[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 66: 5 /***/ ((module) => { 6 7 "use strict"; 8 9 10 var isMergeableObject = function isMergeableObject(value) { 11 return isNonNullObject(value) 12 && !isSpecial(value) 13 }; 14 15 function isNonNullObject(value) { 16 return !!value && typeof value === 'object' 17 } 18 19 function isSpecial(value) { 20 var stringValue = Object.prototype.toString.call(value); 21 22 return stringValue === '[object RegExp]' 23 || stringValue === '[object Date]' 24 || isReactElement(value) 25 } 26 27 // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 28 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; 29 var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; 30 31 function isReactElement(value) { 32 return value.$$typeof === REACT_ELEMENT_TYPE 33 } 34 35 function emptyTarget(val) { 36 return Array.isArray(val) ? [] : {} 37 } 38 39 function cloneUnlessOtherwiseSpecified(value, options) { 40 return (options.clone !== false && options.isMergeableObject(value)) 41 ? deepmerge(emptyTarget(value), value, options) 42 : value 43 } 44 45 function defaultArrayMerge(target, source, options) { 46 return target.concat(source).map(function(element) { 47 return cloneUnlessOtherwiseSpecified(element, options) 48 }) 49 } 50 51 function getMergeFunction(key, options) { 52 if (!options.customMerge) { 53 return deepmerge 54 } 55 var customMerge = options.customMerge(key); 56 return typeof customMerge === 'function' ? customMerge : deepmerge 57 } 58 59 function getEnumerableOwnPropertySymbols(target) { 60 return Object.getOwnPropertySymbols 61 ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 62 return Object.propertyIsEnumerable.call(target, symbol) 63 }) 64 : [] 65 } 66 67 function getKeys(target) { 68 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) 69 } 70 71 function propertyIsOnObject(object, property) { 72 try { 73 return property in object 74 } catch(_) { 75 return false 76 } 77 } 78 79 // Protects from prototype poisoning and unexpected merging up the prototype chain. 80 function propertyIsUnsafe(target, key) { 81 return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, 82 && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, 83 && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. 84 } 85 86 function mergeObject(target, source, options) { 87 var destination = {}; 88 if (options.isMergeableObject(target)) { 89 getKeys(target).forEach(function(key) { 90 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 91 }); 92 } 93 getKeys(source).forEach(function(key) { 94 if (propertyIsUnsafe(target, key)) { 95 return 96 } 97 98 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 99 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 100 } else { 101 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 102 } 103 }); 104 return destination 105 } 106 107 function deepmerge(target, source, options) { 108 options = options || {}; 109 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 110 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 111 // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() 112 // implementations can use it. The caller may not replace it. 113 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 114 115 var sourceIsArray = Array.isArray(source); 116 var targetIsArray = Array.isArray(target); 117 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 118 119 if (!sourceAndTargetTypesMatch) { 120 return cloneUnlessOtherwiseSpecified(source, options) 121 } else if (sourceIsArray) { 122 return options.arrayMerge(target, source, options) 123 } else { 124 return mergeObject(target, source, options) 125 } 126 } 127 128 deepmerge.all = function deepmergeAll(array, options) { 129 if (!Array.isArray(array)) { 130 throw new Error('first argument should be an array') 131 } 132 133 return array.reduce(function(prev, next) { 134 return deepmerge(prev, next, options) 135 }, {}) 136 }; 137 138 var deepmerge_1 = deepmerge; 139 140 module.exports = deepmerge_1; 141 142 143 /***/ }), 144 145 /***/ 83: 146 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 147 148 "use strict"; 149 /** 150 * @license React 151 * use-sync-external-store-shim.production.js 152 * 153 * Copyright (c) Meta Platforms, Inc. and affiliates. 154 * 155 * This source code is licensed under the MIT license found in the 156 * LICENSE file in the root directory of this source tree. 157 */ 158 159 160 var React = __webpack_require__(1609); 161 function is(x, y) { 162 return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); 163 } 164 var objectIs = "function" === typeof Object.is ? Object.is : is, 165 useState = React.useState, 166 useEffect = React.useEffect, 167 useLayoutEffect = React.useLayoutEffect, 168 useDebugValue = React.useDebugValue; 169 function useSyncExternalStore$2(subscribe, getSnapshot) { 170 var value = getSnapshot(), 171 _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }), 172 inst = _useState[0].inst, 173 forceUpdate = _useState[1]; 174 useLayoutEffect( 175 function () { 176 inst.value = value; 177 inst.getSnapshot = getSnapshot; 178 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 179 }, 180 [subscribe, value, getSnapshot] 181 ); 182 useEffect( 183 function () { 184 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 185 return subscribe(function () { 186 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 187 }); 188 }, 189 [subscribe] 190 ); 191 useDebugValue(value); 192 return value; 193 } 194 function checkIfSnapshotChanged(inst) { 195 var latestGetSnapshot = inst.getSnapshot; 196 inst = inst.value; 197 try { 198 var nextValue = latestGetSnapshot(); 199 return !objectIs(inst, nextValue); 200 } catch (error) { 201 return !0; 202 } 203 } 204 function useSyncExternalStore$1(subscribe, getSnapshot) { 205 return getSnapshot(); 206 } 207 var shim = 208 "undefined" === typeof window || 209 "undefined" === typeof window.document || 210 "undefined" === typeof window.document.createElement 211 ? useSyncExternalStore$1 212 : useSyncExternalStore$2; 213 exports.useSyncExternalStore = 214 void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim; 215 216 217 /***/ }), 218 219 /***/ 422: 220 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 221 222 "use strict"; 223 224 225 if (true) { 226 module.exports = __webpack_require__(83); 227 } else {} 228 229 230 /***/ }), 231 232 /***/ 1233: 233 /***/ ((module) => { 234 235 "use strict"; 236 module.exports = window["wp"]["preferences"]; 237 238 /***/ }), 239 240 /***/ 1609: 241 /***/ ((module) => { 242 243 "use strict"; 244 module.exports = window["React"]; 245 246 /***/ }), 247 248 /***/ 4660: 249 /***/ ((module) => { 250 251 /** 252 * Credits: 253 * 254 * lib-font 255 * https://github.com/Pomax/lib-font 256 * https://github.com/Pomax/lib-font/blob/master/lib/inflate.js 257 * 258 * The MIT License (MIT) 259 * 260 * Copyright (c) 2020 pomax@nihongoresources.com 261 * 262 * Permission is hereby granted, free of charge, to any person obtaining a copy 263 * of this software and associated documentation files (the "Software"), to deal 264 * in the Software without restriction, including without limitation the rights 265 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 266 * copies of the Software, and to permit persons to whom the Software is 267 * furnished to do so, subject to the following conditions: 268 * 269 * The above copyright notice and this permission notice shall be included in all 270 * copies or substantial portions of the Software. 271 * 272 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 273 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 274 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 275 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 276 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 277 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 278 * SOFTWARE. 279 */ 280 281 /* eslint eslint-comments/no-unlimited-disable: 0 */ 282 /* eslint-disable */ 283 /* pako 1.0.10 nodeca/pako */(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 284 'use strict'; 285 286 287 var TYPED_OK = (typeof Uint8Array !== 'undefined') && 288 (typeof Uint16Array !== 'undefined') && 289 (typeof Int32Array !== 'undefined'); 290 291 function _has(obj, key) { 292 return Object.prototype.hasOwnProperty.call(obj, key); 293 } 294 295 exports.assign = function (obj /*from1, from2, from3, ...*/) { 296 var sources = Array.prototype.slice.call(arguments, 1); 297 while (sources.length) { 298 var source = sources.shift(); 299 if (!source) { continue; } 300 301 if (typeof source !== 'object') { 302 throw new TypeError(source + 'must be non-object'); 303 } 304 305 for (var p in source) { 306 if (_has(source, p)) { 307 obj[p] = source[p]; 308 } 309 } 310 } 311 312 return obj; 313 }; 314 315 316 // reduce buffer size, avoiding mem copy 317 exports.shrinkBuf = function (buf, size) { 318 if (buf.length === size) { return buf; } 319 if (buf.subarray) { return buf.subarray(0, size); } 320 buf.length = size; 321 return buf; 322 }; 323 324 325 var fnTyped = { 326 arraySet: function (dest, src, src_offs, len, dest_offs) { 327 if (src.subarray && dest.subarray) { 328 dest.set(src.subarray(src_offs, src_offs + len), dest_offs); 329 return; 330 } 331 // Fallback to ordinary array 332 for (var i = 0; i < len; i++) { 333 dest[dest_offs + i] = src[src_offs + i]; 334 } 335 }, 336 // Join array of chunks to single array. 337 flattenChunks: function (chunks) { 338 var i, l, len, pos, chunk, result; 339 340 // calculate data length 341 len = 0; 342 for (i = 0, l = chunks.length; i < l; i++) { 343 len += chunks[i].length; 344 } 345 346 // join chunks 347 result = new Uint8Array(len); 348 pos = 0; 349 for (i = 0, l = chunks.length; i < l; i++) { 350 chunk = chunks[i]; 351 result.set(chunk, pos); 352 pos += chunk.length; 353 } 354 355 return result; 356 } 357 }; 358 359 var fnUntyped = { 360 arraySet: function (dest, src, src_offs, len, dest_offs) { 361 for (var i = 0; i < len; i++) { 362 dest[dest_offs + i] = src[src_offs + i]; 363 } 364 }, 365 // Join array of chunks to single array. 366 flattenChunks: function (chunks) { 367 return [].concat.apply([], chunks); 368 } 369 }; 370 371 372 // Enable/Disable typed arrays use, for testing 373 // 374 exports.setTyped = function (on) { 375 if (on) { 376 exports.Buf8 = Uint8Array; 377 exports.Buf16 = Uint16Array; 378 exports.Buf32 = Int32Array; 379 exports.assign(exports, fnTyped); 380 } else { 381 exports.Buf8 = Array; 382 exports.Buf16 = Array; 383 exports.Buf32 = Array; 384 exports.assign(exports, fnUntyped); 385 } 386 }; 387 388 exports.setTyped(TYPED_OK); 389 390 },{}],2:[function(require,module,exports){ 391 // String encode/decode helpers 392 'use strict'; 393 394 395 var utils = require('./common'); 396 397 398 // Quick check if we can use fast array to bin string conversion 399 // 400 // - apply(Array) can fail on Android 2.2 401 // - apply(Uint8Array) can fail on iOS 5.1 Safari 402 // 403 var STR_APPLY_OK = true; 404 var STR_APPLY_UIA_OK = true; 405 406 try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } 407 try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } 408 409 410 // Table with utf8 lengths (calculated by first byte of sequence) 411 // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, 412 // because max possible codepoint is 0x10ffff 413 var _utf8len = new utils.Buf8(256); 414 for (var q = 0; q < 256; q++) { 415 _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); 416 } 417 _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start 418 419 420 // convert string to array (typed, when possible) 421 exports.string2buf = function (str) { 422 var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; 423 424 // count binary size 425 for (m_pos = 0; m_pos < str_len; m_pos++) { 426 c = str.charCodeAt(m_pos); 427 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 428 c2 = str.charCodeAt(m_pos + 1); 429 if ((c2 & 0xfc00) === 0xdc00) { 430 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 431 m_pos++; 432 } 433 } 434 buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; 435 } 436 437 // allocate buffer 438 buf = new utils.Buf8(buf_len); 439 440 // convert 441 for (i = 0, m_pos = 0; i < buf_len; m_pos++) { 442 c = str.charCodeAt(m_pos); 443 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 444 c2 = str.charCodeAt(m_pos + 1); 445 if ((c2 & 0xfc00) === 0xdc00) { 446 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 447 m_pos++; 448 } 449 } 450 if (c < 0x80) { 451 /* one byte */ 452 buf[i++] = c; 453 } else if (c < 0x800) { 454 /* two bytes */ 455 buf[i++] = 0xC0 | (c >>> 6); 456 buf[i++] = 0x80 | (c & 0x3f); 457 } else if (c < 0x10000) { 458 /* three bytes */ 459 buf[i++] = 0xE0 | (c >>> 12); 460 buf[i++] = 0x80 | (c >>> 6 & 0x3f); 461 buf[i++] = 0x80 | (c & 0x3f); 462 } else { 463 /* four bytes */ 464 buf[i++] = 0xf0 | (c >>> 18); 465 buf[i++] = 0x80 | (c >>> 12 & 0x3f); 466 buf[i++] = 0x80 | (c >>> 6 & 0x3f); 467 buf[i++] = 0x80 | (c & 0x3f); 468 } 469 } 470 471 return buf; 472 }; 473 474 // Helper (used in 2 places) 475 function buf2binstring(buf, len) { 476 // On Chrome, the arguments in a function call that are allowed is `65534`. 477 // If the length of the buffer is smaller than that, we can use this optimization, 478 // otherwise we will take a slower path. 479 if (len < 65534) { 480 if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { 481 return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); 482 } 483 } 484 485 var result = ''; 486 for (var i = 0; i < len; i++) { 487 result += String.fromCharCode(buf[i]); 488 } 489 return result; 490 } 491 492 493 // Convert byte array to binary string 494 exports.buf2binstring = function (buf) { 495 return buf2binstring(buf, buf.length); 496 }; 497 498 499 // Convert binary string (typed, when possible) 500 exports.binstring2buf = function (str) { 501 var buf = new utils.Buf8(str.length); 502 for (var i = 0, len = buf.length; i < len; i++) { 503 buf[i] = str.charCodeAt(i); 504 } 505 return buf; 506 }; 507 508 509 // convert array to string 510 exports.buf2string = function (buf, max) { 511 var i, out, c, c_len; 512 var len = max || buf.length; 513 514 // Reserve max possible length (2 words per char) 515 // NB: by unknown reasons, Array is significantly faster for 516 // String.fromCharCode.apply than Uint16Array. 517 var utf16buf = new Array(len * 2); 518 519 for (out = 0, i = 0; i < len;) { 520 c = buf[i++]; 521 // quick process ascii 522 if (c < 0x80) { utf16buf[out++] = c; continue; } 523 524 c_len = _utf8len[c]; 525 // skip 5 & 6 byte codes 526 if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } 527 528 // apply mask on first byte 529 c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; 530 // join the rest 531 while (c_len > 1 && i < len) { 532 c = (c << 6) | (buf[i++] & 0x3f); 533 c_len--; 534 } 535 536 // terminated by end of string? 537 if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } 538 539 if (c < 0x10000) { 540 utf16buf[out++] = c; 541 } else { 542 c -= 0x10000; 543 utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); 544 utf16buf[out++] = 0xdc00 | (c & 0x3ff); 545 } 546 } 547 548 return buf2binstring(utf16buf, out); 549 }; 550 551 552 // Calculate max possible position in utf8 buffer, 553 // that will not break sequence. If that's not possible 554 // - (very small limits) return max size as is. 555 // 556 // buf[] - utf8 bytes array 557 // max - length limit (mandatory); 558 exports.utf8border = function (buf, max) { 559 var pos; 560 561 max = max || buf.length; 562 if (max > buf.length) { max = buf.length; } 563 564 // go back from last position, until start of sequence found 565 pos = max - 1; 566 while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } 567 568 // Very small and broken sequence, 569 // return max, because we should return something anyway. 570 if (pos < 0) { return max; } 571 572 // If we came to start of buffer - that means buffer is too small, 573 // return max too. 574 if (pos === 0) { return max; } 575 576 return (pos + _utf8len[buf[pos]] > max) ? pos : max; 577 }; 578 579 },{"./common":1}],3:[function(require,module,exports){ 580 'use strict'; 581 582 // Note: adler32 takes 12% for level 0 and 2% for level 6. 583 // It isn't worth it to make additional optimizations as in original. 584 // Small size is preferable. 585 586 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 587 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 588 // 589 // This software is provided 'as-is', without any express or implied 590 // warranty. In no event will the authors be held liable for any damages 591 // arising from the use of this software. 592 // 593 // Permission is granted to anyone to use this software for any purpose, 594 // including commercial applications, and to alter it and redistribute it 595 // freely, subject to the following restrictions: 596 // 597 // 1. The origin of this software must not be misrepresented; you must not 598 // claim that you wrote the original software. If you use this software 599 // in a product, an acknowledgment in the product documentation would be 600 // appreciated but is not required. 601 // 2. Altered source versions must be plainly marked as such, and must not be 602 // misrepresented as being the original software. 603 // 3. This notice may not be removed or altered from any source distribution. 604 605 function adler32(adler, buf, len, pos) { 606 var s1 = (adler & 0xffff) |0, 607 s2 = ((adler >>> 16) & 0xffff) |0, 608 n = 0; 609 610 while (len !== 0) { 611 // Set limit ~ twice less than 5552, to keep 612 // s2 in 31-bits, because we force signed ints. 613 // in other case %= will fail. 614 n = len > 2000 ? 2000 : len; 615 len -= n; 616 617 do { 618 s1 = (s1 + buf[pos++]) |0; 619 s2 = (s2 + s1) |0; 620 } while (--n); 621 622 s1 %= 65521; 623 s2 %= 65521; 624 } 625 626 return (s1 | (s2 << 16)) |0; 627 } 628 629 630 module.exports = adler32; 631 632 },{}],4:[function(require,module,exports){ 633 'use strict'; 634 635 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 636 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 637 // 638 // This software is provided 'as-is', without any express or implied 639 // warranty. In no event will the authors be held liable for any damages 640 // arising from the use of this software. 641 // 642 // Permission is granted to anyone to use this software for any purpose, 643 // including commercial applications, and to alter it and redistribute it 644 // freely, subject to the following restrictions: 645 // 646 // 1. The origin of this software must not be misrepresented; you must not 647 // claim that you wrote the original software. If you use this software 648 // in a product, an acknowledgment in the product documentation would be 649 // appreciated but is not required. 650 // 2. Altered source versions must be plainly marked as such, and must not be 651 // misrepresented as being the original software. 652 // 3. This notice may not be removed or altered from any source distribution. 653 654 module.exports = { 655 656 /* Allowed flush values; see deflate() and inflate() below for details */ 657 Z_NO_FLUSH: 0, 658 Z_PARTIAL_FLUSH: 1, 659 Z_SYNC_FLUSH: 2, 660 Z_FULL_FLUSH: 3, 661 Z_FINISH: 4, 662 Z_BLOCK: 5, 663 Z_TREES: 6, 664 665 /* Return codes for the compression/decompression functions. Negative values 666 * are errors, positive values are used for special but normal events. 667 */ 668 Z_OK: 0, 669 Z_STREAM_END: 1, 670 Z_NEED_DICT: 2, 671 Z_ERRNO: -1, 672 Z_STREAM_ERROR: -2, 673 Z_DATA_ERROR: -3, 674 //Z_MEM_ERROR: -4, 675 Z_BUF_ERROR: -5, 676 //Z_VERSION_ERROR: -6, 677 678 /* compression levels */ 679 Z_NO_COMPRESSION: 0, 680 Z_BEST_SPEED: 1, 681 Z_BEST_COMPRESSION: 9, 682 Z_DEFAULT_COMPRESSION: -1, 683 684 685 Z_FILTERED: 1, 686 Z_HUFFMAN_ONLY: 2, 687 Z_RLE: 3, 688 Z_FIXED: 4, 689 Z_DEFAULT_STRATEGY: 0, 690 691 /* Possible values of the data_type field (though see inflate()) */ 692 Z_BINARY: 0, 693 Z_TEXT: 1, 694 //Z_ASCII: 1, // = Z_TEXT (deprecated) 695 Z_UNKNOWN: 2, 696 697 /* The deflate compression method */ 698 Z_DEFLATED: 8 699 //Z_NULL: null // Use -1 or null inline, depending on var type 700 }; 701 702 },{}],5:[function(require,module,exports){ 703 'use strict'; 704 705 // Note: we can't get significant speed boost here. 706 // So write code to minimize size - no pregenerated tables 707 // and array tools dependencies. 708 709 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 710 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 711 // 712 // This software is provided 'as-is', without any express or implied 713 // warranty. In no event will the authors be held liable for any damages 714 // arising from the use of this software. 715 // 716 // Permission is granted to anyone to use this software for any purpose, 717 // including commercial applications, and to alter it and redistribute it 718 // freely, subject to the following restrictions: 719 // 720 // 1. The origin of this software must not be misrepresented; you must not 721 // claim that you wrote the original software. If you use this software 722 // in a product, an acknowledgment in the product documentation would be 723 // appreciated but is not required. 724 // 2. Altered source versions must be plainly marked as such, and must not be 725 // misrepresented as being the original software. 726 // 3. This notice may not be removed or altered from any source distribution. 727 728 // Use ordinary array, since untyped makes no boost here 729 function makeTable() { 730 var c, table = []; 731 732 for (var n = 0; n < 256; n++) { 733 c = n; 734 for (var k = 0; k < 8; k++) { 735 c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); 736 } 737 table[n] = c; 738 } 739 740 return table; 741 } 742 743 // Create table on load. Just 255 signed longs. Not a problem. 744 var crcTable = makeTable(); 745 746 747 function crc32(crc, buf, len, pos) { 748 var t = crcTable, 749 end = pos + len; 750 751 crc ^= -1; 752 753 for (var i = pos; i < end; i++) { 754 crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; 755 } 756 757 return (crc ^ (-1)); // >>> 0; 758 } 759 760 761 module.exports = crc32; 762 763 },{}],6:[function(require,module,exports){ 764 'use strict'; 765 766 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 767 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 768 // 769 // This software is provided 'as-is', without any express or implied 770 // warranty. In no event will the authors be held liable for any damages 771 // arising from the use of this software. 772 // 773 // Permission is granted to anyone to use this software for any purpose, 774 // including commercial applications, and to alter it and redistribute it 775 // freely, subject to the following restrictions: 776 // 777 // 1. The origin of this software must not be misrepresented; you must not 778 // claim that you wrote the original software. If you use this software 779 // in a product, an acknowledgment in the product documentation would be 780 // appreciated but is not required. 781 // 2. Altered source versions must be plainly marked as such, and must not be 782 // misrepresented as being the original software. 783 // 3. This notice may not be removed or altered from any source distribution. 784 785 function GZheader() { 786 /* true if compressed data believed to be text */ 787 this.text = 0; 788 /* modification time */ 789 this.time = 0; 790 /* extra flags (not used when writing a gzip file) */ 791 this.xflags = 0; 792 /* operating system */ 793 this.os = 0; 794 /* pointer to extra field or Z_NULL if none */ 795 this.extra = null; 796 /* extra field length (valid if extra != Z_NULL) */ 797 this.extra_len = 0; // Actually, we don't need it in JS, 798 // but leave for few code modifications 799 800 // 801 // Setup limits is not necessary because in js we should not preallocate memory 802 // for inflate use constant limit in 65536 bytes 803 // 804 805 /* space at extra (only when reading header) */ 806 // this.extra_max = 0; 807 /* pointer to zero-terminated file name or Z_NULL */ 808 this.name = ''; 809 /* space at name (only when reading header) */ 810 // this.name_max = 0; 811 /* pointer to zero-terminated comment or Z_NULL */ 812 this.comment = ''; 813 /* space at comment (only when reading header) */ 814 // this.comm_max = 0; 815 /* true if there was or will be a header crc */ 816 this.hcrc = 0; 817 /* true when done reading gzip header (not used when writing a gzip file) */ 818 this.done = false; 819 } 820 821 module.exports = GZheader; 822 823 },{}],7:[function(require,module,exports){ 824 'use strict'; 825 826 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 827 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 828 // 829 // This software is provided 'as-is', without any express or implied 830 // warranty. In no event will the authors be held liable for any damages 831 // arising from the use of this software. 832 // 833 // Permission is granted to anyone to use this software for any purpose, 834 // including commercial applications, and to alter it and redistribute it 835 // freely, subject to the following restrictions: 836 // 837 // 1. The origin of this software must not be misrepresented; you must not 838 // claim that you wrote the original software. If you use this software 839 // in a product, an acknowledgment in the product documentation would be 840 // appreciated but is not required. 841 // 2. Altered source versions must be plainly marked as such, and must not be 842 // misrepresented as being the original software. 843 // 3. This notice may not be removed or altered from any source distribution. 844 845 // See state defs from inflate.js 846 var BAD = 30; /* got a data error -- remain here until reset */ 847 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ 848 849 /* 850 Decode literal, length, and distance codes and write out the resulting 851 literal and match bytes until either not enough input or output is 852 available, an end-of-block is encountered, or a data error is encountered. 853 When large enough input and output buffers are supplied to inflate(), for 854 example, a 16K input buffer and a 64K output buffer, more than 95% of the 855 inflate execution time is spent in this routine. 856 857 Entry assumptions: 858 859 state.mode === LEN 860 strm.avail_in >= 6 861 strm.avail_out >= 258 862 start >= strm.avail_out 863 state.bits < 8 864 865 On return, state.mode is one of: 866 867 LEN -- ran out of enough output space or enough available input 868 TYPE -- reached end of block code, inflate() to interpret next block 869 BAD -- error in block data 870 871 Notes: 872 873 - The maximum input bits used by a length/distance pair is 15 bits for the 874 length code, 5 bits for the length extra, 15 bits for the distance code, 875 and 13 bits for the distance extra. This totals 48 bits, or six bytes. 876 Therefore if strm.avail_in >= 6, then there is enough input to avoid 877 checking for available input while decoding. 878 879 - The maximum bytes that a single length/distance pair can output is 258 880 bytes, which is the maximum length that can be coded. inflate_fast() 881 requires strm.avail_out >= 258 for each loop to avoid checking for 882 output space. 883 */ 884 module.exports = function inflate_fast(strm, start) { 885 var state; 886 var _in; /* local strm.input */ 887 var last; /* have enough input while in < last */ 888 var _out; /* local strm.output */ 889 var beg; /* inflate()'s initial strm.output */ 890 var end; /* while out < end, enough space available */ 891 //#ifdef INFLATE_STRICT 892 var dmax; /* maximum distance from zlib header */ 893 //#endif 894 var wsize; /* window size or zero if not using window */ 895 var whave; /* valid bytes in the window */ 896 var wnext; /* window write index */ 897 // Use `s_window` instead `window`, avoid conflict with instrumentation tools 898 var s_window; /* allocated sliding window, if wsize != 0 */ 899 var hold; /* local strm.hold */ 900 var bits; /* local strm.bits */ 901 var lcode; /* local strm.lencode */ 902 var dcode; /* local strm.distcode */ 903 var lmask; /* mask for first level of length codes */ 904 var dmask; /* mask for first level of distance codes */ 905 var here; /* retrieved table entry */ 906 var op; /* code bits, operation, extra bits, or */ 907 /* window position, window bytes to copy */ 908 var len; /* match length, unused bytes */ 909 var dist; /* match distance */ 910 var from; /* where to copy match from */ 911 var from_source; 912 913 914 var input, output; // JS specific, because we have no pointers 915 916 /* copy state to local variables */ 917 state = strm.state; 918 //here = state.here; 919 _in = strm.next_in; 920 input = strm.input; 921 last = _in + (strm.avail_in - 5); 922 _out = strm.next_out; 923 output = strm.output; 924 beg = _out - (start - strm.avail_out); 925 end = _out + (strm.avail_out - 257); 926 //#ifdef INFLATE_STRICT 927 dmax = state.dmax; 928 //#endif 929 wsize = state.wsize; 930 whave = state.whave; 931 wnext = state.wnext; 932 s_window = state.window; 933 hold = state.hold; 934 bits = state.bits; 935 lcode = state.lencode; 936 dcode = state.distcode; 937 lmask = (1 << state.lenbits) - 1; 938 dmask = (1 << state.distbits) - 1; 939 940 941 /* decode literals and length/distances until end-of-block or not enough 942 input data or output space */ 943 944 top: 945 do { 946 if (bits < 15) { 947 hold += input[_in++] << bits; 948 bits += 8; 949 hold += input[_in++] << bits; 950 bits += 8; 951 } 952 953 here = lcode[hold & lmask]; 954 955 dolen: 956 for (;;) { // Goto emulation 957 op = here >>> 24/*here.bits*/; 958 hold >>>= op; 959 bits -= op; 960 op = (here >>> 16) & 0xff/*here.op*/; 961 if (op === 0) { /* literal */ 962 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? 963 // "inflate: literal '%c'\n" : 964 // "inflate: literal 0x%02x\n", here.val)); 965 output[_out++] = here & 0xffff/*here.val*/; 966 } 967 else if (op & 16) { /* length base */ 968 len = here & 0xffff/*here.val*/; 969 op &= 15; /* number of extra bits */ 970 if (op) { 971 if (bits < op) { 972 hold += input[_in++] << bits; 973 bits += 8; 974 } 975 len += hold & ((1 << op) - 1); 976 hold >>>= op; 977 bits -= op; 978 } 979 //Tracevv((stderr, "inflate: length %u\n", len)); 980 if (bits < 15) { 981 hold += input[_in++] << bits; 982 bits += 8; 983 hold += input[_in++] << bits; 984 bits += 8; 985 } 986 here = dcode[hold & dmask]; 987 988 dodist: 989 for (;;) { // goto emulation 990 op = here >>> 24/*here.bits*/; 991 hold >>>= op; 992 bits -= op; 993 op = (here >>> 16) & 0xff/*here.op*/; 994 995 if (op & 16) { /* distance base */ 996 dist = here & 0xffff/*here.val*/; 997 op &= 15; /* number of extra bits */ 998 if (bits < op) { 999 hold += input[_in++] << bits; 1000 bits += 8; 1001 if (bits < op) { 1002 hold += input[_in++] << bits; 1003 bits += 8; 1004 } 1005 } 1006 dist += hold & ((1 << op) - 1); 1007 //#ifdef INFLATE_STRICT 1008 if (dist > dmax) { 1009 strm.msg = 'invalid distance too far back'; 1010 state.mode = BAD; 1011 break top; 1012 } 1013 //#endif 1014 hold >>>= op; 1015 bits -= op; 1016 //Tracevv((stderr, "inflate: distance %u\n", dist)); 1017 op = _out - beg; /* max distance in output */ 1018 if (dist > op) { /* see if copy from window */ 1019 op = dist - op; /* distance back in window */ 1020 if (op > whave) { 1021 if (state.sane) { 1022 strm.msg = 'invalid distance too far back'; 1023 state.mode = BAD; 1024 break top; 1025 } 1026 1027 // (!) This block is disabled in zlib defaults, 1028 // don't enable it for binary compatibility 1029 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR 1030 // if (len <= op - whave) { 1031 // do { 1032 // output[_out++] = 0; 1033 // } while (--len); 1034 // continue top; 1035 // } 1036 // len -= op - whave; 1037 // do { 1038 // output[_out++] = 0; 1039 // } while (--op > whave); 1040 // if (op === 0) { 1041 // from = _out - dist; 1042 // do { 1043 // output[_out++] = output[from++]; 1044 // } while (--len); 1045 // continue top; 1046 // } 1047 //#endif 1048 } 1049 from = 0; // window index 1050 from_source = s_window; 1051 if (wnext === 0) { /* very common case */ 1052 from += wsize - op; 1053 if (op < len) { /* some from window */ 1054 len -= op; 1055 do { 1056 output[_out++] = s_window[from++]; 1057 } while (--op); 1058 from = _out - dist; /* rest from output */ 1059 from_source = output; 1060 } 1061 } 1062 else if (wnext < op) { /* wrap around window */ 1063 from += wsize + wnext - op; 1064 op -= wnext; 1065 if (op < len) { /* some from end of window */ 1066 len -= op; 1067 do { 1068 output[_out++] = s_window[from++]; 1069 } while (--op); 1070 from = 0; 1071 if (wnext < len) { /* some from start of window */ 1072 op = wnext; 1073 len -= op; 1074 do { 1075 output[_out++] = s_window[from++]; 1076 } while (--op); 1077 from = _out - dist; /* rest from output */ 1078 from_source = output; 1079 } 1080 } 1081 } 1082 else { /* contiguous in window */ 1083 from += wnext - op; 1084 if (op < len) { /* some from window */ 1085 len -= op; 1086 do { 1087 output[_out++] = s_window[from++]; 1088 } while (--op); 1089 from = _out - dist; /* rest from output */ 1090 from_source = output; 1091 } 1092 } 1093 while (len > 2) { 1094 output[_out++] = from_source[from++]; 1095 output[_out++] = from_source[from++]; 1096 output[_out++] = from_source[from++]; 1097 len -= 3; 1098 } 1099 if (len) { 1100 output[_out++] = from_source[from++]; 1101 if (len > 1) { 1102 output[_out++] = from_source[from++]; 1103 } 1104 } 1105 } 1106 else { 1107 from = _out - dist; /* copy direct from output */ 1108 do { /* minimum length is three */ 1109 output[_out++] = output[from++]; 1110 output[_out++] = output[from++]; 1111 output[_out++] = output[from++]; 1112 len -= 3; 1113 } while (len > 2); 1114 if (len) { 1115 output[_out++] = output[from++]; 1116 if (len > 1) { 1117 output[_out++] = output[from++]; 1118 } 1119 } 1120 } 1121 } 1122 else if ((op & 64) === 0) { /* 2nd level distance code */ 1123 here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 1124 continue dodist; 1125 } 1126 else { 1127 strm.msg = 'invalid distance code'; 1128 state.mode = BAD; 1129 break top; 1130 } 1131 1132 break; // need to emulate goto via "continue" 1133 } 1134 } 1135 else if ((op & 64) === 0) { /* 2nd level length code */ 1136 here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 1137 continue dolen; 1138 } 1139 else if (op & 32) { /* end-of-block */ 1140 //Tracevv((stderr, "inflate: end of block\n")); 1141 state.mode = TYPE; 1142 break top; 1143 } 1144 else { 1145 strm.msg = 'invalid literal/length code'; 1146 state.mode = BAD; 1147 break top; 1148 } 1149 1150 break; // need to emulate goto via "continue" 1151 } 1152 } while (_in < last && _out < end); 1153 1154 /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ 1155 len = bits >> 3; 1156 _in -= len; 1157 bits -= len << 3; 1158 hold &= (1 << bits) - 1; 1159 1160 /* update state and return */ 1161 strm.next_in = _in; 1162 strm.next_out = _out; 1163 strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); 1164 strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); 1165 state.hold = hold; 1166 state.bits = bits; 1167 return; 1168 }; 1169 1170 },{}],8:[function(require,module,exports){ 1171 'use strict'; 1172 1173 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 1174 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 1175 // 1176 // This software is provided 'as-is', without any express or implied 1177 // warranty. In no event will the authors be held liable for any damages 1178 // arising from the use of this software. 1179 // 1180 // Permission is granted to anyone to use this software for any purpose, 1181 // including commercial applications, and to alter it and redistribute it 1182 // freely, subject to the following restrictions: 1183 // 1184 // 1. The origin of this software must not be misrepresented; you must not 1185 // claim that you wrote the original software. If you use this software 1186 // in a product, an acknowledgment in the product documentation would be 1187 // appreciated but is not required. 1188 // 2. Altered source versions must be plainly marked as such, and must not be 1189 // misrepresented as being the original software. 1190 // 3. This notice may not be removed or altered from any source distribution. 1191 1192 var utils = require('../utils/common'); 1193 var adler32 = require('./adler32'); 1194 var crc32 = require('./crc32'); 1195 var inflate_fast = require('./inffast'); 1196 var inflate_table = require('./inftrees'); 1197 1198 var CODES = 0; 1199 var LENS = 1; 1200 var DISTS = 2; 1201 1202 /* Public constants ==========================================================*/ 1203 /* ===========================================================================*/ 1204 1205 1206 /* Allowed flush values; see deflate() and inflate() below for details */ 1207 //var Z_NO_FLUSH = 0; 1208 //var Z_PARTIAL_FLUSH = 1; 1209 //var Z_SYNC_FLUSH = 2; 1210 //var Z_FULL_FLUSH = 3; 1211 var Z_FINISH = 4; 1212 var Z_BLOCK = 5; 1213 var Z_TREES = 6; 1214 1215 1216 /* Return codes for the compression/decompression functions. Negative values 1217 * are errors, positive values are used for special but normal events. 1218 */ 1219 var Z_OK = 0; 1220 var Z_STREAM_END = 1; 1221 var Z_NEED_DICT = 2; 1222 //var Z_ERRNO = -1; 1223 var Z_STREAM_ERROR = -2; 1224 var Z_DATA_ERROR = -3; 1225 var Z_MEM_ERROR = -4; 1226 var Z_BUF_ERROR = -5; 1227 //var Z_VERSION_ERROR = -6; 1228 1229 /* The deflate compression method */ 1230 var Z_DEFLATED = 8; 1231 1232 1233 /* STATES ====================================================================*/ 1234 /* ===========================================================================*/ 1235 1236 1237 var HEAD = 1; /* i: waiting for magic header */ 1238 var FLAGS = 2; /* i: waiting for method and flags (gzip) */ 1239 var TIME = 3; /* i: waiting for modification time (gzip) */ 1240 var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ 1241 var EXLEN = 5; /* i: waiting for extra length (gzip) */ 1242 var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ 1243 var NAME = 7; /* i: waiting for end of file name (gzip) */ 1244 var COMMENT = 8; /* i: waiting for end of comment (gzip) */ 1245 var HCRC = 9; /* i: waiting for header crc (gzip) */ 1246 var DICTID = 10; /* i: waiting for dictionary check value */ 1247 var DICT = 11; /* waiting for inflateSetDictionary() call */ 1248 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ 1249 var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ 1250 var STORED = 14; /* i: waiting for stored size (length and complement) */ 1251 var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ 1252 var COPY = 16; /* i/o: waiting for input or output to copy stored block */ 1253 var TABLE = 17; /* i: waiting for dynamic block table lengths */ 1254 var LENLENS = 18; /* i: waiting for code length code lengths */ 1255 var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ 1256 var LEN_ = 20; /* i: same as LEN below, but only first time in */ 1257 var LEN = 21; /* i: waiting for length/lit/eob code */ 1258 var LENEXT = 22; /* i: waiting for length extra bits */ 1259 var DIST = 23; /* i: waiting for distance code */ 1260 var DISTEXT = 24; /* i: waiting for distance extra bits */ 1261 var MATCH = 25; /* o: waiting for output space to copy string */ 1262 var LIT = 26; /* o: waiting for output space to write literal */ 1263 var CHECK = 27; /* i: waiting for 32-bit check value */ 1264 var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ 1265 var DONE = 29; /* finished check, done -- remain here until reset */ 1266 var BAD = 30; /* got a data error -- remain here until reset */ 1267 var MEM = 31; /* got an inflate() memory error -- remain here until reset */ 1268 var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ 1269 1270 /* ===========================================================================*/ 1271 1272 1273 1274 var ENOUGH_LENS = 852; 1275 var ENOUGH_DISTS = 592; 1276 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); 1277 1278 var MAX_WBITS = 15; 1279 /* 32K LZ77 window */ 1280 var DEF_WBITS = MAX_WBITS; 1281 1282 1283 function zswap32(q) { 1284 return (((q >>> 24) & 0xff) + 1285 ((q >>> 8) & 0xff00) + 1286 ((q & 0xff00) << 8) + 1287 ((q & 0xff) << 24)); 1288 } 1289 1290 1291 function InflateState() { 1292 this.mode = 0; /* current inflate mode */ 1293 this.last = false; /* true if processing last block */ 1294 this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ 1295 this.havedict = false; /* true if dictionary provided */ 1296 this.flags = 0; /* gzip header method and flags (0 if zlib) */ 1297 this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ 1298 this.check = 0; /* protected copy of check value */ 1299 this.total = 0; /* protected copy of output count */ 1300 // TODO: may be {} 1301 this.head = null; /* where to save gzip header information */ 1302 1303 /* sliding window */ 1304 this.wbits = 0; /* log base 2 of requested window size */ 1305 this.wsize = 0; /* window size or zero if not using window */ 1306 this.whave = 0; /* valid bytes in the window */ 1307 this.wnext = 0; /* window write index */ 1308 this.window = null; /* allocated sliding window, if needed */ 1309 1310 /* bit accumulator */ 1311 this.hold = 0; /* input bit accumulator */ 1312 this.bits = 0; /* number of bits in "in" */ 1313 1314 /* for string and stored block copying */ 1315 this.length = 0; /* literal or length of data to copy */ 1316 this.offset = 0; /* distance back to copy string from */ 1317 1318 /* for table and code decoding */ 1319 this.extra = 0; /* extra bits needed */ 1320 1321 /* fixed and dynamic code tables */ 1322 this.lencode = null; /* starting table for length/literal codes */ 1323 this.distcode = null; /* starting table for distance codes */ 1324 this.lenbits = 0; /* index bits for lencode */ 1325 this.distbits = 0; /* index bits for distcode */ 1326 1327 /* dynamic table building */ 1328 this.ncode = 0; /* number of code length code lengths */ 1329 this.nlen = 0; /* number of length code lengths */ 1330 this.ndist = 0; /* number of distance code lengths */ 1331 this.have = 0; /* number of code lengths in lens[] */ 1332 this.next = null; /* next available space in codes[] */ 1333 1334 this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ 1335 this.work = new utils.Buf16(288); /* work area for code table building */ 1336 1337 /* 1338 because we don't have pointers in js, we use lencode and distcode directly 1339 as buffers so we don't need codes 1340 */ 1341 //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ 1342 this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ 1343 this.distdyn = null; /* dynamic table for distance codes (JS specific) */ 1344 this.sane = 0; /* if false, allow invalid distance too far */ 1345 this.back = 0; /* bits back of last unprocessed length/lit */ 1346 this.was = 0; /* initial length of match */ 1347 } 1348 1349 function inflateResetKeep(strm) { 1350 var state; 1351 1352 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1353 state = strm.state; 1354 strm.total_in = strm.total_out = state.total = 0; 1355 strm.msg = ''; /*Z_NULL*/ 1356 if (state.wrap) { /* to support ill-conceived Java test suite */ 1357 strm.adler = state.wrap & 1; 1358 } 1359 state.mode = HEAD; 1360 state.last = 0; 1361 state.havedict = 0; 1362 state.dmax = 32768; 1363 state.head = null/*Z_NULL*/; 1364 state.hold = 0; 1365 state.bits = 0; 1366 //state.lencode = state.distcode = state.next = state.codes; 1367 state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); 1368 state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); 1369 1370 state.sane = 1; 1371 state.back = -1; 1372 //Tracev((stderr, "inflate: reset\n")); 1373 return Z_OK; 1374 } 1375 1376 function inflateReset(strm) { 1377 var state; 1378 1379 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1380 state = strm.state; 1381 state.wsize = 0; 1382 state.whave = 0; 1383 state.wnext = 0; 1384 return inflateResetKeep(strm); 1385 1386 } 1387 1388 function inflateReset2(strm, windowBits) { 1389 var wrap; 1390 var state; 1391 1392 /* get the state */ 1393 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1394 state = strm.state; 1395 1396 /* extract wrap request from windowBits parameter */ 1397 if (windowBits < 0) { 1398 wrap = 0; 1399 windowBits = -windowBits; 1400 } 1401 else { 1402 wrap = (windowBits >> 4) + 1; 1403 if (windowBits < 48) { 1404 windowBits &= 15; 1405 } 1406 } 1407 1408 /* set number of window bits, free window if different */ 1409 if (windowBits && (windowBits < 8 || windowBits > 15)) { 1410 return Z_STREAM_ERROR; 1411 } 1412 if (state.window !== null && state.wbits !== windowBits) { 1413 state.window = null; 1414 } 1415 1416 /* update state and reset the rest of it */ 1417 state.wrap = wrap; 1418 state.wbits = windowBits; 1419 return inflateReset(strm); 1420 } 1421 1422 function inflateInit2(strm, windowBits) { 1423 var ret; 1424 var state; 1425 1426 if (!strm) { return Z_STREAM_ERROR; } 1427 //strm.msg = Z_NULL; /* in case we return an error */ 1428 1429 state = new InflateState(); 1430 1431 //if (state === Z_NULL) return Z_MEM_ERROR; 1432 //Tracev((stderr, "inflate: allocated\n")); 1433 strm.state = state; 1434 state.window = null/*Z_NULL*/; 1435 ret = inflateReset2(strm, windowBits); 1436 if (ret !== Z_OK) { 1437 strm.state = null/*Z_NULL*/; 1438 } 1439 return ret; 1440 } 1441 1442 function inflateInit(strm) { 1443 return inflateInit2(strm, DEF_WBITS); 1444 } 1445 1446 1447 /* 1448 Return state with length and distance decoding tables and index sizes set to 1449 fixed code decoding. Normally this returns fixed tables from inffixed.h. 1450 If BUILDFIXED is defined, then instead this routine builds the tables the 1451 first time it's called, and returns those tables the first time and 1452 thereafter. This reduces the size of the code by about 2K bytes, in 1453 exchange for a little execution time. However, BUILDFIXED should not be 1454 used for threaded applications, since the rewriting of the tables and virgin 1455 may not be thread-safe. 1456 */ 1457 var virgin = true; 1458 1459 var lenfix, distfix; // We have no pointers in JS, so keep tables separate 1460 1461 function fixedtables(state) { 1462 /* build fixed huffman tables if first call (may not be thread safe) */ 1463 if (virgin) { 1464 var sym; 1465 1466 lenfix = new utils.Buf32(512); 1467 distfix = new utils.Buf32(32); 1468 1469 /* literal/length table */ 1470 sym = 0; 1471 while (sym < 144) { state.lens[sym++] = 8; } 1472 while (sym < 256) { state.lens[sym++] = 9; } 1473 while (sym < 280) { state.lens[sym++] = 7; } 1474 while (sym < 288) { state.lens[sym++] = 8; } 1475 1476 inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); 1477 1478 /* distance table */ 1479 sym = 0; 1480 while (sym < 32) { state.lens[sym++] = 5; } 1481 1482 inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); 1483 1484 /* do this just once */ 1485 virgin = false; 1486 } 1487 1488 state.lencode = lenfix; 1489 state.lenbits = 9; 1490 state.distcode = distfix; 1491 state.distbits = 5; 1492 } 1493 1494 1495 /* 1496 Update the window with the last wsize (normally 32K) bytes written before 1497 returning. If window does not exist yet, create it. This is only called 1498 when a window is already in use, or when output has been written during this 1499 inflate call, but the end of the deflate stream has not been reached yet. 1500 It is also called to create a window for dictionary data when a dictionary 1501 is loaded. 1502 1503 Providing output buffers larger than 32K to inflate() should provide a speed 1504 advantage, since only the last 32K of output is copied to the sliding window 1505 upon return from inflate(), and since all distances after the first 32K of 1506 output will fall in the output data, making match copies simpler and faster. 1507 The advantage may be dependent on the size of the processor's data caches. 1508 */ 1509 function updatewindow(strm, src, end, copy) { 1510 var dist; 1511 var state = strm.state; 1512 1513 /* if it hasn't been done already, allocate space for the window */ 1514 if (state.window === null) { 1515 state.wsize = 1 << state.wbits; 1516 state.wnext = 0; 1517 state.whave = 0; 1518 1519 state.window = new utils.Buf8(state.wsize); 1520 } 1521 1522 /* copy state->wsize or less output bytes into the circular window */ 1523 if (copy >= state.wsize) { 1524 utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); 1525 state.wnext = 0; 1526 state.whave = state.wsize; 1527 } 1528 else { 1529 dist = state.wsize - state.wnext; 1530 if (dist > copy) { 1531 dist = copy; 1532 } 1533 //zmemcpy(state->window + state->wnext, end - copy, dist); 1534 utils.arraySet(state.window, src, end - copy, dist, state.wnext); 1535 copy -= dist; 1536 if (copy) { 1537 //zmemcpy(state->window, end - copy, copy); 1538 utils.arraySet(state.window, src, end - copy, copy, 0); 1539 state.wnext = copy; 1540 state.whave = state.wsize; 1541 } 1542 else { 1543 state.wnext += dist; 1544 if (state.wnext === state.wsize) { state.wnext = 0; } 1545 if (state.whave < state.wsize) { state.whave += dist; } 1546 } 1547 } 1548 return 0; 1549 } 1550 1551 function inflate(strm, flush) { 1552 var state; 1553 var input, output; // input/output buffers 1554 var next; /* next input INDEX */ 1555 var put; /* next output INDEX */ 1556 var have, left; /* available input and output */ 1557 var hold; /* bit buffer */ 1558 var bits; /* bits in bit buffer */ 1559 var _in, _out; /* save starting available input and output */ 1560 var copy; /* number of stored or match bytes to copy */ 1561 var from; /* where to copy match bytes from */ 1562 var from_source; 1563 var here = 0; /* current decoding table entry */ 1564 var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) 1565 //var last; /* parent table entry */ 1566 var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) 1567 var len; /* length to copy for repeats, bits to drop */ 1568 var ret; /* return code */ 1569 var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ 1570 var opts; 1571 1572 var n; // temporary var for NEED_BITS 1573 1574 var order = /* permutation of code lengths */ 1575 [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; 1576 1577 1578 if (!strm || !strm.state || !strm.output || 1579 (!strm.input && strm.avail_in !== 0)) { 1580 return Z_STREAM_ERROR; 1581 } 1582 1583 state = strm.state; 1584 if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ 1585 1586 1587 //--- LOAD() --- 1588 put = strm.next_out; 1589 output = strm.output; 1590 left = strm.avail_out; 1591 next = strm.next_in; 1592 input = strm.input; 1593 have = strm.avail_in; 1594 hold = state.hold; 1595 bits = state.bits; 1596 //--- 1597 1598 _in = have; 1599 _out = left; 1600 ret = Z_OK; 1601 1602 inf_leave: // goto emulation 1603 for (;;) { 1604 switch (state.mode) { 1605 case HEAD: 1606 if (state.wrap === 0) { 1607 state.mode = TYPEDO; 1608 break; 1609 } 1610 //=== NEEDBITS(16); 1611 while (bits < 16) { 1612 if (have === 0) { break inf_leave; } 1613 have--; 1614 hold += input[next++] << bits; 1615 bits += 8; 1616 } 1617 //===// 1618 if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ 1619 state.check = 0/*crc32(0L, Z_NULL, 0)*/; 1620 //=== CRC2(state.check, hold); 1621 hbuf[0] = hold & 0xff; 1622 hbuf[1] = (hold >>> 8) & 0xff; 1623 state.check = crc32(state.check, hbuf, 2, 0); 1624 //===// 1625 1626 //=== INITBITS(); 1627 hold = 0; 1628 bits = 0; 1629 //===// 1630 state.mode = FLAGS; 1631 break; 1632 } 1633 state.flags = 0; /* expect zlib header */ 1634 if (state.head) { 1635 state.head.done = false; 1636 } 1637 if (!(state.wrap & 1) || /* check if zlib header allowed */ 1638 (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { 1639 strm.msg = 'incorrect header check'; 1640 state.mode = BAD; 1641 break; 1642 } 1643 if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { 1644 strm.msg = 'unknown compression method'; 1645 state.mode = BAD; 1646 break; 1647 } 1648 //--- DROPBITS(4) ---// 1649 hold >>>= 4; 1650 bits -= 4; 1651 //---// 1652 len = (hold & 0x0f)/*BITS(4)*/ + 8; 1653 if (state.wbits === 0) { 1654 state.wbits = len; 1655 } 1656 else if (len > state.wbits) { 1657 strm.msg = 'invalid window size'; 1658 state.mode = BAD; 1659 break; 1660 } 1661 state.dmax = 1 << len; 1662 //Tracev((stderr, "inflate: zlib header ok\n")); 1663 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; 1664 state.mode = hold & 0x200 ? DICTID : TYPE; 1665 //=== INITBITS(); 1666 hold = 0; 1667 bits = 0; 1668 //===// 1669 break; 1670 case FLAGS: 1671 //=== NEEDBITS(16); */ 1672 while (bits < 16) { 1673 if (have === 0) { break inf_leave; } 1674 have--; 1675 hold += input[next++] << bits; 1676 bits += 8; 1677 } 1678 //===// 1679 state.flags = hold; 1680 if ((state.flags & 0xff) !== Z_DEFLATED) { 1681 strm.msg = 'unknown compression method'; 1682 state.mode = BAD; 1683 break; 1684 } 1685 if (state.flags & 0xe000) { 1686 strm.msg = 'unknown header flags set'; 1687 state.mode = BAD; 1688 break; 1689 } 1690 if (state.head) { 1691 state.head.text = ((hold >> 8) & 1); 1692 } 1693 if (state.flags & 0x0200) { 1694 //=== CRC2(state.check, hold); 1695 hbuf[0] = hold & 0xff; 1696 hbuf[1] = (hold >>> 8) & 0xff; 1697 state.check = crc32(state.check, hbuf, 2, 0); 1698 //===// 1699 } 1700 //=== INITBITS(); 1701 hold = 0; 1702 bits = 0; 1703 //===// 1704 state.mode = TIME; 1705 /* falls through */ 1706 case TIME: 1707 //=== NEEDBITS(32); */ 1708 while (bits < 32) { 1709 if (have === 0) { break inf_leave; } 1710 have--; 1711 hold += input[next++] << bits; 1712 bits += 8; 1713 } 1714 //===// 1715 if (state.head) { 1716 state.head.time = hold; 1717 } 1718 if (state.flags & 0x0200) { 1719 //=== CRC4(state.check, hold) 1720 hbuf[0] = hold & 0xff; 1721 hbuf[1] = (hold >>> 8) & 0xff; 1722 hbuf[2] = (hold >>> 16) & 0xff; 1723 hbuf[3] = (hold >>> 24) & 0xff; 1724 state.check = crc32(state.check, hbuf, 4, 0); 1725 //=== 1726 } 1727 //=== INITBITS(); 1728 hold = 0; 1729 bits = 0; 1730 //===// 1731 state.mode = OS; 1732 /* falls through */ 1733 case OS: 1734 //=== NEEDBITS(16); */ 1735 while (bits < 16) { 1736 if (have === 0) { break inf_leave; } 1737 have--; 1738 hold += input[next++] << bits; 1739 bits += 8; 1740 } 1741 //===// 1742 if (state.head) { 1743 state.head.xflags = (hold & 0xff); 1744 state.head.os = (hold >> 8); 1745 } 1746 if (state.flags & 0x0200) { 1747 //=== CRC2(state.check, hold); 1748 hbuf[0] = hold & 0xff; 1749 hbuf[1] = (hold >>> 8) & 0xff; 1750 state.check = crc32(state.check, hbuf, 2, 0); 1751 //===// 1752 } 1753 //=== INITBITS(); 1754 hold = 0; 1755 bits = 0; 1756 //===// 1757 state.mode = EXLEN; 1758 /* falls through */ 1759 case EXLEN: 1760 if (state.flags & 0x0400) { 1761 //=== NEEDBITS(16); */ 1762 while (bits < 16) { 1763 if (have === 0) { break inf_leave; } 1764 have--; 1765 hold += input[next++] << bits; 1766 bits += 8; 1767 } 1768 //===// 1769 state.length = hold; 1770 if (state.head) { 1771 state.head.extra_len = hold; 1772 } 1773 if (state.flags & 0x0200) { 1774 //=== CRC2(state.check, hold); 1775 hbuf[0] = hold & 0xff; 1776 hbuf[1] = (hold >>> 8) & 0xff; 1777 state.check = crc32(state.check, hbuf, 2, 0); 1778 //===// 1779 } 1780 //=== INITBITS(); 1781 hold = 0; 1782 bits = 0; 1783 //===// 1784 } 1785 else if (state.head) { 1786 state.head.extra = null/*Z_NULL*/; 1787 } 1788 state.mode = EXTRA; 1789 /* falls through */ 1790 case EXTRA: 1791 if (state.flags & 0x0400) { 1792 copy = state.length; 1793 if (copy > have) { copy = have; } 1794 if (copy) { 1795 if (state.head) { 1796 len = state.head.extra_len - state.length; 1797 if (!state.head.extra) { 1798 // Use untyped array for more convenient processing later 1799 state.head.extra = new Array(state.head.extra_len); 1800 } 1801 utils.arraySet( 1802 state.head.extra, 1803 input, 1804 next, 1805 // extra field is limited to 65536 bytes 1806 // - no need for additional size check 1807 copy, 1808 /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ 1809 len 1810 ); 1811 //zmemcpy(state.head.extra + len, next, 1812 // len + copy > state.head.extra_max ? 1813 // state.head.extra_max - len : copy); 1814 } 1815 if (state.flags & 0x0200) { 1816 state.check = crc32(state.check, input, copy, next); 1817 } 1818 have -= copy; 1819 next += copy; 1820 state.length -= copy; 1821 } 1822 if (state.length) { break inf_leave; } 1823 } 1824 state.length = 0; 1825 state.mode = NAME; 1826 /* falls through */ 1827 case NAME: 1828 if (state.flags & 0x0800) { 1829 if (have === 0) { break inf_leave; } 1830 copy = 0; 1831 do { 1832 // TODO: 2 or 1 bytes? 1833 len = input[next + copy++]; 1834 /* use constant limit because in js we should not preallocate memory */ 1835 if (state.head && len && 1836 (state.length < 65536 /*state.head.name_max*/)) { 1837 state.head.name += String.fromCharCode(len); 1838 } 1839 } while (len && copy < have); 1840 1841 if (state.flags & 0x0200) { 1842 state.check = crc32(state.check, input, copy, next); 1843 } 1844 have -= copy; 1845 next += copy; 1846 if (len) { break inf_leave; } 1847 } 1848 else if (state.head) { 1849 state.head.name = null; 1850 } 1851 state.length = 0; 1852 state.mode = COMMENT; 1853 /* falls through */ 1854 case COMMENT: 1855 if (state.flags & 0x1000) { 1856 if (have === 0) { break inf_leave; } 1857 copy = 0; 1858 do { 1859 len = input[next + copy++]; 1860 /* use constant limit because in js we should not preallocate memory */ 1861 if (state.head && len && 1862 (state.length < 65536 /*state.head.comm_max*/)) { 1863 state.head.comment += String.fromCharCode(len); 1864 } 1865 } while (len && copy < have); 1866 if (state.flags & 0x0200) { 1867 state.check = crc32(state.check, input, copy, next); 1868 } 1869 have -= copy; 1870 next += copy; 1871 if (len) { break inf_leave; } 1872 } 1873 else if (state.head) { 1874 state.head.comment = null; 1875 } 1876 state.mode = HCRC; 1877 /* falls through */ 1878 case HCRC: 1879 if (state.flags & 0x0200) { 1880 //=== NEEDBITS(16); */ 1881 while (bits < 16) { 1882 if (have === 0) { break inf_leave; } 1883 have--; 1884 hold += input[next++] << bits; 1885 bits += 8; 1886 } 1887 //===// 1888 if (hold !== (state.check & 0xffff)) { 1889 strm.msg = 'header crc mismatch'; 1890 state.mode = BAD; 1891 break; 1892 } 1893 //=== INITBITS(); 1894 hold = 0; 1895 bits = 0; 1896 //===// 1897 } 1898 if (state.head) { 1899 state.head.hcrc = ((state.flags >> 9) & 1); 1900 state.head.done = true; 1901 } 1902 strm.adler = state.check = 0; 1903 state.mode = TYPE; 1904 break; 1905 case DICTID: 1906 //=== NEEDBITS(32); */ 1907 while (bits < 32) { 1908 if (have === 0) { break inf_leave; } 1909 have--; 1910 hold += input[next++] << bits; 1911 bits += 8; 1912 } 1913 //===// 1914 strm.adler = state.check = zswap32(hold); 1915 //=== INITBITS(); 1916 hold = 0; 1917 bits = 0; 1918 //===// 1919 state.mode = DICT; 1920 /* falls through */ 1921 case DICT: 1922 if (state.havedict === 0) { 1923 //--- RESTORE() --- 1924 strm.next_out = put; 1925 strm.avail_out = left; 1926 strm.next_in = next; 1927 strm.avail_in = have; 1928 state.hold = hold; 1929 state.bits = bits; 1930 //--- 1931 return Z_NEED_DICT; 1932 } 1933 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; 1934 state.mode = TYPE; 1935 /* falls through */ 1936 case TYPE: 1937 if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } 1938 /* falls through */ 1939 case TYPEDO: 1940 if (state.last) { 1941 //--- BYTEBITS() ---// 1942 hold >>>= bits & 7; 1943 bits -= bits & 7; 1944 //---// 1945 state.mode = CHECK; 1946 break; 1947 } 1948 //=== NEEDBITS(3); */ 1949 while (bits < 3) { 1950 if (have === 0) { break inf_leave; } 1951 have--; 1952 hold += input[next++] << bits; 1953 bits += 8; 1954 } 1955 //===// 1956 state.last = (hold & 0x01)/*BITS(1)*/; 1957 //--- DROPBITS(1) ---// 1958 hold >>>= 1; 1959 bits -= 1; 1960 //---// 1961 1962 switch ((hold & 0x03)/*BITS(2)*/) { 1963 case 0: /* stored block */ 1964 //Tracev((stderr, "inflate: stored block%s\n", 1965 // state.last ? " (last)" : "")); 1966 state.mode = STORED; 1967 break; 1968 case 1: /* fixed block */ 1969 fixedtables(state); 1970 //Tracev((stderr, "inflate: fixed codes block%s\n", 1971 // state.last ? " (last)" : "")); 1972 state.mode = LEN_; /* decode codes */ 1973 if (flush === Z_TREES) { 1974 //--- DROPBITS(2) ---// 1975 hold >>>= 2; 1976 bits -= 2; 1977 //---// 1978 break inf_leave; 1979 } 1980 break; 1981 case 2: /* dynamic block */ 1982 //Tracev((stderr, "inflate: dynamic codes block%s\n", 1983 // state.last ? " (last)" : "")); 1984 state.mode = TABLE; 1985 break; 1986 case 3: 1987 strm.msg = 'invalid block type'; 1988 state.mode = BAD; 1989 } 1990 //--- DROPBITS(2) ---// 1991 hold >>>= 2; 1992 bits -= 2; 1993 //---// 1994 break; 1995 case STORED: 1996 //--- BYTEBITS() ---// /* go to byte boundary */ 1997 hold >>>= bits & 7; 1998 bits -= bits & 7; 1999 //---// 2000 //=== NEEDBITS(32); */ 2001 while (bits < 32) { 2002 if (have === 0) { break inf_leave; } 2003 have--; 2004 hold += input[next++] << bits; 2005 bits += 8; 2006 } 2007 //===// 2008 if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { 2009 strm.msg = 'invalid stored block lengths'; 2010 state.mode = BAD; 2011 break; 2012 } 2013 state.length = hold & 0xffff; 2014 //Tracev((stderr, "inflate: stored length %u\n", 2015 // state.length)); 2016 //=== INITBITS(); 2017 hold = 0; 2018 bits = 0; 2019 //===// 2020 state.mode = COPY_; 2021 if (flush === Z_TREES) { break inf_leave; } 2022 /* falls through */ 2023 case COPY_: 2024 state.mode = COPY; 2025 /* falls through */ 2026 case COPY: 2027 copy = state.length; 2028 if (copy) { 2029 if (copy > have) { copy = have; } 2030 if (copy > left) { copy = left; } 2031 if (copy === 0) { break inf_leave; } 2032 //--- zmemcpy(put, next, copy); --- 2033 utils.arraySet(output, input, next, copy, put); 2034 //---// 2035 have -= copy; 2036 next += copy; 2037 left -= copy; 2038 put += copy; 2039 state.length -= copy; 2040 break; 2041 } 2042 //Tracev((stderr, "inflate: stored end\n")); 2043 state.mode = TYPE; 2044 break; 2045 case TABLE: 2046 //=== NEEDBITS(14); */ 2047 while (bits < 14) { 2048 if (have === 0) { break inf_leave; } 2049 have--; 2050 hold += input[next++] << bits; 2051 bits += 8; 2052 } 2053 //===// 2054 state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; 2055 //--- DROPBITS(5) ---// 2056 hold >>>= 5; 2057 bits -= 5; 2058 //---// 2059 state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; 2060 //--- DROPBITS(5) ---// 2061 hold >>>= 5; 2062 bits -= 5; 2063 //---// 2064 state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; 2065 //--- DROPBITS(4) ---// 2066 hold >>>= 4; 2067 bits -= 4; 2068 //---// 2069 //#ifndef PKZIP_BUG_WORKAROUND 2070 if (state.nlen > 286 || state.ndist > 30) { 2071 strm.msg = 'too many length or distance symbols'; 2072 state.mode = BAD; 2073 break; 2074 } 2075 //#endif 2076 //Tracev((stderr, "inflate: table sizes ok\n")); 2077 state.have = 0; 2078 state.mode = LENLENS; 2079 /* falls through */ 2080 case LENLENS: 2081 while (state.have < state.ncode) { 2082 //=== NEEDBITS(3); 2083 while (bits < 3) { 2084 if (have === 0) { break inf_leave; } 2085 have--; 2086 hold += input[next++] << bits; 2087 bits += 8; 2088 } 2089 //===// 2090 state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); 2091 //--- DROPBITS(3) ---// 2092 hold >>>= 3; 2093 bits -= 3; 2094 //---// 2095 } 2096 while (state.have < 19) { 2097 state.lens[order[state.have++]] = 0; 2098 } 2099 // We have separate tables & no pointers. 2 commented lines below not needed. 2100 //state.next = state.codes; 2101 //state.lencode = state.next; 2102 // Switch to use dynamic table 2103 state.lencode = state.lendyn; 2104 state.lenbits = 7; 2105 2106 opts = { bits: state.lenbits }; 2107 ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); 2108 state.lenbits = opts.bits; 2109 2110 if (ret) { 2111 strm.msg = 'invalid code lengths set'; 2112 state.mode = BAD; 2113 break; 2114 } 2115 //Tracev((stderr, "inflate: code lengths ok\n")); 2116 state.have = 0; 2117 state.mode = CODELENS; 2118 /* falls through */ 2119 case CODELENS: 2120 while (state.have < state.nlen + state.ndist) { 2121 for (;;) { 2122 here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ 2123 here_bits = here >>> 24; 2124 here_op = (here >>> 16) & 0xff; 2125 here_val = here & 0xffff; 2126 2127 if ((here_bits) <= bits) { break; } 2128 //--- PULLBYTE() ---// 2129 if (have === 0) { break inf_leave; } 2130 have--; 2131 hold += input[next++] << bits; 2132 bits += 8; 2133 //---// 2134 } 2135 if (here_val < 16) { 2136 //--- DROPBITS(here.bits) ---// 2137 hold >>>= here_bits; 2138 bits -= here_bits; 2139 //---// 2140 state.lens[state.have++] = here_val; 2141 } 2142 else { 2143 if (here_val === 16) { 2144 //=== NEEDBITS(here.bits + 2); 2145 n = here_bits + 2; 2146 while (bits < n) { 2147 if (have === 0) { break inf_leave; } 2148 have--; 2149 hold += input[next++] << bits; 2150 bits += 8; 2151 } 2152 //===// 2153 //--- DROPBITS(here.bits) ---// 2154 hold >>>= here_bits; 2155 bits -= here_bits; 2156 //---// 2157 if (state.have === 0) { 2158 strm.msg = 'invalid bit length repeat'; 2159 state.mode = BAD; 2160 break; 2161 } 2162 len = state.lens[state.have - 1]; 2163 copy = 3 + (hold & 0x03);//BITS(2); 2164 //--- DROPBITS(2) ---// 2165 hold >>>= 2; 2166 bits -= 2; 2167 //---// 2168 } 2169 else if (here_val === 17) { 2170 //=== NEEDBITS(here.bits + 3); 2171 n = here_bits + 3; 2172 while (bits < n) { 2173 if (have === 0) { break inf_leave; } 2174 have--; 2175 hold += input[next++] << bits; 2176 bits += 8; 2177 } 2178 //===// 2179 //--- DROPBITS(here.bits) ---// 2180 hold >>>= here_bits; 2181 bits -= here_bits; 2182 //---// 2183 len = 0; 2184 copy = 3 + (hold & 0x07);//BITS(3); 2185 //--- DROPBITS(3) ---// 2186 hold >>>= 3; 2187 bits -= 3; 2188 //---// 2189 } 2190 else { 2191 //=== NEEDBITS(here.bits + 7); 2192 n = here_bits + 7; 2193 while (bits < n) { 2194 if (have === 0) { break inf_leave; } 2195 have--; 2196 hold += input[next++] << bits; 2197 bits += 8; 2198 } 2199 //===// 2200 //--- DROPBITS(here.bits) ---// 2201 hold >>>= here_bits; 2202 bits -= here_bits; 2203 //---// 2204 len = 0; 2205 copy = 11 + (hold & 0x7f);//BITS(7); 2206 //--- DROPBITS(7) ---// 2207 hold >>>= 7; 2208 bits -= 7; 2209 //---// 2210 } 2211 if (state.have + copy > state.nlen + state.ndist) { 2212 strm.msg = 'invalid bit length repeat'; 2213 state.mode = BAD; 2214 break; 2215 } 2216 while (copy--) { 2217 state.lens[state.have++] = len; 2218 } 2219 } 2220 } 2221 2222 /* handle error breaks in while */ 2223 if (state.mode === BAD) { break; } 2224 2225 /* check for end-of-block code (better have one) */ 2226 if (state.lens[256] === 0) { 2227 strm.msg = 'invalid code -- missing end-of-block'; 2228 state.mode = BAD; 2229 break; 2230 } 2231 2232 /* build code tables -- note: do not change the lenbits or distbits 2233 values here (9 and 6) without reading the comments in inftrees.h 2234 concerning the ENOUGH constants, which depend on those values */ 2235 state.lenbits = 9; 2236 2237 opts = { bits: state.lenbits }; 2238 ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); 2239 // We have separate tables & no pointers. 2 commented lines below not needed. 2240 // state.next_index = opts.table_index; 2241 state.lenbits = opts.bits; 2242 // state.lencode = state.next; 2243 2244 if (ret) { 2245 strm.msg = 'invalid literal/lengths set'; 2246 state.mode = BAD; 2247 break; 2248 } 2249 2250 state.distbits = 6; 2251 //state.distcode.copy(state.codes); 2252 // Switch to use dynamic table 2253 state.distcode = state.distdyn; 2254 opts = { bits: state.distbits }; 2255 ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); 2256 // We have separate tables & no pointers. 2 commented lines below not needed. 2257 // state.next_index = opts.table_index; 2258 state.distbits = opts.bits; 2259 // state.distcode = state.next; 2260 2261 if (ret) { 2262 strm.msg = 'invalid distances set'; 2263 state.mode = BAD; 2264 break; 2265 } 2266 //Tracev((stderr, 'inflate: codes ok\n')); 2267 state.mode = LEN_; 2268 if (flush === Z_TREES) { break inf_leave; } 2269 /* falls through */ 2270 case LEN_: 2271 state.mode = LEN; 2272 /* falls through */ 2273 case LEN: 2274 if (have >= 6 && left >= 258) { 2275 //--- RESTORE() --- 2276 strm.next_out = put; 2277 strm.avail_out = left; 2278 strm.next_in = next; 2279 strm.avail_in = have; 2280 state.hold = hold; 2281 state.bits = bits; 2282 //--- 2283 inflate_fast(strm, _out); 2284 //--- LOAD() --- 2285 put = strm.next_out; 2286 output = strm.output; 2287 left = strm.avail_out; 2288 next = strm.next_in; 2289 input = strm.input; 2290 have = strm.avail_in; 2291 hold = state.hold; 2292 bits = state.bits; 2293 //--- 2294 2295 if (state.mode === TYPE) { 2296 state.back = -1; 2297 } 2298 break; 2299 } 2300 state.back = 0; 2301 for (;;) { 2302 here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ 2303 here_bits = here >>> 24; 2304 here_op = (here >>> 16) & 0xff; 2305 here_val = here & 0xffff; 2306 2307 if (here_bits <= bits) { break; } 2308 //--- PULLBYTE() ---// 2309 if (have === 0) { break inf_leave; } 2310 have--; 2311 hold += input[next++] << bits; 2312 bits += 8; 2313 //---// 2314 } 2315 if (here_op && (here_op & 0xf0) === 0) { 2316 last_bits = here_bits; 2317 last_op = here_op; 2318 last_val = here_val; 2319 for (;;) { 2320 here = state.lencode[last_val + 2321 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; 2322 here_bits = here >>> 24; 2323 here_op = (here >>> 16) & 0xff; 2324 here_val = here & 0xffff; 2325 2326 if ((last_bits + here_bits) <= bits) { break; } 2327 //--- PULLBYTE() ---// 2328 if (have === 0) { break inf_leave; } 2329 have--; 2330 hold += input[next++] << bits; 2331 bits += 8; 2332 //---// 2333 } 2334 //--- DROPBITS(last.bits) ---// 2335 hold >>>= last_bits; 2336 bits -= last_bits; 2337 //---// 2338 state.back += last_bits; 2339 } 2340 //--- DROPBITS(here.bits) ---// 2341 hold >>>= here_bits; 2342 bits -= here_bits; 2343 //---// 2344 state.back += here_bits; 2345 state.length = here_val; 2346 if (here_op === 0) { 2347 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? 2348 // "inflate: literal '%c'\n" : 2349 // "inflate: literal 0x%02x\n", here.val)); 2350 state.mode = LIT; 2351 break; 2352 } 2353 if (here_op & 32) { 2354 //Tracevv((stderr, "inflate: end of block\n")); 2355 state.back = -1; 2356 state.mode = TYPE; 2357 break; 2358 } 2359 if (here_op & 64) { 2360 strm.msg = 'invalid literal/length code'; 2361 state.mode = BAD; 2362 break; 2363 } 2364 state.extra = here_op & 15; 2365 state.mode = LENEXT; 2366 /* falls through */ 2367 case LENEXT: 2368 if (state.extra) { 2369 //=== NEEDBITS(state.extra); 2370 n = state.extra; 2371 while (bits < n) { 2372 if (have === 0) { break inf_leave; } 2373 have--; 2374 hold += input[next++] << bits; 2375 bits += 8; 2376 } 2377 //===// 2378 state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; 2379 //--- DROPBITS(state.extra) ---// 2380 hold >>>= state.extra; 2381 bits -= state.extra; 2382 //---// 2383 state.back += state.extra; 2384 } 2385 //Tracevv((stderr, "inflate: length %u\n", state.length)); 2386 state.was = state.length; 2387 state.mode = DIST; 2388 /* falls through */ 2389 case DIST: 2390 for (;;) { 2391 here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ 2392 here_bits = here >>> 24; 2393 here_op = (here >>> 16) & 0xff; 2394 here_val = here & 0xffff; 2395 2396 if ((here_bits) <= bits) { break; } 2397 //--- PULLBYTE() ---// 2398 if (have === 0) { break inf_leave; } 2399 have--; 2400 hold += input[next++] << bits; 2401 bits += 8; 2402 //---// 2403 } 2404 if ((here_op & 0xf0) === 0) { 2405 last_bits = here_bits; 2406 last_op = here_op; 2407 last_val = here_val; 2408 for (;;) { 2409 here = state.distcode[last_val + 2410 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; 2411 here_bits = here >>> 24; 2412 here_op = (here >>> 16) & 0xff; 2413 here_val = here & 0xffff; 2414 2415 if ((last_bits + here_bits) <= bits) { break; } 2416 //--- PULLBYTE() ---// 2417 if (have === 0) { break inf_leave; } 2418 have--; 2419 hold += input[next++] << bits; 2420 bits += 8; 2421 //---// 2422 } 2423 //--- DROPBITS(last.bits) ---// 2424 hold >>>= last_bits; 2425 bits -= last_bits; 2426 //---// 2427 state.back += last_bits; 2428 } 2429 //--- DROPBITS(here.bits) ---// 2430 hold >>>= here_bits; 2431 bits -= here_bits; 2432 //---// 2433 state.back += here_bits; 2434 if (here_op & 64) { 2435 strm.msg = 'invalid distance code'; 2436 state.mode = BAD; 2437 break; 2438 } 2439 state.offset = here_val; 2440 state.extra = (here_op) & 15; 2441 state.mode = DISTEXT; 2442 /* falls through */ 2443 case DISTEXT: 2444 if (state.extra) { 2445 //=== NEEDBITS(state.extra); 2446 n = state.extra; 2447 while (bits < n) { 2448 if (have === 0) { break inf_leave; } 2449 have--; 2450 hold += input[next++] << bits; 2451 bits += 8; 2452 } 2453 //===// 2454 state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; 2455 //--- DROPBITS(state.extra) ---// 2456 hold >>>= state.extra; 2457 bits -= state.extra; 2458 //---// 2459 state.back += state.extra; 2460 } 2461 //#ifdef INFLATE_STRICT 2462 if (state.offset > state.dmax) { 2463 strm.msg = 'invalid distance too far back'; 2464 state.mode = BAD; 2465 break; 2466 } 2467 //#endif 2468 //Tracevv((stderr, "inflate: distance %u\n", state.offset)); 2469 state.mode = MATCH; 2470 /* falls through */ 2471 case MATCH: 2472 if (left === 0) { break inf_leave; } 2473 copy = _out - left; 2474 if (state.offset > copy) { /* copy from window */ 2475 copy = state.offset - copy; 2476 if (copy > state.whave) { 2477 if (state.sane) { 2478 strm.msg = 'invalid distance too far back'; 2479 state.mode = BAD; 2480 break; 2481 } 2482 // (!) This block is disabled in zlib defaults, 2483 // don't enable it for binary compatibility 2484 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR 2485 // Trace((stderr, "inflate.c too far\n")); 2486 // copy -= state.whave; 2487 // if (copy > state.length) { copy = state.length; } 2488 // if (copy > left) { copy = left; } 2489 // left -= copy; 2490 // state.length -= copy; 2491 // do { 2492 // output[put++] = 0; 2493 // } while (--copy); 2494 // if (state.length === 0) { state.mode = LEN; } 2495 // break; 2496 //#endif 2497 } 2498 if (copy > state.wnext) { 2499 copy -= state.wnext; 2500 from = state.wsize - copy; 2501 } 2502 else { 2503 from = state.wnext - copy; 2504 } 2505 if (copy > state.length) { copy = state.length; } 2506 from_source = state.window; 2507 } 2508 else { /* copy from output */ 2509 from_source = output; 2510 from = put - state.offset; 2511 copy = state.length; 2512 } 2513 if (copy > left) { copy = left; } 2514 left -= copy; 2515 state.length -= copy; 2516 do { 2517 output[put++] = from_source[from++]; 2518 } while (--copy); 2519 if (state.length === 0) { state.mode = LEN; } 2520 break; 2521 case LIT: 2522 if (left === 0) { break inf_leave; } 2523 output[put++] = state.length; 2524 left--; 2525 state.mode = LEN; 2526 break; 2527 case CHECK: 2528 if (state.wrap) { 2529 //=== NEEDBITS(32); 2530 while (bits < 32) { 2531 if (have === 0) { break inf_leave; } 2532 have--; 2533 // Use '|' instead of '+' to make sure that result is signed 2534 hold |= input[next++] << bits; 2535 bits += 8; 2536 } 2537 //===// 2538 _out -= left; 2539 strm.total_out += _out; 2540 state.total += _out; 2541 if (_out) { 2542 strm.adler = state.check = 2543 /*UPDATE(state.check, put - _out, _out);*/ 2544 (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); 2545 2546 } 2547 _out = left; 2548 // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too 2549 if ((state.flags ? hold : zswap32(hold)) !== state.check) { 2550 strm.msg = 'incorrect data check'; 2551 state.mode = BAD; 2552 break; 2553 } 2554 //=== INITBITS(); 2555 hold = 0; 2556 bits = 0; 2557 //===// 2558 //Tracev((stderr, "inflate: check matches trailer\n")); 2559 } 2560 state.mode = LENGTH; 2561 /* falls through */ 2562 case LENGTH: 2563 if (state.wrap && state.flags) { 2564 //=== NEEDBITS(32); 2565 while (bits < 32) { 2566 if (have === 0) { break inf_leave; } 2567 have--; 2568 hold += input[next++] << bits; 2569 bits += 8; 2570 } 2571 //===// 2572 if (hold !== (state.total & 0xffffffff)) { 2573 strm.msg = 'incorrect length check'; 2574 state.mode = BAD; 2575 break; 2576 } 2577 //=== INITBITS(); 2578 hold = 0; 2579 bits = 0; 2580 //===// 2581 //Tracev((stderr, "inflate: length matches trailer\n")); 2582 } 2583 state.mode = DONE; 2584 /* falls through */ 2585 case DONE: 2586 ret = Z_STREAM_END; 2587 break inf_leave; 2588 case BAD: 2589 ret = Z_DATA_ERROR; 2590 break inf_leave; 2591 case MEM: 2592 return Z_MEM_ERROR; 2593 case SYNC: 2594 /* falls through */ 2595 default: 2596 return Z_STREAM_ERROR; 2597 } 2598 } 2599 2600 // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" 2601 2602 /* 2603 Return from inflate(), updating the total counts and the check value. 2604 If there was no progress during the inflate() call, return a buffer 2605 error. Call updatewindow() to create and/or update the window state. 2606 Note: a memory error from inflate() is non-recoverable. 2607 */ 2608 2609 //--- RESTORE() --- 2610 strm.next_out = put; 2611 strm.avail_out = left; 2612 strm.next_in = next; 2613 strm.avail_in = have; 2614 state.hold = hold; 2615 state.bits = bits; 2616 //--- 2617 2618 if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && 2619 (state.mode < CHECK || flush !== Z_FINISH))) { 2620 if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { 2621 state.mode = MEM; 2622 return Z_MEM_ERROR; 2623 } 2624 } 2625 _in -= strm.avail_in; 2626 _out -= strm.avail_out; 2627 strm.total_in += _in; 2628 strm.total_out += _out; 2629 state.total += _out; 2630 if (state.wrap && _out) { 2631 strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ 2632 (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); 2633 } 2634 strm.data_type = state.bits + (state.last ? 64 : 0) + 2635 (state.mode === TYPE ? 128 : 0) + 2636 (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); 2637 if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { 2638 ret = Z_BUF_ERROR; 2639 } 2640 return ret; 2641 } 2642 2643 function inflateEnd(strm) { 2644 2645 if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { 2646 return Z_STREAM_ERROR; 2647 } 2648 2649 var state = strm.state; 2650 if (state.window) { 2651 state.window = null; 2652 } 2653 strm.state = null; 2654 return Z_OK; 2655 } 2656 2657 function inflateGetHeader(strm, head) { 2658 var state; 2659 2660 /* check state */ 2661 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 2662 state = strm.state; 2663 if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } 2664 2665 /* save header structure */ 2666 state.head = head; 2667 head.done = false; 2668 return Z_OK; 2669 } 2670 2671 function inflateSetDictionary(strm, dictionary) { 2672 var dictLength = dictionary.length; 2673 2674 var state; 2675 var dictid; 2676 var ret; 2677 2678 /* check state */ 2679 if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } 2680 state = strm.state; 2681 2682 if (state.wrap !== 0 && state.mode !== DICT) { 2683 return Z_STREAM_ERROR; 2684 } 2685 2686 /* check for correct dictionary identifier */ 2687 if (state.mode === DICT) { 2688 dictid = 1; /* adler32(0, null, 0)*/ 2689 /* dictid = adler32(dictid, dictionary, dictLength); */ 2690 dictid = adler32(dictid, dictionary, dictLength, 0); 2691 if (dictid !== state.check) { 2692 return Z_DATA_ERROR; 2693 } 2694 } 2695 /* copy dictionary to window using updatewindow(), which will amend the 2696 existing dictionary if appropriate */ 2697 ret = updatewindow(strm, dictionary, dictLength, dictLength); 2698 if (ret) { 2699 state.mode = MEM; 2700 return Z_MEM_ERROR; 2701 } 2702 state.havedict = 1; 2703 // Tracev((stderr, "inflate: dictionary set\n")); 2704 return Z_OK; 2705 } 2706 2707 exports.inflateReset = inflateReset; 2708 exports.inflateReset2 = inflateReset2; 2709 exports.inflateResetKeep = inflateResetKeep; 2710 exports.inflateInit = inflateInit; 2711 exports.inflateInit2 = inflateInit2; 2712 exports.inflate = inflate; 2713 exports.inflateEnd = inflateEnd; 2714 exports.inflateGetHeader = inflateGetHeader; 2715 exports.inflateSetDictionary = inflateSetDictionary; 2716 exports.inflateInfo = 'pako inflate (from Nodeca project)'; 2717 2718 /* Not implemented 2719 exports.inflateCopy = inflateCopy; 2720 exports.inflateGetDictionary = inflateGetDictionary; 2721 exports.inflateMark = inflateMark; 2722 exports.inflatePrime = inflatePrime; 2723 exports.inflateSync = inflateSync; 2724 exports.inflateSyncPoint = inflateSyncPoint; 2725 exports.inflateUndermine = inflateUndermine; 2726 */ 2727 2728 },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){ 2729 'use strict'; 2730 2731 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 2732 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 2733 // 2734 // This software is provided 'as-is', without any express or implied 2735 // warranty. In no event will the authors be held liable for any damages 2736 // arising from the use of this software. 2737 // 2738 // Permission is granted to anyone to use this software for any purpose, 2739 // including commercial applications, and to alter it and redistribute it 2740 // freely, subject to the following restrictions: 2741 // 2742 // 1. The origin of this software must not be misrepresented; you must not 2743 // claim that you wrote the original software. If you use this software 2744 // in a product, an acknowledgment in the product documentation would be 2745 // appreciated but is not required. 2746 // 2. Altered source versions must be plainly marked as such, and must not be 2747 // misrepresented as being the original software. 2748 // 3. This notice may not be removed or altered from any source distribution. 2749 2750 var utils = require('../utils/common'); 2751 2752 var MAXBITS = 15; 2753 var ENOUGH_LENS = 852; 2754 var ENOUGH_DISTS = 592; 2755 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); 2756 2757 var CODES = 0; 2758 var LENS = 1; 2759 var DISTS = 2; 2760 2761 var lbase = [ /* Length codes 257..285 base */ 2762 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 2763 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 2764 ]; 2765 2766 var lext = [ /* Length codes 257..285 extra */ 2767 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 2768 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 2769 ]; 2770 2771 var dbase = [ /* Distance codes 0..29 base */ 2772 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 2773 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 2774 8193, 12289, 16385, 24577, 0, 0 2775 ]; 2776 2777 var dext = [ /* Distance codes 0..29 extra */ 2778 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 2779 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 2780 28, 28, 29, 29, 64, 64 2781 ]; 2782 2783 module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) 2784 { 2785 var bits = opts.bits; 2786 //here = opts.here; /* table entry for duplication */ 2787 2788 var len = 0; /* a code's length in bits */ 2789 var sym = 0; /* index of code symbols */ 2790 var min = 0, max = 0; /* minimum and maximum code lengths */ 2791 var root = 0; /* number of index bits for root table */ 2792 var curr = 0; /* number of index bits for current table */ 2793 var drop = 0; /* code bits to drop for sub-table */ 2794 var left = 0; /* number of prefix codes available */ 2795 var used = 0; /* code entries in table used */ 2796 var huff = 0; /* Huffman code */ 2797 var incr; /* for incrementing code, index */ 2798 var fill; /* index for replicating entries */ 2799 var low; /* low bits for current root entry */ 2800 var mask; /* mask for low root bits */ 2801 var next; /* next available space in table */ 2802 var base = null; /* base value table to use */ 2803 var base_index = 0; 2804 // var shoextra; /* extra bits table to use */ 2805 var end; /* use base and extra for symbol > end */ 2806 var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ 2807 var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ 2808 var extra = null; 2809 var extra_index = 0; 2810 2811 var here_bits, here_op, here_val; 2812 2813 /* 2814 Process a set of code lengths to create a canonical Huffman code. The 2815 code lengths are lens[0..codes-1]. Each length corresponds to the 2816 symbols 0..codes-1. The Huffman code is generated by first sorting the 2817 symbols by length from short to long, and retaining the symbol order 2818 for codes with equal lengths. Then the code starts with all zero bits 2819 for the first code of the shortest length, and the codes are integer 2820 increments for the same length, and zeros are appended as the length 2821 increases. For the deflate format, these bits are stored backwards 2822 from their more natural integer increment ordering, and so when the 2823 decoding tables are built in the large loop below, the integer codes 2824 are incremented backwards. 2825 2826 This routine assumes, but does not check, that all of the entries in 2827 lens[] are in the range 0..MAXBITS. The caller must assure this. 2828 1..MAXBITS is interpreted as that code length. zero means that that 2829 symbol does not occur in this code. 2830 2831 The codes are sorted by computing a count of codes for each length, 2832 creating from that a table of starting indices for each length in the 2833 sorted table, and then entering the symbols in order in the sorted 2834 table. The sorted table is work[], with that space being provided by 2835 the caller. 2836 2837 The length counts are used for other purposes as well, i.e. finding 2838 the minimum and maximum length codes, determining if there are any 2839 codes at all, checking for a valid set of lengths, and looking ahead 2840 at length counts to determine sub-table sizes when building the 2841 decoding tables. 2842 */ 2843 2844 /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ 2845 for (len = 0; len <= MAXBITS; len++) { 2846 count[len] = 0; 2847 } 2848 for (sym = 0; sym < codes; sym++) { 2849 count[lens[lens_index + sym]]++; 2850 } 2851 2852 /* bound code lengths, force root to be within code lengths */ 2853 root = bits; 2854 for (max = MAXBITS; max >= 1; max--) { 2855 if (count[max] !== 0) { break; } 2856 } 2857 if (root > max) { 2858 root = max; 2859 } 2860 if (max === 0) { /* no symbols to code at all */ 2861 //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ 2862 //table.bits[opts.table_index] = 1; //here.bits = (var char)1; 2863 //table.val[opts.table_index++] = 0; //here.val = (var short)0; 2864 table[table_index++] = (1 << 24) | (64 << 16) | 0; 2865 2866 2867 //table.op[opts.table_index] = 64; 2868 //table.bits[opts.table_index] = 1; 2869 //table.val[opts.table_index++] = 0; 2870 table[table_index++] = (1 << 24) | (64 << 16) | 0; 2871 2872 opts.bits = 1; 2873 return 0; /* no symbols, but wait for decoding to report error */ 2874 } 2875 for (min = 1; min < max; min++) { 2876 if (count[min] !== 0) { break; } 2877 } 2878 if (root < min) { 2879 root = min; 2880 } 2881 2882 /* check for an over-subscribed or incomplete set of lengths */ 2883 left = 1; 2884 for (len = 1; len <= MAXBITS; len++) { 2885 left <<= 1; 2886 left -= count[len]; 2887 if (left < 0) { 2888 return -1; 2889 } /* over-subscribed */ 2890 } 2891 if (left > 0 && (type === CODES || max !== 1)) { 2892 return -1; /* incomplete set */ 2893 } 2894 2895 /* generate offsets into symbol table for each length for sorting */ 2896 offs[1] = 0; 2897 for (len = 1; len < MAXBITS; len++) { 2898 offs[len + 1] = offs[len] + count[len]; 2899 } 2900 2901 /* sort symbols by length, by symbol order within each length */ 2902 for (sym = 0; sym < codes; sym++) { 2903 if (lens[lens_index + sym] !== 0) { 2904 work[offs[lens[lens_index + sym]]++] = sym; 2905 } 2906 } 2907 2908 /* 2909 Create and fill in decoding tables. In this loop, the table being 2910 filled is at next and has curr index bits. The code being used is huff 2911 with length len. That code is converted to an index by dropping drop 2912 bits off of the bottom. For codes where len is less than drop + curr, 2913 those top drop + curr - len bits are incremented through all values to 2914 fill the table with replicated entries. 2915 2916 root is the number of index bits for the root table. When len exceeds 2917 root, sub-tables are created pointed to by the root entry with an index 2918 of the low root bits of huff. This is saved in low to check for when a 2919 new sub-table should be started. drop is zero when the root table is 2920 being filled, and drop is root when sub-tables are being filled. 2921 2922 When a new sub-table is needed, it is necessary to look ahead in the 2923 code lengths to determine what size sub-table is needed. The length 2924 counts are used for this, and so count[] is decremented as codes are 2925 entered in the tables. 2926 2927 used keeps track of how many table entries have been allocated from the 2928 provided *table space. It is checked for LENS and DIST tables against 2929 the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in 2930 the initial root table size constants. See the comments in inftrees.h 2931 for more information. 2932 2933 sym increments through all symbols, and the loop terminates when 2934 all codes of length max, i.e. all codes, have been processed. This 2935 routine permits incomplete codes, so another loop after this one fills 2936 in the rest of the decoding tables with invalid code markers. 2937 */ 2938 2939 /* set up for code type */ 2940 // poor man optimization - use if-else instead of switch, 2941 // to avoid deopts in old v8 2942 if (type === CODES) { 2943 base = extra = work; /* dummy value--not used */ 2944 end = 19; 2945 2946 } else if (type === LENS) { 2947 base = lbase; 2948 base_index -= 257; 2949 extra = lext; 2950 extra_index -= 257; 2951 end = 256; 2952 2953 } else { /* DISTS */ 2954 base = dbase; 2955 extra = dext; 2956 end = -1; 2957 } 2958 2959 /* initialize opts for loop */ 2960 huff = 0; /* starting code */ 2961 sym = 0; /* starting code symbol */ 2962 len = min; /* starting code length */ 2963 next = table_index; /* current table to fill in */ 2964 curr = root; /* current table index bits */ 2965 drop = 0; /* current bits to drop from code for index */ 2966 low = -1; /* trigger new sub-table when len > root */ 2967 used = 1 << root; /* use root table entries */ 2968 mask = used - 1; /* mask for comparing low */ 2969 2970 /* check available table space */ 2971 if ((type === LENS && used > ENOUGH_LENS) || 2972 (type === DISTS && used > ENOUGH_DISTS)) { 2973 return 1; 2974 } 2975 2976 /* process all codes and make table entries */ 2977 for (;;) { 2978 /* create table entry */ 2979 here_bits = len - drop; 2980 if (work[sym] < end) { 2981 here_op = 0; 2982 here_val = work[sym]; 2983 } 2984 else if (work[sym] > end) { 2985 here_op = extra[extra_index + work[sym]]; 2986 here_val = base[base_index + work[sym]]; 2987 } 2988 else { 2989 here_op = 32 + 64; /* end of block */ 2990 here_val = 0; 2991 } 2992 2993 /* replicate for those indices with low len bits equal to huff */ 2994 incr = 1 << (len - drop); 2995 fill = 1 << curr; 2996 min = fill; /* save offset to next table */ 2997 do { 2998 fill -= incr; 2999 table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; 3000 } while (fill !== 0); 3001 3002 /* backwards increment the len-bit code huff */ 3003 incr = 1 << (len - 1); 3004 while (huff & incr) { 3005 incr >>= 1; 3006 } 3007 if (incr !== 0) { 3008 huff &= incr - 1; 3009 huff += incr; 3010 } else { 3011 huff = 0; 3012 } 3013 3014 /* go to next symbol, update count, len */ 3015 sym++; 3016 if (--count[len] === 0) { 3017 if (len === max) { break; } 3018 len = lens[lens_index + work[sym]]; 3019 } 3020 3021 /* create new sub-table if needed */ 3022 if (len > root && (huff & mask) !== low) { 3023 /* if first time, transition to sub-tables */ 3024 if (drop === 0) { 3025 drop = root; 3026 } 3027 3028 /* increment past last table */ 3029 next += min; /* here min is 1 << curr */ 3030 3031 /* determine length of next table */ 3032 curr = len - drop; 3033 left = 1 << curr; 3034 while (curr + drop < max) { 3035 left -= count[curr + drop]; 3036 if (left <= 0) { break; } 3037 curr++; 3038 left <<= 1; 3039 } 3040 3041 /* check for enough space */ 3042 used += 1 << curr; 3043 if ((type === LENS && used > ENOUGH_LENS) || 3044 (type === DISTS && used > ENOUGH_DISTS)) { 3045 return 1; 3046 } 3047 3048 /* point entry in root table to sub-table */ 3049 low = huff & mask; 3050 /*table.op[low] = curr; 3051 table.bits[low] = root; 3052 table.val[low] = next - opts.table_index;*/ 3053 table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; 3054 } 3055 } 3056 3057 /* fill in remaining table entry if code is incomplete (guaranteed to have 3058 at most one remaining entry, since if the code is incomplete, the 3059 maximum code length that was allowed to get this far is one bit) */ 3060 if (huff !== 0) { 3061 //table.op[next + huff] = 64; /* invalid code marker */ 3062 //table.bits[next + huff] = len - drop; 3063 //table.val[next + huff] = 0; 3064 table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; 3065 } 3066 3067 /* set return parameters */ 3068 //opts.table_index += used; 3069 opts.bits = root; 3070 return 0; 3071 }; 3072 3073 },{"../utils/common":1}],10:[function(require,module,exports){ 3074 'use strict'; 3075 3076 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 3077 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 3078 // 3079 // This software is provided 'as-is', without any express or implied 3080 // warranty. In no event will the authors be held liable for any damages 3081 // arising from the use of this software. 3082 // 3083 // Permission is granted to anyone to use this software for any purpose, 3084 // including commercial applications, and to alter it and redistribute it 3085 // freely, subject to the following restrictions: 3086 // 3087 // 1. The origin of this software must not be misrepresented; you must not 3088 // claim that you wrote the original software. If you use this software 3089 // in a product, an acknowledgment in the product documentation would be 3090 // appreciated but is not required. 3091 // 2. Altered source versions must be plainly marked as such, and must not be 3092 // misrepresented as being the original software. 3093 // 3. This notice may not be removed or altered from any source distribution. 3094 3095 module.exports = { 3096 2: 'need dictionary', /* Z_NEED_DICT 2 */ 3097 1: 'stream end', /* Z_STREAM_END 1 */ 3098 0: '', /* Z_OK 0 */ 3099 '-1': 'file error', /* Z_ERRNO (-1) */ 3100 '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ 3101 '-3': 'data error', /* Z_DATA_ERROR (-3) */ 3102 '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ 3103 '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ 3104 '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ 3105 }; 3106 3107 },{}],11:[function(require,module,exports){ 3108 'use strict'; 3109 3110 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 3111 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 3112 // 3113 // This software is provided 'as-is', without any express or implied 3114 // warranty. In no event will the authors be held liable for any damages 3115 // arising from the use of this software. 3116 // 3117 // Permission is granted to anyone to use this software for any purpose, 3118 // including commercial applications, and to alter it and redistribute it 3119 // freely, subject to the following restrictions: 3120 // 3121 // 1. The origin of this software must not be misrepresented; you must not 3122 // claim that you wrote the original software. If you use this software 3123 // in a product, an acknowledgment in the product documentation would be 3124 // appreciated but is not required. 3125 // 2. Altered source versions must be plainly marked as such, and must not be 3126 // misrepresented as being the original software. 3127 // 3. This notice may not be removed or altered from any source distribution. 3128 3129 function ZStream() { 3130 /* next input byte */ 3131 this.input = null; // JS specific, because we have no pointers 3132 this.next_in = 0; 3133 /* number of bytes available at input */ 3134 this.avail_in = 0; 3135 /* total number of input bytes read so far */ 3136 this.total_in = 0; 3137 /* next output byte should be put there */ 3138 this.output = null; // JS specific, because we have no pointers 3139 this.next_out = 0; 3140 /* remaining free space at output */ 3141 this.avail_out = 0; 3142 /* total number of bytes output so far */ 3143 this.total_out = 0; 3144 /* last error message, NULL if no error */ 3145 this.msg = ''/*Z_NULL*/; 3146 /* not visible by applications */ 3147 this.state = null; 3148 /* best guess about the data type: binary or text */ 3149 this.data_type = 2/*Z_UNKNOWN*/; 3150 /* adler32 value of the uncompressed data */ 3151 this.adler = 0; 3152 } 3153 3154 module.exports = ZStream; 3155 3156 },{}],"/lib/inflate.js":[function(require,module,exports){ 3157 'use strict'; 3158 3159 3160 var zlib_inflate = require('./zlib/inflate'); 3161 var utils = require('./utils/common'); 3162 var strings = require('./utils/strings'); 3163 var c = require('./zlib/constants'); 3164 var msg = require('./zlib/messages'); 3165 var ZStream = require('./zlib/zstream'); 3166 var GZheader = require('./zlib/gzheader'); 3167 3168 var toString = Object.prototype.toString; 3169 3170 /** 3171 * class Inflate 3172 * 3173 * Generic JS-style wrapper for zlib calls. If you don't need 3174 * streaming behaviour - use more simple functions: [[inflate]] 3175 * and [[inflateRaw]]. 3176 **/ 3177 3178 /* internal 3179 * inflate.chunks -> Array 3180 * 3181 * Chunks of output data, if [[Inflate#onData]] not overridden. 3182 **/ 3183 3184 /** 3185 * Inflate.result -> Uint8Array|Array|String 3186 * 3187 * Uncompressed result, generated by default [[Inflate#onData]] 3188 * and [[Inflate#onEnd]] handlers. Filled after you push last chunk 3189 * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you 3190 * push a chunk with explicit flush (call [[Inflate#push]] with 3191 * `Z_SYNC_FLUSH` param). 3192 **/ 3193 3194 /** 3195 * Inflate.err -> Number 3196 * 3197 * Error code after inflate finished. 0 (Z_OK) on success. 3198 * Should be checked if broken data possible. 3199 **/ 3200 3201 /** 3202 * Inflate.msg -> String 3203 * 3204 * Error message, if [[Inflate.err]] != 0 3205 **/ 3206 3207 3208 /** 3209 * new Inflate(options) 3210 * - options (Object): zlib inflate options. 3211 * 3212 * Creates new inflator instance with specified params. Throws exception 3213 * on bad params. Supported options: 3214 * 3215 * - `windowBits` 3216 * - `dictionary` 3217 * 3218 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 3219 * for more information on these. 3220 * 3221 * Additional options, for internal needs: 3222 * 3223 * - `chunkSize` - size of generated data chunks (16K by default) 3224 * - `raw` (Boolean) - do raw inflate 3225 * - `to` (String) - if equal to 'string', then result will be converted 3226 * from utf8 to utf16 (javascript) string. When string output requested, 3227 * chunk length can differ from `chunkSize`, depending on content. 3228 * 3229 * By default, when no options set, autodetect deflate/gzip data format via 3230 * wrapper header. 3231 * 3232 * ##### Example: 3233 * 3234 * ```javascript 3235 * var pako = require('pako') 3236 * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) 3237 * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); 3238 * 3239 * var inflate = new pako.Inflate({ level: 3}); 3240 * 3241 * inflate.push(chunk1, false); 3242 * inflate.push(chunk2, true); // true -> last chunk 3243 * 3244 * if (inflate.err) { throw new Error(inflate.err); } 3245 * 3246 * console.log(inflate.result); 3247 * ``` 3248 **/ 3249 function Inflate(options) { 3250 if (!(this instanceof Inflate)) return new Inflate(options); 3251 3252 this.options = utils.assign({ 3253 chunkSize: 16384, 3254 windowBits: 0, 3255 to: '' 3256 }, options || {}); 3257 3258 var opt = this.options; 3259 3260 // Force window size for `raw` data, if not set directly, 3261 // because we have no header for autodetect. 3262 if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { 3263 opt.windowBits = -opt.windowBits; 3264 if (opt.windowBits === 0) { opt.windowBits = -15; } 3265 } 3266 3267 // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate 3268 if ((opt.windowBits >= 0) && (opt.windowBits < 16) && 3269 !(options && options.windowBits)) { 3270 opt.windowBits += 32; 3271 } 3272 3273 // Gzip header has no info about windows size, we can do autodetect only 3274 // for deflate. So, if window size not set, force it to max when gzip possible 3275 if ((opt.windowBits > 15) && (opt.windowBits < 48)) { 3276 // bit 3 (16) -> gzipped data 3277 // bit 4 (32) -> autodetect gzip/deflate 3278 if ((opt.windowBits & 15) === 0) { 3279 opt.windowBits |= 15; 3280 } 3281 } 3282 3283 this.err = 0; // error code, if happens (0 = Z_OK) 3284 this.msg = ''; // error message 3285 this.ended = false; // used to avoid multiple onEnd() calls 3286 this.chunks = []; // chunks of compressed data 3287 3288 this.strm = new ZStream(); 3289 this.strm.avail_out = 0; 3290 3291 var status = zlib_inflate.inflateInit2( 3292 this.strm, 3293 opt.windowBits 3294 ); 3295 3296 if (status !== c.Z_OK) { 3297 throw new Error(msg[status]); 3298 } 3299 3300 this.header = new GZheader(); 3301 3302 zlib_inflate.inflateGetHeader(this.strm, this.header); 3303 3304 // Setup dictionary 3305 if (opt.dictionary) { 3306 // Convert data if needed 3307 if (typeof opt.dictionary === 'string') { 3308 opt.dictionary = strings.string2buf(opt.dictionary); 3309 } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { 3310 opt.dictionary = new Uint8Array(opt.dictionary); 3311 } 3312 if (opt.raw) { //In raw mode we need to set the dictionary early 3313 status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); 3314 if (status !== c.Z_OK) { 3315 throw new Error(msg[status]); 3316 } 3317 } 3318 } 3319 } 3320 3321 /** 3322 * Inflate#push(data[, mode]) -> Boolean 3323 * - data (Uint8Array|Array|ArrayBuffer|String): input data 3324 * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. 3325 * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. 3326 * 3327 * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with 3328 * new output chunks. Returns `true` on success. The last data block must have 3329 * mode Z_FINISH (or `true`). That will flush internal pending buffers and call 3330 * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you 3331 * can use mode Z_SYNC_FLUSH, keeping the decompression context. 3332 * 3333 * On fail call [[Inflate#onEnd]] with error code and return false. 3334 * 3335 * We strongly recommend to use `Uint8Array` on input for best speed (output 3336 * format is detected automatically). Also, don't skip last param and always 3337 * use the same type in your code (boolean or number). That will improve JS speed. 3338 * 3339 * For regular `Array`-s make sure all elements are [0..255]. 3340 * 3341 * ##### Example 3342 * 3343 * ```javascript 3344 * push(chunk, false); // push one of data chunks 3345 * ... 3346 * push(chunk, true); // push last chunk 3347 * ``` 3348 **/ 3349 Inflate.prototype.push = function (data, mode) { 3350 var strm = this.strm; 3351 var chunkSize = this.options.chunkSize; 3352 var dictionary = this.options.dictionary; 3353 var status, _mode; 3354 var next_out_utf8, tail, utf8str; 3355 3356 // Flag to properly process Z_BUF_ERROR on testing inflate call 3357 // when we check that all output data was flushed. 3358 var allowBufError = false; 3359 3360 if (this.ended) { return false; } 3361 _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); 3362 3363 // Convert data if needed 3364 if (typeof data === 'string') { 3365 // Only binary strings can be decompressed on practice 3366 strm.input = strings.binstring2buf(data); 3367 } else if (toString.call(data) === '[object ArrayBuffer]') { 3368 strm.input = new Uint8Array(data); 3369 } else { 3370 strm.input = data; 3371 } 3372 3373 strm.next_in = 0; 3374 strm.avail_in = strm.input.length; 3375 3376 do { 3377 if (strm.avail_out === 0) { 3378 strm.output = new utils.Buf8(chunkSize); 3379 strm.next_out = 0; 3380 strm.avail_out = chunkSize; 3381 } 3382 3383 status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ 3384 3385 if (status === c.Z_NEED_DICT && dictionary) { 3386 status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); 3387 } 3388 3389 if (status === c.Z_BUF_ERROR && allowBufError === true) { 3390 status = c.Z_OK; 3391 allowBufError = false; 3392 } 3393 3394 if (status !== c.Z_STREAM_END && status !== c.Z_OK) { 3395 this.onEnd(status); 3396 this.ended = true; 3397 return false; 3398 } 3399 3400 if (strm.next_out) { 3401 if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { 3402 3403 if (this.options.to === 'string') { 3404 3405 next_out_utf8 = strings.utf8border(strm.output, strm.next_out); 3406 3407 tail = strm.next_out - next_out_utf8; 3408 utf8str = strings.buf2string(strm.output, next_out_utf8); 3409 3410 // move tail 3411 strm.next_out = tail; 3412 strm.avail_out = chunkSize - tail; 3413 if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } 3414 3415 this.onData(utf8str); 3416 3417 } else { 3418 this.onData(utils.shrinkBuf(strm.output, strm.next_out)); 3419 } 3420 } 3421 } 3422 3423 // When no more input data, we should check that internal inflate buffers 3424 // are flushed. The only way to do it when avail_out = 0 - run one more 3425 // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. 3426 // Here we set flag to process this error properly. 3427 // 3428 // NOTE. Deflate does not return error in this case and does not needs such 3429 // logic. 3430 if (strm.avail_in === 0 && strm.avail_out === 0) { 3431 allowBufError = true; 3432 } 3433 3434 } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); 3435 3436 if (status === c.Z_STREAM_END) { 3437 _mode = c.Z_FINISH; 3438 } 3439 3440 // Finalize on the last chunk. 3441 if (_mode === c.Z_FINISH) { 3442 status = zlib_inflate.inflateEnd(this.strm); 3443 this.onEnd(status); 3444 this.ended = true; 3445 return status === c.Z_OK; 3446 } 3447 3448 // callback interim results if Z_SYNC_FLUSH. 3449 if (_mode === c.Z_SYNC_FLUSH) { 3450 this.onEnd(c.Z_OK); 3451 strm.avail_out = 0; 3452 return true; 3453 } 3454 3455 return true; 3456 }; 3457 3458 3459 /** 3460 * Inflate#onData(chunk) -> Void 3461 * - chunk (Uint8Array|Array|String): output data. Type of array depends 3462 * on js engine support. When string output requested, each chunk 3463 * will be string. 3464 * 3465 * By default, stores data blocks in `chunks[]` property and glue 3466 * those in `onEnd`. Override this handler, if you need another behaviour. 3467 **/ 3468 Inflate.prototype.onData = function (chunk) { 3469 this.chunks.push(chunk); 3470 }; 3471 3472 3473 /** 3474 * Inflate#onEnd(status) -> Void 3475 * - status (Number): inflate status. 0 (Z_OK) on success, 3476 * other if not. 3477 * 3478 * Called either after you tell inflate that the input stream is 3479 * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) 3480 * or if an error happened. By default - join collected chunks, 3481 * free memory and fill `results` / `err` properties. 3482 **/ 3483 Inflate.prototype.onEnd = function (status) { 3484 // On success - join 3485 if (status === c.Z_OK) { 3486 if (this.options.to === 'string') { 3487 // Glue & convert here, until we teach pako to send 3488 // utf8 aligned strings to onData 3489 this.result = this.chunks.join(''); 3490 } else { 3491 this.result = utils.flattenChunks(this.chunks); 3492 } 3493 } 3494 this.chunks = []; 3495 this.err = status; 3496 this.msg = this.strm.msg; 3497 }; 3498 3499 3500 /** 3501 * inflate(data[, options]) -> Uint8Array|Array|String 3502 * - data (Uint8Array|Array|String): input data to decompress. 3503 * - options (Object): zlib inflate options. 3504 * 3505 * Decompress `data` with inflate/ungzip and `options`. Autodetect 3506 * format via wrapper header by default. That's why we don't provide 3507 * separate `ungzip` method. 3508 * 3509 * Supported options are: 3510 * 3511 * - windowBits 3512 * 3513 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 3514 * for more information. 3515 * 3516 * Sugar (options): 3517 * 3518 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify 3519 * negative windowBits implicitly. 3520 * - `to` (String) - if equal to 'string', then result will be converted 3521 * from utf8 to utf16 (javascript) string. When string output requested, 3522 * chunk length can differ from `chunkSize`, depending on content. 3523 * 3524 * 3525 * ##### Example: 3526 * 3527 * ```javascript 3528 * var pako = require('pako') 3529 * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) 3530 * , output; 3531 * 3532 * try { 3533 * output = pako.inflate(input); 3534 * } catch (err) 3535 * console.log(err); 3536 * } 3537 * ``` 3538 **/ 3539 function inflate(input, options) { 3540 var inflator = new Inflate(options); 3541 3542 inflator.push(input, true); 3543 3544 // That will never happens, if you don't cheat with options :) 3545 if (inflator.err) { throw inflator.msg || msg[inflator.err]; } 3546 3547 return inflator.result; 3548 } 3549 3550 3551 /** 3552 * inflateRaw(data[, options]) -> Uint8Array|Array|String 3553 * - data (Uint8Array|Array|String): input data to decompress. 3554 * - options (Object): zlib inflate options. 3555 * 3556 * The same as [[inflate]], but creates raw data, without wrapper 3557 * (header and adler32 crc). 3558 **/ 3559 function inflateRaw(input, options) { 3560 options = options || {}; 3561 options.raw = true; 3562 return inflate(input, options); 3563 } 3564 3565 3566 /** 3567 * ungzip(data[, options]) -> Uint8Array|Array|String 3568 * - data (Uint8Array|Array|String): input data to decompress. 3569 * - options (Object): zlib inflate options. 3570 * 3571 * Just shortcut to [[inflate]], because it autodetects format 3572 * by header.content. Done for convenience. 3573 **/ 3574 3575 3576 exports.Inflate = Inflate; 3577 exports.inflate = inflate; 3578 exports.inflateRaw = inflateRaw; 3579 exports.ungzip = inflate; 3580 3581 },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js") 3582 }); 3583 /* eslint-enable */ 3584 3585 3586 /***/ }), 3587 3588 /***/ 6087: 3589 /***/ ((module) => { 3590 3591 "use strict"; 3592 module.exports = window["wp"]["element"]; 3593 3594 /***/ }), 3595 3596 /***/ 7143: 3597 /***/ ((module) => { 3598 3599 "use strict"; 3600 module.exports = window["wp"]["data"]; 3601 3602 /***/ }), 3603 3604 /***/ 7734: 3605 /***/ ((module) => { 3606 3607 "use strict"; 3608 3609 3610 // do not edit .js files directly - edit src/index.jst 3611 3612 3613 var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; 3614 3615 3616 module.exports = function equal(a, b) { 3617 if (a === b) return true; 3618 3619 if (a && b && typeof a == 'object' && typeof b == 'object') { 3620 if (a.constructor !== b.constructor) return false; 3621 3622 var length, i, keys; 3623 if (Array.isArray(a)) { 3624 length = a.length; 3625 if (length != b.length) return false; 3626 for (i = length; i-- !== 0;) 3627 if (!equal(a[i], b[i])) return false; 3628 return true; 3629 } 3630 3631 3632 if ((a instanceof Map) && (b instanceof Map)) { 3633 if (a.size !== b.size) return false; 3634 for (i of a.entries()) 3635 if (!b.has(i[0])) return false; 3636 for (i of a.entries()) 3637 if (!equal(i[1], b.get(i[0]))) return false; 3638 return true; 3639 } 3640 3641 if ((a instanceof Set) && (b instanceof Set)) { 3642 if (a.size !== b.size) return false; 3643 for (i of a.entries()) 3644 if (!b.has(i[0])) return false; 3645 return true; 3646 } 3647 3648 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { 3649 length = a.length; 3650 if (length != b.length) return false; 3651 for (i = length; i-- !== 0;) 3652 if (a[i] !== b[i]) return false; 3653 return true; 3654 } 3655 3656 3657 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 3658 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 3659 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 3660 3661 keys = Object.keys(a); 3662 length = keys.length; 3663 if (length !== Object.keys(b).length) return false; 3664 3665 for (i = length; i-- !== 0;) 3666 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 3667 3668 for (i = length; i-- !== 0;) { 3669 var key = keys[i]; 3670 3671 if (!equal(a[key], b[key])) return false; 3672 } 3673 3674 return true; 3675 } 3676 3677 // true if both NaN, false otherwise 3678 return a!==a && b!==b; 3679 }; 3680 3681 3682 /***/ }), 3683 3684 /***/ 7951: 3685 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 3686 3687 "use strict"; 3688 3689 // EXPORTS 3690 __webpack_require__.d(__webpack_exports__, { 3691 loadView: () => (/* reexport */ loadView), 3692 useView: () => (/* reexport */ useView) 3693 }); 3694 3695 ;// ./node_modules/dequal/dist/index.mjs 3696 var has = Object.prototype.hasOwnProperty; 3697 3698 function find(iter, tar, key) { 3699 for (key of iter.keys()) { 3700 if (dequal(key, tar)) return key; 3701 } 3702 } 3703 3704 function dequal(foo, bar) { 3705 var ctor, len, tmp; 3706 if (foo === bar) return true; 3707 3708 if (foo && bar && (ctor=foo.constructor) === bar.constructor) { 3709 if (ctor === Date) return foo.getTime() === bar.getTime(); 3710 if (ctor === RegExp) return foo.toString() === bar.toString(); 3711 3712 if (ctor === Array) { 3713 if ((len=foo.length) === bar.length) { 3714 while (len-- && dequal(foo[len], bar[len])); 3715 } 3716 return len === -1; 3717 } 3718 3719 if (ctor === Set) { 3720 if (foo.size !== bar.size) { 3721 return false; 3722 } 3723 for (len of foo) { 3724 tmp = len; 3725 if (tmp && typeof tmp === 'object') { 3726 tmp = find(bar, tmp); 3727 if (!tmp) return false; 3728 } 3729 if (!bar.has(tmp)) return false; 3730 } 3731 return true; 3732 } 3733 3734 if (ctor === Map) { 3735 if (foo.size !== bar.size) { 3736 return false; 3737 } 3738 for (len of foo) { 3739 tmp = len[0]; 3740 if (tmp && typeof tmp === 'object') { 3741 tmp = find(bar, tmp); 3742 if (!tmp) return false; 3743 } 3744 if (!dequal(len[1], bar.get(tmp))) { 3745 return false; 3746 } 3747 } 3748 return true; 3749 } 3750 3751 if (ctor === ArrayBuffer) { 3752 foo = new Uint8Array(foo); 3753 bar = new Uint8Array(bar); 3754 } else if (ctor === DataView) { 3755 if ((len=foo.byteLength) === bar.byteLength) { 3756 while (len-- && foo.getInt8(len) === bar.getInt8(len)); 3757 } 3758 return len === -1; 3759 } 3760 3761 if (ArrayBuffer.isView(foo)) { 3762 if ((len=foo.byteLength) === bar.byteLength) { 3763 while (len-- && foo[len] === bar[len]); 3764 } 3765 return len === -1; 3766 } 3767 3768 if (!ctor || typeof foo === 'object') { 3769 len = 0; 3770 for (ctor in foo) { 3771 if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; 3772 if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; 3773 } 3774 return Object.keys(bar).length === len; 3775 } 3776 } 3777 3778 return foo !== foo && bar !== bar; 3779 } 3780 3781 ;// ./node_modules/@wordpress/views/build-module/preference-keys.js 3782 function generatePreferenceKey(kind, name, slug) { 3783 return `dataviews-$kind}-$name}-$slug}`; 3784 } 3785 3786 3787 // EXTERNAL MODULE: external ["wp","element"] 3788 var external_wp_element_ = __webpack_require__(6087); 3789 // EXTERNAL MODULE: external ["wp","data"] 3790 var external_wp_data_ = __webpack_require__(7143); 3791 // EXTERNAL MODULE: external ["wp","preferences"] 3792 var external_wp_preferences_ = __webpack_require__(1233); 3793 ;// ./node_modules/@wordpress/views/build-module/use-view.js 3794 3795 3796 3797 3798 3799 function omit(obj, keys) { 3800 const result = { ...obj }; 3801 for (const key of keys) { 3802 delete result[key]; 3803 } 3804 return result; 3805 } 3806 function useView(config) { 3807 const { kind, name, slug, defaultView, queryParams, onChangeQueryParams } = config; 3808 const preferenceKey = generatePreferenceKey(kind, name, slug); 3809 const persistedView = (0,external_wp_data_.useSelect)( 3810 (select) => { 3811 return select(external_wp_preferences_.store).get( 3812 "core/views", 3813 preferenceKey 3814 ); 3815 }, 3816 [preferenceKey] 3817 ); 3818 const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 3819 const baseView = persistedView ?? defaultView; 3820 const page = queryParams?.page ?? baseView.page ?? 1; 3821 const search = queryParams?.search ?? baseView.search ?? ""; 3822 const view = (0,external_wp_element_.useMemo)(() => { 3823 return { 3824 ...baseView, 3825 page, 3826 search 3827 }; 3828 }, [baseView, page, search]); 3829 const isModified = !!persistedView; 3830 const updateView = (0,external_wp_element_.useCallback)( 3831 (newView) => { 3832 const urlParams = { 3833 page: newView?.page, 3834 search: newView?.search 3835 }; 3836 const preferenceView = omit(newView, ["page", "search"]); 3837 if (onChangeQueryParams && !dequal(urlParams, { page, search })) { 3838 onChangeQueryParams(urlParams); 3839 } 3840 if (!dequal(baseView, preferenceView)) { 3841 if (dequal(preferenceView, defaultView)) { 3842 set("core/views", preferenceKey, void 0); 3843 } else { 3844 set("core/views", preferenceKey, preferenceView); 3845 } 3846 } 3847 }, 3848 [ 3849 onChangeQueryParams, 3850 page, 3851 search, 3852 baseView, 3853 defaultView, 3854 set, 3855 preferenceKey 3856 ] 3857 ); 3858 const resetToDefault = (0,external_wp_element_.useCallback)(() => { 3859 set("core/views", preferenceKey, void 0); 3860 }, [preferenceKey, set]); 3861 return { 3862 view, 3863 isModified, 3864 updateView, 3865 resetToDefault 3866 }; 3867 } 3868 3869 3870 ;// ./node_modules/@wordpress/views/build-module/load-view.js 3871 3872 3873 3874 async function loadView(config) { 3875 const { kind, name, slug, defaultView, queryParams } = config; 3876 const preferenceKey = generatePreferenceKey(kind, name, slug); 3877 const persistedView = (0,external_wp_data_.select)(external_wp_preferences_.store).get( 3878 "core/views", 3879 preferenceKey 3880 ); 3881 const baseView = persistedView ?? defaultView; 3882 const page = queryParams?.page ?? 1; 3883 const search = queryParams?.search ?? ""; 3884 return { 3885 ...baseView, 3886 page, 3887 search 3888 }; 3889 } 3890 3891 3892 ;// ./node_modules/@wordpress/views/build-module/index.js 3893 3894 3895 3896 3897 3898 /***/ }), 3899 3900 /***/ 8572: 3901 /***/ ((module) => { 3902 3903 /** 3904 * Credits: 3905 * 3906 * lib-font 3907 * https://github.com/Pomax/lib-font 3908 * https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js 3909 * 3910 * The MIT License (MIT) 3911 * 3912 * Copyright (c) 2020 pomax@nihongoresources.com 3913 * 3914 * Permission is hereby granted, free of charge, to any person obtaining a copy 3915 * of this software and associated documentation files (the "Software"), to deal 3916 * in the Software without restriction, including without limitation the rights 3917 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3918 * copies of the Software, and to permit persons to whom the Software is 3919 * furnished to do so, subject to the following conditions: 3920 * 3921 * The above copyright notice and this permission notice shall be included in all 3922 * copies or substantial portions of the Software. 3923 * 3924 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3925 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3926 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3927 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3928 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3929 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 3930 * SOFTWARE. 3931 */ 3932 3933 /* eslint eslint-comments/no-unlimited-disable: 0 */ 3934 /* eslint-disable */ 3935 (function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 3936 /* Copyright 2013 Google Inc. All Rights Reserved. 3937 3938 Licensed under the Apache License, Version 2.0 (the "License"); 3939 you may not use this file except in compliance with the License. 3940 You may obtain a copy of the License at 3941 3942 http://www.apache.org/licenses/LICENSE-2.0 3943 3944 Unless required by applicable law or agreed to in writing, software 3945 distributed under the License is distributed on an "AS IS" BASIS, 3946 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3947 See the License for the specific language governing permissions and 3948 limitations under the License. 3949 3950 Bit reading helpers 3951 */ 3952 3953 var BROTLI_READ_SIZE = 4096; 3954 var BROTLI_IBUF_SIZE = (2 * BROTLI_READ_SIZE + 32); 3955 var BROTLI_IBUF_MASK = (2 * BROTLI_READ_SIZE - 1); 3956 3957 var kBitMask = new Uint32Array([ 3958 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 3959 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215 3960 ]); 3961 3962 /* Input byte buffer, consist of a ringbuffer and a "slack" region where */ 3963 /* bytes from the start of the ringbuffer are copied. */ 3964 function BrotliBitReader(input) { 3965 this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE); 3966 this.input_ = input; /* input callback */ 3967 3968 this.reset(); 3969 } 3970 3971 BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE; 3972 BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK; 3973 3974 BrotliBitReader.prototype.reset = function() { 3975 this.buf_ptr_ = 0; /* next input will write here */ 3976 this.val_ = 0; /* pre-fetched bits */ 3977 this.pos_ = 0; /* byte position in stream */ 3978 this.bit_pos_ = 0; /* current bit-reading position in val_ */ 3979 this.bit_end_pos_ = 0; /* bit-reading end position from LSB of val_ */ 3980 this.eos_ = 0; /* input stream is finished */ 3981 3982 this.readMoreInput(); 3983 for (var i = 0; i < 4; i++) { 3984 this.val_ |= this.buf_[this.pos_] << (8 * i); 3985 ++this.pos_; 3986 } 3987 3988 return this.bit_end_pos_ > 0; 3989 }; 3990 3991 /* Fills up the input ringbuffer by calling the input callback. 3992 3993 Does nothing if there are at least 32 bytes present after current position. 3994 3995 Returns 0 if either: 3996 - the input callback returned an error, or 3997 - there is no more input and the position is past the end of the stream. 3998 3999 After encountering the end of the input stream, 32 additional zero bytes are 4000 copied to the ringbuffer, therefore it is safe to call this function after 4001 every 32 bytes of input is read. 4002 */ 4003 BrotliBitReader.prototype.readMoreInput = function() { 4004 if (this.bit_end_pos_ > 256) { 4005 return; 4006 } else if (this.eos_) { 4007 if (this.bit_pos_ > this.bit_end_pos_) 4008 throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_); 4009 } else { 4010 var dst = this.buf_ptr_; 4011 var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE); 4012 if (bytes_read < 0) { 4013 throw new Error('Unexpected end of input'); 4014 } 4015 4016 if (bytes_read < BROTLI_READ_SIZE) { 4017 this.eos_ = 1; 4018 /* Store 32 bytes of zero after the stream end. */ 4019 for (var p = 0; p < 32; p++) 4020 this.buf_[dst + bytes_read + p] = 0; 4021 } 4022 4023 if (dst === 0) { 4024 /* Copy the head of the ringbuffer to the slack region. */ 4025 for (var p = 0; p < 32; p++) 4026 this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p]; 4027 4028 this.buf_ptr_ = BROTLI_READ_SIZE; 4029 } else { 4030 this.buf_ptr_ = 0; 4031 } 4032 4033 this.bit_end_pos_ += bytes_read << 3; 4034 } 4035 }; 4036 4037 /* Guarantees that there are at least 24 bits in the buffer. */ 4038 BrotliBitReader.prototype.fillBitWindow = function() { 4039 while (this.bit_pos_ >= 8) { 4040 this.val_ >>>= 8; 4041 this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24; 4042 ++this.pos_; 4043 this.bit_pos_ = this.bit_pos_ - 8 >>> 0; 4044 this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0; 4045 } 4046 }; 4047 4048 /* Reads the specified number of bits from Read Buffer. */ 4049 BrotliBitReader.prototype.readBits = function(n_bits) { 4050 if (32 - this.bit_pos_ < n_bits) { 4051 this.fillBitWindow(); 4052 } 4053 4054 var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]); 4055 this.bit_pos_ += n_bits; 4056 return val; 4057 }; 4058 4059 module.exports = BrotliBitReader; 4060 4061 },{}],2:[function(require,module,exports){ 4062 /* Copyright 2013 Google Inc. All Rights Reserved. 4063 4064 Licensed under the Apache License, Version 2.0 (the "License"); 4065 you may not use this file except in compliance with the License. 4066 You may obtain a copy of the License at 4067 4068 http://www.apache.org/licenses/LICENSE-2.0 4069 4070 Unless required by applicable law or agreed to in writing, software 4071 distributed under the License is distributed on an "AS IS" BASIS, 4072 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4073 See the License for the specific language governing permissions and 4074 limitations under the License. 4075 4076 Lookup table to map the previous two bytes to a context id. 4077 4078 There are four different context modeling modes defined here: 4079 CONTEXT_LSB6: context id is the least significant 6 bits of the last byte, 4080 CONTEXT_MSB6: context id is the most significant 6 bits of the last byte, 4081 CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text, 4082 CONTEXT_SIGNED: second-order context model tuned for signed integers. 4083 4084 The context id for the UTF8 context model is calculated as follows. If p1 4085 and p2 are the previous two bytes, we calcualte the context as 4086 4087 context = kContextLookup[p1] | kContextLookup[p2 + 256]. 4088 4089 If the previous two bytes are ASCII characters (i.e. < 128), this will be 4090 equivalent to 4091 4092 context = 4 * context1(p1) + context2(p2), 4093 4094 where context1 is based on the previous byte in the following way: 4095 4096 0 : non-ASCII control 4097 1 : \t, \n, \r 4098 2 : space 4099 3 : other punctuation 4100 4 : " ' 4101 5 : % 4102 6 : ( < [ { 4103 7 : ) > ] } 4104 8 : , ; : 4105 9 : . 4106 10 : = 4107 11 : number 4108 12 : upper-case vowel 4109 13 : upper-case consonant 4110 14 : lower-case vowel 4111 15 : lower-case consonant 4112 4113 and context2 is based on the second last byte: 4114 4115 0 : control, space 4116 1 : punctuation 4117 2 : upper-case letter, number 4118 3 : lower-case letter 4119 4120 If the last byte is ASCII, and the second last byte is not (in a valid UTF8 4121 stream it will be a continuation byte, value between 128 and 191), the 4122 context is the same as if the second last byte was an ASCII control or space. 4123 4124 If the last byte is a UTF8 lead byte (value >= 192), then the next byte will 4125 be a continuation byte and the context id is 2 or 3 depending on the LSB of 4126 the last byte and to a lesser extent on the second last byte if it is ASCII. 4127 4128 If the last byte is a UTF8 continuation byte, the second last byte can be: 4129 - continuation byte: the next byte is probably ASCII or lead byte (assuming 4130 4-byte UTF8 characters are rare) and the context id is 0 or 1. 4131 - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1 4132 - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3 4133 4134 The possible value combinations of the previous two bytes, the range of 4135 context ids and the type of the next byte is summarized in the table below: 4136 4137 |--------\-----------------------------------------------------------------| 4138 | \ Last byte | 4139 | Second \---------------------------------------------------------------| 4140 | last byte \ ASCII | cont. byte | lead byte | 4141 | \ (0-127) | (128-191) | (192-) | 4142 |=============|===================|=====================|==================| 4143 | ASCII | next: ASCII/lead | not valid | next: cont. | 4144 | (0-127) | context: 4 - 63 | | context: 2 - 3 | 4145 |-------------|-------------------|---------------------|------------------| 4146 | cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. | 4147 | (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 | 4148 |-------------|-------------------|---------------------|------------------| 4149 | lead byte | not valid | next: ASCII/lead | not valid | 4150 | (192-207) | | context: 0 - 1 | | 4151 |-------------|-------------------|---------------------|------------------| 4152 | lead byte | not valid | next: cont. | not valid | 4153 | (208-) | | context: 2 - 3 | | 4154 |-------------|-------------------|---------------------|------------------| 4155 4156 The context id for the signed context mode is calculated as: 4157 4158 context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2]. 4159 4160 For any context modeling modes, the context ids can be calculated by |-ing 4161 together two lookups from one table using context model dependent offsets: 4162 4163 context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2]. 4164 4165 where offset1 and offset2 are dependent on the context mode. 4166 */ 4167 4168 var CONTEXT_LSB6 = 0; 4169 var CONTEXT_MSB6 = 1; 4170 var CONTEXT_UTF8 = 2; 4171 var CONTEXT_SIGNED = 3; 4172 4173 /* Common context lookup table for all context modes. */ 4174 exports.lookup = new Uint8Array([ 4175 /* CONTEXT_UTF8, last byte. */ 4176 /* ASCII range. */ 4177 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 4178 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4179 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12, 4180 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12, 4181 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 4182 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12, 4183 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 4184 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0, 4185 /* UTF8 continuation byte range. */ 4186 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4187 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4188 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4189 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4190 /* UTF8 lead byte range. */ 4191 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4192 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4193 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4194 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4195 /* CONTEXT_UTF8 second last byte. */ 4196 /* ASCII range. */ 4197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4198 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4199 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4201 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 4203 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4204 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, 4205 /* UTF8 continuation byte range. */ 4206 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4211 /* UTF8 lead byte range. */ 4212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4215 /* CONTEXT_SIGNED, second last byte. */ 4216 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4217 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4218 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4219 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4220 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4221 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4222 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4223 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4224 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4225 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4226 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4227 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4228 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4229 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4230 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4231 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 4232 /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */ 4233 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4234 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 4235 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 4236 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 4237 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 4238 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 4239 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 4240 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 4241 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 4242 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 4243 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 4244 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 4245 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 4246 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 4247 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 4248 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56, 4249 /* CONTEXT_LSB6, last byte. */ 4250 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 4251 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 4252 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 4253 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 4254 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 4255 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 4256 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 4257 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 4258 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 4259 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 4260 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 4261 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 4262 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 4263 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 4264 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 4265 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 4266 /* CONTEXT_MSB6, last byte. */ 4267 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4268 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4269 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 4270 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 4271 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 4272 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 4273 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 4274 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 4275 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 4276 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 4277 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 4278 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 4279 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 4280 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 4281 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 4282 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 4283 /* CONTEXT_{M,L}SB6, second last byte, */ 4284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4286 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4288 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4293 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4294 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4300 ]); 4301 4302 exports.lookupOffsets = new Uint16Array([ 4303 /* CONTEXT_LSB6 */ 4304 1024, 1536, 4305 /* CONTEXT_MSB6 */ 4306 1280, 1536, 4307 /* CONTEXT_UTF8 */ 4308 0, 256, 4309 /* CONTEXT_SIGNED */ 4310 768, 512, 4311 ]); 4312 4313 },{}],3:[function(require,module,exports){ 4314 /* Copyright 2013 Google Inc. All Rights Reserved. 4315 4316 Licensed under the Apache License, Version 2.0 (the "License"); 4317 you may not use this file except in compliance with the License. 4318 You may obtain a copy of the License at 4319 4320 http://www.apache.org/licenses/LICENSE-2.0 4321 4322 Unless required by applicable law or agreed to in writing, software 4323 distributed under the License is distributed on an "AS IS" BASIS, 4324 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4325 See the License for the specific language governing permissions and 4326 limitations under the License. 4327 */ 4328 4329 var BrotliInput = require('./streams').BrotliInput; 4330 var BrotliOutput = require('./streams').BrotliOutput; 4331 var BrotliBitReader = require('./bit_reader'); 4332 var BrotliDictionary = require('./dictionary'); 4333 var HuffmanCode = require('./huffman').HuffmanCode; 4334 var BrotliBuildHuffmanTable = require('./huffman').BrotliBuildHuffmanTable; 4335 var Context = require('./context'); 4336 var Prefix = require('./prefix'); 4337 var Transform = require('./transform'); 4338 4339 var kDefaultCodeLength = 8; 4340 var kCodeLengthRepeatCode = 16; 4341 var kNumLiteralCodes = 256; 4342 var kNumInsertAndCopyCodes = 704; 4343 var kNumBlockLengthCodes = 26; 4344 var kLiteralContextBits = 6; 4345 var kDistanceContextBits = 2; 4346 4347 var HUFFMAN_TABLE_BITS = 8; 4348 var HUFFMAN_TABLE_MASK = 0xff; 4349 /* Maximum possible Huffman table size for an alphabet size of 704, max code 4350 * length 15 and root table bits 8. */ 4351 var HUFFMAN_MAX_TABLE_SIZE = 1080; 4352 4353 var CODE_LENGTH_CODES = 18; 4354 var kCodeLengthCodeOrder = new Uint8Array([ 4355 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 4356 ]); 4357 4358 var NUM_DISTANCE_SHORT_CODES = 16; 4359 var kDistanceShortCodeIndexOffset = new Uint8Array([ 4360 3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 4361 ]); 4362 4363 var kDistanceShortCodeValueOffset = new Int8Array([ 4364 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 4365 ]); 4366 4367 var kMaxHuffmanTableSize = new Uint16Array([ 4368 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 4369 854, 886, 920, 952, 984, 1016, 1048, 1080 4370 ]); 4371 4372 function DecodeWindowBits(br) { 4373 var n; 4374 if (br.readBits(1) === 0) { 4375 return 16; 4376 } 4377 4378 n = br.readBits(3); 4379 if (n > 0) { 4380 return 17 + n; 4381 } 4382 4383 n = br.readBits(3); 4384 if (n > 0) { 4385 return 8 + n; 4386 } 4387 4388 return 17; 4389 } 4390 4391 /* Decodes a number in the range [0..255], by reading 1 - 11 bits. */ 4392 function DecodeVarLenUint8(br) { 4393 if (br.readBits(1)) { 4394 var nbits = br.readBits(3); 4395 if (nbits === 0) { 4396 return 1; 4397 } else { 4398 return br.readBits(nbits) + (1 << nbits); 4399 } 4400 } 4401 return 0; 4402 } 4403 4404 function MetaBlockLength() { 4405 this.meta_block_length = 0; 4406 this.input_end = 0; 4407 this.is_uncompressed = 0; 4408 this.is_metadata = false; 4409 } 4410 4411 function DecodeMetaBlockLength(br) { 4412 var out = new MetaBlockLength; 4413 var size_nibbles; 4414 var size_bytes; 4415 var i; 4416 4417 out.input_end = br.readBits(1); 4418 if (out.input_end && br.readBits(1)) { 4419 return out; 4420 } 4421 4422 size_nibbles = br.readBits(2) + 4; 4423 if (size_nibbles === 7) { 4424 out.is_metadata = true; 4425 4426 if (br.readBits(1) !== 0) 4427 throw new Error('Invalid reserved bit'); 4428 4429 size_bytes = br.readBits(2); 4430 if (size_bytes === 0) 4431 return out; 4432 4433 for (i = 0; i < size_bytes; i++) { 4434 var next_byte = br.readBits(8); 4435 if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0) 4436 throw new Error('Invalid size byte'); 4437 4438 out.meta_block_length |= next_byte << (i * 8); 4439 } 4440 } else { 4441 for (i = 0; i < size_nibbles; ++i) { 4442 var next_nibble = br.readBits(4); 4443 if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0) 4444 throw new Error('Invalid size nibble'); 4445 4446 out.meta_block_length |= next_nibble << (i * 4); 4447 } 4448 } 4449 4450 ++out.meta_block_length; 4451 4452 if (!out.input_end && !out.is_metadata) { 4453 out.is_uncompressed = br.readBits(1); 4454 } 4455 4456 return out; 4457 } 4458 4459 /* Decodes the next Huffman code from bit-stream. */ 4460 function ReadSymbol(table, index, br) { 4461 var start_index = index; 4462 4463 var nbits; 4464 br.fillBitWindow(); 4465 index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK; 4466 nbits = table[index].bits - HUFFMAN_TABLE_BITS; 4467 if (nbits > 0) { 4468 br.bit_pos_ += HUFFMAN_TABLE_BITS; 4469 index += table[index].value; 4470 index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1); 4471 } 4472 br.bit_pos_ += table[index].bits; 4473 return table[index].value; 4474 } 4475 4476 function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) { 4477 var symbol = 0; 4478 var prev_code_len = kDefaultCodeLength; 4479 var repeat = 0; 4480 var repeat_code_len = 0; 4481 var space = 32768; 4482 4483 var table = []; 4484 for (var i = 0; i < 32; i++) 4485 table.push(new HuffmanCode(0, 0)); 4486 4487 BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES); 4488 4489 while (symbol < num_symbols && space > 0) { 4490 var p = 0; 4491 var code_len; 4492 4493 br.readMoreInput(); 4494 br.fillBitWindow(); 4495 p += (br.val_ >>> br.bit_pos_) & 31; 4496 br.bit_pos_ += table[p].bits; 4497 code_len = table[p].value & 0xff; 4498 if (code_len < kCodeLengthRepeatCode) { 4499 repeat = 0; 4500 code_lengths[symbol++] = code_len; 4501 if (code_len !== 0) { 4502 prev_code_len = code_len; 4503 space -= 32768 >> code_len; 4504 } 4505 } else { 4506 var extra_bits = code_len - 14; 4507 var old_repeat; 4508 var repeat_delta; 4509 var new_len = 0; 4510 if (code_len === kCodeLengthRepeatCode) { 4511 new_len = prev_code_len; 4512 } 4513 if (repeat_code_len !== new_len) { 4514 repeat = 0; 4515 repeat_code_len = new_len; 4516 } 4517 old_repeat = repeat; 4518 if (repeat > 0) { 4519 repeat -= 2; 4520 repeat <<= extra_bits; 4521 } 4522 repeat += br.readBits(extra_bits) + 3; 4523 repeat_delta = repeat - old_repeat; 4524 if (symbol + repeat_delta > num_symbols) { 4525 throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols'); 4526 } 4527 4528 for (var x = 0; x < repeat_delta; x++) 4529 code_lengths[symbol + x] = repeat_code_len; 4530 4531 symbol += repeat_delta; 4532 4533 if (repeat_code_len !== 0) { 4534 space -= repeat_delta << (15 - repeat_code_len); 4535 } 4536 } 4537 } 4538 if (space !== 0) { 4539 throw new Error("[ReadHuffmanCodeLengths] space = " + space); 4540 } 4541 4542 for (; symbol < num_symbols; symbol++) 4543 code_lengths[symbol] = 0; 4544 } 4545 4546 function ReadHuffmanCode(alphabet_size, tables, table, br) { 4547 var table_size = 0; 4548 var simple_code_or_skip; 4549 var code_lengths = new Uint8Array(alphabet_size); 4550 4551 br.readMoreInput(); 4552 4553 /* simple_code_or_skip is used as follows: 4554 1 for simple code; 4555 0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */ 4556 simple_code_or_skip = br.readBits(2); 4557 if (simple_code_or_skip === 1) { 4558 /* Read symbols, codes & code lengths directly. */ 4559 var i; 4560 var max_bits_counter = alphabet_size - 1; 4561 var max_bits = 0; 4562 var symbols = new Int32Array(4); 4563 var num_symbols = br.readBits(2) + 1; 4564 while (max_bits_counter) { 4565 max_bits_counter >>= 1; 4566 ++max_bits; 4567 } 4568 4569 for (i = 0; i < num_symbols; ++i) { 4570 symbols[i] = br.readBits(max_bits) % alphabet_size; 4571 code_lengths[symbols[i]] = 2; 4572 } 4573 code_lengths[symbols[0]] = 1; 4574 switch (num_symbols) { 4575 case 1: 4576 break; 4577 case 3: 4578 if ((symbols[0] === symbols[1]) || 4579 (symbols[0] === symbols[2]) || 4580 (symbols[1] === symbols[2])) { 4581 throw new Error('[ReadHuffmanCode] invalid symbols'); 4582 } 4583 break; 4584 case 2: 4585 if (symbols[0] === symbols[1]) { 4586 throw new Error('[ReadHuffmanCode] invalid symbols'); 4587 } 4588 4589 code_lengths[symbols[1]] = 1; 4590 break; 4591 case 4: 4592 if ((symbols[0] === symbols[1]) || 4593 (symbols[0] === symbols[2]) || 4594 (symbols[0] === symbols[3]) || 4595 (symbols[1] === symbols[2]) || 4596 (symbols[1] === symbols[3]) || 4597 (symbols[2] === symbols[3])) { 4598 throw new Error('[ReadHuffmanCode] invalid symbols'); 4599 } 4600 4601 if (br.readBits(1)) { 4602 code_lengths[symbols[2]] = 3; 4603 code_lengths[symbols[3]] = 3; 4604 } else { 4605 code_lengths[symbols[0]] = 2; 4606 } 4607 break; 4608 } 4609 } else { /* Decode Huffman-coded code lengths. */ 4610 var i; 4611 var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES); 4612 var space = 32; 4613 var num_codes = 0; 4614 /* Static Huffman code for the code length code lengths */ 4615 var huff = [ 4616 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 4617 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1), 4618 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 4619 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5) 4620 ]; 4621 for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) { 4622 var code_len_idx = kCodeLengthCodeOrder[i]; 4623 var p = 0; 4624 var v; 4625 br.fillBitWindow(); 4626 p += (br.val_ >>> br.bit_pos_) & 15; 4627 br.bit_pos_ += huff[p].bits; 4628 v = huff[p].value; 4629 code_length_code_lengths[code_len_idx] = v; 4630 if (v !== 0) { 4631 space -= (32 >> v); 4632 ++num_codes; 4633 } 4634 } 4635 4636 if (!(num_codes === 1 || space === 0)) 4637 throw new Error('[ReadHuffmanCode] invalid num_codes or space'); 4638 4639 ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br); 4640 } 4641 4642 table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size); 4643 4644 if (table_size === 0) { 4645 throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: "); 4646 } 4647 4648 return table_size; 4649 } 4650 4651 function ReadBlockLength(table, index, br) { 4652 var code; 4653 var nbits; 4654 code = ReadSymbol(table, index, br); 4655 nbits = Prefix.kBlockLengthPrefixCode[code].nbits; 4656 return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits); 4657 } 4658 4659 function TranslateShortCodes(code, ringbuffer, index) { 4660 var val; 4661 if (code < NUM_DISTANCE_SHORT_CODES) { 4662 index += kDistanceShortCodeIndexOffset[code]; 4663 index &= 3; 4664 val = ringbuffer[index] + kDistanceShortCodeValueOffset[code]; 4665 } else { 4666 val = code - NUM_DISTANCE_SHORT_CODES + 1; 4667 } 4668 return val; 4669 } 4670 4671 function MoveToFront(v, index) { 4672 var value = v[index]; 4673 var i = index; 4674 for (; i; --i) v[i] = v[i - 1]; 4675 v[0] = value; 4676 } 4677 4678 function InverseMoveToFrontTransform(v, v_len) { 4679 var mtf = new Uint8Array(256); 4680 var i; 4681 for (i = 0; i < 256; ++i) { 4682 mtf[i] = i; 4683 } 4684 for (i = 0; i < v_len; ++i) { 4685 var index = v[i]; 4686 v[i] = mtf[index]; 4687 if (index) MoveToFront(mtf, index); 4688 } 4689 } 4690 4691 /* Contains a collection of huffman trees with the same alphabet size. */ 4692 function HuffmanTreeGroup(alphabet_size, num_htrees) { 4693 this.alphabet_size = alphabet_size; 4694 this.num_htrees = num_htrees; 4695 this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]); 4696 this.htrees = new Uint32Array(num_htrees); 4697 } 4698 4699 HuffmanTreeGroup.prototype.decode = function(br) { 4700 var i; 4701 var table_size; 4702 var next = 0; 4703 for (i = 0; i < this.num_htrees; ++i) { 4704 this.htrees[i] = next; 4705 table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br); 4706 next += table_size; 4707 } 4708 }; 4709 4710 function DecodeContextMap(context_map_size, br) { 4711 var out = { num_htrees: null, context_map: null }; 4712 var use_rle_for_zeros; 4713 var max_run_length_prefix = 0; 4714 var table; 4715 var i; 4716 4717 br.readMoreInput(); 4718 var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1; 4719 4720 var context_map = out.context_map = new Uint8Array(context_map_size); 4721 if (num_htrees <= 1) { 4722 return out; 4723 } 4724 4725 use_rle_for_zeros = br.readBits(1); 4726 if (use_rle_for_zeros) { 4727 max_run_length_prefix = br.readBits(4) + 1; 4728 } 4729 4730 table = []; 4731 for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) { 4732 table[i] = new HuffmanCode(0, 0); 4733 } 4734 4735 ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br); 4736 4737 for (i = 0; i < context_map_size;) { 4738 var code; 4739 4740 br.readMoreInput(); 4741 code = ReadSymbol(table, 0, br); 4742 if (code === 0) { 4743 context_map[i] = 0; 4744 ++i; 4745 } else if (code <= max_run_length_prefix) { 4746 var reps = 1 + (1 << code) + br.readBits(code); 4747 while (--reps) { 4748 if (i >= context_map_size) { 4749 throw new Error("[DecodeContextMap] i >= context_map_size"); 4750 } 4751 context_map[i] = 0; 4752 ++i; 4753 } 4754 } else { 4755 context_map[i] = code - max_run_length_prefix; 4756 ++i; 4757 } 4758 } 4759 if (br.readBits(1)) { 4760 InverseMoveToFrontTransform(context_map, context_map_size); 4761 } 4762 4763 return out; 4764 } 4765 4766 function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) { 4767 var ringbuffer = tree_type * 2; 4768 var index = tree_type; 4769 var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br); 4770 var block_type; 4771 if (type_code === 0) { 4772 block_type = ringbuffers[ringbuffer + (indexes[index] & 1)]; 4773 } else if (type_code === 1) { 4774 block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1; 4775 } else { 4776 block_type = type_code - 2; 4777 } 4778 if (block_type >= max_block_type) { 4779 block_type -= max_block_type; 4780 } 4781 block_types[tree_type] = block_type; 4782 ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type; 4783 ++indexes[index]; 4784 } 4785 4786 function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) { 4787 var rb_size = ringbuffer_mask + 1; 4788 var rb_pos = pos & ringbuffer_mask; 4789 var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK; 4790 var nbytes; 4791 4792 /* For short lengths copy byte-by-byte */ 4793 if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) { 4794 while (len-- > 0) { 4795 br.readMoreInput(); 4796 ringbuffer[rb_pos++] = br.readBits(8); 4797 if (rb_pos === rb_size) { 4798 output.write(ringbuffer, rb_size); 4799 rb_pos = 0; 4800 } 4801 } 4802 return; 4803 } 4804 4805 if (br.bit_end_pos_ < 32) { 4806 throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32'); 4807 } 4808 4809 /* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */ 4810 while (br.bit_pos_ < 32) { 4811 ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_); 4812 br.bit_pos_ += 8; 4813 ++rb_pos; 4814 --len; 4815 } 4816 4817 /* Copy remaining bytes from br.buf_ to ringbuffer. */ 4818 nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3; 4819 if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) { 4820 var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos; 4821 for (var x = 0; x < tail; x++) 4822 ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; 4823 4824 nbytes -= tail; 4825 rb_pos += tail; 4826 len -= tail; 4827 br_pos = 0; 4828 } 4829 4830 for (var x = 0; x < nbytes; x++) 4831 ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; 4832 4833 rb_pos += nbytes; 4834 len -= nbytes; 4835 4836 /* If we wrote past the logical end of the ringbuffer, copy the tail of the 4837 ringbuffer to its beginning and flush the ringbuffer to the output. */ 4838 if (rb_pos >= rb_size) { 4839 output.write(ringbuffer, rb_size); 4840 rb_pos -= rb_size; 4841 for (var x = 0; x < rb_pos; x++) 4842 ringbuffer[x] = ringbuffer[rb_size + x]; 4843 } 4844 4845 /* If we have more to copy than the remaining size of the ringbuffer, then we 4846 first fill the ringbuffer from the input and then flush the ringbuffer to 4847 the output */ 4848 while (rb_pos + len >= rb_size) { 4849 nbytes = rb_size - rb_pos; 4850 if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) { 4851 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); 4852 } 4853 output.write(ringbuffer, rb_size); 4854 len -= nbytes; 4855 rb_pos = 0; 4856 } 4857 4858 /* Copy straight from the input onto the ringbuffer. The ringbuffer will be 4859 flushed to the output at a later time. */ 4860 if (br.input_.read(ringbuffer, rb_pos, len) < len) { 4861 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); 4862 } 4863 4864 /* Restore the state of the bit reader. */ 4865 br.reset(); 4866 } 4867 4868 /* Advances the bit reader position to the next byte boundary and verifies 4869 that any skipped bits are set to zero. */ 4870 function JumpToByteBoundary(br) { 4871 var new_bit_pos = (br.bit_pos_ + 7) & ~7; 4872 var pad_bits = br.readBits(new_bit_pos - br.bit_pos_); 4873 return pad_bits == 0; 4874 } 4875 4876 function BrotliDecompressedSize(buffer) { 4877 var input = new BrotliInput(buffer); 4878 var br = new BrotliBitReader(input); 4879 DecodeWindowBits(br); 4880 var out = DecodeMetaBlockLength(br); 4881 return out.meta_block_length; 4882 } 4883 4884 exports.BrotliDecompressedSize = BrotliDecompressedSize; 4885 4886 function BrotliDecompressBuffer(buffer, output_size) { 4887 var input = new BrotliInput(buffer); 4888 4889 if (output_size == null) { 4890 output_size = BrotliDecompressedSize(buffer); 4891 } 4892 4893 var output_buffer = new Uint8Array(output_size); 4894 var output = new BrotliOutput(output_buffer); 4895 4896 BrotliDecompress(input, output); 4897 4898 if (output.pos < output.buffer.length) { 4899 output.buffer = output.buffer.subarray(0, output.pos); 4900 } 4901 4902 return output.buffer; 4903 } 4904 4905 exports.BrotliDecompressBuffer = BrotliDecompressBuffer; 4906 4907 function BrotliDecompress(input, output) { 4908 var i; 4909 var pos = 0; 4910 var input_end = 0; 4911 var window_bits = 0; 4912 var max_backward_distance; 4913 var max_distance = 0; 4914 var ringbuffer_size; 4915 var ringbuffer_mask; 4916 var ringbuffer; 4917 var ringbuffer_end; 4918 /* This ring buffer holds a few past copy distances that will be used by */ 4919 /* some special distance codes. */ 4920 var dist_rb = [ 16, 15, 11, 4 ]; 4921 var dist_rb_idx = 0; 4922 /* The previous 2 bytes used for context. */ 4923 var prev_byte1 = 0; 4924 var prev_byte2 = 0; 4925 var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)]; 4926 var block_type_trees; 4927 var block_len_trees; 4928 var br; 4929 4930 /* We need the slack region for the following reasons: 4931 - always doing two 8-byte copies for fast backward copying 4932 - transforms 4933 - flushing the input ringbuffer when decoding uncompressed blocks */ 4934 var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE; 4935 4936 br = new BrotliBitReader(input); 4937 4938 /* Decode window size. */ 4939 window_bits = DecodeWindowBits(br); 4940 max_backward_distance = (1 << window_bits) - 16; 4941 4942 ringbuffer_size = 1 << window_bits; 4943 ringbuffer_mask = ringbuffer_size - 1; 4944 ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength); 4945 ringbuffer_end = ringbuffer_size; 4946 4947 block_type_trees = []; 4948 block_len_trees = []; 4949 for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) { 4950 block_type_trees[x] = new HuffmanCode(0, 0); 4951 block_len_trees[x] = new HuffmanCode(0, 0); 4952 } 4953 4954 while (!input_end) { 4955 var meta_block_remaining_len = 0; 4956 var is_uncompressed; 4957 var block_length = [ 1 << 28, 1 << 28, 1 << 28 ]; 4958 var block_type = [ 0 ]; 4959 var num_block_types = [ 1, 1, 1 ]; 4960 var block_type_rb = [ 0, 1, 0, 1, 0, 1 ]; 4961 var block_type_rb_index = [ 0 ]; 4962 var distance_postfix_bits; 4963 var num_direct_distance_codes; 4964 var distance_postfix_mask; 4965 var num_distance_codes; 4966 var context_map = null; 4967 var context_modes = null; 4968 var num_literal_htrees; 4969 var dist_context_map = null; 4970 var num_dist_htrees; 4971 var context_offset = 0; 4972 var context_map_slice = null; 4973 var literal_htree_index = 0; 4974 var dist_context_offset = 0; 4975 var dist_context_map_slice = null; 4976 var dist_htree_index = 0; 4977 var context_lookup_offset1 = 0; 4978 var context_lookup_offset2 = 0; 4979 var context_mode; 4980 var htree_command; 4981 4982 for (i = 0; i < 3; ++i) { 4983 hgroup[i].codes = null; 4984 hgroup[i].htrees = null; 4985 } 4986 4987 br.readMoreInput(); 4988 4989 var _out = DecodeMetaBlockLength(br); 4990 meta_block_remaining_len = _out.meta_block_length; 4991 if (pos + meta_block_remaining_len > output.buffer.length) { 4992 /* We need to grow the output buffer to fit the additional data. */ 4993 var tmp = new Uint8Array( pos + meta_block_remaining_len ); 4994 tmp.set( output.buffer ); 4995 output.buffer = tmp; 4996 } 4997 input_end = _out.input_end; 4998 is_uncompressed = _out.is_uncompressed; 4999 5000 if (_out.is_metadata) { 5001 JumpToByteBoundary(br); 5002 5003 for (; meta_block_remaining_len > 0; --meta_block_remaining_len) { 5004 br.readMoreInput(); 5005 /* Read one byte and ignore it. */ 5006 br.readBits(8); 5007 } 5008 5009 continue; 5010 } 5011 5012 if (meta_block_remaining_len === 0) { 5013 continue; 5014 } 5015 5016 if (is_uncompressed) { 5017 br.bit_pos_ = (br.bit_pos_ + 7) & ~7; 5018 CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos, 5019 ringbuffer, ringbuffer_mask, br); 5020 pos += meta_block_remaining_len; 5021 continue; 5022 } 5023 5024 for (i = 0; i < 3; ++i) { 5025 num_block_types[i] = DecodeVarLenUint8(br) + 1; 5026 if (num_block_types[i] >= 2) { 5027 ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 5028 ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 5029 block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 5030 block_type_rb_index[i] = 1; 5031 } 5032 } 5033 5034 br.readMoreInput(); 5035 5036 distance_postfix_bits = br.readBits(2); 5037 num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits); 5038 distance_postfix_mask = (1 << distance_postfix_bits) - 1; 5039 num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits)); 5040 context_modes = new Uint8Array(num_block_types[0]); 5041 5042 for (i = 0; i < num_block_types[0]; ++i) { 5043 br.readMoreInput(); 5044 context_modes[i] = (br.readBits(2) << 1); 5045 } 5046 5047 var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br); 5048 num_literal_htrees = _o1.num_htrees; 5049 context_map = _o1.context_map; 5050 5051 var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br); 5052 num_dist_htrees = _o2.num_htrees; 5053 dist_context_map = _o2.context_map; 5054 5055 hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees); 5056 hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]); 5057 hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees); 5058 5059 for (i = 0; i < 3; ++i) { 5060 hgroup[i].decode(br); 5061 } 5062 5063 context_map_slice = 0; 5064 dist_context_map_slice = 0; 5065 context_mode = context_modes[block_type[0]]; 5066 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 5067 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 5068 htree_command = hgroup[1].htrees[0]; 5069 5070 while (meta_block_remaining_len > 0) { 5071 var cmd_code; 5072 var range_idx; 5073 var insert_code; 5074 var copy_code; 5075 var insert_length; 5076 var copy_length; 5077 var distance_code; 5078 var distance; 5079 var context; 5080 var j; 5081 var copy_dst; 5082 5083 br.readMoreInput(); 5084 5085 if (block_length[1] === 0) { 5086 DecodeBlockType(num_block_types[1], 5087 block_type_trees, 1, block_type, block_type_rb, 5088 block_type_rb_index, br); 5089 block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br); 5090 htree_command = hgroup[1].htrees[block_type[1]]; 5091 } 5092 --block_length[1]; 5093 cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br); 5094 range_idx = cmd_code >> 6; 5095 if (range_idx >= 2) { 5096 range_idx -= 2; 5097 distance_code = -1; 5098 } else { 5099 distance_code = 0; 5100 } 5101 insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7); 5102 copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7); 5103 insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + 5104 br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits); 5105 copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + 5106 br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits); 5107 prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask]; 5108 prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask]; 5109 for (j = 0; j < insert_length; ++j) { 5110 br.readMoreInput(); 5111 5112 if (block_length[0] === 0) { 5113 DecodeBlockType(num_block_types[0], 5114 block_type_trees, 0, block_type, block_type_rb, 5115 block_type_rb_index, br); 5116 block_length[0] = ReadBlockLength(block_len_trees, 0, br); 5117 context_offset = block_type[0] << kLiteralContextBits; 5118 context_map_slice = context_offset; 5119 context_mode = context_modes[block_type[0]]; 5120 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 5121 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 5122 } 5123 context = (Context.lookup[context_lookup_offset1 + prev_byte1] | 5124 Context.lookup[context_lookup_offset2 + prev_byte2]); 5125 literal_htree_index = context_map[context_map_slice + context]; 5126 --block_length[0]; 5127 prev_byte2 = prev_byte1; 5128 prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br); 5129 ringbuffer[pos & ringbuffer_mask] = prev_byte1; 5130 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 5131 output.write(ringbuffer, ringbuffer_size); 5132 } 5133 ++pos; 5134 } 5135 meta_block_remaining_len -= insert_length; 5136 if (meta_block_remaining_len <= 0) break; 5137 5138 if (distance_code < 0) { 5139 var context; 5140 5141 br.readMoreInput(); 5142 if (block_length[2] === 0) { 5143 DecodeBlockType(num_block_types[2], 5144 block_type_trees, 2, block_type, block_type_rb, 5145 block_type_rb_index, br); 5146 block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br); 5147 dist_context_offset = block_type[2] << kDistanceContextBits; 5148 dist_context_map_slice = dist_context_offset; 5149 } 5150 --block_length[2]; 5151 context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff; 5152 dist_htree_index = dist_context_map[dist_context_map_slice + context]; 5153 distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br); 5154 if (distance_code >= num_direct_distance_codes) { 5155 var nbits; 5156 var postfix; 5157 var offset; 5158 distance_code -= num_direct_distance_codes; 5159 postfix = distance_code & distance_postfix_mask; 5160 distance_code >>= distance_postfix_bits; 5161 nbits = (distance_code >> 1) + 1; 5162 offset = ((2 + (distance_code & 1)) << nbits) - 4; 5163 distance_code = num_direct_distance_codes + 5164 ((offset + br.readBits(nbits)) << 5165 distance_postfix_bits) + postfix; 5166 } 5167 } 5168 5169 /* Convert the distance code to the actual distance by possibly looking */ 5170 /* up past distnaces from the ringbuffer. */ 5171 distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx); 5172 if (distance < 0) { 5173 throw new Error('[BrotliDecompress] invalid distance'); 5174 } 5175 5176 if (pos < max_backward_distance && 5177 max_distance !== max_backward_distance) { 5178 max_distance = pos; 5179 } else { 5180 max_distance = max_backward_distance; 5181 } 5182 5183 copy_dst = pos & ringbuffer_mask; 5184 5185 if (distance > max_distance) { 5186 if (copy_length >= BrotliDictionary.minDictionaryWordLength && 5187 copy_length <= BrotliDictionary.maxDictionaryWordLength) { 5188 var offset = BrotliDictionary.offsetsByLength[copy_length]; 5189 var word_id = distance - max_distance - 1; 5190 var shift = BrotliDictionary.sizeBitsByLength[copy_length]; 5191 var mask = (1 << shift) - 1; 5192 var word_idx = word_id & mask; 5193 var transform_idx = word_id >> shift; 5194 offset += word_idx * copy_length; 5195 if (transform_idx < Transform.kNumTransforms) { 5196 var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx); 5197 copy_dst += len; 5198 pos += len; 5199 meta_block_remaining_len -= len; 5200 if (copy_dst >= ringbuffer_end) { 5201 output.write(ringbuffer, ringbuffer_size); 5202 5203 for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++) 5204 ringbuffer[_x] = ringbuffer[ringbuffer_end + _x]; 5205 } 5206 } else { 5207 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 5208 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 5209 } 5210 } else { 5211 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 5212 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 5213 } 5214 } else { 5215 if (distance_code > 0) { 5216 dist_rb[dist_rb_idx & 3] = distance; 5217 ++dist_rb_idx; 5218 } 5219 5220 if (copy_length > meta_block_remaining_len) { 5221 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 5222 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 5223 } 5224 5225 for (j = 0; j < copy_length; ++j) { 5226 ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask]; 5227 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 5228 output.write(ringbuffer, ringbuffer_size); 5229 } 5230 ++pos; 5231 --meta_block_remaining_len; 5232 } 5233 } 5234 5235 /* When we get here, we must have inserted at least one literal and */ 5236 /* made a copy of at least length two, therefore accessing the last 2 */ 5237 /* bytes is valid. */ 5238 prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask]; 5239 prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask]; 5240 } 5241 5242 /* Protect pos from overflow, wrap it around at every GB of input data */ 5243 pos &= 0x3fffffff; 5244 } 5245 5246 output.write(ringbuffer, pos & ringbuffer_mask); 5247 } 5248 5249 exports.BrotliDecompress = BrotliDecompress; 5250 5251 BrotliDictionary.init(); 5252 5253 },{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(require,module,exports){ 5254 var base64 = require('base64-js'); 5255 //var fs = require('fs'); 5256 5257 /** 5258 * The normal dictionary-data.js is quite large, which makes it 5259 * unsuitable for browser usage. In order to make it smaller, 5260 * we read dictionary.bin, which is a compressed version of 5261 * the dictionary, and on initial load, Brotli decompresses 5262 * it's own dictionary. 😜 5263 */ 5264 exports.init = function() { 5265 var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer; 5266 var compressed = base64.toByteArray(require('./dictionary.bin.js')); 5267 return BrotliDecompressBuffer(compressed); 5268 }; 5269 5270 },{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(require,module,exports){ 5271 module.exports="W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/dPUiqBso2q+7ZyFBvENCkkVr44iyPbtOoOoCecWsiuqMSML5lv+vN5MzUr+Dnh73G7Q1YnRYJVYXHRJaNAOByiaK6CusgFdBPE40r0rvqXV7tksKO2DrHYXBTv8P5ysqxEx8VDXUDDqkPH6NNOV/a2WH8zlkXRELSa8P+heNyJBBP7PgsG1EtWtNef6/i+lcayzQwQCsduidpbKfhWUDgAEmyhGu/zVTacI6RS0zTABrOYueemnVa19u9fT23N/Ta6RvTpof5DWygqreCqrDAgM4LID1+1T/taU6yTFVLqXOv+/MuQOFnaF8vLMKD7tKWDoBdALgxF33zQccCcdHx8fKIVdW69O7qHtXpeGr9jbbpFA+qRMWr5hp0s67FPc7HAiLV0g0/peZlW7hJPYEhZyhpSwahnf93/tZgfqZWXFdmdXBzqxGHLrQKxoAY6fRoBhgCRPmmGueYZ5JexTVDKUIXzkG/fqp/0U3hAgQdJ9zumutK6nqWbaqvm1pgu03IYR+G+8s0jDBBz8cApZFSBeuWasyqo2OMDKAZCozS+GWSvL/HsE9rHxooe17U3s/lTE+VZAk4j3dp6uIGaC0JMiqR5CUsabPyM0dOYDR7Ea7ip4USZlya38YfPtvrX/tBlhHilj55nZ1nfN24AOAi9BVtz/Mbn8AEDJCqJgsVUa6nQnSxv2Fs7l/NlCzpfYEjmPrNyib/+t0ei2eEMjvNhLkHCZlci4WhBe7ePZTmzYqlY9+1pxtS4GB+5lM1BHT9tS270EWUDYFq1I0yY/fNiAk4bk9yBgmef/f2k6AlYQZHsNFnW8wBQxCd68iWv7/35bXfz3JZmfGligWAKRjIs3IpzxQ27vAglHSiOzCYzJ9L9A1CdiyFvyR66ucA4jKifu5ehwER26yV7HjKqn5Mfozo7Coxxt8LWWPT47BeMxX8p0Pjb7hZn+6bw7z3Lw+7653j5sI8CLu5kThpMlj1m4c2ch3jGcP1FsT13vuK3qjecKTZk2kHcOZY40UX+qdaxstZqsqQqgXz+QGF99ZJLqr3VYu4aecl1Ab5GmqS8k/GV5b95zxQ5d4EfXUJ6kTS/CXF/aiqKDOT1T7Jz5z0PwDUcwr9clLN1OJGCiKfqvah+h3XzrBOiLOW8wvn8gW6qE8vPxi+Efv+UH55T7PQFVMh6cZ1pZQlzJpKZ7P7uWvwPGJ6DTlR6wbyj3Iv2HyefnRo/dv7dNx+qaa0N38iBsR++Uil7Wd4afwDNsrzDAK4fXZwvEY/jdKuIKXlfrQd2C39dW7ntnRbIp9OtGy9pPBn/V2ASoi/2UJZfS+xuGLH8bnLuPlzdTNS6zdyk8Dt/h6sfOW5myxh1f+zf3zZ3MX/mO9cQPp5pOx967ZA6/pqHvclNfnUFF+rq+Vd7alKr6KWPcIDhpn6v2K6NlUu6LrKo8b/pYpU/Gazfvtwhn7tEOUuXht5rUJdSf6sLjYf0VTYDgwJ81yaqKTUYej/tbHckSRb/HZicwGJqh1mAHB/IuNs9dc9yuvF3D5Xocm3elWFdq5oEy70dYFit79yaLiNjPj5UUcVmZUVhQEhW5V2Z6Cm4HVH/R8qlamRYwBileuh07CbEce3TXa2JmXWBf+ozt319psboobeZhVnwhMZzOeQJzhpTDbP71Tv8HuZxxUI/+ma3XW6DFDDs4+qmpERwHGBd2edxwUKlODRdUWZ/g0GOezrbzOZauFMai4QU6GVHV6aPNBiBndHSsV4IzpvUiiYyg6OyyrL4Dj5q/Lw3N5kAwftEVl9rNd7Jk5PDij2hTH6wIXnsyXkKePxbmHYgC8A6an5Fob/KH5GtC0l4eFso+VpxedtJHdHpNm+Bvy4C79yVOkrZsLrQ3OHCeB0Ra+kBIRldUGlDCEmq2RwXnfyh6Dz+alk6eftI2n6sastRrGwbwszBeDRS/Fa/KwRJkCzTsLr/JCs5hOPE/MPLYdZ1F1fv7D+VmysX6NpOC8aU9F4Qs6HvDyUy9PvFGDKZ/P5101TYHFl8pjj6wm/qyS75etZhhfg0UEL4OYmHk6m6dO192AzoIyPSV9QedDA4Ml23rRbqxMPMxf7FJnDc5FTElVS/PyqgePzmwVZ26NWhRDQ+oaT7ly7ell4s3DypS1s0g+tOr7XHrrkZj9+x/mJBttrLx98lFIaRZzHz4aC7r52/JQ4VjHahY2/YVXZn/QC2ztQb/sY3uRlyc5vQS8nLPGT/n27495i8HPA152z7Fh5aFpyn1GPJKHuPL8Iw94DuW3KjkURAWZXn4EQy89xiKEHN1mk/tkM4gYDBxwNoYvRfE6LFqsxWJtPrDGbsnLMap3Ka3MUoytW0cvieozOmdERmhcqzG+3HmZv2yZeiIeQTKGdRT4HHNxekm1tY+/n06rGmFleqLscSERzctTKM6G9P0Pc1RmVvrascIxaO1CQCiYPE15bD7c3xSeW7gXxYjgxcrUlcbIvO0r+Yplhx0kTt3qafDOmFyMjgGxXu73rddMHpV1wMubyAGcf/v5dLr5P72Ta9lBF+fzMJrMycwv+9vnU3ANIl1cH9tfW7af8u0/HG0vV47jNFXzFTtaha1xvze/s8KMtCYucXc1nzfd/MQydUXn/b72RBt5wO/3jRcMH9BdhC/yctKBIveRYPrNpDWqBsO8VMmP+WvRaOcA4zRMR1PvSoO92rS7pYEv+fZfEfTMzEdM+6X5tLlyxExhqLRkms5EuLovLfx66de5fL2/yX02H52FPVwahrPqmN/E0oVXnsCKhbi/yRxX83nRbUKWhzYceXOntfuXn51NszJ6MO73pQf5Pl4in3ec4JU8hF7ppV34+mm9r1LY0ee/i1O1wpd8+zfLztE0cqBxggiBi5Bu95v9l3r9r/U5hweLn+TbfxowrWDqdJauKd8+q/dH8sbPkc9ttuyO94f7/XK/nHX46MPFLEb5qQlNPvhJ50/59t9ft3LXu7uVaWaO2bDrDCnRSzZyWvFKxO1+vT8MwwunR3bX0CkfPjqb4K9O19tn5X50PvmYpEwHtiW9WtzuV/s76B1zvLLNkViNd8ySxIl/3orfqP90TyTGaf7/rx8jQzeHJXdmh/N6YDvbvmTBwCdxfEQ1NcL6wNMdSIXNq7b1EUzRy1/Axsyk5p22GMG1b+GxFgbHErZh92wuvco0AuOLXct9hvw2nw/LqIcDRRmJmmZzcgUa7JpM/WV/S9IUfbF56TL2orzqwebdRD8nIYNJ41D/hz37Fo11p2Y21wzPcn713qVGhqtevStYfGH4n69OEJtPvbbLYWvscDqc3Hgnu166+tAyLnxrX0Y5zoYjV++1sI7t5kMr02KT/+uwtkc+rZLOf/qn/s3nYCf13Dg8/sB2diJgjGqjQ+TLhxbzyue2Ob7X6/9lUwW7a+lbznHzOYy8LKW1C/uRPbQY3KW/0gO9LXunHLvPL97afba9bFtc9hmz7GAttjVYlCvQAiOwAk/gC5+hkLEs6tr3AZKxLJtOEwk2dLxTYWsIB/j/ToWtIWzo906FrSG8iaqqqqqqiIiIiAgzMzMzNz+AyK+01/zi8n8S+Y1MjoRaQ80WU/G8MBlO+53VPXANrWm4wzGUVZUjjBJZVdhpcfkjsmcWaO+UEldXi1e+zq+HOsCpknYshuh8pOLISJun7TN0EIGW2xTnlOImeecnoGW4raxe2G1T3HEvfYUYMhG+gAFOAwh5nK8mZhwJMmN7r224QVsNFvZ87Z0qatvknklyPDK3Hy45PgVKXji52Wen4d4PlFVVYGnNap+fSpFbK90rYnhUc6n91Q3AY9E0tJOFrcfZtm/491XbcG/jsViUPPX76qmeuiz+qY1Hk7/1VPM405zWVuoheLUimpWYdVzCmUdKHebMdzgrYrb8mL2eeLSnRWHdonfZa8RsOU9F37w+591l5FLYHiOqWeHtE/lWrBHcRKp3uhtr8yXm8LU/5ms+NM6ZKsqu90cFZ4o58+k4rdrtB97NADFbwmEG7lXqvirhOTOqU14xuUF2myIjURcPHrPOQ4lmM3PeMg7bUuk0nnZi67bXsU6H8lhqIo8TaOrEafCO1ARK9PjC0QOoq2BxmMdgYB9G/lIb9++fqNJ2s7BHGFyBNmZAR8J3KCo012ikaSP8BCrf6VI0X5xdnbhHIO+B5rbOyB54zXkzfObyJ4ecwxfqBJMLFc7m59rNcw7hoHnFZ0b00zee+gTqvjm61Pb4xn0kcDX4jvHM0rBXZypG3DCKnD/Waa/ZtHmtFPgO5eETx+k7RrVg3aSwm2YoNXnCs3XPQDhNn+Fia6IlOOuIG6VJH7TP6ava26ehKHQa2T4N0tcZ9dPCGo3ZdnNltsHQbeYt5vPnJezV/cAeNypdml1vCHI8M81nSRP5Qi2+mI8v/sxiZru9187nRtp3f/42NemcONa+4eVC3PCZzc88aZh851CqSsshe70uPxeN/dmYwlwb3trwMrN1Gq8jbnApcVDx/yDPeYs5/7r62tsQ6lLg+DiFXTEhzR9dHqv0iT4tgj825W+H3XiRUNUZT2kR9Ri0+lp+UM3iQtS8uOE23Ly4KYtvqH13jghUntJRAewuzNLDXp8RxdcaA3cMY6TO2IeSFRXezeWIjCqyhsUdMYuCgYTZSKpBype1zRfq8FshvfBPc6BAQWl7/QxIDp3VGo1J3vn42OEs3qznws+YLRXbymyB19a9XBx6n/owcyxlEYyFWCi+kG9F+EyD/4yn80+agaZ9P7ay2Dny99aK2o91FkfEOY8hBwyfi5uwx2y5SaHmG+oq/zl1FX/8irOf8Y3vAcX/6uLP6A6nvMO24edSGPjQc827Rw2atX+z2bKq0CmW9mOtYnr5/AfDa1ZfPaXnKtlWborup7QYx+Or2uWb+N3N//2+yDcXMqIJdf55xl7/vsj4WoPPlxLxtVrkJ4w/tTe3mLdATOOYwxcq52w5Wxz5MbPdVs5O8/lhfE7dPj0bIiPQ3QV0iqm4m3YX8hRfc6jQ3fWepevMqUDJd86Z4vwM40CWHnn+WphsGHfieF02D3tmZvpWD+kBpNCFcLnZhcmmrhpGzzbdA+sQ1ar18OJD87IOKOFoRNznaHPNHUfUNhvY1iU+uhvEvpKHaUn3qK3exVVyX4joipp3um7FmYJWmA+WbIDshRpbVRx5/nqstCgy87FGbfVB8yDGCqS+2qCsnRwnSAN6zgzxfdB2nBT/vZ4/6uxb6oH8b4VBRxiIB93wLa47hG3w2SL/2Z27yOXJFwZpSJaBYyvajA7vRRYNKqljXKpt/CFD/tSMr18DKKbwB0xggBePatl1nki0yvqW5zchlyZmJ0OTxJ3D+fsYJs/mxYN5+Le5oagtcl+YsVvy8kSjI2YGvGjvmpkRS9W2dtXqWnVuxUhURm1lKtou/hdEq19VBp9OjGvHEQSmrpuf2R24mXGheil8KeiANY8fW1VERUfBImb64j12caBZmRViZHbeVMjCrPDg9A90IXrtnsYCuZtRQ0PyrKDjBNOsPfKsg1pA02gHlVr0OXiFhtp6nJqXVzcbfM0KnzC3ggOENPE9VBdmHKN6LYaijb4wXxJn5A0FSDF5j+h1ooZx885Jt3ZKzO5n7Z5WfNEOtyyPqQEnn7WLv5Fis3PdgMshjF1FRydbNyeBbyKI1oN1TRVrVK7kgsb/zjX4NDPIRMctVeaxVB38Vh1x5KbeJbU138AM5KzmZu3uny0ErygxiJF7GVXUrPzFxrlx1uFdAaZFDN9cvIb74qD9tzBMo7L7WIEYK+sla1DVMHpF0F7b3+Y6S+zjvLeDMCpapmJo1weBWuxKF3rOocih1gun4BoJh1kWnV/Jmiq6uOhK3VfKxEHEkafjLgK3oujaPzY6SXg8phhL4TNR1xvJd1Wa0aYFfPUMLrNBDCh4AuGRTbtKMc6Z1Udj8evY/ZpCuMAUefdo69DZUngoqE1P9A3PJfOf7WixCEj+Y6t7fYeHbbxUAoFV3M89cCKfma3fc1+jKRe7MFWEbQqEfyzO2x/wrO2VYH7iYdQ9BkPyI8/3kXBpLaCpU7eC0Yv/am/tEDu7HZpqg0EvHo0nf/R/gRzUWy33/HXMJQeu1GylKmOkXzlCfGFruAcPPhaGqZOtu19zsJ1SO2Jz4Ztth5cBX6mRQwWmDwryG9FUMlZzNckMdK+IoMJv1rOWnBamS2w2KHiaPMPLC15hCZm4KTpoZyj4E2TqC/P6r7/EhnDMhKicZZ1ZwxuC7DPzDGs53q8gXaI9kFTK+2LTq7bhwsTbrMV8Rsfua5lMS0FwbTitUVnVa1yTb5IX51mmYnUcP9wPr8Ji1tiYJeJV9GZTrQhF7vvdU2OTU42ogJ9FDwhmycI2LIg++03C6scYhUyUuMV5tkw6kGUoL+mjNC38+wMdWNljn6tGPpRES7veqrSn5TRuv+dh6JVL/iDHU1db4c9WK3++OrH3PqziF916UMUKn8G67nN60GfWiHrXYhUG3yVWmyYak59NHj8t1smG4UDiWz2rPHNrKnN4Zo1LBbr2/eF9YZ0n0blx2nG4X+EKFxvS3W28JESD+FWk61VCD3z/URGHiJl++7TdBwkCj6tGOH3qDb0QqcOF9Kzpj0HUb/KyFW3Yhj2VMKJqGZleFBH7vqvf7WqLC3XMuHV8q8a4sTFuxUtkD/6JIBvKaVjv96ndgruKZ1k/BHzqf2K9fLk7HGXANyLDd1vxkK/i055pnzl+zw6zLnwXlVYVtfmacJgEpRP1hbGgrYPVN6v2lG+idQNGmwcKXu/8xEj/P6qe/sB2WmwNp6pp8jaISMkwdleFXYK55NHWLTTbutSUqjBfDGWo/Yg918qQ+8BRZSAHZbfuNZz2O0sov1Ue4CWlVg3rFhM3Kljj9ksGd/NUhk4nH+a5UN2+1i8+NM3vRNp7uQ6sqexSCukEVlVZriHNqFi5rLm9TMWa4qm3idJqppQACol2l4VSuvWLfta4JcXy3bROPNbXOgdOhG47LC0CwW/dMlSx4Jf17aEU3yA1x9p+Yc0jupXgcMuYNku64iYOkGToVDuJvlbEKlJqsmiHbvNrIVZEH+yFdF8DbleZ6iNiWwMqvtMp/mSpwx5KxRrT9p3MAPTHGtMbfvdFhyj9vhaKcn3At8Lc16Ai+vBcSp1ztXi7rCJZx/ql7TXcclq6Q76UeKWDy9boS0WHIjUuWhPG8LBmW5y2rhuTpM5vsLt+HOLh1Yf0DqXa9tsfC+kaKt2htA0ai/L2i7RKoNjEwztkmRU0GfgW1TxUvPFhg0V7DdfWJk5gfrccpYv+MA9M0dkGTLECeYwUixRzjRFdmjG7zdZIl3XKB9YliNKI31lfa7i2JG5C8Ss+rHe0D7Z696/V3DEAOWHnQ9yNahMUl5kENWS6pHKKp2D1BaSrrHdE1w2qNxIztpXgUIrF0bm15YML4b6V1k+GpNysTahKMVrrS85lTVo9OGJ96I47eAy5rYWpRf/mIzeoYU1DKaQCTUVwrhHeyNoDqHel+lLxr9WKzhSYw7vrR6+V5q0pfi2k3L1zqkubY6rrd9ZLvSuWNf0uqnkY+FpTvFzSW9Fp0b9l8JA7THV9eCi/PY/SCZIUYx3BU2alj7Cm3VV6eYpios4b6WuNOJdYXUK3zTqj5CVG2FqYM4Z7CuIU0qO05XR0d71FHM0YhZmJmTRfLlXEumN82BGtzdX0S19t1e+bUieK8zRmqpa4Qc5TSjifmaQsY2ETLjhI36gMR1+7qpjdXXHiceUekfBaucHShAOiFXmv3sNmGQyU5iVgnoocuonQXEPTFwslHtS8R+A47StI9wj0iSrtbi5rMysczFiImsQ+bdFClnFjjpXXwMy6O7qfjOr8Fb0a7ODItisjnn3EQO16+ypd1cwyaAW5Yzxz5QknfMO7643fXW/I9y3U2xH27Oapqr56Z/tEzglj6IbT6HEHjopiXqeRbe5mQQvxtcbDOVverN0ZgMdzqRYRjaXtMRd56Q4cZSmdPvZJdSrhJ1D9zNXPqAEqPIavPdfubt5oke2kmv0dztIszSv2VYuoyf1UuopbsYb+uX9h6WpwjpgtZ6fNNawNJ4q8O3CFoSbioAaOSZMx2GYaPYB+rEb6qjQiNRFQ76TvwNFVKD+BhH9VhcKGsXzmMI7BptU/CNWolM7YzROvpFAntsiWJp6eR2d3GarcYShVYSUqhmYOWj5E96NK2WvmYNTeY7Zs4RUEdv9h9QT4EseKt6LzLrqEOs3hxAY1MaNWpSa6zZx8F3YOVeCYMS88W+CYHDuWe4yoc6YK+djDuEOrBR5lvh0r+Q9uM88lrjx9x9AtgpQVNE8r+3O6Gvw59D+kBF/UMXyhliYUtPjmvXGY6Dk3x+kEOW+GtdMVC4EZTqoS/jmR0P0LS75DOc/w2vnri97M4SdbZ8qeU7gg8DVbERkU5geaMQO3mYrSYyAngeUQqrN0C0/vsFmcgWNXNeidsTAj7/4MncJR0caaBUpbLK1yBCBNRjEv6KvuVSdpPnEMJdsRRtqJ+U8tN1gXA4ePHc6ZT0eviI73UOJF0fEZ8YaneAQqQdGphNvwM4nIqPnXxV0xA0fnCT+oAhJuyw/q8jO0y8CjSteZExwBpIN6SvNp6A5G/abi6egeND/1GTguhuNjaUbbnSbGd4L8937Ezm34Eyi6n1maeOBxh3PI0jzJDf5mh/BsLD7F2GOKvlA/5gtvxI3/eV4sLfKW5Wy+oio+es/u6T8UU+nsofy57Icb/JlZHPFtCgd/x+bwt3ZT+xXTtTtTrGAb4QehC6X9G+8YT+ozcLxDsdCjsuOqwPFnrdLYaFc92Ui0m4fr39lYmlCaqTit7G6O/3kWDkgtXjNH4BiEm/+jegQnihOtfffn33WxsFjhfMd48HT+f6o6X65j7XR8WLSHMFkxbvOYsrRsF1bowDuSQ18Mkxk4qz2zoGPL5fu9h2Hqmt1asl3Q3Yu3szOc+spiCmX4AETBM3pLoTYSp3sVxahyhL8eC4mPN9k2x3o0xkiixIzM3CZFzf5oR4mecQ5+ax2wCah3/crmnHoqR0+KMaOPxRif1oEFRFOO/kTPPmtww+NfMXxEK6gn6iU32U6fFruIz8Q4WgljtnaCVTBgWx7diUdshC9ZEa5yKpRBBeW12r/iNc/+EgNqmhswNB8SBoihHXeDF7rrWDLcmt3V8GYYN7pXRy4DZjj4DJuUBL5iC3DQAaoo4vkftqVTYRGLS3mHZ7gdmdTTqbgNN/PTdTCOTgXolc88MhXAEUMdX0iy1JMuk5wLsgeu0QUYlz2S4skTWwJz6pOm/8ihrmgGfFgri+ZWUK2gAPHgbWa8jaocdSuM4FJYoKicYX/ZSENkg9Q1ZzJfwScfVnR2DegOGwCvmogaWJCLQepv9WNlU6QgsmOwICquU28Mlk3d9W5E81lU/5Ez0LcX6lwKMWDNluNKfBDUy/phJgBcMnfkh9iRxrdOzgs08JdPB85Lwo+GUSb4t3nC+0byqMZtO2fQJ4U2zGIr49t/28qmmGv2RanDD7a3FEcdtutkW8twwwlUSpb8QalodddbBfNHKDQ828BdE7OBgFdiKYohLawFYqpybQoxATZrheLhdI7+0Zlu9Q1myRcd15r9UIm8K2LGJxqTegntqNVMKnf1a8zQiyUR1rxoqjiFxeHxqFcYUTHfDu7rhbWng6qOxOsI+5A1p9mRyEPdVkTlE24vY54W7bWc6jMgZvNXdfC9/9q7408KDsbdL7Utz7QFSDetz2picArzrdpL8OaCHC9V26RroemtDZ5yNM/KGkWMyTmfnInEvwtSD23UcFcjhaE3VKzkoaEMKGBft4XbIO6forTY1lmGQwVmKicBCiArDzE+1oIxE08fWeviIOD5TznqH+OoHadvoOP20drMPe5Irg3XBQziW2XDuHYzjqQQ4wySssjXUs5H+t3FWYMHppUnBHMx/nYIT5d7OmjDbgD9F6na3m4l7KdkeSO3kTEPXafiWinogag7b52taiZhL1TSvBFmEZafFq2H8khQaZXuitCewT5FBgVtPK0j4xUHPfUz3Q28eac1Z139DAP23dgki94EC8vbDPTQC97HPPSWjUNG5tWKMsaxAEMKC0665Xvo1Ntd07wCLNf8Q56mrEPVpCxlIMVlQlWRxM3oAfpgIc+8KC3rEXUog5g06vt7zgXY8grH7hhwVSaeuvC06YYRAwpbyk/Unzj9hLEZNs2oxPQB9yc+GnL6zTgq7rI++KDJwX2SP8Sd6YzTuw5lV/kU6eQxRD12omfQAW6caTR4LikYkBB1CMOrvgRr/VY75+NSB40Cni6bADAtaK+vyxVWpf9NeKJxN2KYQ8Q2xPB3K1s7fuhvWbr2XpgW044VD6DRs0qXoqKf1NFsaGvKJc47leUV3pppP/5VTKFhaGuol4Esfjf5zyCyUHmHthChcYh4hYLQF+AFWsuq4t0wJyWgdwQVOZiV0efRHPoK5+E1vjz9wTJmVkITC9oEstAsyZSgE/dbicwKr89YUxKZI+owD205Tm5lnnmDRuP/JnzxX3gMtlrcX0UesZdxyQqYQuEW4R51vmQ5xOZteUd8SJruMlTUzhtVw/Nq7eUBcqN2/HVotgfngif60yKEtoUx3WYOZlVJuJOh8u59fzSDPFYtQgqDUAGyGhQOAvKroXMcOYY0qjnStJR/G3aP+Jt1sLVlGV8POwr/6OGsqetnyF3TmTqZjENfnXh51oxe9qVUw2M78EzAJ+IM8lZ1MBPQ9ZWSVc4J3mWSrLKrMHReA5qdGoz0ODRsaA+vwxXA2cAM4qlfzBJA6581m4hzxItQw5dxrrBL3Y6kCbUcFxo1S8jyV44q//+7ASNNudZ6xeaNOSIUffqMn4A9lIjFctYn2gpEPAb3f7p3iIBN8H14FUGQ9ct2hPsL+cEsTgUrR47uJVN4n4wt/wgfwwHuOnLd4yobkofy8JvxSQTA7rMpDIc608SlZFJfZYcmbT0tAHpPE8MrtQ42siTUNWxqvWZOmvu9f0JPoQmg+6l7sZWwyfi6PXkxJnwBraUG0MYG4zYHQz3igy/XsFkx5tNQxw43qvI9dU3f0DdhOUlHKjmi1VAr2Kiy0HZwD8VeEbhh0OiDdMYspolQsYdSwjCcjeowIXNZVUPmL2wwIkYhmXKhGozdCJ4lRKbsf4NBh/XnQoS92NJEWOVOFs2YhN8c5QZFeK0pRdAG40hqvLbmoSA8xQmzOOEc7wLcme9JOsjPCEgpCwUs9E2DohMHRhUeyGIN6TFvrbny8nDuilsDpzrH5mS76APoIEJmItS67sQJ+nfwddzmjPxcBEBBCw0kWDwd0EZCkNeOD7NNQhtBm7KHL9mRxj6U1yWU2puzlIDtpYxdH4ZPeXBJkTGAJfUr/oTCz/iypY6uXaR2V1doPxJYlrw2ghH0D5gbrhFcIxzYwi4a/4hqVdf2DdxBp6vGYDjavxMAAoy+1+3aiO6S3W/QAKNVXagDtvsNtx7Ks+HKgo6U21B+QSZgIogV5Bt+BnXisdVfy9VyXV+2P5fMuvdpAjM1o/K9Z+XnE4EOCrue+kcdYHqAQ0/Y/OmNlQ6OI33jH/uD1RalPaHpJAm2av0/xtpqdXVKNDrc9F2izo23Wu7firgbURFDNX9eGGeYBhiypyXZft2j3hTvzE6PMWKsod//rEILDkzBXfi7xh0eFkfb3/1zzPK/PI5Nk3FbZyTl4mq5BfBoVoqiPHO4Q4QKZAlrQ3MdNfi3oxIjvsM3kAFv3fdufurqYR3PSwX/mpGy/GFI/B2MNPiNdOppWVbs/gjF3YH+QA9jMhlAbhvasAHstB0IJew09iAkmXHl1/TEj+jvHOpOGrPRQXbPADM+Ig2/OEcUcpgPTItMtW4DdqgfYVI/+4hAFWYjUGpOP/UwNuB7+BbKOcALbjobdgzeBQfjgNSp2GOpxzGLj70Vvq5cw2AoYENwKLUtJUX8sGRox4dVa/TN4xKwaKcl9XawQR/uNus700Hf17pyNnezrUgaY9e4MADhEDBpsJT6y1gDJs1q6wlwGhuUzGR7C8kgpjPyHWwsvrf3yn1zJEIRa5eSxoLAZOCR9xbuztxFRJW9ZmMYfCFJ0evm9F2fVnuje92Rc4Pl6A8bluN8MZyyJGZ0+sNSb//DvAFxC2BqlEsFwccWeAl6CyBcQV1bx4mQMBP1Jxqk1EUADNLeieS2dUFbQ/c/kvwItbZ7tx0st16viqd53WsRmPTKv2AD8CUnhtPWg5aUegNpsYgasaw2+EVooeNKmrW3MFtj76bYHJm5K9gpAXZXsE5U8DM8XmVOSJ1F1WnLy6nQup+jx52bAb+rCq6y9WXl2B2oZDhfDkW7H3oYfT/4xx5VncBuxMXP2lNfhUVQjSSzSRbuZFE4vFawlzveXxaYKVs8LpvAb8IRYF3ZHiRnm0ADeNPWocwxSzNseG7NrSEVZoHdKWqaGEBz1N8Pt7kFbqh3LYmAbm9i1IChIpLpM5AS6mr6OAPHMwwznVy61YpBYX8xZDN/a+lt7n+x5j4bNOVteZ8lj3hpAHSx1VR8vZHec4AHO9XFCdjZ9eRkSV65ljMmZVzaej2qFn/qt1lvWzNZEfHxK3qOJrHL6crr0CRzMox5f2e8ALBB4UGFZKA3tN6F6IXd32GTJXGQ7DTi9j/dNcLF9jCbDcWGKxoKTYblIwbLDReL00LRcDPMcQuXLMh5YzgtfjkFK1DP1iDzzYYVZz5M/kWYRlRpig1htVRjVCknm+h1M5LiEDXOyHREhvzCGpFZjHS0RsK27o2avgdilrJkalWqPW3D9gmwV37HKmfM3F8YZj2ar+vHFvf3B8CRoH4kDHIK9mrAg+owiEwNjjd9V+FsQKYR8czJrUkf7Qoi2YaW6EVDZp5zYlqiYtuXOTHk4fAcZ7qBbdLDiJq0WNV1l2+Hntk1mMWvxrYmc8kIx8G3rW36J6Ra4lLrTOCgiOihmow+YnzUT19jbV2B3RWqSHyxkhmgsBqMYWvOcUom1jDQ436+fcbu3xf2bbeqU/ca+C4DOKE+e3qvmeMqW3AxejfzBRFVcwVYPq4L0APSWWoJu+5UYX4qg5U6YTioqQGPG9XrnuZ/BkxuYpe6Li87+18EskyQW/uA+uk2rpHpr6hut2TlVbKgWkFpx+AZffweiw2+VittkEyf/ifinS/0ItRL2Jq3tQOcxPaWO2xrG68GdFoUpZgFXaP2wYVtRc6xYCfI1CaBqyWpg4bx8OHBQwsV4XWMibZZ0LYjWEy2IxQ1mZrf1/UNbYCJplWu3nZ4WpodIGVA05d+RWSS+ET9tH3RfGGmNI1cIY7evZZq7o+a0bjjygpmR3mVfalkT/SZGT27Q8QGalwGlDOS9VHCyFAIL0a1Q7JiW3saz9gqY8lqKynFrPCzxkU4SIfLc9VfCI5edgRhDXs0edO992nhTKHriREP1NJC6SROMgQ0xO5kNNZOhMOIT99AUElbxqeZF8A3xrfDJsWtDnUenAHdYWSwAbYjFqQZ+D5gi3hNK8CSxU9i6f6ClL9IGlj1OPMQAsr84YG6ijsJpCaGWj75c3yOZKBB9mNpQNPUKkK0D6wgLH8MGoyRxTX6Y05Q4AnYNXMZwXM4eij/9WpsM/9CoRnFQXGR6MEaY+FXvXEO3RO0JaStk6OXuHVATHJE+1W+TU3bSZ2ksMtqjO0zfSJCdBv7y2d8DMx6TfVme3q0ZpTKMMu4YL/t7ciTNtdDkwPogh3Cnjx7qk08SHwf+dksZ7M2vCOlfsF0hQ6J4ehPCaHTNrM/zBSOqD83dBEBCW/F/LEmeh0nOHd7oVl3/Qo/9GUDkkbj7yz+9cvvu+dDAtx8NzCDTP4iKdZvk9MWiizvtILLepysflSvTLFBZ37RLwiriqyRxYv/zrgFd/9XVHh/OmzBvDX4mitMR/lUavs2Vx6cR94lzAkplm3IRNy4TFfu47tuYs9EQPIPVta4P64tV+sZ7n3ued3cgEx2YK+QL5+xms6osk8qQbTyuKVGdaX9FQqk6qfDnT5ykxk0VK7KZ62b6DNDUfQlqGHxSMKv1P0XN5BqMeKG1P4Wp5QfZDUCEldppoX0U6ss2jIko2XpURKCIhfaOqLPfShdtS37ZrT+jFRSH2xYVV1rmT/MBtRQhxiO4MQ3iAGlaZi+9PWBEIXOVnu9jN1f921lWLZky9bqbM3J2MAAI9jmuAx3gyoEUa6P2ivs0EeNv/OR+AX6q5SW6l5HaoFuS6jr6yg9limu+P0KYKzfMXWcQSfTXzpOzKEKpwI3YGXZpSSy2LTlMgfmFA3CF6R5c9xWEtRuCg2ZPUQ2Nb6dRFTNd4TfGHrnEWSKHPuRyiJSDAZ+KX0VxmSHjGPbQTLVpqixia2uyhQ394gBMt7C3ZAmxn/DJS+l1fBsAo2Eir/C0jG9csd4+/tp12pPc/BVJGaK9mfvr7M/CeztrmCO5qY06Edi4xAGtiEhnWAbzLy2VEyazE1J5nPmgU4RpW4Sa0TnOT6w5lgt3/tMpROigHHmexBGAMY0mdcDbDxWIz41NgdD6oxgHsJRgr5RnT6wZAkTOcStU4NMOQNemSO7gxGahdEsC+NRVGxMUhQmmM0llWRbbmFGHzEqLM4Iw0H7577Kyo+Zf+2cUFIOw93gEY171vQaM0HLwpjpdRR6Jz7V0ckE7XzYJ0TmY9znLdzkva0vNrAGGT5SUZ5uaHDkcGvI0ySpwkasEgZPMseYcu85w8HPdSNi+4T6A83iAwDbxgeFcB1ZM2iGXzFcEOUlYVrEckaOyodfvaYSQ7GuB4ISE0nYJc15X/1ciDTPbPCgYJK55VkEor4LvzL9S2WDy4xj+6FOqVyTAC2ZNowheeeSI5hA/02l8UYkv4nk9iaVn+kCVEUstgk5Hyq+gJm6R9vG3rhuM904he/hFmNQaUIATB1y3vw+OmxP4X5Yi6A5I5jJufHCjF9+AGNwnEllZjUco6XhsO5T5+R3yxz5yLVOnAn0zuS+6zdj0nTJbEZCbXJdtpfYZfCeCOqJHoE2vPPFS6eRLjIJlG69X93nfR0mxSFXzp1Zc0lt/VafDaImhUMtbnqWVb9M4nGNQLN68BHP7AR8Il9dkcxzmBv8PCZlw9guY0lurbBsmNYlwJZsA/B15/HfkbjbwPddaVecls/elmDHNW2r4crAx43feNkfRwsaNq/yyJ0d/p5hZ6AZajz7DBfUok0ZU62gCzz7x8eVfJTKA8IWn45vINLSM1q+HF9CV9qF3zP6Ml21kPPL3CXzkuYUlnSqT+Ij4tI/od5KwIs+tDajDs64owN7tOAd6eucGz+KfO26iNcBFpbWA5732bBNWO4kHNpr9D955L61bvHCF/mwSrz6eQaDjfDEANqGMkFc+NGxpKZzCD2sj/JrHd+zlPQ8Iz7Q+2JVIiVCuCKoK/hlAEHzvk/Piq3mRL1rT/fEh9hoT5GJmeYswg1otiKydizJ/fS2SeKHVu6Z3JEHjiW8NaTQgP5xdBli8nC57XiN9hrquBu99hn9zqwo92+PM2JXtpeVZS0PdqR5mDyDreMMtEws+CpwaRyyzoYtfcvt9PJIW0fJVNNi/FFyRsea7peLvJrL+5b4GOXJ8tAr+ATk9f8KmiIsRhqRy0vFzwRV3Z5dZ3QqIU8JQ/uQpkJbjMUMFj2F9sCFeaBjI4+fL/oN3+LQgjI4zuAfQ+3IPIPFQBccf0clJpsfpnBxD84atwtupkGqKvrH7cGNl/QcWcSi6wcVDML6ljOgYbo+2BOAWNNjlUBPiyitUAwbnhFvLbnqw42kR3Yp2kv2dMeDdcGOX5kT4S6M44KHEB/SpCfl7xgsUvs+JNY9G3O2X/6FEt9FyAn57lrbiu+tl83sCymSvq9eZbe9mchL7MTf/Ta78e80zSf0hYY5eUU7+ff14jv7Xy8qjzfzzzvaJnrIdvFb5BLWKcWGy5/w7+vV2cvIfwHqdTB+RuJK5oj9mbt0Hy94AmjMjjwYNZlNS6uiyxNnwNyt3gdreLb64p/3+08nXkb92LTkkRgFOwk1oGEVllcOj5lv1hfAZywDows0944U8vUFw+A/nuVq/UCygsrmWIBnHyU01d0XJPwriEOvx/ISK6Pk4y2w0gmojZs7lU8TtakBAdne4v/aNxmMpK4VcGMp7si0yqsiolXRuOi1Z1P7SqD3Zmp0CWcyK4Ubmp2SXiXuI5nGLCieFHKHNRIlcY3Pys2dwMTYCaqlyWSITwr2oGXvyU3h1Pf8eQ3w1bnD7ilocVjYDkcXR3Oo1BXgMLTUjNw2xMVwjtp99NhSVc5aIWrDQT5DHPKtCtheBP4zHcw4dz2eRdTMamhlHhtfgqJJHI7NGDUw1XL8vsSeSHyKqDtqoAmrQqsYwvwi7HW3ojWyhIa5oz5xJTaq14NAzFLjVLR12rRNUQ6xohDnrWFb5bG9yf8aCD8d5phoackcNJp+Dw3Due3RM+5Rid7EuIgsnwgpX0rUWh/nqPtByMhMZZ69NpgvRTKZ62ViZ+Q7Dp5r4K0d7EfJuiy06KuIYauRh5Ecrhdt2QpTS1k1AscEHvapNbU3HL1F2TFyR33Wxb5MvH5iZsrn3SDcsxlnnshO8PLwmdGN+paWnQuORtZGX37uhFT64SeuPsx8UOokY6ON85WdQ1dki5zErsJGazcBOddWJEKqNPiJpsMD1GrVLrVY+AOdPWQneTyyP1hRX/lMM4ZogGGOhYuAdr7F/DOiAoc++cn5vlf0zkMUJ40Z1rlgv9BelPqVOpxKeOpzKdF8maK+1Vv23MO9k/8+qpLoxrIGH2EDQlnGmH8CD31G8QqlyQIcpmR5bwmSVw9/Ns6IHgulCRehvZ/+VrM60Cu/r3AontFfrljew74skYe2uyn7JKQtFQBQRJ9ryGic/zQOsbS4scUBctA8cPToQ3x6ZBQu6DPu5m1bnCtP8TllLYA0UTQNVqza5nfew3Mopy1GPUwG5jsl0OVXniPmAcmLqO5HG8Hv3nSLecE9oOjPDXcsTxoCBxYyzBdj4wmnyEV4kvFDunipS8SSkvdaMnTBN9brHUR8xdmmEAp/Pdqk9uextp1t+JrtXwpN/MG2w/qhRMpSNxQ1uhg/kKO30eQ/FyHUDkWHT8V6gGRU4DhDMxZu7xXij9Ui6jlpWmQCqJg3FkOTq3WKneCRYZxBXMNAVLQgHXSCGSqNdjebY94oyIpVjMYehAiFx/tqzBXFHZaL5PeeD74rW5OysFoUXY8sebUZleFTUa/+zBKVTFDopTReXNuZq47QjkWnxjirCommO4L/GrFtVV21EpMyw8wyThL5Y59d88xtlx1g1ttSICDwnof6lt/6zliPzgVUL8jWBjC0o2D6Kg+jNuThkAlaDJsq/AG2aKA//A76avw2KNqtv223P+Wq3StRDDNKFFgtsFukYt1GFDWooFVXitaNhb3RCyJi4cMeNjROiPEDb4k+G3+hD8tsg+5hhmSc/8t2JTSwYoCzAI75doq8QTHe+E/Tw0RQSUDlU+6uBeNN3h6jJGX/mH8oj0i3caCNsjvTnoh73BtyZpsflHLq6AfwJNCDX4S98h4+pCOhGKDhV3rtkKHMa3EG4J9y8zFWI4UsfNzC/Rl5midNn7gwoN9j23HGCQQ+OAZpTTPMdiVow740gIyuEtd0qVxMyNXhHcnuXRKdw5wDUSL358ktjMXmAkvIB73BLa1vfF9BAUZInPYJiwxqFWQQBVk7gQH4ojfUQ/KEjn+A/WR6EEe4CtbpoLe1mzHkajgTIoE0SLDHVauKhrq12zrAXBGbPPWKCt4DGedq3JyGRbmPFW32bE7T20+73BatV/qQhhBWfWBFHfhYWXjALts38FemnoT+9bn1jDBMcUMmYgSc0e7GQjv2MUBwLU8ionCpgV+Qrhg7iUIfUY6JFxR0Y+ZTCPM+rVuq0GNLyJXX6nrUTt8HzFBRY1E/FIm2EeVA9NcXrj7S6YYIChVQCWr/m2fYUjC4j0XLkzZ8GCSLfmkW3PB/xq+nlXsKVBOj7vTvqKCOMq7Ztqr3cQ+N8gBnPaAps+oGwWOkbuxnRYj/x/WjiDclVrs22xMK4qArE1Ztk1456kiJriw6abkNeRHogaPRBgbgF9Z8i/tbzWELN4CvbqtrqV9TtGSnmPS2F9kqOIBaazHYaJ9bi3AoDBvlZasMluxt0BDXfhp02Jn411aVt6S4TUB8ZgFDkI6TP6gwPY85w+oUQSsjIeXVminrwIdK2ZAawb8Se6XOJbOaliQxHSrnAeONDLuCnFejIbp4YDtBcQCwMsYiRZfHefuEJqJcwKTTJ8sx5hjHmJI1sPFHOr6W9AhZ2NAod38mnLQk1gOz2LCAohoQbgMbUK9RMEA3LkiF7Sr9tLZp6lkciIGhE2V546w3Mam53VtVkGbB9w0Yk2XiRnCmbpxmHr2k4eSC0RuNbjNsUfDIfc8DZvRvgUDe1IlKdZTzcT4ZGEb53dp8VtsoZlyXzLHOdAbsp1LPTVaHvLA0GYDFMbAW/WUBfUAdHwqLFAV+3uHvYWrCfhUOR2i89qvCBoOb48usAGdcF2M4aKn79k/43WzBZ+xR1L0uZfia70XP9soQReeuhZiUnXFDG1T8/OXNmssTSnYO+3kVLAgeiY719uDwL9FQycgLPessNihMZbAKG7qwPZyG11G1+ZA3jAX2yddpYfmaKBlmfcK/V0mwIRUDC0nJSOPUl2KB8h13F4dlVZiRhdGY5farwN+f9hEb1cRi41ZcGDn6Xe9MMSTOY81ULJyXIHSWFIQHstVYLiJEiUjktlHiGjntN5/btB8Fu+vp28zl2fZXN+dJDyN6EXhS+0yzqpl/LSJNEUVxmu7BsNdjAY0jVsAhkNuuY0E1G48ej25mSt+00yPbQ4SRCVkIwb6ISvYtmJRPz9Zt5dk76blf+lJwAPH5KDF+vHAmACLoCdG2Adii6dOHnNJnTmZtoOGO8Q1jy1veMw6gbLFToQmfJa7nT7Al89mRbRkZZQxJTKgK5Kc9INzmTJFp0tpAPzNmyL/F08bX3nhCumM/cR/2RPn9emZ3VljokttZD1zVWXlUIqEU7SLk5I0lFRU0AcENXBYazNaVzsVHA/sD3o9hm42wbHIRb/BBQTKzAi8s3+bMtpOOZgLdQzCYPfX3UUxKd1WYVkGH7lh/RBBgMZZwXzU9+GYxdBqlGs0LP+DZ5g2BWNh6FAcR944B+K/JTWI3t9YyVyRhlP4CCoUk/mmF7+r2pilVBjxXBHFaBfBtr9hbVn2zDuI0kEOG3kBx8CGdPOjX1ph1POOZJUO1JEGG0jzUy2tK4X0CgVNYhmkqqQysRNtKuPdCJqK3WW57kaV17vXgiyPrl4KEEWgiGF1euI4QkSFHFf0TDroQiLNKJiLbdhH0YBhriRNCHPxSqJmNNoketaioohqMglh6wLtEGWSM1EZbQg72h0UJAIPVFCAJOThpQGGdKfFovcwEeiBuZHN2Ob4uVM7+gwZLz1D9E7ta4RmMZ24OBBAg7Eh6dLXGofZ4U2TFOCQMKjwhVckjrydRS+YaqCw1kYt6UexuzbNEDyYLTZnrY1PzsHZJT4U+awO2xlqTSYu6n/U29O2wPXgGOEKDMSq+zTUtyc8+6iLp0ivav4FKx+xxVy4FxhIF/pucVDqpsVe2jFOfdZhTzLz2QjtzvsTCvDPU7bzDH2eXVKUV9TZ+qFtaSSxnYgYdXKwVreIgvWhT9eGDB2OvnWyPLfIIIfNnfIxU8nW7MbcH05nhlsYtaW9EZRsxWcKdEqInq1DiZPKCz7iGmAU9/ccnnQud2pNgIGFYOTAWjhIrd63aPDgfj8/sdlD4l+UTlcxTI9jbaMqqN0gQxSHs60IAcW3cH4p3V1aSciTKB29L1tz2eUQhRiTgTvmqc+sGtBNh4ky0mQJGsdycBREP+fAaSs1EREDVo5gvgi5+aCN7NECw30owbCc1mSpjiahyNVwJd1jiGgzSwfTpzf2c5XJvG/g1n0fH88KHNnf+u7ZiRMlXueSIsloJBUtW9ezvsx9grfsX/FNxnbxU1Lvg0hLxixypHKGFAaPu0xCD8oDTeFSyfRT6s8109GMUZL8m2xXp8X2dpPCWWdX84iga4BrTlOfqox4shqEgh/Ht4qRst52cA1xOIUuOxgfUivp6v5f8IVyaryEdpVk72ERAwdT4aoY1usBgmP+0m06Q216H/nubtNYxHaOIYjcach3A8Ez/zc0KcShhel0HCYjFsA0FjYqyJ5ZUH1aZw3+zWC0hLpM6GDfcAdn9fq2orPmZbW6XXrf+Krc9RtvII5jeD3dFoT1KwZJwxfUMvc5KLfn8rROW23Jw89sJ2a5dpB3qWDUBWF2iX8OCuKprHosJ2mflBR+Wqs86VvgI/XMnsqb97+VlKdPVysczPj8Jhzf+WCvGBHijAqYlavbF60soMWlHbvKT+ScvhprgeTln51xX0sF+Eadc/l2s2a5BgkVbHYyz0E85p0LstqH+gEGiR84nBRRFIn8hLSZrGwqjZ3E29cuGi+5Z5bp7EM8MWFa9ssS/vy4VrDfECSv7DSU84DaP0sXI3Ap4lWznQ65nQoTKRWU30gd7Nn8ZowUvGIx4aqyXGwmA/PB4qN8msJUODezUHEl0VP9uo+cZ8vPFodSIB4C7lQYjEFj8yu49C2KIV3qxMFYTevG8KqAr0TPlkbzHHnTpDpvpzziAiNFh8xiT7C/TiyH0EguUw4vxAgpnE27WIypV+uFN2zW7xniF/n75trs9IJ5amB1zXXZ1LFkJ6GbS/dFokzl4cc2mamVwhL4XU0Av5gDWAl+aEWhAP7t2VIwU+EpvfOPDcLASX7H7lZpXA2XQfbSlD4qU18NffNPoAKMNSccBfO9YVVgmlW4RydBqfHAV7+hrZ84WJGho6bNT0YMhxxLdOx/dwGj0oyak9aAkNJ8lRJzUuA8sR+fPyiyTgUHio5+Pp+YaKlHrhR41jY5NESPS3x+zTMe0S2HnLOKCOQPpdxKyviBvdHrCDRqO+l96HhhNBLXWv4yEMuEUYo8kXnYJM8oIgVM4XJ+xXOev4YbWeqsvgq0lmw4/PiYr9sYLt+W5EAuYSFnJEan8CwJwbtASBfLBBpJZiRPor/aCJBZsM+MhvS7ZepyHvU8m5WSmaZnxuLts8ojl6KkS8oSAHkq5GWlCB/NgJ5W3rO2Cj1MK7ahxsCrbTT3a0V/QQH+sErxV4XUWDHx0kkFy25bPmBMBQ6BU3HoHhhYcJB9JhP6NXUWKxnE0raXHB6U9KHpWdQCQI72qevp5fMzcm+AvC85rsynVQhruDA9fp9COe7N56cg1UKGSas89vrN+WlGLYTwi5W+0xYdKEGtGCeNJwXKDU0XqU5uQYnWsMwTENLGtbQMvoGjIFIEMzCRal4rnBAg7D/CSn8MsCvS+FDJJAzoiioJEhZJgAp9n2+1Yznr7H+6eT4YkJ9Mpj60ImcW4i4iHDLn9RydB8dx3QYm3rsX6n4VRrZDsYK6DCGwkwd5n3/INFEpk16fYpP6JtMQpqEMzcOfQGAHXBTEGzuLJ03GYQL9bmV2/7ExDlRf+Uvf1sM2frRtCWmal12pMgtonvSCtR4n1CLUZRdTHDHP1Otwqd+rcdlavnKjUB/OYXQHUJzpNyFoKpQK+2OgrEKpGyIgIBgn2y9QHnTJihZOpEvOKIoHAMGAXHmj21Lym39Mbiow4IF+77xNuewziNVBxr6KD5e+9HzZSBIlUa/AmsDFJFXeyrQakR3FwowTGcADJHcEfhGkXYNGSYo4dh4bxwLM+28xjiqkdn0/3R4UEkvcBrBfn/SzBc1XhKM2VPlJgKSorjDac96V2UnQYXl1/yZPT4DVelgO+soMjexXwYO58VLl5xInQUZI8jc3H2CPnCNb9X05nOxIy4MlecasTqGK6s2az4RjpF2cQP2G28R+7wDPsZDZC/kWtjdoHC7SpdPmqQrUAhMwKVuxCmYTiD9q/O7GHtZvPSN0CAUQN/rymXZNniYLlJDE70bsk6Xxsh4kDOdxe7A2wo7P9F5YvqqRDI6brf79yPCSp4I0jVoO4YnLYtX5nzspR5WB4AKOYtR1ujXbOQpPyYDvfRE3FN5zw0i7reehdi7yV0YDRKRllGCGRk5Yz+Uv1fYl2ZwrnGsqsjgAVo0xEUba8ohjaNMJNwTwZA/wBDWFSCpg1eUH8MYL2zdioxRTqgGQrDZxQyNzyBJPXZF0+oxITJAbj7oNC5JwgDMUJaM5GqlGCWc//KCIrI+aclEe4IA0uzv7cuj6GCdaJONpi13O544vbtIHBF+A+JeDFUQNy61Gki3rtyQ4aUywn6ru314/dkGiP8Iwjo0J/2Txs49ZkwEl4mx+iYUUO55I6pJzU4P+7RRs+DXZkyKUYZqVWrPF4I94m4Wx1tXeE74o9GuX977yvJ/jkdak8+AmoHVjI15V+WwBdARFV2IPirJgVMdsg1Pez2VNHqa7EHWdTkl3XTcyjG9BiueWFvQfXI8aWSkuuRmqi/HUuzqyvLJfNfs0txMqldYYflWB1BS31WkuPJGGwXUCpjiQSktkuBMWwHjSkQxeehqw1Kgz0Trzm7QbtgxiEPDVmWCNCAeCfROTphd1ZNOhzLy6XfJyG6Xgd5MCAZw4xie0Sj5AnY1/akDgNS9YFl3Y06vd6FAsg2gVQJtzG7LVq1OH2frbXNHWH/NY89NNZ4QUSJqL2yEcGADbT38X0bGdukqYlSoliKOcsSTuqhcaemUeYLLoI8+MZor2RxXTRThF1LrHfqf/5LcLAjdl4EERgUysYS2geE+yFdasU91UgUDsc2cSQ1ZoT9+uLOwdgAmifwQqF028INc2IQEDfTmUw3eZxvz7Ud1z3xc1PQfeCvfKsB9jOhRj7rFyb9XcDWLcYj0bByosychMezMLVkFiYcdBBQtvI6K0KRuOZQH2kBsYHJaXTkup8F0eIhO1/GcIwWKpr2mouB7g5TUDJNvORXPXa/mU8bh27TAZYBe2sKx4NSv5OjnHIWD2RuysCzBlUfeNXhDd2jxnHoUlheJ3jBApzURy0fwm2FwwsSU0caQGl0Kv8hopRQE211NnvtLRsmCNrhhpEDoNiZEzD2QdJWKbRRWnaFedXHAELSN0t0bfsCsMf0ktfBoXBoNA+nZN9+pSlmuzspFevmsqqcMllzzvkyXrzoA+Ryo1ePXpdGOoJvhyru+EBRsmOp7MXZ0vNUMUqHLUoKglg1p73sWeZmPc+KAw0pE2zIsFFE5H4192KwDvDxdxEYoDBDNZjbg2bmADTeUKK57IPD4fTYF4c6EnXx/teYMORBDtIhPJneiZny7Nv/zG+YmekIKCoxr6kauE2bZtBLufetNG0BtBY7f+/ImUypMBvdWu/Q7vTMRzw5aQGZWuc1V0HEsItFYMIBnoKGZ0xcarba/TYZq50kCaflFysYjA4EDKHqGdpYWdKYmm+a7TADmW35yfnOYpZYrkpVEtiqF0EujI00aeplNs2k+qyFZNeE3CDPL9P6b4PQ/kataHkVpLSEVGK7EX6rAa7IVNrvZtFvOA6okKvBgMtFDAGZOx88MeBcJ8AR3AgUUeIznAN6tjCUipGDZONm1FjWJp4A3QIzSaIOmZ7DvF/ysYYbM/fFDOV0jntAjRdapxJxL0eThpEhKOjCDDq2ks+3GrwxqIFKLe1WdOzII8XIOPGnwy6LKXVfpSDOTEfaRsGujhpS4hBIsMOqHbl16PJxc4EkaVu9wpEYlF/84NSv5Zum4drMfp9yXbzzAOJqqS4YkI4cBrFrC7bMPiCfgI3nNZAqkk3QOZqR+yyqx+nDQKBBBZ7QKrfGMCL+XpqFaBJU0wpkBdAhbR4hJsmT5aynlvkouoxm/NjD5oe6BzVIO9uktM+/5dEC5P7vZvarmuO/lKXz4sBabVPIATuKTrwbJP8XUkdM6uEctHKXICUJGjaZIWRbZp8czquQYfY6ynBUCfIU+gG6wqSIBmYIm9pZpXdaL121V7q0VjDjmQnXvMe7ysoEZnZL15B0SpxS1jjd83uNIOKZwu5MPzg2NhOx3xMOPYwEn2CUzbSrwAs5OAtrz3GAaUkJOU74XwjaYUmGJdZBS1NJVkGYrToINLKDjxcuIlyfVsKQSG/G4DyiO2SlQvJ0d0Ot1uOG5IFSAkq+PRVMgVMDvOIJMdqjeCFKUGRWBW9wigYvcbU7CQL/7meF2KZAaWl+4y9uhowAX7elogAvItAAxo2+SFxGRsHGEW9BnhlTuWigYxRcnVUBRQHV41LV+Fr5CJYV7sHfeywswx4XMtUx6EkBhR+q8AXXUA8uPJ73Pb49i9KG9fOljvXeyFj9ixgbo6CcbAJ7WHWqKHy/h+YjBwp6VcN7M89FGzQ04qbrQtgrOFybg3gQRTYG5xn73ArkfQWjCJROwy3J38Dx/D7jOa6BBNsitEw1wGq780EEioOeD+ZGp2J66ADiVGMayiHYucMk8nTK2zzT9CnEraAk95kQjy4k0GRElLL5YAKLQErJ5rp1eay9O4Fb6yJGm9U4FaMwPGxtKD6odIIHKoWnhKo1U8KIpFC+MVn59ZXmc7ZTBZfsg6FQ8W10YfTr4u0nYrpHZbZ1jXiLmooF0cOm0+mPnJBXQtepc7n0BqOipNCqI6yyloTeRShNKH04FIo0gcMk0H/xThyN4pPAWjDDkEp3lNNPRNVfpMI44CWRlRgViP64eK0JSRp0WUvCWYumlW/c58Vcz/yMwVcW5oYb9+26TEhwvbxiNg48hl1VI1UXTU//Eta+BMKnGUivctfL5wINDD0giQL1ipt6U7C9cd4+lgqY2lMUZ02Uv6Prs+ZEZer7ZfWBXVghlfOOrClwsoOFKzWEfz6RZu1eCs+K8fLvkts5+BX0gyrFYve0C3qHrn5U/Oh6D/CihmWIrY7HUZRhJaxde+tldu6adYJ+LeXupQw0XExC36RETdNFxcq9glMu4cNQSX9cqR/GQYp+IxUkIcNGWVU7ZtGa6P3XAyodRt0XeS3Tp01AnCh0ZbUh4VrSZeV9RWfSoWyxnY3hzcZ30G/InDq4wxRrEejreBxnhIQbkxenxkaxl+k7eLUQkUR6vKJ2iDFNGX3WmVA1yaOH+mvhBd+sE6vacQzFobwY5BqEAFmejwW5ne7HtVNolOUgJc8CsUxmc/LBi8N5mu9VsIA5HyErnS6zeCz7VLI9+n/hbT6hTokMXTVyXJRKSG2hd2labXTbtmK4fNH3IZBPreSA4FMeVouVN3zG5x9CiGpLw/3pceo4qGqp+rVp+z+7yQ98oEf+nyH4F3+J9IheDBa94Wi63zJbLBCIZm7P0asHGpIJt3PzE3m0S4YIWyXBCVXGikj8MudDPB/6Nm2v4IxJ5gU0ii0guy5SUHqGUYzTP0jIJU5E82RHUXtX4lDdrihBLdP1YaG1AGUC12rQKuIaGvCpMjZC9bWSCYnjDlvpWbkdXMTNeBHLKiuoozMGIvkczmP0aRJSJ8PYnLCVNhKHXBNckH79e8Z8Kc2wUej4sQZoH8qDRGkg86maW/ZQWGNnLcXmq3FlXM6ssR/3P6E/bHMvm6HLrv1yRixit25JsH3/IOr2UV4BWJhxXW5BJ6Xdr07n9kF3ZNAk6/Xpc5MSFmYJ2R7bdL8Kk7q1OU9Elg/tCxJ8giT27wSTySF0GOxg4PbYJdi/Nyia9Nn89CGDulfJemm1aiEr/eleGSN+5MRrVJ4K6lgyTTIW3i9cQ0dAi6FHt0YMbH3wDSAtGLSAccezzxHitt1QdhW36CQgPcA8vIIBh3/JNjf/Obmc2yzpk8edSlS4lVdwgW5vzbYEyFoF4GCBBby1keVNueHAH+evi+H7oOVfS3XuPQSNTXOONAbzJeSb5stwdQHl1ZjrGoE49I8+A9j3t+ahhQj74FCSWpZrj7wRSFJJnnwi1T9HL5qrCFW/JZq6P62XkMWTb+u4lGpKfmmwiJWx178GOG7KbrZGqyWwmuyKWPkNswkZ1q8uptUlviIi+AXh2bOOTOLsrtNkfqbQJeh24reebkINLkjut5r4d9GR/r8CBa9SU0UQhsnZp5cP+RqWCixRm7i4YRFbtZ4EAkhtNa6jHb6gPYQv7MKqkPLRmX3dFsK8XsRLVZ6IEVrCbmNDc8o5mqsogjAQfoC9Bc7R6gfw03m+lQpv6kTfhxscDIX6s0w+fBxtkhjXAXr10UouWCx3C/p/FYwJRS/AXRKkjOb5CLmK4XRe0+xeDDwVkJPZau52bzLEDHCqV0f44pPgKOkYKgTZJ33fmk3Tu8SdxJ02SHM8Fem5SMsWqRyi2F1ynfRJszcFKykdWlNqgDA/L9lKYBmc7Zu/q9ii1FPF47VJkqhirUob53zoiJtVVRVwMR34gV9iqcBaHbRu9kkvqk3yMpfRFG49pKKjIiq7h/VpRwPGTHoY4cg05X5028iHsLvUW/uz+kjPyIEhhcKUwCkJAwbR9pIEGOn8z6svAO8i89sJ3dL5qDWFYbS+HGPRMxYwJItFQN86YESeJQhn2urGiLRffQeLptDl8dAgb+Tp47UQPxWOw17OeChLN1WnzlkPL1T5O+O3Menpn4C3IY5LEepHpnPeZHbvuWfeVtPlkH4LZjPbBrkJT3NoRJzBt86CO0Xq59oQ+8dsm0ymRcmQyn8w71mhmcuEI5byuF+C88VPYly2sEzjlzAQ3vdn/1+Hzguw6qFNNbqenhZGbdiG6RwZaTG7jTA2X9RdXjDN9yj1uQpyO4Lx8KRAcZcbZMafp4wPOd5MdXoFY52V1A8M9hi3sso93+uprE0qYNMjkE22CvK4HuUxqN7oIz5pWuETq1lQAjqlSlqdD2Rnr/ggp/TVkQYjn9lMfYelk2sH5HPdopYo7MHwlV1or9Bxf+QCyLzm92vzG2wjiIjC/ZHEJzeroJl6bdFPTpZho5MV2U86fLQqxNlGIMqCGy+9WYhJ8ob1r0+Whxde9L2PdysETv97O+xVw+VNN1TZSQN5I6l9m5Ip6pLIqLm4a1B1ffH6gHyqT9p82NOjntRWGIofO3bJz5GhkvSWbsXueTAMaJDou99kGLqDlhwBZNEQ4mKPuDvVwSK4WmLluHyhA97pZiVe8g+JxmnJF8IkV/tCs4Jq/HgOoAEGR9tCDsDbDmi3OviUQpG5D8XmKcSAUaFLRXb2lmJTNYdhtYyfjBYZQmN5qT5CNuaD3BVnlkCk7bsMW3AtXkNMMTuW4HjUERSJnVQ0vsBGa1wo3Qh7115XGeTF3NTz8w0440AgU7c3bSXO/KMINaIWXd0oLpoq/0/QJxCQSJ9XnYy1W7TYLBJpHsVWD1ahsA7FjNvRd6mxCiHsm8g6Z0pnzqIpF1dHUtP2ITU5Z1hZHbu+L3BEEStBbL9XYvGfEakv1bmf+bOZGnoiuHEdlBnaChxYKNzB23b8sw8YyT7Ajxfk49eJIAvdbVkdFCe2J0gMefhQ0bIZxhx3fzMIysQNiN8PgOUKxOMur10LduigREDRMZyP4oGWrP1GFY4t6groASsZ421os48wAdnrbovNhLt7ScNULkwZ5AIZJTrbaKYTLjA1oJ3sIuN/aYocm/9uoQHEIlacF1s/TM1fLcPTL38O9fOsjMEIwoPKfvt7opuI9G2Hf/PR4aCLDQ7wNmIdEuXJ/QNL72k5q4NejAldPfe3UVVqzkys8YZ/jYOGOp6c+YzRCrCuq0M11y7TiN6qk7YXRMn/gukxrEimbMQjr3jwRM6dKVZ4RUfWQr8noPXLJq6yh5R3EH1IVOHESst/LItbG2D2vRsZRkAObzvQAAD3mb3/G4NzopI0FAiHfbpq0X72adg6SRj+8OHMShtFxxLZlf/nLgRLbClwl5WmaYSs+yEjkq48tY7Z2bE0N91mJwt+ua0NlRJIDh0HikF4UvSVorFj2YVu9YeS5tfvlVjPSoNu/Zu6dEUfBOT555hahBdN3Sa5Xuj2Rvau1lQNIaC944y0RWj9UiNDskAK1WoL+EfXcC6IbBXFRyVfX/WKXxPAwUyIAGW8ggZ08hcijKTt1YKnUO6QPvcrmDVAb0FCLIXn5id4fD/Jx4tw/gbXs7WF9b2RgXtPhLBG9vF5FEkdHAKrQHZAJC/HWvk7nvzzDzIXZlfFTJoC3JpGgLPBY7SQTjGlUvG577yNutZ1hTfs9/1nkSXK9zzKLRZ3VODeKUovJe0WCq1zVMYxCJMenmNzPIU2S8TA4E7wWmbNkxq9rI2dd6v0VpcAPVMxnDsvWTWFayyqvKZO7Z08a62i/oH2/jxf8rpmfO64in3FLiL1GX8IGtVE9M23yGsIqJbxDTy+LtaMWDaPqkymb5VrQdzOvqldeU0SUi6IirG8UZ3jcpRbwHa1C0Dww9G/SFX3gPvTJQE+kyz+g1BeMILKKO+olcHzctOWgzxYHnOD7dpCRtuZEXACjgqesZMasoPgnuDC4nUviAAxDc5pngjoAITIkvhKwg5d608pdrZcA+qn5TMT6Uo/QzBaOxBCLTJX3Mgk85rMfsnWx86oLxf7p2PX5ONqieTa/qM3tPw4ZXvlAp83NSD8F7+ZgctK1TpoYwtiU2h02HCGioH5tkVCqNVTMH5p00sRy2JU1qyDBP2CII/Dg4WDsIl+zgeX7589srx6YORRQMBfKbodbB743Tl4WLKOEnwWUVBsm94SOlCracU72MSyj068wdpYjyz1FwC2bjQnxnB6Mp/pZ+yyZXtguEaYB+kqhjQ6UUmwSFazOb+rhYjLaoiM+aN9/8KKn0zaCTFpN9eKwWy7/u4EHzO46TdFSNjMfn2iPSJwDPCFHc0I1+vjdAZw5ZjqR/uzi9Zn20oAa5JnLEk/EA3VRWE7J/XrupfFJPtCUuqHPpnlL7ISJtRpSVcB8qsZCm2QEkWoROtCKKxUh3yEcMbWYJwk6DlEBG0bZP6eg06FL3v6RPb7odGuwm7FN8fG4woqtB8e7M5klPpo97GoObNwt+ludTAmxyC5hmcFx+dIvEZKI6igFKHqLH01iY1o7903VzG9QGetyVx5RNmBYUU+zIuSva/yIcECUi4pRmE3VkF2avqulQEUY4yZ/wmNboBzPmAPey3+dSYtBZUjeWWT0pPwCz4Vozxp9xeClIU60qvEFMQCaPvPaA70WlOP9f/ey39macvpGCVa+zfa8gO44wbxpJUlC8GN/pRMTQtzY8Z8/hiNrU+Zq64ZfFGIkdj7m7abcK1EBtws1X4J/hnqvasPvvDSDYWN+QcQVGMqXalkDtTad5rYY0TIR1Eqox3czwPMjKPvF5sFv17Thujr1IZ1Ytl4VX1J0vjXKmLY4lmXipRAro0qVGEcXxEVMMEl54jQMd4J7RjgomU0j1ptjyxY+cLiSyXPfiEcIS2lWDK3ISAy6UZ3Hb5vnPncA94411jcy75ay6B6DSTzK6UTCZR9uDANtPBrvIDgjsfarMiwoax2OlLxaSoYn4iRgkpEGqEkwox5tyI8aKkLlfZ12lO11TxsqRMY89j5JaO55XfPJPDL1LGSnC88Re9Ai+Nu5bZjtwRrvFITUFHPR4ZmxGslQMecgbZO7nHk32qHxYkdvWpup07ojcMCaVrpFAyFZJJbNvBpZfdf39Hdo2kPtT7v0/f8R/B5Nz4f1t9/3zNM/7n6SUHfcWk5dfQFJvcJMgPolGCpOFb/WC0FGWU2asuQyT+rm88ZKZ78Cei/CAh939CH0JYbpZIPtxc2ufXqjS3pHH9lnWK4iJ7OjR/EESpCo2R3MYKyE7rHfhTvWho4cL1QdN4jFTyR6syMwFm124TVDDRXMNveI1Dp/ntwdz8k8kxw7iFSx6+Yx6O+1LzMVrN0BBzziZi9kneZSzgollBnVwBh6oSOPHXrglrOj+QmR/AESrhDpKrWT+8/AiMDxS/5wwRNuGQPLlJ9ovomhJWn8sMLVItQ8N/7IXvtD8kdOoHaw+vBSbFImQsv/OCAIui99E+YSIOMlMvBXkAt+NAZK8wB9Jf8CPtB+TOUOR+z71d/AFXpPBT6+A5FLjxMjLIEoJzrQfquvxEIi+WoUzGR1IzQFNvbYOnxb2PyQ0kGdyXKzW2axQL8lNAXPk6NEjqrRD1oZtKLlFoofrXw0dCNWASHzy+7PSzOUJ3XtaPZsxLDjr+o41fKuKWNmjiZtfkOzItvlV2MDGSheGF0ma04qE3TUEfqJMrXFm7DpK+27DSvCUVf7rbNoljPhha5W7KBqVq0ShUSTbRmuqPtQreVWH4JET5yMhuqMoSd4r/N8sDmeQiQQvi1tcZv7Moc7dT5X5AtCD6kNEGZOzVcNYlpX4AbTsLgSYYliiPyVoniuYYySxsBy5cgb3pD+EK0Gpb0wJg031dPgaL8JZt6sIvzNPEHfVPOjXmaXj4bd4voXzpZ5GApMhILgMbCEWZ2zwgdeQgjNHLbPIt+KqxRwWPLTN6HwZ0Ouijj4UF+Sg0Au8XuIKW0WxlexdrFrDcZJ8Shauat3X0XmHygqgL1nAu2hrJFb4wZXkcS+i36KMyU1yFvYv23bQUJi/3yQpqr/naUOoiEWOxckyq/gq43dFou1DVDaYMZK9tho7+IXXokBCs5GRfOcBK7g3A+jXQ39K4YA8PBRW4m5+yR0ZAxWJncjRVbITvIAPHYRt1EJ3YLiUbqIvoKHtzHKtUy1ddRUQ0AUO41vonZDUOW+mrszw+SW/6Q/IUgNpcXFjkM7F4CSSQ2ExZg85otsMs7kqsQD4OxYeBNDcSpifjMoLb7GEbGWTwasVObmB/bfPcUlq0wYhXCYEDWRW02TP5bBrYsKTGWjnWDDJ1F7zWai0zW/2XsCuvBQjPFcTYaQX3tSXRSm8hsAoDdjArK/OFp6vcWYOE7lizP0Yc+8p16i7/NiXIiiQTp7c7Xus925VEtlKAjUdFhyaiLT7VxDagprMFwix4wZ05u0qj7cDWFd0W9OYHIu3JbJKMXRJ1aYNovugg+QqRN7fNHSi26VSgBpn+JfMuPo3aeqPWik/wI5Rz3BWarPQX4i5+dM0npwVOsX+KsOhC7vDg+OJsz4Q5zlnIeflUWL6QYMbf9WDfLmosLF4Qev3mJiOuHjoor/dMeBpA9iKDkMjYBNbRo414HCxjsHrB4EXNbHzNMDHCLuNBG6Sf+J4MZ/ElVsDSLxjIiGsTPhw8BPjxbfQtskj+dyNMKOOcUYIRBEIqbazz3lmjlRQhplxq673VklMMY6597vu+d89ec/zq7Mi4gQvh87ehYbpOuZEXj5g/Q7S7BFDAAB9DzG35SC853xtWVcnZQoH54jeOqYLR9NDuwxsVthTV7V99n/B7HSbAytbEyVTz/5NhJ8gGIjG0E5j3griULUd5Rg7tQR+90hJgNQKQH2btbSfPcaTOfIexc1db1BxUOhM1vWCpLaYuKr3FdNTt/T3PWCpEUWDKEtzYrjpzlL/wri3MITKsFvtF8QVV/NhVo97aKIBgdliNc10dWdXVDpVtsNn+2UIolrgqdWA4EY8so0YvB4a+aLzMXiMAuOHQrXY0tr+CL10JbvZzgjJJuB1cRkdT7DUqTvnswVUp5kkUSFVtIIFYK05+tQxT6992HHNWVhWxUsD1PkceIrlXuUVRogwmfdhyrf6zzaL8+c0L7GXMZOteAhAVQVwdJh+7nrX7x4LaIIfz2F2v7Dg/uDfz2Fa+4gFm2zHAor8UqimJG3VTJtZEoFXhnDYXvxMJFc6ku2bhbCxzij2z5UNuK0jmp1mnvkVNUfR+SEmj1Lr94Lym75PO7Fs0MIr3GdsWXRXSfgLTVY0FLqba97u1In8NAcY7IC6TjWLigwKEIm43NxTdaVTv9mcKkzuzBkKd8x/xt1p/9BbP7Wyb4bpo1K1gnOpbLvKz58pWl3B55RJ/Z5mRDLPtNQg14jdOEs9+h/V5UVpwrAI8kGbX8KPVPDIMfIqKDjJD9UyDOPhjZ3vFAyecwyq4akUE9mDOtJEK1hpDyi6Ae87sWAClXGTiwPwN7PXWwjxaR79ArHRIPeYKTunVW24sPr/3HPz2IwH8oKH4OlWEmt4BLM6W5g4kMcYbLwj2usodD1088stZA7VOsUSpEVl4w7NMb1EUHMRxAxLF0CIV+0L3iZb+ekB1vSDSFjAZ3hfLJf7gFaXrOKn+mhR+rWw/eTXIcAgl4HvFuBg1LOmOAwJH3eoVEjjwheKA4icbrQCmvAtpQ0mXG0agYp5mj4Rb6mdQ+RV4QBPbxMqh9C7o8nP0Wko2ocnCHeRGhN1XVyT2b9ACsL+6ylUy+yC3QEnaKRIJK91YtaoSrcWZMMwxuM0E9J68Z+YyjA0g8p1PfHAAIROy6Sa04VXOuT6A351FOWhKfTGsFJ3RTJGWYPoLk5FVK4OaYR9hkJvezwF9vQN1126r6isMGXWTqFW+3HL3I/jurlIdDWIVvYY+s6yq7lrFSPAGRdnU7PVwY/SvWbZGpXzy3BQ2LmAJlrONUsZs4oGkly0V267xbD5KMY8woNNsmWG1VVgLCra8aQBBcI4DP2BlNwxhiCtHlaz6OWFoCW0vMR3ErrG7JyMjTSCnvRcsEHgmPnwA6iNpJ2DrFb4gLlhKJyZGaWkA97H6FFdwEcLT6DRQQL++fOkVC4cYGW1TG/3iK5dShRSuiBulmihqgjR45Vi03o2RbQbP3sxt90VxQ6vzdlGfkXmmKmjOi080JSHkLntjvsBJnv7gKscOaTOkEaRQqAnCA4HWtB4XnMtOhpRmH2FH8tTXrIjAGNWEmudQLCkcVlGTQ965Kh0H6ixXbgImQP6b42B49sO5C8pc7iRlgyvSYvcnH9FgQ3azLbQG2cUW96SDojTQStxkOJyOuDGTHAnnWkz29aEwN9FT8EJ4yhXOg+jLTrCPKeEoJ9a7lDXOjEr8AgX4BmnMQ668oW0zYPyQiVMPxKRHtpfnEEyaKhdzNVThlxxDQNdrHeZiUFb6NoY2KwvSb7BnRcpJy+/g/zAYx3fYSN5QEaVD2Y1VsNWxB0BSO12MRsRY8JLfAezRMz5lURuLUnG1ToKk6Q30FughqWN6gBNcFxP/nY/iv+iaUQOa+2Nuym46wtI/DvSfzSp1jEi4SdYBE7YhTiVV5cX9gwboVDMVgZp5YBQlHOQvaDNfcCoCJuYhf5kz5kwiIKPjzgpcRJHPbOhJajeoeRL53cuMahhV8Z7IRr6M4hW0JzT7mzaMUzQpm866zwM7Cs07fJYXuWvjAMkbe5O6V4bu71sOG6JQ4oL8zIeXHheFVavzxmlIyBkgc9IZlEDplMPr8xlcyss4pVUdwK1e7CK2kTsSdq7g5SHRAl3pYUB9Ko4fsh4qleOyJv1z3KFSTSvwEcRO/Ew8ozEDYZSqpfoVW9uhJfYrNAXR0Z3VmeoAD+rVWtwP/13sE/3ICX3HhDG3CMc476dEEC0K3umSAD4j+ZQLVdFOsWL2C1TH5+4KiSWH+lMibo+B55hR3Gq40G1n25sGcN0mEcoU2wN9FCVyQLBhYOu9aHVLWjEKx2JIUZi5ySoHUAI9b8hGzaLMxCZDMLhv8MkcpTqEwz9KFDpCpqQhVmsGQN8m24wyB82FAKNmjgfKRsXRmsSESovAwXjBIoMKSG51p6Um8b3i7GISs7kjTq/PZoioCfJzfKdJTN0Q45kQEQuh9H88M3yEs3DbtRTKALraM0YC8laiMiOOe6ADmTcCiREeAWZelBaEXRaSuj2lx0xHaRYqF65O0Lo5OCFU18A8cMDE4MLYm9w2QSr9NgQAIcRxZsNpA7UJR0e71JL+VU+ISWFk5I97lra8uGg7GlQYhGd4Gc6rxsLFRiIeGO4abP4S4ekQ1fiqDCy87GZHd52fn5aaDGuvOmIofrzpVwMvtbreZ/855OaXTRcNiNE0wzGZSxbjg26v8ko8L537v/XCCWP2MFaArJpvnkep0pA+O86MWjRAZPQRfznZiSIaTppy6m3p6HrNSsY7fDtz7Cl4V/DJAjQDoyiL2uwf1UHVd2AIrzBUSlJaTj4k6NL97a/GqhWKU9RUmjnYKpm2r+JYUcrkCuZKvcYvrg8pDoUKQywY9GDWg03DUFSirlUXBS5SWn/KAntnf0IdHGL/7mwXqDG+LZYjbEdQmqUqq4y54TNmWUP7IgcAw5816YBzwiNIJiE9M4lPCzeI/FGBeYy3p6IAmH4AjXXmvQ4Iy0Y82NTobcAggT2Cdqz6Mx4TdGoq9fn2etrWKUNFyatAHydQTVUQ2S5OWVUlugcNvoUrlA8cJJz9MqOa/W3iVno4zDHfE7zhoY5f5lRTVZDhrQbR8LS4eRLz8iPMyBL6o4PiLlp89FjdokQLaSBmKHUwWp0na5fE3v9zny2YcDXG/jfI9sctulHRbdkI5a4GOPJx4oAJQzVZ/yYAado8KNZUdEFs9ZPiBsausotXMNebEgr0dyopuqfScFJ3ODNPHgclACPdccwv0YJGQdsN2lhoV4HVGBxcEUeUX/alr4nqpcc1CCR3vR7g40zteQg/JvWmFlUE4mAiTpHlYGrB7w+U2KdSwQz2QJKBe/5eiixWipmfP15AFWrK8Sh1GBBYLgzki1wTMhGQmagXqJ2+FuqJ8f0XzXCVJFHQdMAw8xco11HhM347alrAu+wmX3pDFABOvkC+WPX0Uhg1Z5MVHKNROxaR84YV3s12UcM+70cJ460SzEaKLyh472vOMD3XnaK7zxZcXlWqenEvcjmgGNR2OKbI1s8U+iwiW+HotHalp3e1MGDy6BMVIvajnAzkFHbeVsgjmJUkrP9OAwnEHYXVBqYx3q7LvXjoVR0mY8h+ZaOnh053pdsGkmbqhyryN01eVHySr+CkDYkSMeZ1xjPNVM+gVLTDKu2VGsMUJqWO4TwPDP0VOg2/8ITbAUaMGb4LjL7L+Pi11lEVMXTYIlAZ/QHmTENjyx3kDkBdfcvvQt6tKk6jYFM4EG5UXDTaF5+1ZjRz6W7MdJPC+wTkbDUim4p5QQH3b9kGk2Bkilyeur8Bc20wm5uJSBO95GfYDI1EZipoRaH7uVveneqz43tlTZGRQ4a7CNmMHgXyOQQOL6WQkgMUTQDT8vh21aSdz7ERiZT1jK9F+v6wgFvuEmGngSvIUR2CJkc5tx1QygfZnAruONobB1idCLB1FCfO7N1ZdRocT8/Wye+EnDiO9pzqIpnLDl4bkaRKW+ekBVwHn46Shw1X0tclt/0ROijuUB4kIInrVJU4buWf4YITJtjOJ6iKdr1u+flgQeFH70GxKjhdgt/MrwfB4K/sXczQ+9zYcrD4dhY6qZhZ010rrxggWA8JaZyg2pYij8ieYEg1aZJkZK9O1Re7sB0iouf60rK0Gd+AYlp7soqCBCDGwfKeUQhCBn0E0o0GS6PdmjLi0TtCYZeqazqwN+yNINIA8Lk3iPDnWUiIPLGNcHmZDxfeK0iAdxm/T7LnN+gemRL61hHIc0NCAZaiYJR+OHnLWSe8sLrK905B5eEJHNlWq4RmEXIaFTmo49f8w61+NwfEUyuJAwVqZCLFcyHBKAcIVj3sNzfEOXzVKIndxHw+AR93owhbCxUZf6Gs8cz6/1VdrFEPrv330+9s6BtMVPJ3zl/Uf9rUi0Z/opexfdL3ykF76e999GPfVv8fJv/Y/+/5hEMon1tqNFyVRevV9y9/uIvsG3dbB8GRRrgaEXfhx+2xeOFt+cEn3RZanNxdEe2+B6MHpNbrRE53PlDifPvFcp4kO78ILR0T4xyW/WGPyBsqGdoA7zJJCu1TKbGfhnqgnRbxbB2B3UZoeQ2bz2sTVnUwokTcTU21RxN1PYPS3Sar7T0eRIsyCNowr9amwoMU/od9s2APtiKNL6ENOlyKADstAEWKA+sdKDhrJ6BOhRJmZ+QJbAaZ3/5Fq0/lumCgEzGEbu3yi0Y4I4EgVAjqxh4HbuQn0GrRhOWyAfsglQJAVL1y/6yezS2k8RE2MstJLh92NOB3GCYgFXznF4d25qiP4ZCyI4RYGesut6FXK6GwPpKK8WHEkhYui0AyEmr5Ml3uBFtPFdnioI8RiCooa7Z1G1WuyIi3nSNglutc+xY8BkeW3JJXPK6jd2VIMpaSxpVtFq+R+ySK9J6WG5Qvt+C+QH1hyYUOVK7857nFmyDBYgZ/o+AnibzNVqyYCJQvyDXDTK+iXdkA71bY7TL3bvuLxLBQ8kbTvTEY9aqkQ3+MiLWbEgjLzOH+lXgco1ERgzd80rDCymlpaRQbOYnKG/ODoFl46lzT0cjM5FYVvv0qLUbD5lyJtMUaC1pFlTkNONx6lliaX9o0i/1vws5bNKn5OuENQEKmLlcP4o2ZmJjD4zzd3Fk32uQ4uRWkPSUqb4LBe3EXHdORNB2BWsws5daRnMfNVX7isPSb1hMQdAJi1/qmDMfRUlCU74pmnzjbXfL8PVG8NsW6IQM2Ne23iCPIpryJjYbVnm5hCvKpMa7HLViNiNc+xTfDIaKm3jctViD8A1M9YPJNk003VVr4Zo2MuGW8vil8SLaGpPXqG7I4DLdtl8a4Rbx1Lt4w5Huqaa1XzZBtj208EJVGcmKYEuaeN27zT9EE6a09JerXdEbpaNgNqYJdhP1NdqiPKsbDRUi86XvvNC7rME5mrSQtrzAZVndtSjCMqd8BmaeGR4l4YFULGRBeXIV9Y4yxLFdyoUNpiy2IhePSWzBofYPP0eIa2q5JP4j9G8at/AqoSsLAUuRXtvgsqX/zYwsE+of6oSDbUOo4RMJw+DOUTJq+hnqwKim9Yy/napyZNTc2rCq6V9jHtJbxGPDwlzWj/Sk3zF/BHOlT/fSjSq7FqlPI1q6J+ru8Aku008SFINXZfOfnZNOvGPMtEmn2gLPt+H4QLA+/SYe4j398auzhKIp2Pok3mPC5q1IN1HgR+mnEfc4NeeHYwd2/kpszR3cBn7ni9NbIqhtSWFW8xbUJuUPVOeeXu3j0IGZmFNiwaNZ6rH4/zQ2ODz6tFxRLsUYZu1bfd1uIvfQDt4YD/efKYv8VF8bHGDgK22w2Wqwpi43vNCOXFJZCGMqWiPbL8mil6tsmOTXAWCyMCw73e2rADZj2IK6rqksM3EXF2cbLb4vjB14wa/yXK5vwU+05MzERJ5nXsXsW21o7M+gO0js2OyKciP5uF2iXyb2DiptwQeHeqygkrNsqVCSlldxBMpwHi1vfc8RKpP/4L3Lmpq6DZcvhDDfxTCE3splacTcOtXdK2g303dIWBVe2wD/Gvja1cClFQ67gw0t1ZUttsUgQ1Veky8oOpS6ksYEc4bqseCbZy766SvL3FodmnahlWJRgVCNjPxhL/fk2wyvlKhITH/VQCipOI0dNcRa5B1M5HmOBjTLeZQJy237e2mobwmDyJNHePhdDmiknvLKaDbShL+Is1XTCJuLQd2wmdJL7+mKvs294whXQD+vtd88KKk0DXP8B1Xu9J+xo69VOuFgexgTrcvI6SyltuLix9OPuE6/iRJYoBMEXxU4shQMf4Fjqwf1PtnJ/wWSZd29rhZjRmTGgiGTAUQqRz+nCdjeMfYhsBD5Lv60KILWEvNEHfmsDs2L0A252351eUoYxAysVaCJVLdH9QFWAmqJDCODUcdoo12+gd6bW2boY0pBVHWL6LQDK5bYWh1V8vFvi0cRpfwv7cJiMX3AZNJuTddHehTIdU0YQ/sQ1dLoF2xQPcCuHKiuCWOY30DHe1OwcClLAhqAKyqlnIbH/8u9ScJpcS4kgp6HKDUdiOgRaRGSiUCRBjzI5gSksMZKqy7Sd51aeg0tgJ+x0TH9YH2Mgsap9N7ENZdEB0bey2DMTrBA1hn56SErNHf3tKtqyL9b6yXEP97/rc+jgD2N1LNUH6RM9AzP3kSipr06RkKOolR7HO768jjWiH1X92jA7dkg7gcNcjqsZCgfqWw0tPXdLg20cF6vnQypg7gLtkazrHAodyYfENPQZsdfnjMZiNu4nJO97D1/sQE+3vNFzrSDOKw+keLECYf7RJwVHeP/j79833oZ0egonYB2FlFE5qj02B/LVOMJQlsB8uNg3Leg4qtZwntsOSNidR0abbZmAK4sCzvt8Yiuz2yrNCJoH5O8XvX/vLeR/BBYTWj0sOPYM/jyxRd5+/JziKAABaPcw/34UA3aj/gLZxZgRCWN6m4m3demanNgsx0P237/Q+Ew5VYnJPkyCY0cIVHoFn2Ay/e7U4P19APbPFXEHX94N6KhEMPG7iwB3+I+O1jd5n6VSgHegxgaSawO6iQCYFgDsPSMsNOcUj4q3sF6KzGaH/0u5PQoAj/8zq6Uc9MoNrGqhYeb2jQo0WlGlXjxtanZLS24/OIN5Gx/2g684BPDQpwlqnkFcxpmP/osnOXrFuu4PqifouQH0eF5qCkvITQbJw/Zvy5mAHWC9oU+cTiYhJmSfKsCyt1cGVxisKu+NymEQIAyaCgud/V09qT3nk/9s/SWsYtha7yNpzBIMM40rCSGaJ9u6lEkl00vXBiEt7p9P5IBCiavynEOv7FgLqPdeqxRiCwuFVMolSIUBcoyfUC2e2FJSAUgYdVGFf0b0Kn2EZlK97yyxrT2MVgvtRikfdaAW8RwEEfN+B7/eK8bBdp7URpbqn1xcrC6d2UjdsKbzCjBFqkKkoZt7Mrhg6YagE7spkqj0jOrWM+UGQ0MUlG2evP1uE1p2xSv4dMK0dna6ENcNUF+xkaJ7B764NdxLCpuvhblltVRAf7vK5qPttJ/9RYFUUSGcLdibnz6mf7WkPO3MkUUhR2mAOuGv8IWw5XG1ZvoVMnjSAZe6T7WYA99GENxoHkMiKxHlCuK5Gd0INrISImHQrQmv6F4mqU/TTQ8nHMDzCRivKySQ8dqkpQgnUMnwIkaAuc6/FGq1hw3b2Sba398BhUwUZSAIO8XZvnuLdY2n6hOXws+gq9BHUKcKFA6kz6FDnpxLPICa3qGhnc97bo1FT/XJk48LrkHJ2CAtBv0RtN97N21plfpXHvZ8gMJb7Zc4cfI6MbPwsW7AilCSXMFIEUEmir8XLEklA0ztYbGpTTGqttp5hpFTTIqUyaAIqvMT9A/x+Ji5ejA4Bhxb/cl1pUdOD6epd3yilIdO6j297xInoiBPuEDW2/UfslDyhGkQs7Wy253bVnlT+SWg89zYIK/9KXFl5fe+jow2rd5FXv8zDPrmfMXiUPt9QBO/iK4QGbX5j/7Rx1c1vzsY8ONbP3lVIaPrhL4+1QrECTN3nyKavGG0gBBtHvTKhGoBHgMXHStFowN+HKrPriYu+OZ05Frn8okQrPaaxoKP1ULCS/cmKFN3gcH7HQlVjraCeQmtjg1pSQxeuqXiSKgLpxc/1OiZsU4+n4lz4hpahGyWBURLi4642n1gn9qz9bIsaCeEPJ0uJmenMWp2tJmIwLQ6VSgDYErOeBCfSj9P4G/vI7oIF+l/n5fp956QgxGvur77ynawAu3G9MdFbJbu49NZnWnnFcQHjxRuhUYvg1U/e84N4JTecciDAKb/KYIFXzloyuE1eYXf54MmhjTq7B/yBToDzzpx3tJCTo3HCmVPYfmtBRe3mPYEE/6RlTIxbf4fSOcaKFGk4gbaUWe44hVk9SZzhW80yfW5QWBHxmtUzvMhfVQli4gZTktIOZd9mjJ5hsbmzttaHQB29Am3dZkmx3g/qvYocyhZ2PXAWsNQiIaf+Q8W/MWPIK7/TjvCx5q2XRp4lVWydMc2wIQkhadDB0xsnw/kSEyGjLKjI4coVIwtubTF3E7MJ6LS6UOsJKj82XVAVPJJcepfewbzE91ivXZvOvYfsmMevwtPpfMzGmC7WJlyW2j0jh7AF1JLmwEJSKYwIvu6DHc3YnyLH9ZdIBnQ+nOVDRiP+REpqv++typYHIvoJyICGA40d8bR7HR2k7do6UQTHF4oriYeIQbxKe4Th6+/l1BjUtS9hqORh3MbgvYrStXTfSwaBOmAVQZzpYNqsAmQyjY56MUqty3c/xH6GuhNvNaG9vGbG6cPtBM8UA3e8r51D0AR9kozKuGGSMgLz3nAHxDNnc7GTwpLj7/6HeWp1iksDeTjwCLpxejuMtpMnGJgsiku1sOACwQ9ukzESiDRN77YNESxR5LphOlcASXA5uIts1LnBIcn1J7BLWs49DMALSnuz95gdOrTZr0u1SeYHinno/pE58xYoXbVO/S+FEMMs5qyWkMnp8Q3ClyTlZP52Y9nq7b8fITPuVXUk9ohG5EFHw4gAEcjFxfKb3xuAsEjx2z1wxNbSZMcgS9GKyW3R6KwJONgtA64LTyxWm8Bvudp0M1FdJPEGopM4Fvg7G/hsptkhCfHFegv4ENwxPeXmYhxwZy7js+BeM27t9ODBMynVCLJ7RWcBMteZJtvjOYHb5lOnCLYWNEMKC59BA7covu1cANa2PXL05iGdufOzkgFqqHBOrgQVUmLEc+Mkz4Rq8O6WkNr7atNkH4M8d+SD1t/tSzt3oFql+neVs+AwEI5JaBJaxARtY2Z4mKoUqxds4UpZ0sv3zIbNoo0J4fihldQTX3XNcuNcZmcrB5LTWMdzeRuAtBk3cZHYQF6gTi3PNuDJ0nmR+4LPLoHvxQIxRgJ9iNNXqf2SYJhcvCtJiVWo85TsyFOuq7EyBPJrAdhEgE0cTq16FQXhYPJFqSfiVn0IQnPOy0LbU4BeG94QjdYNB0CiQ3QaxQqD2ebSMiNjaVaw8WaM4Z5WnzcVDsr4eGweSLa2DE3BWViaxhZFIcSTjgxNCAfelg+hznVOYoe5VqTYs1g7WtfTm3e4/WduC6p+qqAM8H4ZyrJCGpewThTDPe6H7CzX/zQ8Tm+r65HeZn+MsmxUciEWPlAVaK/VBaQBWfoG/aRL/jSZIQfep/89GjasWmbaWzeEZ2R1FOjvyJT37O9B8046SRSKVEnXWlBqbkb5XCS3qFeuE9xb9+frEknxWB5h1D/hruz2iVDEAS7+qkEz5Ot5agHJc7WCdY94Ws61sURcX5nG8UELGBAHZ3i+3VulAyT0nKNNz4K2LBHBWJcTBX1wzf+//u/j/9+//v87+9/l9Lbh/L/uyNYiTsWV2LwsjaA6MxTuzFMqmxW8Jw/+IppdX8t/Clgi1rI1SN0UC/r6tX/4lUc2VV1OQReSeCsjUpKZchw4XUcjHfw6ryCV3R8s6VXm67vp4n+lcPV9gJwmbKQEsmrJi9c2vkwrm8HFbVYNTaRGq8D91t9n5+U+aD/hNtN3HjC/nC/vUoGFSCkXP+NlRcmLUqLbiUBl4LYf1U/CCvwtd3ryCH8gUmGITAxiH1O5rnGTz7y1LuFjmnFGQ1UWuM7HwfXtWl2fPFKklYwNUpF2IL/TmaRETjQiM5SJacI+3Gv5MBU8lP5Io6gWkawpyzNEVGqOdx4YlO1dCvjbWFZWbCmeiFKPSlMKtKcMFLs/KQxtgAHi7NZNCQ32bBAW2mbHflVZ8wXKi1JKVHkW20bnYnl3dKWJeWJOiX3oKPBD6Zbi0ZvSIuWktUHB8qDR8DMMh1ZfkBL9FS9x5r0hBGLJ8pUCJv3NYH+Ae8p40mZWd5m5fhobFjQeQvqTT4VKWIYfRL0tfaXKiVl75hHReuTJEcqVlug+eOIIc4bdIydtn2K0iNZPsYWQvQio2qbO3OqAlPHDDOB7DfjGEfVF51FqqNacd6QmgFKJpMfLp5DHTv4wXlONKVXF9zTJpDV4m1sYZqJPhotcsliZM8yksKkCkzpiXt+EcRQvSQqmBS9WdWkxMTJXPSw94jqI3varCjQxTazjlMH8jTS8ilaW8014/vwA/LNa+YiFoyyx3s/KswP3O8QW1jtq45yTM/DX9a8M4voTVaO2ebvw1EooDw/yg6Y1faY+WwrdVs5Yt0hQ5EwRfYXSFxray1YvSM+kYmlpLG2/9mm1MfmbKHXr44Ih8nVKb1M537ZANUkCtdsPZ80JVKVKabVHCadaLXg+IV8i5GSwpZti0h6diTaKs9sdpUKEpd7jDUpYmHtiX33SKiO3tuydkaxA7pEc9XIQEOfWJlszj5YpL5bKeQyT7aZSBOamvSHl8xsWvgo26IP/bqk+0EJUz+gkkcvlUlyPp2kdKFtt7y5aCdks9ZJJcFp5ZWeaWKgtnXMN3ORwGLBE0PtkEIek5FY2aVssUZHtsWIvnljMVJtuVIjpZup/5VL1yPOHWWHkOMc6YySWMckczD5jUj2mlLVquFaMU8leGVaqeXis+aRRL8zm4WuBk6cyWfGMxgtr8useQEx7k/PvRoZyd9nde1GUCV84gMX8Ogu/BWezYPSR27llzQnA97oo0pYyxobYUJfsj+ysTm9zJ+S4pk0TGo9VTG0KjqYhTmALfoDZVKla2b5yhv241PxFaLJs3i05K0AAIdcGxCJZmT3ZdT7CliR7q+kur7WdQjygYtOWRL9B8E4s4LI8KpAj7bE0dg7DLOaX+MGeAi0hMMSSWZEz+RudXbZCsGYS0QqiXjH9XQbd8sCB+nIVTq7/T/FDS+zWY9q7Z2fdq1tdLb6v3hKKVDAw5gjj6o9r1wHFROdHc18MJp4SJ2Ucvu+iQ9EgkekW8VCM+psM6y+/2SBy8tNN4a3L1MzP+OLsyvESo5gS7IQOnIqMmviJBVc6zbVG1n8eXiA3j46kmvvtJlewwNDrxk4SbJOtP/TV/lIVK9ueShNbbMHfwnLTLLhbZuO79ec5XvfgRwLFK+w1r5ZWW15rVFZrE+wKqNRv5KqsLNfpGgnoUU6Y71NxEmN7MyqwqAQqoIULOw/LbuUB2+uE75gJt+kq1qY4LoxV+qR/zalupea3D5+WMeaRIn0sAI6DDWDh158fqUb4YhAxhREbUN0qyyJYkBU4V2KARXDT65gW3gRsiv7xSPYEKLwzgriWcWgPr0sbZnv7m1XHNFW6xPdGNZUdxFiUYlmXNjDVWuu7LCkX/nVkrXaJhiYktBISC2xgBXQnNEP+cptWl1eG62a7CPXrnrkTQ5BQASbEqUZWMDiZUisKyHDeLFOaJILUo5f6iDt4ZO8MlqaKLto0AmTHVVbkGuyPa1R/ywZsWRoRDoRdNMMHwYTsklMVnlAd2S0282bgMI8fiJpDh69OSL6K3qbo20KfpNMurnYGQSr/stFqZ7hYsxKlLnKAKhsmB8AIpEQ4bd/NrTLTXefsE6ChRmKWjXKVgpGoPs8GAicgKVw4K0qgDgy1A6hFq1WRat3fHF+FkU+b6H4NWpOU3KXTxrIb2qSHAb+qhm8hiSROi/9ofapjxhyKxxntPpge6KL5Z4+WBMYkAcE6+0Hd3Yh2zBsK2MV3iW0Y6cvOCroXlRb2MMJtdWx+3dkFzGh2Pe3DZ9QpSqpaR/rE1ImOrHqYYyccpiLC22amJIjRWVAherTfpQLmo6/K2pna85GrDuQPlH1Tsar8isAJbXLafSwOof4gg9RkAGm/oYpBQQiPUoyDk2BCQ1k+KILq48ErFo4WSRhHLq/y7mgw3+L85PpP6xWr6cgp9sOjYjKagOrxF148uhuaWtjet953fh1IQiEzgC+d2IgBCcUZqgTAICm2bR8oCjDLBsmg+ThyhfD+zBalsKBY1Ce54Y/t9cwfbLu9SFwEgphfopNA3yNxgyDafUM3mYTovZNgPGdd4ZFFOj1vtfFW3u7N+iHEN1HkeesDMXKPyoCDCGVMo4GCCD6PBhQ3dRZIHy0Y/3MaE5zU9mTCrwwnZojtE+qNpMSkJSpmGe0EzLyFelMJqhfFQ7a50uXxZ8pCc2wxtAKWgHoeamR2O7R+bq7IbPYItO0esdRgoTaY38hZLJ5y02oIVwoPokGIzxAMDuanQ1vn2WDQ00Rh6o5QOaCRu99fwDbQcN0XAuqkFpxT/cfz3slGRVokrNU0iqiMAJFEbKScZdmSkTUznC0U+MfwFOGdLgsewRyPKwBZYSmy6U325iUhBQNxbAC3FLKDV9VSOuQpOOukJ/GAmu/tyEbX9DgEp6dv1zoU0IqzpG6gssSjIYRVPGgU1QAQYRgIT8gEV0EXr1sqeh2I6rXjtmoCYyEDCe/PkFEi/Q48FuT29p557iN+LCwk5CK/CZ2WdAdfQZh2Z9QGrzPLSNRj5igUWzl9Vi0rCqH8G1Kp4QMLkuwMCAypdviDXyOIk0AHTM8HBYKh3b0/F+DxoNj4ZdoZfCpQVdnZarqoMaHWnMLNVcyevytGsrXQEoIbubqWYNo7NRHzdc0zvT21fWVirj7g36iy6pxogfvgHp1xH1Turbz8QyyHnXeBJicpYUctbzApwzZ1HT+FPEXMAgUZetgeGMwt4G+DHiDT2Lu+PT21fjJCAfV16a/Wu1PqOkUHSTKYhWW6PhhHUlNtWzFnA7MbY+r64vkwdpfNB2JfWgWXAvkzd42K4lN9x7Wrg4kIKgXCb4mcW595MCPJ/cTfPAMQMFWwnqwde4w8HZYJFpQwcSMhjVz4B8p6ncSCN1X4klxoIH4BN2J6taBMj6lHkAOs8JJAmXq5xsQtrPIPIIp/HG6i21xMGcFgqDXSRF0xQg14d2uy6HgKE13LSvQe52oShF5Jx1R6avyL4thhXQZHfC94oZzuPUBKFYf1VvDaxIrtV6dNGSx7DO0i1p6CzBkuAmEqyWceQY7F9+U0ObYDzoa1iKao/cOD/v6Q9gHrrr1uCeOk8fST9MG23Ul0KmM3r+Wn6Hi6WAcL7gEeaykicvgjzkjSwFsAXIR81Zx4QJ6oosVyJkCcT+4xAldCcihqvTf94HHUPXYp3REIaR4dhpQF6+FK1H0i9i7Pvh8owu3lO4PT1iuqu+DkL2Bj9+kdfGAg2TXw03iNHyobxofLE2ibjsYDPgeEQlRMR7afXbSGQcnPjI2D+sdtmuQ771dbASUsDndU7t58jrrNGRzISvwioAlHs5FA+cBE5Ccznkd8NMV6BR6ksnKLPZnMUawRDU1MZ/ib3xCdkTblHKu4blNiylH5n213yM0zubEie0o4JhzcfAy3H5qh2l17uLooBNLaO+gzonTH2uF8PQu9EyH+pjGsACTMy4cHzsPdymUSXYJOMP3yTkXqvO/lpvt0cX5ekDEu9PUfBeZODkFuAjXCaGdi6ew4qxJ8PmFfwmPpkgQjQlWqomFY6UkjmcnAtJG75EVR+NpzGpP1Ef5qUUbfowrC3zcSLX3BxgWEgEx/v9cP8H8u1Mvt9/rMDYf6sjwU1xSOPBgzFEeJLMRVFtKo5QHsUYT8ZRLCah27599EuqoC9PYjYO6aoAMHB8X1OHwEAYouHfHB3nyb2B+SnZxM/vw/bCtORjLMSy5aZoEpvgdGvlJfNPFUu/p7Z4VVK1hiI0/UTuB3ZPq4ohEbm7Mntgc1evEtknaosgZSwnDC2BdMmibpeg48X8Ixl+/8+xXdbshQXUPPvx8jT3fkELivHSmqbhblfNFShWAyQnJ3WBU6SMYSIpTDmHjdLVAdlADdz9gCplZw6mTiHqDwIsxbm9ErGusiVpg2w8Q3khKV/R9Oj8PFeF43hmW/nSd99nZzhyjCX3QOZkkB6BsH4H866WGyv9E0hVAzPYah2tkRfQZMmP2rinfOeQalge0ovhduBjJs9a1GBwReerceify49ctOh5/65ATYuMsAkVltmvTLBk4oHpdl6i+p8DoNj4Fb2vhdFYer2JSEilEwPd5n5zNoGBXEjreg/wh2NFnNRaIUHSOXa4eJRwygZoX6vnWnqVdCRT1ARxeFrNBJ+tsdooMwqnYhE7zIxnD8pZH+P0Nu1wWxCPTADfNWmqx626IBJJq6NeapcGeOmbtXvl0TeWG0Y7OGGV4+EHTtNBIT5Wd0Bujl7inXgZgfXTM5efD3qDTJ54O9v3Bkv+tdIRlq1kXcVD0BEMirmFxglNPt5pedb1AnxuCYMChUykwsTIWqT23XDpvTiKEru1cTcEMeniB+HQDehxPXNmkotFdwUPnilB/u4Nx5Xc6l8J9jH1EgKZUUt8t8cyoZleDBEt8oibDmJRAoMKJ5Oe9CSWS5ZMEJvacsGVdXDWjp/Ype5x0p9PXB2PAwt2LRD3d+ftNgpuyvxlP8pB84oB1i73vAVpwyrmXW72hfW6Dzn9Jkj4++0VQ4d0KSx1AsDA4OtXXDo63/w+GD+zC7w5SJaxsmnlYRQ4dgdjA7tTl2KNLnpJ+mvkoDxtt1a4oPaX3EVqj96o9sRKBQqU7ZOiupeAIyLMD+Y3YwHx30XWHB5CQiw7q3mj1EDlP2eBsZbz79ayUMbyHQ7s8gu4Lgip1LiGJj7NQj905/+rgUYKAA5qdrlHKIknWmqfuR+PB8RdBkDg/NgnlT89G72h2NvySnj7UyBwD+mi/IWs1xWbxuVwUIVXun5cMqBtFbrccI+DILjsVQg6eeq0itiRfedn89CvyFtpkxaauEvSANuZmB1p8FGPbU94J9medwsZ9HkUYjmI7OH5HuxendLbxTaYrPuIfE2ffXFKhoNBUp33HsFAXmCV/Vxpq5AYgFoRr5Ay93ZLRlgaIPjhZjXZZChT+aE5iWAXMX0oSFQEtwjiuhQQItTQX5IYrKfKB+queTNplR1Hoflo5/I6aPPmACwQCE2jTOYo5Dz1cs7Sod0KTG/3kEDGk3kUaUCON19xSJCab3kNpWZhSWkO8l+SpW70Wn3g0ciOIJO5JXma6dbos6jyisuxXwUUhj2+1uGhcvuliKtWwsUTw4gi1c/diEEpZHoKoxTBeMDmhPhKTx7TXWRakV8imJR355DcIHkR9IREHxohP4TbyR5LtFU24umRPRmEYHbpe1LghyxPx7YgUHjNbbQFRQhh4KeU1EabXx8FS3JAxp2rwRDoeWkJgWRUSKw6gGP5U2PuO9V4ZuiKXGGzFQuRuf+tkSSsbBtRJKhCi3ENuLlXhPbjTKD4djXVnfXFds6Zb+1XiUrRfyayGxJq1+SYBEfbKlgjiSmk0orgTqzSS+DZ5rTqsJbttiNtp+KMqGE2AHGFw6jQqM5vD6vMptmXV9OAjq49Uf/Lx9Opam+Hn5O9p8qoBBAQixzQZ4eNVkO9sPzJAMyR1y4/RCQQ1s0pV5KAU5sKLw3tkcFbI/JqrjCsK4Mw+W8aod4lioYuawUiCyVWBE/qPaFi5bnkgpfu/ae47174rI1fqQoTbW0HrU6FAejq7ByM0V4zkZTg02/YJK2N7hUQRCeZ4BIgSEqgD8XsjzG6LIsSbuHoIdz/LhFzbNn1clci1NHWJ0/6/O8HJMdIpEZbqi1RrrFfoo/rI/7ufm2MPG5lUI0IYJ4MAiHRTSOFJ2oTverFHYXThkYFIoyFx6rMYFgaOKM4xNWdlOnIcKb/suptptgTOTdVIf4YgdaAjJnIAm4qNNHNQqqAzvi53GkyRCEoseUBrHohZsjUbkR8gfKtc/+Oa72lwxJ8Mq6HDfDATbfbJhzeIuFQJSiw1uZprHlzUf90WgqG76zO0eCB1WdPv1IT6sNxxh91GEL2YpgC97ikFHyoaH92ndwduqZ6IYjkg20DX33MWdoZk7QkcKUCgisIYslOaaLyvIIqRKWQj16jE1DlQWJJaPopWTJjXfixEjRJJo8g4++wuQjbq+WVYjsqCuNIQW3YjnxKe2M5ZKEqq+cX7ZVgnkbsU3RWIyXA1rxv4kGersYJjD//auldXGmcEbcfTeF16Y1708FB1HIfmWv6dSFi6oD4E+RIjCsEZ+kY7dKnwReJJw3xCjKvi3kGN42rvyhUlIz0Bp+fNSV5xwFiuBzG296e5s/oHoFtUyUplmPulIPl+e1CQIQVtjlzLzzzbV+D/OVQtYzo5ixtMi5BmHuG4N/uKfJk5UIREp7+12oZlKtPBomXSzAY0KgtbPzzZoHQxujnREUgBU+O/jKKhgxVhRPtbqyHiUaRwRpHv7pgRPyUrnE7fYkVblGmfTY28tFCvlILC04Tz3ivkNWVazA+OsYrxvRM/hiNn8Fc4bQBeUZABGx5S/xFf9Lbbmk298X7iFg2yeimvsQqqJ+hYbt6uq+Zf9jC+Jcwiccd61NKQtFvGWrgJiHB5lwi6fR8KzYS7EaEHf/ka9EC7H8D+WEa3TEACHBkNSj/cXxFeq4RllC+fUFm2xtstYLL2nos1DfzsC9vqDDdRVcPA3Ho95aEQHvExVThXPqym65llkKlfRXbPTRiDepdylHjmV9YTWAEjlD9DdQnCem7Aj/ml58On366392214B5zrmQz/9ySG2mFqEwjq5sFl5tYJPw5hNz8lyZPUTsr5E0F2C9VMPnZckWP7+mbwp/BiN7f4kf7vtGnZF2JGvjK/sDX1RtcFY5oPQnE4lIAYV49U3C9SP0LCY/9i/WIFK9ORjzM9kG/KGrAuwFmgdEpdLaiqQNpCTGZVuAO65afkY1h33hrqyLjZy92JK3/twdj9pafFcwfXONmPQWldPlMe7jlP24Js0v9m8bIJ9TgS2IuRvE9ZVRaCwSJYOtAfL5H/YS4FfzKWKbek+GFulheyKtDNlBtrdmr+KU+ibHTdalzFUmMfxw3f36x+3cQbJLItSilW9cuvZEMjKw987jykZRlsH/UI+HlKfo2tLwemBEeBFtmxF2xmItA/dAIfQ+rXnm88dqvXa+GapOYVt/2waFimXFx3TC2MUiOi5/Ml+3rj/YU6Ihx2hXgiDXFsUeQkRAD6wF3SCPi2flk7XwKAA4zboqynuELD312EJ88lmDEVOMa1W/K/a8tGylZRMrMoILyoMQzzbDJHNZrhH77L9qSC42HVmKiZ5S0016UTp83gOhCwz9XItK9fgXfK3F5d7nZCBUekoLxrutQaPHa16Rjsa0gTrzyjqTnmcIcrxg6X6dkKiucudc0DD5W4pJPf0vuDW8r5/uw24YfMuxFRpD2ovT2mFX79xH6Jf+MVdv2TYqR6/955QgVPe3JCD/WjAYcLA9tpXgFiEjge2J5ljeI/iUzg91KQuHkII4mmHZxC3XQORLAC6G7uFn5LOmlnXkjFdoO976moNTxElS8HdxWoPAkjjocDR136m2l+f5t6xaaNgdodOvTu0rievnhNAB79WNrVs6EsPgkgfahF9gSFzzAd+rJSraw5Mllit7vUP5YxA843lUpu6/5jAR0RvH4rRXkSg3nE+O5GFyfe+L0s5r3k05FyghSFnKo4TTgs07qj4nTLqOYj6qaW9knJTDkF5OFMYbmCP+8H16Ty482OjvERV6OFyw043L9w3hoJi408sR+SGo1WviXUu8d7qS+ehKjpKwxeCthsm2LBFSFeetx0x4AaKPxtp3CxdWqCsLrB1s/j5TAhc1jNZsXWl6tjo/WDoewxzg8T8NnhZ1niUwL/nhfygLanCnRwaFGDyLw+sfZhyZ1UtYTp8TYB6dE7R3VsKKH95CUxJ8u8N+9u2/9HUNKHW3x3w5GQrfOPafk2w5qZq8MaHT0ebeY3wIsp3rN9lrpIsW9c1ws3VNV+JwNz0Lo9+V7zZr6GD56We6gWVIvtmam5GPPkVAbr74r6SwhuL+TRXtW/0pgyX16VNl4/EAD50TnUPuwrW6OcUO2VlWXS0inq872kk7GUlW6o/ozFKq+Sip6LcTtSDfDrPTcCHhx75H8BeRon+KG2wRwzfDgWhALmiWOMO6h3pm1UCZEPEjScyk7tdLx6WrdA2N1QTPENvNnhCQjW6kl057/qv7IwRryHrZBCwVSbLLnFRiHdTwk8mlYixFt1slEcPD7FVht13HyqVeyD55HOXrh2ElAxJyinGeoFzwKA91zfrdLvDxJSjzmImfvTisreI25EDcVfGsmxLVbfU8PGe/7NmWWKjXcdTJ11jAlVIY/Bv/mcxg/Q10vCHwKG1GW/XbJq5nxDhyLqiorn7Wd7VEVL8UgVzpHMjQ+Z8DUgSukiVwWAKkeTlVVeZ7t1DGnCgJVIdBPZAEK5f8CDyDNo7tK4/5DBjdD5MPV86TaEhGsLVFPQSI68KlBYy84FievdU9gWh6XZrugvtCZmi9vfd6db6V7FmoEcRHnG36VZH8N4aZaldq9zZawt1uBFgxYYx+Gs/qW1jwANeFy+LCoymyM6zgG7j8bGzUyLhvrbJkTYAEdICEb4kMKusKT9V3eIwMLsjdUdgijMc+7iKrr+TxrVWG0U+W95SGrxnxGrE4eaJFfgvAjUM4SAy8UaRwE9j6ZQH5qYAWGtXByvDiLSDfOD0yFA3UCMKSyQ30fyy1mIRg4ZcgZHLNHWl+c9SeijOvbOJxoQy7lTN2r3Y8p6ovxvUY74aOYbuVezryqXA6U+fcp6wSV9X5/OZKP18tB56Ua0gMyxJI7XyNT7IrqN8GsB9rL/kP5KMrjXxgqKLDa+V5OCH6a5hmOWemMUsea9vQl9t5Oce76PrTyTv50ExOqngE3PHPfSL//AItPdB7kGnyTRhVUUFNdJJ2z7RtktZwgmQzhBG/G7QsjZmJfCE7k75EmdIKH7xlnmDrNM/XbTT6FzldcH/rcRGxlPrv4qDScqE7JSmQABJWqRT/TUcJSwoQM+1jvDigvrjjH8oeK2in1S+/yO1j8xAws/T5u0VnIvAPqaE1atNuN0cuRliLcH2j0nTL4JpcR7w9Qya0JoaHgsOiALLCCzRkl1UUESz+ze/gIXHGtDwgYrK6pCFKJ1webSDog4zTlPkgXZqxlQDiYMjhDpwTtBW2WxthWbov9dt2X9XFLFmcF+eEc1UaQ74gqZiZsdj63pH1qcv3Vy8JYciogIVKsJ8Yy3J9w/GhjWVSQAmrS0BPOWK+RKV+0lWqXgYMnIFwpcZVD7zPSp547i9HlflB8gVnSTGmmq1ClO081OW/UH11pEQMfkEdDFzjLC1Cdo/BdL3s7cXb8J++Hzz1rhOUVZFIPehRiZ8VYu6+7Er7j5PSZu9g/GBdmNzJmyCD9wiswj9BZw+T3iBrg81re36ihMLjoVLoWc+62a1U/7qVX5CpvTVF7rocSAKwv4cBVqZm7lLDS/qoXs4fMs/VQi6BtVbNA3uSzKpQfjH1o3x4LrvkOn40zhm6hjduDglzJUwA0POabgdXIndp9fzhOo23Pe+Rk9GSLX0d71Poqry8NQDTzNlsa+JTNG9+UrEf+ngxCjGEsDCc0bz+udVRyHQI1jmEO3S+IOQycEq7XwB6z3wfMfa73m8PVRp+iOgtZfeSBl01xn03vMaQJkyj7vnhGCklsCWVRUl4y+5oNUzQ63B2dbjDF3vikd/3RUMifPYnX5Glfuk2FsV/7RqjI9yKTbE8wJY+74p7qXO8+dIYgjtLD/N8TJtRh04N9tXJA4H59IkMmLElgvr0Q5OCeVfdAt+5hkh4pQgfRMHpL74XatLQpPiOyHRs/OdmHtBf8nOZcxVKzdGclIN16lE7kJ+pVMjspOI+5+TqLRO6m0ZpNXJoZRv9MPDRcAfJUtNZHyig/s2wwReakFgPPJwCQmu1I30/tcBbji+Na53i1W1N+BqoY7Zxo+U/M9XyJ4Ok2SSkBtoOrwuhAY3a03Eu6l8wFdIG1cN+e8hopTkiKF093KuH/BcB39rMiGDLn6XVhGKEaaT/vqb/lufuAdpGExevF1+J9itkFhCfymWr9vGb3BTK4j598zRH7+e+MU9maruZqb0pkGxRDRE1CD4Z8LV4vhgPidk5w2Bq816g3nHw1//j3JStz7NR9HIWELO8TMn3QrP/zZp//+Dv9p429/ogv+GATR+n/UdF+ns9xNkXZQJXY4t9jMkJNUFygAtzndXwjss+yWH9HAnLQQfhAskdZS2l01HLWv7L7us5uTH409pqitvfSOQg/c+Zt7k879P3K9+WV68n7+3cZfuRd/dDPP/03rn+d+/nBvWfgDlt8+LzjqJ/vx3CnNOwiXhho778C96iD+1TBvRZYeP+EH81LE0vVwOOrmCLB3iKzI1x+vJEsrPH4uF0UB4TJ4X3uDfOCo3PYpYe0MF4bouh0DQ/l43fxUF7Y+dpWuvTSffB0yO2UQUETI/LwCZE3BvnevJ7c9zUlY3H58xzke6DNFDQG8n0WtDN4LAYN4nogKav1ezOfK/z+t6tsCTp+dhx4ymjWuCJk1dEUifDP+HyS4iP/Vg9B2jTo9L4NbiBuDS4nuuHW6H+JDQn2JtqRKGkEQPEYE7uzazXIkcxIAqUq1esasZBETlEZY7y7Jo+RoV/IsjY9eIMkUvr42Hc0xqtsavZvhz1OLwSxMOTuqzlhb0WbdOwBH9EYiyBjatz40bUxTHbiWxqJ0uma19qhPruvcWJlbiSSH48OLDDpaHPszvyct41ZfTu10+vjox6kOqK6v0K/gEPphEvMl/vwSv+A4Hhm36JSP9IXTyCZDm4kKsqD5ay8b1Sad/vaiyO5N/sDfEV6Z4q95E+yfjxpqBoBETW2C7xl4pIO2bDODDFurUPwE7EWC2Uplq+AHmBHvir2PSgkR12/Ry65O0aZtQPeXi9mTlF/Wj5GQ+vFkYyhXsLTjrBSP9hwk4GPqDP5rBn5/l8b0mLRAvRSzXHc293bs3s8EsdE3m2exxidWVB4joHR+S+dz5/W+v00K3TqN14CDBth8eWcsTbiwXPsygHdGid0PEdy6HHm2v/IUuV5RVapYmzGsX90mpnIdNGcOOq64Dbc5GUbYpD9M7S+6cLY//QmjxFLP5cuTFRm3vA5rkFZroFnO3bjHF35uU3s8mvL7Tp9nyTc4mymTJ5sLIp7umSnGkO23faehtz3mmTS7fbVx5rP7x3HXIjRNeq/A3xCs9JNB08c9S9BF2O3bOur0ItslFxXgRPdaapBIi4dRpKGxVz7ir69t/bc9qTxjvtOyGOfiLGDhR4fYywHv1WdOplxIV87TpLBy3Wc0QP0P9s4G7FBNOdITS/tep3o3h1TEa5XDDii7fWtqRzUEReP2fbxz7bHWWJdbIOxOUJZtItNZpTFRfj6vm9sYjRxQVO+WTdiOhdPeTJ+8YirPvoeL88l5iLYOHd3b/Imkq+1ZN1El3UikhftuteEYxf1Wujof8Pr4ICTu5ezZyZ4tHQMxlzUHLYO2VMOoNMGL/20S5i2o2obfk+8qqdR7xzbRDbgU0lnuIgz4LelQ5XS7xbLuSQtNS95v3ZUOdaUx/Qd8qxCt6xf2E62yb/HukLO6RyorV8KgYl5YNc75y+KvefrxY+lc/64y9kvWP0a0bDz/rojq+RWjO06WeruWqNFU7r3HPIcLWRql8ICZsz2Ls/qOm/CLn6++X+Qf7mGspYCrZod/lpl6Rw4xN/yuq8gqV4B6aHk1hVE1SfILxWu5gvXqbfARYQpspcxKp1F/c8XOPzkZvmoSw+vEqBLdrq1fr3wAPv5NnM9i8F+jdAuxkP5Z71c6uhK3enlnGymr7UsWZKC12qgUiG8XXGQ9mxnqz4GSIlybF9eXmbqj2sHX+a1jf0gRoONHRdRSrIq03Ty89eQ1GbV/Bk+du4+V15zls+vvERvZ4E7ZbnxWTVjDjb4o/k8jlw44pTIrUGxxuJvBeO+heuhOjpFsO6lVJ/aXnJDa/bM0Ql1cLbXE/Pbv3EZ3vj3iVrB5irjupZTzlnv677NrI9UNYNqbPgp/HZXS+lJmk87wec+7YOxTDo2aw2l3NfDr34VNlvqWJBknuK7oSlZ6/T10zuOoPZOeoIk81N+sL843WJ2Q4Z0fZ3scsqC/JV2fuhWi1jGURSKZV637lf53Xnnx16/vKEXY89aVJ0fv91jGdfG+G4+sniwHes4hS+udOr4RfhFhG/F5gUG35QaU+McuLmclb5ZWmR+sG5V6nf+PxYzlrnFGxpZaK8eqqVo0NfmAWoGfXDiT/FnUbWvzGDOTr8aktOZWg4BYvz5YH12ZbfCcGtNk+dDAZNGWvHov+PIOnY9Prjg8h/wLRrT69suaMVZ5bNuK00lSVpnqSX1NON/81FoP92rYndionwgOiA8WMf4vc8l15KqEEG4yAm2+WAN5Brfu1sq9suWYqgoajgOYt/JCk1gC8wPkK+XKCtRX6TAtgvrnuBgNRmn6I8lVDipOVB9kX6Oxkp4ZKyd1M6Gj8/v2U7k+YQBL95Kb9PQENucJb0JlW3b5tObN7m/Z1j1ev388d7o15zgXsI9CikAGAViR6lkJv7nb4Ak40M2G8TJ447kN+pvfHiOFjSUSP6PM+QfbAywKJCBaxSVxpizHseZUyUBhq59vFwrkyGoRiHbo0apweEZeSLuNiQ+HAekOnarFg00dZNXaPeoHPTRR0FmEyqYExOVaaaO8c0uFUh7U4e/UxdBmthlBDgg257Q33j1hA7HTxSeTTSuVnPZbgW1nodwmG16aKBDKxEetv7D9OjO0JhrbJTnoe+kcGoDJazFSO8/fUN9Jy/g4XK5PUkw2dgPDGpJqBfhe7GA+cjzfE/EGsMM+FV9nj9IAhrSfT/J3QE5TEIYyk5UjsI6ZZcCPr6A8FZUF4g9nnpVmjX90MLSQysIPD0nFzqwCcSJmIb5mYv2Cmk+C1MDFkZQyCBq4c/Yai9LJ6xYkGS/x2s5/frIW2vmG2Wrv0APpCdgCA9snFvfpe8uc0OwdRs4G9973PGEBnQB5qKrCQ6m6X/H7NInZ7y/1674/ZXOVp7OeuCRk8JFS516VHrnH1HkIUIlTIljjHaQtEtkJtosYul77cVwjk3gW1Ajaa6zWeyHGLlpk3VHE2VFzT2yI/EvlGUSz2H9zYE1s4nsKMtMqNyKNtL/59CpFJki5Fou6VXGm8vWATEPwrUVOLvoA8jLuwOzVBCgHB2Cr5V6OwEWtJEKokJkfc87h+sNHTvMb0KVTp5284QTPupoWvQVUwUeogZR3kBMESYo0mfukewRVPKh5+rzLQb7HKjFFIgWhj1w3yN/qCNoPI8XFiUgBNT1hCHBsAz8L7Oyt8wQWUFj92ONn/APyJFg8hzueqoJdNj57ROrFbffuS/XxrSXLTRgj5uxZjpgQYceeMc2wJrahReSKpm3QjHfqExTLAB2ipVumE8pqcZv8LYXQiPHHsgb5BMW8zM5pvQit+mQx8XGaVDcfVbLyMTlY8xcfmm/RSAT/H09UQol5gIz7rESDmnrQ4bURIB4iRXMDQwxgex1GgtDxKp2HayIkR+E/aDmCttNm2C6lytWdfOVzD6X2SpDWjQDlMRvAp1symWv4my1bPCD+E1EmGnMGWhNwmycJnDV2WrQNxO45ukEb08AAffizYKVULp15I4vbNK5DzWwCSUADfmKhfGSUqii1L2UsE8rB7mLuHuUJZOx4+WiizHBJ/hwboaBzhpNOVvgFTf5cJsHef7L1HCI9dOUUbb+YxUJWn6dYOLz+THi91kzY5dtO5c+grX7v0jEbsuoOGnoIreDIg/sFMyG+TyCLIcAWd1IZ1UNFxE8Uie13ucm40U2fcxC0u3WLvLOxwu+F7MWUsHsdtFQZ7W+nlfCASiAKyh8rnP3EyDByvtJb6Kax6/HkLzT9SyEyTMVM1zPtM0MJY14DmsWh4MgD15Ea9Hd00AdkTZ0EiG5NAGuIBzQJJ0JR0na+OB7lQA6UKxMfihIQ7GCCnVz694QvykWXTxpS2soDu+smru1UdIxSvAszBFD1c8c6ZOobA8bJiJIvuycgIXBQIXWwhyTgZDQxJTRXgEwRNAawGSXO0a1DKjdihLVNp/taE/xYhsgwe+VpKEEB4LlraQyE84gEihxCnbfoyOuJIEXy2FIYw+JjRusybKlU2g/vhTSGTydvCvXhYBdtAXtS2v7LkHtmXh/8fly1do8FI/D0f8UbzVb5h+KRhMGSAmR2mhi0YG/uj7wgxcfzCrMvdjitUIpXDX8ae2JcF/36qUWIMwN6JsjaRGNj+jEteGDcFyTUb8X/NHSucKMJp7pduxtD6KuxVlyxxwaeiC1FbGBESO84lbyrAugYxdl+2N8/6AgWpo/IeoAOcsG35IA/b3AuSyoa55L7llBLlaWlEWvuCFd8f8NfcTUgzJv6CbB+6ohWwodlk9nGWFpBAOaz5uEW5xBvmjnHFeDsb0mXwayj3mdYq5gxxNf3H3/tnCgHwjSrpSgVxLmiTtuszdRUFIsn6LiMPjL808vL1uQhDbM7aA43mISXReqjSskynIRcHCJ9qeFopJfx9tqyUoGbSwJex/0aDE3plBPGtNBYgWbdLom3+Q/bjdizR2/AS/c/dH/d3G7pyl1qDXgtOFtEqidwLqxPYtrNEveasWq3vPUUtqTeu8gpov4bdOQRI2kneFvRNMrShyVeEupK1PoLDPMSfWMIJcs267mGB8X9CehQCF0gIyhpP10mbyM7lwW1e6TGvHBV1sg/UyTghHPGRqMyaebC6pbB1WKNCQtlai1GGvmq9zUKaUzLaXsXEBYtHxmFbEZ2kJhR164LhWW2Tlp1dhsGE7ZgIWRBOx3Zcu2DxgH+G83WTPceKG0TgQKKiiNNOlWgvqNEbnrk6fVD+AqRam2OguZb0YWSTX88N+i/ELSxbaUUpPx4vJUzYg/WonSeA8xUK6u7DPHgpqWpEe6D4cXg5uK9FIYVba47V/nb+wyOtk+zG8RrS4EA0ouwa04iByRLSvoJA2FzaobbZtXnq8GdbfqEp5I2dpfpj59TCVif6+E75p665faiX8gS213RqBxTZqfHP46nF6NSenOneuT+vgbLUbdTH2/t0REFXZJOEB6DHvx6N6g9956CYrY/AYcm9gELJXYkrSi+0F0geKDZgOCIYkLU/+GOW5aGj8mvLFgtFH5+XC8hvAE3CvHRfl4ofM/Qwk4x2A+R+nyc9gNu/9Tem7XW4XRnyRymf52z09cTOdr+PG6+P/Vb4QiXlwauc5WB1z3o+IJjlbxI8MyWtSzT+k4sKVbhF3xa+vDts3NxXa87iiu+xRH9cAprnOL2h6vV54iQRXuOAj1s8nLFK8gZ70ThIQcWdF19/2xaJmT0efrkNDkWbpAQPdo92Z8+Hn/aLjbOzB9AI/k12fPs9HhUNDJ1u6ax2VxD3R6PywN7BrLJ26z6s3QoMp76qzzwetrDABKSGkfW5PwS1GvYNUbK6uRqxfyVGNyFB0E+OugMM8kKwmJmupuRWO8XkXXXQECyRVw9UyIrtCtcc4oNqXqr7AURBmKn6Khz3eBN96LwIJrAGP9mr/59uTOSx631suyT+QujDd4beUFpZ0kJEEnjlP+X/Kr2kCKhnENTg4BsMTOmMqlj2WMFLRUlVG0fzdCBgUta9odrJfpVdFomTi6ak0tFjXTcdqqvWBAzjY6hVrH9sbt3Z9gn+AVDpTcQImefbB4edirjzrsNievve4ZT4EUZWV3TxEsIW+9MT/RJoKfZZYSRGfC1CwPG/9rdMOM8qR/LUYvw5f/emUSoD7YSFuOoqchdUg2UePd1eCtFSKgxLSZ764oy4lvRCIH6bowPxZWwxNFctksLeil47pfevcBipkkBIc4ngZG+kxGZ71a72KQ7VaZ6MZOZkQJZXM6kb/Ac0/XkJx8dvyfJcWbI3zONEaEPIW8GbkYjsZcwy+eMoKrYjDmvEEixHzkCSCRPRzhOfJZuLdcbx19EL23MA8rnjTZZ787FGMnkqnpuzB5/90w1gtUSRaWcb0eta8198VEeZMUSfIhyuc4/nywFQ9uqn7jdqXh+5wwv+RK9XouNPbYdoEelNGo34KyySwigsrfCe0v/PlWPvQvQg8R0KgHO18mTVThhQrlbEQ0Kp/JxPdjHyR7E1QPw/ut0r+HDDG7BwZFm9IqEUZRpv2WpzlMkOemeLcAt5CsrzskLGaVOAxyySzZV/D2EY7ydNZMf8e8VhHcKGHAWNszf1EOq8fNstijMY4JXyATwTdncFFqcNDfDo+mWFvxJJpc4sEZtjXyBdoFcxbUmniCoKq5jydUHNjYJxMqN1KzYV62MugcELVhS3Bnd+TLLOh7dws/zSXWzxEb4Nj4aFun5x4kDWLK5TUF/yCXB/cZYvI9kPgVsG2jShtXkxfgT+xzjJofXqPEnIXIQ1lnIdmVzBOM90EXvJUW6a0nZ/7XjJGl8ToO3H/fdxnxmTNKBZxnkpXLVgLXCZywGT3YyS75w/PAH5I/jMuRspej8xZObU9kREbRA+kqjmKRFaKGWAmFQspC+QLbKPf0RaK3OXvBSWqo46p70ws/eZpu6jCtZUgQy6r4tHMPUdAgWGGUYNbuv/1a6K+MVFsd3T183+T8capSo6m0+Sh57fEeG/95dykGJBQMj09DSW2bY0mUonDy9a8trLnnL5B5LW3Nl8rJZNysO8Zb+80zXxqUGFpud3Qzwb7bf+8mq6x0TAnJU9pDQR9YQmZhlna2xuxJt0aCO/f1SU8gblOrbIyMsxTlVUW69VJPzYU2HlRXcqE2lLLxnObZuz2tT9CivfTAUYfmzJlt/lOPgsR6VN64/xQd4Jlk/RV7UKVv2Gx/AWsmTAuCWKhdwC+4HmKEKYZh2Xis4KsUR1BeObs1c13wqFRnocdmuheaTV30gvVXZcouzHKK5zwrN52jXJEuX6dGx3BCpV/++4f3hyaW/cQJLFKqasjsMuO3B3WlMq2gyYfdK1e7L2pO/tRye2mwzwZPfdUMrl5wdLqdd2Kv/wVtnpyWYhd49L6rsOV+8HXPrWH2Kup89l2tz6bf80iYSd+V4LROSOHeamvexR524q4r43rTmtFzQvArpvWfLYFZrbFspBsXNUqqenjxNNsFXatZvlIhk7teUPfK+YL32F8McTnjv0BZNppb+vshoCrtLXjIWq3EJXpVXIlG6ZNL0dh6qEm2WMwDjD3LfOfkGh1/czYc/0qhiD2ozNnH4882MVVt3JbVFkbwowNCO3KL5IoYW5wlVeGCViOuv1svZx7FbzxKzA4zGqBlRRaRWCobXaVq4yYCWbZf8eiJwt3OY+MFiSJengcFP2t0JMfzOiJ7cECvpx7neg1Rc5x+7myPJOXt2FohVRyXtD+/rDoTOyGYInJelZMjolecVHUhUNqvdZWg2J2t0jPmiLFeRD/8fOT4o+NGILb+TufCo9ceBBm3JLVn+MO2675n7qiEX/6W+188cYg3Zn5NSTjgOKfWFSAANa6raCxSoVU851oJLY11WIoYK0du0ec5E4tCnAPoKh71riTsjVIp3gKvBbEYQiNYrmH22oLQWA2AdwMnID6PX9b58dR2QKo4qag1D1Z+L/FwEKTR7osOZPWECPJIHQqPUsM5i/CH5YupVPfFA5pHUBcsesh8eO5YhyWnaVRPZn/BmdXVumZWPxMP5e28zm2uqHgFoT9CymHYNNrzrrjlXZM06HnzDxYNlI5b/QosxLmmrqDFqmogQdqk0WLkUceoAvQxHgkIyvWU69BPFr24VB6+lx75Rna6dGtrmOxDnvBojvi1/4dHjVeg8owofPe1cOnxU1ioh016s/Vudv9mhV9f35At+Sh28h1bpp8xhr09+vf47Elx3Ms6hyp6QvB3t0vnLbOhwo660cp7K0vvepabK7YJfxEWWfrC2YzJfYOjygPwfwd/1amTqa0hZ5ueebhWYVMubRTwIjj+0Oq0ohU3zfRfuL8gt59XsHdwKtxTQQ4Y2qz6gisxnm2UdlmpEkgOsZz7iEk6QOt8BuPwr+NR01LTqXmJo1C76o1N274twJvl+I069TiLpenK/miRxhyY8jvYV6W1WuSwhH9q7kuwnJMtm7IWcqs7HsnyHSqWXLSpYtZGaR1V3t0gauninFPZGtWskF65rtti48UV9uV9KM8kfDYs0pgB00S+TlzTXV6P8mxq15b9En8sz3jWSszcifZa/NuufPNnNTb031pptt0+sRSH/7UG8pzbsgtt3OG3ut7B9JzDMt2mTZuyRNIV8D54TuTrpNcHtgmMlYJeiY9XS83NYJicjRjtJSf9BZLsQv629QdDsKQhTK5CnXhpk7vMNkHzPhm0ExW/VCGApHfPyBagtZQTQmPHx7g5IXXsrQDPzIVhv2LB6Ih138iSDww1JNHrDvzUxvp73MsQBVhW8EbrReaVUcLB1R3PUXyaYG4HpJUcLVxMgDxcPkVRQpL7VTAGabDzbKcvg12t5P8TSGQkrj/gOrpnbiDHwluA73xbXts/L7u468cRWSWRtgTwlQnA47EKg0OiZDgFxAKQQUcsbGomITgeXUAAyKe03eA7Mp4gnyKQmm0LXJtEk6ddksMJCuxDmmHzmVhO+XaN2A54MIh3niw5CF7PwiXFZrnA8wOdeHLvvhdoqIDG9PDI7UnWWHq526T8y6ixJPhkuVKZnoUruOpUgOOp3iIKBjk+yi1vHo5cItHXb1PIKzGaZlRS0g5d3MV2pD8FQdGYLZ73aae/eEIUePMc4NFz8pIUfLCrrF4jVWH5gQneN3S8vANBmUXrEcKGn6hIUN95y1vpsvLwbGpzV9L0ZKTan6TDXM05236uLJcIEMKVAxKNT0K8WljuwNny3BNQRfzovA85beI9zr1AGNYnYCVkR1aGngWURUrgqR+gRrQhxW81l3CHevjvGEPzPMTxdsIfB9dfGRbZU0cg/1mcubtECX4tvaedmNAvTxCJtc2QaoUalGfENCGK7IS/O8CRpdOVca8EWCRwv2sSWE8CJPW5PCugjCXPd3h6U60cPD+bdhtXZuYB6stcoveE7Sm5MM2yvfUHXFSW7KzLmi7/EeEWL0wqcOH9MOSKjhCHHmw+JGLcYE/7SBZQCRggox0ZZTAxrlzNNXYXL5fNIjkdT4YMqVUz6p8YDt049v4OXGdg3qTrtLBUXOZf7ahPlZAY/O+7Sp0bvGSHdyQ8B1LOsplqMb9Se8VAE7gIdSZvxbRSrfl+Lk5Qaqi5QJceqjitdErcHXg/3MryljPSIAMaaloFm1cVwBJ8DNmkDqoGROSHFetrgjQ5CahuKkdH5pRPigMrgTtlFI8ufJPJSUlGgTjbBSvpRc0zypiUn6U5KZqcRoyrtzhmJ7/caeZkmVRwJQeLOG8LY6vP5ChpKhc8Js0El+n6FXqbx9ItdtLtYP92kKfaTLtCi8StLZdENJa9Ex1nOoz1kQ7qxoiZFKRyLf4O4CHRT0T/0W9F8epNKVoeyxUXhy3sQMMsJjQJEyMOjmOhMFgOmmlscV4eFi1CldU92yjwleirEKPW3bPAuEhRZV7JsKV3Lr5cETAiFuX5Nw5UlF7d2HZ96Bh0sgFIL5KGaKSoVYVlvdKpZJVP5+NZ7xDEkQhmDgsDKciazJCXJ6ZN2B3FY2f6VZyGl/t4aunGIAk/BHaS+i+SpdRfnB/OktOvyjinWNfM9Ksr6WwtCa1hCmeRI6icpFM4o8quCLsikU0tMoZI/9EqXRMpKGaWzofl4nQuVQm17d5fU5qXCQeCDqVaL9XJ9qJ08n3G3EFZS28SHEb3cdRBdtO0YcTzil3QknNKEe/smQ1fTb0XbpyNB5xAeuIlf+5KWlEY0DqJbsnzJlQxJPOVyHiKMx5Xu9FcEv1Fbg6Fhm4t+Jyy5JC1W3YO8dYLsO0PXPbxodBgttTbH3rt9Cp1lJIk2r3O1Zqu94eRbnIz2f50lWolYzuKsj4PMok4abHLO8NAC884hiXx5Fy5pWKO0bWL7uEGXaJCtznhP67SlQ4xjWIfgq6EpZ28QMtuZK7JC0RGbl9nA4XtFLug/NLMoH1pGt9IonAJqcEDLyH6TDROcbsmGPaGIxMo41IUAnQVPMPGByp4mOmh9ZQMkBAcksUK55LsZj7E5z5XuZoyWCKu6nHmDq22xI/9Z8YdxJy4kWpD16jLVrpwGLWfyOD0Wd+cBzFBxVaGv7S5k9qwh/5t/LQEXsRqI3Q9Rm3QIoaZW9GlsDaKOUyykyWuhNOprSEi0s1G4rgoiX1V743EELti+pJu5og6X0g6oTynUqlhH9k6ezyRi05NGZHz0nvp3HOJr7ebrAUFrDjbkFBObEvdQWkkUbL0pEvMU46X58vF9j9F3j6kpyetNUBItrEubW9ZvMPM4qNqLlsSBJqOH3XbNwv/cXDXNxN8iFLzUhteisYY+RlHYOuP29/Cb+L+xv+35Rv7xudnZ6ohK4cMPfCG8KI7dNmjNk/H4e84pOxn/sZHK9psfvj8ncA8qJz7O8xqbxESDivGJOZzF7o5PJLQ7g34qAWoyuA+x3btU98LT6ZyGyceIXjrqob2CAVql4VOTQPUQYvHV/g4zAuCZGvYQBtf0wmd5lilrvuEn1BXLny01B4h4SMDlYsnNpm9d7m9h578ufpef9Z4WplqWQvqo52fyUA7J24eZD5av6SyGIV9kpmHNqyvdfzcpEMw97BvknV2fq+MFHun9BT3Lsf8pbzvisWiIQvYkng+8Vxk1V+dli1u56kY50LRjaPdotvT5BwqtwyF+emo/z9J3yVUVGfKrxQtJMOAQWoQii/4dp9wgybSa5mkucmRLtEQZ/pz0tL/NVcgWAd95nEQ3Tg6tNbuyn3Iepz65L3huMUUBntllWuu4DbtOFSMSbpILV4fy6wlM0SOvi6CpLh81c1LreIvKd61uEWBcDw1lUBUW1I0Z+m/PaRlX+PQ/oxg0Ye6KUiIiTF4ADNk59Ydpt5/rkxmq9tV5Kcp/eQLUVVmBzQNVuytQCP6Ezd0G8eLxWyHpmZWJ3bAzkWTtg4lZlw42SQezEmiUPaJUuR/qklVA/87S4ArFCpALdY3QRdUw3G3XbWUp6aq9z0zUizcPa7351p9JXOZyfdZBFnqt90VzQndXB/mwf8LC9STj5kenVpNuqOQQP3mIRJj7eV21FxG8VAxKrEn3c+XfmZ800EPb9/5lIlijscUbB6da0RQaMook0zug1G0tKi/JBC4rw7/D3m4ARzAkzMcVrDcT2SyFtUdWAsFlsPDFqV3N+EjyXaoEePwroaZCiLqEzb8MW+PNE9TmTC01EzWli51PzZvUqkmyuROU+V6ik+Le/9qT6nwzUzf9tP68tYei0YaDGx6kAd7jn1cKqOCuYbiELH9zYqcc4MnRJjkeGiqaGwLImhyeKs+xKJMBlOJ05ow9gGCKZ1VpnMKoSCTbMS+X+23y042zOb5MtcY/6oBeAo1Vy89OTyhpavFP78jXCcFH0t7Gx24hMEOm2gsEfGabVpQgvFqbQKMsknFRRmuPHcZu0Su/WMFphZvB2r/EGbG72rpGGho3h+Msz0uGzJ7hNK2uqQiE1qmn0zgacKYYZBCqsxV+sjbpoVdSilW/b94n2xNb648VmNIoizqEWhBnsen+d0kbCPmRItfWqSBeOd9Wne3c6bcd6uvXOJ6WdiSsuXq0ndhqrQ4QoWUjCjYtZ0EAhnSOP1m44xkf0O7jXghrzSJWxP4a/t72jU29Vu2rvu4n7HfHkkmQOMGSS+NPeLGO5I73mC2B7+lMiBQQZRM9/9liLIfowupUFAbPBbR+lxDM6M8Ptgh1paJq5Rvs7yEuLQv/7d1oU2woFSb3FMPWQOKMuCuJ7pDDjpIclus5TeEoMBy2YdVB4fxmesaCeMNsEgTHKS5WDSGyNUOoEpcC2OFWtIRf0w27ck34/DjxRTVIcc9+kqZE6iMSiVDsiKdP/Xz5XfEhm/sBhO50p1rvJDlkyyxuJ9SPgs7YeUJBjXdeAkE+P9OQJm6SZnn1svcduI78dYmbkE2mtziPrcjVisXG78spLvbZaSFx/Rks9zP4LKn0Cdz/3JsetkT06A8f/yCgMO6Mb1Hme0JJ7b2wZz1qleqTuKBGokhPVUZ0dVu+tnQYNEY1fmkZSz6+EGZ5EzL7657mreZGR3jUfaEk458PDniBzsSmBKhDRzfXameryJv9/D5m6HIqZ0R+ouCE54Dzp4IJuuD1e4Dc5i+PpSORJfG23uVgqixAMDvchMR0nZdH5brclYwRoJRWv/rlxGRI5ffD5NPGmIDt7vDE1434pYdVZIFh89Bs94HGGJbTwrN8T6lh1HZFTOB4lWzWj6EVqxSMvC0/ljWBQ3F2kc/mO2b6tWonT2JEqEwFts8rz2h+oWNds9ceR2cb7zZvJTDppHaEhK5avWqsseWa2Dt5BBhabdWSktS80oMQrL4TvAM9b5HMmyDnO+OkkbMXfUJG7eXqTIG6lqSOEbqVR+qYdP7uWb57WEJqzyh411GAVsDinPs7KvUeXItlcMdOUWzXBH6zscymV1LLVCtc8IePojzXHF9m5b5zGwBRdzcyUJkiu938ApmAayRdJrX1PmVguWUvt2ThQ62czItTyWJMW2An/hdDfMK7SiFQlGIdAbltHz3ycoh7j9V7GxNWBpbtcSdqm4XxRwTawc3cbZ+xfSv9qQfEkDKfZTwCkqWGI/ur250ItXlMlh6vUNWEYIg9A3GzbgmbqvTN8js2YMo87CU5y6nZ4dbJLDQJj9fc7yM7tZzJDZFtqOcU8+mZjYlq4VmifI23iHb1ZoT9E+kT2dolnP1AfiOkt7PQCSykBiXy5mv637IegWSKj9IKrYZf4Lu9+I7ub+mkRdlvYzehh/jaJ9n7HUH5b2IbgeNdkY7wx1yVzxS7pbvky6+nmVUtRllEFfweUQ0/nG017WoUYSxs+j2B4FV/F62EtHlMWZXYrjGHpthnNb1x66LKZ0Qe92INWHdfR/vqp02wMS8r1G4dJqHok8KmQ7947G13a4YXbsGgHcBvRuVu1eAi4/A5+ZixmdSXM73LupB/LH7O9yxLTVXJTyBbI1S49TIROrfVCOb/czZ9pM4JsZx8kUz8dQGv7gUWKxXvTH7QM/3J2OuXXgciUhqY+cgtaOliQQVOYthBLV3xpESZT3rmfEYNZxmpBbb24CRao86prn+i9TNOh8VxRJGXJfXHATJHs1T5txgc/opYrY8XjlGQQbRcoxIBcnVsMjmU1ymmIUL4dviJXndMAJ0Yet+c7O52/p98ytlmAsGBaTAmMhimAnvp1TWNGM9BpuitGj+t810CU2UhorrjPKGtThVC8WaXw04WFnT5fTjqmPyrQ0tN3CkLsctVy2xr0ZWgiWVZ1OrlFjjxJYsOiZv2cAoOvE+7sY0I/TwWcZqMoyIKNOftwP7w++Rfg67ljfovKYa50if3fzE/8aPYVey/Nq35+nH2sLPh/fP5TsylSKGOZ4k69d2PnH43+kq++sRXHQqGArWdwhx+hpwQC6JgT2uxehYU4Zbw7oNb6/HLikPyJROGK2ouyr+vzseESp9G50T4AyFrSqOQ0rroCYP4sMDFBrHn342EyZTMlSyk47rHSq89Y9/nI3zG5lX16Z5lxphguLOcZUndL8wNcrkyjH82jqg8Bo8OYkynrxZvbFno5lUS3OPr8Ko3mX9NoRPdYOKKjD07bvgFgpZ/RF+YzkWvJ/Hs/tUbfeGzGWLxNAjfDzHHMVSDwB5SabQLsIZHiBp43FjGkaienYoDd18hu2BGwOK7U3o70K/WY/kuuKdmdrykIBUdG2mvE91L1JtTbh20mOLbk1vCAamu7utlXeGU2ooVikbU/actcgmsC1FKk2qmj3GWeIWbj4tGIxE7BLcBWUvvcnd/lYxsMV4F917fWeFB/XbINN3qGvIyTpCalz1lVewdIGqeAS/gB8Mi+sA+BqDiX3VGD2eUunTRbSY+AuDy4E3Qx3hAhwnSXX+B0zuj3eQ1miS8Vux2z/l6/BkWtjKGU72aJkOCWhGcSf3+kFkkB15vGOsQrSdFr6qTj0gBYiOlnBO41170gOWHSUoBVRU2JjwppYdhIFDfu7tIRHccSNM5KZOFDPz0TGMAjzzEpeLwTWp+kn201kU6NjbiMQJx83+LX1e1tZ10kuChJZ/XBUQ1dwaBHjTDJDqOympEk8X2M3VtVw21JksChA8w1tTefO3RJ1FMbqZ01bHHkudDB/OhLfe7P5GOHaI28ZXKTMuqo0hLWQ4HabBsGG7NbP1RiXtETz074er6w/OerJWEqjmkq2y51q1BVI+JUudnVa3ogBpzdhFE7fC7kybrAt2Z6RqDjATAUEYeYK45WMupBKQRtQlU+uNsjnzj6ZmGrezA+ASrWxQ6LMkHRXqXwNq7ftv28dUx/ZSJciDXP2SWJsWaN0FjPX9Yko6LobZ7aYW/IdUktI9apTLyHS8DyWPyuoZyxN1TK/vtfxk3HwWh6JczZC8Ftn0bIJay2g+n5wd7lm9rEsKO+svqVmi+c1j88hSCxbzrg4+HEP0Nt1/B6YW1XVm09T1CpAKjc9n18hjqsaFGdfyva1ZG0Xu3ip6N6JGpyTSqY5h4BOlpLPaOnyw45PdXTN+DtAKg7DLrLFTnWusoSBHk3s0d7YouJHq85/R09Tfc37ENXZF48eAYLnq9GLioNcwDZrC6FW6godB8JnqYUPvn0pWLfQz0lM0Yy8Mybgn84Ds3Q9bDP10bLyOV+qzxa4Rd9Dhu7cju8mMaONXK3UqmBQ9qIg7etIwEqM/kECk/Dzja4Bs1xR+Q/tCbc8IKrSGsTdJJ0vge7IG20W687uVmK6icWQ6cD3lwFzgNMGtFvO5qyJeKflGLAAcQZOrkxVwy3cWvqlGpvjmf9Qe6Ap20MPbV92DPV0OhFM4kz8Yr0ffC2zLWSQ1kqY6QdQrttR3kh1YLtQd1kCEv5hVoPIRWl5ERcUTttBIrWp6Xs5Ehh5OUUwI5aEBvuiDmUoENmnVw1FohCrbRp1A1E+XSlWVOTi7ADW+5Ohb9z1vK4qx5R5lPdGCPBJZ00mC+Ssp8VUbgpGAvXWMuWQQRbCqI6Rr2jtxZxtfP7W/8onz+yz0Gs76LaT5HX9ecyiZCB/ZR/gFtMxPsDwohoeCRtiuLxE1GM1vUEUgBv86+eehL58/P56QFGQ/MqOe/vC76L63jzmeax4exd/OKTUvkXg+fOJUHych9xt/9goJMrapSgvXrj8+8vk/N80f22Sewj6cyGqt1B6mztoeklVHHraouhvHJaG/OuBz6DHKMpFmQULU1bRWlyYE0RPXYYkUycIemN7TLtgNCJX6BqdyxDKkegO7nJK5xQ7OVYDZTMf9bVHidtk6DQX9Et+V9M7esgbsYBdEeUpsB0Xvw2kd9+rI7V+m47u+O/tq7mw7262HU1WlS9uFzsV6JxIHNmUCy0QS9e077JGRFbG65z3/dOKB/Zk+yDdKpUmdXjn/aS3N5nv4fK7bMHHmPlHd4E2+iTbV5rpzScRnxk6KARuDTJ8Q1LpK2mP8gj1EbuJ9RIyY+EWK4hCiIDBAS1Tm2IEXAFfgKPgdL9O6mAa06wjCcUAL6EsxPQWO9VNegBPm/0GgkZbDxCynxujX/92vmGcjZRMAY45puak2sFLCLSwXpEsyy5fnF0jGJBhm+fNSHKKUUfy+276A7/feLOFxxUuHRNJI2Osenxyvf8DAGObT60pfTTlhEg9u/KKkhJqm5U1/+BEcSkpFDA5XeCqxwXmPac1jcuZ3JWQ+p0NdWzb/5v1ZvF8GtMTFFEdQjpLO0bwPb0BHNWnip3liDXI2fXf05jjvfJ0NpjLCUgfTh9CMFYVFKEd4Z/OG/2C+N435mnK+9t1gvCiVcaaH7rK4+PjCvpVNiz+t2QyqH1O8x3JKZVl6Q+Lp/XK8wMjVMslOq9FdSw5FtUs/CptXH9PW+wbWHgrV17R5jTVOtGtKFu3nb80T+E0tv9QkzW3J2dbaw/8ddAKZ0pxIaEqLjlPrji3VgJ3GvdFvlqD8075woxh4fVt0JZE0KVFsAvqhe0dqN9b35jtSpnYMXkU+vZq+IAHad3IHc2s/LYrnD1anfG46IFiMIr9oNbZDWvwthqYNqOigaKd/XlLU4XHfk/PXIjPsLy/9/kAtQ+/wKH+hI/IROWj5FPvTZAT9f7j4ZXQyG4M0TujMAFXYkKvEHv1xhySekgXGGqNxWeWKlf8dDAlLuB1cb/qOD+rk7cmwt+1yKpk9cudqBanTi6zTbXRtV8qylNtjyOVKy1HTz0GW9rjt6sSjAZcT5R+KdtyYb0zyqG9pSLuCw5WBwAn7fjBjKLLoxLXMI+52L9cLwIR2B6OllJZLHJ8vDxmWdtF+QJnmt1rsHPIWY20lftk8fYePkAIg6Hgn532QoIpegMxiWgAOfe5/U44APR8Ac0NeZrVh3gEhs12W+tVSiWiUQekf/YBECUy5fdYbA08dd7VzPAP9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg="; 5272 5273 },{}],6:[function(require,module,exports){ 5274 /* Copyright 2013 Google Inc. All Rights Reserved. 5275 5276 Licensed under the Apache License, Version 2.0 (the "License"); 5277 you may not use this file except in compliance with the License. 5278 You may obtain a copy of the License at 5279 5280 http://www.apache.org/licenses/LICENSE-2.0 5281 5282 Unless required by applicable law or agreed to in writing, software 5283 distributed under the License is distributed on an "AS IS" BASIS, 5284 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5285 See the License for the specific language governing permissions and 5286 limitations under the License. 5287 5288 Collection of static dictionary words. 5289 */ 5290 5291 var data = require('./dictionary-browser'); 5292 exports.init = function() { 5293 exports.dictionary = data.init(); 5294 }; 5295 5296 exports.offsetsByLength = new Uint32Array([ 5297 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 5298 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536, 5299 115968, 118528, 119872, 121280, 122016, 5300 ]); 5301 5302 exports.sizeBitsByLength = new Uint8Array([ 5303 0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 5304 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 5305 7, 6, 6, 5, 5, 5306 ]); 5307 5308 exports.minDictionaryWordLength = 4; 5309 exports.maxDictionaryWordLength = 24; 5310 5311 },{"./dictionary-browser":4}],7:[function(require,module,exports){ 5312 function HuffmanCode(bits, value) { 5313 this.bits = bits; /* number of bits used for this symbol */ 5314 this.value = value; /* symbol value or table offset */ 5315 } 5316 5317 exports.HuffmanCode = HuffmanCode; 5318 5319 var MAX_LENGTH = 15; 5320 5321 /* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the 5322 bit-wise reversal of the len least significant bits of key. */ 5323 function GetNextKey(key, len) { 5324 var step = 1 << (len - 1); 5325 while (key & step) { 5326 step >>= 1; 5327 } 5328 return (key & (step - 1)) + step; 5329 } 5330 5331 /* Stores code in table[0], table[step], table[2*step], ..., table[end] */ 5332 /* Assumes that end is an integer multiple of step */ 5333 function ReplicateValue(table, i, step, end, code) { 5334 do { 5335 end -= step; 5336 table[i + end] = new HuffmanCode(code.bits, code.value); 5337 } while (end > 0); 5338 } 5339 5340 /* Returns the table width of the next 2nd level table. count is the histogram 5341 of bit lengths for the remaining symbols, len is the code length of the next 5342 processed symbol */ 5343 function NextTableBitSize(count, len, root_bits) { 5344 var left = 1 << (len - root_bits); 5345 while (len < MAX_LENGTH) { 5346 left -= count[len]; 5347 if (left <= 0) break; 5348 ++len; 5349 left <<= 1; 5350 } 5351 return len - root_bits; 5352 } 5353 5354 exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) { 5355 var start_table = table; 5356 var code; /* current table entry */ 5357 var len; /* current code length */ 5358 var symbol; /* symbol index in original or sorted table */ 5359 var key; /* reversed prefix code */ 5360 var step; /* step size to replicate values in current table */ 5361 var low; /* low bits for current root entry */ 5362 var mask; /* mask for low bits */ 5363 var table_bits; /* key length of current table */ 5364 var table_size; /* size of current table */ 5365 var total_size; /* sum of root table size and 2nd level table sizes */ 5366 var sorted; /* symbols sorted by code length */ 5367 var count = new Int32Array(MAX_LENGTH + 1); /* number of codes of each length */ 5368 var offset = new Int32Array(MAX_LENGTH + 1); /* offsets in sorted table for each length */ 5369 5370 sorted = new Int32Array(code_lengths_size); 5371 5372 /* build histogram of code lengths */ 5373 for (symbol = 0; symbol < code_lengths_size; symbol++) { 5374 count[code_lengths[symbol]]++; 5375 } 5376 5377 /* generate offsets into sorted symbol table by code length */ 5378 offset[1] = 0; 5379 for (len = 1; len < MAX_LENGTH; len++) { 5380 offset[len + 1] = offset[len] + count[len]; 5381 } 5382 5383 /* sort symbols by length, by symbol order within each length */ 5384 for (symbol = 0; symbol < code_lengths_size; symbol++) { 5385 if (code_lengths[symbol] !== 0) { 5386 sorted[offset[code_lengths[symbol]]++] = symbol; 5387 } 5388 } 5389 5390 table_bits = root_bits; 5391 table_size = 1 << table_bits; 5392 total_size = table_size; 5393 5394 /* special case code with only one value */ 5395 if (offset[MAX_LENGTH] === 1) { 5396 for (key = 0; key < total_size; ++key) { 5397 root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff); 5398 } 5399 5400 return total_size; 5401 } 5402 5403 /* fill in root table */ 5404 key = 0; 5405 symbol = 0; 5406 for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) { 5407 for (; count[len] > 0; --count[len]) { 5408 code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff); 5409 ReplicateValue(root_table, table + key, step, table_size, code); 5410 key = GetNextKey(key, len); 5411 } 5412 } 5413 5414 /* fill in 2nd level tables and add pointers to root table */ 5415 mask = total_size - 1; 5416 low = -1; 5417 for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) { 5418 for (; count[len] > 0; --count[len]) { 5419 if ((key & mask) !== low) { 5420 table += table_size; 5421 table_bits = NextTableBitSize(count, len, root_bits); 5422 table_size = 1 << table_bits; 5423 total_size += table_size; 5424 low = key & mask; 5425 root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff); 5426 } 5427 code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff); 5428 ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code); 5429 key = GetNextKey(key, len); 5430 } 5431 } 5432 5433 return total_size; 5434 } 5435 5436 },{}],8:[function(require,module,exports){ 5437 'use strict' 5438 5439 exports.byteLength = byteLength 5440 exports.toByteArray = toByteArray 5441 exports.fromByteArray = fromByteArray 5442 5443 var lookup = [] 5444 var revLookup = [] 5445 var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array 5446 5447 var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 5448 for (var i = 0, len = code.length; i < len; ++i) { 5449 lookup[i] = code[i] 5450 revLookup[code.charCodeAt(i)] = i 5451 } 5452 5453 // Support decoding URL-safe base64 strings, as Node.js does. 5454 // See: https://en.wikipedia.org/wiki/Base64#URL_applications 5455 revLookup['-'.charCodeAt(0)] = 62 5456 revLookup['_'.charCodeAt(0)] = 63 5457 5458 function getLens (b64) { 5459 var len = b64.length 5460 5461 if (len % 4 > 0) { 5462 throw new Error('Invalid string. Length must be a multiple of 4') 5463 } 5464 5465 // Trim off extra bytes after placeholder bytes are found 5466 // See: https://github.com/beatgammit/base64-js/issues/42 5467 var validLen = b64.indexOf('=') 5468 if (validLen === -1) validLen = len 5469 5470 var placeHoldersLen = validLen === len 5471 ? 0 5472 : 4 - (validLen % 4) 5473 5474 return [validLen, placeHoldersLen] 5475 } 5476 5477 // base64 is 4/3 + up to two characters of the original data 5478 function byteLength (b64) { 5479 var lens = getLens(b64) 5480 var validLen = lens[0] 5481 var placeHoldersLen = lens[1] 5482 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 5483 } 5484 5485 function _byteLength (b64, validLen, placeHoldersLen) { 5486 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 5487 } 5488 5489 function toByteArray (b64) { 5490 var tmp 5491 var lens = getLens(b64) 5492 var validLen = lens[0] 5493 var placeHoldersLen = lens[1] 5494 5495 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) 5496 5497 var curByte = 0 5498 5499 // if there are placeholders, only get up to the last complete 4 chars 5500 var len = placeHoldersLen > 0 5501 ? validLen - 4 5502 : validLen 5503 5504 for (var i = 0; i < len; i += 4) { 5505 tmp = 5506 (revLookup[b64.charCodeAt(i)] << 18) | 5507 (revLookup[b64.charCodeAt(i + 1)] << 12) | 5508 (revLookup[b64.charCodeAt(i + 2)] << 6) | 5509 revLookup[b64.charCodeAt(i + 3)] 5510 arr[curByte++] = (tmp >> 16) & 0xFF 5511 arr[curByte++] = (tmp >> 8) & 0xFF 5512 arr[curByte++] = tmp & 0xFF 5513 } 5514 5515 if (placeHoldersLen === 2) { 5516 tmp = 5517 (revLookup[b64.charCodeAt(i)] << 2) | 5518 (revLookup[b64.charCodeAt(i + 1)] >> 4) 5519 arr[curByte++] = tmp & 0xFF 5520 } 5521 5522 if (placeHoldersLen === 1) { 5523 tmp = 5524 (revLookup[b64.charCodeAt(i)] << 10) | 5525 (revLookup[b64.charCodeAt(i + 1)] << 4) | 5526 (revLookup[b64.charCodeAt(i + 2)] >> 2) 5527 arr[curByte++] = (tmp >> 8) & 0xFF 5528 arr[curByte++] = tmp & 0xFF 5529 } 5530 5531 return arr 5532 } 5533 5534 function tripletToBase64 (num) { 5535 return lookup[num >> 18 & 0x3F] + 5536 lookup[num >> 12 & 0x3F] + 5537 lookup[num >> 6 & 0x3F] + 5538 lookup[num & 0x3F] 5539 } 5540 5541 function encodeChunk (uint8, start, end) { 5542 var tmp 5543 var output = [] 5544 for (var i = start; i < end; i += 3) { 5545 tmp = 5546 ((uint8[i] << 16) & 0xFF0000) + 5547 ((uint8[i + 1] << 8) & 0xFF00) + 5548 (uint8[i + 2] & 0xFF) 5549 output.push(tripletToBase64(tmp)) 5550 } 5551 return output.join('') 5552 } 5553 5554 function fromByteArray (uint8) { 5555 var tmp 5556 var len = uint8.length 5557 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes 5558 var parts = [] 5559 var maxChunkLength = 16383 // must be multiple of 3 5560 5561 // go through the array every three bytes, we'll deal with trailing stuff later 5562 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { 5563 parts.push(encodeChunk( 5564 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) 5565 )) 5566 } 5567 5568 // pad the end with zeros, but make sure to not forget the extra bytes 5569 if (extraBytes === 1) { 5570 tmp = uint8[len - 1] 5571 parts.push( 5572 lookup[tmp >> 2] + 5573 lookup[(tmp << 4) & 0x3F] + 5574 '==' 5575 ) 5576 } else if (extraBytes === 2) { 5577 tmp = (uint8[len - 2] << 8) + uint8[len - 1] 5578 parts.push( 5579 lookup[tmp >> 10] + 5580 lookup[(tmp >> 4) & 0x3F] + 5581 lookup[(tmp << 2) & 0x3F] + 5582 '=' 5583 ) 5584 } 5585 5586 return parts.join('') 5587 } 5588 5589 },{}],9:[function(require,module,exports){ 5590 /* Copyright 2013 Google Inc. All Rights Reserved. 5591 5592 Licensed under the Apache License, Version 2.0 (the "License"); 5593 you may not use this file except in compliance with the License. 5594 You may obtain a copy of the License at 5595 5596 http://www.apache.org/licenses/LICENSE-2.0 5597 5598 Unless required by applicable law or agreed to in writing, software 5599 distributed under the License is distributed on an "AS IS" BASIS, 5600 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5601 See the License for the specific language governing permissions and 5602 limitations under the License. 5603 5604 Lookup tables to map prefix codes to value ranges. This is used during 5605 decoding of the block lengths, literal insertion lengths and copy lengths. 5606 */ 5607 5608 /* Represents the range of values belonging to a prefix code: */ 5609 /* [offset, offset + 2^nbits) */ 5610 function PrefixCodeRange(offset, nbits) { 5611 this.offset = offset; 5612 this.nbits = nbits; 5613 } 5614 5615 exports.kBlockLengthPrefixCode = [ 5616 new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2), 5617 new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3), 5618 new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4), 5619 new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5), 5620 new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8), 5621 new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12), 5622 new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24) 5623 ]; 5624 5625 exports.kInsertLengthPrefixCode = [ 5626 new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), 5627 new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1), 5628 new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3), 5629 new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5), 5630 new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9), 5631 new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24), 5632 ]; 5633 5634 exports.kCopyLengthPrefixCode = [ 5635 new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), 5636 new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0), 5637 new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2), 5638 new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4), 5639 new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7), 5640 new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24), 5641 ]; 5642 5643 exports.kInsertRangeLut = [ 5644 0, 0, 8, 8, 0, 16, 8, 16, 16, 5645 ]; 5646 5647 exports.kCopyRangeLut = [ 5648 0, 8, 0, 8, 16, 0, 16, 8, 16, 5649 ]; 5650 5651 },{}],10:[function(require,module,exports){ 5652 function BrotliInput(buffer) { 5653 this.buffer = buffer; 5654 this.pos = 0; 5655 } 5656 5657 BrotliInput.prototype.read = function(buf, i, count) { 5658 if (this.pos + count > this.buffer.length) { 5659 count = this.buffer.length - this.pos; 5660 } 5661 5662 for (var p = 0; p < count; p++) 5663 buf[i + p] = this.buffer[this.pos + p]; 5664 5665 this.pos += count; 5666 return count; 5667 } 5668 5669 exports.BrotliInput = BrotliInput; 5670 5671 function BrotliOutput(buf) { 5672 this.buffer = buf; 5673 this.pos = 0; 5674 } 5675 5676 BrotliOutput.prototype.write = function(buf, count) { 5677 if (this.pos + count > this.buffer.length) 5678 throw new Error('Output buffer is not large enough'); 5679 5680 this.buffer.set(buf.subarray(0, count), this.pos); 5681 this.pos += count; 5682 return count; 5683 }; 5684 5685 exports.BrotliOutput = BrotliOutput; 5686 5687 },{}],11:[function(require,module,exports){ 5688 /* Copyright 2013 Google Inc. All Rights Reserved. 5689 5690 Licensed under the Apache License, Version 2.0 (the "License"); 5691 you may not use this file except in compliance with the License. 5692 You may obtain a copy of the License at 5693 5694 http://www.apache.org/licenses/LICENSE-2.0 5695 5696 Unless required by applicable law or agreed to in writing, software 5697 distributed under the License is distributed on an "AS IS" BASIS, 5698 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5699 See the License for the specific language governing permissions and 5700 limitations under the License. 5701 5702 Transformations on dictionary words. 5703 */ 5704 5705 var BrotliDictionary = require('./dictionary'); 5706 5707 var kIdentity = 0; 5708 var kOmitLast1 = 1; 5709 var kOmitLast2 = 2; 5710 var kOmitLast3 = 3; 5711 var kOmitLast4 = 4; 5712 var kOmitLast5 = 5; 5713 var kOmitLast6 = 6; 5714 var kOmitLast7 = 7; 5715 var kOmitLast8 = 8; 5716 var kOmitLast9 = 9; 5717 var kUppercaseFirst = 10; 5718 var kUppercaseAll = 11; 5719 var kOmitFirst1 = 12; 5720 var kOmitFirst2 = 13; 5721 var kOmitFirst3 = 14; 5722 var kOmitFirst4 = 15; 5723 var kOmitFirst5 = 16; 5724 var kOmitFirst6 = 17; 5725 var kOmitFirst7 = 18; 5726 var kOmitFirst8 = 19; 5727 var kOmitFirst9 = 20; 5728 5729 function Transform(prefix, transform, suffix) { 5730 this.prefix = new Uint8Array(prefix.length); 5731 this.transform = transform; 5732 this.suffix = new Uint8Array(suffix.length); 5733 5734 for (var i = 0; i < prefix.length; i++) 5735 this.prefix[i] = prefix.charCodeAt(i); 5736 5737 for (var i = 0; i < suffix.length; i++) 5738 this.suffix[i] = suffix.charCodeAt(i); 5739 } 5740 5741 var kTransforms = [ 5742 new Transform( "", kIdentity, "" ), 5743 new Transform( "", kIdentity, " " ), 5744 new Transform( " ", kIdentity, " " ), 5745 new Transform( "", kOmitFirst1, "" ), 5746 new Transform( "", kUppercaseFirst, " " ), 5747 new Transform( "", kIdentity, " the " ), 5748 new Transform( " ", kIdentity, "" ), 5749 new Transform( "s ", kIdentity, " " ), 5750 new Transform( "", kIdentity, " of " ), 5751 new Transform( "", kUppercaseFirst, "" ), 5752 new Transform( "", kIdentity, " and " ), 5753 new Transform( "", kOmitFirst2, "" ), 5754 new Transform( "", kOmitLast1, "" ), 5755 new Transform( ", ", kIdentity, " " ), 5756 new Transform( "", kIdentity, ", " ), 5757 new Transform( " ", kUppercaseFirst, " " ), 5758 new Transform( "", kIdentity, " in " ), 5759 new Transform( "", kIdentity, " to " ), 5760 new Transform( "e ", kIdentity, " " ), 5761 new Transform( "", kIdentity, "\"" ), 5762 new Transform( "", kIdentity, "." ), 5763 new Transform( "", kIdentity, "\">" ), 5764 new Transform( "", kIdentity, "\n" ), 5765 new Transform( "", kOmitLast3, "" ), 5766 new Transform( "", kIdentity, "]" ), 5767 new Transform( "", kIdentity, " for " ), 5768 new Transform( "", kOmitFirst3, "" ), 5769 new Transform( "", kOmitLast2, "" ), 5770 new Transform( "", kIdentity, " a " ), 5771 new Transform( "", kIdentity, " that " ), 5772 new Transform( " ", kUppercaseFirst, "" ), 5773 new Transform( "", kIdentity, ". " ), 5774 new Transform( ".", kIdentity, "" ), 5775 new Transform( " ", kIdentity, ", " ), 5776 new Transform( "", kOmitFirst4, "" ), 5777 new Transform( "", kIdentity, " with " ), 5778 new Transform( "", kIdentity, "'" ), 5779 new Transform( "", kIdentity, " from " ), 5780 new Transform( "", kIdentity, " by " ), 5781 new Transform( "", kOmitFirst5, "" ), 5782 new Transform( "", kOmitFirst6, "" ), 5783 new Transform( " the ", kIdentity, "" ), 5784 new Transform( "", kOmitLast4, "" ), 5785 new Transform( "", kIdentity, ". The " ), 5786 new Transform( "", kUppercaseAll, "" ), 5787 new Transform( "", kIdentity, " on " ), 5788 new Transform( "", kIdentity, " as " ), 5789 new Transform( "", kIdentity, " is " ), 5790 new Transform( "", kOmitLast7, "" ), 5791 new Transform( "", kOmitLast1, "ing " ), 5792 new Transform( "", kIdentity, "\n\t" ), 5793 new Transform( "", kIdentity, ":" ), 5794 new Transform( " ", kIdentity, ". " ), 5795 new Transform( "", kIdentity, "ed " ), 5796 new Transform( "", kOmitFirst9, "" ), 5797 new Transform( "", kOmitFirst7, "" ), 5798 new Transform( "", kOmitLast6, "" ), 5799 new Transform( "", kIdentity, "(" ), 5800 new Transform( "", kUppercaseFirst, ", " ), 5801 new Transform( "", kOmitLast8, "" ), 5802 new Transform( "", kIdentity, " at " ), 5803 new Transform( "", kIdentity, "ly " ), 5804 new Transform( " the ", kIdentity, " of " ), 5805 new Transform( "", kOmitLast5, "" ), 5806 new Transform( "", kOmitLast9, "" ), 5807 new Transform( " ", kUppercaseFirst, ", " ), 5808 new Transform( "", kUppercaseFirst, "\"" ), 5809 new Transform( ".", kIdentity, "(" ), 5810 new Transform( "", kUppercaseAll, " " ), 5811 new Transform( "", kUppercaseFirst, "\">" ), 5812 new Transform( "", kIdentity, "=\"" ), 5813 new Transform( " ", kIdentity, "." ), 5814 new Transform( ".com/", kIdentity, "" ), 5815 new Transform( " the ", kIdentity, " of the " ), 5816 new Transform( "", kUppercaseFirst, "'" ), 5817 new Transform( "", kIdentity, ". This " ), 5818 new Transform( "", kIdentity, "," ), 5819 new Transform( ".", kIdentity, " " ), 5820 new Transform( "", kUppercaseFirst, "(" ), 5821 new Transform( "", kUppercaseFirst, "." ), 5822 new Transform( "", kIdentity, " not " ), 5823 new Transform( " ", kIdentity, "=\"" ), 5824 new Transform( "", kIdentity, "er " ), 5825 new Transform( " ", kUppercaseAll, " " ), 5826 new Transform( "", kIdentity, "al " ), 5827 new Transform( " ", kUppercaseAll, "" ), 5828 new Transform( "", kIdentity, "='" ), 5829 new Transform( "", kUppercaseAll, "\"" ), 5830 new Transform( "", kUppercaseFirst, ". " ), 5831 new Transform( " ", kIdentity, "(" ), 5832 new Transform( "", kIdentity, "ful " ), 5833 new Transform( " ", kUppercaseFirst, ". " ), 5834 new Transform( "", kIdentity, "ive " ), 5835 new Transform( "", kIdentity, "less " ), 5836 new Transform( "", kUppercaseAll, "'" ), 5837 new Transform( "", kIdentity, "est " ), 5838 new Transform( " ", kUppercaseFirst, "." ), 5839 new Transform( "", kUppercaseAll, "\">" ), 5840 new Transform( " ", kIdentity, "='" ), 5841 new Transform( "", kUppercaseFirst, "," ), 5842 new Transform( "", kIdentity, "ize " ), 5843 new Transform( "", kUppercaseAll, "." ), 5844 new Transform( "\xc2\xa0", kIdentity, "" ), 5845 new Transform( " ", kIdentity, "," ), 5846 new Transform( "", kUppercaseFirst, "=\"" ), 5847 new Transform( "", kUppercaseAll, "=\"" ), 5848 new Transform( "", kIdentity, "ous " ), 5849 new Transform( "", kUppercaseAll, ", " ), 5850 new Transform( "", kUppercaseFirst, "='" ), 5851 new Transform( " ", kUppercaseFirst, "," ), 5852 new Transform( " ", kUppercaseAll, "=\"" ), 5853 new Transform( " ", kUppercaseAll, ", " ), 5854 new Transform( "", kUppercaseAll, "," ), 5855 new Transform( "", kUppercaseAll, "(" ), 5856 new Transform( "", kUppercaseAll, ". " ), 5857 new Transform( " ", kUppercaseAll, "." ), 5858 new Transform( "", kUppercaseAll, "='" ), 5859 new Transform( " ", kUppercaseAll, ". " ), 5860 new Transform( " ", kUppercaseFirst, "=\"" ), 5861 new Transform( " ", kUppercaseAll, "='" ), 5862 new Transform( " ", kUppercaseFirst, "='" ) 5863 ]; 5864 5865 exports.kTransforms = kTransforms; 5866 exports.kNumTransforms = kTransforms.length; 5867 5868 function ToUpperCase(p, i) { 5869 if (p[i] < 0xc0) { 5870 if (p[i] >= 97 && p[i] <= 122) { 5871 p[i] ^= 32; 5872 } 5873 return 1; 5874 } 5875 5876 /* An overly simplified uppercasing model for utf-8. */ 5877 if (p[i] < 0xe0) { 5878 p[i + 1] ^= 32; 5879 return 2; 5880 } 5881 5882 /* An arbitrary transform for three byte characters. */ 5883 p[i + 2] ^= 5; 5884 return 3; 5885 } 5886 5887 exports.transformDictionaryWord = function(dst, idx, word, len, transform) { 5888 var prefix = kTransforms[transform].prefix; 5889 var suffix = kTransforms[transform].suffix; 5890 var t = kTransforms[transform].transform; 5891 var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1); 5892 var i = 0; 5893 var start_idx = idx; 5894 var uppercase; 5895 5896 if (skip > len) { 5897 skip = len; 5898 } 5899 5900 var prefix_pos = 0; 5901 while (prefix_pos < prefix.length) { 5902 dst[idx++] = prefix[prefix_pos++]; 5903 } 5904 5905 word += skip; 5906 len -= skip; 5907 5908 if (t <= kOmitLast9) { 5909 len -= t; 5910 } 5911 5912 for (i = 0; i < len; i++) { 5913 dst[idx++] = BrotliDictionary.dictionary[word + i]; 5914 } 5915 5916 uppercase = idx - len; 5917 5918 if (t === kUppercaseFirst) { 5919 ToUpperCase(dst, uppercase); 5920 } else if (t === kUppercaseAll) { 5921 while (len > 0) { 5922 var step = ToUpperCase(dst, uppercase); 5923 uppercase += step; 5924 len -= step; 5925 } 5926 } 5927 5928 var suffix_pos = 0; 5929 while (suffix_pos < suffix.length) { 5930 dst[idx++] = suffix[suffix_pos++]; 5931 } 5932 5933 return idx - start_idx; 5934 } 5935 5936 },{"./dictionary":6}],12:[function(require,module,exports){ 5937 module.exports = require('./dec/decode').BrotliDecompressBuffer; 5938 5939 },{"./dec/decode":3}]},{},[12])(12) 5940 }); 5941 /* eslint-enable */ 5942 5943 5944 /***/ }), 5945 5946 /***/ 9681: 5947 /***/ ((module) => { 5948 5949 var characterMap = { 5950 "À": "A", 5951 "Á": "A", 5952 "Â": "A", 5953 "Ã": "A", 5954 "Ä": "A", 5955 "Å": "A", 5956 "Ấ": "A", 5957 "Ắ": "A", 5958 "Ẳ": "A", 5959 "Ẵ": "A", 5960 "Ặ": "A", 5961 "Æ": "AE", 5962 "Ầ": "A", 5963 "Ằ": "A", 5964 "Ȃ": "A", 5965 "Ả": "A", 5966 "Ạ": "A", 5967 "Ẩ": "A", 5968 "Ẫ": "A", 5969 "Ậ": "A", 5970 "Ç": "C", 5971 "Ḉ": "C", 5972 "È": "E", 5973 "É": "E", 5974 "Ê": "E", 5975 "Ë": "E", 5976 "Ế": "E", 5977 "Ḗ": "E", 5978 "Ề": "E", 5979 "Ḕ": "E", 5980 "Ḝ": "E", 5981 "Ȇ": "E", 5982 "Ẻ": "E", 5983 "Ẽ": "E", 5984 "Ẹ": "E", 5985 "Ể": "E", 5986 "Ễ": "E", 5987 "Ệ": "E", 5988 "Ì": "I", 5989 "Í": "I", 5990 "Î": "I", 5991 "Ï": "I", 5992 "Ḯ": "I", 5993 "Ȋ": "I", 5994 "Ỉ": "I", 5995 "Ị": "I", 5996 "Ð": "D", 5997 "Ñ": "N", 5998 "Ò": "O", 5999 "Ó": "O", 6000 "Ô": "O", 6001 "Õ": "O", 6002 "Ö": "O", 6003 "Ø": "O", 6004 "Ố": "O", 6005 "Ṍ": "O", 6006 "Ṓ": "O", 6007 "Ȏ": "O", 6008 "Ỏ": "O", 6009 "Ọ": "O", 6010 "Ổ": "O", 6011 "Ỗ": "O", 6012 "Ộ": "O", 6013 "Ờ": "O", 6014 "Ở": "O", 6015 "Ỡ": "O", 6016 "Ớ": "O", 6017 "Ợ": "O", 6018 "Ù": "U", 6019 "Ú": "U", 6020 "Û": "U", 6021 "Ü": "U", 6022 "Ủ": "U", 6023 "Ụ": "U", 6024 "Ử": "U", 6025 "Ữ": "U", 6026 "Ự": "U", 6027 "Ý": "Y", 6028 "à": "a", 6029 "á": "a", 6030 "â": "a", 6031 "ã": "a", 6032 "ä": "a", 6033 "å": "a", 6034 "ấ": "a", 6035 "ắ": "a", 6036 "ẳ": "a", 6037 "ẵ": "a", 6038 "ặ": "a", 6039 "æ": "ae", 6040 "ầ": "a", 6041 "ằ": "a", 6042 "ȃ": "a", 6043 "ả": "a", 6044 "ạ": "a", 6045 "ẩ": "a", 6046 "ẫ": "a", 6047 "ậ": "a", 6048 "ç": "c", 6049 "ḉ": "c", 6050 "è": "e", 6051 "é": "e", 6052 "ê": "e", 6053 "ë": "e", 6054 "ế": "e", 6055 "ḗ": "e", 6056 "ề": "e", 6057 "ḕ": "e", 6058 "ḝ": "e", 6059 "ȇ": "e", 6060 "ẻ": "e", 6061 "ẽ": "e", 6062 "ẹ": "e", 6063 "ể": "e", 6064 "ễ": "e", 6065 "ệ": "e", 6066 "ì": "i", 6067 "í": "i", 6068 "î": "i", 6069 "ï": "i", 6070 "ḯ": "i", 6071 "ȋ": "i", 6072 "ỉ": "i", 6073 "ị": "i", 6074 "ð": "d", 6075 "ñ": "n", 6076 "ò": "o", 6077 "ó": "o", 6078 "ô": "o", 6079 "õ": "o", 6080 "ö": "o", 6081 "ø": "o", 6082 "ố": "o", 6083 "ṍ": "o", 6084 "ṓ": "o", 6085 "ȏ": "o", 6086 "ỏ": "o", 6087 "ọ": "o", 6088 "ổ": "o", 6089 "ỗ": "o", 6090 "ộ": "o", 6091 "ờ": "o", 6092 "ở": "o", 6093 "ỡ": "o", 6094 "ớ": "o", 6095 "ợ": "o", 6096 "ù": "u", 6097 "ú": "u", 6098 "û": "u", 6099 "ü": "u", 6100 "ủ": "u", 6101 "ụ": "u", 6102 "ử": "u", 6103 "ữ": "u", 6104 "ự": "u", 6105 "ý": "y", 6106 "ÿ": "y", 6107 "Ā": "A", 6108 "ā": "a", 6109 "Ă": "A", 6110 "ă": "a", 6111 "Ą": "A", 6112 "ą": "a", 6113 "Ć": "C", 6114 "ć": "c", 6115 "Ĉ": "C", 6116 "ĉ": "c", 6117 "Ċ": "C", 6118 "ċ": "c", 6119 "Č": "C", 6120 "č": "c", 6121 "C̆": "C", 6122 "c̆": "c", 6123 "Ď": "D", 6124 "ď": "d", 6125 "Đ": "D", 6126 "đ": "d", 6127 "Ē": "E", 6128 "ē": "e", 6129 "Ĕ": "E", 6130 "ĕ": "e", 6131 "Ė": "E", 6132 "ė": "e", 6133 "Ę": "E", 6134 "ę": "e", 6135 "Ě": "E", 6136 "ě": "e", 6137 "Ĝ": "G", 6138 "Ǵ": "G", 6139 "ĝ": "g", 6140 "ǵ": "g", 6141 "Ğ": "G", 6142 "ğ": "g", 6143 "Ġ": "G", 6144 "ġ": "g", 6145 "Ģ": "G", 6146 "ģ": "g", 6147 "Ĥ": "H", 6148 "ĥ": "h", 6149 "Ħ": "H", 6150 "ħ": "h", 6151 "Ḫ": "H", 6152 "ḫ": "h", 6153 "Ĩ": "I", 6154 "ĩ": "i", 6155 "Ī": "I", 6156 "ī": "i", 6157 "Ĭ": "I", 6158 "ĭ": "i", 6159 "Į": "I", 6160 "į": "i", 6161 "İ": "I", 6162 "ı": "i", 6163 "IJ": "IJ", 6164 "ij": "ij", 6165 "Ĵ": "J", 6166 "ĵ": "j", 6167 "Ķ": "K", 6168 "ķ": "k", 6169 "Ḱ": "K", 6170 "ḱ": "k", 6171 "K̆": "K", 6172 "k̆": "k", 6173 "Ĺ": "L", 6174 "ĺ": "l", 6175 "Ļ": "L", 6176 "ļ": "l", 6177 "Ľ": "L", 6178 "ľ": "l", 6179 "Ŀ": "L", 6180 "ŀ": "l", 6181 "Ł": "l", 6182 "ł": "l", 6183 "Ḿ": "M", 6184 "ḿ": "m", 6185 "M̆": "M", 6186 "m̆": "m", 6187 "Ń": "N", 6188 "ń": "n", 6189 "Ņ": "N", 6190 "ņ": "n", 6191 "Ň": "N", 6192 "ň": "n", 6193 "ʼn": "n", 6194 "N̆": "N", 6195 "n̆": "n", 6196 "Ō": "O", 6197 "ō": "o", 6198 "Ŏ": "O", 6199 "ŏ": "o", 6200 "Ő": "O", 6201 "ő": "o", 6202 "Œ": "OE", 6203 "œ": "oe", 6204 "P̆": "P", 6205 "p̆": "p", 6206 "Ŕ": "R", 6207 "ŕ": "r", 6208 "Ŗ": "R", 6209 "ŗ": "r", 6210 "Ř": "R", 6211 "ř": "r", 6212 "R̆": "R", 6213 "r̆": "r", 6214 "Ȓ": "R", 6215 "ȓ": "r", 6216 "Ś": "S", 6217 "ś": "s", 6218 "Ŝ": "S", 6219 "ŝ": "s", 6220 "Ş": "S", 6221 "Ș": "S", 6222 "ș": "s", 6223 "ş": "s", 6224 "Š": "S", 6225 "š": "s", 6226 "Ţ": "T", 6227 "ţ": "t", 6228 "ț": "t", 6229 "Ț": "T", 6230 "Ť": "T", 6231 "ť": "t", 6232 "Ŧ": "T", 6233 "ŧ": "t", 6234 "T̆": "T", 6235 "t̆": "t", 6236 "Ũ": "U", 6237 "ũ": "u", 6238 "Ū": "U", 6239 "ū": "u", 6240 "Ŭ": "U", 6241 "ŭ": "u", 6242 "Ů": "U", 6243 "ů": "u", 6244 "Ű": "U", 6245 "ű": "u", 6246 "Ų": "U", 6247 "ų": "u", 6248 "Ȗ": "U", 6249 "ȗ": "u", 6250 "V̆": "V", 6251 "v̆": "v", 6252 "Ŵ": "W", 6253 "ŵ": "w", 6254 "Ẃ": "W", 6255 "ẃ": "w", 6256 "X̆": "X", 6257 "x̆": "x", 6258 "Ŷ": "Y", 6259 "ŷ": "y", 6260 "Ÿ": "Y", 6261 "Y̆": "Y", 6262 "y̆": "y", 6263 "Ź": "Z", 6264 "ź": "z", 6265 "Ż": "Z", 6266 "ż": "z", 6267 "Ž": "Z", 6268 "ž": "z", 6269 "ſ": "s", 6270 "ƒ": "f", 6271 "Ơ": "O", 6272 "ơ": "o", 6273 "Ư": "U", 6274 "ư": "u", 6275 "Ǎ": "A", 6276 "ǎ": "a", 6277 "Ǐ": "I", 6278 "ǐ": "i", 6279 "Ǒ": "O", 6280 "ǒ": "o", 6281 "Ǔ": "U", 6282 "ǔ": "u", 6283 "Ǖ": "U", 6284 "ǖ": "u", 6285 "Ǘ": "U", 6286 "ǘ": "u", 6287 "Ǚ": "U", 6288 "ǚ": "u", 6289 "Ǜ": "U", 6290 "ǜ": "u", 6291 "Ứ": "U", 6292 "ứ": "u", 6293 "Ṹ": "U", 6294 "ṹ": "u", 6295 "Ǻ": "A", 6296 "ǻ": "a", 6297 "Ǽ": "AE", 6298 "ǽ": "ae", 6299 "Ǿ": "O", 6300 "ǿ": "o", 6301 "Þ": "TH", 6302 "þ": "th", 6303 "Ṕ": "P", 6304 "ṕ": "p", 6305 "Ṥ": "S", 6306 "ṥ": "s", 6307 "X́": "X", 6308 "x́": "x", 6309 "Ѓ": "Г", 6310 "ѓ": "г", 6311 "Ќ": "К", 6312 "ќ": "к", 6313 "A̋": "A", 6314 "a̋": "a", 6315 "E̋": "E", 6316 "e̋": "e", 6317 "I̋": "I", 6318 "i̋": "i", 6319 "Ǹ": "N", 6320 "ǹ": "n", 6321 "Ồ": "O", 6322 "ồ": "o", 6323 "Ṑ": "O", 6324 "ṑ": "o", 6325 "Ừ": "U", 6326 "ừ": "u", 6327 "Ẁ": "W", 6328 "ẁ": "w", 6329 "Ỳ": "Y", 6330 "ỳ": "y", 6331 "Ȁ": "A", 6332 "ȁ": "a", 6333 "Ȅ": "E", 6334 "ȅ": "e", 6335 "Ȉ": "I", 6336 "ȉ": "i", 6337 "Ȍ": "O", 6338 "ȍ": "o", 6339 "Ȑ": "R", 6340 "ȑ": "r", 6341 "Ȕ": "U", 6342 "ȕ": "u", 6343 "B̌": "B", 6344 "b̌": "b", 6345 "Č̣": "C", 6346 "č̣": "c", 6347 "Ê̌": "E", 6348 "ê̌": "e", 6349 "F̌": "F", 6350 "f̌": "f", 6351 "Ǧ": "G", 6352 "ǧ": "g", 6353 "Ȟ": "H", 6354 "ȟ": "h", 6355 "J̌": "J", 6356 "ǰ": "j", 6357 "Ǩ": "K", 6358 "ǩ": "k", 6359 "M̌": "M", 6360 "m̌": "m", 6361 "P̌": "P", 6362 "p̌": "p", 6363 "Q̌": "Q", 6364 "q̌": "q", 6365 "Ř̩": "R", 6366 "ř̩": "r", 6367 "Ṧ": "S", 6368 "ṧ": "s", 6369 "V̌": "V", 6370 "v̌": "v", 6371 "W̌": "W", 6372 "w̌": "w", 6373 "X̌": "X", 6374 "x̌": "x", 6375 "Y̌": "Y", 6376 "y̌": "y", 6377 "A̧": "A", 6378 "a̧": "a", 6379 "B̧": "B", 6380 "b̧": "b", 6381 "Ḑ": "D", 6382 "ḑ": "d", 6383 "Ȩ": "E", 6384 "ȩ": "e", 6385 "Ɛ̧": "E", 6386 "ɛ̧": "e", 6387 "Ḩ": "H", 6388 "ḩ": "h", 6389 "I̧": "I", 6390 "i̧": "i", 6391 "Ɨ̧": "I", 6392 "ɨ̧": "i", 6393 "M̧": "M", 6394 "m̧": "m", 6395 "O̧": "O", 6396 "o̧": "o", 6397 "Q̧": "Q", 6398 "q̧": "q", 6399 "U̧": "U", 6400 "u̧": "u", 6401 "X̧": "X", 6402 "x̧": "x", 6403 "Z̧": "Z", 6404 "z̧": "z", 6405 "й":"и", 6406 "Й":"И", 6407 "ё":"е", 6408 "Ё":"Е", 6409 }; 6410 6411 var chars = Object.keys(characterMap).join('|'); 6412 var allAccents = new RegExp(chars, 'g'); 6413 var firstAccent = new RegExp(chars, ''); 6414 6415 function matcher(match) { 6416 return characterMap[match]; 6417 } 6418 6419 var removeAccents = function(string) { 6420 return string.replace(allAccents, matcher); 6421 }; 6422 6423 var hasAccents = function(string) { 6424 return !!string.match(firstAccent); 6425 }; 6426 6427 module.exports = removeAccents; 6428 module.exports.has = hasAccents; 6429 module.exports.remove = removeAccents; 6430 6431 6432 /***/ }) 6433 6434 /******/ }); 6435 /************************************************************************/ 6436 /******/ // The module cache 6437 /******/ var __webpack_module_cache__ = {}; 6438 /******/ 6439 /******/ // The require function 6440 /******/ function __webpack_require__(moduleId) { 6441 /******/ // Check if module is in cache 6442 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 6443 /******/ if (cachedModule !== undefined) { 6444 /******/ return cachedModule.exports; 6445 /******/ } 6446 /******/ // Create a new module (and put it into the cache) 6447 /******/ var module = __webpack_module_cache__[moduleId] = { 6448 /******/ // no module.id needed 6449 /******/ // no module.loaded needed 6450 /******/ exports: {} 6451 /******/ }; 6452 /******/ 6453 /******/ // Execute the module function 6454 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 6455 /******/ 6456 /******/ // Return the exports of the module 6457 /******/ return module.exports; 6458 /******/ } 6459 /******/ 6460 /************************************************************************/ 6461 /******/ /* webpack/runtime/compat get default export */ 6462 /******/ (() => { 6463 /******/ // getDefaultExport function for compatibility with non-harmony modules 6464 /******/ __webpack_require__.n = (module) => { 6465 /******/ var getter = module && module.__esModule ? 6466 /******/ () => (module['default']) : 6467 /******/ () => (module); 6468 /******/ __webpack_require__.d(getter, { a: getter }); 6469 /******/ return getter; 6470 /******/ }; 6471 /******/ })(); 6472 /******/ 6473 /******/ /* webpack/runtime/create fake namespace object */ 6474 /******/ (() => { 6475 /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); 6476 /******/ var leafPrototypes; 6477 /******/ // create a fake namespace object 6478 /******/ // mode & 1: value is a module id, require it 6479 /******/ // mode & 2: merge all properties of value into the ns 6480 /******/ // mode & 4: return value when already ns object 6481 /******/ // mode & 16: return value when it's Promise-like 6482 /******/ // mode & 8|1: behave like require 6483 /******/ __webpack_require__.t = function(value, mode) { 6484 /******/ if(mode & 1) value = this(value); 6485 /******/ if(mode & 8) return value; 6486 /******/ if(typeof value === 'object' && value) { 6487 /******/ if((mode & 4) && value.__esModule) return value; 6488 /******/ if((mode & 16) && typeof value.then === 'function') return value; 6489 /******/ } 6490 /******/ var ns = Object.create(null); 6491 /******/ __webpack_require__.r(ns); 6492 /******/ var def = {}; 6493 /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; 6494 /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { 6495 /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); 6496 /******/ } 6497 /******/ def['default'] = () => (value); 6498 /******/ __webpack_require__.d(ns, def); 6499 /******/ return ns; 6500 /******/ }; 6501 /******/ })(); 6502 /******/ 6503 /******/ /* webpack/runtime/define property getters */ 6504 /******/ (() => { 6505 /******/ // define getter functions for harmony exports 6506 /******/ __webpack_require__.d = (exports, definition) => { 6507 /******/ for(var key in definition) { 6508 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 6509 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 6510 /******/ } 6511 /******/ } 6512 /******/ }; 6513 /******/ })(); 6514 /******/ 6515 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 6516 /******/ (() => { 6517 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 6518 /******/ })(); 6519 /******/ 6520 /******/ /* webpack/runtime/make namespace object */ 6521 /******/ (() => { 6522 /******/ // define __esModule on exports 6523 /******/ __webpack_require__.r = (exports) => { 6524 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 6525 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 6526 /******/ } 6527 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 6528 /******/ }; 6529 /******/ })(); 6530 /******/ 6531 /************************************************************************/ 6532 var __webpack_exports__ = {}; 6533 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 6534 (() => { 6535 "use strict"; 6536 // ESM COMPAT FLAG 6537 __webpack_require__.r(__webpack_exports__); 6538 6539 // EXPORTS 6540 __webpack_require__.d(__webpack_exports__, { 6541 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), 6542 PluginSidebar: () => (/* reexport */ PluginSidebar), 6543 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 6544 PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel_default), 6545 initializeEditor: () => (/* binding */ initializeEditor), 6546 initializePostsDashboard: () => (/* reexport */ initializePostsDashboard), 6547 reinitializeEditor: () => (/* binding */ reinitializeEditor), 6548 store: () => (/* reexport */ store) 6549 }); 6550 6551 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js 6552 var actions_namespaceObject = {}; 6553 __webpack_require__.r(actions_namespaceObject); 6554 __webpack_require__.d(actions_namespaceObject, { 6555 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), 6556 addTemplate: () => (addTemplate), 6557 closeGeneralSidebar: () => (closeGeneralSidebar), 6558 openGeneralSidebar: () => (openGeneralSidebar), 6559 openNavigationPanelToMenu: () => (openNavigationPanelToMenu), 6560 removeTemplate: () => (removeTemplate), 6561 revertTemplate: () => (revertTemplate), 6562 setEditedEntity: () => (setEditedEntity), 6563 setEditedPostContext: () => (setEditedPostContext), 6564 setHasPageContentFocus: () => (setHasPageContentFocus), 6565 setHomeTemplateId: () => (setHomeTemplateId), 6566 setIsInserterOpened: () => (setIsInserterOpened), 6567 setIsListViewOpened: () => (setIsListViewOpened), 6568 setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened), 6569 setIsSaveViewOpened: () => (setIsSaveViewOpened), 6570 setNavigationMenu: () => (setNavigationMenu), 6571 setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu), 6572 setPage: () => (setPage), 6573 setTemplate: () => (setTemplate), 6574 setTemplatePart: () => (setTemplatePart), 6575 switchEditorMode: () => (switchEditorMode), 6576 toggleDistractionFree: () => (toggleDistractionFree), 6577 toggleFeature: () => (toggleFeature), 6578 updateSettings: () => (updateSettings) 6579 }); 6580 6581 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 6582 var private_actions_namespaceObject = {}; 6583 __webpack_require__.r(private_actions_namespaceObject); 6584 __webpack_require__.d(private_actions_namespaceObject, { 6585 registerRoute: () => (registerRoute), 6586 setEditorCanvasContainerView: () => (setEditorCanvasContainerView), 6587 unregisterRoute: () => (unregisterRoute) 6588 }); 6589 6590 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 6591 var selectors_namespaceObject = {}; 6592 __webpack_require__.r(selectors_namespaceObject); 6593 __webpack_require__.d(selectors_namespaceObject, { 6594 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), 6595 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), 6596 getCanUserCreateMedia: () => (getCanUserCreateMedia), 6597 getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu), 6598 getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts), 6599 getEditedPostContext: () => (getEditedPostContext), 6600 getEditedPostId: () => (getEditedPostId), 6601 getEditedPostType: () => (getEditedPostType), 6602 getEditorMode: () => (getEditorMode), 6603 getHomeTemplateId: () => (getHomeTemplateId), 6604 getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu), 6605 getPage: () => (getPage), 6606 getReusableBlocks: () => (getReusableBlocks), 6607 getSettings: () => (getSettings), 6608 hasPageContentFocus: () => (hasPageContentFocus), 6609 isFeatureActive: () => (isFeatureActive), 6610 isInserterOpened: () => (isInserterOpened), 6611 isListViewOpened: () => (isListViewOpened), 6612 isNavigationOpened: () => (isNavigationOpened), 6613 isPage: () => (isPage), 6614 isSaveViewOpened: () => (isSaveViewOpened) 6615 }); 6616 6617 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 6618 var private_selectors_namespaceObject = {}; 6619 __webpack_require__.r(private_selectors_namespaceObject); 6620 __webpack_require__.d(private_selectors_namespaceObject, { 6621 getEditorCanvasContainerView: () => (getEditorCanvasContainerView), 6622 getRoutes: () => (getRoutes) 6623 }); 6624 6625 ;// external "ReactJSXRuntime" 6626 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 6627 ;// external ["wp","blocks"] 6628 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 6629 ;// external ["wp","blockLibrary"] 6630 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 6631 // EXTERNAL MODULE: external ["wp","data"] 6632 var external_wp_data_ = __webpack_require__(7143); 6633 ;// external ["wp","deprecated"] 6634 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 6635 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 6636 // EXTERNAL MODULE: external ["wp","element"] 6637 var external_wp_element_ = __webpack_require__(6087); 6638 ;// external ["wp","editor"] 6639 const external_wp_editor_namespaceObject = window["wp"]["editor"]; 6640 // EXTERNAL MODULE: external ["wp","preferences"] 6641 var external_wp_preferences_ = __webpack_require__(1233); 6642 ;// external ["wp","widgets"] 6643 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; 6644 ;// external ["wp","hooks"] 6645 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 6646 ;// external ["wp","compose"] 6647 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 6648 ;// external ["wp","blockEditor"] 6649 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 6650 ;// external ["wp","components"] 6651 const external_wp_components_namespaceObject = window["wp"]["components"]; 6652 ;// external ["wp","i18n"] 6653 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 6654 ;// external ["wp","notices"] 6655 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 6656 ;// external ["wp","coreData"] 6657 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 6658 ;// ./node_modules/colord/index.mjs 6659 var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; 6660 6661 ;// ./node_modules/colord/plugins/a11y.mjs 6662 var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} 6663 6664 ;// external ["wp","privateApis"] 6665 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 6666 ;// ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js 6667 6668 const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 6669 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 6670 "@wordpress/edit-site" 6671 ); 6672 6673 6674 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js 6675 6676 6677 6678 6679 6680 6681 const { useGlobalSetting, useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6682 k([a11y]); 6683 function useColorRandomizer(name) { 6684 const [themeColors, setThemeColors] = useGlobalSetting( 6685 "color.palette.theme", 6686 name 6687 ); 6688 function randomizeColors() { 6689 const randomRotationValue = Math.floor(Math.random() * 225); 6690 const newColors = themeColors.map((colorObject) => { 6691 const { color } = colorObject; 6692 const newColor = w(color).rotate(randomRotationValue).toHex(); 6693 return { 6694 ...colorObject, 6695 color: newColor 6696 }; 6697 }); 6698 setThemeColors(newColors); 6699 } 6700 return window.__experimentalEnableColorRandomizer ? [randomizeColors] : []; 6701 } 6702 function useStylesPreviewColors() { 6703 const [textColor = "black"] = useGlobalStyle("color.text"); 6704 const [backgroundColor = "white"] = useGlobalStyle("color.background"); 6705 const [headingColor = textColor] = useGlobalStyle( 6706 "elements.h1.color.text" 6707 ); 6708 const [linkColor = headingColor] = useGlobalStyle( 6709 "elements.link.color.text" 6710 ); 6711 const [buttonBackgroundColor = linkColor] = useGlobalStyle( 6712 "elements.button.color.background" 6713 ); 6714 const [coreColors] = useGlobalSetting("color.palette.core"); 6715 const [themeColors] = useGlobalSetting("color.palette.theme"); 6716 const [customColors] = useGlobalSetting("color.palette.custom"); 6717 const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []); 6718 const textColorObject = paletteColors.filter( 6719 ({ color }) => color === textColor 6720 ); 6721 const buttonBackgroundColorObject = paletteColors.filter( 6722 ({ color }) => color === buttonBackgroundColor 6723 ); 6724 const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( 6725 // we exclude these background color because it is already visible in the preview. 6726 ({ color }) => color !== backgroundColor 6727 ).slice(0, 2); 6728 return { 6729 paletteColors, 6730 highlightedColors 6731 }; 6732 } 6733 function useSupportedStyles(name, element) { 6734 const { supportedPanels } = (0,external_wp_data_.useSelect)( 6735 (select) => { 6736 return { 6737 supportedPanels: unlock( 6738 select(external_wp_blocks_namespaceObject.store) 6739 ).getSupportedStyles(name, element) 6740 }; 6741 }, 6742 [name, element] 6743 ); 6744 return supportedPanels; 6745 } 6746 6747 6748 ;// ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js 6749 function setNestedValue(object, path, value) { 6750 if (!object || typeof object !== "object") { 6751 return object; 6752 } 6753 path.reduce((acc, key, idx) => { 6754 if (acc[key] === void 0) { 6755 if (Number.isInteger(path[idx + 1])) { 6756 acc[key] = []; 6757 } else { 6758 acc[key] = {}; 6759 } 6760 } 6761 if (idx === path.length - 1) { 6762 acc[key] = value; 6763 } 6764 return acc[key]; 6765 }, object); 6766 return object; 6767 } 6768 6769 6770 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 const { cleanEmptyObject, GlobalStylesContext } = unlock( 6786 external_wp_blockEditor_namespaceObject.privateApis 6787 ); 6788 const STYLE_PROPERTY = { 6789 ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, 6790 blockGap: { value: ["spacing", "blockGap"] } 6791 }; 6792 const STYLE_PATH_TO_CSS_VAR_INFIX = { 6793 "border.color": "color", 6794 "color.background": "color", 6795 "color.text": "color", 6796 "elements.link.color.text": "color", 6797 "elements.link.:hover.color.text": "color", 6798 "elements.link.typography.fontFamily": "font-family", 6799 "elements.link.typography.fontSize": "font-size", 6800 "elements.button.color.text": "color", 6801 "elements.button.color.background": "color", 6802 "elements.button.typography.fontFamily": "font-family", 6803 "elements.button.typography.fontSize": "font-size", 6804 "elements.caption.color.text": "color", 6805 "elements.heading.color": "color", 6806 "elements.heading.color.background": "color", 6807 "elements.heading.typography.fontFamily": "font-family", 6808 "elements.heading.gradient": "gradient", 6809 "elements.heading.color.gradient": "gradient", 6810 "elements.h1.color": "color", 6811 "elements.h1.color.background": "color", 6812 "elements.h1.typography.fontFamily": "font-family", 6813 "elements.h1.color.gradient": "gradient", 6814 "elements.h2.color": "color", 6815 "elements.h2.color.background": "color", 6816 "elements.h2.typography.fontFamily": "font-family", 6817 "elements.h2.color.gradient": "gradient", 6818 "elements.h3.color": "color", 6819 "elements.h3.color.background": "color", 6820 "elements.h3.typography.fontFamily": "font-family", 6821 "elements.h3.color.gradient": "gradient", 6822 "elements.h4.color": "color", 6823 "elements.h4.color.background": "color", 6824 "elements.h4.typography.fontFamily": "font-family", 6825 "elements.h4.color.gradient": "gradient", 6826 "elements.h5.color": "color", 6827 "elements.h5.color.background": "color", 6828 "elements.h5.typography.fontFamily": "font-family", 6829 "elements.h5.color.gradient": "gradient", 6830 "elements.h6.color": "color", 6831 "elements.h6.color.background": "color", 6832 "elements.h6.typography.fontFamily": "font-family", 6833 "elements.h6.color.gradient": "gradient", 6834 "color.gradient": "gradient", 6835 blockGap: "spacing", 6836 "typography.fontSize": "font-size", 6837 "typography.fontFamily": "font-family" 6838 }; 6839 const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 6840 "border.color": "borderColor", 6841 "color.background": "backgroundColor", 6842 "color.text": "textColor", 6843 "color.gradient": "gradient", 6844 "typography.fontSize": "fontSize", 6845 "typography.fontFamily": "fontFamily" 6846 }; 6847 const SUPPORTED_STYLES = ["border", "color", "spacing", "typography"]; 6848 const getValueFromObjectPath = (object, path) => { 6849 let value = object; 6850 path.forEach((fieldName) => { 6851 value = value?.[fieldName]; 6852 }); 6853 return value; 6854 }; 6855 const flatBorderProperties = ["borderColor", "borderWidth", "borderStyle"]; 6856 const sides = ["top", "right", "bottom", "left"]; 6857 function getBorderStyleChanges(border, presetColor, userStyle) { 6858 if (!border && !presetColor) { 6859 return []; 6860 } 6861 const changes = [ 6862 ...getFallbackBorderStyleChange("top", border, userStyle), 6863 ...getFallbackBorderStyleChange("right", border, userStyle), 6864 ...getFallbackBorderStyleChange("bottom", border, userStyle), 6865 ...getFallbackBorderStyleChange("left", border, userStyle) 6866 ]; 6867 const { color: customColor, style, width } = border || {}; 6868 const hasColorOrWidth = presetColor || customColor || width; 6869 if (hasColorOrWidth && !style) { 6870 sides.forEach((side) => { 6871 if (!userStyle?.[side]?.style) { 6872 changes.push({ 6873 path: ["border", side, "style"], 6874 value: "solid" 6875 }); 6876 } 6877 }); 6878 } 6879 return changes; 6880 } 6881 function getFallbackBorderStyleChange(side, border, globalBorderStyle) { 6882 if (!border?.[side] || globalBorderStyle?.[side]?.style) { 6883 return []; 6884 } 6885 const { color, style, width } = border[side]; 6886 const hasColorOrWidth = color || width; 6887 if (!hasColorOrWidth || style) { 6888 return []; 6889 } 6890 return [{ path: ["border", side, "style"], value: "solid" }]; 6891 } 6892 function useChangesToPush(name, attributes, userConfig) { 6893 const supports = useSupportedStyles(name); 6894 const blockUserConfig = userConfig?.styles?.blocks?.[name]; 6895 return (0,external_wp_element_.useMemo)(() => { 6896 const changes = supports.flatMap((key) => { 6897 if (!STYLE_PROPERTY[key]) { 6898 return []; 6899 } 6900 const { value: path } = STYLE_PROPERTY[key]; 6901 const presetAttributeKey = path.join("."); 6902 const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]]; 6903 const value = presetAttributeValue ? `var:preset|$STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|$presetAttributeValue}` : getValueFromObjectPath(attributes.style, path); 6904 if (key === "linkColor") { 6905 const linkChanges = value ? [{ path, value }] : []; 6906 const hoverPath = [ 6907 "elements", 6908 "link", 6909 ":hover", 6910 "color", 6911 "text" 6912 ]; 6913 const hoverValue = getValueFromObjectPath( 6914 attributes.style, 6915 hoverPath 6916 ); 6917 if (hoverValue) { 6918 linkChanges.push({ path: hoverPath, value: hoverValue }); 6919 } 6920 return linkChanges; 6921 } 6922 if (flatBorderProperties.includes(key) && value) { 6923 const borderChanges = [{ path, value }]; 6924 sides.forEach((side) => { 6925 const currentPath = [...path]; 6926 currentPath.splice(-1, 0, side); 6927 borderChanges.push({ path: currentPath, value }); 6928 }); 6929 return borderChanges; 6930 } 6931 return value ? [{ path, value }] : []; 6932 }); 6933 getBorderStyleChanges( 6934 attributes.style?.border, 6935 attributes.borderColor, 6936 blockUserConfig?.border 6937 ).forEach((change) => changes.push(change)); 6938 return changes; 6939 }, [supports, attributes, blockUserConfig]); 6940 } 6941 function PushChangesToGlobalStylesControl({ 6942 name, 6943 attributes, 6944 setAttributes 6945 }) { 6946 const { user: userConfig, setUserConfig } = (0,external_wp_element_.useContext)(GlobalStylesContext); 6947 const changes = useChangesToPush(name, attributes, userConfig); 6948 const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); 6949 const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 6950 const pushChanges = (0,external_wp_element_.useCallback)(() => { 6951 if (changes.length === 0) { 6952 return; 6953 } 6954 if (changes.length > 0) { 6955 const { style: blockStyles } = attributes; 6956 const newBlockStyles = structuredClone(blockStyles); 6957 const newUserConfig = structuredClone(userConfig); 6958 for (const { path, value } of changes) { 6959 setNestedValue(newBlockStyles, path, void 0); 6960 setNestedValue( 6961 newUserConfig, 6962 ["styles", "blocks", name, ...path], 6963 value 6964 ); 6965 } 6966 const newBlockAttributes = { 6967 borderColor: void 0, 6968 backgroundColor: void 0, 6969 textColor: void 0, 6970 gradient: void 0, 6971 fontSize: void 0, 6972 fontFamily: void 0, 6973 style: cleanEmptyObject(newBlockStyles) 6974 }; 6975 __unstableMarkNextChangeAsNotPersistent(); 6976 setAttributes(newBlockAttributes); 6977 setUserConfig(newUserConfig, { undoIgnore: true }); 6978 createSuccessNotice( 6979 (0,external_wp_i18n_namespaceObject.sprintf)( 6980 // translators: %s: Title of the block e.g. 'Heading'. 6981 (0,external_wp_i18n_namespaceObject.__)("%s styles applied."), 6982 (0,external_wp_blocks_namespaceObject.getBlockType)(name).title 6983 ), 6984 { 6985 type: "snackbar", 6986 actions: [ 6987 { 6988 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 6989 onClick() { 6990 __unstableMarkNextChangeAsNotPersistent(); 6991 setAttributes(attributes); 6992 setUserConfig(userConfig, { 6993 undoIgnore: true 6994 }); 6995 } 6996 } 6997 ] 6998 } 6999 ); 7000 } 7001 }, [ 7002 __unstableMarkNextChangeAsNotPersistent, 7003 attributes, 7004 changes, 7005 createSuccessNotice, 7006 name, 7007 setAttributes, 7008 setUserConfig, 7009 userConfig 7010 ]); 7011 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 7012 external_wp_components_namespaceObject.BaseControl, 7013 { 7014 __nextHasNoMarginBottom: true, 7015 className: "edit-site-push-changes-to-global-styles-control", 7016 help: (0,external_wp_i18n_namespaceObject.sprintf)( 7017 // translators: %s: Title of the block e.g. 'Heading'. 7018 (0,external_wp_i18n_namespaceObject.__)( 7019 "Apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks." 7020 ), 7021 (0,external_wp_blocks_namespaceObject.getBlockType)(name).title 7022 ), 7023 children: [ 7024 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Styles") }), 7025 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7026 external_wp_components_namespaceObject.Button, 7027 { 7028 __next40pxDefaultSize: true, 7029 variant: "secondary", 7030 accessibleWhenDisabled: true, 7031 disabled: changes.length === 0, 7032 onClick: pushChanges, 7033 children: (0,external_wp_i18n_namespaceObject.__)("Apply globally") 7034 } 7035 ) 7036 ] 7037 } 7038 ); 7039 } 7040 function PushChangesToGlobalStyles(props) { 7041 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 7042 const isBlockBasedTheme = (0,external_wp_data_.useSelect)( 7043 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, 7044 [] 7045 ); 7046 const supportsStyles = SUPPORTED_STYLES.some( 7047 (feature) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature) 7048 ); 7049 const isDisplayed = blockEditingMode === "default" && supportsStyles && isBlockBasedTheme; 7050 if (!isDisplayed) { 7051 return null; 7052 } 7053 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { ...props }) }); 7054 } 7055 const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 7056 (BlockEdit) => (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 7057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), 7058 props.isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { ...props }) 7059 ] }) 7060 ); 7061 (0,external_wp_hooks_namespaceObject.addFilter)( 7062 "editor.BlockEdit", 7063 "core/edit-site/push-changes-to-global-styles", 7064 withPushChangesToGlobalStyles 7065 ); 7066 7067 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/index.js 7068 7069 7070 ;// ./node_modules/@wordpress/edit-site/build-module/store/reducer.js 7071 7072 function settings(state = {}, action) { 7073 switch (action.type) { 7074 case "UPDATE_SETTINGS": 7075 return { 7076 ...state, 7077 ...action.settings 7078 }; 7079 } 7080 return state; 7081 } 7082 function editedPost(state = {}, action) { 7083 switch (action.type) { 7084 case "SET_EDITED_POST": 7085 return { 7086 postType: action.postType, 7087 id: action.id, 7088 context: action.context 7089 }; 7090 case "SET_EDITED_POST_CONTEXT": 7091 return { 7092 ...state, 7093 context: action.context 7094 }; 7095 } 7096 return state; 7097 } 7098 function saveViewPanel(state = false, action) { 7099 switch (action.type) { 7100 case "SET_IS_SAVE_VIEW_OPENED": 7101 return action.isOpen; 7102 } 7103 return state; 7104 } 7105 function editorCanvasContainerView(state = void 0, action) { 7106 switch (action.type) { 7107 case "SET_EDITOR_CANVAS_CONTAINER_VIEW": 7108 return action.view; 7109 } 7110 return state; 7111 } 7112 function routes(state = [], action) { 7113 switch (action.type) { 7114 case "REGISTER_ROUTE": 7115 return [...state, action.route]; 7116 case "UNREGISTER_ROUTE": 7117 return state.filter((route) => route.name !== action.name); 7118 } 7119 return state; 7120 } 7121 var reducer_default = (0,external_wp_data_.combineReducers)({ 7122 settings, 7123 editedPost, 7124 saveViewPanel, 7125 editorCanvasContainerView, 7126 routes 7127 }); 7128 7129 7130 ;// external ["wp","patterns"] 7131 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 7132 ;// ./node_modules/@wordpress/edit-site/build-module/utils/constants.js 7133 7134 7135 7136 const NAVIGATION_POST_TYPE = "wp_navigation"; 7137 const TEMPLATE_POST_TYPE = "wp_template"; 7138 const TEMPLATE_PART_POST_TYPE = "wp_template_part"; 7139 const TEMPLATE_ORIGINS = { 7140 custom: "custom", 7141 theme: "theme", 7142 plugin: "plugin" 7143 }; 7144 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized"; 7145 const TEMPLATE_PART_ALL_AREAS_CATEGORY = "all-parts"; 7146 const { 7147 PATTERN_TYPES, 7148 PATTERN_DEFAULT_CATEGORY, 7149 PATTERN_USER_CATEGORY, 7150 EXCLUDED_PATTERN_SOURCES, 7151 PATTERN_SYNC_TYPES 7152 } = unlock(external_wp_patterns_namespaceObject.privateApis); 7153 const FOCUSABLE_ENTITIES = [ 7154 TEMPLATE_PART_POST_TYPE, 7155 NAVIGATION_POST_TYPE, 7156 PATTERN_TYPES.user 7157 ]; 7158 const POST_TYPE_LABELS = { 7159 [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template"), 7160 [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template part"), 7161 [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)("Pattern"), 7162 [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Navigation") 7163 }; 7164 const LAYOUT_GRID = "grid"; 7165 const LAYOUT_TABLE = "table"; 7166 const LAYOUT_LIST = "list"; 7167 const OPERATOR_IS = "is"; 7168 const OPERATOR_IS_NOT = "isNot"; 7169 const OPERATOR_IS_ANY = "isAny"; 7170 const OPERATOR_IS_NONE = "isNone"; 7171 7172 7173 ;// ./node_modules/@wordpress/edit-site/build-module/store/actions.js 7174 7175 7176 7177 7178 7179 7180 7181 7182 const { interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); 7183 function toggleFeature(featureName) { 7184 return function({ registry }) { 7185 external_wp_deprecated_default()( 7186 "dispatch( 'core/edit-site' ).toggleFeature( featureName )", 7187 { 7188 since: "6.0", 7189 alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )" 7190 } 7191 ); 7192 registry.dispatch(external_wp_preferences_.store).toggle("core/edit-site", featureName); 7193 }; 7194 } 7195 const __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => { 7196 external_wp_deprecated_default()( 7197 "dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType", 7198 { 7199 since: "6.5", 7200 version: "6.7", 7201 hint: "registry.dispatch( editorStore ).setDeviceType" 7202 } 7203 ); 7204 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); 7205 }; 7206 function setTemplate() { 7207 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", { 7208 since: "6.5", 7209 version: "6.8", 7210 hint: "The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically." 7211 }); 7212 return { 7213 type: "NOTHING" 7214 }; 7215 } 7216 const addTemplate = (template) => async ({ dispatch, registry }) => { 7217 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", { 7218 since: "6.5", 7219 version: "6.8", 7220 hint: "use saveEntityRecord directly" 7221 }); 7222 const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", TEMPLATE_POST_TYPE, template); 7223 if (template.content) { 7224 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( 7225 "postType", 7226 TEMPLATE_POST_TYPE, 7227 newTemplate.id, 7228 { blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) }, 7229 { undoIgnore: true } 7230 ); 7231 } 7232 dispatch({ 7233 type: "SET_EDITED_POST", 7234 postType: TEMPLATE_POST_TYPE, 7235 id: newTemplate.id 7236 }); 7237 }; 7238 const removeTemplate = (template) => ({ registry }) => { 7239 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([ 7240 template 7241 ]); 7242 }; 7243 function setTemplatePart(templatePartId) { 7244 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplatePart", { 7245 since: "6.8" 7246 }); 7247 return { 7248 type: "SET_EDITED_POST", 7249 postType: TEMPLATE_PART_POST_TYPE, 7250 id: templatePartId 7251 }; 7252 } 7253 function setNavigationMenu(navigationMenuId) { 7254 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationMenu", { 7255 since: "6.8" 7256 }); 7257 return { 7258 type: "SET_EDITED_POST", 7259 postType: NAVIGATION_POST_TYPE, 7260 id: navigationMenuId 7261 }; 7262 } 7263 function setEditedEntity(postType, postId, context) { 7264 return { 7265 type: "SET_EDITED_POST", 7266 postType, 7267 id: postId, 7268 context 7269 }; 7270 } 7271 function setHomeTemplateId() { 7272 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", { 7273 since: "6.2", 7274 version: "6.4" 7275 }); 7276 return { 7277 type: "NOTHING" 7278 }; 7279 } 7280 function setEditedPostContext(context) { 7281 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setEditedPostContext", { 7282 since: "6.8" 7283 }); 7284 return { 7285 type: "SET_EDITED_POST_CONTEXT", 7286 context 7287 }; 7288 } 7289 function setPage() { 7290 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", { 7291 since: "6.5", 7292 version: "6.8", 7293 hint: "The setPage is not needed anymore, the correct entity is resolved from the URL automatically." 7294 }); 7295 return { type: "NOTHING" }; 7296 } 7297 function setNavigationPanelActiveMenu() { 7298 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", { 7299 since: "6.2", 7300 version: "6.4" 7301 }); 7302 return { type: "NOTHING" }; 7303 } 7304 function openNavigationPanelToMenu() { 7305 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", { 7306 since: "6.2", 7307 version: "6.4" 7308 }); 7309 return { type: "NOTHING" }; 7310 } 7311 function setIsNavigationPanelOpened() { 7312 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", { 7313 since: "6.2", 7314 version: "6.4" 7315 }); 7316 return { type: "NOTHING" }; 7317 } 7318 const setIsInserterOpened = (value) => ({ registry }) => { 7319 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", { 7320 since: "6.5", 7321 alternative: "dispatch( 'core/editor').setIsInserterOpened" 7322 }); 7323 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); 7324 }; 7325 const setIsListViewOpened = (isOpen) => ({ registry }) => { 7326 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", { 7327 since: "6.5", 7328 alternative: "dispatch( 'core/editor').setIsListViewOpened" 7329 }); 7330 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); 7331 }; 7332 function updateSettings(settings) { 7333 return { 7334 type: "UPDATE_SETTINGS", 7335 settings 7336 }; 7337 } 7338 function setIsSaveViewOpened(isOpen) { 7339 return { 7340 type: "SET_IS_SAVE_VIEW_OPENED", 7341 isOpen 7342 }; 7343 } 7344 const revertTemplate = (template, options) => ({ registry }) => { 7345 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate( 7346 template, 7347 options 7348 ); 7349 }; 7350 const openGeneralSidebar = (name) => ({ registry }) => { 7351 registry.dispatch(interfaceStore).enableComplementaryArea("core", name); 7352 }; 7353 const closeGeneralSidebar = () => ({ registry }) => { 7354 registry.dispatch(interfaceStore).disableComplementaryArea("core"); 7355 }; 7356 const switchEditorMode = (mode) => ({ registry }) => { 7357 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", { 7358 since: "6.6", 7359 alternative: "dispatch( 'core/editor').switchEditorMode" 7360 }); 7361 registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); 7362 }; 7363 const setHasPageContentFocus = (hasPageContentFocus) => ({ dispatch, registry }) => { 7364 external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, { 7365 since: "6.5" 7366 }); 7367 if (hasPageContentFocus) { 7368 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 7369 } 7370 dispatch({ 7371 type: "SET_HAS_PAGE_CONTENT_FOCUS", 7372 hasPageContentFocus 7373 }); 7374 }; 7375 const toggleDistractionFree = () => ({ registry }) => { 7376 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", { 7377 since: "6.6", 7378 alternative: "dispatch( 'core/editor').toggleDistractionFree" 7379 }); 7380 registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); 7381 }; 7382 7383 7384 ;// ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 7385 const setEditorCanvasContainerView = (view) => ({ dispatch }) => { 7386 dispatch({ 7387 type: "SET_EDITOR_CANVAS_CONTAINER_VIEW", 7388 view 7389 }); 7390 }; 7391 function registerRoute(route) { 7392 return { 7393 type: "REGISTER_ROUTE", 7394 route 7395 }; 7396 } 7397 function unregisterRoute(name) { 7398 return { 7399 type: "UNREGISTER_ROUTE", 7400 name 7401 }; 7402 } 7403 7404 7405 ;// ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js 7406 7407 const EMPTY_ARRAY = []; 7408 function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { 7409 const templatePartsById = templateParts ? ( 7410 // Key template parts by their ID. 7411 templateParts.reduce( 7412 (newTemplateParts, part) => ({ 7413 ...newTemplateParts, 7414 [part.id]: part 7415 }), 7416 {} 7417 ) 7418 ) : {}; 7419 const result = []; 7420 const stack = [...blocks]; 7421 while (stack.length) { 7422 const { innerBlocks, ...block } = stack.shift(); 7423 stack.unshift(...innerBlocks); 7424 if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { 7425 const { 7426 attributes: { theme, slug } 7427 } = block; 7428 const templatePartId = `$theme}//${slug}`; 7429 const templatePart = templatePartsById[templatePartId]; 7430 if (templatePart) { 7431 result.push({ 7432 templatePart, 7433 block 7434 }); 7435 } 7436 } 7437 } 7438 return result; 7439 } 7440 7441 7442 ;// ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 const isFeatureActive = (0,external_wp_data_.createRegistrySelector)( 7454 (select) => (_, featureName) => { 7455 external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, { 7456 since: "6.0", 7457 alternative: `select( 'core/preferences' ).get` 7458 }); 7459 return !!select(external_wp_preferences_.store).get( 7460 "core/edit-site", 7461 featureName 7462 ); 7463 } 7464 ); 7465 const __experimentalGetPreviewDeviceType = (0,external_wp_data_.createRegistrySelector)( 7466 (select) => () => { 7467 external_wp_deprecated_default()( 7468 `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, 7469 { 7470 since: "6.5", 7471 version: "6.7", 7472 alternative: `select( 'core/editor' ).getDeviceType` 7473 } 7474 ); 7475 return select(external_wp_editor_namespaceObject.store).getDeviceType(); 7476 } 7477 ); 7478 const getCanUserCreateMedia = (0,external_wp_data_.createRegistrySelector)( 7479 (select) => () => { 7480 external_wp_deprecated_default()( 7481 `wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, 7482 { 7483 since: "6.7", 7484 alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )` 7485 } 7486 ); 7487 return select(external_wp_coreData_namespaceObject.store).canUser("create", "media"); 7488 } 7489 ); 7490 const getReusableBlocks = (0,external_wp_data_.createRegistrySelector)((select) => () => { 7491 external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, { 7492 since: "6.5", 7493 version: "6.8", 7494 alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )` 7495 }); 7496 const isWeb = external_wp_element_.Platform.OS === "web"; 7497 return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", "wp_block", { 7498 per_page: -1 7499 }) : []; 7500 }); 7501 function getSettings(state) { 7502 return state.settings; 7503 } 7504 function getHomeTemplateId() { 7505 external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", { 7506 since: "6.2", 7507 version: "6.4" 7508 }); 7509 } 7510 function getEditedPostType(state) { 7511 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostType", { 7512 since: "6.8", 7513 alternative: "select( 'core/editor' ).getCurrentPostType" 7514 }); 7515 return state.editedPost.postType; 7516 } 7517 function getEditedPostId(state) { 7518 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostId", { 7519 since: "6.8", 7520 alternative: "select( 'core/editor' ).getCurrentPostId" 7521 }); 7522 return state.editedPost.id; 7523 } 7524 function getEditedPostContext(state) { 7525 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostContext", { 7526 since: "6.8" 7527 }); 7528 return state.editedPost.context; 7529 } 7530 function getPage(state) { 7531 external_wp_deprecated_default()("select( 'core/edit-site' ).getPage", { 7532 since: "6.8" 7533 }); 7534 return { context: state.editedPost.context }; 7535 } 7536 const isInserterOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => { 7537 external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, { 7538 since: "6.5", 7539 alternative: `select( 'core/editor' ).isInserterOpened` 7540 }); 7541 return select(external_wp_editor_namespaceObject.store).isInserterOpened(); 7542 }); 7543 const __experimentalGetInsertionPoint = (0,external_wp_data_.createRegistrySelector)( 7544 (select) => () => { 7545 external_wp_deprecated_default()( 7546 `select( 'core/edit-site' ).__experimentalGetInsertionPoint`, 7547 { 7548 since: "6.5", 7549 version: "6.7" 7550 } 7551 ); 7552 return unlock(select(external_wp_editor_namespaceObject.store)).getInserter(); 7553 } 7554 ); 7555 const isListViewOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => { 7556 external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, { 7557 since: "6.5", 7558 alternative: `select( 'core/editor' ).isListViewOpened` 7559 }); 7560 return select(external_wp_editor_namespaceObject.store).isListViewOpened(); 7561 }); 7562 function isSaveViewOpened(state) { 7563 return state.saveViewPanel; 7564 } 7565 function getBlocksAndTemplateParts(select) { 7566 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords( 7567 "postType", 7568 TEMPLATE_PART_POST_TYPE, 7569 { per_page: -1 } 7570 ); 7571 const { getBlocksByName, getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store); 7572 const clientIds = getBlocksByName("core/template-part"); 7573 const blocks = getBlocksByClientId(clientIds); 7574 return [blocks, templateParts]; 7575 } 7576 const getCurrentTemplateTemplateParts = (0,external_wp_data_.createRegistrySelector)( 7577 (select) => (0,external_wp_data_.createSelector)( 7578 () => { 7579 external_wp_deprecated_default()( 7580 `select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, 7581 { 7582 since: "6.7", 7583 version: "6.9", 7584 alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )` 7585 } 7586 ); 7587 return getFilteredTemplatePartBlocks( 7588 ...getBlocksAndTemplateParts(select) 7589 ); 7590 }, 7591 () => getBlocksAndTemplateParts(select) 7592 ) 7593 ); 7594 const getEditorMode = (0,external_wp_data_.createRegistrySelector)((select) => () => { 7595 return select(external_wp_preferences_.store).get("core", "editorMode"); 7596 }); 7597 function getCurrentTemplateNavigationPanelSubMenu() { 7598 external_wp_deprecated_default()( 7599 "dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", 7600 { 7601 since: "6.2", 7602 version: "6.4" 7603 } 7604 ); 7605 } 7606 function getNavigationPanelActiveMenu() { 7607 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", { 7608 since: "6.2", 7609 version: "6.4" 7610 }); 7611 } 7612 function isNavigationOpened() { 7613 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", { 7614 since: "6.2", 7615 version: "6.4" 7616 }); 7617 } 7618 function isPage(state) { 7619 external_wp_deprecated_default()("select( 'core/edit-site' ).isPage", { 7620 since: "6.8", 7621 alternative: "select( 'core/editor' ).getCurrentPostType" 7622 }); 7623 return !!state.editedPost.context?.postId; 7624 } 7625 function hasPageContentFocus() { 7626 external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, { 7627 since: "6.5" 7628 }); 7629 return false; 7630 } 7631 7632 7633 ;// ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 7634 function getEditorCanvasContainerView(state) { 7635 return state.editorCanvasContainerView; 7636 } 7637 function getRoutes(state) { 7638 return state.routes; 7639 } 7640 7641 7642 ;// ./node_modules/@wordpress/edit-site/build-module/store/constants.js 7643 const STORE_NAME = "core/edit-site"; 7644 7645 7646 ;// ./node_modules/@wordpress/edit-site/build-module/store/index.js 7647 7648 7649 7650 7651 7652 7653 7654 7655 const storeConfig = { 7656 reducer: reducer_default, 7657 actions: actions_namespaceObject, 7658 selectors: selectors_namespaceObject 7659 }; 7660 const store = (0,external_wp_data_.createReduxStore)(STORE_NAME, storeConfig); 7661 (0,external_wp_data_.register)(store); 7662 unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); 7663 unlock(store).registerPrivateActions(private_actions_namespaceObject); 7664 7665 7666 ;// external ["wp","router"] 7667 const external_wp_router_namespaceObject = window["wp"]["router"]; 7668 ;// ./node_modules/clsx/dist/clsx.mjs 7669 function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); 7670 ;// ./node_modules/@wordpress/admin-ui/build-module/navigable-region/index.js 7671 7672 7673 7674 const NavigableRegion = (0,external_wp_element_.forwardRef)( 7675 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 7676 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7677 Tag, 7678 { 7679 ref, 7680 className: dist_clsx("admin-ui-navigable-region", className), 7681 "aria-label": ariaLabel, 7682 role: "region", 7683 tabIndex: "-1", 7684 ...props, 7685 children 7686 } 7687 ); 7688 } 7689 ); 7690 NavigableRegion.displayName = "NavigableRegion"; 7691 var navigable_region_default = NavigableRegion; 7692 7693 7694 ;// external ["wp","plugins"] 7695 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 7696 ;// external ["wp","htmlEntities"] 7697 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 7698 ;// external ["wp","primitives"] 7699 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 7700 ;// ./node_modules/@wordpress/icons/build-module/library/search.js 7701 7702 7703 var search_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); 7704 7705 7706 ;// external ["wp","commands"] 7707 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 7708 ;// external ["wp","keycodes"] 7709 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 7710 ;// external ["wp","url"] 7711 const external_wp_url_namespaceObject = window["wp"]["url"]; 7712 ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js 7713 7714 7715 var wordpress_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) }); 7716 7717 7718 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js 7719 7720 7721 7722 7723 7724 7725 7726 function SiteIcon({ className }) { 7727 const { isRequestingSite, siteIconUrl } = (0,external_wp_data_.useSelect)((select) => { 7728 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 7729 const siteData = getEntityRecord("root", "__unstableBase", void 0); 7730 return { 7731 isRequestingSite: !siteData, 7732 siteIconUrl: siteData?.site_icon_url 7733 }; 7734 }, []); 7735 if (isRequestingSite && !siteIconUrl) { 7736 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-icon__image" }); 7737 } 7738 const icon = siteIconUrl ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7739 "img", 7740 { 7741 className: "edit-site-site-icon__image", 7742 alt: (0,external_wp_i18n_namespaceObject.__)("Site Icon"), 7743 src: siteIconUrl 7744 } 7745 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7746 external_wp_components_namespaceObject.Icon, 7747 { 7748 className: "edit-site-site-icon__icon", 7749 icon: wordpress_default, 7750 size: 48 7751 } 7752 ); 7753 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, "edit-site-site-icon"), children: icon }); 7754 } 7755 var site_icon_default = SiteIcon; 7756 7757 7758 ;// external ["wp","dom"] 7759 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 7760 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js 7761 7762 7763 7764 7765 const SidebarNavigationContext = (0,external_wp_element_.createContext)(() => { 7766 }); 7767 SidebarNavigationContext.displayName = "SidebarNavigationContext"; 7768 function focusSidebarElement(el, direction, focusSelector) { 7769 let elementToFocus; 7770 if (direction === "back" && focusSelector) { 7771 elementToFocus = el.querySelector(focusSelector); 7772 } 7773 if (direction !== null && !elementToFocus) { 7774 const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el); 7775 elementToFocus = firstTabbable ?? el; 7776 } 7777 elementToFocus?.focus(); 7778 } 7779 function createNavState() { 7780 let state = { 7781 direction: null, 7782 focusSelector: null 7783 }; 7784 return { 7785 get() { 7786 return state; 7787 }, 7788 navigate(direction, focusSelector = null) { 7789 state = { 7790 direction, 7791 focusSelector: direction === "forward" && focusSelector ? focusSelector : state.focusSelector 7792 }; 7793 } 7794 }; 7795 } 7796 function SidebarContentWrapper({ children, shouldAnimate }) { 7797 const navState = (0,external_wp_element_.useContext)(SidebarNavigationContext); 7798 const wrapperRef = (0,external_wp_element_.useRef)(); 7799 const [navAnimation, setNavAnimation] = (0,external_wp_element_.useState)(null); 7800 (0,external_wp_element_.useLayoutEffect)(() => { 7801 const { direction, focusSelector } = navState.get(); 7802 focusSidebarElement(wrapperRef.current, direction, focusSelector); 7803 setNavAnimation(direction); 7804 }, [navState]); 7805 const wrapperCls = dist_clsx( 7806 "edit-site-sidebar__screen-wrapper", 7807 /* 7808 * Some panes do not have sub-panes and therefore 7809 * should not animate when clicked on. 7810 */ 7811 shouldAnimate ? { 7812 "slide-from-left": navAnimation === "back", 7813 "slide-from-right": navAnimation === "forward" 7814 } : {} 7815 ); 7816 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: wrapperRef, className: wrapperCls, children }); 7817 } 7818 function SidebarNavigationProvider({ children }) { 7819 const [navState] = (0,external_wp_element_.useState)(createNavState); 7820 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { value: navState, children }); 7821 } 7822 function SidebarContent({ routeKey, shouldAnimate, children }) { 7823 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7824 SidebarContentWrapper, 7825 { 7826 shouldAnimate, 7827 children 7828 }, 7829 routeKey 7830 ) }); 7831 } 7832 7833 7834 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 const { useLocation, useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 7853 const SiteHub = (0,external_wp_element_.memo)( 7854 (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => { 7855 const { dashboardLink, homeUrl, siteTitle } = (0,external_wp_data_.useSelect)((select) => { 7856 const { getSettings } = unlock(select(store)); 7857 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 7858 const _site = getEntityRecord("root", "site"); 7859 return { 7860 dashboardLink: getSettings().__experimentalDashboardLink, 7861 homeUrl: getEntityRecord("root", "__unstableBase")?.home, 7862 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title 7863 }; 7864 }, []); 7865 const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store); 7866 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [ 7867 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7868 "div", 7869 { 7870 className: dist_clsx( 7871 "edit-site-site-hub__view-mode-toggle-container", 7872 { 7873 "has-transparent-background": isTransparent 7874 } 7875 ), 7876 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7877 external_wp_components_namespaceObject.Button, 7878 { 7879 __next40pxDefaultSize: true, 7880 ref, 7881 href: dashboardLink, 7882 label: (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"), 7883 className: "edit-site-layout__view-mode-toggle", 7884 style: { 7885 transform: "scale(0.5333) translateX(-4px)", 7886 // Offset to position the icon 12px from viewport edge 7887 borderRadius: 4 7888 }, 7889 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" }) 7890 } 7891 ) 7892 } 7893 ), 7894 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 7895 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 7896 external_wp_components_namespaceObject.Button, 7897 { 7898 __next40pxDefaultSize: true, 7899 variant: "link", 7900 href: homeUrl, 7901 target: "_blank", 7902 children: [ 7903 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle), 7904 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 7905 as: "span", 7906 /* translators: accessibility text */ 7907 children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") 7908 }) 7909 ] 7910 } 7911 ) }), 7912 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7913 external_wp_components_namespaceObject.__experimentalHStack, 7914 { 7915 spacing: 0, 7916 expanded: false, 7917 className: "edit-site-site-hub__actions", 7918 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7919 external_wp_components_namespaceObject.Button, 7920 { 7921 size: "compact", 7922 className: "edit-site-site-hub_toggle-command-center", 7923 icon: search_default, 7924 onClick: () => openCommandCenter(), 7925 label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"), 7926 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k") 7927 } 7928 ) 7929 } 7930 ) 7931 ] }) 7932 ] }) }); 7933 }) 7934 ); 7935 var site_hub_default = SiteHub; 7936 const SiteHubMobile = (0,external_wp_element_.memo)( 7937 (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => { 7938 const { path } = useLocation(); 7939 const history = useHistory(); 7940 const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext); 7941 const { 7942 dashboardLink, 7943 homeUrl, 7944 siteTitle, 7945 isBlockTheme, 7946 isClassicThemeWithStyleBookSupport 7947 } = (0,external_wp_data_.useSelect)((select) => { 7948 const { getSettings } = unlock(select(store)); 7949 const { getEntityRecord, getCurrentTheme } = select(external_wp_coreData_namespaceObject.store); 7950 const _site = getEntityRecord("root", "site"); 7951 const currentTheme = getCurrentTheme(); 7952 const settings = getSettings(); 7953 const supportsEditorStyles = currentTheme.theme_supports["editor-styles"]; 7954 const hasThemeJson = settings.supportsLayout; 7955 return { 7956 dashboardLink: settings.__experimentalDashboardLink, 7957 homeUrl: getEntityRecord("root", "__unstableBase")?.home, 7958 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title, 7959 isBlockTheme: currentTheme?.is_block_theme, 7960 isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson) 7961 }; 7962 }, []); 7963 const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store); 7964 let backPath; 7965 if (path !== "/") { 7966 if (isBlockTheme || isClassicThemeWithStyleBookSupport) { 7967 backPath = "/"; 7968 } else if (path !== "/pattern") { 7969 backPath = "/pattern"; 7970 } 7971 } 7972 const backButtonProps = { 7973 href: !!backPath ? void 0 : dashboardLink, 7974 label: !!backPath ? (0,external_wp_i18n_namespaceObject.__)("Go to Site Editor") : (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"), 7975 onClick: !!backPath ? () => { 7976 history.navigate(backPath); 7977 navigate("back"); 7978 } : void 0 7979 }; 7980 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [ 7981 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7982 "div", 7983 { 7984 className: dist_clsx( 7985 "edit-site-site-hub__view-mode-toggle-container", 7986 { 7987 "has-transparent-background": isTransparent 7988 } 7989 ), 7990 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7991 external_wp_components_namespaceObject.Button, 7992 { 7993 __next40pxDefaultSize: true, 7994 ref, 7995 className: "edit-site-layout__view-mode-toggle", 7996 style: { 7997 transform: "scale(0.5)", 7998 borderRadius: 4 7999 }, 8000 ...backButtonProps, 8001 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" }) 8002 } 8003 ) 8004 } 8005 ), 8006 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 8007 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8008 external_wp_components_namespaceObject.Button, 8009 { 8010 __next40pxDefaultSize: true, 8011 variant: "link", 8012 href: homeUrl, 8013 target: "_blank", 8014 label: (0,external_wp_i18n_namespaceObject.__)("View site (opens in a new tab)"), 8015 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) 8016 } 8017 ) }), 8018 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8019 external_wp_components_namespaceObject.__experimentalHStack, 8020 { 8021 spacing: 0, 8022 expanded: false, 8023 className: "edit-site-site-hub__actions", 8024 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8025 external_wp_components_namespaceObject.Button, 8026 { 8027 __next40pxDefaultSize: true, 8028 className: "edit-site-site-hub_toggle-command-center", 8029 icon: search_default, 8030 onClick: () => openCommandCenter(), 8031 label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"), 8032 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k") 8033 } 8034 ) 8035 } 8036 ) 8037 ] }) 8038 ] }) }); 8039 }) 8040 ); 8041 8042 8043 ;// ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 const { useLocation: resizable_frame_useLocation, useHistory: resizable_frame_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 8056 const HANDLE_STYLES_OVERRIDE = { 8057 position: void 0, 8058 userSelect: void 0, 8059 cursor: void 0, 8060 width: void 0, 8061 height: void 0, 8062 top: void 0, 8063 right: void 0, 8064 bottom: void 0, 8065 left: void 0 8066 }; 8067 const FRAME_MIN_WIDTH = 320; 8068 const FRAME_REFERENCE_WIDTH = 1300; 8069 const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; 8070 const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; 8071 const INITIAL_FRAME_SIZE = { width: "100%", height: "100%" }; 8072 function calculateNewHeight(width, initialAspectRatio) { 8073 const lerp = (a, b, amount) => { 8074 return a + (b - a) * amount; 8075 }; 8076 const lerpFactor = 1 - Math.max( 8077 0, 8078 Math.min( 8079 1, 8080 (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH) 8081 ) 8082 ); 8083 const intermediateAspectRatio = lerp( 8084 initialAspectRatio, 8085 FRAME_TARGET_ASPECT_RATIO, 8086 lerpFactor 8087 ); 8088 return width / intermediateAspectRatio; 8089 } 8090 function ResizableFrame({ 8091 isFullWidth, 8092 isOversized, 8093 setIsOversized, 8094 isReady, 8095 children, 8096 /** The default (unresized) width/height of the frame, based on the space available in the viewport. */ 8097 defaultSize, 8098 innerContentStyle 8099 }) { 8100 const history = resizable_frame_useHistory(); 8101 const { path, query } = resizable_frame_useLocation(); 8102 const { canvas = "view" } = query; 8103 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 8104 const [frameSize, setFrameSize] = (0,external_wp_element_.useState)(INITIAL_FRAME_SIZE); 8105 const [startingWidth, setStartingWidth] = (0,external_wp_element_.useState)(); 8106 const [isResizing, setIsResizing] = (0,external_wp_element_.useState)(false); 8107 const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_.useState)(false); 8108 const [resizeRatio, setResizeRatio] = (0,external_wp_element_.useState)(1); 8109 const FRAME_TRANSITION = { type: "tween", duration: isResizing ? 0 : 0.5 }; 8110 const frameRef = (0,external_wp_element_.useRef)(null); 8111 const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)( 8112 ResizableFrame, 8113 "edit-site-resizable-frame-handle-help" 8114 ); 8115 const defaultAspectRatio = defaultSize.width / defaultSize.height; 8116 const isBlockTheme = (0,external_wp_data_.useSelect)((select) => { 8117 const { getCurrentTheme } = select(external_wp_coreData_namespaceObject.store); 8118 return getCurrentTheme()?.is_block_theme; 8119 }, []); 8120 const handleResizeStart = (_event, _direction, ref) => { 8121 setStartingWidth(ref.offsetWidth); 8122 setIsResizing(true); 8123 }; 8124 const handleResize = (_event, _direction, _ref, delta) => { 8125 const normalizedDelta = delta.width / resizeRatio; 8126 const deltaAbs = Math.abs(normalizedDelta); 8127 const maxDoubledDelta = delta.width < 0 ? deltaAbs : (defaultSize.width - startingWidth) / 2; 8128 const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta); 8129 const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs; 8130 const singleSegment = 1 - doubleSegment; 8131 setResizeRatio(singleSegment + doubleSegment * 2); 8132 const updatedWidth = startingWidth + delta.width; 8133 setIsOversized(updatedWidth > defaultSize.width); 8134 setFrameSize({ 8135 height: isOversized ? "100%" : calculateNewHeight(updatedWidth, defaultAspectRatio) 8136 }); 8137 }; 8138 const handleResizeStop = (_event, _direction, ref) => { 8139 setIsResizing(false); 8140 if (!isOversized) { 8141 return; 8142 } 8143 setIsOversized(false); 8144 const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth; 8145 if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) { 8146 setFrameSize(INITIAL_FRAME_SIZE); 8147 } else { 8148 history.navigate( 8149 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 8150 canvas: "edit" 8151 }), 8152 { 8153 transition: "canvas-mode-edit-transition" 8154 } 8155 ); 8156 } 8157 }; 8158 const handleResizableHandleKeyDown = (event) => { 8159 if (!["ArrowLeft", "ArrowRight"].includes(event.key)) { 8160 return; 8161 } 8162 event.preventDefault(); 8163 const step = 20 * (event.shiftKey ? 5 : 1); 8164 const delta = step * (event.key === "ArrowLeft" ? 1 : -1) * ((0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1); 8165 const newWidth = Math.min( 8166 Math.max( 8167 FRAME_MIN_WIDTH, 8168 frameRef.current.resizable.offsetWidth + delta 8169 ), 8170 defaultSize.width 8171 ); 8172 setFrameSize({ 8173 width: newWidth, 8174 height: calculateNewHeight(newWidth, defaultAspectRatio) 8175 }); 8176 }; 8177 const frameAnimationVariants = { 8178 default: { 8179 flexGrow: 0, 8180 height: frameSize.height 8181 }, 8182 fullWidth: { 8183 flexGrow: 1, 8184 height: frameSize.height 8185 } 8186 }; 8187 const resizeHandleVariants = { 8188 hidden: { 8189 opacity: 0, 8190 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: 0 } : { left: 0 } 8191 }, 8192 visible: { 8193 opacity: 1, 8194 // Account for the handle's width. 8195 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 } 8196 }, 8197 active: { 8198 opacity: 1, 8199 // Account for the handle's width. 8200 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 }, 8201 scaleY: 1.3 8202 } 8203 }; 8204 const currentResizeHandleVariant = (() => { 8205 if (isResizing) { 8206 return "active"; 8207 } 8208 return shouldShowHandle ? "visible" : "hidden"; 8209 })(); 8210 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8211 external_wp_components_namespaceObject.ResizableBox, 8212 { 8213 as: external_wp_components_namespaceObject.__unstableMotion.div, 8214 ref: frameRef, 8215 initial: false, 8216 variants: frameAnimationVariants, 8217 animate: isFullWidth ? "fullWidth" : "default", 8218 onAnimationComplete: (definition) => { 8219 if (definition === "fullWidth") { 8220 setFrameSize({ width: "100%", height: "100%" }); 8221 } 8222 }, 8223 whileHover: canvas === "view" && isBlockTheme ? { 8224 scale: 1.005, 8225 transition: { 8226 duration: disableMotion ? 0 : 0.5, 8227 ease: "easeOut" 8228 } 8229 } : {}, 8230 transition: FRAME_TRANSITION, 8231 size: frameSize, 8232 enable: { 8233 top: false, 8234 bottom: false, 8235 // Resizing will be disabled until the editor content is loaded. 8236 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: isReady, left: false } : { left: isReady, right: false }, 8237 topRight: false, 8238 bottomRight: false, 8239 bottomLeft: false, 8240 topLeft: false 8241 }, 8242 resizeRatio, 8243 handleClasses: void 0, 8244 handleStyles: { 8245 left: HANDLE_STYLES_OVERRIDE, 8246 right: HANDLE_STYLES_OVERRIDE 8247 }, 8248 minWidth: FRAME_MIN_WIDTH, 8249 maxWidth: isFullWidth ? "100%" : "150%", 8250 maxHeight: "100%", 8251 onFocus: () => setShouldShowHandle(true), 8252 onBlur: () => setShouldShowHandle(false), 8253 onMouseOver: () => setShouldShowHandle(true), 8254 onMouseOut: () => setShouldShowHandle(false), 8255 handleComponent: { 8256 [(0,external_wp_i18n_namespaceObject.isRTL)() ? "right" : "left"]: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 8257 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8258 external_wp_components_namespaceObject.__unstableMotion.button, 8259 { 8260 role: "separator", 8261 "aria-orientation": "vertical", 8262 className: dist_clsx( 8263 "edit-site-resizable-frame__handle", 8264 { "is-resizing": isResizing } 8265 ), 8266 variants: resizeHandleVariants, 8267 animate: currentResizeHandleVariant, 8268 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), 8269 "aria-describedby": resizableHandleHelpId, 8270 "aria-valuenow": frameRef.current?.resizable?.offsetWidth || void 0, 8271 "aria-valuemin": FRAME_MIN_WIDTH, 8272 "aria-valuemax": defaultSize.width, 8273 onKeyDown: handleResizableHandleKeyDown, 8274 initial: "hidden", 8275 exit: "hidden", 8276 whileFocus: "active", 8277 whileHover: "active" 8278 }, 8279 "handle" 8280 ) }), 8281 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)( 8282 "Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments." 8283 ) }) 8284 ] }) 8285 }, 8286 onResizeStart: handleResizeStart, 8287 onResize: handleResize, 8288 onResizeStop: handleResizeStop, 8289 className: dist_clsx("edit-site-resizable-frame__inner", { 8290 "is-resizing": isResizing 8291 }), 8292 showHandle: false, 8293 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8294 "div", 8295 { 8296 className: "edit-site-resizable-frame__inner-content", 8297 style: innerContentStyle, 8298 children 8299 } 8300 ) 8301 } 8302 ); 8303 } 8304 var resizable_frame_default = ResizableFrame; 8305 8306 8307 ;// external ["wp","keyboardShortcuts"] 8308 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 8309 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-keyboard-shortcut/index.js 8310 8311 8312 8313 8314 8315 8316 8317 const shortcutName = "core/edit-site/save"; 8318 function SaveKeyboardShortcut() { 8319 const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store); 8320 const { hasNonPostEntityChanges, isPostSavingLocked } = (0,external_wp_data_.useSelect)(external_wp_editor_namespaceObject.store); 8321 const { savePost } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); 8322 const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store); 8323 const { registerShortcut, unregisterShortcut } = (0,external_wp_data_.useDispatch)( 8324 external_wp_keyboardShortcuts_namespaceObject.store 8325 ); 8326 (0,external_wp_element_.useEffect)(() => { 8327 registerShortcut({ 8328 name: shortcutName, 8329 category: "global", 8330 description: (0,external_wp_i18n_namespaceObject.__)("Save your changes."), 8331 keyCombination: { 8332 modifier: "primary", 8333 character: "s" 8334 } 8335 }); 8336 return () => { 8337 unregisterShortcut(shortcutName); 8338 }; 8339 }, [registerShortcut, unregisterShortcut]); 8340 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-site/save", (event) => { 8341 event.preventDefault(); 8342 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8343 const hasDirtyEntities = !!dirtyEntityRecords.length; 8344 const isSaving = dirtyEntityRecords.some( 8345 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 8346 ); 8347 if (!hasDirtyEntities || isSaving) { 8348 return; 8349 } 8350 if (hasNonPostEntityChanges()) { 8351 setIsSaveViewOpened(true); 8352 } else if (!isPostSavingLocked()) { 8353 savePost(); 8354 } 8355 }); 8356 return null; 8357 } 8358 8359 8360 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js 8361 8362 8363 8364 const MAX_LOADING_TIME = 1e4; 8365 function useIsSiteEditorLoading() { 8366 const [loaded, setLoaded] = (0,external_wp_element_.useState)(false); 8367 const inLoadingPause = (0,external_wp_data_.useSelect)( 8368 (select) => { 8369 const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors(); 8370 return !loaded && !hasResolvingSelectors; 8371 }, 8372 [loaded] 8373 ); 8374 (0,external_wp_element_.useEffect)(() => { 8375 let timeout; 8376 if (!loaded) { 8377 timeout = setTimeout(() => { 8378 setLoaded(true); 8379 }, MAX_LOADING_TIME); 8380 } 8381 return () => { 8382 clearTimeout(timeout); 8383 }; 8384 }, [loaded]); 8385 (0,external_wp_element_.useEffect)(() => { 8386 if (inLoadingPause) { 8387 const ARTIFICIAL_DELAY = 100; 8388 const timeout = setTimeout(() => { 8389 setLoaded(true); 8390 }, ARTIFICIAL_DELAY); 8391 return () => { 8392 clearTimeout(timeout); 8393 }; 8394 } 8395 }, [inLoadingPause]); 8396 return !loaded; 8397 } 8398 8399 8400 ;// ./node_modules/@react-spring/rafz/dist/esm/index.js 8401 var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}}; 8402 8403 // EXTERNAL MODULE: external "React" 8404 var external_React_ = __webpack_require__(1609); 8405 var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2); 8406 ;// ./node_modules/@react-spring/shared/dist/esm/index.js 8407 var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`$n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba($r}, $n}, $f}, $o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`($O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba($Math.round(t)}, $Math.round(r)}, $Math.round(n)}, $f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`($Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`$f[s++](o)}$i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`$Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`$Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`$Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll$f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e}; 8408 8409 ;// ./node_modules/@react-spring/animated/dist/esm/index.js 8410 var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated($m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null; 8411 8412 ;// ./node_modules/@react-spring/core/dist/esm/index.js 8413 function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&>(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between $x.constructor.name} and $L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(dist_esm_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var dist_esm_n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance; 8414 8415 ;// external "ReactDOM" 8416 const external_ReactDOM_namespaceObject = window["ReactDOM"]; 8417 ;// ./node_modules/@react-spring/web/dist/esm/index.js 8418 var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d($a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d($m},$o},$p},$web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`$n}($m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated; 8419 8420 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js 8421 8422 8423 function getAbsolutePosition(element) { 8424 return { 8425 top: element.offsetTop, 8426 left: element.offsetLeft 8427 }; 8428 } 8429 const ANIMATION_DURATION = 400; 8430 function useMovingAnimation({ triggerAnimationOnChange }) { 8431 const ref = (0,external_wp_element_.useRef)(); 8432 const { previous, prevRect } = (0,external_wp_element_.useMemo)( 8433 () => ({ 8434 previous: ref.current && getAbsolutePosition(ref.current), 8435 prevRect: ref.current && ref.current.getBoundingClientRect() 8436 }), 8437 [triggerAnimationOnChange] 8438 ); 8439 (0,external_wp_element_.useLayoutEffect)(() => { 8440 if (!previous || !ref.current) { 8441 return; 8442 } 8443 const disableAnimation = window.matchMedia( 8444 "(prefers-reduced-motion: reduce)" 8445 ).matches; 8446 if (disableAnimation) { 8447 return; 8448 } 8449 const controller = new esm_le({ 8450 x: 0, 8451 y: 0, 8452 width: prevRect.width, 8453 height: prevRect.height, 8454 config: { 8455 duration: ANIMATION_DURATION, 8456 easing: Lt.easeInOutQuint 8457 }, 8458 onChange({ value }) { 8459 if (!ref.current) { 8460 return; 8461 } 8462 let { x: x2, y: y2, width: width2, height: height2 } = value; 8463 x2 = Math.round(x2); 8464 y2 = Math.round(y2); 8465 width2 = Math.round(width2); 8466 height2 = Math.round(height2); 8467 const finishedMoving = x2 === 0 && y2 === 0; 8468 ref.current.style.transformOrigin = "center center"; 8469 ref.current.style.transform = finishedMoving ? null : `translate3d($x2}px,$y2}px,0)`; 8470 ref.current.style.width = finishedMoving ? null : `$width2}px`; 8471 ref.current.style.height = finishedMoving ? null : `$height2}px`; 8472 } 8473 }); 8474 ref.current.style.transform = void 0; 8475 const destination = ref.current.getBoundingClientRect(); 8476 const x = Math.round(prevRect.left - destination.left); 8477 const y = Math.round(prevRect.top - destination.top); 8478 const width = destination.width; 8479 const height = destination.height; 8480 controller.start({ 8481 x: 0, 8482 y: 0, 8483 width, 8484 height, 8485 from: { x, y, width: prevRect.width, height: prevRect.height } 8486 }); 8487 return () => { 8488 controller.stop(); 8489 controller.set({ 8490 x: 0, 8491 y: 0, 8492 width: prevRect.width, 8493 height: prevRect.height 8494 }); 8495 }; 8496 }, [previous, prevRect]); 8497 return ref; 8498 } 8499 var animation_default = useMovingAnimation; 8500 8501 8502 ;// ./node_modules/@wordpress/icons/build-module/library/check.js 8503 8504 8505 var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 8506 8507 8508 ;// ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js 8509 8510 function isPreviewingTheme() { 8511 return !!(0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview"); 8512 } 8513 function currentlyPreviewingTheme() { 8514 if (isPreviewingTheme()) { 8515 return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview"); 8516 } 8517 return null; 8518 } 8519 8520 8521 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 const { useLocation: save_button_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 8534 function SaveButton({ 8535 className = "edit-site-save-button__button", 8536 variant = "primary", 8537 showTooltip = true, 8538 showReviewMessage, 8539 icon, 8540 size, 8541 __next40pxDefaultSize = false 8542 }) { 8543 const { params } = save_button_useLocation(); 8544 const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store); 8545 const { saveDirtyEntities } = unlock((0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store)); 8546 const { dirtyEntityRecords } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 8547 const { isSaving, isSaveViewOpen, previewingThemeName } = (0,external_wp_data_.useSelect)( 8548 (select) => { 8549 const { isSavingEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); 8550 const { isSaveViewOpened } = select(store); 8551 const isActivatingTheme = isResolving("activateTheme"); 8552 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 8553 return { 8554 isSaving: dirtyEntityRecords.some( 8555 (record) => isSavingEntityRecord( 8556 record.kind, 8557 record.name, 8558 record.key 8559 ) 8560 ) || isActivatingTheme, 8561 isSaveViewOpen: isSaveViewOpened(), 8562 // Do not call `getTheme` with null, it will cause a request to 8563 // the server. 8564 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0 8565 }; 8566 }, 8567 [dirtyEntityRecords] 8568 ); 8569 const hasDirtyEntities = !!dirtyEntityRecords.length; 8570 let isOnlyCurrentEntityDirty; 8571 if (dirtyEntityRecords.length === 1) { 8572 if (params.postId) { 8573 isOnlyCurrentEntityDirty = `$dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType; 8574 } else if (params.path?.includes("wp_global_styles")) { 8575 isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === "globalStyles"; 8576 } 8577 } 8578 const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme(); 8579 const getLabel = () => { 8580 if (isPreviewingTheme()) { 8581 if (isSaving) { 8582 return (0,external_wp_i18n_namespaceObject.sprintf)( 8583 /* translators: %s: The name of theme to be activated. */ 8584 (0,external_wp_i18n_namespaceObject.__)("Activating %s"), 8585 previewingThemeName 8586 ); 8587 } else if (disabled) { 8588 return (0,external_wp_i18n_namespaceObject.__)("Saved"); 8589 } else if (hasDirtyEntities) { 8590 return (0,external_wp_i18n_namespaceObject.sprintf)( 8591 /* translators: %s: The name of theme to be activated. */ 8592 (0,external_wp_i18n_namespaceObject.__)("Activate %s & Save"), 8593 previewingThemeName 8594 ); 8595 } 8596 return (0,external_wp_i18n_namespaceObject.sprintf)( 8597 /* translators: %s: The name of theme to be activated. */ 8598 (0,external_wp_i18n_namespaceObject.__)("Activate %s"), 8599 previewingThemeName 8600 ); 8601 } 8602 if (isSaving) { 8603 return (0,external_wp_i18n_namespaceObject.__)("Saving"); 8604 } 8605 if (disabled) { 8606 return (0,external_wp_i18n_namespaceObject.__)("Saved"); 8607 } 8608 if (!isOnlyCurrentEntityDirty && showReviewMessage) { 8609 return (0,external_wp_i18n_namespaceObject.sprintf)( 8610 // translators: %d: number of unsaved changes (number). 8611 (0,external_wp_i18n_namespaceObject._n)( 8612 "Review %d change\u2026", 8613 "Review %d changes\u2026", 8614 dirtyEntityRecords.length 8615 ), 8616 dirtyEntityRecords.length 8617 ); 8618 } 8619 return (0,external_wp_i18n_namespaceObject.__)("Save"); 8620 }; 8621 const label = getLabel(); 8622 const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ dirtyEntityRecords }) : () => setIsSaveViewOpened(true); 8623 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8624 external_wp_components_namespaceObject.Button, 8625 { 8626 variant, 8627 className, 8628 "aria-disabled": disabled, 8629 "aria-expanded": isSaveViewOpen, 8630 isBusy: isSaving, 8631 onClick: disabled ? void 0 : onClick, 8632 label, 8633 shortcut: disabled ? void 0 : external_wp_keycodes_namespaceObject.displayShortcut.primary("s"), 8634 showTooltip, 8635 icon, 8636 __next40pxDefaultSize, 8637 size, 8638 children: label 8639 } 8640 ); 8641 } 8642 8643 8644 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js 8645 8646 8647 8648 8649 8650 8651 8652 function SaveHub() { 8653 const { isDisabled, isSaving } = (0,external_wp_data_.useSelect)((select) => { 8654 const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); 8655 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8656 const _isSaving = dirtyEntityRecords.some( 8657 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 8658 ); 8659 return { 8660 isSaving: _isSaving, 8661 isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme() 8662 }; 8663 }, []); 8664 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { className: "edit-site-save-hub", alignment: "right", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8665 SaveButton, 8666 { 8667 className: "edit-site-save-hub__button", 8668 variant: isDisabled ? null : "primary", 8669 showTooltip: false, 8670 icon: isDisabled && !isSaving ? check_default : null, 8671 showReviewMessage: true, 8672 __next40pxDefaultSize: true 8673 } 8674 ) }); 8675 } 8676 8677 8678 ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js 8679 8680 8681 8682 8683 8684 8685 const { useHistory: use_activate_theme_useHistory, useLocation: use_activate_theme_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 8686 function useActivateTheme() { 8687 const history = use_activate_theme_useHistory(); 8688 const { path } = use_activate_theme_useLocation(); 8689 const { startResolution, finishResolution } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 8690 return async () => { 8691 if (isPreviewingTheme()) { 8692 const activationURL = "themes.php?action=activate&stylesheet=" + currentlyPreviewingTheme() + "&_wpnonce=" + window.WP_BLOCK_THEME_ACTIVATE_NONCE; 8693 startResolution("activateTheme"); 8694 await window.fetch(activationURL); 8695 finishResolution("activateTheme"); 8696 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { wp_theme_preview: "" })); 8697 } 8698 }; 8699 } 8700 8701 8702 ;// external ["wp","apiFetch"] 8703 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 8704 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 8705 ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js 8706 8707 8708 8709 const ACTIVE_THEMES_URL = "/wp/v2/themes?status=active"; 8710 function useActualCurrentTheme() { 8711 const [currentTheme, setCurrentTheme] = (0,external_wp_element_.useState)(); 8712 (0,external_wp_element_.useEffect)(() => { 8713 const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, { 8714 context: "edit", 8715 wp_theme_preview: "" 8716 }); 8717 external_wp_apiFetch_default()({ path }).then((activeThemes) => setCurrentTheme(activeThemes[0])).catch(() => { 8718 }); 8719 }, []); 8720 return currentTheme; 8721 } 8722 8723 8724 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 const { EntitiesSavedStatesExtensible } = unlock(external_wp_editor_namespaceObject.privateApis); 8741 const { useLocation: save_panel_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 8742 const EntitiesSavedStatesForPreview = ({ 8743 onClose, 8744 renderDialog, 8745 variant 8746 }) => { 8747 const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 8748 let activateSaveLabel; 8749 if (isDirtyProps.isDirty) { 8750 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate & Save"); 8751 } else { 8752 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate"); 8753 } 8754 const currentTheme = useActualCurrentTheme(); 8755 const previewingTheme = (0,external_wp_data_.useSelect)( 8756 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), 8757 [] 8758 ); 8759 const additionalPrompt = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)( 8760 /* translators: 1: The name of active theme, 2: The name of theme to be activated. */ 8761 (0,external_wp_i18n_namespaceObject.__)( 8762 "Saving your changes will change your active theme from %1$s to %2$s." 8763 ), 8764 currentTheme?.name?.rendered ?? "...", 8765 previewingTheme?.name?.rendered ?? "..." 8766 ) }); 8767 const activateTheme = useActivateTheme(); 8768 const onSave = async (values) => { 8769 await activateTheme(); 8770 return values; 8771 }; 8772 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8773 EntitiesSavedStatesExtensible, 8774 { 8775 ...{ 8776 ...isDirtyProps, 8777 additionalPrompt, 8778 close: onClose, 8779 onSave, 8780 saveEnabled: true, 8781 saveLabel: activateSaveLabel, 8782 renderDialog, 8783 variant 8784 } 8785 } 8786 ); 8787 }; 8788 const _EntitiesSavedStates = ({ onClose, renderDialog, variant }) => { 8789 if (isPreviewingTheme()) { 8790 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8791 EntitiesSavedStatesForPreview, 8792 { 8793 onClose, 8794 renderDialog, 8795 variant 8796 } 8797 ); 8798 } 8799 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8800 external_wp_editor_namespaceObject.EntitiesSavedStates, 8801 { 8802 close: onClose, 8803 renderDialog, 8804 variant 8805 } 8806 ); 8807 }; 8808 function SavePanel() { 8809 const { query } = save_panel_useLocation(); 8810 const { canvas = "view" } = query; 8811 const { isSaveViewOpen, isDirty, isSaving } = (0,external_wp_data_.useSelect)((select) => { 8812 const { 8813 __experimentalGetDirtyEntityRecords, 8814 isSavingEntityRecord, 8815 isResolving 8816 } = select(external_wp_coreData_namespaceObject.store); 8817 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8818 const isActivatingTheme = isResolving("activateTheme"); 8819 const { isSaveViewOpened } = unlock(select(store)); 8820 return { 8821 isSaveViewOpen: isSaveViewOpened(), 8822 isDirty: dirtyEntityRecords.length > 0, 8823 isSaving: dirtyEntityRecords.some( 8824 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 8825 ) || isActivatingTheme 8826 }; 8827 }, []); 8828 const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store); 8829 const onClose = () => setIsSaveViewOpened(false); 8830 (0,external_wp_element_.useEffect)(() => { 8831 setIsSaveViewOpened(false); 8832 }, [canvas, setIsSaveViewOpened]); 8833 if (canvas === "view") { 8834 return isSaveViewOpen ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8835 external_wp_components_namespaceObject.Modal, 8836 { 8837 className: "edit-site-save-panel__modal", 8838 onRequestClose: onClose, 8839 title: (0,external_wp_i18n_namespaceObject.__)("Review changes"), 8840 size: "small", 8841 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, variant: "inline" }) 8842 } 8843 ) : null; 8844 } 8845 const activateSaveEnabled = isPreviewingTheme() || isDirty; 8846 const disabled = isSaving || !activateSaveEnabled; 8847 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 8848 navigable_region_default, 8849 { 8850 className: dist_clsx("edit-site-layout__actions", { 8851 "is-entity-save-view-open": isSaveViewOpen 8852 }), 8853 ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Save panel"), 8854 children: [ 8855 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8856 "div", 8857 { 8858 className: dist_clsx("edit-site-editor__toggle-save-panel", { 8859 "screen-reader-text": isSaveViewOpen 8860 }), 8861 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8862 external_wp_components_namespaceObject.Button, 8863 { 8864 __next40pxDefaultSize: true, 8865 variant: "secondary", 8866 className: "edit-site-editor__toggle-save-panel-button", 8867 onClick: () => setIsSaveViewOpened(true), 8868 "aria-haspopup": "dialog", 8869 disabled, 8870 accessibleWhenDisabled: true, 8871 children: (0,external_wp_i18n_namespaceObject.__)("Open save panel") 8872 } 8873 ) 8874 } 8875 ), 8876 isSaveViewOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, renderDialog: true }) 8877 ] 8878 } 8879 ); 8880 } 8881 8882 8883 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 const { useGlobalStyle: layout_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 8908 const { GlobalStylesProvider } = unlock(external_wp_editor_namespaceObject.privateApis); 8909 const { useLocation: layout_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 8910 const layout_ANIMATION_DURATION = 0.3; 8911 function Layout() { 8912 const { query, name: routeKey, areas, widths } = layout_useLocation(); 8913 const { canvas = "view" } = query; 8914 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 8915 const toggleRef = (0,external_wp_element_.useRef)(); 8916 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); 8917 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 8918 const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 8919 const isEditorLoading = useIsSiteEditorLoading(); 8920 const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_.useState)(false); 8921 const animationRef = animation_default({ 8922 triggerAnimationOnChange: routeKey + "-" + canvas 8923 }); 8924 const { showIconLabels } = (0,external_wp_data_.useSelect)((select) => { 8925 return { 8926 showIconLabels: select(external_wp_preferences_.store).get( 8927 "core", 8928 "showIconLabels" 8929 ) 8930 }; 8931 }); 8932 const [backgroundColor] = layout_useGlobalStyle("color.background"); 8933 const [gradientValue] = layout_useGlobalStyle("color.gradient"); 8934 const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvas); 8935 (0,external_wp_element_.useEffect)(() => { 8936 if (previousCanvaMode === "edit") { 8937 toggleRef.current?.focus(); 8938 } 8939 }, [canvas]); 8940 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 8941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), 8942 canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveKeyboardShortcut, {}), 8943 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8944 "div", 8945 { 8946 ...navigateRegionsProps, 8947 ref: navigateRegionsProps.ref, 8948 className: dist_clsx( 8949 "edit-site-layout", 8950 navigateRegionsProps.className, 8951 { 8952 "is-full-canvas": canvas === "edit", 8953 "show-icon-labels": showIconLabels 8954 } 8955 ), 8956 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__content", children: [ 8957 (!isMobileViewport || !areas.mobile) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8958 navigable_region_default, 8959 { 8960 ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Navigation"), 8961 className: "edit-site-layout__sidebar-region", 8962 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 8963 external_wp_components_namespaceObject.__unstableMotion.div, 8964 { 8965 initial: { opacity: 0 }, 8966 animate: { opacity: 1 }, 8967 exit: { opacity: 0 }, 8968 transition: { 8969 type: "tween", 8970 duration: ( 8971 // Disable transition in mobile to emulate a full page transition. 8972 disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION 8973 ), 8974 ease: "easeOut" 8975 }, 8976 className: "edit-site-layout__sidebar", 8977 children: [ 8978 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8979 site_hub_default, 8980 { 8981 ref: toggleRef, 8982 isTransparent: isResizableFrameOversized 8983 } 8984 ), 8985 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8986 SidebarContent, 8987 { 8988 shouldAnimate: routeKey !== "styles", 8989 routeKey, 8990 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.sidebar }) 8991 } 8992 ) }), 8993 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), 8994 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}) 8995 ] 8996 } 8997 ) }) 8998 } 8999 ), 9000 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), 9001 isMobileViewport && areas.mobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-layout__mobile", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: canvas !== "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 9002 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9003 SiteHubMobile, 9004 { 9005 ref: toggleRef, 9006 isTransparent: isResizableFrameOversized 9007 } 9008 ), 9009 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { routeKey, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }), 9010 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), 9011 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}) 9012 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }) }), 9013 !isMobileViewport && areas.content && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9014 "div", 9015 { 9016 className: "edit-site-layout__area", 9017 style: { 9018 maxWidth: widths?.content 9019 }, 9020 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.content }) 9021 } 9022 ), 9023 !isMobileViewport && areas.edit && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9024 "div", 9025 { 9026 className: "edit-site-layout__area", 9027 style: { 9028 maxWidth: widths?.edit 9029 }, 9030 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.edit }) 9031 } 9032 ), 9033 !isMobileViewport && areas.preview && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__canvas-container", children: [ 9034 canvasResizer, 9035 !!canvasSize.width && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9036 "div", 9037 { 9038 className: dist_clsx( 9039 "edit-site-layout__canvas", 9040 { 9041 "is-right-aligned": isResizableFrameOversized 9042 } 9043 ), 9044 ref: animationRef, 9045 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9046 resizable_frame_default, 9047 { 9048 isReady: !isEditorLoading, 9049 isFullWidth: canvas === "edit", 9050 defaultSize: { 9051 width: canvasSize.width - 24, 9052 height: canvasSize.height 9053 }, 9054 isOversized: isResizableFrameOversized, 9055 setIsOversized: setIsResizableFrameOversized, 9056 innerContentStyle: { 9057 background: gradientValue ?? backgroundColor 9058 }, 9059 children: areas.preview 9060 } 9061 ) }) 9062 } 9063 ) 9064 ] }) 9065 ] }) 9066 } 9067 ) 9068 ] }); 9069 } 9070 function LayoutWithGlobalStylesProvider(props) { 9071 const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 9072 function onPluginAreaError(name) { 9073 createErrorNotice( 9074 (0,external_wp_i18n_namespaceObject.sprintf)( 9075 /* translators: %s: plugin name */ 9076 (0,external_wp_i18n_namespaceObject.__)( 9077 'The "%s" plugin has encountered an error and cannot be rendered.' 9078 ), 9079 name 9080 ) 9081 ); 9082 } 9083 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { children: [ 9084 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError }), 9085 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { ...props }) 9086 ] }) }); 9087 } 9088 9089 9090 ;// ./node_modules/@wordpress/icons/build-module/library/help.js 9091 9092 9093 var help_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) }); 9094 9095 9096 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js 9097 9098 9099 var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); 9100 9101 9102 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js 9103 9104 9105 var rotate_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) }); 9106 9107 9108 ;// ./node_modules/@wordpress/icons/build-module/library/backup.js 9109 9110 9111 var backup_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) }); 9112 9113 9114 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 const { useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9127 const { useHistory: use_common_commands_useHistory, useLocation: use_common_commands_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 9128 const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() { 9129 const { openGeneralSidebar } = unlock((0,external_wp_data_.useDispatch)(store)); 9130 const { params } = use_common_commands_useLocation(); 9131 const { canvas = "view" } = params; 9132 const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 9133 const history = use_common_commands_useHistory(); 9134 const isBlockBasedTheme = (0,external_wp_data_.useSelect)((select) => { 9135 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 9136 }, []); 9137 const commands = (0,external_wp_element_.useMemo)(() => { 9138 if (!isBlockBasedTheme) { 9139 return []; 9140 } 9141 return [ 9142 { 9143 name: "core/edit-site/toggle-styles-welcome-guide", 9144 label: (0,external_wp_i18n_namespaceObject.__)("Learn about styles"), 9145 callback: ({ close }) => { 9146 close(); 9147 if (canvas !== "edit") { 9148 history.navigate("/styles?canvas=edit", { 9149 transition: "canvas-mode-edit-transition" 9150 }); 9151 } 9152 openGeneralSidebar("edit-site/global-styles"); 9153 set("core/edit-site", "welcomeGuideStyles", true); 9154 setTimeout(() => { 9155 set("core/edit-site", "welcomeGuideStyles", true); 9156 }, 500); 9157 }, 9158 icon: help_default 9159 } 9160 ]; 9161 }, [history, openGeneralSidebar, canvas, isBlockBasedTheme, set]); 9162 return { 9163 isLoading: false, 9164 commands 9165 }; 9166 }; 9167 const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() { 9168 const [canReset, onReset] = useGlobalStylesReset(); 9169 const commands = (0,external_wp_element_.useMemo)(() => { 9170 if (!canReset) { 9171 return []; 9172 } 9173 return [ 9174 { 9175 name: "core/edit-site/reset-global-styles", 9176 label: (0,external_wp_i18n_namespaceObject.__)("Reset styles"), 9177 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right_default : rotate_left_default, 9178 callback: ({ close }) => { 9179 close(); 9180 onReset(); 9181 } 9182 } 9183 ]; 9184 }, [canReset, onReset]); 9185 return { 9186 isLoading: false, 9187 commands 9188 }; 9189 }; 9190 const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() { 9191 const { openGeneralSidebar, setEditorCanvasContainerView } = unlock( 9192 (0,external_wp_data_.useDispatch)(store) 9193 ); 9194 const { params } = use_common_commands_useLocation(); 9195 const { canvas = "view" } = params; 9196 const history = use_common_commands_useHistory(); 9197 const hasRevisions = (0,external_wp_data_.useSelect)((select) => { 9198 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); 9199 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9200 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; 9201 return !!globalStyles?._links?.["version-history"]?.[0]?.count; 9202 }, []); 9203 const commands = (0,external_wp_element_.useMemo)(() => { 9204 if (!hasRevisions) { 9205 return []; 9206 } 9207 return [ 9208 { 9209 name: "core/edit-site/open-styles-revisions", 9210 label: (0,external_wp_i18n_namespaceObject.__)("Open style revisions"), 9211 icon: backup_default, 9212 callback: ({ close }) => { 9213 close(); 9214 if (canvas !== "edit") { 9215 history.navigate("/styles?canvas=edit", { 9216 transition: "canvas-mode-edit-transition" 9217 }); 9218 } 9219 openGeneralSidebar("edit-site/global-styles"); 9220 setEditorCanvasContainerView( 9221 "global-styles-revisions" 9222 ); 9223 } 9224 } 9225 ]; 9226 }, [ 9227 history, 9228 openGeneralSidebar, 9229 setEditorCanvasContainerView, 9230 hasRevisions, 9231 canvas 9232 ]); 9233 return { 9234 isLoading: false, 9235 commands 9236 }; 9237 }; 9238 function useCommonCommands() { 9239 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9240 name: "core/edit-site/toggle-styles-welcome-guide", 9241 hook: getGlobalStylesToggleWelcomeGuideCommands() 9242 }); 9243 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9244 name: "core/edit-site/reset-global-styles", 9245 hook: getGlobalStylesResetCommands() 9246 }); 9247 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9248 name: "core/edit-site/open-styles-revisions", 9249 hook: getGlobalStylesOpenRevisionsCommands() 9250 }); 9251 } 9252 9253 9254 ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js 9255 9256 9257 var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); 9258 9259 9260 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 const { EditorContentSlotFill, ResizableEditor } = unlock(external_wp_editor_namespaceObject.privateApis); 9274 function getEditorCanvasContainerTitle(view) { 9275 switch (view) { 9276 case "style-book": 9277 return (0,external_wp_i18n_namespaceObject.__)("Style Book"); 9278 case "global-styles-revisions": 9279 case "global-styles-revisions:style-book": 9280 return (0,external_wp_i18n_namespaceObject.__)("Style Revisions"); 9281 default: 9282 return ""; 9283 } 9284 } 9285 function EditorCanvasContainer({ 9286 children, 9287 closeButtonLabel, 9288 onClose, 9289 enableResizing = false 9290 }) { 9291 const { editorCanvasContainerView, showListViewByDefault } = (0,external_wp_data_.useSelect)( 9292 (select) => { 9293 const _editorCanvasContainerView = unlock( 9294 select(store) 9295 ).getEditorCanvasContainerView(); 9296 const _showListViewByDefault = select(external_wp_preferences_.store).get( 9297 "core", 9298 "showListViewByDefault" 9299 ); 9300 return { 9301 editorCanvasContainerView: _editorCanvasContainerView, 9302 showListViewByDefault: _showListViewByDefault 9303 }; 9304 }, 9305 [] 9306 ); 9307 const [isClosed, setIsClosed] = (0,external_wp_element_.useState)(false); 9308 const { setEditorCanvasContainerView } = unlock( 9309 (0,external_wp_data_.useDispatch)(store) 9310 ); 9311 const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); 9312 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)("firstElement"); 9313 const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); 9314 function onCloseContainer() { 9315 setIsListViewOpened(showListViewByDefault); 9316 setEditorCanvasContainerView(void 0); 9317 setIsClosed(true); 9318 if (typeof onClose === "function") { 9319 onClose(); 9320 } 9321 } 9322 function closeOnEscape(event) { 9323 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 9324 event.preventDefault(); 9325 onCloseContainer(); 9326 } 9327 } 9328 const childrenWithProps = Array.isArray(children) ? external_wp_element_.Children.map( 9329 children, 9330 (child, index) => index === 0 ? (0,external_wp_element_.cloneElement)(child, { 9331 ref: sectionFocusReturnRef 9332 }) : child 9333 ) : (0,external_wp_element_.cloneElement)(children, { 9334 ref: sectionFocusReturnRef 9335 }); 9336 if (isClosed) { 9337 return null; 9338 } 9339 const title = getEditorCanvasContainerTitle(editorCanvasContainerView); 9340 const shouldShowCloseButton = onClose || closeButtonLabel; 9341 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-editor-canvas-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { enableResizing, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 9342 "section", 9343 { 9344 className: "edit-site-editor-canvas-container__section", 9345 ref: shouldShowCloseButton ? focusOnMountRef : null, 9346 onKeyDown: closeOnEscape, 9347 "aria-label": title, 9348 children: [ 9349 shouldShowCloseButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9350 external_wp_components_namespaceObject.Button, 9351 { 9352 size: "compact", 9353 className: "edit-site-editor-canvas-container__close-button", 9354 icon: close_small_default, 9355 label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)("Close"), 9356 onClick: onCloseContainer 9357 } 9358 ), 9359 childrenWithProps 9360 ] 9361 } 9362 ) }) }) }); 9363 } 9364 function useHasEditorCanvasContainer() { 9365 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.name); 9366 return !!fills?.length; 9367 } 9368 var editor_canvas_container_default = EditorCanvasContainer; 9369 9370 9371 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js 9372 9373 9374 9375 9376 9377 9378 const { useCommandContext } = unlock(external_wp_commands_namespaceObject.privateApis); 9379 const { useLocation: use_set_command_context_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 9380 function useSetCommandContext() { 9381 const { query = {} } = use_set_command_context_useLocation(); 9382 const { canvas = "view" } = query; 9383 const hasBlockSelected = (0,external_wp_data_.useSelect)((select) => { 9384 return select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(); 9385 }, []); 9386 const hasEditorCanvasContainer = useHasEditorCanvasContainer(); 9387 let commandContext = "site-editor"; 9388 if (canvas === "edit") { 9389 commandContext = "entity-edit"; 9390 } 9391 if (hasBlockSelected) { 9392 commandContext = "block-selection-edit"; 9393 } 9394 if (hasEditorCanvasContainer) { 9395 commandContext = ""; 9396 } 9397 useCommandContext(commandContext); 9398 } 9399 9400 9401 ;// ./node_modules/@wordpress/icons/build-module/library/styles.js 9402 9403 9404 var styles_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9405 external_wp_primitives_namespaceObject.Path, 9406 { 9407 fillRule: "evenodd", 9408 clipRule: "evenodd", 9409 d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" 9410 } 9411 ) }); 9412 9413 9414 ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js 9415 9416 9417 var navigation_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); 9418 9419 9420 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 9421 9422 9423 var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 9424 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), 9425 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" }) 9426 ] }); 9427 9428 9429 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 9430 9431 9432 var layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 9433 9434 9435 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 9436 9437 9438 var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); 9439 9440 9441 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js 9442 9443 9444 var chevron_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); 9445 9446 9447 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js 9448 9449 9450 var chevron_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); 9451 9452 9453 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js 9454 9455 9456 9457 function SidebarButton(props) { 9458 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9459 external_wp_components_namespaceObject.Button, 9460 { 9461 size: "compact", 9462 ...props, 9463 className: dist_clsx("edit-site-sidebar-button", props.className) 9464 } 9465 ); 9466 } 9467 9468 9469 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 const { useHistory: sidebar_navigation_screen_useHistory, useLocation: sidebar_navigation_screen_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 9485 function SidebarNavigationScreen({ 9486 isRoot, 9487 title, 9488 actions, 9489 content, 9490 footer, 9491 description, 9492 backPath: backPathProp 9493 }) { 9494 const { dashboardLink, dashboardLinkText, previewingThemeName } = (0,external_wp_data_.useSelect)( 9495 (select) => { 9496 const { getSettings } = unlock(select(store)); 9497 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 9498 return { 9499 dashboardLink: getSettings().__experimentalDashboardLink, 9500 dashboardLinkText: getSettings().__experimentalDashboardLinkText, 9501 // Do not call `getTheme` with null, it will cause a request to 9502 // the server. 9503 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0 9504 }; 9505 }, 9506 [] 9507 ); 9508 const location = sidebar_navigation_screen_useLocation(); 9509 const history = sidebar_navigation_screen_useHistory(); 9510 const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext); 9511 const backPath = backPathProp ?? location.state?.backPath; 9512 const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default; 9513 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 9514 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 9515 external_wp_components_namespaceObject.__experimentalVStack, 9516 { 9517 className: dist_clsx("edit-site-sidebar-navigation-screen__main", { 9518 "has-footer": !!footer 9519 }), 9520 spacing: 0, 9521 justify: "flex-start", 9522 children: [ 9523 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 9524 external_wp_components_namespaceObject.__experimentalHStack, 9525 { 9526 spacing: 3, 9527 alignment: "flex-start", 9528 className: "edit-site-sidebar-navigation-screen__title-icon", 9529 children: [ 9530 !isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9531 SidebarButton, 9532 { 9533 onClick: () => { 9534 history.navigate(backPath); 9535 navigate("back"); 9536 }, 9537 icon, 9538 label: (0,external_wp_i18n_namespaceObject.__)("Back"), 9539 showTooltip: false 9540 } 9541 ), 9542 isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9543 SidebarButton, 9544 { 9545 icon, 9546 label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"), 9547 href: dashboardLink 9548 } 9549 ), 9550 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9551 external_wp_components_namespaceObject.__experimentalHeading, 9552 { 9553 className: "edit-site-sidebar-navigation-screen__title", 9554 color: "#e0e0e0", 9555 level: 1, 9556 size: 20, 9557 children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)( 9558 /* translators: 1: theme name. 2: title */ 9559 (0,external_wp_i18n_namespaceObject.__)("Previewing %1$s: %2$s"), 9560 previewingThemeName, 9561 title 9562 ) 9563 } 9564 ), 9565 actions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__actions", children: actions }) 9566 ] 9567 } 9568 ), 9569 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-sidebar-navigation-screen__content", children: [ 9570 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__description", children: description }), 9571 content 9572 ] }) 9573 ] 9574 } 9575 ), 9576 footer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { className: "edit-site-sidebar-navigation-screen__footer", children: footer }) 9577 ] }); 9578 } 9579 9580 9581 ;// ./node_modules/@wordpress/icons/build-module/icon/index.js 9582 9583 var icon_default = (0,external_wp_element_.forwardRef)( 9584 ({ icon, size = 24, ...props }, ref) => { 9585 return (0,external_wp_element_.cloneElement)(icon, { 9586 width: size, 9587 height: size, 9588 ...props, 9589 ref 9590 }); 9591 } 9592 ); 9593 9594 9595 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 9596 9597 9598 var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); 9599 9600 9601 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 9602 9603 9604 var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); 9605 9606 9607 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 const { useHistory: sidebar_navigation_item_useHistory, useLink } = unlock(external_wp_router_namespaceObject.privateApis); 9618 function SidebarNavigationItem({ 9619 className, 9620 icon, 9621 withChevron = false, 9622 suffix, 9623 uid, 9624 to, 9625 onClick, 9626 children, 9627 ...props 9628 }) { 9629 const history = sidebar_navigation_item_useHistory(); 9630 const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext); 9631 function handleClick(e) { 9632 if (onClick) { 9633 onClick(e); 9634 navigate("forward"); 9635 } else if (to) { 9636 e.preventDefault(); 9637 history.navigate(to); 9638 navigate("forward", `[id="$uid}"]`); 9639 } 9640 } 9641 const linkProps = useLink(to); 9642 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9643 external_wp_components_namespaceObject.__experimentalItem, 9644 { 9645 className: dist_clsx( 9646 "edit-site-sidebar-navigation-item", 9647 { "with-suffix": !withChevron && suffix }, 9648 className 9649 ), 9650 id: uid, 9651 onClick: handleClick, 9652 href: to ? linkProps.href : void 0, 9653 ...props, 9654 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 9655 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9656 icon_default, 9657 { 9658 style: { fill: "currentcolor" }, 9659 icon, 9660 size: 24 9661 } 9662 ), 9663 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children }), 9664 withChevron && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9665 icon_default, 9666 { 9667 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default, 9668 className: "edit-site-sidebar-navigation-item__drilldown-indicator", 9669 size: 24 9670 } 9671 ), 9672 !withChevron && suffix 9673 ] }) 9674 } 9675 ); 9676 } 9677 9678 9679 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js 9680 9681 9682 9683 9684 9685 const SITE_EDITOR_AUTHORS_QUERY = { 9686 per_page: -1, 9687 _fields: "id,name,avatar_urls", 9688 context: "view", 9689 capabilities: ["edit_theme_options"] 9690 }; 9691 const DEFAULT_QUERY = { per_page: 100, page: 1 }; 9692 const use_global_styles_revisions_EMPTY_ARRAY = []; 9693 const { GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9694 function useGlobalStylesRevisions({ query } = {}) { 9695 const { user: userConfig } = (0,external_wp_element_.useContext)(use_global_styles_revisions_GlobalStylesContext); 9696 const _query = { ...DEFAULT_QUERY, ...query }; 9697 const { 9698 authors, 9699 currentUser, 9700 isDirty, 9701 revisions, 9702 isLoadingGlobalStylesRevisions, 9703 revisionsCount 9704 } = (0,external_wp_data_.useSelect)( 9705 (select) => { 9706 const { 9707 __experimentalGetDirtyEntityRecords, 9708 getCurrentUser, 9709 getUsers, 9710 getRevisions, 9711 __experimentalGetCurrentGlobalStylesId, 9712 getEntityRecord, 9713 isResolving 9714 } = select(external_wp_coreData_namespaceObject.store); 9715 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 9716 const _currentUser = getCurrentUser(); 9717 const _isDirty = dirtyEntityRecords.length > 0; 9718 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9719 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; 9720 const _revisionsCount = globalStyles?._links?.["version-history"]?.[0]?.count ?? 0; 9721 const globalStylesRevisions = getRevisions( 9722 "root", 9723 "globalStyles", 9724 globalStylesId, 9725 _query 9726 ) || use_global_styles_revisions_EMPTY_ARRAY; 9727 const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY; 9728 const _isResolving = isResolving("getRevisions", [ 9729 "root", 9730 "globalStyles", 9731 globalStylesId, 9732 _query 9733 ]); 9734 return { 9735 authors: _authors, 9736 currentUser: _currentUser, 9737 isDirty: _isDirty, 9738 revisions: globalStylesRevisions, 9739 isLoadingGlobalStylesRevisions: _isResolving, 9740 revisionsCount: _revisionsCount 9741 }; 9742 }, 9743 [query] 9744 ); 9745 return (0,external_wp_element_.useMemo)(() => { 9746 if (!authors.length || isLoadingGlobalStylesRevisions) { 9747 return { 9748 revisions: use_global_styles_revisions_EMPTY_ARRAY, 9749 hasUnsavedChanges: isDirty, 9750 isLoading: true, 9751 revisionsCount 9752 }; 9753 } 9754 const _modifiedRevisions = revisions.map((revision) => { 9755 return { 9756 ...revision, 9757 author: authors.find( 9758 (author) => author.id === revision.author 9759 ) 9760 }; 9761 }); 9762 const fetchedRevisionsCount = revisions.length; 9763 if (fetchedRevisionsCount) { 9764 if (_modifiedRevisions[0].id !== "unsaved" && _query.page === 1) { 9765 _modifiedRevisions[0].isLatest = true; 9766 } 9767 if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { 9768 const unsavedRevision = { 9769 id: "unsaved", 9770 styles: userConfig?.styles, 9771 settings: userConfig?.settings, 9772 _links: userConfig?._links, 9773 author: { 9774 name: currentUser?.name, 9775 avatar_urls: currentUser?.avatar_urls 9776 }, 9777 modified: /* @__PURE__ */ new Date() 9778 }; 9779 _modifiedRevisions.unshift(unsavedRevision); 9780 } 9781 if (_query.page === Math.ceil(revisionsCount / _query.per_page)) { 9782 _modifiedRevisions.push({ 9783 id: "parent", 9784 styles: {}, 9785 settings: {} 9786 }); 9787 } 9788 } 9789 return { 9790 revisions: _modifiedRevisions, 9791 hasUnsavedChanges: isDirty, 9792 isLoading: false, 9793 revisionsCount 9794 }; 9795 }, [ 9796 isDirty, 9797 revisions, 9798 currentUser, 9799 authors, 9800 userConfig, 9801 isLoadingGlobalStylesRevisions 9802 ]); 9803 } 9804 9805 9806 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js 9807 9808 9809 9810 9811 9812 9813 function SidebarNavigationScreenDetailsFooter({ 9814 record, 9815 revisionsCount, 9816 ...otherProps 9817 }) { 9818 const hrefProps = {}; 9819 const lastRevisionId = record?._links?.["predecessor-version"]?.[0]?.id ?? null; 9820 revisionsCount = revisionsCount || record?._links?.["version-history"]?.[0]?.count || 0; 9821 if (lastRevisionId && revisionsCount > 1) { 9822 hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { 9823 revision: record?._links["predecessor-version"][0].id 9824 }); 9825 hrefProps.as = "a"; 9826 } 9827 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9828 external_wp_components_namespaceObject.__experimentalItemGroup, 9829 { 9830 size: "large", 9831 className: "edit-site-sidebar-navigation-screen-details-footer", 9832 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9833 SidebarNavigationItem, 9834 { 9835 icon: backup_default, 9836 ...hrefProps, 9837 ...otherProps, 9838 children: (0,external_wp_i18n_namespaceObject.sprintf)( 9839 /* translators: %d: Number of Styles revisions. */ 9840 (0,external_wp_i18n_namespaceObject._n)("%d Revision", "%d Revisions", revisionsCount), 9841 revisionsCount 9842 ) 9843 } 9844 ) 9845 } 9846 ); 9847 } 9848 9849 9850 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 const { useLocation: sidebar_navigation_screen_global_styles_useLocation, useHistory: sidebar_navigation_screen_global_styles_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 9866 function SidebarNavigationItemGlobalStyles(props) { 9867 const { name } = sidebar_navigation_screen_global_styles_useLocation(); 9868 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9869 SidebarNavigationItem, 9870 { 9871 ...props, 9872 "aria-current": name === "styles" 9873 } 9874 ); 9875 } 9876 function SidebarNavigationScreenGlobalStyles() { 9877 const history = sidebar_navigation_screen_global_styles_useHistory(); 9878 const { path } = sidebar_navigation_screen_global_styles_useLocation(); 9879 const { 9880 revisions, 9881 isLoading: isLoadingRevisions, 9882 revisionsCount 9883 } = useGlobalStylesRevisions(); 9884 const { openGeneralSidebar } = (0,external_wp_data_.useDispatch)(store); 9885 const { setEditorCanvasContainerView } = unlock( 9886 (0,external_wp_data_.useDispatch)(store) 9887 ); 9888 const { set: setPreference } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 9889 const openGlobalStyles = (0,external_wp_element_.useCallback)(async () => { 9890 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), { 9891 transition: "canvas-mode-edit-transition" 9892 }); 9893 return Promise.all([ 9894 setPreference("core", "distractionFree", false), 9895 openGeneralSidebar("edit-site/global-styles") 9896 ]); 9897 }, [path, history, openGeneralSidebar, setPreference]); 9898 const openRevisions = (0,external_wp_element_.useCallback)(async () => { 9899 await openGlobalStyles(); 9900 setEditorCanvasContainerView("global-styles-revisions"); 9901 }, [openGlobalStyles, setEditorCanvasContainerView]); 9902 const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions; 9903 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9904 SidebarNavigationScreen, 9905 { 9906 title: (0,external_wp_i18n_namespaceObject.__)("Design"), 9907 isRoot: true, 9908 description: (0,external_wp_i18n_namespaceObject.__)( 9909 "Customize the appearance of your website using the block editor." 9910 ), 9911 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { activeItem: "styles-navigation-item" }), 9912 footer: shouldShowGlobalStylesFooter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9913 SidebarNavigationScreenDetailsFooter, 9914 { 9915 record: revisions?.[0], 9916 revisionsCount, 9917 onClick: openRevisions 9918 } 9919 ) 9920 } 9921 ) }); 9922 } 9923 9924 9925 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 function MainSidebarNavigationContent({ isBlockBasedTheme = true }) { 9939 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-main", children: [ 9940 isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 9941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9942 SidebarNavigationItemGlobalStyles, 9943 { 9944 to: "/styles", 9945 uid: "global-styles-navigation-item", 9946 icon: styles_default, 9947 children: (0,external_wp_i18n_namespaceObject.__)("Styles") 9948 } 9949 ), 9950 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9951 SidebarNavigationItem, 9952 { 9953 uid: "navigation-navigation-item", 9954 to: "/navigation", 9955 withChevron: true, 9956 icon: navigation_default, 9957 children: (0,external_wp_i18n_namespaceObject.__)("Navigation") 9958 } 9959 ), 9960 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9961 SidebarNavigationItem, 9962 { 9963 uid: "page-navigation-item", 9964 to: "/page", 9965 withChevron: true, 9966 icon: page_default, 9967 children: (0,external_wp_i18n_namespaceObject.__)("Pages") 9968 } 9969 ), 9970 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9971 SidebarNavigationItem, 9972 { 9973 uid: "template-navigation-item", 9974 to: "/template", 9975 withChevron: true, 9976 icon: layout_default, 9977 children: (0,external_wp_i18n_namespaceObject.__)("Templates") 9978 } 9979 ) 9980 ] }), 9981 !isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9982 SidebarNavigationItem, 9983 { 9984 uid: "stylebook-navigation-item", 9985 to: "/stylebook", 9986 withChevron: true, 9987 icon: styles_default, 9988 children: (0,external_wp_i18n_namespaceObject.__)("Styles") 9989 } 9990 ), 9991 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9992 SidebarNavigationItem, 9993 { 9994 uid: "patterns-navigation-item", 9995 to: "/pattern", 9996 withChevron: true, 9997 icon: symbol_default, 9998 children: (0,external_wp_i18n_namespaceObject.__)("Patterns") 9999 } 10000 ) 10001 ] }); 10002 } 10003 function SidebarNavigationScreenMain({ customDescription }) { 10004 const isBlockBasedTheme = (0,external_wp_data_.useSelect)( 10005 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, 10006 [] 10007 ); 10008 const { setEditorCanvasContainerView } = unlock( 10009 (0,external_wp_data_.useDispatch)(store) 10010 ); 10011 (0,external_wp_element_.useEffect)(() => { 10012 setEditorCanvasContainerView(void 0); 10013 }, [setEditorCanvasContainerView]); 10014 let description; 10015 if (customDescription) { 10016 description = customDescription; 10017 } else if (isBlockBasedTheme) { 10018 description = (0,external_wp_i18n_namespaceObject.__)( 10019 "Customize the appearance of your website using the block editor." 10020 ); 10021 } else { 10022 description = (0,external_wp_i18n_namespaceObject.__)( 10023 "Explore block styles and patterns to refine your site." 10024 ); 10025 } 10026 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10027 SidebarNavigationScreen, 10028 { 10029 isRoot: true, 10030 title: (0,external_wp_i18n_namespaceObject.__)("Design"), 10031 description, 10032 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10033 MainSidebarNavigationContent, 10034 { 10035 isBlockBasedTheme 10036 } 10037 ) 10038 } 10039 ); 10040 } 10041 10042 10043 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.js 10044 10045 10046 10047 function SidebarNavigationScreenUnsupported() { 10048 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 3, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)( 10049 "The theme you are currently using does not support this screen." 10050 ) }) }); 10051 } 10052 10053 10054 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js 10055 10056 10057 var arrow_up_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) }); 10058 10059 10060 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js 10061 10062 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { 10063 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { className: "edit-site-welcome-guide__image", children: [ 10064 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10065 "source", 10066 { 10067 srcSet: nonAnimatedSrc, 10068 media: "(prefers-reduced-motion: reduce)" 10069 } 10070 ), 10071 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) 10072 ] }); 10073 } 10074 10075 10076 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js 10077 10078 10079 10080 10081 10082 10083 10084 10085 function WelcomeGuideEditor() { 10086 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 10087 const { isActive, isBlockBasedTheme } = (0,external_wp_data_.useSelect)((select) => { 10088 return { 10089 isActive: !!select(external_wp_preferences_.store).get( 10090 "core/edit-site", 10091 "welcomeGuide" 10092 ), 10093 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme 10094 }; 10095 }, []); 10096 if (!isActive || !isBlockBasedTheme) { 10097 return null; 10098 } 10099 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10100 external_wp_components_namespaceObject.Guide, 10101 { 10102 className: "edit-site-welcome-guide guide-editor", 10103 contentLabel: (0,external_wp_i18n_namespaceObject.__)("Welcome to the site editor"), 10104 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"), 10105 onFinish: () => toggle("core/edit-site", "welcomeGuide"), 10106 pages: [ 10107 { 10108 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10109 WelcomeGuideImage, 10110 { 10111 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", 10112 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" 10113 } 10114 ), 10115 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10116 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Edit your site") }), 10117 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( 10118 "Design everything on your site \u2014 from the header right down to the footer \u2014 using blocks." 10119 ) }), 10120 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_element_.createInterpolateElement)( 10121 (0,external_wp_i18n_namespaceObject.__)( 10122 "Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors." 10123 ), 10124 { 10125 StylesIconImage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10126 "img", 10127 { 10128 alt: (0,external_wp_i18n_namespaceObject.__)("styles"), 10129 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A" 10130 } 10131 ) 10132 } 10133 ) }) 10134 ] }) 10135 } 10136 ] 10137 } 10138 ); 10139 } 10140 10141 10142 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js 10143 10144 10145 10146 10147 10148 10149 10150 10151 const { interfaceStore: styles_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); 10152 function WelcomeGuideStyles() { 10153 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 10154 const { isActive, isStylesOpen } = (0,external_wp_data_.useSelect)((select) => { 10155 const sidebar = select(styles_interfaceStore).getActiveComplementaryArea("core"); 10156 return { 10157 isActive: !!select(external_wp_preferences_.store).get( 10158 "core/edit-site", 10159 "welcomeGuideStyles" 10160 ), 10161 isStylesOpen: sidebar === "edit-site/global-styles" 10162 }; 10163 }, []); 10164 if (!isActive || !isStylesOpen) { 10165 return null; 10166 } 10167 const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)("Welcome to Styles"); 10168 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10169 external_wp_components_namespaceObject.Guide, 10170 { 10171 className: "edit-site-welcome-guide guide-styles", 10172 contentLabel: welcomeLabel, 10173 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"), 10174 onFinish: () => toggle("core/edit-site", "welcomeGuideStyles"), 10175 pages: [ 10176 { 10177 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10178 WelcomeGuideImage, 10179 { 10180 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", 10181 animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" 10182 } 10183 ), 10184 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10185 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: welcomeLabel }), 10186 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( 10187 "Tweak your site, or give it a whole new look! Get creative \u2014 how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here." 10188 ) }) 10189 ] }) 10190 }, 10191 { 10192 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10193 WelcomeGuideImage, 10194 { 10195 nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", 10196 animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" 10197 } 10198 ), 10199 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Set the design") }), 10201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( 10202 "You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!" 10203 ) }) 10204 ] }) 10205 }, 10206 { 10207 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10208 WelcomeGuideImage, 10209 { 10210 nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", 10211 animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" 10212 } 10213 ), 10214 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10215 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Personalize blocks") }), 10216 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( 10217 "You can adjust your blocks to ensure a cohesive experience across your site \u2014 add your unique colors to a branded Button block, or adjust the Heading block to your preferred size." 10218 ) }) 10219 ] }) 10220 }, 10221 { 10222 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10223 WelcomeGuideImage, 10224 { 10225 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 10226 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 10227 } 10228 ), 10229 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10230 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Learn more") }), 10231 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "edit-site-welcome-guide__text", children: [ 10232 (0,external_wp_i18n_namespaceObject.__)( 10233 "New to block themes and styling your site?" 10234 ), 10235 " ", 10236 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10237 external_wp_components_namespaceObject.ExternalLink, 10238 { 10239 href: (0,external_wp_i18n_namespaceObject.__)( 10240 "https://wordpress.org/documentation/article/styles-overview/" 10241 ), 10242 children: (0,external_wp_i18n_namespaceObject.__)( 10243 "Here\u2019s a detailed guide to learn how to make the most of it." 10244 ) 10245 } 10246 ) 10247 ] }) 10248 ] }) 10249 } 10250 ] 10251 } 10252 ); 10253 } 10254 10255 10256 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js 10257 10258 10259 10260 10261 10262 function WelcomeGuidePage() { 10263 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 10264 const isVisible = (0,external_wp_data_.useSelect)((select) => { 10265 const isPageActive = !!select(external_wp_preferences_.store).get( 10266 "core/edit-site", 10267 "welcomeGuidePage" 10268 ); 10269 const isEditorActive = !!select(external_wp_preferences_.store).get( 10270 "core/edit-site", 10271 "welcomeGuide" 10272 ); 10273 return isPageActive && !isEditorActive; 10274 }, []); 10275 if (!isVisible) { 10276 return null; 10277 } 10278 const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a page"); 10279 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10280 external_wp_components_namespaceObject.Guide, 10281 { 10282 className: "edit-site-welcome-guide guide-page", 10283 contentLabel: heading, 10284 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"), 10285 onFinish: () => toggle("core/edit-site", "welcomeGuidePage"), 10286 pages: [ 10287 { 10288 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10289 "video", 10290 { 10291 className: "edit-site-welcome-guide__video", 10292 autoPlay: true, 10293 loop: true, 10294 muted: true, 10295 width: "312", 10296 height: "240", 10297 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10298 "source", 10299 { 10300 src: "https://s.w.org/images/block-editor/editing-your-page.mp4", 10301 type: "video/mp4" 10302 } 10303 ) 10304 } 10305 ), 10306 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10307 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), 10308 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( 10309 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 10310 "It\u2019s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar." 10311 ) }) 10312 ] }) 10313 } 10314 ] 10315 } 10316 ); 10317 } 10318 10319 10320 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js 10321 10322 10323 10324 10325 10326 10327 function WelcomeGuideTemplate() { 10328 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 10329 const { isActive, hasPreviousEntity } = (0,external_wp_data_.useSelect)((select) => { 10330 const { getEditorSettings } = select(external_wp_editor_namespaceObject.store); 10331 const { get } = select(external_wp_preferences_.store); 10332 return { 10333 isActive: get("core/edit-site", "welcomeGuideTemplate"), 10334 hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord 10335 }; 10336 }, []); 10337 const isVisible = isActive && hasPreviousEntity; 10338 if (!isVisible) { 10339 return null; 10340 } 10341 const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a template"); 10342 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10343 external_wp_components_namespaceObject.Guide, 10344 { 10345 className: "edit-site-welcome-guide guide-template", 10346 contentLabel: heading, 10347 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"), 10348 onFinish: () => toggle("core/edit-site", "welcomeGuideTemplate"), 10349 pages: [ 10350 { 10351 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10352 "video", 10353 { 10354 className: "edit-site-welcome-guide__video", 10355 autoPlay: true, 10356 loop: true, 10357 muted: true, 10358 width: "312", 10359 height: "240", 10360 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10361 "source", 10362 { 10363 src: "https://s.w.org/images/block-editor/editing-your-template.mp4", 10364 type: "video/mp4" 10365 } 10366 ) 10367 } 10368 ), 10369 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10370 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), 10371 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( 10372 "Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the \u2018Back\u2019 button in the toolbar." 10373 ) }) 10374 ] }) 10375 } 10376 ] 10377 } 10378 ); 10379 } 10380 10381 10382 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js 10383 10384 10385 10386 10387 10388 function WelcomeGuide({ postType }) { 10389 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10390 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}), 10391 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}), 10392 postType === "page" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}), 10393 postType === "wp_template" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {}) 10394 ] }); 10395 } 10396 10397 10398 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js 10399 10400 10401 10402 10403 10404 const { useGlobalStylesOutput } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10405 function useGlobalStylesRenderer(disableRootPadding) { 10406 const [styles, settings] = useGlobalStylesOutput(disableRootPadding); 10407 const { getSettings } = (0,external_wp_data_.useSelect)(store); 10408 const { updateSettings } = (0,external_wp_data_.useDispatch)(store); 10409 (0,external_wp_element_.useEffect)(() => { 10410 if (!styles || !settings) { 10411 return; 10412 } 10413 const currentStoreSettings = getSettings(); 10414 const nonGlobalStyles = Object.values( 10415 currentStoreSettings.styles ?? [] 10416 ).filter((style) => !style.isGlobalStyles); 10417 updateSettings({ 10418 ...currentStoreSettings, 10419 styles: [...nonGlobalStyles, ...styles], 10420 __experimentalFeatures: settings 10421 }); 10422 }, [styles, settings, updateSettings, getSettings]); 10423 } 10424 function GlobalStylesRenderer({ disableRootPadding }) { 10425 useGlobalStylesRenderer(disableRootPadding); 10426 return null; 10427 } 10428 10429 10430 ;// ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js 10431 10432 10433 10434 10435 10436 10437 10438 const { Theme } = unlock(external_wp_components_namespaceObject.privateApis); 10439 const { useGlobalStyle: canvas_loader_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10440 function CanvasLoader({ id }) { 10441 const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle("color.text"); 10442 const [backgroundColor] = canvas_loader_useGlobalStyle("color.background"); 10443 const { highlightedColors } = useStylesPreviewColors(); 10444 const indicatorColor = highlightedColors[0]?.color ?? fallbackIndicatorColor; 10445 const { elapsed, total } = (0,external_wp_data_.useSelect)((select) => { 10446 const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus(); 10447 const resolving = selectorsByStatus.resolving ?? 0; 10448 const finished = selectorsByStatus.finished ?? 0; 10449 return { 10450 elapsed: finished, 10451 total: finished + resolving 10452 }; 10453 }, []); 10454 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-canvas-loader", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, { accent: indicatorColor, background: backgroundColor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, { id, max: total, value: elapsed }) }) }); 10455 } 10456 10457 10458 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js 10459 10460 10461 10462 const { useHistory: use_navigate_to_entity_record_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 10463 function useNavigateToEntityRecord() { 10464 const history = use_navigate_to_entity_record_useHistory(); 10465 const onNavigateToEntityRecord = (0,external_wp_element_.useCallback)( 10466 (params) => { 10467 history.navigate( 10468 `/$params.postType}/$params.postId}?canvas=edit&focusMode=true` 10469 ); 10470 }, 10471 [history] 10472 ); 10473 return onNavigateToEntityRecord; 10474 } 10475 10476 10477 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js 10478 10479 10480 10481 10482 10483 10484 10485 10486 const { useLocation: use_site_editor_settings_useLocation, useHistory: use_site_editor_settings_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 10487 function useNavigateToPreviousEntityRecord() { 10488 const location = use_site_editor_settings_useLocation(); 10489 const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location); 10490 const history = use_site_editor_settings_useHistory(); 10491 const goBack = (0,external_wp_element_.useMemo)(() => { 10492 const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType); 10493 const didComeFromEditorCanvas = previousLocation?.query.canvas === "edit"; 10494 const showBackButton = isFocusMode && didComeFromEditorCanvas; 10495 return showBackButton ? () => history.back() : void 0; 10496 }, [location, history]); 10497 return goBack; 10498 } 10499 function useSpecificEditorSettings() { 10500 const { query } = use_site_editor_settings_useLocation(); 10501 const { canvas = "view" } = query; 10502 const onNavigateToEntityRecord = useNavigateToEntityRecord(); 10503 const { settings } = (0,external_wp_data_.useSelect)((select) => { 10504 const { getSettings } = select(store); 10505 return { 10506 settings: getSettings() 10507 }; 10508 }, []); 10509 const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); 10510 const defaultEditorSettings = (0,external_wp_element_.useMemo)(() => { 10511 return { 10512 ...settings, 10513 richEditingEnabled: true, 10514 supportsTemplateMode: true, 10515 focusMode: canvas !== "view", 10516 onNavigateToEntityRecord, 10517 onNavigateToPreviousEntityRecord, 10518 isPreviewMode: canvas === "view" 10519 }; 10520 }, [ 10521 settings, 10522 canvas, 10523 onNavigateToEntityRecord, 10524 onNavigateToPreviousEntityRecord 10525 ]); 10526 return defaultEditorSettings; 10527 } 10528 10529 10530 ;// ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js 10531 10532 10533 10534 10535 10536 const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginTemplateSettingPanel"); 10537 const PluginTemplateSettingPanel = ({ children }) => { 10538 external_wp_deprecated_default()("wp.editSite.PluginTemplateSettingPanel", { 10539 since: "6.6", 10540 version: "6.8", 10541 alternative: "wp.editor.PluginDocumentSettingPanel" 10542 }); 10543 const isCurrentEntityTemplate = (0,external_wp_data_.useSelect)( 10544 (select) => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === "wp_template", 10545 [] 10546 ); 10547 if (!isCurrentEntityTemplate) { 10548 return null; 10549 } 10550 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children }); 10551 }; 10552 PluginTemplateSettingPanel.Slot = Slot; 10553 var plugin_template_setting_panel_default = PluginTemplateSettingPanel; 10554 10555 10556 ;// ./node_modules/@wordpress/icons/build-module/library/seen.js 10557 10558 10559 var seen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) }); 10560 10561 10562 ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 10563 10564 10565 var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 10566 10567 10568 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js 10569 10570 10571 10572 function IconWithCurrentColor({ className, ...props }) { 10573 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10574 external_wp_components_namespaceObject.Icon, 10575 { 10576 className: dist_clsx( 10577 className, 10578 "edit-site-global-styles-icon-with-current-color" 10579 ), 10580 ...props 10581 } 10582 ); 10583 } 10584 10585 10586 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js 10587 10588 10589 10590 function GenericNavigationButton({ icon, children, ...props }) { 10591 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { ...props, children: [ 10592 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 10593 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon, size: 24 }), 10594 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children }) 10595 ] }), 10596 !icon && children 10597 ] }); 10598 } 10599 function NavigationButtonAsItem(props) { 10600 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { as: GenericNavigationButton, ...props }); 10601 } 10602 function NavigationBackButtonAsItem(props) { 10603 return /* @__PURE__ */ jsx(Navigator.BackButton, { as: GenericNavigationButton, ...props }); 10604 } 10605 10606 10607 ;// ./node_modules/@wordpress/icons/build-module/library/typography.js 10608 10609 10610 var typography_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m8.6 7 3.9 10.8h-1.7l-1-2.8H5.7l-1 2.8H3L6.9 7h1.7Zm-2.4 6.6h3L7.7 9.3l-1.5 4.3ZM17.691 8.879c.473 0 .88.055 1.221.165.352.1.643.264.875.495.274.253.456.572.544.957.088.374.132.83.132 1.37v4.554c0 .274.033.472.099.593.077.11.198.166.363.166.11 0 .215-.028.313-.083.11-.055.237-.137.38-.247l.165.28a3.304 3.304 0 0 1-.71.446c-.23.11-.527.165-.89.165-.352 0-.639-.055-.858-.165-.22-.11-.386-.27-.495-.479-.1-.209-.149-.468-.149-.775-.286.462-.627.814-1.023 1.056-.396.242-.858.363-1.386.363-.462 0-.858-.088-1.188-.264a1.752 1.752 0 0 1-.742-.726 2.201 2.201 0 0 1-.248-1.056c0-.484.11-.875.33-1.172.22-.308.5-.556.841-.742.352-.187.721-.341 1.106-.462.396-.132.765-.253 1.106-.363.351-.121.637-.259.857-.413.232-.154.347-.357.347-.61V10.81c0-.396-.066-.71-.198-.941a1.05 1.05 0 0 0-.511-.511 1.763 1.763 0 0 0-.76-.149c-.253 0-.522.039-.808.116a1.165 1.165 0 0 0-.677.412 1.1 1.1 0 0 1 .595.396c.165.187.247.424.247.71 0 .307-.104.55-.313.726-.198.176-.451.263-.76.263-.34 0-.594-.104-.758-.313a1.231 1.231 0 0 1-.248-.759c0-.297.072-.539.214-.726.154-.187.352-.363.595-.528.264-.176.6-.324 1.006-.445.418-.121.88-.182 1.386-.182Zm.99 3.729a1.57 1.57 0 0 1-.528.462c-.231.121-.479.248-.742.38a5.377 5.377 0 0 0-.76.462c-.23.165-.423.38-.577.643-.154.264-.231.6-.231 1.007 0 .429.11.77.33 1.023.22.242.517.363.891.363.308 0 .594-.088.858-.264.275-.176.528-.44.759-.792v-3.284Z" }) }); 10611 10612 10613 ;// ./node_modules/@wordpress/icons/build-module/library/color.js 10614 10615 10616 var color_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) }); 10617 10618 10619 ;// ./node_modules/@wordpress/icons/build-module/library/background.js 10620 10621 10622 var background_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10623 external_wp_primitives_namespaceObject.Path, 10624 { 10625 fillRule: "evenodd", 10626 clipRule: "evenodd", 10627 d: "M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z" 10628 } 10629 ) }); 10630 10631 10632 ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js 10633 10634 10635 var shadow_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) }); 10636 10637 10638 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js 10639 10640 10641 10642 10643 10644 10645 10646 const { 10647 useHasDimensionsPanel, 10648 useHasTypographyPanel, 10649 useHasColorPanel, 10650 useGlobalSetting: root_menu_useGlobalSetting, 10651 useSettingsForBlockElement, 10652 useHasBackgroundPanel 10653 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10654 function RootMenu() { 10655 const [rawSettings] = root_menu_useGlobalSetting(""); 10656 const settings = useSettingsForBlockElement(rawSettings); 10657 const hasBackgroundPanel = useHasBackgroundPanel(rawSettings); 10658 const hasTypographyPanel = useHasTypographyPanel(settings); 10659 const hasColorPanel = useHasColorPanel(settings); 10660 const hasShadowPanel = true; 10661 const hasDimensionsPanel = useHasDimensionsPanel(settings); 10662 const hasLayoutPanel = hasDimensionsPanel; 10663 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: [ 10664 hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10665 NavigationButtonAsItem, 10666 { 10667 icon: typography_default, 10668 path: "/typography", 10669 children: (0,external_wp_i18n_namespaceObject.__)("Typography") 10670 } 10671 ), 10672 hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: color_default, path: "/colors", children: (0,external_wp_i18n_namespaceObject.__)("Colors") }), 10673 hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10674 NavigationButtonAsItem, 10675 { 10676 icon: background_default, 10677 path: "/background", 10678 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Background styles"), 10679 children: (0,external_wp_i18n_namespaceObject.__)("Background") 10680 } 10681 ), 10682 hasShadowPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: shadow_default, path: "/shadows", children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }), 10683 hasLayoutPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: layout_default, path: "/layout", children: (0,external_wp_i18n_namespaceObject.__)("Layout") }) 10684 ] }) }); 10685 } 10686 var root_menu_default = RootMenu; 10687 10688 10689 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js 10690 function findNearest(input, numbers) { 10691 if (numbers.length === 0) { 10692 return null; 10693 } 10694 numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b)); 10695 return numbers[0]; 10696 } 10697 function extractFontWeights(fontFaces) { 10698 const result = []; 10699 fontFaces.forEach((face) => { 10700 const weights = String(face.fontWeight).split(" "); 10701 if (weights.length === 2) { 10702 const start = parseInt(weights[0]); 10703 const end = parseInt(weights[1]); 10704 for (let i = start; i <= end; i += 100) { 10705 result.push(i); 10706 } 10707 } else if (weights.length === 1) { 10708 result.push(parseInt(weights[0])); 10709 } 10710 }); 10711 return result; 10712 } 10713 function formatFontFamily(input) { 10714 const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; 10715 const output = input.trim(); 10716 const formatItem = (item) => { 10717 item = item.trim(); 10718 if (item.match(regex)) { 10719 item = item.replace(/^["']|["']$/g, ""); 10720 return `"$item}"`; 10721 } 10722 return item; 10723 }; 10724 if (output.includes(",")) { 10725 return output.split(",").map(formatItem).filter((item) => item !== "").join(", "); 10726 } 10727 return formatItem(output); 10728 } 10729 function formatFontFaceName(input) { 10730 if (!input) { 10731 return ""; 10732 } 10733 let output = input.trim(); 10734 if (output.includes(",")) { 10735 output = output.split(",").find((item) => item.trim() !== "").trim(); 10736 } 10737 output = output.replace(/^["']|["']$/g, ""); 10738 if (window.navigator.userAgent.toLowerCase().includes("firefox")) { 10739 output = `"$output}"`; 10740 } 10741 return output; 10742 } 10743 function getFamilyPreviewStyle(family) { 10744 const style = { fontFamily: formatFontFamily(family.fontFamily) }; 10745 if (!Array.isArray(family.fontFace)) { 10746 style.fontWeight = "400"; 10747 style.fontStyle = "normal"; 10748 return style; 10749 } 10750 if (family.fontFace) { 10751 const normalFaces = family.fontFace.filter( 10752 (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal" 10753 ); 10754 if (normalFaces.length > 0) { 10755 style.fontStyle = "normal"; 10756 const normalWeights = extractFontWeights(normalFaces); 10757 const nearestWeight = findNearest(400, normalWeights); 10758 style.fontWeight = String(nearestWeight) || "400"; 10759 } else { 10760 style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal"; 10761 style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400"; 10762 } 10763 } 10764 return style; 10765 } 10766 function getFacePreviewStyle(face) { 10767 return { 10768 fontFamily: formatFontFamily(face.fontFamily), 10769 fontStyle: face.fontStyle || "normal", 10770 fontWeight: face.fontWeight || "400" 10771 }; 10772 } 10773 10774 10775 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js 10776 function getVariationClassName(variation) { 10777 if (!variation) { 10778 return ""; 10779 } 10780 return `is-style-$variation}`; 10781 } 10782 function getNewIndexFromPresets(presets, slugPrefix) { 10783 const nameRegex = new RegExp(`^$slugPrefix}([\\d]+)$`); 10784 const highestPresetValue = presets.reduce((currentHighest, preset) => { 10785 if (typeof preset?.slug === "string") { 10786 const matches = preset?.slug.match(nameRegex); 10787 if (matches) { 10788 const id = parseInt(matches[1], 10); 10789 if (id > currentHighest) { 10790 return id; 10791 } 10792 } 10793 } 10794 return currentHighest; 10795 }, 0); 10796 return highestPresetValue + 1; 10797 } 10798 function getFontFamilyFromSetting(fontFamilies, setting) { 10799 if (!Array.isArray(fontFamilies) || !setting) { 10800 return null; 10801 } 10802 const fontFamilyVariable = setting.replace("var(", "").replace(")", ""); 10803 const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0]; 10804 return fontFamilies.find( 10805 (fontFamily) => fontFamily.slug === fontFamilySlug 10806 ); 10807 } 10808 function getFontFamilies(themeJson) { 10809 const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; 10810 const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; 10811 let fontFamilies = []; 10812 if (themeFontFamilies && customFontFamilies) { 10813 fontFamilies = [...themeFontFamilies, ...customFontFamilies]; 10814 } else if (themeFontFamilies) { 10815 fontFamilies = themeFontFamilies; 10816 } else if (customFontFamilies) { 10817 fontFamilies = customFontFamilies; 10818 } 10819 const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; 10820 const bodyFontFamily = getFontFamilyFromSetting( 10821 fontFamilies, 10822 bodyFontFamilySetting 10823 ); 10824 const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; 10825 let headingFontFamily; 10826 if (!headingFontFamilySetting) { 10827 headingFontFamily = bodyFontFamily; 10828 } else { 10829 headingFontFamily = getFontFamilyFromSetting( 10830 fontFamilies, 10831 themeJson?.styles?.elements?.heading?.typography?.fontFamily 10832 ); 10833 } 10834 return [bodyFontFamily, headingFontFamily]; 10835 } 10836 10837 10838 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 const { useGlobalStyle: typography_example_useGlobalStyle, GlobalStylesContext: typography_example_GlobalStylesContext } = unlock( 10849 external_wp_blockEditor_namespaceObject.privateApis 10850 ); 10851 const { mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); 10852 function PreviewTypography({ fontSize, variation }) { 10853 const { base } = (0,external_wp_element_.useContext)(typography_example_GlobalStylesContext); 10854 let config = base; 10855 if (variation) { 10856 config = mergeBaseAndUserConfigs(base, variation); 10857 } 10858 const [textColor] = typography_example_useGlobalStyle("color.text"); 10859 const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config); 10860 const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; 10861 const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; 10862 if (textColor) { 10863 bodyPreviewStyle.color = textColor; 10864 headingPreviewStyle.color = textColor; 10865 } 10866 if (fontSize) { 10867 bodyPreviewStyle.fontSize = fontSize; 10868 headingPreviewStyle.fontSize = fontSize; 10869 } 10870 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 10871 external_wp_components_namespaceObject.__unstableMotion.div, 10872 { 10873 animate: { 10874 scale: 1, 10875 opacity: 1 10876 }, 10877 initial: { 10878 scale: 0.1, 10879 opacity: 0 10880 }, 10881 transition: { 10882 delay: 0.3, 10883 type: "tween" 10884 }, 10885 style: { 10886 textAlign: "center", 10887 lineHeight: 1 10888 }, 10889 children: [ 10890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: headingPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("A", "Uppercase letter A") }), 10891 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: bodyPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("a", "Lowercase letter A") }) 10892 ] 10893 } 10894 ); 10895 } 10896 10897 10898 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js 10899 10900 10901 10902 function HighlightedColors({ 10903 normalizedColorSwatchSize, 10904 ratio 10905 }) { 10906 const { highlightedColors } = useStylesPreviewColors(); 10907 const scaledSwatchSize = normalizedColorSwatchSize * ratio; 10908 return highlightedColors.map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10909 external_wp_components_namespaceObject.__unstableMotion.div, 10910 { 10911 style: { 10912 height: scaledSwatchSize, 10913 width: scaledSwatchSize, 10914 background: color, 10915 borderRadius: scaledSwatchSize / 2 10916 }, 10917 animate: { 10918 scale: 1, 10919 opacity: 1 10920 }, 10921 initial: { 10922 scale: 0.1, 10923 opacity: 0 10924 }, 10925 transition: { 10926 delay: index === 1 ? 0.2 : 0.1 10927 } 10928 }, 10929 `$slug}-$index}` 10930 )); 10931 } 10932 10933 10934 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-wrapper.js 10935 10936 10937 10938 10939 10940 10941 const { useGlobalStyle: preview_wrapper_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10942 const normalizedWidth = 248; 10943 const normalizedHeight = 152; 10944 const THROTTLE_OPTIONS = { 10945 leading: true, 10946 trailing: true 10947 }; 10948 function PreviewWrapper({ 10949 children, 10950 label, 10951 isFocused, 10952 withHoverView 10953 }) { 10954 const [backgroundColor = "white"] = preview_wrapper_useGlobalStyle("color.background"); 10955 const [gradientValue] = preview_wrapper_useGlobalStyle("color.gradient"); 10956 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 10957 const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false); 10958 const [containerResizeListener, { width }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 10959 const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_.useState)(width); 10960 const [ratioState, setRatioState] = (0,external_wp_element_.useState)(); 10961 const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)( 10962 setThrottledWidthState, 10963 250, 10964 THROTTLE_OPTIONS 10965 ); 10966 (0,external_wp_element_.useLayoutEffect)(() => { 10967 if (width) { 10968 setThrottledWidth(width); 10969 } 10970 }, [width, setThrottledWidth]); 10971 (0,external_wp_element_.useLayoutEffect)(() => { 10972 const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; 10973 const ratioDiff = newRatio - (ratioState || 0); 10974 const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; 10975 if (isRatioDiffBigEnough || !ratioState) { 10976 setRatioState(newRatio); 10977 } 10978 }, [throttledWidth, ratioState]); 10979 const fallbackRatio = width ? width / normalizedWidth : 1; 10980 const ratio = ratioState ? ratioState : fallbackRatio; 10981 const isReady = !!width; 10982 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10983 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }), 10984 isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10985 "div", 10986 { 10987 className: "edit-site-global-styles-preview__wrapper", 10988 style: { 10989 height: normalizedHeight * ratio 10990 }, 10991 onMouseEnter: () => setIsHovered(true), 10992 onMouseLeave: () => setIsHovered(false), 10993 tabIndex: -1, 10994 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10995 external_wp_components_namespaceObject.__unstableMotion.div, 10996 { 10997 style: { 10998 height: normalizedHeight * ratio, 10999 width: "100%", 11000 background: gradientValue ?? backgroundColor, 11001 cursor: withHoverView ? "pointer" : void 0 11002 }, 11003 initial: "start", 11004 animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start", 11005 children: [].concat(children).map((child, key) => child({ ratio, key })) 11006 } 11007 ) 11008 } 11009 ) 11010 ] }); 11011 } 11012 11013 11014 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js 11015 11016 11017 11018 11019 11020 11021 11022 11023 const { useGlobalStyle: preview_styles_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11024 const firstFrameVariants = { 11025 start: { 11026 scale: 1, 11027 opacity: 1 11028 }, 11029 hover: { 11030 scale: 0, 11031 opacity: 0 11032 } 11033 }; 11034 const midFrameVariants = { 11035 hover: { 11036 opacity: 1 11037 }, 11038 start: { 11039 opacity: 0.5 11040 } 11041 }; 11042 const secondFrameVariants = { 11043 hover: { 11044 scale: 1, 11045 opacity: 1 11046 }, 11047 start: { 11048 scale: 0, 11049 opacity: 0 11050 } 11051 }; 11052 const PreviewStyles = ({ label, isFocused, withHoverView, variation }) => { 11053 const [fontWeight] = preview_styles_useGlobalStyle("typography.fontWeight"); 11054 const [fontFamily = "serif"] = preview_styles_useGlobalStyle("typography.fontFamily"); 11055 const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle( 11056 "elements.h1.typography.fontFamily" 11057 ); 11058 const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle( 11059 "elements.h1.typography.fontWeight" 11060 ); 11061 const [textColor = "black"] = preview_styles_useGlobalStyle("color.text"); 11062 const [headingColor = textColor] = preview_styles_useGlobalStyle( 11063 "elements.h1.color.text" 11064 ); 11065 const { paletteColors } = useStylesPreviewColors(); 11066 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 11067 PreviewWrapper, 11068 { 11069 label, 11070 isFocused, 11071 withHoverView, 11072 children: [ 11073 ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11074 external_wp_components_namespaceObject.__unstableMotion.div, 11075 { 11076 variants: firstFrameVariants, 11077 style: { 11078 height: "100%", 11079 overflow: "hidden" 11080 }, 11081 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 11082 external_wp_components_namespaceObject.__experimentalHStack, 11083 { 11084 spacing: 10 * ratio, 11085 justify: "center", 11086 style: { 11087 height: "100%", 11088 overflow: "hidden" 11089 }, 11090 children: [ 11091 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11092 PreviewTypography, 11093 { 11094 fontSize: 65 * ratio, 11095 variation 11096 } 11097 ), 11098 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11099 HighlightedColors, 11100 { 11101 normalizedColorSwatchSize: 32, 11102 ratio 11103 } 11104 ) }) 11105 ] 11106 } 11107 ) 11108 }, 11109 key 11110 ), 11111 ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11112 external_wp_components_namespaceObject.__unstableMotion.div, 11113 { 11114 variants: withHoverView && midFrameVariants, 11115 style: { 11116 height: "100%", 11117 width: "100%", 11118 position: "absolute", 11119 top: 0, 11120 overflow: "hidden", 11121 filter: "blur(60px)", 11122 opacity: 0.1 11123 }, 11124 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11125 external_wp_components_namespaceObject.__experimentalHStack, 11126 { 11127 spacing: 0, 11128 justify: "flex-start", 11129 style: { 11130 height: "100%", 11131 overflow: "hidden" 11132 }, 11133 children: paletteColors.slice(0, 4).map(({ color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11134 "div", 11135 { 11136 style: { 11137 height: "100%", 11138 background: color, 11139 flexGrow: 1 11140 } 11141 }, 11142 index 11143 )) 11144 } 11145 ) 11146 }, 11147 key 11148 ), 11149 ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11150 external_wp_components_namespaceObject.__unstableMotion.div, 11151 { 11152 variants: secondFrameVariants, 11153 style: { 11154 height: "100%", 11155 width: "100%", 11156 overflow: "hidden", 11157 position: "absolute", 11158 top: 0 11159 }, 11160 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11161 external_wp_components_namespaceObject.__experimentalVStack, 11162 { 11163 spacing: 3 * ratio, 11164 justify: "center", 11165 style: { 11166 height: "100%", 11167 overflow: "hidden", 11168 padding: 10 * ratio, 11169 boxSizing: "border-box" 11170 }, 11171 children: label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11172 "div", 11173 { 11174 style: { 11175 fontSize: 40 * ratio, 11176 fontFamily: headingFontFamily, 11177 color: headingColor, 11178 fontWeight: headingFontWeight, 11179 lineHeight: "1em", 11180 textAlign: "center" 11181 }, 11182 children: label 11183 } 11184 ) 11185 } 11186 ) 11187 }, 11188 key 11189 ) 11190 ] 11191 } 11192 ); 11193 }; 11194 var preview_styles_default = PreviewStyles; 11195 11196 11197 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 function ScreenRoot() { 11209 const hasVariations = (0,external_wp_data_.useSelect)((select) => { 11210 const { __experimentalGetCurrentThemeGlobalStylesVariations } = select(external_wp_coreData_namespaceObject.store); 11211 return !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length; 11212 }, []); 11213 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 11214 external_wp_components_namespaceObject.Card, 11215 { 11216 size: "small", 11217 isBorderless: true, 11218 className: "edit-site-global-styles-screen-root", 11219 isRounded: false, 11220 children: [ 11221 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 11222 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { className: "edit-site-global-styles-screen-root__active-style-tile", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, { className: "edit-site-global-styles-screen-root__active-style-tile-preview", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles_default, {}) }) }), 11223 hasVariations && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 11224 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Browse styles") }), 11225 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11226 IconWithCurrentColor, 11227 { 11228 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default 11229 } 11230 ) 11231 ] }) }) }), 11232 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu_default, {}) 11233 ] }) }), 11234 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), 11235 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [ 11236 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11237 external_wp_components_namespaceObject.__experimentalSpacer, 11238 { 11239 as: "p", 11240 paddingTop: 2, 11241 paddingX: "13px", 11242 marginBottom: 2, 11243 children: (0,external_wp_i18n_namespaceObject.__)( 11244 "Customize the appearance of specific blocks for the whole site." 11245 ) 11246 } 11247 ), 11248 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 11249 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Blocks") }), 11250 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11251 IconWithCurrentColor, 11252 { 11253 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default 11254 } 11255 ) 11256 ] }) }) }) 11257 ] }) 11258 ] 11259 } 11260 ); 11261 } 11262 var screen_root_default = ScreenRoot; 11263 11264 11265 ;// external ["wp","a11y"] 11266 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 11267 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js 11268 11269 11270 11271 11272 11273 11274 11275 const { useGlobalStyle: variations_panel_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11276 function getFilteredBlockStyles(blockStyles, variations) { 11277 return blockStyles?.filter( 11278 (style) => style.source === "block" || variations.includes(style.name) 11279 ); 11280 } 11281 function useBlockVariations(name) { 11282 const blockStyles = (0,external_wp_data_.useSelect)( 11283 (select) => { 11284 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); 11285 return getBlockStyles(name); 11286 }, 11287 [name] 11288 ); 11289 const [variations] = variations_panel_useGlobalStyle("variations", name); 11290 const variationNames = Object.keys(variations ?? {}); 11291 return getFilteredBlockStyles(blockStyles, variationNames); 11292 } 11293 function VariationsPanel({ name }) { 11294 const coreBlockStyles = useBlockVariations(name); 11295 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: coreBlockStyles.map((style, index) => { 11296 if (style?.isDefault) { 11297 return null; 11298 } 11299 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11300 NavigationButtonAsItem, 11301 { 11302 path: "/blocks/" + encodeURIComponent(name) + "/variations/" + encodeURIComponent(style.name), 11303 children: style.label 11304 }, 11305 index 11306 ); 11307 }) }); 11308 } 11309 11310 11311 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js 11312 11313 11314 11315 11316 function ScreenHeader({ title, description, onBack }) { 11317 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [ 11318 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 0, paddingX: 4, paddingY: 3, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [ 11319 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11320 external_wp_components_namespaceObject.Navigator.BackButton, 11321 { 11322 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 11323 size: "small", 11324 label: (0,external_wp_i18n_namespaceObject.__)("Back"), 11325 onClick: onBack 11326 } 11327 ), 11328 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11329 external_wp_components_namespaceObject.__experimentalHeading, 11330 { 11331 className: "edit-site-global-styles-header", 11332 level: 2, 11333 size: 13, 11334 children: title 11335 } 11336 ) }) 11337 ] }) }) }), 11338 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-header__description", children: description }) 11339 ] }); 11340 } 11341 var header_default = ScreenHeader; 11342 11343 11344 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 const { 11359 useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel, 11360 useHasTypographyPanel: screen_block_list_useHasTypographyPanel, 11361 useHasBorderPanel, 11362 useGlobalSetting: screen_block_list_useGlobalSetting, 11363 useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement, 11364 useHasColorPanel: screen_block_list_useHasColorPanel 11365 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11366 function useSortedBlockTypes() { 11367 const blockItems = (0,external_wp_data_.useSelect)( 11368 (select) => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), 11369 [] 11370 ); 11371 const groupByType = (blocks, block) => { 11372 const { core, noncore } = blocks; 11373 const type = block.name.startsWith("core/") ? core : noncore; 11374 type.push(block); 11375 return blocks; 11376 }; 11377 const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce( 11378 groupByType, 11379 { core: [], noncore: [] } 11380 ); 11381 return [...coreItems, ...nonCoreItems]; 11382 } 11383 function useBlockHasGlobalStyles(blockName) { 11384 const [rawSettings] = screen_block_list_useGlobalSetting("", blockName); 11385 const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName); 11386 const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings); 11387 const hasColorPanel = screen_block_list_useHasColorPanel(settings); 11388 const hasBorderPanel = useHasBorderPanel(settings); 11389 const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings); 11390 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 11391 const hasVariationsPanel = !!useBlockVariations(blockName)?.length; 11392 const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel; 11393 return hasGlobalStyles; 11394 } 11395 function BlockMenuItem({ block }) { 11396 const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); 11397 if (!hasBlockMenuItem) { 11398 return null; 11399 } 11400 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11401 NavigationButtonAsItem, 11402 { 11403 path: "/blocks/" + encodeURIComponent(block.name), 11404 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 11405 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: block.icon }), 11406 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: block.title }) 11407 ] }) 11408 } 11409 ); 11410 } 11411 function BlockList({ filterValue }) { 11412 const sortedBlockTypes = useSortedBlockTypes(); 11413 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 11414 const { isMatchingSearchTerm } = (0,external_wp_data_.useSelect)(external_wp_blocks_namespaceObject.store); 11415 const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter( 11416 (blockType) => isMatchingSearchTerm(blockType, filterValue) 11417 ); 11418 const blockTypesListRef = (0,external_wp_element_.useRef)(); 11419 (0,external_wp_element_.useEffect)(() => { 11420 if (!filterValue) { 11421 return; 11422 } 11423 const count = blockTypesListRef.current.childElementCount; 11424 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 11425 /* translators: %d: number of results. */ 11426 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), 11427 count 11428 ); 11429 debouncedSpeak(resultsFoundMessage, count); 11430 }, [filterValue, debouncedSpeak]); 11431 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11432 "div", 11433 { 11434 ref: blockTypesListRef, 11435 className: "edit-site-block-types-item-list", 11436 role: "list", 11437 children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "center", as: "p", children: (0,external_wp_i18n_namespaceObject.__)("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11438 BlockMenuItem, 11439 { 11440 block 11441 }, 11442 "menu-itemblock-" + block.name 11443 )) 11444 } 11445 ); 11446 } 11447 const MemoizedBlockList = (0,external_wp_element_.memo)(BlockList); 11448 function ScreenBlockList() { 11449 const [filterValue, setFilterValue] = (0,external_wp_element_.useState)(""); 11450 const deferredFilterValue = (0,external_wp_element_.useDeferredValue)(filterValue); 11451 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 11452 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11453 header_default, 11454 { 11455 title: (0,external_wp_i18n_namespaceObject.__)("Blocks"), 11456 description: (0,external_wp_i18n_namespaceObject.__)( 11457 "Customize the appearance of specific blocks and for the whole site." 11458 ) 11459 } 11460 ), 11461 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11462 external_wp_components_namespaceObject.SearchControl, 11463 { 11464 __nextHasNoMarginBottom: true, 11465 className: "edit-site-block-types-search", 11466 onChange: setFilterValue, 11467 value: filterValue, 11468 label: (0,external_wp_i18n_namespaceObject.__)("Search"), 11469 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") 11470 } 11471 ), 11472 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { filterValue: deferredFilterValue }) 11473 ] }); 11474 } 11475 var screen_block_list_default = ScreenBlockList; 11476 11477 11478 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js 11479 11480 11481 11482 11483 11484 11485 const BlockPreviewPanel = ({ name, variation = "" }) => { 11486 const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example; 11487 const blocks = (0,external_wp_element_.useMemo)(() => { 11488 if (!blockExample) { 11489 return null; 11490 } 11491 const example = { 11492 ...blockExample, 11493 attributes: { 11494 ...blockExample.attributes, 11495 style: void 0, 11496 className: variation ? getVariationClassName(variation) : blockExample.attributes?.className 11497 } 11498 }; 11499 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example); 11500 }, [name, blockExample, variation]); 11501 const viewportWidth = blockExample?.viewportWidth ?? 500; 11502 const previewHeight = 144; 11503 const sidebarWidth = 235; 11504 const scale = sidebarWidth / viewportWidth; 11505 const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; 11506 if (!blockExample) { 11507 return null; 11508 } 11509 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11510 "div", 11511 { 11512 className: "edit-site-global-styles__block-preview-panel", 11513 style: { maxHeight: previewHeight, boxSizing: "initial" }, 11514 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11515 external_wp_blockEditor_namespaceObject.BlockPreview, 11516 { 11517 blocks, 11518 viewportWidth, 11519 minHeight: previewHeight, 11520 additionalStyles: ( 11521 //We want this CSS to be in sync with the one in InserterPreviewPanel. 11522 [ 11523 { 11524 css: ` 11525 body{ 11526 padding: 24px; 11527 min-height:$Math.round(minHeight)}px; 11528 display:flex; 11529 align-items:center; 11530 } 11531 .is-root-container { width: 100%; } 11532 ` 11533 } 11534 ] 11535 ) 11536 } 11537 ) 11538 } 11539 ) }); 11540 }; 11541 var block_preview_panel_default = BlockPreviewPanel; 11542 11543 11544 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js 11545 11546 11547 function Subtitle({ children, level }) { 11548 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11549 external_wp_components_namespaceObject.__experimentalHeading, 11550 { 11551 className: "edit-site-global-styles-subtitle", 11552 level: level ?? 2, 11553 children 11554 } 11555 ); 11556 } 11557 var subtitle_default = Subtitle; 11558 11559 11560 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 const BACKGROUND_BLOCK_DEFAULT_VALUES = { 11575 backgroundSize: "cover", 11576 backgroundPosition: "50% 50%" 11577 // used only when backgroundSize is 'contain'. 11578 }; 11579 function applyFallbackStyle(border) { 11580 if (!border) { 11581 return border; 11582 } 11583 const hasColorOrWidth = border.color || border.width; 11584 if (!border.style && hasColorOrWidth) { 11585 return { ...border, style: "solid" }; 11586 } 11587 if (border.style && !hasColorOrWidth) { 11588 return void 0; 11589 } 11590 return border; 11591 } 11592 function applyAllFallbackStyles(border) { 11593 if (!border) { 11594 return border; 11595 } 11596 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) { 11597 return { 11598 top: applyFallbackStyle(border.top), 11599 right: applyFallbackStyle(border.right), 11600 bottom: applyFallbackStyle(border.bottom), 11601 left: applyFallbackStyle(border.left) 11602 }; 11603 } 11604 return applyFallbackStyle(border); 11605 } 11606 const { 11607 useHasDimensionsPanel: screen_block_useHasDimensionsPanel, 11608 useHasTypographyPanel: screen_block_useHasTypographyPanel, 11609 useHasBorderPanel: screen_block_useHasBorderPanel, 11610 useGlobalSetting: screen_block_useGlobalSetting, 11611 useSettingsForBlockElement: screen_block_useSettingsForBlockElement, 11612 useHasColorPanel: screen_block_useHasColorPanel, 11613 useHasFiltersPanel, 11614 useHasImageSettingsPanel, 11615 useGlobalStyle: screen_block_useGlobalStyle, 11616 useHasBackgroundPanel: screen_block_useHasBackgroundPanel, 11617 BackgroundPanel: StylesBackgroundPanel, 11618 BorderPanel: StylesBorderPanel, 11619 ColorPanel: StylesColorPanel, 11620 TypographyPanel: StylesTypographyPanel, 11621 DimensionsPanel: StylesDimensionsPanel, 11622 FiltersPanel: StylesFiltersPanel, 11623 ImageSettingsPanel, 11624 AdvancedPanel: StylesAdvancedPanel 11625 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11626 function ScreenBlock({ name, variation }) { 11627 let prefixParts = []; 11628 if (variation) { 11629 prefixParts = ["variations", variation].concat(prefixParts); 11630 } 11631 const prefix = prefixParts.join("."); 11632 const [style] = screen_block_useGlobalStyle(prefix, name, "user", { 11633 shouldDecodeEncode: false 11634 }); 11635 const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, "all", { 11636 shouldDecodeEncode: false 11637 }); 11638 const [userSettings] = screen_block_useGlobalSetting("", name, "user"); 11639 const [rawSettings, setSettings] = screen_block_useGlobalSetting("", name); 11640 const settingsForBlockElement = screen_block_useSettingsForBlockElement( 11641 rawSettings, 11642 name 11643 ); 11644 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 11645 let disableBlockGap = false; 11646 if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.( 11647 (spacingType) => spacingType === "blockGap" 11648 ))) { 11649 disableBlockGap = true; 11650 } 11651 let disableAspectRatio = false; 11652 if (settingsForBlockElement?.dimensions?.aspectRatio && name === "core/group") { 11653 disableAspectRatio = true; 11654 } 11655 const settings = (0,external_wp_element_.useMemo)(() => { 11656 const updatedSettings = structuredClone(settingsForBlockElement); 11657 if (disableBlockGap) { 11658 updatedSettings.spacing.blockGap = false; 11659 } 11660 if (disableAspectRatio) { 11661 updatedSettings.dimensions.aspectRatio = false; 11662 } 11663 return updatedSettings; 11664 }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]); 11665 const blockVariations = useBlockVariations(name); 11666 const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings); 11667 const hasTypographyPanel = screen_block_useHasTypographyPanel(settings); 11668 const hasColorPanel = screen_block_useHasColorPanel(settings); 11669 const hasBorderPanel = screen_block_useHasBorderPanel(settings); 11670 const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings); 11671 const hasFiltersPanel = useHasFiltersPanel(settings); 11672 const hasImageSettingsPanel = useHasImageSettingsPanel( 11673 name, 11674 userSettings, 11675 settings 11676 ); 11677 const hasVariationsPanel = !!blockVariations?.length && !variation; 11678 const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => { 11679 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); 11680 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 11681 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; 11682 return { 11683 canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"] 11684 }; 11685 }, []); 11686 const currentBlockStyle = variation ? blockVariations.find((s) => s.name === variation) : null; 11687 const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => { 11688 return { 11689 ...inheritedStyle, 11690 layout: settings.layout 11691 }; 11692 }, [inheritedStyle, settings.layout]); 11693 const styleWithLayout = (0,external_wp_element_.useMemo)(() => { 11694 return { 11695 ...style, 11696 layout: userSettings.layout 11697 }; 11698 }, [style, userSettings.layout]); 11699 const onChangeDimensions = (newStyle) => { 11700 const updatedStyle = { ...newStyle }; 11701 delete updatedStyle.layout; 11702 setStyle(updatedStyle); 11703 if (newStyle.layout !== userSettings.layout) { 11704 setSettings({ 11705 ...userSettings, 11706 layout: newStyle.layout 11707 }); 11708 } 11709 }; 11710 const onChangeLightbox = (newSetting) => { 11711 if (newSetting === void 0) { 11712 setSettings({ 11713 ...rawSettings, 11714 lightbox: void 0 11715 }); 11716 } else { 11717 setSettings({ 11718 ...rawSettings, 11719 lightbox: { 11720 ...rawSettings.lightbox, 11721 ...newSetting 11722 } 11723 }); 11724 } 11725 }; 11726 const onChangeBorders = (newStyle) => { 11727 if (!newStyle?.border) { 11728 setStyle(newStyle); 11729 return; 11730 } 11731 const { radius, ...newBorder } = newStyle.border; 11732 const border = applyAllFallbackStyles(newBorder); 11733 const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? { 11734 top: border, 11735 right: border, 11736 bottom: border, 11737 left: border 11738 } : { 11739 color: null, 11740 style: null, 11741 width: null, 11742 ...border 11743 }; 11744 setStyle({ ...newStyle, border: { ...updatedBorder, radius } }); 11745 }; 11746 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 11747 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11748 header_default, 11749 { 11750 title: variation ? currentBlockStyle?.label : blockType.title 11751 } 11752 ), 11753 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel_default, { name, variation }), 11754 hasVariationsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 11755 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { children: (0,external_wp_i18n_namespaceObject.__)("Style Variations") }), 11756 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { name }) 11757 ] }) }), 11758 hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11759 StylesColorPanel, 11760 { 11761 inheritedValue: inheritedStyle, 11762 value: style, 11763 onChange: setStyle, 11764 settings 11765 } 11766 ), 11767 hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11768 StylesBackgroundPanel, 11769 { 11770 inheritedValue: inheritedStyle, 11771 value: style, 11772 onChange: setStyle, 11773 settings, 11774 defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES 11775 } 11776 ), 11777 hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11778 StylesTypographyPanel, 11779 { 11780 inheritedValue: inheritedStyle, 11781 value: style, 11782 onChange: setStyle, 11783 settings 11784 } 11785 ), 11786 hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11787 StylesDimensionsPanel, 11788 { 11789 inheritedValue: inheritedStyleWithLayout, 11790 value: styleWithLayout, 11791 onChange: onChangeDimensions, 11792 settings, 11793 includeLayoutControls: true 11794 } 11795 ), 11796 hasBorderPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11797 StylesBorderPanel, 11798 { 11799 inheritedValue: inheritedStyle, 11800 value: style, 11801 onChange: onChangeBorders, 11802 settings 11803 } 11804 ), 11805 hasFiltersPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11806 StylesFiltersPanel, 11807 { 11808 inheritedValue: inheritedStyleWithLayout, 11809 value: styleWithLayout, 11810 onChange: setStyle, 11811 settings, 11812 includeLayoutControls: true 11813 } 11814 ), 11815 hasImageSettingsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11816 ImageSettingsPanel, 11817 { 11818 onChange: onChangeLightbox, 11819 value: userSettings, 11820 inheritedValue: settings 11821 } 11822 ), 11823 canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Advanced"), initialOpen: false, children: [ 11824 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)( 11825 // translators: %s: is the name of a block e.g., 'Image' or 'Table'. 11826 (0,external_wp_i18n_namespaceObject.__)( 11827 "Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value." 11828 ), 11829 blockType?.title 11830 ) }), 11831 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11832 StylesAdvancedPanel, 11833 { 11834 value: style, 11835 onChange: setStyle, 11836 inheritedValue: inheritedStyle 11837 } 11838 ) 11839 ] }) 11840 ] }); 11841 } 11842 var screen_block_default = ScreenBlock; 11843 11844 11845 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js 11846 11847 11848 11849 11850 11851 11852 11853 const { useGlobalStyle: typography_elements_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11854 function ElementItem({ parentMenu, element, label }) { 11855 const prefix = element === "text" || !element ? "" : `elements.$element}.`; 11856 const extraStyles = element === "link" ? { 11857 textDecoration: "underline" 11858 } : {}; 11859 const [fontFamily] = typography_elements_useGlobalStyle(prefix + "typography.fontFamily"); 11860 const [fontStyle] = typography_elements_useGlobalStyle(prefix + "typography.fontStyle"); 11861 const [fontWeight] = typography_elements_useGlobalStyle(prefix + "typography.fontWeight"); 11862 const [backgroundColor] = typography_elements_useGlobalStyle(prefix + "color.background"); 11863 const [fallbackBackgroundColor] = typography_elements_useGlobalStyle("color.background"); 11864 const [gradientValue] = typography_elements_useGlobalStyle(prefix + "color.gradient"); 11865 const [color] = typography_elements_useGlobalStyle(prefix + "color.text"); 11866 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: parentMenu + "/typography/" + element, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 11867 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11868 external_wp_components_namespaceObject.FlexItem, 11869 { 11870 className: "edit-site-global-styles-screen-typography__indicator", 11871 style: { 11872 fontFamily: fontFamily ?? "serif", 11873 background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor, 11874 color, 11875 fontStyle, 11876 fontWeight, 11877 ...extraStyles 11878 }, 11879 "aria-hidden": "true", 11880 children: (0,external_wp_i18n_namespaceObject.__)("Aa") 11881 } 11882 ), 11883 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: label }) 11884 ] }) }); 11885 } 11886 function TypographyElements() { 11887 const parentMenu = ""; 11888 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 11889 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Elements") }), 11890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [ 11891 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11892 ElementItem, 11893 { 11894 parentMenu, 11895 element: "text", 11896 label: (0,external_wp_i18n_namespaceObject.__)("Text") 11897 } 11898 ), 11899 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11900 ElementItem, 11901 { 11902 parentMenu, 11903 element: "link", 11904 label: (0,external_wp_i18n_namespaceObject.__)("Links") 11905 } 11906 ), 11907 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11908 ElementItem, 11909 { 11910 parentMenu, 11911 element: "heading", 11912 label: (0,external_wp_i18n_namespaceObject.__)("Headings") 11913 } 11914 ), 11915 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11916 ElementItem, 11917 { 11918 parentMenu, 11919 element: "caption", 11920 label: (0,external_wp_i18n_namespaceObject.__)("Captions") 11921 } 11922 ), 11923 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11924 ElementItem, 11925 { 11926 parentMenu, 11927 element: "button", 11928 label: (0,external_wp_i18n_namespaceObject.__)("Buttons") 11929 } 11930 ) 11931 ] }) 11932 ] }); 11933 } 11934 var typography_elements_default = TypographyElements; 11935 11936 11937 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js 11938 11939 11940 11941 11942 const StylesPreviewTypography = ({ variation, isFocused, withHoverView }) => { 11943 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11944 PreviewWrapper, 11945 { 11946 label: variation.title, 11947 isFocused, 11948 withHoverView, 11949 children: ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11950 external_wp_components_namespaceObject.__experimentalHStack, 11951 { 11952 spacing: 10 * ratio, 11953 justify: "center", 11954 style: { 11955 height: "100%", 11956 overflow: "hidden" 11957 }, 11958 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11959 PreviewTypography, 11960 { 11961 variation, 11962 fontSize: 85 * ratio 11963 } 11964 ) 11965 }, 11966 key 11967 ) 11968 } 11969 ); 11970 }; 11971 var preview_typography_default = StylesPreviewTypography; 11972 11973 11974 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js 11975 11976 11977 11978 11979 11980 11981 11982 const use_theme_style_variations_by_property_EMPTY_ARRAY = []; 11983 const { GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock( 11984 external_wp_blockEditor_namespaceObject.privateApis 11985 ); 11986 const { mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); 11987 function removePropertiesFromObject(object, properties) { 11988 if (!properties?.length) { 11989 return object; 11990 } 11991 if (typeof object !== "object" || !object || !Object.keys(object).length) { 11992 return object; 11993 } 11994 for (const key in object) { 11995 if (properties.includes(key)) { 11996 delete object[key]; 11997 } else if (typeof object[key] === "object") { 11998 removePropertiesFromObject(object[key], properties); 11999 } 12000 } 12001 return object; 12002 } 12003 function hasThemeVariation({ title, settings, styles }) { 12004 return title === (0,external_wp_i18n_namespaceObject.__)("Default") || // Always preserve the default variation. 12005 Object.keys(settings).length > 0 || Object.keys(styles).length > 0; 12006 } 12007 function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { 12008 const { variationsFromTheme } = (0,external_wp_data_.useSelect)((select) => { 12009 const _variationsFromTheme = select( 12010 external_wp_coreData_namespaceObject.store 12011 ).__experimentalGetCurrentThemeGlobalStylesVariations(); 12012 return { 12013 variationsFromTheme: _variationsFromTheme || use_theme_style_variations_by_property_EMPTY_ARRAY 12014 }; 12015 }, []); 12016 const { user: userVariation } = (0,external_wp_element_.useContext)(use_theme_style_variations_by_property_GlobalStylesContext); 12017 const propertiesAsString = properties.toString(); 12018 return (0,external_wp_element_.useMemo)(() => { 12019 const clonedUserVariation = structuredClone(userVariation); 12020 const userVariationWithoutProperties = removePropertiesFromObject( 12021 clonedUserVariation, 12022 properties 12023 ); 12024 userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)("Default"); 12025 const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => { 12026 return isVariationWithProperties(variation, properties); 12027 }).map((variation) => { 12028 return use_theme_style_variations_by_property_mergeBaseAndUserConfigs( 12029 userVariationWithoutProperties, 12030 variation 12031 ); 12032 }); 12033 const variationsByProperties = [ 12034 userVariationWithoutProperties, 12035 ...variationsWithPropertiesAndBase 12036 ]; 12037 return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; 12038 }, [propertiesAsString, userVariation, variationsFromTheme]); 12039 } 12040 const filterObjectByProperties = (object, properties) => { 12041 if (!object || !properties?.length) { 12042 return {}; 12043 } 12044 const newObject = {}; 12045 Object.keys(object).forEach((key) => { 12046 if (properties.includes(key)) { 12047 newObject[key] = object[key]; 12048 } else if (typeof object[key] === "object") { 12049 const newFilter = filterObjectByProperties( 12050 object[key], 12051 properties 12052 ); 12053 if (Object.keys(newFilter).length) { 12054 newObject[key] = newFilter; 12055 } 12056 } 12057 }); 12058 return newObject; 12059 }; 12060 function isVariationWithProperties(variation, properties) { 12061 const variationWithProperties = filterObjectByProperties( 12062 structuredClone(variation), 12063 properties 12064 ); 12065 return areGlobalStyleConfigsEqual(variationWithProperties, variation); 12066 } 12067 12068 12069 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 const { mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); 12081 const { GlobalStylesContext: variation_GlobalStylesContext, areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual } = unlock( 12082 external_wp_blockEditor_namespaceObject.privateApis 12083 ); 12084 function Variation({ 12085 variation, 12086 children, 12087 isPill, 12088 properties, 12089 showTooltip 12090 }) { 12091 const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false); 12092 const { base, user, setUserConfig } = (0,external_wp_element_.useContext)(variation_GlobalStylesContext); 12093 const context = (0,external_wp_element_.useMemo)(() => { 12094 let merged = variation_mergeBaseAndUserConfigs(base, variation); 12095 if (properties) { 12096 merged = filterObjectByProperties(merged, properties); 12097 } 12098 return { 12099 user: variation, 12100 base, 12101 merged, 12102 setUserConfig: () => { 12103 } 12104 }; 12105 }, [variation, base, properties]); 12106 const selectVariation = () => setUserConfig(variation); 12107 const selectOnEnter = (event) => { 12108 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 12109 event.preventDefault(); 12110 selectVariation(); 12111 } 12112 }; 12113 const isActive = (0,external_wp_element_.useMemo)( 12114 () => variation_areGlobalStyleConfigsEqual(user, variation), 12115 [user, variation] 12116 ); 12117 let label = variation?.title; 12118 if (variation?.description) { 12119 label = (0,external_wp_i18n_namespaceObject.sprintf)( 12120 /* translators: 1: variation title. 2: variation description. */ 12121 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "variation label"), 12122 variation?.title, 12123 variation?.description 12124 ); 12125 } 12126 const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12127 "div", 12128 { 12129 className: dist_clsx("edit-site-global-styles-variations_item", { 12130 "is-active": isActive 12131 }), 12132 role: "button", 12133 onClick: selectVariation, 12134 onKeyDown: selectOnEnter, 12135 tabIndex: "0", 12136 "aria-label": label, 12137 "aria-current": isActive, 12138 onFocus: () => setIsFocused(true), 12139 onBlur: () => setIsFocused(false), 12140 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12141 "div", 12142 { 12143 className: dist_clsx( 12144 "edit-site-global-styles-variations_item-preview", 12145 { "is-pill": isPill } 12146 ), 12147 children: children(isFocused) 12148 } 12149 ) 12150 } 12151 ); 12152 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, { value: context, children: showTooltip ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: variation?.title, children: content }) : content }); 12153 } 12154 12155 12156 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js 12157 12158 12159 12160 12161 12162 12163 function TypographyVariations({ title, gap = 2 }) { 12164 const propertiesToFilter = ["typography"]; 12165 const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 12166 if (typographyVariations?.length <= 1) { 12167 return null; 12168 } 12169 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 12170 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }), 12171 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12172 external_wp_components_namespaceObject.__experimentalGrid, 12173 { 12174 columns: 3, 12175 gap, 12176 className: "edit-site-global-styles-style-variations-container", 12177 children: typographyVariations.map((variation, index) => { 12178 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12179 Variation, 12180 { 12181 variation, 12182 properties: propertiesToFilter, 12183 showTooltip: true, 12184 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12185 preview_typography_default, 12186 { 12187 variation 12188 } 12189 ) 12190 }, 12191 index 12192 ); 12193 }) 12194 } 12195 ) 12196 ] }); 12197 } 12198 12199 12200 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js 12201 12202 12203 12204 12205 12206 12207 function FontSizes() { 12208 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ 12209 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Font Sizes") }) }), 12210 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [ 12211 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Font size presets") }), 12212 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) 12213 ] }) }) }) 12214 ] }); 12215 } 12216 var font_sizes_count_default = FontSizes; 12217 12218 12219 ;// ./node_modules/@wordpress/icons/build-module/library/settings.js 12220 12221 12222 var settings_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 12223 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }), 12224 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" }) 12225 ] }); 12226 12227 12228 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js 12229 12230 const FONT_FAMILIES_URL = "/wp/v2/font-families"; 12231 const FONT_COLLECTIONS_URL = "/wp/v2/font-collections"; 12232 async function fetchInstallFontFamily(data) { 12233 const config = { 12234 path: FONT_FAMILIES_URL, 12235 method: "POST", 12236 body: data 12237 }; 12238 const response = await external_wp_apiFetch_default()(config); 12239 return { 12240 id: response.id, 12241 ...response.font_family_settings, 12242 fontFace: [] 12243 }; 12244 } 12245 async function fetchInstallFontFace(fontFamilyId, data) { 12246 const config = { 12247 path: `$FONT_FAMILIES_URL}/$fontFamilyId}/font-faces`, 12248 method: "POST", 12249 body: data 12250 }; 12251 const response = await external_wp_apiFetch_default()(config); 12252 return { 12253 id: response.id, 12254 ...response.font_face_settings 12255 }; 12256 } 12257 async function fetchGetFontFamilyBySlug(slug) { 12258 const config = { 12259 path: `$FONT_FAMILIES_URL}?slug=$slug}&_embed=true`, 12260 method: "GET" 12261 }; 12262 const response = await external_wp_apiFetch_default()(config); 12263 if (!response || response.length === 0) { 12264 return null; 12265 } 12266 const fontFamilyPost = response[0]; 12267 return { 12268 id: fontFamilyPost.id, 12269 ...fontFamilyPost.font_family_settings, 12270 fontFace: fontFamilyPost?._embedded?.font_faces.map( 12271 (face) => face.font_face_settings 12272 ) || [] 12273 }; 12274 } 12275 async function fetchUninstallFontFamily(fontFamilyId) { 12276 const config = { 12277 path: `$FONT_FAMILIES_URL}/$fontFamilyId}?force=true`, 12278 method: "DELETE" 12279 }; 12280 return await external_wp_apiFetch_default()(config); 12281 } 12282 async function fetchFontCollections() { 12283 const config = { 12284 path: `$FONT_COLLECTIONS_URL}?_fields=slug,name,description`, 12285 method: "GET" 12286 }; 12287 return await external_wp_apiFetch_default()(config); 12288 } 12289 async function fetchFontCollection(id) { 12290 const config = { 12291 path: `$FONT_COLLECTIONS_URL}/$id}`, 12292 method: "GET" 12293 }; 12294 return await external_wp_apiFetch_default()(config); 12295 } 12296 12297 12298 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js 12299 12300 const ALLOWED_FILE_EXTENSIONS = ["otf", "ttf", "woff", "woff2"]; 12301 const FONT_WEIGHTS = { 12302 100: (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"), 12303 200: (0,external_wp_i18n_namespaceObject._x)("Extra-light", "font weight"), 12304 300: (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"), 12305 400: (0,external_wp_i18n_namespaceObject._x)("Normal", "font weight"), 12306 500: (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"), 12307 600: (0,external_wp_i18n_namespaceObject._x)("Semi-bold", "font weight"), 12308 700: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"), 12309 800: (0,external_wp_i18n_namespaceObject._x)("Extra-bold", "font weight"), 12310 900: (0,external_wp_i18n_namespaceObject._x)("Black", "font weight") 12311 }; 12312 const FONT_STYLES = { 12313 normal: (0,external_wp_i18n_namespaceObject._x)("Normal", "font style"), 12314 italic: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style") 12315 }; 12316 12317 12318 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js 12319 12320 12321 12322 12323 12324 const { File } = window; 12325 const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 12326 function setUIValuesNeeded(font, extraValues = {}) { 12327 if (!font.name && (font.fontFamily || font.slug)) { 12328 font.name = font.fontFamily || font.slug; 12329 } 12330 return { 12331 ...font, 12332 ...extraValues 12333 }; 12334 } 12335 function isUrlEncoded(url) { 12336 if (typeof url !== "string") { 12337 return false; 12338 } 12339 return url !== decodeURIComponent(url); 12340 } 12341 function getFontFaceVariantName(face) { 12342 const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight; 12343 const styleName = face.fontStyle === "normal" ? "" : FONT_STYLES[face.fontStyle] || face.fontStyle; 12344 return `$weightName} $styleName}`; 12345 } 12346 function mergeFontFaces(existing = [], incoming = []) { 12347 const map = /* @__PURE__ */ new Map(); 12348 for (const face of existing) { 12349 map.set(`$face.fontWeight}$face.fontStyle}`, face); 12350 } 12351 for (const face of incoming) { 12352 map.set(`$face.fontWeight}$face.fontStyle}`, face); 12353 } 12354 return Array.from(map.values()); 12355 } 12356 function mergeFontFamilies(existing = [], incoming = []) { 12357 const map = /* @__PURE__ */ new Map(); 12358 for (const font of existing) { 12359 map.set(font.slug, { ...font }); 12360 } 12361 for (const font of incoming) { 12362 if (map.has(font.slug)) { 12363 const { fontFace: incomingFontFaces, ...restIncoming } = font; 12364 const existingFont = map.get(font.slug); 12365 const mergedFontFaces = mergeFontFaces( 12366 existingFont.fontFace, 12367 incomingFontFaces 12368 ); 12369 map.set(font.slug, { 12370 ...restIncoming, 12371 fontFace: mergedFontFaces 12372 }); 12373 } else { 12374 map.set(font.slug, { ...font }); 12375 } 12376 } 12377 return Array.from(map.values()); 12378 } 12379 async function loadFontFaceInBrowser(fontFace, source, addTo = "all") { 12380 let dataSource; 12381 if (typeof source === "string") { 12382 dataSource = `url($source})`; 12383 } else if (source instanceof File) { 12384 dataSource = await source.arrayBuffer(); 12385 } else { 12386 return; 12387 } 12388 const newFont = new window.FontFace( 12389 formatFontFaceName(fontFace.fontFamily), 12390 dataSource, 12391 { 12392 style: fontFace.fontStyle, 12393 weight: fontFace.fontWeight 12394 } 12395 ); 12396 const loadedFace = await newFont.load(); 12397 if (addTo === "document" || addTo === "all") { 12398 document.fonts.add(loadedFace); 12399 } 12400 if (addTo === "iframe" || addTo === "all") { 12401 const iframeDocument = document.querySelector( 12402 'iframe[name="editor-canvas"]' 12403 ).contentDocument; 12404 iframeDocument.fonts.add(loadedFace); 12405 } 12406 } 12407 function unloadFontFaceInBrowser(fontFace, removeFrom = "all") { 12408 const unloadFontFace = (fonts) => { 12409 fonts.forEach((f) => { 12410 if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) { 12411 fonts.delete(f); 12412 } 12413 }); 12414 }; 12415 if (removeFrom === "document" || removeFrom === "all") { 12416 unloadFontFace(document.fonts); 12417 } 12418 if (removeFrom === "iframe" || removeFrom === "all") { 12419 const iframeDocument = document.querySelector( 12420 'iframe[name="editor-canvas"]' 12421 ).contentDocument; 12422 unloadFontFace(iframeDocument.fonts); 12423 } 12424 } 12425 function getDisplaySrcFromFontFace(input) { 12426 if (!input) { 12427 return; 12428 } 12429 let src; 12430 if (Array.isArray(input)) { 12431 src = input[0]; 12432 } else { 12433 src = input; 12434 } 12435 if (src.startsWith("file:.")) { 12436 return; 12437 } 12438 if (!isUrlEncoded(src)) { 12439 src = encodeURI(src); 12440 } 12441 return src; 12442 } 12443 function makeFontFamilyFormData(fontFamily) { 12444 const formData = new FormData(); 12445 const { fontFace, category, ...familyWithValidParameters } = fontFamily; 12446 const fontFamilySettings = { 12447 ...familyWithValidParameters, 12448 slug: kebabCase(fontFamily.slug) 12449 }; 12450 formData.append( 12451 "font_family_settings", 12452 JSON.stringify(fontFamilySettings) 12453 ); 12454 return formData; 12455 } 12456 function makeFontFacesFormData(font) { 12457 if (font?.fontFace) { 12458 const fontFacesFormData = font.fontFace.map((item, faceIndex) => { 12459 const face = { ...item }; 12460 const formData = new FormData(); 12461 if (face.file) { 12462 const files = Array.isArray(face.file) ? face.file : [face.file]; 12463 const src = []; 12464 files.forEach((file, key) => { 12465 const fileId = `file-$faceIndex}-$key}`; 12466 formData.append(fileId, file, file.name); 12467 src.push(fileId); 12468 }); 12469 face.src = src.length === 1 ? src[0] : src; 12470 delete face.file; 12471 formData.append("font_face_settings", JSON.stringify(face)); 12472 } else { 12473 formData.append("font_face_settings", JSON.stringify(face)); 12474 } 12475 return formData; 12476 }); 12477 return fontFacesFormData; 12478 } 12479 } 12480 async function batchInstallFontFaces(fontFamilyId, fontFacesData) { 12481 const responses = []; 12482 for (const faceData of fontFacesData) { 12483 try { 12484 const response = await fetchInstallFontFace( 12485 fontFamilyId, 12486 faceData 12487 ); 12488 responses.push({ status: "fulfilled", value: response }); 12489 } catch (error) { 12490 responses.push({ status: "rejected", reason: error }); 12491 } 12492 } 12493 const results = { 12494 errors: [], 12495 successes: [] 12496 }; 12497 responses.forEach((result, index) => { 12498 if (result.status === "fulfilled") { 12499 const response = result.value; 12500 if (response.id) { 12501 results.successes.push(response); 12502 } else { 12503 results.errors.push({ 12504 data: fontFacesData[index], 12505 message: `Error: $response.message}` 12506 }); 12507 } 12508 } else { 12509 results.errors.push({ 12510 data: fontFacesData[index], 12511 message: result.reason.message 12512 }); 12513 } 12514 }); 12515 return results; 12516 } 12517 async function downloadFontFaceAssets(src) { 12518 src = Array.isArray(src) ? src : [src]; 12519 const files = await Promise.all( 12520 src.map(async (url) => { 12521 return fetch(new Request(url)).then((response) => { 12522 if (!response.ok) { 12523 throw new Error( 12524 `Error downloading font face asset from $url}. Server responded with status: $response.status}` 12525 ); 12526 } 12527 return response.blob(); 12528 }).then((blob) => { 12529 const filename = url.split("/").pop(); 12530 const file = new File([blob], filename, { 12531 type: blob.type 12532 }); 12533 return file; 12534 }); 12535 }) 12536 ); 12537 return files.length === 1 ? files[0] : files; 12538 } 12539 function checkFontFaceInstalled(fontFace, collection) { 12540 return -1 !== collection.findIndex((collectionFontFace) => { 12541 return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle; 12542 }); 12543 } 12544 12545 12546 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js 12547 function toggleFont(font, face, initialfonts) { 12548 const isFontActivated = (f) => f.slug === font.slug; 12549 const getActivatedFont = (fonts) => fonts.find(isFontActivated); 12550 const toggleEntireFontFamily = (activatedFont2) => { 12551 if (!activatedFont2) { 12552 return [...initialfonts, font]; 12553 } 12554 return initialfonts.filter((f) => !isFontActivated(f)); 12555 }; 12556 const toggleFontVariant = (activatedFont2) => { 12557 const isFaceActivated = (f) => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle; 12558 if (!activatedFont2) { 12559 return [...initialfonts, { ...font, fontFace: [face] }]; 12560 } 12561 let newFontFaces = activatedFont2.fontFace || []; 12562 if (newFontFaces.find(isFaceActivated)) { 12563 newFontFaces = newFontFaces.filter( 12564 (f) => !isFaceActivated(f) 12565 ); 12566 } else { 12567 newFontFaces = [...newFontFaces, face]; 12568 } 12569 if (newFontFaces.length === 0) { 12570 return initialfonts.filter((f) => !isFontActivated(f)); 12571 } 12572 return initialfonts.map( 12573 (f) => isFontActivated(f) ? { ...f, fontFace: newFontFaces } : f 12574 ); 12575 }; 12576 const activatedFont = getActivatedFont(initialfonts); 12577 if (!face) { 12578 return toggleEntireFontFamily(activatedFont); 12579 } 12580 return toggleFontVariant(activatedFont); 12581 } 12582 12583 12584 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js 12585 12586 12587 12588 12589 12590 12591 12592 12593 const { useGlobalSetting: context_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12594 12595 12596 12597 const FontLibraryContext = (0,external_wp_element_.createContext)({}); 12598 FontLibraryContext.displayName = "FontLibraryContext"; 12599 function FontLibraryProvider({ children }) { 12600 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 12601 const { globalStylesId } = (0,external_wp_data_.useSelect)((select) => { 12602 const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); 12603 return { globalStylesId: __experimentalGetCurrentGlobalStylesId() }; 12604 }); 12605 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)( 12606 "root", 12607 "globalStyles", 12608 globalStylesId 12609 ); 12610 const [isInstalling, setIsInstalling] = (0,external_wp_element_.useState)(false); 12611 const [refreshKey, setRefreshKey] = (0,external_wp_element_.useState)(0); 12612 const refreshLibrary = () => { 12613 setRefreshKey(Date.now()); 12614 }; 12615 const { records: libraryPosts = [], isResolving: isResolvingLibrary } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", "wp_font_family", { 12616 refreshKey, 12617 _embed: true 12618 }); 12619 const libraryFonts = (libraryPosts || []).map((fontFamilyPost) => { 12620 return { 12621 id: fontFamilyPost.id, 12622 ...fontFamilyPost.font_family_settings, 12623 fontFace: fontFamilyPost?._embedded?.font_faces.map( 12624 (face) => face.font_face_settings 12625 ) || [] 12626 }; 12627 }) || []; 12628 const [fontFamilies, setFontFamilies] = context_useGlobalSetting( 12629 "typography.fontFamilies" 12630 ); 12631 const saveFontFamilies = async (fonts) => { 12632 const updatedGlobalStyles = globalStyles.record; 12633 setNestedValue( 12634 updatedGlobalStyles, 12635 ["settings", "typography", "fontFamilies"], 12636 fonts 12637 ); 12638 await saveEntityRecord("root", "globalStyles", updatedGlobalStyles); 12639 }; 12640 const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_.useState)(false); 12641 const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_.useState)(null); 12642 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : []; 12643 const customFonts = fontFamilies?.custom ? fontFamilies.custom.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : []; 12644 const baseCustomFonts = libraryFonts ? libraryFonts.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : []; 12645 (0,external_wp_element_.useEffect)(() => { 12646 if (!modalTabOpen) { 12647 setLibraryFontSelected(null); 12648 } 12649 }, [modalTabOpen]); 12650 const handleSetLibraryFontSelected = (font) => { 12651 if (!font) { 12652 setLibraryFontSelected(null); 12653 return; 12654 } 12655 const fonts = font.source === "theme" ? themeFonts : baseCustomFonts; 12656 const fontSelected = fonts.find((f) => f.slug === font.slug); 12657 setLibraryFontSelected({ 12658 ...fontSelected || font, 12659 source: font.source 12660 }); 12661 }; 12662 const [loadedFontUrls] = (0,external_wp_element_.useState)(/* @__PURE__ */ new Set()); 12663 const getAvailableFontsOutline = (availableFontFamilies) => { 12664 const outline = availableFontFamilies.reduce((acc, font) => { 12665 const availableFontFaces = font?.fontFace && font.fontFace?.length > 0 ? font?.fontFace.map( 12666 (face) => `$face.fontStyle + face.fontWeight}` 12667 ) : ["normal400"]; 12668 acc[font.slug] = availableFontFaces; 12669 return acc; 12670 }, {}); 12671 return outline; 12672 }; 12673 const getActivatedFontsOutline = (source) => { 12674 switch (source) { 12675 case "theme": 12676 return getAvailableFontsOutline(themeFonts); 12677 case "custom": 12678 default: 12679 return getAvailableFontsOutline(customFonts); 12680 } 12681 }; 12682 const isFontActivated = (slug, style, weight, source) => { 12683 if (!style && !weight) { 12684 return !!getActivatedFontsOutline(source)[slug]; 12685 } 12686 return !!getActivatedFontsOutline(source)[slug]?.includes( 12687 style + weight 12688 ); 12689 }; 12690 const getFontFacesActivated = (slug, source) => { 12691 return getActivatedFontsOutline(source)[slug] || []; 12692 }; 12693 async function installFonts(fontFamiliesToInstall) { 12694 setIsInstalling(true); 12695 try { 12696 const fontFamiliesToActivate = []; 12697 let installationErrors = []; 12698 for (const fontFamilyToInstall of fontFamiliesToInstall) { 12699 let isANewFontFamily = false; 12700 let installedFontFamily = await fetchGetFontFamilyBySlug( 12701 fontFamilyToInstall.slug 12702 ); 12703 if (!installedFontFamily) { 12704 isANewFontFamily = true; 12705 installedFontFamily = await fetchInstallFontFamily( 12706 makeFontFamilyFormData(fontFamilyToInstall) 12707 ); 12708 } 12709 const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter( 12710 (fontFaceToInstall) => checkFontFaceInstalled( 12711 fontFaceToInstall, 12712 fontFamilyToInstall.fontFace 12713 ) 12714 ) : []; 12715 if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) { 12716 fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter( 12717 (fontFaceToInstall) => !checkFontFaceInstalled( 12718 fontFaceToInstall, 12719 installedFontFamily.fontFace 12720 ) 12721 ); 12722 } 12723 let successfullyInstalledFontFaces = []; 12724 let unsuccessfullyInstalledFontFaces = []; 12725 if (fontFamilyToInstall?.fontFace?.length > 0) { 12726 const response = await batchInstallFontFaces( 12727 installedFontFamily.id, 12728 makeFontFacesFormData(fontFamilyToInstall) 12729 ); 12730 successfullyInstalledFontFaces = response?.successes; 12731 unsuccessfullyInstalledFontFaces = response?.errors; 12732 } 12733 if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) { 12734 installedFontFamily.fontFace = [ 12735 ...successfullyInstalledFontFaces 12736 ]; 12737 fontFamiliesToActivate.push(installedFontFamily); 12738 } 12739 if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) { 12740 fontFamiliesToActivate.push(installedFontFamily); 12741 } 12742 if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) { 12743 await fetchUninstallFontFamily(installedFontFamily.id); 12744 } 12745 installationErrors = installationErrors.concat( 12746 unsuccessfullyInstalledFontFaces 12747 ); 12748 } 12749 installationErrors = installationErrors.reduce( 12750 (unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], 12751 [] 12752 ); 12753 if (fontFamiliesToActivate.length > 0) { 12754 const activeFonts = activateCustomFontFamilies( 12755 fontFamiliesToActivate 12756 ); 12757 await saveFontFamilies(activeFonts); 12758 refreshLibrary(); 12759 } 12760 if (installationErrors.length > 0) { 12761 const installError = new Error( 12762 (0,external_wp_i18n_namespaceObject.__)("There was an error installing fonts.") 12763 ); 12764 installError.installationErrors = installationErrors; 12765 throw installError; 12766 } 12767 } finally { 12768 setIsInstalling(false); 12769 } 12770 } 12771 async function uninstallFontFamily(fontFamilyToUninstall) { 12772 try { 12773 const uninstalledFontFamily = await fetchUninstallFontFamily( 12774 fontFamilyToUninstall.id 12775 ); 12776 if (uninstalledFontFamily.deleted) { 12777 const activeFonts = deactivateFontFamily( 12778 fontFamilyToUninstall 12779 ); 12780 await saveFontFamilies(activeFonts); 12781 } 12782 refreshLibrary(); 12783 return uninstalledFontFamily; 12784 } catch (error) { 12785 console.error( 12786 `There was an error uninstalling the font family:`, 12787 error 12788 ); 12789 throw error; 12790 } 12791 } 12792 const deactivateFontFamily = (font) => { 12793 const initialCustomFonts = fontFamilies?.[font.source] ?? []; 12794 const newCustomFonts = initialCustomFonts.filter( 12795 (f) => f.slug !== font.slug 12796 ); 12797 const activeFonts = { 12798 ...fontFamilies, 12799 [font.source]: newCustomFonts 12800 }; 12801 setFontFamilies(activeFonts); 12802 if (font.fontFace) { 12803 font.fontFace.forEach((face) => { 12804 unloadFontFaceInBrowser(face, "all"); 12805 }); 12806 } 12807 return activeFonts; 12808 }; 12809 const activateCustomFontFamilies = (fontsToAdd) => { 12810 const fontsToActivate = cleanFontsForSave(fontsToAdd); 12811 const activeFonts = { 12812 ...fontFamilies, 12813 // Merge the existing custom fonts with the new fonts. 12814 custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate) 12815 }; 12816 setFontFamilies(activeFonts); 12817 loadFontsInBrowser(fontsToActivate); 12818 return activeFonts; 12819 }; 12820 const cleanFontsForSave = (fonts) => { 12821 return fonts.map(({ id: _familyDbId, fontFace, ...font }) => ({ 12822 ...font, 12823 ...fontFace && fontFace.length > 0 ? { 12824 fontFace: fontFace.map( 12825 ({ id: _faceDbId, ...face }) => face 12826 ) 12827 } : {} 12828 })); 12829 }; 12830 const loadFontsInBrowser = (fonts) => { 12831 fonts.forEach((font) => { 12832 if (font.fontFace) { 12833 font.fontFace.forEach((face) => { 12834 loadFontFaceInBrowser( 12835 face, 12836 getDisplaySrcFromFontFace(face.src), 12837 "all" 12838 ); 12839 }); 12840 } 12841 }); 12842 }; 12843 const toggleActivateFont = (font, face) => { 12844 const initialFonts = fontFamilies?.[font.source] ?? []; 12845 const newFonts = toggleFont(font, face, initialFonts); 12846 setFontFamilies({ 12847 ...fontFamilies, 12848 [font.source]: newFonts 12849 }); 12850 const isFaceActivated = isFontActivated( 12851 font.slug, 12852 face?.fontStyle, 12853 face?.fontWeight, 12854 font.source 12855 ); 12856 if (isFaceActivated) { 12857 unloadFontFaceInBrowser(face, "all"); 12858 } else { 12859 loadFontFaceInBrowser( 12860 face, 12861 getDisplaySrcFromFontFace(face?.src), 12862 "all" 12863 ); 12864 } 12865 }; 12866 const loadFontFaceAsset = async (fontFace) => { 12867 if (!fontFace.src) { 12868 return; 12869 } 12870 const src = getDisplaySrcFromFontFace(fontFace.src); 12871 if (!src || loadedFontUrls.has(src)) { 12872 return; 12873 } 12874 loadFontFaceInBrowser(fontFace, src, "document"); 12875 loadedFontUrls.add(src); 12876 }; 12877 const [collections, setFontCollections] = (0,external_wp_element_.useState)([]); 12878 const getFontCollections = async () => { 12879 const response = await fetchFontCollections(); 12880 setFontCollections(response); 12881 }; 12882 const getFontCollection = async (slug) => { 12883 try { 12884 const hasData = !!collections.find( 12885 (collection) => collection.slug === slug 12886 )?.font_families; 12887 if (hasData) { 12888 return; 12889 } 12890 const response = await fetchFontCollection(slug); 12891 const updatedCollections = collections.map( 12892 (collection) => collection.slug === slug ? { ...collection, ...response } : collection 12893 ); 12894 setFontCollections(updatedCollections); 12895 } catch (e) { 12896 console.error(e); 12897 throw e; 12898 } 12899 }; 12900 (0,external_wp_element_.useEffect)(() => { 12901 getFontCollections(); 12902 }, []); 12903 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12904 FontLibraryContext.Provider, 12905 { 12906 value: { 12907 libraryFontSelected, 12908 handleSetLibraryFontSelected, 12909 fontFamilies, 12910 baseCustomFonts, 12911 isFontActivated, 12912 getFontFacesActivated, 12913 loadFontFaceAsset, 12914 installFonts, 12915 uninstallFontFamily, 12916 toggleActivateFont, 12917 getAvailableFontsOutline, 12918 modalTabOpen, 12919 setModalTabOpen, 12920 refreshLibrary, 12921 saveFontFamilies, 12922 isResolvingLibrary, 12923 isInstalling, 12924 collections, 12925 getFontCollection 12926 }, 12927 children 12928 } 12929 ); 12930 } 12931 var context_default = FontLibraryProvider; 12932 12933 12934 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js 12935 12936 12937 12938 12939 12940 function getPreviewUrl(fontFace) { 12941 if (fontFace.preview) { 12942 return fontFace.preview; 12943 } 12944 if (fontFace.src) { 12945 return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src; 12946 } 12947 } 12948 function getDisplayFontFace(font) { 12949 if (font.fontStyle || font.fontWeight) { 12950 return font; 12951 } 12952 if (font.fontFace && font.fontFace.length) { 12953 return font.fontFace.find( 12954 (face) => face.fontStyle === "normal" && face.fontWeight === "400" 12955 ) || font.fontFace[0]; 12956 } 12957 return { 12958 fontStyle: "normal", 12959 fontWeight: "400", 12960 fontFamily: font.fontFamily, 12961 fake: true 12962 }; 12963 } 12964 function FontDemo({ font, text }) { 12965 const ref = (0,external_wp_element_.useRef)(null); 12966 const fontFace = getDisplayFontFace(font); 12967 const style = getFamilyPreviewStyle(font); 12968 text = text || font.name; 12969 const customPreviewUrl = font.preview; 12970 const [isIntersecting, setIsIntersecting] = (0,external_wp_element_.useState)(false); 12971 const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_.useState)(false); 12972 const { loadFontFaceAsset } = (0,external_wp_element_.useContext)(FontLibraryContext); 12973 const previewUrl = customPreviewUrl ?? getPreviewUrl(fontFace); 12974 const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i); 12975 const faceStyles = getFacePreviewStyle(fontFace); 12976 const textDemoStyle = { 12977 fontSize: "18px", 12978 lineHeight: 1, 12979 opacity: isAssetLoaded ? "1" : "0", 12980 ...style, 12981 ...faceStyles 12982 }; 12983 (0,external_wp_element_.useEffect)(() => { 12984 const observer = new window.IntersectionObserver(([entry]) => { 12985 setIsIntersecting(entry.isIntersecting); 12986 }, {}); 12987 observer.observe(ref.current); 12988 return () => observer.disconnect(); 12989 }, [ref]); 12990 (0,external_wp_element_.useEffect)(() => { 12991 const loadAsset = async () => { 12992 if (isIntersecting) { 12993 if (!isPreviewImage && fontFace.src) { 12994 await loadFontFaceAsset(fontFace); 12995 } 12996 setIsAssetLoaded(true); 12997 } 12998 }; 12999 loadAsset(); 13000 }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]); 13001 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref, children: isPreviewImage ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13002 "img", 13003 { 13004 src: previewUrl, 13005 loading: "lazy", 13006 alt: text, 13007 className: "font-library-modal__font-variant_demo-image" 13008 } 13009 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13010 external_wp_components_namespaceObject.__experimentalText, 13011 { 13012 style: textDemoStyle, 13013 className: "font-library-modal__font-variant_demo-text", 13014 children: text 13015 } 13016 ) }); 13017 } 13018 var font_demo_default = FontDemo; 13019 13020 13021 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js 13022 13023 13024 13025 13026 13027 function FontCard({ font, onClick, variantsText, navigatorPath }) { 13028 const variantsCount = font.fontFace?.length || 1; 13029 const style = { 13030 cursor: !!onClick ? "pointer" : "default" 13031 }; 13032 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 13033 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13034 external_wp_components_namespaceObject.Button, 13035 { 13036 __next40pxDefaultSize: true, 13037 onClick: () => { 13038 onClick(); 13039 if (navigatorPath) { 13040 navigator.goTo(navigatorPath); 13041 } 13042 }, 13043 style, 13044 className: "font-library-modal__font-card", 13045 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "space-between", wrap: false, children: [ 13046 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo_default, { font }), 13047 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-end", children: [ 13048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__font-card__count", children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)( 13049 /* translators: %d: Number of font variants. */ 13050 (0,external_wp_i18n_namespaceObject._n)( 13051 "%d variant", 13052 "%d variants", 13053 variantsCount 13054 ), 13055 variantsCount 13056 ) }) }), 13057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) }) 13058 ] }) 13059 ] }) 13060 } 13061 ); 13062 } 13063 var font_card_default = FontCard; 13064 13065 13066 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js 13067 13068 13069 13070 13071 13072 13073 function LibraryFontVariant({ face, font }) { 13074 const { isFontActivated, toggleActivateFont } = (0,external_wp_element_.useContext)(FontLibraryContext); 13075 const isInstalled = font?.fontFace?.length > 0 ? isFontActivated( 13076 font.slug, 13077 face.fontStyle, 13078 face.fontWeight, 13079 font.source 13080 ) : isFontActivated(font.slug, null, null, font.source); 13081 const handleToggleActivation = () => { 13082 if (font?.fontFace?.length > 0) { 13083 toggleActivateFont(font, face); 13084 return; 13085 } 13086 toggleActivateFont(font); 13087 }; 13088 const displayName = font.name + " " + getFontFaceVariantName(face); 13089 const checkboxId = (0,external_wp_element_.useId)(); 13090 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [ 13091 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13092 external_wp_components_namespaceObject.CheckboxControl, 13093 { 13094 checked: isInstalled, 13095 onChange: handleToggleActivation, 13096 __nextHasNoMarginBottom: true, 13097 id: checkboxId 13098 } 13099 ), 13100 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13101 font_demo_default, 13102 { 13103 font: face, 13104 text: displayName, 13105 onClick: handleToggleActivation 13106 } 13107 ) }) 13108 ] }) }); 13109 } 13110 var library_font_variant_default = LibraryFontVariant; 13111 13112 13113 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js 13114 function getNumericFontWeight(value) { 13115 switch (value) { 13116 case "normal": 13117 return 400; 13118 case "bold": 13119 return 700; 13120 case "bolder": 13121 return 500; 13122 case "lighter": 13123 return 300; 13124 default: 13125 return parseInt(value, 10); 13126 } 13127 } 13128 function sortFontFaces(faces) { 13129 return faces.sort((a, b) => { 13130 if (a.fontStyle === "normal" && b.fontStyle !== "normal") { 13131 return -1; 13132 } 13133 if (b.fontStyle === "normal" && a.fontStyle !== "normal") { 13134 return 1; 13135 } 13136 if (a.fontStyle === b.fontStyle) { 13137 return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight); 13138 } 13139 return a.fontStyle.localeCompare(b.fontStyle); 13140 }); 13141 } 13142 13143 13144 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 const { useGlobalSetting: installed_fonts_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13160 function InstalledFonts() { 13161 const { 13162 baseCustomFonts, 13163 libraryFontSelected, 13164 handleSetLibraryFontSelected, 13165 refreshLibrary, 13166 uninstallFontFamily, 13167 isResolvingLibrary, 13168 isInstalling, 13169 saveFontFamilies, 13170 getFontFacesActivated 13171 } = (0,external_wp_element_.useContext)(FontLibraryContext); 13172 const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting( 13173 "typography.fontFamilies" 13174 ); 13175 const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_.useState)(false); 13176 const [notice, setNotice] = (0,external_wp_element_.useState)(false); 13177 const [baseFontFamilies] = installed_fonts_useGlobalSetting( 13178 "typography.fontFamilies", 13179 void 0, 13180 "base" 13181 ); 13182 const globalStylesId = (0,external_wp_data_.useSelect)((select) => { 13183 const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); 13184 return __experimentalGetCurrentGlobalStylesId(); 13185 }); 13186 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)( 13187 "root", 13188 "globalStyles", 13189 globalStylesId 13190 ); 13191 const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies; 13192 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13193 const themeFontsSlugs = new Set(themeFonts.map((f) => f.slug)); 13194 const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat( 13195 baseFontFamilies.theme.filter((f) => !themeFontsSlugs.has(f.slug)).map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) 13196 ) : []; 13197 const customFontFamilyId = libraryFontSelected?.source === "custom" && libraryFontSelected?.id; 13198 const canUserDelete = (0,external_wp_data_.useSelect)( 13199 (select) => { 13200 const { canUser } = select(external_wp_coreData_namespaceObject.store); 13201 return customFontFamilyId && canUser("delete", { 13202 kind: "postType", 13203 name: "wp_font_family", 13204 id: customFontFamilyId 13205 }); 13206 }, 13207 [customFontFamilyId] 13208 ); 13209 const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== "theme" && canUserDelete; 13210 const handleUninstallClick = () => { 13211 setIsConfirmDeleteOpen(true); 13212 }; 13213 const handleUpdate = async () => { 13214 setNotice(null); 13215 try { 13216 await saveFontFamilies(fontFamilies); 13217 setNotice({ 13218 type: "success", 13219 message: (0,external_wp_i18n_namespaceObject.__)("Font family updated successfully.") 13220 }); 13221 } catch (error) { 13222 setNotice({ 13223 type: "error", 13224 message: (0,external_wp_i18n_namespaceObject.sprintf)( 13225 /* translators: %s: error message */ 13226 (0,external_wp_i18n_namespaceObject.__)("There was an error updating the font family. %s"), 13227 error.message 13228 ) 13229 }); 13230 } 13231 }; 13232 const getFontFacesToDisplay = (font) => { 13233 if (!font) { 13234 return []; 13235 } 13236 if (!font.fontFace || !font.fontFace.length) { 13237 return [ 13238 { 13239 fontFamily: font.fontFamily, 13240 fontStyle: "normal", 13241 fontWeight: "400" 13242 } 13243 ]; 13244 } 13245 return sortFontFaces(font.fontFace); 13246 }; 13247 const getFontCardVariantsText = (font) => { 13248 const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1; 13249 const variantsActive = getFontFacesActivated( 13250 font.slug, 13251 font.source 13252 ).length; 13253 return (0,external_wp_i18n_namespaceObject.sprintf)( 13254 /* translators: 1: Active font variants, 2: Total font variants. */ 13255 (0,external_wp_i18n_namespaceObject.__)("%1$s/%2$s variants active"), 13256 variantsActive, 13257 variantsInstalled 13258 ); 13259 }; 13260 (0,external_wp_element_.useEffect)(() => { 13261 handleSetLibraryFontSelected(libraryFontSelected); 13262 refreshLibrary(); 13263 }, []); 13264 const activeFontsCount = libraryFontSelected ? getFontFacesActivated( 13265 libraryFontSelected.slug, 13266 libraryFontSelected.source 13267 ).length : 0; 13268 const selectedFontsCount = libraryFontSelected?.fontFace?.length ?? (libraryFontSelected?.fontFamily ? 1 : 0); 13269 const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount; 13270 const isSelectAllChecked = activeFontsCount === selectedFontsCount; 13271 const toggleSelectAll = () => { 13272 const initialFonts = fontFamilies?.[libraryFontSelected.source]?.filter( 13273 (f) => f.slug !== libraryFontSelected.slug 13274 ) ?? []; 13275 const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected]; 13276 setFontFamilies({ 13277 ...fontFamilies, 13278 [libraryFontSelected.source]: newFonts 13279 }); 13280 if (libraryFontSelected.fontFace) { 13281 libraryFontSelected.fontFace.forEach((face) => { 13282 if (isSelectAllChecked) { 13283 unloadFontFaceInBrowser(face, "all"); 13284 } else { 13285 loadFontFaceInBrowser( 13286 face, 13287 getDisplaySrcFromFontFace(face?.src), 13288 "all" 13289 ); 13290 } 13291 }); 13292 } 13293 }; 13294 const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; 13295 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [ 13296 isResolvingLibrary && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }), 13297 !isResolvingLibrary && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 13298 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13299 external_wp_components_namespaceObject.Navigator, 13300 { 13301 initialPath: libraryFontSelected ? "/fontFamily" : "/", 13302 children: [ 13303 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "8", children: [ 13304 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13305 external_wp_components_namespaceObject.Notice, 13306 { 13307 status: notice.type, 13308 onRemove: () => setNotice(null), 13309 children: notice.message 13310 } 13311 ), 13312 !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)("No fonts installed.") }), 13313 baseThemeFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ 13314 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 13315 className: "font-library-modal__fonts-title", 13316 /* translators: Heading for a list of fonts provided by the theme. */ 13317 children: (0,external_wp_i18n_namespaceObject._x)("Theme", "font source") 13318 }), 13319 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13320 "ul", 13321 { 13322 role: "list", 13323 className: "font-library-modal__fonts-list", 13324 children: baseThemeFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13325 "li", 13326 { 13327 className: "font-library-modal__fonts-list-item", 13328 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13329 font_card_default, 13330 { 13331 font, 13332 navigatorPath: "/fontFamily", 13333 variantsText: getFontCardVariantsText( 13334 font 13335 ), 13336 onClick: () => { 13337 setNotice(null); 13338 handleSetLibraryFontSelected( 13339 font 13340 ); 13341 } 13342 } 13343 ) 13344 }, 13345 font.slug 13346 )) 13347 } 13348 ) 13349 ] }), 13350 baseCustomFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ 13351 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 13352 className: "font-library-modal__fonts-title", 13353 /* translators: Heading for a list of fonts installed by the user. */ 13354 children: (0,external_wp_i18n_namespaceObject._x)("Custom", "font source") 13355 }), 13356 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13357 "ul", 13358 { 13359 role: "list", 13360 className: "font-library-modal__fonts-list", 13361 children: baseCustomFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13362 "li", 13363 { 13364 className: "font-library-modal__fonts-list-item", 13365 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13366 font_card_default, 13367 { 13368 font, 13369 navigatorPath: "/fontFamily", 13370 variantsText: getFontCardVariantsText( 13371 font 13372 ), 13373 onClick: () => { 13374 setNotice(null); 13375 handleSetLibraryFontSelected( 13376 font 13377 ); 13378 } 13379 } 13380 ) 13381 }, 13382 font.slug 13383 )) 13384 } 13385 ) 13386 ] }) 13387 ] }) }), 13388 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [ 13389 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13390 ConfirmDeleteDialog, 13391 { 13392 font: libraryFontSelected, 13393 isOpen: isConfirmDeleteOpen, 13394 setIsOpen: setIsConfirmDeleteOpen, 13395 setNotice, 13396 uninstallFontFamily, 13397 handleSetLibraryFontSelected 13398 } 13399 ), 13400 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [ 13401 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13402 external_wp_components_namespaceObject.Navigator.BackButton, 13403 { 13404 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 13405 size: "small", 13406 onClick: () => { 13407 handleSetLibraryFontSelected(null); 13408 setNotice(null); 13409 }, 13410 label: (0,external_wp_i18n_namespaceObject.__)("Back") 13411 } 13412 ), 13413 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13414 external_wp_components_namespaceObject.__experimentalHeading, 13415 { 13416 level: 2, 13417 size: 13, 13418 className: "edit-site-global-styles-header", 13419 children: libraryFontSelected?.name 13420 } 13421 ) 13422 ] }), 13423 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 13424 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }), 13425 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13426 external_wp_components_namespaceObject.Notice, 13427 { 13428 status: notice.type, 13429 onRemove: () => setNotice(null), 13430 children: notice.message 13431 } 13432 ), 13433 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }) 13434 ] }), 13435 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), 13436 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( 13437 "Choose font variants. Keep in mind that too many variants could make your site slower." 13438 ) }), 13439 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), 13440 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [ 13441 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13442 external_wp_components_namespaceObject.CheckboxControl, 13443 { 13444 className: "font-library-modal__select-all", 13445 label: (0,external_wp_i18n_namespaceObject.__)("Select all"), 13446 checked: isSelectAllChecked, 13447 onChange: toggleSelectAll, 13448 indeterminate: isIndeterminate, 13449 __nextHasNoMarginBottom: true 13450 } 13451 ), 13452 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 8 }), 13453 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13454 "ul", 13455 { 13456 role: "list", 13457 className: "font-library-modal__fonts-list", 13458 children: getFontFacesToDisplay( 13459 libraryFontSelected 13460 ).map((face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13461 "li", 13462 { 13463 className: "font-library-modal__fonts-list-item", 13464 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13465 library_font_variant_default, 13466 { 13467 font: libraryFontSelected, 13468 face 13469 }, 13470 `face$i}` 13471 ) 13472 }, 13473 `face$i}` 13474 )) 13475 } 13476 ) 13477 ] }) 13478 ] }) 13479 ] 13480 } 13481 ), 13482 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13483 external_wp_components_namespaceObject.__experimentalHStack, 13484 { 13485 justify: "flex-end", 13486 className: "font-library-modal__footer", 13487 children: [ 13488 isInstalling && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}), 13489 shouldDisplayDeleteButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13490 external_wp_components_namespaceObject.Button, 13491 { 13492 __next40pxDefaultSize: true, 13493 isDestructive: true, 13494 variant: "tertiary", 13495 onClick: handleUninstallClick, 13496 children: (0,external_wp_i18n_namespaceObject.__)("Delete") 13497 } 13498 ), 13499 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13500 external_wp_components_namespaceObject.Button, 13501 { 13502 __next40pxDefaultSize: true, 13503 variant: "primary", 13504 onClick: handleUpdate, 13505 disabled: !fontFamiliesHasChanges, 13506 accessibleWhenDisabled: true, 13507 children: (0,external_wp_i18n_namespaceObject.__)("Update") 13508 } 13509 ) 13510 ] 13511 } 13512 ) 13513 ] }) 13514 ] }); 13515 } 13516 function ConfirmDeleteDialog({ 13517 font, 13518 isOpen, 13519 setIsOpen, 13520 setNotice, 13521 uninstallFontFamily, 13522 handleSetLibraryFontSelected 13523 }) { 13524 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 13525 const handleConfirmUninstall = async () => { 13526 setNotice(null); 13527 setIsOpen(false); 13528 try { 13529 await uninstallFontFamily(font); 13530 navigator.goBack(); 13531 handleSetLibraryFontSelected(null); 13532 setNotice({ 13533 type: "success", 13534 message: (0,external_wp_i18n_namespaceObject.__)("Font family uninstalled successfully.") 13535 }); 13536 } catch (error) { 13537 setNotice({ 13538 type: "error", 13539 message: (0,external_wp_i18n_namespaceObject.__)("There was an error uninstalling the font family.") + error.message 13540 }); 13541 } 13542 }; 13543 const handleCancelUninstall = () => { 13544 setIsOpen(false); 13545 }; 13546 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13547 external_wp_components_namespaceObject.__experimentalConfirmDialog, 13548 { 13549 isOpen, 13550 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), 13551 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), 13552 onCancel: handleCancelUninstall, 13553 onConfirm: handleConfirmUninstall, 13554 size: "medium", 13555 children: font && (0,external_wp_i18n_namespaceObject.sprintf)( 13556 /* translators: %s: Name of the font. */ 13557 (0,external_wp_i18n_namespaceObject.__)( 13558 'Are you sure you want to delete "%s" font and all its variants and assets?' 13559 ), 13560 font.name 13561 ) 13562 } 13563 ); 13564 } 13565 var installed_fonts_default = InstalledFonts; 13566 13567 13568 ;// ./node_modules/@wordpress/icons/build-module/library/next.js 13569 13570 13571 var next_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); 13572 13573 13574 ;// ./node_modules/@wordpress/icons/build-module/library/previous.js 13575 13576 13577 var previous_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); 13578 13579 13580 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js 13581 function filterFonts(fonts, filters) { 13582 const { category, search } = filters; 13583 let filteredFonts = fonts || []; 13584 if (category && category !== "all") { 13585 filteredFonts = filteredFonts.filter( 13586 (font) => font.categories.indexOf(category) !== -1 13587 ); 13588 } 13589 if (search) { 13590 filteredFonts = filteredFonts.filter( 13591 (font) => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase()) 13592 ); 13593 } 13594 return filteredFonts; 13595 } 13596 13597 13598 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js 13599 function getFontsOutline(fonts) { 13600 return fonts.reduce( 13601 (acc, font) => ({ 13602 ...acc, 13603 [font.slug]: (font?.fontFace || []).reduce( 13604 (faces, face) => ({ 13605 ...faces, 13606 [`$face.fontStyle}-$face.fontWeight}`]: true 13607 }), 13608 {} 13609 ) 13610 }), 13611 {} 13612 ); 13613 } 13614 function isFontFontFaceInOutline(slug, face, outline) { 13615 if (!face) { 13616 return !!outline[slug]; 13617 } 13618 return !!outline[slug]?.[`$face.fontStyle}-$face.fontWeight}`]; 13619 } 13620 13621 13622 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js 13623 13624 13625 13626 function GoogleFontsConfirmDialog() { 13627 const handleConfirm = () => { 13628 window.localStorage.setItem( 13629 "wp-font-library-google-fonts-permission", 13630 "true" 13631 ); 13632 window.dispatchEvent(new Event("storage")); 13633 }; 13634 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library__google-fonts-confirm", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [ 13635 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, children: (0,external_wp_i18n_namespaceObject.__)("Connect to Google Fonts") }), 13636 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }), 13637 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)( 13638 "To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts." 13639 ) }), 13640 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }), 13641 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)( 13642 "You can alternatively upload files directly on the Upload tab." 13643 ) }), 13644 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }), 13645 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13646 external_wp_components_namespaceObject.Button, 13647 { 13648 __next40pxDefaultSize: true, 13649 variant: "primary", 13650 onClick: handleConfirm, 13651 children: (0,external_wp_i18n_namespaceObject.__)("Allow access to Google Fonts") 13652 } 13653 ) 13654 ] }) }) }); 13655 } 13656 var google_fonts_confirm_dialog_default = GoogleFontsConfirmDialog; 13657 13658 13659 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js 13660 13661 13662 13663 13664 13665 function CollectionFontVariant({ 13666 face, 13667 font, 13668 handleToggleVariant, 13669 selected 13670 }) { 13671 const handleToggleActivation = () => { 13672 if (font?.fontFace) { 13673 handleToggleVariant(font, face); 13674 return; 13675 } 13676 handleToggleVariant(font); 13677 }; 13678 const displayName = font.name + " " + getFontFaceVariantName(face); 13679 const checkboxId = (0,external_wp_element_.useId)(); 13680 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [ 13681 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13682 external_wp_components_namespaceObject.CheckboxControl, 13683 { 13684 checked: selected, 13685 onChange: handleToggleActivation, 13686 __nextHasNoMarginBottom: true, 13687 id: checkboxId 13688 } 13689 ), 13690 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13691 font_demo_default, 13692 { 13693 font: face, 13694 text: displayName, 13695 onClick: handleToggleActivation 13696 } 13697 ) }) 13698 ] }) }); 13699 } 13700 var collection_font_variant_default = CollectionFontVariant; 13701 13702 13703 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 const DEFAULT_CATEGORY = { 13720 slug: "all", 13721 name: (0,external_wp_i18n_namespaceObject._x)("All", "font categories") 13722 }; 13723 const LOCAL_STORAGE_ITEM = "wp-font-library-google-fonts-permission"; 13724 const MIN_WINDOW_HEIGHT = 500; 13725 function FontCollection({ slug }) { 13726 const requiresPermission = slug === "google-fonts"; 13727 const getGoogleFontsPermissionFromStorage = () => { 13728 return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === "true"; 13729 }; 13730 const [selectedFont, setSelectedFont] = (0,external_wp_element_.useState)(null); 13731 const [notice, setNotice] = (0,external_wp_element_.useState)(false); 13732 const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_.useState)([]); 13733 const [page, setPage] = (0,external_wp_element_.useState)(1); 13734 const [filters, setFilters] = (0,external_wp_element_.useState)({}); 13735 const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_.useState)( 13736 requiresPermission && !getGoogleFontsPermissionFromStorage() 13737 ); 13738 const { collections, getFontCollection, installFonts, isInstalling } = (0,external_wp_element_.useContext)(FontLibraryContext); 13739 const selectedCollection = collections.find( 13740 (collection) => collection.slug === slug 13741 ); 13742 (0,external_wp_element_.useEffect)(() => { 13743 const handleStorage = () => { 13744 setRenderConfirmDialog( 13745 requiresPermission && !getGoogleFontsPermissionFromStorage() 13746 ); 13747 }; 13748 handleStorage(); 13749 window.addEventListener("storage", handleStorage); 13750 return () => window.removeEventListener("storage", handleStorage); 13751 }, [slug, requiresPermission]); 13752 const revokeAccess = () => { 13753 window.localStorage.setItem(LOCAL_STORAGE_ITEM, "false"); 13754 window.dispatchEvent(new Event("storage")); 13755 }; 13756 (0,external_wp_element_.useEffect)(() => { 13757 const fetchFontCollection = async () => { 13758 try { 13759 await getFontCollection(slug); 13760 resetFilters(); 13761 } catch (e) { 13762 if (!notice) { 13763 setNotice({ 13764 type: "error", 13765 message: e?.message 13766 }); 13767 } 13768 } 13769 }; 13770 fetchFontCollection(); 13771 }, [slug, getFontCollection, setNotice, notice]); 13772 (0,external_wp_element_.useEffect)(() => { 13773 setSelectedFont(null); 13774 }, [slug]); 13775 (0,external_wp_element_.useEffect)(() => { 13776 setFontsToInstall([]); 13777 }, [selectedFont]); 13778 const collectionFonts = (0,external_wp_element_.useMemo)( 13779 () => selectedCollection?.font_families ?? [], 13780 [selectedCollection] 13781 ); 13782 const collectionCategories = selectedCollection?.categories ?? []; 13783 const categories = [DEFAULT_CATEGORY, ...collectionCategories]; 13784 const fonts = (0,external_wp_element_.useMemo)( 13785 () => filterFonts(collectionFonts, filters), 13786 [collectionFonts, filters] 13787 ); 13788 const isLoading = !selectedCollection?.font_families && !notice; 13789 const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT); 13790 const pageSize = Math.floor((windowHeight - 417) / 61); 13791 const totalPages = Math.ceil(fonts.length / pageSize); 13792 const itemsStart = (page - 1) * pageSize; 13793 const itemsLimit = page * pageSize; 13794 const items = fonts.slice(itemsStart, itemsLimit); 13795 const handleCategoryFilter = (category) => { 13796 setFilters({ ...filters, category }); 13797 setPage(1); 13798 }; 13799 const handleUpdateSearchInput = (value) => { 13800 setFilters({ ...filters, search: value }); 13801 setPage(1); 13802 }; 13803 const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300); 13804 const resetFilters = () => { 13805 setFilters({}); 13806 setPage(1); 13807 }; 13808 const handleToggleVariant = (font, face) => { 13809 const newFontsToInstall = toggleFont(font, face, fontsToInstall); 13810 setFontsToInstall(newFontsToInstall); 13811 }; 13812 const fontToInstallOutline = getFontsOutline(fontsToInstall); 13813 const resetFontsToInstall = () => { 13814 setFontsToInstall([]); 13815 }; 13816 const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0; 13817 const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length; 13818 const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length; 13819 const toggleSelectAll = () => { 13820 const newFonts = isSelectAllChecked ? [] : [selectedFont]; 13821 setFontsToInstall(newFonts); 13822 }; 13823 const handleInstall = async () => { 13824 setNotice(null); 13825 const fontFamily = fontsToInstall[0]; 13826 try { 13827 if (fontFamily?.fontFace) { 13828 await Promise.all( 13829 fontFamily.fontFace.map(async (fontFace) => { 13830 if (fontFace.src) { 13831 fontFace.file = await downloadFontFaceAssets( 13832 fontFace.src 13833 ); 13834 } 13835 }) 13836 ); 13837 } 13838 } catch (error) { 13839 setNotice({ 13840 type: "error", 13841 message: (0,external_wp_i18n_namespaceObject.__)( 13842 "Error installing the fonts, could not be downloaded." 13843 ) 13844 }); 13845 return; 13846 } 13847 try { 13848 await installFonts([fontFamily]); 13849 setNotice({ 13850 type: "success", 13851 message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.") 13852 }); 13853 } catch (error) { 13854 setNotice({ 13855 type: "error", 13856 message: error.message 13857 }); 13858 } 13859 resetFontsToInstall(); 13860 }; 13861 const getSortedFontFaces = (fontFamily) => { 13862 if (!fontFamily) { 13863 return []; 13864 } 13865 if (!fontFamily.fontFace || !fontFamily.fontFace.length) { 13866 return [ 13867 { 13868 fontFamily: fontFamily.fontFamily, 13869 fontStyle: "normal", 13870 fontWeight: "400" 13871 } 13872 ]; 13873 } 13874 return sortFontFaces(fontFamily.fontFace); 13875 }; 13876 if (renderConfirmDialog) { 13877 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog_default, {}); 13878 } 13879 const ActionsComponent = () => { 13880 if (slug !== "google-fonts" || renderConfirmDialog || selectedFont) { 13881 return null; 13882 } 13883 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13884 external_wp_components_namespaceObject.DropdownMenu, 13885 { 13886 icon: more_vertical_default, 13887 label: (0,external_wp_i18n_namespaceObject.__)("Actions"), 13888 popoverProps: { 13889 position: "bottom left" 13890 }, 13891 controls: [ 13892 { 13893 title: (0,external_wp_i18n_namespaceObject.__)("Revoke access to Google Fonts"), 13894 onClick: revokeAccess 13895 } 13896 ] 13897 } 13898 ); 13899 }; 13900 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [ 13901 isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }), 13902 !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 13903 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13904 external_wp_components_namespaceObject.Navigator, 13905 { 13906 initialPath: "/", 13907 className: "font-library-modal__tabpanel-layout", 13908 children: [ 13909 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: [ 13910 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 13911 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ 13912 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: selectedCollection.name }), 13913 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: selectedCollection.description }) 13914 ] }), 13915 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {}) 13916 ] }), 13917 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), 13918 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ 13919 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13920 external_wp_components_namespaceObject.SearchControl, 13921 { 13922 className: "font-library-modal__search", 13923 value: filters.search, 13924 placeholder: (0,external_wp_i18n_namespaceObject.__)("Font name\u2026"), 13925 label: (0,external_wp_i18n_namespaceObject.__)("Search"), 13926 onChange: debouncedUpdateSearchInput, 13927 __nextHasNoMarginBottom: true, 13928 hideLabelFromVision: false 13929 } 13930 ) }), 13931 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13932 external_wp_components_namespaceObject.SelectControl, 13933 { 13934 __nextHasNoMarginBottom: true, 13935 __next40pxDefaultSize: true, 13936 label: (0,external_wp_i18n_namespaceObject.__)("Category"), 13937 value: filters.category, 13938 onChange: handleCategoryFilter, 13939 children: categories && categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13940 "option", 13941 { 13942 value: category.slug, 13943 children: category.name 13944 }, 13945 category.slug 13946 )) 13947 } 13948 ) }) 13949 ] }), 13950 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), 13951 !!selectedCollection?.font_families?.length && !fonts.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( 13952 "No fonts found. Try with a different search term." 13953 ) }), 13954 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__fonts-grid__main", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13955 "ul", 13956 { 13957 role: "list", 13958 className: "font-library-modal__fonts-list", 13959 children: items.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13960 "li", 13961 { 13962 className: "font-library-modal__fonts-list-item", 13963 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13964 font_card_default, 13965 { 13966 font: font.font_family_settings, 13967 navigatorPath: "/fontFamily", 13968 onClick: () => { 13969 setSelectedFont( 13970 font.font_family_settings 13971 ); 13972 } 13973 } 13974 ) 13975 }, 13976 font.font_family_settings.slug 13977 )) 13978 } 13979 ) }) 13980 ] }), 13981 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [ 13982 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [ 13983 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13984 external_wp_components_namespaceObject.Navigator.BackButton, 13985 { 13986 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 13987 size: "small", 13988 onClick: () => { 13989 setSelectedFont(null); 13990 setNotice(null); 13991 }, 13992 label: (0,external_wp_i18n_namespaceObject.__)("Back") 13993 } 13994 ), 13995 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13996 external_wp_components_namespaceObject.__experimentalHeading, 13997 { 13998 level: 2, 13999 size: 13, 14000 className: "edit-site-global-styles-header", 14001 children: selectedFont?.name 14002 } 14003 ) 14004 ] }), 14005 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 14006 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }), 14007 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14008 external_wp_components_namespaceObject.Notice, 14009 { 14010 status: notice.type, 14011 onRemove: () => setNotice(null), 14012 children: notice.message 14013 } 14014 ), 14015 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }) 14016 ] }), 14017 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), 14018 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Select font variants to install.") }), 14019 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), 14020 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14021 external_wp_components_namespaceObject.CheckboxControl, 14022 { 14023 className: "font-library-modal__select-all", 14024 label: (0,external_wp_i18n_namespaceObject.__)("Select all"), 14025 checked: isSelectAllChecked, 14026 onChange: toggleSelectAll, 14027 indeterminate: isIndeterminate, 14028 __nextHasNoMarginBottom: true 14029 } 14030 ), 14031 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14032 "ul", 14033 { 14034 role: "list", 14035 className: "font-library-modal__fonts-list", 14036 children: getSortedFontFaces(selectedFont).map( 14037 (face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14038 "li", 14039 { 14040 className: "font-library-modal__fonts-list-item", 14041 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14042 collection_font_variant_default, 14043 { 14044 font: selectedFont, 14045 face, 14046 handleToggleVariant, 14047 selected: isFontFontFaceInOutline( 14048 selectedFont.slug, 14049 selectedFont.fontFace ? face : null, 14050 // If the font has no fontFace, we want to check if the font is in the outline 14051 fontToInstallOutline 14052 ) 14053 } 14054 ) 14055 }, 14056 `face$i}` 14057 ) 14058 ) 14059 } 14060 ) }), 14061 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 16 }) 14062 ] }) 14063 ] 14064 } 14065 ), 14066 selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14067 external_wp_components_namespaceObject.Flex, 14068 { 14069 justify: "flex-end", 14070 className: "font-library-modal__footer", 14071 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14072 external_wp_components_namespaceObject.Button, 14073 { 14074 __next40pxDefaultSize: true, 14075 variant: "primary", 14076 onClick: handleInstall, 14077 isBusy: isInstalling, 14078 disabled: fontsToInstall.length === 0 || isInstalling, 14079 accessibleWhenDisabled: true, 14080 children: (0,external_wp_i18n_namespaceObject.__)("Install") 14081 } 14082 ) 14083 } 14084 ), 14085 !selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 14086 external_wp_components_namespaceObject.__experimentalHStack, 14087 { 14088 expanded: false, 14089 className: "font-library-modal__footer", 14090 justify: "end", 14091 spacing: 6, 14092 children: [ 14093 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14094 external_wp_components_namespaceObject.__experimentalHStack, 14095 { 14096 justify: "flex-start", 14097 expanded: false, 14098 spacing: 1, 14099 className: "font-library-modal__page-selection", 14100 children: (0,external_wp_element_.createInterpolateElement)( 14101 (0,external_wp_i18n_namespaceObject.sprintf)( 14102 // translators: 1: Current page number, 2: Total number of pages. 14103 (0,external_wp_i18n_namespaceObject._x)( 14104 "<div>Page</div>%1$s<div>of %2$s</div>", 14105 "paging" 14106 ), 14107 "<CurrentPage />", 14108 totalPages 14109 ), 14110 { 14111 div: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }), 14112 CurrentPage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14113 external_wp_components_namespaceObject.SelectControl, 14114 { 14115 "aria-label": (0,external_wp_i18n_namespaceObject.__)( 14116 "Current page" 14117 ), 14118 value: page, 14119 options: [ 14120 ...Array(totalPages) 14121 ].map((e, i) => { 14122 return { 14123 label: i + 1, 14124 value: i + 1 14125 }; 14126 }), 14127 onChange: (newPage) => setPage( 14128 parseInt(newPage) 14129 ), 14130 size: "small", 14131 __nextHasNoMarginBottom: true, 14132 variant: "minimal" 14133 } 14134 ) 14135 } 14136 ) 14137 } 14138 ), 14139 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [ 14140 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14141 external_wp_components_namespaceObject.Button, 14142 { 14143 onClick: () => setPage(page - 1), 14144 disabled: page === 1, 14145 accessibleWhenDisabled: true, 14146 label: (0,external_wp_i18n_namespaceObject.__)("Previous page"), 14147 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default, 14148 showTooltip: true, 14149 size: "compact", 14150 tooltipPosition: "top" 14151 } 14152 ), 14153 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14154 external_wp_components_namespaceObject.Button, 14155 { 14156 onClick: () => setPage(page + 1), 14157 disabled: page === totalPages, 14158 accessibleWhenDisabled: true, 14159 label: (0,external_wp_i18n_namespaceObject.__)("Next page"), 14160 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default, 14161 showTooltip: true, 14162 size: "compact", 14163 tooltipPosition: "top" 14164 } 14165 ) 14166 ] }) 14167 ] 14168 } 14169 ) 14170 ] }) 14171 ] }); 14172 } 14173 var font_collection_default = FontCollection; 14174 14175 14176 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js 14177 var unbrotli = __webpack_require__(8572); 14178 var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli); 14179 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js 14180 var inflate = __webpack_require__(4660); 14181 var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate); 14182 ;// ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js 14183 /** 14184 * Credits: 14185 * 14186 * lib-font 14187 * https://github.com/Pomax/lib-font 14188 * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js 14189 * 14190 * The MIT License (MIT) 14191 * 14192 * Copyright (c) 2020 pomax@nihongoresources.com 14193 * 14194 * Permission is hereby granted, free of charge, to any person obtaining a copy 14195 * of this software and associated documentation files (the "Software"), to deal 14196 * in the Software without restriction, including without limitation the rights 14197 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14198 * copies of the Software, and to permit persons to whom the Software is 14199 * furnished to do so, subject to the following conditions: 14200 * 14201 * The above copyright notice and this permission notice shall be included in all 14202 * copies or substantial portions of the Software. 14203 * 14204 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14205 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14206 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14207 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14208 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14209 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 14210 * SOFTWARE. 14211 */ 14212 14213 /* eslint eslint-comments/no-unlimited-disable: 0 */ 14214 /* eslint-disable */ 14215 // import pako from 'pako'; 14216 14217 14218 14219 let fetchFunction = globalThis.fetch; 14220 // if ( ! fetchFunction ) { 14221 // let backlog = []; 14222 // fetchFunction = globalThis.fetch = ( ...args ) => 14223 // new Promise( ( resolve, reject ) => { 14224 // backlog.push( { args: args, resolve: resolve, reject: reject } ); 14225 // } ); 14226 // import( 'fs' ) 14227 // .then( ( fs ) => { 14228 // fetchFunction = globalThis.fetch = async function ( path ) { 14229 // return new Promise( ( resolve, reject ) => { 14230 // fs.readFile( path, ( err, data ) => { 14231 // if ( err ) return reject( err ); 14232 // resolve( { ok: true, arrayBuffer: () => data.buffer } ); 14233 // } ); 14234 // } ); 14235 // }; 14236 // while ( backlog.length ) { 14237 // let instruction = backlog.shift(); 14238 // fetchFunction( ...instruction.args ) 14239 // .then( ( data ) => instruction.resolve( data ) ) 14240 // .catch( ( err ) => instruction.reject( err ) ); 14241 // } 14242 // } ) 14243 // .catch( ( err ) => { 14244 // console.error( err ); 14245 // throw new Error( 14246 // `lib-font cannot run unless either the Fetch API or Node's filesystem module is available.` 14247 // ); 14248 // } ); 14249 // } 14250 class lib_font_browser_Event { 14251 constructor( type, detail = {}, msg ) { 14252 this.type = type; 14253 this.detail = detail; 14254 this.msg = msg; 14255 Object.defineProperty( this, `__mayPropagate`, { 14256 enumerable: false, 14257 writable: true, 14258 } ); 14259 this.__mayPropagate = true; 14260 } 14261 preventDefault() {} 14262 stopPropagation() { 14263 this.__mayPropagate = false; 14264 } 14265 valueOf() { 14266 return this; 14267 } 14268 toString() { 14269 return this.msg 14270 ? `[${ this.type } event]: ${ this.msg }` 14271 : `[${ this.type } event]`; 14272 } 14273 } 14274 class EventManager { 14275 constructor() { 14276 this.listeners = {}; 14277 } 14278 addEventListener( type, listener, useCapture ) { 14279 let bin = this.listeners[ type ] || []; 14280 if ( useCapture ) bin.unshift( listener ); 14281 else bin.push( listener ); 14282 this.listeners[ type ] = bin; 14283 } 14284 removeEventListener( type, listener ) { 14285 let bin = this.listeners[ type ] || []; 14286 let pos = bin.findIndex( ( e ) => e === listener ); 14287 if ( pos > -1 ) { 14288 bin.splice( pos, 1 ); 14289 this.listeners[ type ] = bin; 14290 } 14291 } 14292 dispatch( event ) { 14293 let bin = this.listeners[ event.type ]; 14294 if ( bin ) { 14295 for ( let l = 0, e = bin.length; l < e; l++ ) { 14296 if ( ! event.__mayPropagate ) break; 14297 bin[ l ]( event ); 14298 } 14299 } 14300 } 14301 } 14302 const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime(); 14303 function asText( data ) { 14304 return Array.from( data ) 14305 .map( ( v ) => String.fromCharCode( v ) ) 14306 .join( `` ); 14307 } 14308 class Parser { 14309 constructor( dict, dataview, name ) { 14310 this.name = ( name || dict.tag || `` ).trim(); 14311 this.length = dict.length; 14312 this.start = dict.offset; 14313 this.offset = 0; 14314 this.data = dataview; 14315 [ 14316 `getInt8`, 14317 `getUint8`, 14318 `getInt16`, 14319 `getUint16`, 14320 `getInt32`, 14321 `getUint32`, 14322 `getBigInt64`, 14323 `getBigUint64`, 14324 ].forEach( ( name ) => { 14325 let fn = name.replace( /get(Big)?/, '' ).toLowerCase(); 14326 let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8; 14327 Object.defineProperty( this, fn, { 14328 get: () => this.getValue( name, increment ), 14329 } ); 14330 } ); 14331 } 14332 get currentPosition() { 14333 return this.start + this.offset; 14334 } 14335 set currentPosition( position ) { 14336 this.start = position; 14337 this.offset = 0; 14338 } 14339 skip( n = 0, bits = 8 ) { 14340 this.offset += ( n * bits ) / 8; 14341 } 14342 getValue( type, increment ) { 14343 let pos = this.start + this.offset; 14344 this.offset += increment; 14345 try { 14346 return this.data[ type ]( pos ); 14347 } catch ( e ) { 14348 console.error( `parser`, type, increment, this ); 14349 console.error( `parser`, this.start, this.offset ); 14350 throw e; 14351 } 14352 } 14353 flags( n ) { 14354 if ( n === 8 || n === 16 || n === 32 || n === 64 ) { 14355 return this[ `uint${ n }` ] 14356 .toString( 2 ) 14357 .padStart( n, 0 ) 14358 .split( `` ) 14359 .map( ( v ) => v === '1' ); 14360 } 14361 console.error( 14362 `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` 14363 ); 14364 console.trace(); 14365 } 14366 get tag() { 14367 const t = this.uint32; 14368 return asText( [ 14369 ( t >> 24 ) & 255, 14370 ( t >> 16 ) & 255, 14371 ( t >> 8 ) & 255, 14372 t & 255, 14373 ] ); 14374 } 14375 get fixed() { 14376 let major = this.int16; 14377 let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 ); 14378 return major + minor / 1e3; 14379 } 14380 get legacyFixed() { 14381 let major = this.uint16; 14382 let minor = this.uint16.toString( 16 ).padStart( 4, 0 ); 14383 return parseFloat( `${ major }.${ minor }` ); 14384 } 14385 get uint24() { 14386 return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8; 14387 } 14388 get uint128() { 14389 let value = 0; 14390 for ( let i = 0; i < 5; i++ ) { 14391 let byte = this.uint8; 14392 value = value * 128 + ( byte & 127 ); 14393 if ( byte < 128 ) break; 14394 } 14395 return value; 14396 } 14397 get longdatetime() { 14398 return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) ); 14399 } 14400 get fword() { 14401 return this.int16; 14402 } 14403 get ufword() { 14404 return this.uint16; 14405 } 14406 get Offset16() { 14407 return this.uint16; 14408 } 14409 get Offset32() { 14410 return this.uint32; 14411 } 14412 get F2DOT14() { 14413 const bits = p.uint16; 14414 const integer = [ 0, 1, -2, -1 ][ bits >> 14 ]; 14415 const fraction = bits & 16383; 14416 return integer + fraction / 16384; 14417 } 14418 verifyLength() { 14419 if ( this.offset != this.length ) { 14420 console.error( 14421 `unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })` 14422 ); 14423 } 14424 } 14425 readBytes( n = 0, position = 0, bits = 8, signed = false ) { 14426 n = n || this.length; 14427 if ( n === 0 ) return []; 14428 if ( position ) this.currentPosition = position; 14429 const fn = `${ signed ? `` : `u` }int${ bits }`, 14430 slice = []; 14431 while ( n-- ) slice.push( this[ fn ] ); 14432 return slice; 14433 } 14434 } 14435 class ParsedData { 14436 constructor( parser ) { 14437 const pGetter = { enumerable: false, get: () => parser }; 14438 Object.defineProperty( this, `parser`, pGetter ); 14439 const start = parser.currentPosition; 14440 const startGetter = { enumerable: false, get: () => start }; 14441 Object.defineProperty( this, `start`, startGetter ); 14442 } 14443 load( struct ) { 14444 Object.keys( struct ).forEach( ( p ) => { 14445 let props = Object.getOwnPropertyDescriptor( struct, p ); 14446 if ( props.get ) { 14447 this[ p ] = props.get.bind( this ); 14448 } else if ( props.value !== undefined ) { 14449 this[ p ] = props.value; 14450 } 14451 } ); 14452 if ( this.parser.length ) { 14453 this.parser.verifyLength(); 14454 } 14455 } 14456 } 14457 class SimpleTable extends ParsedData { 14458 constructor( dict, dataview, name ) { 14459 const { parser: parser, start: start } = super( 14460 new Parser( dict, dataview, name ) 14461 ); 14462 const pGetter = { enumerable: false, get: () => parser }; 14463 Object.defineProperty( this, `p`, pGetter ); 14464 const startGetter = { enumerable: false, get: () => start }; 14465 Object.defineProperty( this, `tableStart`, startGetter ); 14466 } 14467 } 14468 function lazy$1( object, property, getter ) { 14469 let val; 14470 Object.defineProperty( object, property, { 14471 get: () => { 14472 if ( val ) return val; 14473 val = getter(); 14474 return val; 14475 }, 14476 enumerable: true, 14477 } ); 14478 } 14479 class SFNT extends SimpleTable { 14480 constructor( font, dataview, createTable ) { 14481 const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` ); 14482 this.version = p.uint32; 14483 this.numTables = p.uint16; 14484 this.searchRange = p.uint16; 14485 this.entrySelector = p.uint16; 14486 this.rangeShift = p.uint16; 14487 p.verifyLength(); 14488 this.directory = [ ...new Array( this.numTables ) ].map( 14489 ( _ ) => new TableRecord( p ) 14490 ); 14491 this.tables = {}; 14492 this.directory.forEach( ( entry ) => { 14493 const getter = () => 14494 createTable( 14495 this.tables, 14496 { 14497 tag: entry.tag, 14498 offset: entry.offset, 14499 length: entry.length, 14500 }, 14501 dataview 14502 ); 14503 lazy$1( this.tables, entry.tag.trim(), getter ); 14504 } ); 14505 } 14506 } 14507 class TableRecord { 14508 constructor( p ) { 14509 this.tag = p.tag; 14510 this.checksum = p.uint32; 14511 this.offset = p.uint32; 14512 this.length = p.uint32; 14513 } 14514 } 14515 const gzipDecode = (inflate_default()).inflate || undefined; 14516 let nativeGzipDecode = undefined; 14517 // if ( ! gzipDecode ) { 14518 // import( 'zlib' ).then( ( zlib ) => { 14519 // nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer ); 14520 // } ); 14521 // } 14522 class WOFF$1 extends SimpleTable { 14523 constructor( font, dataview, createTable ) { 14524 const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` ); 14525 this.signature = p.tag; 14526 this.flavor = p.uint32; 14527 this.length = p.uint32; 14528 this.numTables = p.uint16; 14529 p.uint16; 14530 this.totalSfntSize = p.uint32; 14531 this.majorVersion = p.uint16; 14532 this.minorVersion = p.uint16; 14533 this.metaOffset = p.uint32; 14534 this.metaLength = p.uint32; 14535 this.metaOrigLength = p.uint32; 14536 this.privOffset = p.uint32; 14537 this.privLength = p.uint32; 14538 p.verifyLength(); 14539 this.directory = [ ...new Array( this.numTables ) ].map( 14540 ( _ ) => new WoffTableDirectoryEntry( p ) 14541 ); 14542 buildWoffLazyLookups( this, dataview, createTable ); 14543 } 14544 } 14545 class WoffTableDirectoryEntry { 14546 constructor( p ) { 14547 this.tag = p.tag; 14548 this.offset = p.uint32; 14549 this.compLength = p.uint32; 14550 this.origLength = p.uint32; 14551 this.origChecksum = p.uint32; 14552 } 14553 } 14554 function buildWoffLazyLookups( woff, dataview, createTable ) { 14555 woff.tables = {}; 14556 woff.directory.forEach( ( entry ) => { 14557 lazy$1( woff.tables, entry.tag.trim(), () => { 14558 let offset = 0; 14559 let view = dataview; 14560 if ( entry.compLength !== entry.origLength ) { 14561 const data = dataview.buffer.slice( 14562 entry.offset, 14563 entry.offset + entry.compLength 14564 ); 14565 let unpacked; 14566 if ( gzipDecode ) { 14567 unpacked = gzipDecode( new Uint8Array( data ) ); 14568 } else if ( nativeGzipDecode ) { 14569 unpacked = nativeGzipDecode( new Uint8Array( data ) ); 14570 } else { 14571 const msg = `no brotli decoder available to decode WOFF2 font`; 14572 if ( font.onerror ) font.onerror( msg ); 14573 throw new Error( msg ); 14574 } 14575 view = new DataView( unpacked.buffer ); 14576 } else { 14577 offset = entry.offset; 14578 } 14579 return createTable( 14580 woff.tables, 14581 { tag: entry.tag, offset: offset, length: entry.origLength }, 14582 view 14583 ); 14584 } ); 14585 } ); 14586 } 14587 const brotliDecode = (unbrotli_default()); 14588 let nativeBrotliDecode = undefined; 14589 // if ( ! brotliDecode ) { 14590 // import( 'zlib' ).then( ( zlib ) => { 14591 // nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer ); 14592 // } ); 14593 // } 14594 class WOFF2$1 extends SimpleTable { 14595 constructor( font, dataview, createTable ) { 14596 const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` ); 14597 this.signature = p.tag; 14598 this.flavor = p.uint32; 14599 this.length = p.uint32; 14600 this.numTables = p.uint16; 14601 p.uint16; 14602 this.totalSfntSize = p.uint32; 14603 this.totalCompressedSize = p.uint32; 14604 this.majorVersion = p.uint16; 14605 this.minorVersion = p.uint16; 14606 this.metaOffset = p.uint32; 14607 this.metaLength = p.uint32; 14608 this.metaOrigLength = p.uint32; 14609 this.privOffset = p.uint32; 14610 this.privLength = p.uint32; 14611 p.verifyLength(); 14612 this.directory = [ ...new Array( this.numTables ) ].map( 14613 ( _ ) => new Woff2TableDirectoryEntry( p ) 14614 ); 14615 let dictOffset = p.currentPosition; 14616 this.directory[ 0 ].offset = 0; 14617 this.directory.forEach( ( e, i ) => { 14618 let next = this.directory[ i + 1 ]; 14619 if ( next ) { 14620 next.offset = 14621 e.offset + 14622 ( e.transformLength !== undefined 14623 ? e.transformLength 14624 : e.origLength ); 14625 } 14626 } ); 14627 let decoded; 14628 let buffer = dataview.buffer.slice( dictOffset ); 14629 if ( brotliDecode ) { 14630 decoded = brotliDecode( new Uint8Array( buffer ) ); 14631 } else if ( nativeBrotliDecode ) { 14632 decoded = new Uint8Array( nativeBrotliDecode( buffer ) ); 14633 } else { 14634 const msg = `no brotli decoder available to decode WOFF2 font`; 14635 if ( font.onerror ) font.onerror( msg ); 14636 throw new Error( msg ); 14637 } 14638 buildWoff2LazyLookups( this, decoded, createTable ); 14639 } 14640 } 14641 class Woff2TableDirectoryEntry { 14642 constructor( p ) { 14643 this.flags = p.uint8; 14644 const tagNumber = ( this.tagNumber = this.flags & 63 ); 14645 if ( tagNumber === 63 ) { 14646 this.tag = p.tag; 14647 } else { 14648 this.tag = getWOFF2Tag( tagNumber ); 14649 } 14650 const transformVersion = ( this.transformVersion = 14651 ( this.flags & 192 ) >> 6 ); 14652 let hasTransforms = transformVersion !== 0; 14653 if ( this.tag === `glyf` || this.tag === `loca` ) { 14654 hasTransforms = this.transformVersion !== 3; 14655 } 14656 this.origLength = p.uint128; 14657 if ( hasTransforms ) { 14658 this.transformLength = p.uint128; 14659 } 14660 } 14661 } 14662 function buildWoff2LazyLookups( woff2, decoded, createTable ) { 14663 woff2.tables = {}; 14664 woff2.directory.forEach( ( entry ) => { 14665 lazy$1( woff2.tables, entry.tag.trim(), () => { 14666 const start = entry.offset; 14667 const end = 14668 start + 14669 ( entry.transformLength 14670 ? entry.transformLength 14671 : entry.origLength ); 14672 const data = new DataView( decoded.slice( start, end ).buffer ); 14673 try { 14674 return createTable( 14675 woff2.tables, 14676 { tag: entry.tag, offset: 0, length: entry.origLength }, 14677 data 14678 ); 14679 } catch ( e ) { 14680 console.error( e ); 14681 } 14682 } ); 14683 } ); 14684 } 14685 function getWOFF2Tag( flag ) { 14686 return [ 14687 `cmap`, 14688 `head`, 14689 `hhea`, 14690 `hmtx`, 14691 `maxp`, 14692 `name`, 14693 `OS/2`, 14694 `post`, 14695 `cvt `, 14696 `fpgm`, 14697 `glyf`, 14698 `loca`, 14699 `prep`, 14700 `CFF `, 14701 `VORG`, 14702 `EBDT`, 14703 `EBLC`, 14704 `gasp`, 14705 `hdmx`, 14706 `kern`, 14707 `LTSH`, 14708 `PCLT`, 14709 `VDMX`, 14710 `vhea`, 14711 `vmtx`, 14712 `BASE`, 14713 `GDEF`, 14714 `GPOS`, 14715 `GSUB`, 14716 `EBSC`, 14717 `JSTF`, 14718 `MATH`, 14719 `CBDT`, 14720 `CBLC`, 14721 `COLR`, 14722 `CPAL`, 14723 `SVG `, 14724 `sbix`, 14725 `acnt`, 14726 `avar`, 14727 `bdat`, 14728 `bloc`, 14729 `bsln`, 14730 `cvar`, 14731 `fdsc`, 14732 `feat`, 14733 `fmtx`, 14734 `fvar`, 14735 `gvar`, 14736 `hsty`, 14737 `just`, 14738 `lcar`, 14739 `mort`, 14740 `morx`, 14741 `opbd`, 14742 `prop`, 14743 `trak`, 14744 `Zapf`, 14745 `Silf`, 14746 `Glat`, 14747 `Gloc`, 14748 `Feat`, 14749 `Sill`, 14750 ][ flag & 63 ]; 14751 } 14752 const tableClasses = {}; 14753 let tableClassesLoaded = false; 14754 Promise.all( [ 14755 Promise.resolve().then( function () { 14756 return cmap$1; 14757 } ), 14758 Promise.resolve().then( function () { 14759 return head$1; 14760 } ), 14761 Promise.resolve().then( function () { 14762 return hhea$1; 14763 } ), 14764 Promise.resolve().then( function () { 14765 return hmtx$1; 14766 } ), 14767 Promise.resolve().then( function () { 14768 return maxp$1; 14769 } ), 14770 Promise.resolve().then( function () { 14771 return name$1; 14772 } ), 14773 Promise.resolve().then( function () { 14774 return OS2$1; 14775 } ), 14776 Promise.resolve().then( function () { 14777 return post$1; 14778 } ), 14779 Promise.resolve().then( function () { 14780 return BASE$1; 14781 } ), 14782 Promise.resolve().then( function () { 14783 return GDEF$1; 14784 } ), 14785 Promise.resolve().then( function () { 14786 return GSUB$1; 14787 } ), 14788 Promise.resolve().then( function () { 14789 return GPOS$1; 14790 } ), 14791 Promise.resolve().then( function () { 14792 return SVG$1; 14793 } ), 14794 Promise.resolve().then( function () { 14795 return fvar$1; 14796 } ), 14797 Promise.resolve().then( function () { 14798 return cvt$1; 14799 } ), 14800 Promise.resolve().then( function () { 14801 return fpgm$1; 14802 } ), 14803 Promise.resolve().then( function () { 14804 return gasp$1; 14805 } ), 14806 Promise.resolve().then( function () { 14807 return glyf$1; 14808 } ), 14809 Promise.resolve().then( function () { 14810 return loca$1; 14811 } ), 14812 Promise.resolve().then( function () { 14813 return prep$1; 14814 } ), 14815 Promise.resolve().then( function () { 14816 return CFF$1; 14817 } ), 14818 Promise.resolve().then( function () { 14819 return CFF2$1; 14820 } ), 14821 Promise.resolve().then( function () { 14822 return VORG$1; 14823 } ), 14824 Promise.resolve().then( function () { 14825 return EBLC$1; 14826 } ), 14827 Promise.resolve().then( function () { 14828 return EBDT$1; 14829 } ), 14830 Promise.resolve().then( function () { 14831 return EBSC$1; 14832 } ), 14833 Promise.resolve().then( function () { 14834 return CBLC$1; 14835 } ), 14836 Promise.resolve().then( function () { 14837 return CBDT$1; 14838 } ), 14839 Promise.resolve().then( function () { 14840 return sbix$1; 14841 } ), 14842 Promise.resolve().then( function () { 14843 return COLR$1; 14844 } ), 14845 Promise.resolve().then( function () { 14846 return CPAL$1; 14847 } ), 14848 Promise.resolve().then( function () { 14849 return DSIG$1; 14850 } ), 14851 Promise.resolve().then( function () { 14852 return hdmx$1; 14853 } ), 14854 Promise.resolve().then( function () { 14855 return kern$1; 14856 } ), 14857 Promise.resolve().then( function () { 14858 return LTSH$1; 14859 } ), 14860 Promise.resolve().then( function () { 14861 return MERG$1; 14862 } ), 14863 Promise.resolve().then( function () { 14864 return meta$1; 14865 } ), 14866 Promise.resolve().then( function () { 14867 return PCLT$1; 14868 } ), 14869 Promise.resolve().then( function () { 14870 return VDMX$1; 14871 } ), 14872 Promise.resolve().then( function () { 14873 return vhea$1; 14874 } ), 14875 Promise.resolve().then( function () { 14876 return vmtx$1; 14877 } ), 14878 ] ).then( ( data ) => { 14879 data.forEach( ( e ) => { 14880 let name = Object.keys( e )[ 0 ]; 14881 tableClasses[ name ] = e[ name ]; 14882 } ); 14883 tableClassesLoaded = true; 14884 } ); 14885 function createTable( tables, dict, dataview ) { 14886 let name = dict.tag.replace( /[^\w\d]/g, `` ); 14887 let Type = tableClasses[ name ]; 14888 if ( Type ) return new Type( dict, dataview, tables ); 14889 console.warn( 14890 `lib-font has no definition for ${ name }. The table was skipped.` 14891 ); 14892 return {}; 14893 } 14894 function loadTableClasses() { 14895 let count = 0; 14896 function checkLoaded( resolve, reject ) { 14897 if ( ! tableClassesLoaded ) { 14898 if ( count > 10 ) { 14899 return reject( new Error( `loading took too long` ) ); 14900 } 14901 count++; 14902 return setTimeout( () => checkLoaded( resolve ), 250 ); 14903 } 14904 resolve( createTable ); 14905 } 14906 return new Promise( ( resolve, reject ) => checkLoaded( resolve ) ); 14907 } 14908 function getFontCSSFormat( path, errorOnStyle ) { 14909 let pos = path.lastIndexOf( `.` ); 14910 let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase(); 14911 let format = { 14912 ttf: `truetype`, 14913 otf: `opentype`, 14914 woff: `woff`, 14915 woff2: `woff2`, 14916 }[ ext ]; 14917 if ( format ) return format; 14918 let msg = { 14919 eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`, 14920 svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`, 14921 fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, 14922 ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`, 14923 }[ ext ]; 14924 if ( ! msg ) msg = `${ path } is not a known webfont format.`; 14925 if ( errorOnStyle ) { 14926 throw new Error( msg ); 14927 } else { 14928 console.warn( `Could not load font: ${ msg }` ); 14929 } 14930 } 14931 async function setupFontFace( name, url, options = {} ) { 14932 if ( ! globalThis.document ) return; 14933 let format = getFontCSSFormat( url, options.errorOnStyle ); 14934 if ( ! format ) return; 14935 let style = document.createElement( `style` ); 14936 style.className = `injected-by-Font-js`; 14937 let rules = []; 14938 if ( options.styleRules ) { 14939 rules = Object.entries( options.styleRules ).map( 14940 ( [ key, value ] ) => `${ key }: ${ value };` 14941 ); 14942 } 14943 style.textContent = `\n@font-face {\n font-family: "${ name }";\n ${ rules.join( 14944 `\n\t` 14945 ) }\n src: url("${ url }") format("${ format }");\n}`; 14946 globalThis.document.head.appendChild( style ); 14947 return style; 14948 } 14949 const TTF = [ 0, 1, 0, 0 ]; 14950 const OTF = [ 79, 84, 84, 79 ]; 14951 const WOFF = [ 119, 79, 70, 70 ]; 14952 const WOFF2 = [ 119, 79, 70, 50 ]; 14953 function match( ar1, ar2 ) { 14954 if ( ar1.length !== ar2.length ) return; 14955 for ( let i = 0; i < ar1.length; i++ ) { 14956 if ( ar1[ i ] !== ar2[ i ] ) return; 14957 } 14958 return true; 14959 } 14960 function validFontFormat( dataview ) { 14961 const LEAD_BYTES = [ 14962 dataview.getUint8( 0 ), 14963 dataview.getUint8( 1 ), 14964 dataview.getUint8( 2 ), 14965 dataview.getUint8( 3 ), 14966 ]; 14967 if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`; 14968 if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`; 14969 if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`; 14970 } 14971 function checkFetchResponseStatus( response ) { 14972 if ( ! response.ok ) { 14973 throw new Error( 14974 `HTTP ${ response.status } - ${ response.statusText }` 14975 ); 14976 } 14977 return response; 14978 } 14979 class Font extends EventManager { 14980 constructor( name, options = {} ) { 14981 super(); 14982 this.name = name; 14983 this.options = options; 14984 this.metrics = false; 14985 } 14986 get src() { 14987 return this.__src; 14988 } 14989 set src( src ) { 14990 this.__src = src; 14991 ( async () => { 14992 if ( globalThis.document && ! this.options.skipStyleSheet ) { 14993 await setupFontFace( this.name, src, this.options ); 14994 } 14995 this.loadFont( src ); 14996 } )(); 14997 } 14998 async loadFont( url, filename ) { 14999 fetch( url ) 15000 .then( 15001 ( response ) => 15002 checkFetchResponseStatus( response ) && 15003 response.arrayBuffer() 15004 ) 15005 .then( ( buffer ) => 15006 this.fromDataBuffer( buffer, filename || url ) 15007 ) 15008 .catch( ( err ) => { 15009 const evt = new lib_font_browser_Event( 15010 `error`, 15011 err, 15012 `Failed to load font at ${ filename || url }` 15013 ); 15014 this.dispatch( evt ); 15015 if ( this.onerror ) this.onerror( evt ); 15016 } ); 15017 } 15018 async fromDataBuffer( buffer, filenameOrUrL ) { 15019 this.fontData = new DataView( buffer ); 15020 let type = validFontFormat( this.fontData ); 15021 if ( ! type ) { 15022 throw new Error( 15023 `${ filenameOrUrL } is either an unsupported font format, or not a font at all.` 15024 ); 15025 } 15026 await this.parseBasicData( type ); 15027 const evt = new lib_font_browser_Event( 'load', { font: this } ); 15028 this.dispatch( evt ); 15029 if ( this.onload ) this.onload( evt ); 15030 } 15031 async parseBasicData( type ) { 15032 return loadTableClasses().then( ( createTable ) => { 15033 if ( type === `SFNT` ) { 15034 this.opentype = new SFNT( this, this.fontData, createTable ); 15035 } 15036 if ( type === `WOFF` ) { 15037 this.opentype = new WOFF$1( this, this.fontData, createTable ); 15038 } 15039 if ( type === `WOFF2` ) { 15040 this.opentype = new WOFF2$1( this, this.fontData, createTable ); 15041 } 15042 return this.opentype; 15043 } ); 15044 } 15045 getGlyphId( char ) { 15046 return this.opentype.tables.cmap.getGlyphId( char ); 15047 } 15048 reverse( glyphid ) { 15049 return this.opentype.tables.cmap.reverse( glyphid ); 15050 } 15051 supports( char ) { 15052 return this.getGlyphId( char ) !== 0; 15053 } 15054 supportsVariation( variation ) { 15055 return ( 15056 this.opentype.tables.cmap.supportsVariation( variation ) !== false 15057 ); 15058 } 15059 measureText( text, size = 16 ) { 15060 if ( this.__unloaded ) 15061 throw new Error( 15062 'Cannot measure text: font was unloaded. Please reload before calling measureText()' 15063 ); 15064 let d = document.createElement( 'div' ); 15065 d.textContent = text; 15066 d.style.fontFamily = this.name; 15067 d.style.fontSize = `${ size }px`; 15068 d.style.color = `transparent`; 15069 d.style.background = `transparent`; 15070 d.style.top = `0`; 15071 d.style.left = `0`; 15072 d.style.position = `absolute`; 15073 document.body.appendChild( d ); 15074 let bbox = d.getBoundingClientRect(); 15075 document.body.removeChild( d ); 15076 const OS2 = this.opentype.tables[ 'OS/2' ]; 15077 bbox.fontSize = size; 15078 bbox.ascender = OS2.sTypoAscender; 15079 bbox.descender = OS2.sTypoDescender; 15080 return bbox; 15081 } 15082 unload() { 15083 if ( this.styleElement.parentNode ) { 15084 this.styleElement.parentNode.removeElement( this.styleElement ); 15085 const evt = new lib_font_browser_Event( 'unload', { font: this } ); 15086 this.dispatch( evt ); 15087 if ( this.onunload ) this.onunload( evt ); 15088 } 15089 this._unloaded = true; 15090 } 15091 load() { 15092 if ( this.__unloaded ) { 15093 delete this.__unloaded; 15094 document.head.appendChild( this.styleElement ); 15095 const evt = new lib_font_browser_Event( 'load', { font: this } ); 15096 this.dispatch( evt ); 15097 if ( this.onload ) this.onload( evt ); 15098 } 15099 } 15100 } 15101 globalThis.Font = Font; 15102 class Subtable extends ParsedData { 15103 constructor( p, plaformID, encodingID ) { 15104 super( p ); 15105 this.plaformID = plaformID; 15106 this.encodingID = encodingID; 15107 } 15108 } 15109 class Format0 extends Subtable { 15110 constructor( p, platformID, encodingID ) { 15111 super( p, platformID, encodingID ); 15112 this.format = 0; 15113 this.length = p.uint16; 15114 this.language = p.uint16; 15115 this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 ); 15116 } 15117 supports( charCode ) { 15118 if ( charCode.charCodeAt ) { 15119 charCode = -1; 15120 console.warn( 15121 `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` 15122 ); 15123 } 15124 return 0 <= charCode && charCode <= 255; 15125 } 15126 reverse( glyphID ) { 15127 console.warn( `reverse not implemented for cmap subtable format 0` ); 15128 return {}; 15129 } 15130 getSupportedCharCodes() { 15131 return [ { start: 1, end: 256 } ]; 15132 } 15133 } 15134 class Format2 extends Subtable { 15135 constructor( p, platformID, encodingID ) { 15136 super( p, platformID, encodingID ); 15137 this.format = 2; 15138 this.length = p.uint16; 15139 this.language = p.uint16; 15140 this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 ); 15141 const subHeaderCount = Math.max( ...this.subHeaderKeys ); 15142 const subHeaderOffset = p.currentPosition; 15143 lazy$1( this, `subHeaders`, () => { 15144 p.currentPosition = subHeaderOffset; 15145 return [ ...new Array( subHeaderCount ) ].map( 15146 ( _ ) => new SubHeader( p ) 15147 ); 15148 } ); 15149 const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; 15150 lazy$1( this, `glyphIndexArray`, () => { 15151 p.currentPosition = glyphIndexOffset; 15152 return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 ); 15153 } ); 15154 } 15155 supports( charCode ) { 15156 if ( charCode.charCodeAt ) { 15157 charCode = -1; 15158 console.warn( 15159 `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` 15160 ); 15161 } 15162 const low = charCode && 255; 15163 const high = charCode && 65280; 15164 const subHeaderKey = this.subHeaders[ high ]; 15165 const subheader = this.subHeaders[ subHeaderKey ]; 15166 const first = subheader.firstCode; 15167 const last = first + subheader.entryCount; 15168 return first <= low && low <= last; 15169 } 15170 reverse( glyphID ) { 15171 console.warn( `reverse not implemented for cmap subtable format 2` ); 15172 return {}; 15173 } 15174 getSupportedCharCodes( preservePropNames = false ) { 15175 if ( preservePropNames ) { 15176 return this.subHeaders.map( ( h ) => ( { 15177 firstCode: h.firstCode, 15178 lastCode: h.lastCode, 15179 } ) ); 15180 } 15181 return this.subHeaders.map( ( h ) => ( { 15182 start: h.firstCode, 15183 end: h.lastCode, 15184 } ) ); 15185 } 15186 } 15187 class SubHeader { 15188 constructor( p ) { 15189 this.firstCode = p.uint16; 15190 this.entryCount = p.uint16; 15191 this.lastCode = this.first + this.entryCount; 15192 this.idDelta = p.int16; 15193 this.idRangeOffset = p.uint16; 15194 } 15195 } 15196 class Format4 extends Subtable { 15197 constructor( p, platformID, encodingID ) { 15198 super( p, platformID, encodingID ); 15199 this.format = 4; 15200 this.length = p.uint16; 15201 this.language = p.uint16; 15202 this.segCountX2 = p.uint16; 15203 this.segCount = this.segCountX2 / 2; 15204 this.searchRange = p.uint16; 15205 this.entrySelector = p.uint16; 15206 this.rangeShift = p.uint16; 15207 const endCodePosition = p.currentPosition; 15208 lazy$1( this, `endCode`, () => 15209 p.readBytes( this.segCount, endCodePosition, 16 ) 15210 ); 15211 const startCodePosition = endCodePosition + 2 + this.segCountX2; 15212 lazy$1( this, `startCode`, () => 15213 p.readBytes( this.segCount, startCodePosition, 16 ) 15214 ); 15215 const idDeltaPosition = startCodePosition + this.segCountX2; 15216 lazy$1( this, `idDelta`, () => 15217 p.readBytes( this.segCount, idDeltaPosition, 16, true ) 15218 ); 15219 const idRangePosition = idDeltaPosition + this.segCountX2; 15220 lazy$1( this, `idRangeOffset`, () => 15221 p.readBytes( this.segCount, idRangePosition, 16 ) 15222 ); 15223 const glyphIdArrayPosition = idRangePosition + this.segCountX2; 15224 const glyphIdArrayLength = 15225 this.length - ( glyphIdArrayPosition - this.tableStart ); 15226 lazy$1( this, `glyphIdArray`, () => 15227 p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 ) 15228 ); 15229 lazy$1( this, `segments`, () => 15230 this.buildSegments( idRangePosition, glyphIdArrayPosition, p ) 15231 ); 15232 } 15233 buildSegments( idRangePosition, glyphIdArrayPosition, p ) { 15234 const build = ( _, i ) => { 15235 let startCode = this.startCode[ i ], 15236 endCode = this.endCode[ i ], 15237 idDelta = this.idDelta[ i ], 15238 idRangeOffset = this.idRangeOffset[ i ], 15239 idRangeOffsetPointer = idRangePosition + 2 * i, 15240 glyphIDs = []; 15241 if ( idRangeOffset === 0 ) { 15242 for ( 15243 let i = startCode + idDelta, e = endCode + idDelta; 15244 i <= e; 15245 i++ 15246 ) { 15247 glyphIDs.push( i ); 15248 } 15249 } else { 15250 for ( let i = 0, e = endCode - startCode; i <= e; i++ ) { 15251 p.currentPosition = 15252 idRangeOffsetPointer + idRangeOffset + i * 2; 15253 glyphIDs.push( p.uint16 ); 15254 } 15255 } 15256 return { 15257 startCode: startCode, 15258 endCode: endCode, 15259 idDelta: idDelta, 15260 idRangeOffset: idRangeOffset, 15261 glyphIDs: glyphIDs, 15262 }; 15263 }; 15264 return [ ...new Array( this.segCount ) ].map( build ); 15265 } 15266 reverse( glyphID ) { 15267 let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) ); 15268 if ( ! s ) return {}; 15269 const code = s.startCode + s.glyphIDs.indexOf( glyphID ); 15270 return { code: code, unicode: String.fromCodePoint( code ) }; 15271 } 15272 getGlyphId( charCode ) { 15273 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 15274 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 15275 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 15276 return 0; 15277 let segment = this.segments.find( 15278 ( s ) => s.startCode <= charCode && charCode <= s.endCode 15279 ); 15280 if ( ! segment ) return 0; 15281 return segment.glyphIDs[ charCode - segment.startCode ]; 15282 } 15283 supports( charCode ) { 15284 return this.getGlyphId( charCode ) !== 0; 15285 } 15286 getSupportedCharCodes( preservePropNames = false ) { 15287 if ( preservePropNames ) return this.segments; 15288 return this.segments.map( ( v ) => ( { 15289 start: v.startCode, 15290 end: v.endCode, 15291 } ) ); 15292 } 15293 } 15294 class Format6 extends Subtable { 15295 constructor( p, platformID, encodingID ) { 15296 super( p, platformID, encodingID ); 15297 this.format = 6; 15298 this.length = p.uint16; 15299 this.language = p.uint16; 15300 this.firstCode = p.uint16; 15301 this.entryCount = p.uint16; 15302 this.lastCode = this.firstCode + this.entryCount - 1; 15303 const getter = () => 15304 [ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 ); 15305 lazy$1( this, `glyphIdArray`, getter ); 15306 } 15307 supports( charCode ) { 15308 if ( charCode.charCodeAt ) { 15309 charCode = -1; 15310 console.warn( 15311 `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` 15312 ); 15313 } 15314 if ( charCode < this.firstCode ) return {}; 15315 if ( charCode > this.firstCode + this.entryCount ) return {}; 15316 const code = charCode - this.firstCode; 15317 return { code: code, unicode: String.fromCodePoint( code ) }; 15318 } 15319 reverse( glyphID ) { 15320 let pos = this.glyphIdArray.indexOf( glyphID ); 15321 if ( pos > -1 ) return this.firstCode + pos; 15322 } 15323 getSupportedCharCodes( preservePropNames = false ) { 15324 if ( preservePropNames ) { 15325 return [ { firstCode: this.firstCode, lastCode: this.lastCode } ]; 15326 } 15327 return [ { start: this.firstCode, end: this.lastCode } ]; 15328 } 15329 } 15330 class Format8 extends Subtable { 15331 constructor( p, platformID, encodingID ) { 15332 super( p, platformID, encodingID ); 15333 this.format = 8; 15334 p.uint16; 15335 this.length = p.uint32; 15336 this.language = p.uint32; 15337 this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 ); 15338 this.numGroups = p.uint32; 15339 const getter = () => 15340 [ ...new Array( this.numGroups ) ].map( 15341 ( _ ) => new SequentialMapGroup$1( p ) 15342 ); 15343 lazy$1( this, `groups`, getter ); 15344 } 15345 supports( charCode ) { 15346 if ( charCode.charCodeAt ) { 15347 charCode = -1; 15348 console.warn( 15349 `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` 15350 ); 15351 } 15352 return ( 15353 this.groups.findIndex( 15354 ( s ) => 15355 s.startcharCode <= charCode && charCode <= s.endcharCode 15356 ) !== -1 15357 ); 15358 } 15359 reverse( glyphID ) { 15360 console.warn( `reverse not implemented for cmap subtable format 8` ); 15361 return {}; 15362 } 15363 getSupportedCharCodes( preservePropNames = false ) { 15364 if ( preservePropNames ) return this.groups; 15365 return this.groups.map( ( v ) => ( { 15366 start: v.startcharCode, 15367 end: v.endcharCode, 15368 } ) ); 15369 } 15370 } 15371 class SequentialMapGroup$1 { 15372 constructor( p ) { 15373 this.startcharCode = p.uint32; 15374 this.endcharCode = p.uint32; 15375 this.startGlyphID = p.uint32; 15376 } 15377 } 15378 class Format10 extends Subtable { 15379 constructor( p, platformID, encodingID ) { 15380 super( p, platformID, encodingID ); 15381 this.format = 10; 15382 p.uint16; 15383 this.length = p.uint32; 15384 this.language = p.uint32; 15385 this.startCharCode = p.uint32; 15386 this.numChars = p.uint32; 15387 this.endCharCode = this.startCharCode + this.numChars; 15388 const getter = () => 15389 [ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 ); 15390 lazy$1( this, `glyphs`, getter ); 15391 } 15392 supports( charCode ) { 15393 if ( charCode.charCodeAt ) { 15394 charCode = -1; 15395 console.warn( 15396 `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` 15397 ); 15398 } 15399 if ( charCode < this.startCharCode ) return false; 15400 if ( charCode > this.startCharCode + this.numChars ) return false; 15401 return charCode - this.startCharCode; 15402 } 15403 reverse( glyphID ) { 15404 console.warn( `reverse not implemented for cmap subtable format 10` ); 15405 return {}; 15406 } 15407 getSupportedCharCodes( preservePropNames = false ) { 15408 if ( preservePropNames ) { 15409 return [ 15410 { 15411 startCharCode: this.startCharCode, 15412 endCharCode: this.endCharCode, 15413 }, 15414 ]; 15415 } 15416 return [ { start: this.startCharCode, end: this.endCharCode } ]; 15417 } 15418 } 15419 class Format12 extends Subtable { 15420 constructor( p, platformID, encodingID ) { 15421 super( p, platformID, encodingID ); 15422 this.format = 12; 15423 p.uint16; 15424 this.length = p.uint32; 15425 this.language = p.uint32; 15426 this.numGroups = p.uint32; 15427 const getter = () => 15428 [ ...new Array( this.numGroups ) ].map( 15429 ( _ ) => new SequentialMapGroup( p ) 15430 ); 15431 lazy$1( this, `groups`, getter ); 15432 } 15433 supports( charCode ) { 15434 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 15435 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 15436 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 15437 return 0; 15438 return ( 15439 this.groups.findIndex( 15440 ( s ) => 15441 s.startCharCode <= charCode && charCode <= s.endCharCode 15442 ) !== -1 15443 ); 15444 } 15445 reverse( glyphID ) { 15446 for ( let group of this.groups ) { 15447 let start = group.startGlyphID; 15448 if ( start > glyphID ) continue; 15449 if ( start === glyphID ) return group.startCharCode; 15450 let end = start + ( group.endCharCode - group.startCharCode ); 15451 if ( end < glyphID ) continue; 15452 const code = group.startCharCode + ( glyphID - start ); 15453 return { code: code, unicode: String.fromCodePoint( code ) }; 15454 } 15455 return {}; 15456 } 15457 getSupportedCharCodes( preservePropNames = false ) { 15458 if ( preservePropNames ) return this.groups; 15459 return this.groups.map( ( v ) => ( { 15460 start: v.startCharCode, 15461 end: v.endCharCode, 15462 } ) ); 15463 } 15464 } 15465 class SequentialMapGroup { 15466 constructor( p ) { 15467 this.startCharCode = p.uint32; 15468 this.endCharCode = p.uint32; 15469 this.startGlyphID = p.uint32; 15470 } 15471 } 15472 class Format13 extends Subtable { 15473 constructor( p, platformID, encodingID ) { 15474 super( p, platformID, encodingID ); 15475 this.format = 13; 15476 p.uint16; 15477 this.length = p.uint32; 15478 this.language = p.uint32; 15479 this.numGroups = p.uint32; 15480 const getter = [ ...new Array( this.numGroups ) ].map( 15481 ( _ ) => new ConstantMapGroup( p ) 15482 ); 15483 lazy$1( this, `groups`, getter ); 15484 } 15485 supports( charCode ) { 15486 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 15487 return ( 15488 this.groups.findIndex( 15489 ( s ) => 15490 s.startCharCode <= charCode && charCode <= s.endCharCode 15491 ) !== -1 15492 ); 15493 } 15494 reverse( glyphID ) { 15495 console.warn( `reverse not implemented for cmap subtable format 13` ); 15496 return {}; 15497 } 15498 getSupportedCharCodes( preservePropNames = false ) { 15499 if ( preservePropNames ) return this.groups; 15500 return this.groups.map( ( v ) => ( { 15501 start: v.startCharCode, 15502 end: v.endCharCode, 15503 } ) ); 15504 } 15505 } 15506 class ConstantMapGroup { 15507 constructor( p ) { 15508 this.startCharCode = p.uint32; 15509 this.endCharCode = p.uint32; 15510 this.glyphID = p.uint32; 15511 } 15512 } 15513 class Format14 extends Subtable { 15514 constructor( p, platformID, encodingID ) { 15515 super( p, platformID, encodingID ); 15516 this.subTableStart = p.currentPosition; 15517 this.format = 14; 15518 this.length = p.uint32; 15519 this.numVarSelectorRecords = p.uint32; 15520 lazy$1( this, `varSelectors`, () => 15521 [ ...new Array( this.numVarSelectorRecords ) ].map( 15522 ( _ ) => new VariationSelector( p ) 15523 ) 15524 ); 15525 } 15526 supports() { 15527 console.warn( `supports not implemented for cmap subtable format 14` ); 15528 return 0; 15529 } 15530 getSupportedCharCodes() { 15531 console.warn( 15532 `getSupportedCharCodes not implemented for cmap subtable format 14` 15533 ); 15534 return []; 15535 } 15536 reverse( glyphID ) { 15537 console.warn( `reverse not implemented for cmap subtable format 14` ); 15538 return {}; 15539 } 15540 supportsVariation( variation ) { 15541 let v = this.varSelector.find( 15542 ( uvs ) => uvs.varSelector === variation 15543 ); 15544 return v ? v : false; 15545 } 15546 getSupportedVariations() { 15547 return this.varSelectors.map( ( v ) => v.varSelector ); 15548 } 15549 } 15550 class VariationSelector { 15551 constructor( p ) { 15552 this.varSelector = p.uint24; 15553 this.defaultUVSOffset = p.Offset32; 15554 this.nonDefaultUVSOffset = p.Offset32; 15555 } 15556 } 15557 function createSubTable( parser, platformID, encodingID ) { 15558 const format = parser.uint16; 15559 if ( format === 0 ) return new Format0( parser, platformID, encodingID ); 15560 if ( format === 2 ) return new Format2( parser, platformID, encodingID ); 15561 if ( format === 4 ) return new Format4( parser, platformID, encodingID ); 15562 if ( format === 6 ) return new Format6( parser, platformID, encodingID ); 15563 if ( format === 8 ) return new Format8( parser, platformID, encodingID ); 15564 if ( format === 10 ) return new Format10( parser, platformID, encodingID ); 15565 if ( format === 12 ) return new Format12( parser, platformID, encodingID ); 15566 if ( format === 13 ) return new Format13( parser, platformID, encodingID ); 15567 if ( format === 14 ) return new Format14( parser, platformID, encodingID ); 15568 return {}; 15569 } 15570 class cmap extends SimpleTable { 15571 constructor( dict, dataview ) { 15572 const { p: p } = super( dict, dataview ); 15573 this.version = p.uint16; 15574 this.numTables = p.uint16; 15575 this.encodingRecords = [ ...new Array( this.numTables ) ].map( 15576 ( _ ) => new EncodingRecord( p, this.tableStart ) 15577 ); 15578 } 15579 getSubTable( tableID ) { 15580 return this.encodingRecords[ tableID ].table; 15581 } 15582 getSupportedEncodings() { 15583 return this.encodingRecords.map( ( r ) => ( { 15584 platformID: r.platformID, 15585 encodingId: r.encodingID, 15586 } ) ); 15587 } 15588 getSupportedCharCodes( platformID, encodingID ) { 15589 const recordID = this.encodingRecords.findIndex( 15590 ( r ) => r.platformID === platformID && r.encodingID === encodingID 15591 ); 15592 if ( recordID === -1 ) return false; 15593 const subtable = this.getSubTable( recordID ); 15594 return subtable.getSupportedCharCodes(); 15595 } 15596 reverse( glyphid ) { 15597 for ( let i = 0; i < this.numTables; i++ ) { 15598 let code = this.getSubTable( i ).reverse( glyphid ); 15599 if ( code ) return code; 15600 } 15601 } 15602 getGlyphId( char ) { 15603 let last = 0; 15604 this.encodingRecords.some( ( _, tableID ) => { 15605 let t = this.getSubTable( tableID ); 15606 if ( ! t.getGlyphId ) return false; 15607 last = t.getGlyphId( char ); 15608 return last !== 0; 15609 } ); 15610 return last; 15611 } 15612 supports( char ) { 15613 return this.encodingRecords.some( ( _, tableID ) => { 15614 const t = this.getSubTable( tableID ); 15615 return t.supports && t.supports( char ) !== false; 15616 } ); 15617 } 15618 supportsVariation( variation ) { 15619 return this.encodingRecords.some( ( _, tableID ) => { 15620 const t = this.getSubTable( tableID ); 15621 return ( 15622 t.supportsVariation && 15623 t.supportsVariation( variation ) !== false 15624 ); 15625 } ); 15626 } 15627 } 15628 class EncodingRecord { 15629 constructor( p, tableStart ) { 15630 const platformID = ( this.platformID = p.uint16 ); 15631 const encodingID = ( this.encodingID = p.uint16 ); 15632 const offset = ( this.offset = p.Offset32 ); 15633 lazy$1( this, `table`, () => { 15634 p.currentPosition = tableStart + offset; 15635 return createSubTable( p, platformID, encodingID ); 15636 } ); 15637 } 15638 } 15639 var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } ); 15640 class head extends SimpleTable { 15641 constructor( dict, dataview ) { 15642 const { p: p } = super( dict, dataview ); 15643 this.load( { 15644 majorVersion: p.uint16, 15645 minorVersion: p.uint16, 15646 fontRevision: p.fixed, 15647 checkSumAdjustment: p.uint32, 15648 magicNumber: p.uint32, 15649 flags: p.flags( 16 ), 15650 unitsPerEm: p.uint16, 15651 created: p.longdatetime, 15652 modified: p.longdatetime, 15653 xMin: p.int16, 15654 yMin: p.int16, 15655 xMax: p.int16, 15656 yMax: p.int16, 15657 macStyle: p.flags( 16 ), 15658 lowestRecPPEM: p.uint16, 15659 fontDirectionHint: p.uint16, 15660 indexToLocFormat: p.uint16, 15661 glyphDataFormat: p.uint16, 15662 } ); 15663 } 15664 } 15665 var head$1 = Object.freeze( { __proto__: null, head: head } ); 15666 class hhea extends SimpleTable { 15667 constructor( dict, dataview ) { 15668 const { p: p } = super( dict, dataview ); 15669 this.majorVersion = p.uint16; 15670 this.minorVersion = p.uint16; 15671 this.ascender = p.fword; 15672 this.descender = p.fword; 15673 this.lineGap = p.fword; 15674 this.advanceWidthMax = p.ufword; 15675 this.minLeftSideBearing = p.fword; 15676 this.minRightSideBearing = p.fword; 15677 this.xMaxExtent = p.fword; 15678 this.caretSlopeRise = p.int16; 15679 this.caretSlopeRun = p.int16; 15680 this.caretOffset = p.int16; 15681 p.int16; 15682 p.int16; 15683 p.int16; 15684 p.int16; 15685 this.metricDataFormat = p.int16; 15686 this.numberOfHMetrics = p.uint16; 15687 p.verifyLength(); 15688 } 15689 } 15690 var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } ); 15691 class hmtx extends SimpleTable { 15692 constructor( dict, dataview, tables ) { 15693 const { p: p } = super( dict, dataview ); 15694 const numberOfHMetrics = tables.hhea.numberOfHMetrics; 15695 const numGlyphs = tables.maxp.numGlyphs; 15696 const metricsStart = p.currentPosition; 15697 lazy$1( this, `hMetrics`, () => { 15698 p.currentPosition = metricsStart; 15699 return [ ...new Array( numberOfHMetrics ) ].map( 15700 ( _ ) => new LongHorMetric( p.uint16, p.int16 ) 15701 ); 15702 } ); 15703 if ( numberOfHMetrics < numGlyphs ) { 15704 const lsbStart = metricsStart + numberOfHMetrics * 4; 15705 lazy$1( this, `leftSideBearings`, () => { 15706 p.currentPosition = lsbStart; 15707 return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map( 15708 ( _ ) => p.int16 15709 ); 15710 } ); 15711 } 15712 } 15713 } 15714 class LongHorMetric { 15715 constructor( w, b ) { 15716 this.advanceWidth = w; 15717 this.lsb = b; 15718 } 15719 } 15720 var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } ); 15721 class maxp extends SimpleTable { 15722 constructor( dict, dataview ) { 15723 const { p: p } = super( dict, dataview ); 15724 this.version = p.legacyFixed; 15725 this.numGlyphs = p.uint16; 15726 if ( this.version === 1 ) { 15727 this.maxPoints = p.uint16; 15728 this.maxContours = p.uint16; 15729 this.maxCompositePoints = p.uint16; 15730 this.maxCompositeContours = p.uint16; 15731 this.maxZones = p.uint16; 15732 this.maxTwilightPoints = p.uint16; 15733 this.maxStorage = p.uint16; 15734 this.maxFunctionDefs = p.uint16; 15735 this.maxInstructionDefs = p.uint16; 15736 this.maxStackElements = p.uint16; 15737 this.maxSizeOfInstructions = p.uint16; 15738 this.maxComponentElements = p.uint16; 15739 this.maxComponentDepth = p.uint16; 15740 } 15741 p.verifyLength(); 15742 } 15743 } 15744 var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } ); 15745 class lib_font_browser_name extends SimpleTable { 15746 constructor( dict, dataview ) { 15747 const { p: p } = super( dict, dataview ); 15748 this.format = p.uint16; 15749 this.count = p.uint16; 15750 this.stringOffset = p.Offset16; 15751 this.nameRecords = [ ...new Array( this.count ) ].map( 15752 ( _ ) => new NameRecord( p, this ) 15753 ); 15754 if ( this.format === 1 ) { 15755 this.langTagCount = p.uint16; 15756 this.langTagRecords = [ ...new Array( this.langTagCount ) ].map( 15757 ( _ ) => new LangTagRecord( p.uint16, p.Offset16 ) 15758 ); 15759 } 15760 this.stringStart = this.tableStart + this.stringOffset; 15761 } 15762 get( nameID ) { 15763 let record = this.nameRecords.find( 15764 ( record ) => record.nameID === nameID 15765 ); 15766 if ( record ) return record.string; 15767 } 15768 } 15769 class LangTagRecord { 15770 constructor( length, offset ) { 15771 this.length = length; 15772 this.offset = offset; 15773 } 15774 } 15775 class NameRecord { 15776 constructor( p, nameTable ) { 15777 this.platformID = p.uint16; 15778 this.encodingID = p.uint16; 15779 this.languageID = p.uint16; 15780 this.nameID = p.uint16; 15781 this.length = p.uint16; 15782 this.offset = p.Offset16; 15783 lazy$1( this, `string`, () => { 15784 p.currentPosition = nameTable.stringStart + this.offset; 15785 return decodeString( p, this ); 15786 } ); 15787 } 15788 } 15789 function decodeString( p, record ) { 15790 const { platformID: platformID, length: length } = record; 15791 if ( length === 0 ) return ``; 15792 if ( platformID === 0 || platformID === 3 ) { 15793 const str = []; 15794 for ( let i = 0, e = length / 2; i < e; i++ ) 15795 str[ i ] = String.fromCharCode( p.uint16 ); 15796 return str.join( `` ); 15797 } 15798 const bytes = p.readBytes( length ); 15799 const str = []; 15800 bytes.forEach( function ( b, i ) { 15801 str[ i ] = String.fromCharCode( b ); 15802 } ); 15803 return str.join( `` ); 15804 } 15805 var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } ); 15806 class OS2 extends SimpleTable { 15807 constructor( dict, dataview ) { 15808 const { p: p } = super( dict, dataview ); 15809 this.version = p.uint16; 15810 this.xAvgCharWidth = p.int16; 15811 this.usWeightClass = p.uint16; 15812 this.usWidthClass = p.uint16; 15813 this.fsType = p.uint16; 15814 this.ySubscriptXSize = p.int16; 15815 this.ySubscriptYSize = p.int16; 15816 this.ySubscriptXOffset = p.int16; 15817 this.ySubscriptYOffset = p.int16; 15818 this.ySuperscriptXSize = p.int16; 15819 this.ySuperscriptYSize = p.int16; 15820 this.ySuperscriptXOffset = p.int16; 15821 this.ySuperscriptYOffset = p.int16; 15822 this.yStrikeoutSize = p.int16; 15823 this.yStrikeoutPosition = p.int16; 15824 this.sFamilyClass = p.int16; 15825 this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 ); 15826 this.ulUnicodeRange1 = p.flags( 32 ); 15827 this.ulUnicodeRange2 = p.flags( 32 ); 15828 this.ulUnicodeRange3 = p.flags( 32 ); 15829 this.ulUnicodeRange4 = p.flags( 32 ); 15830 this.achVendID = p.tag; 15831 this.fsSelection = p.uint16; 15832 this.usFirstCharIndex = p.uint16; 15833 this.usLastCharIndex = p.uint16; 15834 this.sTypoAscender = p.int16; 15835 this.sTypoDescender = p.int16; 15836 this.sTypoLineGap = p.int16; 15837 this.usWinAscent = p.uint16; 15838 this.usWinDescent = p.uint16; 15839 if ( this.version === 0 ) return p.verifyLength(); 15840 this.ulCodePageRange1 = p.flags( 32 ); 15841 this.ulCodePageRange2 = p.flags( 32 ); 15842 if ( this.version === 1 ) return p.verifyLength(); 15843 this.sxHeight = p.int16; 15844 this.sCapHeight = p.int16; 15845 this.usDefaultChar = p.uint16; 15846 this.usBreakChar = p.uint16; 15847 this.usMaxContext = p.uint16; 15848 if ( this.version <= 4 ) return p.verifyLength(); 15849 this.usLowerOpticalPointSize = p.uint16; 15850 this.usUpperOpticalPointSize = p.uint16; 15851 if ( this.version === 5 ) return p.verifyLength(); 15852 } 15853 } 15854 var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } ); 15855 class post extends SimpleTable { 15856 constructor( dict, dataview ) { 15857 const { p: p } = super( dict, dataview ); 15858 this.version = p.legacyFixed; 15859 this.italicAngle = p.fixed; 15860 this.underlinePosition = p.fword; 15861 this.underlineThickness = p.fword; 15862 this.isFixedPitch = p.uint32; 15863 this.minMemType42 = p.uint32; 15864 this.maxMemType42 = p.uint32; 15865 this.minMemType1 = p.uint32; 15866 this.maxMemType1 = p.uint32; 15867 if ( this.version === 1 || this.version === 3 ) return p.verifyLength(); 15868 this.numGlyphs = p.uint16; 15869 if ( this.version === 2 ) { 15870 this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map( 15871 ( _ ) => p.uint16 15872 ); 15873 this.namesOffset = p.currentPosition; 15874 this.glyphNameOffsets = [ 1 ]; 15875 for ( let i = 0; i < this.numGlyphs; i++ ) { 15876 let index = this.glyphNameIndex[ i ]; 15877 if ( index < macStrings.length ) { 15878 this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] ); 15879 continue; 15880 } 15881 let bytelength = p.int8; 15882 p.skip( bytelength ); 15883 this.glyphNameOffsets.push( 15884 this.glyphNameOffsets[ i ] + bytelength + 1 15885 ); 15886 } 15887 } 15888 if ( this.version === 2.5 ) { 15889 this.offset = [ ...new Array( this.numGlyphs ) ].map( 15890 ( _ ) => p.int8 15891 ); 15892 } 15893 } 15894 getGlyphName( glyphid ) { 15895 if ( this.version !== 2 ) { 15896 console.warn( 15897 `post table version ${ this.version } does not support glyph name lookups` 15898 ); 15899 return ``; 15900 } 15901 let index = this.glyphNameIndex[ glyphid ]; 15902 if ( index < 258 ) return macStrings[ index ]; 15903 let offset = this.glyphNameOffsets[ glyphid ]; 15904 let next = this.glyphNameOffsets[ glyphid + 1 ]; 15905 let len = next - offset - 1; 15906 if ( len === 0 ) return `.notdef.`; 15907 this.parser.currentPosition = this.namesOffset + offset; 15908 const data = this.parser.readBytes( 15909 len, 15910 this.namesOffset + offset, 15911 8, 15912 true 15913 ); 15914 return data.map( ( b ) => String.fromCharCode( b ) ).join( `` ); 15915 } 15916 } 15917 const macStrings = [ 15918 `.notdef`, 15919 `.null`, 15920 `nonmarkingreturn`, 15921 `space`, 15922 `exclam`, 15923 `quotedbl`, 15924 `numbersign`, 15925 `dollar`, 15926 `percent`, 15927 `ampersand`, 15928 `quotesingle`, 15929 `parenleft`, 15930 `parenright`, 15931 `asterisk`, 15932 `plus`, 15933 `comma`, 15934 `hyphen`, 15935 `period`, 15936 `slash`, 15937 `zero`, 15938 `one`, 15939 `two`, 15940 `three`, 15941 `four`, 15942 `five`, 15943 `six`, 15944 `seven`, 15945 `eight`, 15946 `nine`, 15947 `colon`, 15948 `semicolon`, 15949 `less`, 15950 `equal`, 15951 `greater`, 15952 `question`, 15953 `at`, 15954 `A`, 15955 `B`, 15956 `C`, 15957 `D`, 15958 `E`, 15959 `F`, 15960 `G`, 15961 `H`, 15962 `I`, 15963 `J`, 15964 `K`, 15965 `L`, 15966 `M`, 15967 `N`, 15968 `O`, 15969 `P`, 15970 `Q`, 15971 `R`, 15972 `S`, 15973 `T`, 15974 `U`, 15975 `V`, 15976 `W`, 15977 `X`, 15978 `Y`, 15979 `Z`, 15980 `bracketleft`, 15981 `backslash`, 15982 `bracketright`, 15983 `asciicircum`, 15984 `underscore`, 15985 `grave`, 15986 `a`, 15987 `b`, 15988 `c`, 15989 `d`, 15990 `e`, 15991 `f`, 15992 `g`, 15993 `h`, 15994 `i`, 15995 `j`, 15996 `k`, 15997 `l`, 15998 `m`, 15999 `n`, 16000 `o`, 16001 `p`, 16002 `q`, 16003 `r`, 16004 `s`, 16005 `t`, 16006 `u`, 16007 `v`, 16008 `w`, 16009 `x`, 16010 `y`, 16011 `z`, 16012 `braceleft`, 16013 `bar`, 16014 `braceright`, 16015 `asciitilde`, 16016 `Adieresis`, 16017 `Aring`, 16018 `Ccedilla`, 16019 `Eacute`, 16020 `Ntilde`, 16021 `Odieresis`, 16022 `Udieresis`, 16023 `aacute`, 16024 `agrave`, 16025 `acircumflex`, 16026 `adieresis`, 16027 `atilde`, 16028 `aring`, 16029 `ccedilla`, 16030 `eacute`, 16031 `egrave`, 16032 `ecircumflex`, 16033 `edieresis`, 16034 `iacute`, 16035 `igrave`, 16036 `icircumflex`, 16037 `idieresis`, 16038 `ntilde`, 16039 `oacute`, 16040 `ograve`, 16041 `ocircumflex`, 16042 `odieresis`, 16043 `otilde`, 16044 `uacute`, 16045 `ugrave`, 16046 `ucircumflex`, 16047 `udieresis`, 16048 `dagger`, 16049 `degree`, 16050 `cent`, 16051 `sterling`, 16052 `section`, 16053 `bullet`, 16054 `paragraph`, 16055 `germandbls`, 16056 `registered`, 16057 `copyright`, 16058 `trademark`, 16059 `acute`, 16060 `dieresis`, 16061 `notequal`, 16062 `AE`, 16063 `Oslash`, 16064 `infinity`, 16065 `plusminus`, 16066 `lessequal`, 16067 `greaterequal`, 16068 `yen`, 16069 `mu`, 16070 `partialdiff`, 16071 `summation`, 16072 `product`, 16073 `pi`, 16074 `integral`, 16075 `ordfeminine`, 16076 `ordmasculine`, 16077 `Omega`, 16078 `ae`, 16079 `oslash`, 16080 `questiondown`, 16081 `exclamdown`, 16082 `logicalnot`, 16083 `radical`, 16084 `florin`, 16085 `approxequal`, 16086 `Delta`, 16087 `guillemotleft`, 16088 `guillemotright`, 16089 `ellipsis`, 16090 `nonbreakingspace`, 16091 `Agrave`, 16092 `Atilde`, 16093 `Otilde`, 16094 `OE`, 16095 `oe`, 16096 `endash`, 16097 `emdash`, 16098 `quotedblleft`, 16099 `quotedblright`, 16100 `quoteleft`, 16101 `quoteright`, 16102 `divide`, 16103 `lozenge`, 16104 `ydieresis`, 16105 `Ydieresis`, 16106 `fraction`, 16107 `currency`, 16108 `guilsinglleft`, 16109 `guilsinglright`, 16110 `fi`, 16111 `fl`, 16112 `daggerdbl`, 16113 `periodcentered`, 16114 `quotesinglbase`, 16115 `quotedblbase`, 16116 `perthousand`, 16117 `Acircumflex`, 16118 `Ecircumflex`, 16119 `Aacute`, 16120 `Edieresis`, 16121 `Egrave`, 16122 `Iacute`, 16123 `Icircumflex`, 16124 `Idieresis`, 16125 `Igrave`, 16126 `Oacute`, 16127 `Ocircumflex`, 16128 `apple`, 16129 `Ograve`, 16130 `Uacute`, 16131 `Ucircumflex`, 16132 `Ugrave`, 16133 `dotlessi`, 16134 `circumflex`, 16135 `tilde`, 16136 `macron`, 16137 `breve`, 16138 `dotaccent`, 16139 `ring`, 16140 `cedilla`, 16141 `hungarumlaut`, 16142 `ogonek`, 16143 `caron`, 16144 `Lslash`, 16145 `lslash`, 16146 `Scaron`, 16147 `scaron`, 16148 `Zcaron`, 16149 `zcaron`, 16150 `brokenbar`, 16151 `Eth`, 16152 `eth`, 16153 `Yacute`, 16154 `yacute`, 16155 `Thorn`, 16156 `thorn`, 16157 `minus`, 16158 `multiply`, 16159 `onesuperior`, 16160 `twosuperior`, 16161 `threesuperior`, 16162 `onehalf`, 16163 `onequarter`, 16164 `threequarters`, 16165 `franc`, 16166 `Gbreve`, 16167 `gbreve`, 16168 `Idotaccent`, 16169 `Scedilla`, 16170 `scedilla`, 16171 `Cacute`, 16172 `cacute`, 16173 `Ccaron`, 16174 `ccaron`, 16175 `dcroat`, 16176 ]; 16177 var post$1 = Object.freeze( { __proto__: null, post: post } ); 16178 class BASE extends SimpleTable { 16179 constructor( dict, dataview ) { 16180 const { p: p } = super( dict, dataview ); 16181 this.majorVersion = p.uint16; 16182 this.minorVersion = p.uint16; 16183 this.horizAxisOffset = p.Offset16; 16184 this.vertAxisOffset = p.Offset16; 16185 lazy$1( 16186 this, 16187 `horizAxis`, 16188 () => 16189 new AxisTable( 16190 { offset: dict.offset + this.horizAxisOffset }, 16191 dataview 16192 ) 16193 ); 16194 lazy$1( 16195 this, 16196 `vertAxis`, 16197 () => 16198 new AxisTable( 16199 { offset: dict.offset + this.vertAxisOffset }, 16200 dataview 16201 ) 16202 ); 16203 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 16204 this.itemVarStoreOffset = p.Offset32; 16205 lazy$1( 16206 this, 16207 `itemVarStore`, 16208 () => 16209 new AxisTable( 16210 { offset: dict.offset + this.itemVarStoreOffset }, 16211 dataview 16212 ) 16213 ); 16214 } 16215 } 16216 } 16217 class AxisTable extends SimpleTable { 16218 constructor( dict, dataview ) { 16219 const { p: p } = super( dict, dataview, `AxisTable` ); 16220 this.baseTagListOffset = p.Offset16; 16221 this.baseScriptListOffset = p.Offset16; 16222 lazy$1( 16223 this, 16224 `baseTagList`, 16225 () => 16226 new BaseTagListTable( 16227 { offset: dict.offset + this.baseTagListOffset }, 16228 dataview 16229 ) 16230 ); 16231 lazy$1( 16232 this, 16233 `baseScriptList`, 16234 () => 16235 new BaseScriptListTable( 16236 { offset: dict.offset + this.baseScriptListOffset }, 16237 dataview 16238 ) 16239 ); 16240 } 16241 } 16242 class BaseTagListTable extends SimpleTable { 16243 constructor( dict, dataview ) { 16244 const { p: p } = super( dict, dataview, `BaseTagListTable` ); 16245 this.baseTagCount = p.uint16; 16246 this.baselineTags = [ ...new Array( this.baseTagCount ) ].map( 16247 ( _ ) => p.tag 16248 ); 16249 } 16250 } 16251 class BaseScriptListTable extends SimpleTable { 16252 constructor( dict, dataview ) { 16253 const { p: p } = super( dict, dataview, `BaseScriptListTable` ); 16254 this.baseScriptCount = p.uint16; 16255 const recordStart = p.currentPosition; 16256 lazy$1( this, `baseScriptRecords`, () => { 16257 p.currentPosition = recordStart; 16258 return [ ...new Array( this.baseScriptCount ) ].map( 16259 ( _ ) => new BaseScriptRecord( this.start, p ) 16260 ); 16261 } ); 16262 } 16263 } 16264 class BaseScriptRecord { 16265 constructor( baseScriptListTableStart, p ) { 16266 this.baseScriptTag = p.tag; 16267 this.baseScriptOffset = p.Offset16; 16268 lazy$1( this, `baseScriptTable`, () => { 16269 p.currentPosition = 16270 baseScriptListTableStart + this.baseScriptOffset; 16271 return new BaseScriptTable( p ); 16272 } ); 16273 } 16274 } 16275 class BaseScriptTable { 16276 constructor( p ) { 16277 this.start = p.currentPosition; 16278 this.baseValuesOffset = p.Offset16; 16279 this.defaultMinMaxOffset = p.Offset16; 16280 this.baseLangSysCount = p.uint16; 16281 this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map( 16282 ( _ ) => new BaseLangSysRecord( this.start, p ) 16283 ); 16284 lazy$1( this, `baseValues`, () => { 16285 p.currentPosition = this.start + this.baseValuesOffset; 16286 return new BaseValuesTable( p ); 16287 } ); 16288 lazy$1( this, `defaultMinMax`, () => { 16289 p.currentPosition = this.start + this.defaultMinMaxOffset; 16290 return new MinMaxTable( p ); 16291 } ); 16292 } 16293 } 16294 class BaseLangSysRecord { 16295 constructor( baseScriptTableStart, p ) { 16296 this.baseLangSysTag = p.tag; 16297 this.minMaxOffset = p.Offset16; 16298 lazy$1( this, `minMax`, () => { 16299 p.currentPosition = baseScriptTableStart + this.minMaxOffset; 16300 return new MinMaxTable( p ); 16301 } ); 16302 } 16303 } 16304 class BaseValuesTable { 16305 constructor( p ) { 16306 this.parser = p; 16307 this.start = p.currentPosition; 16308 this.defaultBaselineIndex = p.uint16; 16309 this.baseCoordCount = p.uint16; 16310 this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map( 16311 ( _ ) => p.Offset16 16312 ); 16313 } 16314 getTable( id ) { 16315 this.parser.currentPosition = this.start + this.baseCoords[ id ]; 16316 return new BaseCoordTable( this.parser ); 16317 } 16318 } 16319 class MinMaxTable { 16320 constructor( p ) { 16321 this.minCoord = p.Offset16; 16322 this.maxCoord = p.Offset16; 16323 this.featMinMaxCount = p.uint16; 16324 const recordStart = p.currentPosition; 16325 lazy$1( this, `featMinMaxRecords`, () => { 16326 p.currentPosition = recordStart; 16327 return [ ...new Array( this.featMinMaxCount ) ].map( 16328 ( _ ) => new FeatMinMaxRecord( p ) 16329 ); 16330 } ); 16331 } 16332 } 16333 class FeatMinMaxRecord { 16334 constructor( p ) { 16335 this.featureTableTag = p.tag; 16336 this.minCoord = p.Offset16; 16337 this.maxCoord = p.Offset16; 16338 } 16339 } 16340 class BaseCoordTable { 16341 constructor( p ) { 16342 this.baseCoordFormat = p.uint16; 16343 this.coordinate = p.int16; 16344 if ( this.baseCoordFormat === 2 ) { 16345 this.referenceGlyph = p.uint16; 16346 this.baseCoordPoint = p.uint16; 16347 } 16348 if ( this.baseCoordFormat === 3 ) { 16349 this.deviceTable = p.Offset16; 16350 } 16351 } 16352 } 16353 var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } ); 16354 class ClassDefinition { 16355 constructor( p ) { 16356 this.classFormat = p.uint16; 16357 if ( this.classFormat === 1 ) { 16358 this.startGlyphID = p.uint16; 16359 this.glyphCount = p.uint16; 16360 this.classValueArray = [ ...new Array( this.glyphCount ) ].map( 16361 ( _ ) => p.uint16 16362 ); 16363 } 16364 if ( this.classFormat === 2 ) { 16365 this.classRangeCount = p.uint16; 16366 this.classRangeRecords = [ 16367 ...new Array( this.classRangeCount ), 16368 ].map( ( _ ) => new ClassRangeRecord( p ) ); 16369 } 16370 } 16371 } 16372 class ClassRangeRecord { 16373 constructor( p ) { 16374 this.startGlyphID = p.uint16; 16375 this.endGlyphID = p.uint16; 16376 this.class = p.uint16; 16377 } 16378 } 16379 class CoverageTable extends ParsedData { 16380 constructor( p ) { 16381 super( p ); 16382 this.coverageFormat = p.uint16; 16383 if ( this.coverageFormat === 1 ) { 16384 this.glyphCount = p.uint16; 16385 this.glyphArray = [ ...new Array( this.glyphCount ) ].map( 16386 ( _ ) => p.uint16 16387 ); 16388 } 16389 if ( this.coverageFormat === 2 ) { 16390 this.rangeCount = p.uint16; 16391 this.rangeRecords = [ ...new Array( this.rangeCount ) ].map( 16392 ( _ ) => new CoverageRangeRecord( p ) 16393 ); 16394 } 16395 } 16396 } 16397 class CoverageRangeRecord { 16398 constructor( p ) { 16399 this.startGlyphID = p.uint16; 16400 this.endGlyphID = p.uint16; 16401 this.startCoverageIndex = p.uint16; 16402 } 16403 } 16404 class ItemVariationStoreTable { 16405 constructor( table, p ) { 16406 this.table = table; 16407 this.parser = p; 16408 this.start = p.currentPosition; 16409 this.format = p.uint16; 16410 this.variationRegionListOffset = p.Offset32; 16411 this.itemVariationDataCount = p.uint16; 16412 this.itemVariationDataOffsets = [ 16413 ...new Array( this.itemVariationDataCount ), 16414 ].map( ( _ ) => p.Offset32 ); 16415 } 16416 } 16417 class GDEF extends SimpleTable { 16418 constructor( dict, dataview ) { 16419 const { p: p } = super( dict, dataview ); 16420 this.majorVersion = p.uint16; 16421 this.minorVersion = p.uint16; 16422 this.glyphClassDefOffset = p.Offset16; 16423 lazy$1( this, `glyphClassDefs`, () => { 16424 if ( this.glyphClassDefOffset === 0 ) return undefined; 16425 p.currentPosition = this.tableStart + this.glyphClassDefOffset; 16426 return new ClassDefinition( p ); 16427 } ); 16428 this.attachListOffset = p.Offset16; 16429 lazy$1( this, `attachList`, () => { 16430 if ( this.attachListOffset === 0 ) return undefined; 16431 p.currentPosition = this.tableStart + this.attachListOffset; 16432 return new AttachList( p ); 16433 } ); 16434 this.ligCaretListOffset = p.Offset16; 16435 lazy$1( this, `ligCaretList`, () => { 16436 if ( this.ligCaretListOffset === 0 ) return undefined; 16437 p.currentPosition = this.tableStart + this.ligCaretListOffset; 16438 return new LigCaretList( p ); 16439 } ); 16440 this.markAttachClassDefOffset = p.Offset16; 16441 lazy$1( this, `markAttachClassDef`, () => { 16442 if ( this.markAttachClassDefOffset === 0 ) return undefined; 16443 p.currentPosition = this.tableStart + this.markAttachClassDefOffset; 16444 return new ClassDefinition( p ); 16445 } ); 16446 if ( this.minorVersion >= 2 ) { 16447 this.markGlyphSetsDefOffset = p.Offset16; 16448 lazy$1( this, `markGlyphSetsDef`, () => { 16449 if ( this.markGlyphSetsDefOffset === 0 ) return undefined; 16450 p.currentPosition = 16451 this.tableStart + this.markGlyphSetsDefOffset; 16452 return new MarkGlyphSetsTable( p ); 16453 } ); 16454 } 16455 if ( this.minorVersion === 3 ) { 16456 this.itemVarStoreOffset = p.Offset32; 16457 lazy$1( this, `itemVarStore`, () => { 16458 if ( this.itemVarStoreOffset === 0 ) return undefined; 16459 p.currentPosition = this.tableStart + this.itemVarStoreOffset; 16460 return new ItemVariationStoreTable( p ); 16461 } ); 16462 } 16463 } 16464 } 16465 class AttachList extends ParsedData { 16466 constructor( p ) { 16467 super( p ); 16468 this.coverageOffset = p.Offset16; 16469 this.glyphCount = p.uint16; 16470 this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map( 16471 ( _ ) => p.Offset16 16472 ); 16473 } 16474 getPoint( pointID ) { 16475 this.parser.currentPosition = 16476 this.start + this.attachPointOffsets[ pointID ]; 16477 return new AttachPoint( this.parser ); 16478 } 16479 } 16480 class AttachPoint { 16481 constructor( p ) { 16482 this.pointCount = p.uint16; 16483 this.pointIndices = [ ...new Array( this.pointCount ) ].map( 16484 ( _ ) => p.uint16 16485 ); 16486 } 16487 } 16488 class LigCaretList extends ParsedData { 16489 constructor( p ) { 16490 super( p ); 16491 this.coverageOffset = p.Offset16; 16492 lazy$1( this, `coverage`, () => { 16493 p.currentPosition = this.start + this.coverageOffset; 16494 return new CoverageTable( p ); 16495 } ); 16496 this.ligGlyphCount = p.uint16; 16497 this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map( 16498 ( _ ) => p.Offset16 16499 ); 16500 } 16501 getLigGlyph( ligGlyphID ) { 16502 this.parser.currentPosition = 16503 this.start + this.ligGlyphOffsets[ ligGlyphID ]; 16504 return new LigGlyph( this.parser ); 16505 } 16506 } 16507 class LigGlyph extends ParsedData { 16508 constructor( p ) { 16509 super( p ); 16510 this.caretCount = p.uint16; 16511 this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map( 16512 ( _ ) => p.Offset16 16513 ); 16514 } 16515 getCaretValue( caretID ) { 16516 this.parser.currentPosition = 16517 this.start + this.caretValueOffsets[ caretID ]; 16518 return new CaretValue( this.parser ); 16519 } 16520 } 16521 class CaretValue { 16522 constructor( p ) { 16523 this.caretValueFormat = p.uint16; 16524 if ( this.caretValueFormat === 1 ) { 16525 this.coordinate = p.int16; 16526 } 16527 if ( this.caretValueFormat === 2 ) { 16528 this.caretValuePointIndex = p.uint16; 16529 } 16530 if ( this.caretValueFormat === 3 ) { 16531 this.coordinate = p.int16; 16532 this.deviceOffset = p.Offset16; 16533 } 16534 } 16535 } 16536 class MarkGlyphSetsTable extends ParsedData { 16537 constructor( p ) { 16538 super( p ); 16539 this.markGlyphSetTableFormat = p.uint16; 16540 this.markGlyphSetCount = p.uint16; 16541 this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map( 16542 ( _ ) => p.Offset32 16543 ); 16544 } 16545 getMarkGlyphSet( markGlyphSetID ) { 16546 this.parser.currentPosition = 16547 this.start + this.coverageOffsets[ markGlyphSetID ]; 16548 return new CoverageTable( this.parser ); 16549 } 16550 } 16551 var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } ); 16552 class ScriptList extends ParsedData { 16553 static EMPTY = { scriptCount: 0, scriptRecords: [] }; 16554 constructor( p ) { 16555 super( p ); 16556 this.scriptCount = p.uint16; 16557 this.scriptRecords = [ ...new Array( this.scriptCount ) ].map( 16558 ( _ ) => new ScriptRecord( p ) 16559 ); 16560 } 16561 } 16562 class ScriptRecord { 16563 constructor( p ) { 16564 this.scriptTag = p.tag; 16565 this.scriptOffset = p.Offset16; 16566 } 16567 } 16568 class ScriptTable extends ParsedData { 16569 constructor( p ) { 16570 super( p ); 16571 this.defaultLangSys = p.Offset16; 16572 this.langSysCount = p.uint16; 16573 this.langSysRecords = [ ...new Array( this.langSysCount ) ].map( 16574 ( _ ) => new LangSysRecord( p ) 16575 ); 16576 } 16577 } 16578 class LangSysRecord { 16579 constructor( p ) { 16580 this.langSysTag = p.tag; 16581 this.langSysOffset = p.Offset16; 16582 } 16583 } 16584 class LangSysTable { 16585 constructor( p ) { 16586 this.lookupOrder = p.Offset16; 16587 this.requiredFeatureIndex = p.uint16; 16588 this.featureIndexCount = p.uint16; 16589 this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map( 16590 ( _ ) => p.uint16 16591 ); 16592 } 16593 } 16594 class FeatureList extends ParsedData { 16595 static EMPTY = { featureCount: 0, featureRecords: [] }; 16596 constructor( p ) { 16597 super( p ); 16598 this.featureCount = p.uint16; 16599 this.featureRecords = [ ...new Array( this.featureCount ) ].map( 16600 ( _ ) => new FeatureRecord( p ) 16601 ); 16602 } 16603 } 16604 class FeatureRecord { 16605 constructor( p ) { 16606 this.featureTag = p.tag; 16607 this.featureOffset = p.Offset16; 16608 } 16609 } 16610 class FeatureTable extends ParsedData { 16611 constructor( p ) { 16612 super( p ); 16613 this.featureParams = p.Offset16; 16614 this.lookupIndexCount = p.uint16; 16615 this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map( 16616 ( _ ) => p.uint16 16617 ); 16618 } 16619 getFeatureParams() { 16620 if ( this.featureParams > 0 ) { 16621 const p = this.parser; 16622 p.currentPosition = this.start + this.featureParams; 16623 const tag = this.featureTag; 16624 if ( tag === `size` ) return new Size( p ); 16625 if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p ); 16626 if ( tag.startsWith( `ss` ) ) return new StylisticSet( p ); 16627 } 16628 } 16629 } 16630 class CharacterVariant { 16631 constructor( p ) { 16632 this.format = p.uint16; 16633 this.featUiLabelNameId = p.uint16; 16634 this.featUiTooltipTextNameId = p.uint16; 16635 this.sampleTextNameId = p.uint16; 16636 this.numNamedParameters = p.uint16; 16637 this.firstParamUiLabelNameId = p.uint16; 16638 this.charCount = p.uint16; 16639 this.character = [ ...new Array( this.charCount ) ].map( 16640 ( _ ) => p.uint24 16641 ); 16642 } 16643 } 16644 class Size { 16645 constructor( p ) { 16646 this.designSize = p.uint16; 16647 this.subfamilyIdentifier = p.uint16; 16648 this.subfamilyNameID = p.uint16; 16649 this.smallEnd = p.uint16; 16650 this.largeEnd = p.uint16; 16651 } 16652 } 16653 class StylisticSet { 16654 constructor( p ) { 16655 this.version = p.uint16; 16656 this.UINameID = p.uint16; 16657 } 16658 } 16659 function undoCoverageOffsetParsing( instance ) { 16660 instance.parser.currentPosition -= 2; 16661 delete instance.coverageOffset; 16662 delete instance.getCoverageTable; 16663 } 16664 class LookupType$1 extends ParsedData { 16665 constructor( p ) { 16666 super( p ); 16667 this.substFormat = p.uint16; 16668 this.coverageOffset = p.Offset16; 16669 } 16670 getCoverageTable() { 16671 let p = this.parser; 16672 p.currentPosition = this.start + this.coverageOffset; 16673 return new CoverageTable( p ); 16674 } 16675 } 16676 class SubstLookupRecord { 16677 constructor( p ) { 16678 this.glyphSequenceIndex = p.uint16; 16679 this.lookupListIndex = p.uint16; 16680 } 16681 } 16682 class LookupType1$1 extends LookupType$1 { 16683 constructor( p ) { 16684 super( p ); 16685 this.deltaGlyphID = p.int16; 16686 } 16687 } 16688 class LookupType2$1 extends LookupType$1 { 16689 constructor( p ) { 16690 super( p ); 16691 this.sequenceCount = p.uint16; 16692 this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map( 16693 ( _ ) => p.Offset16 16694 ); 16695 } 16696 getSequence( index ) { 16697 let p = this.parser; 16698 p.currentPosition = this.start + this.sequenceOffsets[ index ]; 16699 return new SequenceTable( p ); 16700 } 16701 } 16702 class SequenceTable { 16703 constructor( p ) { 16704 this.glyphCount = p.uint16; 16705 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 16706 ( _ ) => p.uint16 16707 ); 16708 } 16709 } 16710 class LookupType3$1 extends LookupType$1 { 16711 constructor( p ) { 16712 super( p ); 16713 this.alternateSetCount = p.uint16; 16714 this.alternateSetOffsets = [ 16715 ...new Array( this.alternateSetCount ), 16716 ].map( ( _ ) => p.Offset16 ); 16717 } 16718 getAlternateSet( index ) { 16719 let p = this.parser; 16720 p.currentPosition = this.start + this.alternateSetOffsets[ index ]; 16721 return new AlternateSetTable( p ); 16722 } 16723 } 16724 class AlternateSetTable { 16725 constructor( p ) { 16726 this.glyphCount = p.uint16; 16727 this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 16728 ( _ ) => p.uint16 16729 ); 16730 } 16731 } 16732 class LookupType4$1 extends LookupType$1 { 16733 constructor( p ) { 16734 super( p ); 16735 this.ligatureSetCount = p.uint16; 16736 this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map( 16737 ( _ ) => p.Offset16 16738 ); 16739 } 16740 getLigatureSet( index ) { 16741 let p = this.parser; 16742 p.currentPosition = this.start + this.ligatureSetOffsets[ index ]; 16743 return new LigatureSetTable( p ); 16744 } 16745 } 16746 class LigatureSetTable extends ParsedData { 16747 constructor( p ) { 16748 super( p ); 16749 this.ligatureCount = p.uint16; 16750 this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map( 16751 ( _ ) => p.Offset16 16752 ); 16753 } 16754 getLigature( index ) { 16755 let p = this.parser; 16756 p.currentPosition = this.start + this.ligatureOffsets[ index ]; 16757 return new LigatureTable( p ); 16758 } 16759 } 16760 class LigatureTable { 16761 constructor( p ) { 16762 this.ligatureGlyph = p.uint16; 16763 this.componentCount = p.uint16; 16764 this.componentGlyphIDs = [ 16765 ...new Array( this.componentCount - 1 ), 16766 ].map( ( _ ) => p.uint16 ); 16767 } 16768 } 16769 class LookupType5$1 extends LookupType$1 { 16770 constructor( p ) { 16771 super( p ); 16772 if ( this.substFormat === 1 ) { 16773 this.subRuleSetCount = p.uint16; 16774 this.subRuleSetOffsets = [ 16775 ...new Array( this.subRuleSetCount ), 16776 ].map( ( _ ) => p.Offset16 ); 16777 } 16778 if ( this.substFormat === 2 ) { 16779 this.classDefOffset = p.Offset16; 16780 this.subClassSetCount = p.uint16; 16781 this.subClassSetOffsets = [ 16782 ...new Array( this.subClassSetCount ), 16783 ].map( ( _ ) => p.Offset16 ); 16784 } 16785 if ( this.substFormat === 3 ) { 16786 undoCoverageOffsetParsing( this ); 16787 this.glyphCount = p.uint16; 16788 this.substitutionCount = p.uint16; 16789 this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map( 16790 ( _ ) => p.Offset16 16791 ); 16792 this.substLookupRecords = [ 16793 ...new Array( this.substitutionCount ), 16794 ].map( ( _ ) => new SubstLookupRecord( p ) ); 16795 } 16796 } 16797 getSubRuleSet( index ) { 16798 if ( this.substFormat !== 1 ) 16799 throw new Error( 16800 `lookup type 5.${ this.substFormat } has no subrule sets.` 16801 ); 16802 let p = this.parser; 16803 p.currentPosition = this.start + this.subRuleSetOffsets[ index ]; 16804 return new SubRuleSetTable( p ); 16805 } 16806 getSubClassSet( index ) { 16807 if ( this.substFormat !== 2 ) 16808 throw new Error( 16809 `lookup type 5.${ this.substFormat } has no subclass sets.` 16810 ); 16811 let p = this.parser; 16812 p.currentPosition = this.start + this.subClassSetOffsets[ index ]; 16813 return new SubClassSetTable( p ); 16814 } 16815 getCoverageTable( index ) { 16816 if ( this.substFormat !== 3 && ! index ) 16817 return super.getCoverageTable(); 16818 if ( ! index ) 16819 throw new Error( 16820 `lookup type 5.${ this.substFormat } requires an coverage table index.` 16821 ); 16822 let p = this.parser; 16823 p.currentPosition = this.start + this.coverageOffsets[ index ]; 16824 return new CoverageTable( p ); 16825 } 16826 } 16827 class SubRuleSetTable extends ParsedData { 16828 constructor( p ) { 16829 super( p ); 16830 this.subRuleCount = p.uint16; 16831 this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map( 16832 ( _ ) => p.Offset16 16833 ); 16834 } 16835 getSubRule( index ) { 16836 let p = this.parser; 16837 p.currentPosition = this.start + this.subRuleOffsets[ index ]; 16838 return new SubRuleTable( p ); 16839 } 16840 } 16841 class SubRuleTable { 16842 constructor( p ) { 16843 this.glyphCount = p.uint16; 16844 this.substitutionCount = p.uint16; 16845 this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map( 16846 ( _ ) => p.uint16 16847 ); 16848 this.substLookupRecords = [ 16849 ...new Array( this.substitutionCount ), 16850 ].map( ( _ ) => new SubstLookupRecord( p ) ); 16851 } 16852 } 16853 class SubClassSetTable extends ParsedData { 16854 constructor( p ) { 16855 super( p ); 16856 this.subClassRuleCount = p.uint16; 16857 this.subClassRuleOffsets = [ 16858 ...new Array( this.subClassRuleCount ), 16859 ].map( ( _ ) => p.Offset16 ); 16860 } 16861 getSubClass( index ) { 16862 let p = this.parser; 16863 p.currentPosition = this.start + this.subClassRuleOffsets[ index ]; 16864 return new SubClassRuleTable( p ); 16865 } 16866 } 16867 class SubClassRuleTable extends SubRuleTable { 16868 constructor( p ) { 16869 super( p ); 16870 } 16871 } 16872 class LookupType6$1 extends LookupType$1 { 16873 constructor( p ) { 16874 super( p ); 16875 if ( this.substFormat === 1 ) { 16876 this.chainSubRuleSetCount = p.uint16; 16877 this.chainSubRuleSetOffsets = [ 16878 ...new Array( this.chainSubRuleSetCount ), 16879 ].map( ( _ ) => p.Offset16 ); 16880 } 16881 if ( this.substFormat === 2 ) { 16882 this.backtrackClassDefOffset = p.Offset16; 16883 this.inputClassDefOffset = p.Offset16; 16884 this.lookaheadClassDefOffset = p.Offset16; 16885 this.chainSubClassSetCount = p.uint16; 16886 this.chainSubClassSetOffsets = [ 16887 ...new Array( this.chainSubClassSetCount ), 16888 ].map( ( _ ) => p.Offset16 ); 16889 } 16890 if ( this.substFormat === 3 ) { 16891 undoCoverageOffsetParsing( this ); 16892 this.backtrackGlyphCount = p.uint16; 16893 this.backtrackCoverageOffsets = [ 16894 ...new Array( this.backtrackGlyphCount ), 16895 ].map( ( _ ) => p.Offset16 ); 16896 this.inputGlyphCount = p.uint16; 16897 this.inputCoverageOffsets = [ 16898 ...new Array( this.inputGlyphCount ), 16899 ].map( ( _ ) => p.Offset16 ); 16900 this.lookaheadGlyphCount = p.uint16; 16901 this.lookaheadCoverageOffsets = [ 16902 ...new Array( this.lookaheadGlyphCount ), 16903 ].map( ( _ ) => p.Offset16 ); 16904 this.seqLookupCount = p.uint16; 16905 this.seqLookupRecords = [ 16906 ...new Array( this.substitutionCount ), 16907 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 16908 } 16909 } 16910 getChainSubRuleSet( index ) { 16911 if ( this.substFormat !== 1 ) 16912 throw new Error( 16913 `lookup type 6.${ this.substFormat } has no chainsubrule sets.` 16914 ); 16915 let p = this.parser; 16916 p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ]; 16917 return new ChainSubRuleSetTable( p ); 16918 } 16919 getChainSubClassSet( index ) { 16920 if ( this.substFormat !== 2 ) 16921 throw new Error( 16922 `lookup type 6.${ this.substFormat } has no chainsubclass sets.` 16923 ); 16924 let p = this.parser; 16925 p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ]; 16926 return new ChainSubClassSetTable( p ); 16927 } 16928 getCoverageFromOffset( offset ) { 16929 if ( this.substFormat !== 3 ) 16930 throw new Error( 16931 `lookup type 6.${ this.substFormat } does not use contextual coverage offsets.` 16932 ); 16933 let p = this.parser; 16934 p.currentPosition = this.start + offset; 16935 return new CoverageTable( p ); 16936 } 16937 } 16938 class ChainSubRuleSetTable extends ParsedData { 16939 constructor( p ) { 16940 super( p ); 16941 this.chainSubRuleCount = p.uint16; 16942 this.chainSubRuleOffsets = [ 16943 ...new Array( this.chainSubRuleCount ), 16944 ].map( ( _ ) => p.Offset16 ); 16945 } 16946 getSubRule( index ) { 16947 let p = this.parser; 16948 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 16949 return new ChainSubRuleTable( p ); 16950 } 16951 } 16952 class ChainSubRuleTable { 16953 constructor( p ) { 16954 this.backtrackGlyphCount = p.uint16; 16955 this.backtrackSequence = [ 16956 ...new Array( this.backtrackGlyphCount ), 16957 ].map( ( _ ) => p.uint16 ); 16958 this.inputGlyphCount = p.uint16; 16959 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 16960 ( _ ) => p.uint16 16961 ); 16962 this.lookaheadGlyphCount = p.uint16; 16963 this.lookAheadSequence = [ 16964 ...new Array( this.lookAheadGlyphCount ), 16965 ].map( ( _ ) => p.uint16 ); 16966 this.substitutionCount = p.uint16; 16967 this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map( 16968 ( _ ) => new SubstLookupRecord( p ) 16969 ); 16970 } 16971 } 16972 class ChainSubClassSetTable extends ParsedData { 16973 constructor( p ) { 16974 super( p ); 16975 this.chainSubClassRuleCount = p.uint16; 16976 this.chainSubClassRuleOffsets = [ 16977 ...new Array( this.chainSubClassRuleCount ), 16978 ].map( ( _ ) => p.Offset16 ); 16979 } 16980 getSubClass( index ) { 16981 let p = this.parser; 16982 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 16983 return new ChainSubClassRuleTable( p ); 16984 } 16985 } 16986 class ChainSubClassRuleTable { 16987 constructor( p ) { 16988 this.backtrackGlyphCount = p.uint16; 16989 this.backtrackSequence = [ 16990 ...new Array( this.backtrackGlyphCount ), 16991 ].map( ( _ ) => p.uint16 ); 16992 this.inputGlyphCount = p.uint16; 16993 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 16994 ( _ ) => p.uint16 16995 ); 16996 this.lookaheadGlyphCount = p.uint16; 16997 this.lookAheadSequence = [ 16998 ...new Array( this.lookAheadGlyphCount ), 16999 ].map( ( _ ) => p.uint16 ); 17000 this.substitutionCount = p.uint16; 17001 this.substLookupRecords = [ 17002 ...new Array( this.substitutionCount ), 17003 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 17004 } 17005 } 17006 class SequenceLookupRecord extends ParsedData { 17007 constructor( p ) { 17008 super( p ); 17009 this.sequenceIndex = p.uint16; 17010 this.lookupListIndex = p.uint16; 17011 } 17012 } 17013 class LookupType7$1 extends ParsedData { 17014 constructor( p ) { 17015 super( p ); 17016 this.substFormat = p.uint16; 17017 this.extensionLookupType = p.uint16; 17018 this.extensionOffset = p.Offset32; 17019 } 17020 } 17021 class LookupType8$1 extends LookupType$1 { 17022 constructor( p ) { 17023 super( p ); 17024 this.backtrackGlyphCount = p.uint16; 17025 this.backtrackCoverageOffsets = [ 17026 ...new Array( this.backtrackGlyphCount ), 17027 ].map( ( _ ) => p.Offset16 ); 17028 this.lookaheadGlyphCount = p.uint16; 17029 this.lookaheadCoverageOffsets = [ 17030 new Array( this.lookaheadGlyphCount ), 17031 ].map( ( _ ) => p.Offset16 ); 17032 this.glyphCount = p.uint16; 17033 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 17034 ( _ ) => p.uint16 17035 ); 17036 } 17037 } 17038 var GSUBtables = { 17039 buildSubtable: function ( type, p ) { 17040 const subtable = new [ 17041 undefined, 17042 LookupType1$1, 17043 LookupType2$1, 17044 LookupType3$1, 17045 LookupType4$1, 17046 LookupType5$1, 17047 LookupType6$1, 17048 LookupType7$1, 17049 LookupType8$1, 17050 ][ type ]( p ); 17051 subtable.type = type; 17052 return subtable; 17053 }, 17054 }; 17055 class LookupType extends ParsedData { 17056 constructor( p ) { 17057 super( p ); 17058 } 17059 } 17060 class LookupType1 extends LookupType { 17061 constructor( p ) { 17062 super( p ); 17063 console.log( `lookup type 1` ); 17064 } 17065 } 17066 class LookupType2 extends LookupType { 17067 constructor( p ) { 17068 super( p ); 17069 console.log( `lookup type 2` ); 17070 } 17071 } 17072 class LookupType3 extends LookupType { 17073 constructor( p ) { 17074 super( p ); 17075 console.log( `lookup type 3` ); 17076 } 17077 } 17078 class LookupType4 extends LookupType { 17079 constructor( p ) { 17080 super( p ); 17081 console.log( `lookup type 4` ); 17082 } 17083 } 17084 class LookupType5 extends LookupType { 17085 constructor( p ) { 17086 super( p ); 17087 console.log( `lookup type 5` ); 17088 } 17089 } 17090 class LookupType6 extends LookupType { 17091 constructor( p ) { 17092 super( p ); 17093 console.log( `lookup type 6` ); 17094 } 17095 } 17096 class LookupType7 extends LookupType { 17097 constructor( p ) { 17098 super( p ); 17099 console.log( `lookup type 7` ); 17100 } 17101 } 17102 class LookupType8 extends LookupType { 17103 constructor( p ) { 17104 super( p ); 17105 console.log( `lookup type 8` ); 17106 } 17107 } 17108 class LookupType9 extends LookupType { 17109 constructor( p ) { 17110 super( p ); 17111 console.log( `lookup type 9` ); 17112 } 17113 } 17114 var GPOStables = { 17115 buildSubtable: function ( type, p ) { 17116 const subtable = new [ 17117 undefined, 17118 LookupType1, 17119 LookupType2, 17120 LookupType3, 17121 LookupType4, 17122 LookupType5, 17123 LookupType6, 17124 LookupType7, 17125 LookupType8, 17126 LookupType9, 17127 ][ type ]( p ); 17128 subtable.type = type; 17129 return subtable; 17130 }, 17131 }; 17132 class LookupList extends ParsedData { 17133 static EMPTY = { lookupCount: 0, lookups: [] }; 17134 constructor( p ) { 17135 super( p ); 17136 this.lookupCount = p.uint16; 17137 this.lookups = [ ...new Array( this.lookupCount ) ].map( 17138 ( _ ) => p.Offset16 17139 ); 17140 } 17141 } 17142 class LookupTable extends ParsedData { 17143 constructor( p, type ) { 17144 super( p ); 17145 this.ctType = type; 17146 this.lookupType = p.uint16; 17147 this.lookupFlag = p.uint16; 17148 this.subTableCount = p.uint16; 17149 this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map( 17150 ( _ ) => p.Offset16 17151 ); 17152 this.markFilteringSet = p.uint16; 17153 } 17154 get rightToLeft() { 17155 return this.lookupFlag & ( 1 === 1 ); 17156 } 17157 get ignoreBaseGlyphs() { 17158 return this.lookupFlag & ( 2 === 2 ); 17159 } 17160 get ignoreLigatures() { 17161 return this.lookupFlag & ( 4 === 4 ); 17162 } 17163 get ignoreMarks() { 17164 return this.lookupFlag & ( 8 === 8 ); 17165 } 17166 get useMarkFilteringSet() { 17167 return this.lookupFlag & ( 16 === 16 ); 17168 } 17169 get markAttachmentType() { 17170 return this.lookupFlag & ( 65280 === 65280 ); 17171 } 17172 getSubTable( index ) { 17173 const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; 17174 this.parser.currentPosition = 17175 this.start + this.subtableOffsets[ index ]; 17176 return builder.buildSubtable( this.lookupType, this.parser ); 17177 } 17178 } 17179 class CommonLayoutTable extends SimpleTable { 17180 constructor( dict, dataview, name ) { 17181 const { p: p, tableStart: tableStart } = super( dict, dataview, name ); 17182 this.majorVersion = p.uint16; 17183 this.minorVersion = p.uint16; 17184 this.scriptListOffset = p.Offset16; 17185 this.featureListOffset = p.Offset16; 17186 this.lookupListOffset = p.Offset16; 17187 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 17188 this.featureVariationsOffset = p.Offset32; 17189 } 17190 const no_content = ! ( 17191 this.scriptListOffset || 17192 this.featureListOffset || 17193 this.lookupListOffset 17194 ); 17195 lazy$1( this, `scriptList`, () => { 17196 if ( no_content ) return ScriptList.EMPTY; 17197 p.currentPosition = tableStart + this.scriptListOffset; 17198 return new ScriptList( p ); 17199 } ); 17200 lazy$1( this, `featureList`, () => { 17201 if ( no_content ) return FeatureList.EMPTY; 17202 p.currentPosition = tableStart + this.featureListOffset; 17203 return new FeatureList( p ); 17204 } ); 17205 lazy$1( this, `lookupList`, () => { 17206 if ( no_content ) return LookupList.EMPTY; 17207 p.currentPosition = tableStart + this.lookupListOffset; 17208 return new LookupList( p ); 17209 } ); 17210 if ( this.featureVariationsOffset ) { 17211 lazy$1( this, `featureVariations`, () => { 17212 if ( no_content ) return FeatureVariations.EMPTY; 17213 p.currentPosition = tableStart + this.featureVariationsOffset; 17214 return new FeatureVariations( p ); 17215 } ); 17216 } 17217 } 17218 getSupportedScripts() { 17219 return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag ); 17220 } 17221 getScriptTable( scriptTag ) { 17222 let record = this.scriptList.scriptRecords.find( 17223 ( r ) => r.scriptTag === scriptTag 17224 ); 17225 this.parser.currentPosition = 17226 this.scriptList.start + record.scriptOffset; 17227 let table = new ScriptTable( this.parser ); 17228 table.scriptTag = scriptTag; 17229 return table; 17230 } 17231 ensureScriptTable( arg ) { 17232 if ( typeof arg === 'string' ) { 17233 return this.getScriptTable( arg ); 17234 } 17235 return arg; 17236 } 17237 getSupportedLangSys( scriptTable ) { 17238 scriptTable = this.ensureScriptTable( scriptTable ); 17239 const hasDefault = scriptTable.defaultLangSys !== 0; 17240 const supported = scriptTable.langSysRecords.map( 17241 ( l ) => l.langSysTag 17242 ); 17243 if ( hasDefault ) supported.unshift( `dflt` ); 17244 return supported; 17245 } 17246 getDefaultLangSysTable( scriptTable ) { 17247 scriptTable = this.ensureScriptTable( scriptTable ); 17248 let offset = scriptTable.defaultLangSys; 17249 if ( offset !== 0 ) { 17250 this.parser.currentPosition = scriptTable.start + offset; 17251 let table = new LangSysTable( this.parser ); 17252 table.langSysTag = ``; 17253 table.defaultForScript = scriptTable.scriptTag; 17254 return table; 17255 } 17256 } 17257 getLangSysTable( scriptTable, langSysTag = `dflt` ) { 17258 if ( langSysTag === `dflt` ) 17259 return this.getDefaultLangSysTable( scriptTable ); 17260 scriptTable = this.ensureScriptTable( scriptTable ); 17261 let record = scriptTable.langSysRecords.find( 17262 ( l ) => l.langSysTag === langSysTag 17263 ); 17264 this.parser.currentPosition = scriptTable.start + record.langSysOffset; 17265 let table = new LangSysTable( this.parser ); 17266 table.langSysTag = langSysTag; 17267 return table; 17268 } 17269 getFeatures( langSysTable ) { 17270 return langSysTable.featureIndices.map( ( index ) => 17271 this.getFeature( index ) 17272 ); 17273 } 17274 getFeature( indexOrTag ) { 17275 let record; 17276 if ( parseInt( indexOrTag ) == indexOrTag ) { 17277 record = this.featureList.featureRecords[ indexOrTag ]; 17278 } else { 17279 record = this.featureList.featureRecords.find( 17280 ( f ) => f.featureTag === indexOrTag 17281 ); 17282 } 17283 if ( ! record ) return; 17284 this.parser.currentPosition = 17285 this.featureList.start + record.featureOffset; 17286 let table = new FeatureTable( this.parser ); 17287 table.featureTag = record.featureTag; 17288 return table; 17289 } 17290 getLookups( featureTable ) { 17291 return featureTable.lookupListIndices.map( ( index ) => 17292 this.getLookup( index ) 17293 ); 17294 } 17295 getLookup( lookupIndex, type ) { 17296 let lookupOffset = this.lookupList.lookups[ lookupIndex ]; 17297 this.parser.currentPosition = this.lookupList.start + lookupOffset; 17298 return new LookupTable( this.parser, type ); 17299 } 17300 } 17301 class GSUB extends CommonLayoutTable { 17302 constructor( dict, dataview ) { 17303 super( dict, dataview, `GSUB` ); 17304 } 17305 getLookup( lookupIndex ) { 17306 return super.getLookup( lookupIndex, `GSUB` ); 17307 } 17308 } 17309 var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } ); 17310 class GPOS extends CommonLayoutTable { 17311 constructor( dict, dataview ) { 17312 super( dict, dataview, `GPOS` ); 17313 } 17314 getLookup( lookupIndex ) { 17315 return super.getLookup( lookupIndex, `GPOS` ); 17316 } 17317 } 17318 var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } ); 17319 class SVG extends SimpleTable { 17320 constructor( dict, dataview ) { 17321 const { p: p } = super( dict, dataview ); 17322 this.version = p.uint16; 17323 this.offsetToSVGDocumentList = p.Offset32; 17324 p.currentPosition = this.tableStart + this.offsetToSVGDocumentList; 17325 this.documentList = new SVGDocumentList( p ); 17326 } 17327 } 17328 class SVGDocumentList extends ParsedData { 17329 constructor( p ) { 17330 super( p ); 17331 this.numEntries = p.uint16; 17332 this.documentRecords = [ ...new Array( this.numEntries ) ].map( 17333 ( _ ) => new SVGDocumentRecord( p ) 17334 ); 17335 } 17336 getDocument( documentID ) { 17337 let record = this.documentRecords[ documentID ]; 17338 if ( ! record ) return ''; 17339 let offset = this.start + record.svgDocOffset; 17340 this.parser.currentPosition = offset; 17341 return this.parser.readBytes( record.svgDocLength ); 17342 } 17343 getDocumentForGlyph( glyphID ) { 17344 let id = this.documentRecords.findIndex( 17345 ( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID 17346 ); 17347 if ( id === -1 ) return ''; 17348 return this.getDocument( id ); 17349 } 17350 } 17351 class SVGDocumentRecord { 17352 constructor( p ) { 17353 this.startGlyphID = p.uint16; 17354 this.endGlyphID = p.uint16; 17355 this.svgDocOffset = p.Offset32; 17356 this.svgDocLength = p.uint32; 17357 } 17358 } 17359 var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } ); 17360 class fvar extends SimpleTable { 17361 constructor( dict, dataview ) { 17362 const { p: p } = super( dict, dataview ); 17363 this.majorVersion = p.uint16; 17364 this.minorVersion = p.uint16; 17365 this.axesArrayOffset = p.Offset16; 17366 p.uint16; 17367 this.axisCount = p.uint16; 17368 this.axisSize = p.uint16; 17369 this.instanceCount = p.uint16; 17370 this.instanceSize = p.uint16; 17371 const axisStart = this.tableStart + this.axesArrayOffset; 17372 lazy$1( this, `axes`, () => { 17373 p.currentPosition = axisStart; 17374 return [ ...new Array( this.axisCount ) ].map( 17375 ( _ ) => new VariationAxisRecord( p ) 17376 ); 17377 } ); 17378 const instanceStart = axisStart + this.axisCount * this.axisSize; 17379 lazy$1( this, `instances`, () => { 17380 let instances = []; 17381 for ( let i = 0; i < this.instanceCount; i++ ) { 17382 p.currentPosition = instanceStart + i * this.instanceSize; 17383 instances.push( 17384 new InstanceRecord( p, this.axisCount, this.instanceSize ) 17385 ); 17386 } 17387 return instances; 17388 } ); 17389 } 17390 getSupportedAxes() { 17391 return this.axes.map( ( a ) => a.tag ); 17392 } 17393 getAxis( name ) { 17394 return this.axes.find( ( a ) => a.tag === name ); 17395 } 17396 } 17397 class VariationAxisRecord { 17398 constructor( p ) { 17399 this.tag = p.tag; 17400 this.minValue = p.fixed; 17401 this.defaultValue = p.fixed; 17402 this.maxValue = p.fixed; 17403 this.flags = p.flags( 16 ); 17404 this.axisNameID = p.uint16; 17405 } 17406 } 17407 class InstanceRecord { 17408 constructor( p, axisCount, size ) { 17409 let start = p.currentPosition; 17410 this.subfamilyNameID = p.uint16; 17411 p.uint16; 17412 this.coordinates = [ ...new Array( axisCount ) ].map( 17413 ( _ ) => p.fixed 17414 ); 17415 if ( p.currentPosition - start < size ) { 17416 this.postScriptNameID = p.uint16; 17417 } 17418 } 17419 } 17420 var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } ); 17421 class cvt extends SimpleTable { 17422 constructor( dict, dataview ) { 17423 const { p: p } = super( dict, dataview ); 17424 const n = dict.length / 2; 17425 lazy$1( this, `items`, () => 17426 [ ...new Array( n ) ].map( ( _ ) => p.fword ) 17427 ); 17428 } 17429 } 17430 var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } ); 17431 class fpgm extends SimpleTable { 17432 constructor( dict, dataview ) { 17433 const { p: p } = super( dict, dataview ); 17434 lazy$1( this, `instructions`, () => 17435 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 17436 ); 17437 } 17438 } 17439 var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } ); 17440 class gasp extends SimpleTable { 17441 constructor( dict, dataview ) { 17442 const { p: p } = super( dict, dataview ); 17443 this.version = p.uint16; 17444 this.numRanges = p.uint16; 17445 const getter = () => 17446 [ ...new Array( this.numRanges ) ].map( 17447 ( _ ) => new GASPRange( p ) 17448 ); 17449 lazy$1( this, `gaspRanges`, getter ); 17450 } 17451 } 17452 class GASPRange { 17453 constructor( p ) { 17454 this.rangeMaxPPEM = p.uint16; 17455 this.rangeGaspBehavior = p.uint16; 17456 } 17457 } 17458 var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } ); 17459 class glyf extends SimpleTable { 17460 constructor( dict, dataview ) { 17461 super( dict, dataview ); 17462 } 17463 getGlyphData( offset, length ) { 17464 this.parser.currentPosition = this.tableStart + offset; 17465 return this.parser.readBytes( length ); 17466 } 17467 } 17468 var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } ); 17469 class loca extends SimpleTable { 17470 constructor( dict, dataview, tables ) { 17471 const { p: p } = super( dict, dataview ); 17472 const n = tables.maxp.numGlyphs + 1; 17473 if ( tables.head.indexToLocFormat === 0 ) { 17474 this.x2 = true; 17475 lazy$1( this, `offsets`, () => 17476 [ ...new Array( n ) ].map( ( _ ) => p.Offset16 ) 17477 ); 17478 } else { 17479 lazy$1( this, `offsets`, () => 17480 [ ...new Array( n ) ].map( ( _ ) => p.Offset32 ) 17481 ); 17482 } 17483 } 17484 getGlyphDataOffsetAndLength( glyphID ) { 17485 let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1; 17486 let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1; 17487 return { offset: offset, length: nextOffset - offset }; 17488 } 17489 } 17490 var loca$1 = Object.freeze( { __proto__: null, loca: loca } ); 17491 class prep extends SimpleTable { 17492 constructor( dict, dataview ) { 17493 const { p: p } = super( dict, dataview ); 17494 lazy$1( this, `instructions`, () => 17495 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 17496 ); 17497 } 17498 } 17499 var prep$1 = Object.freeze( { __proto__: null, prep: prep } ); 17500 class CFF extends SimpleTable { 17501 constructor( dict, dataview ) { 17502 const { p: p } = super( dict, dataview ); 17503 lazy$1( this, `data`, () => p.readBytes() ); 17504 } 17505 } 17506 var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } ); 17507 class CFF2 extends SimpleTable { 17508 constructor( dict, dataview ) { 17509 const { p: p } = super( dict, dataview ); 17510 lazy$1( this, `data`, () => p.readBytes() ); 17511 } 17512 } 17513 var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } ); 17514 class VORG extends SimpleTable { 17515 constructor( dict, dataview ) { 17516 const { p: p } = super( dict, dataview ); 17517 this.majorVersion = p.uint16; 17518 this.minorVersion = p.uint16; 17519 this.defaultVertOriginY = p.int16; 17520 this.numVertOriginYMetrics = p.uint16; 17521 lazy$1( this, `vertORiginYMetrics`, () => 17522 [ ...new Array( this.numVertOriginYMetrics ) ].map( 17523 ( _ ) => new VertOriginYMetric( p ) 17524 ) 17525 ); 17526 } 17527 } 17528 class VertOriginYMetric { 17529 constructor( p ) { 17530 this.glyphIndex = p.uint16; 17531 this.vertOriginY = p.int16; 17532 } 17533 } 17534 var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } ); 17535 class BitmapSize { 17536 constructor( p ) { 17537 this.indexSubTableArrayOffset = p.Offset32; 17538 this.indexTablesSize = p.uint32; 17539 this.numberofIndexSubTables = p.uint32; 17540 this.colorRef = p.uint32; 17541 this.hori = new SbitLineMetrics( p ); 17542 this.vert = new SbitLineMetrics( p ); 17543 this.startGlyphIndex = p.uint16; 17544 this.endGlyphIndex = p.uint16; 17545 this.ppemX = p.uint8; 17546 this.ppemY = p.uint8; 17547 this.bitDepth = p.uint8; 17548 this.flags = p.int8; 17549 } 17550 } 17551 class BitmapScale { 17552 constructor( p ) { 17553 this.hori = new SbitLineMetrics( p ); 17554 this.vert = new SbitLineMetrics( p ); 17555 this.ppemX = p.uint8; 17556 this.ppemY = p.uint8; 17557 this.substitutePpemX = p.uint8; 17558 this.substitutePpemY = p.uint8; 17559 } 17560 } 17561 class SbitLineMetrics { 17562 constructor( p ) { 17563 this.ascender = p.int8; 17564 this.descender = p.int8; 17565 this.widthMax = p.uint8; 17566 this.caretSlopeNumerator = p.int8; 17567 this.caretSlopeDenominator = p.int8; 17568 this.caretOffset = p.int8; 17569 this.minOriginSB = p.int8; 17570 this.minAdvanceSB = p.int8; 17571 this.maxBeforeBL = p.int8; 17572 this.minAfterBL = p.int8; 17573 this.pad1 = p.int8; 17574 this.pad2 = p.int8; 17575 } 17576 } 17577 class EBLC extends SimpleTable { 17578 constructor( dict, dataview, name ) { 17579 const { p: p } = super( dict, dataview, name ); 17580 this.majorVersion = p.uint16; 17581 this.minorVersion = p.uint16; 17582 this.numSizes = p.uint32; 17583 lazy$1( this, `bitMapSizes`, () => 17584 [ ...new Array( this.numSizes ) ].map( 17585 ( _ ) => new BitmapSize( p ) 17586 ) 17587 ); 17588 } 17589 } 17590 var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } ); 17591 class EBDT extends SimpleTable { 17592 constructor( dict, dataview, name ) { 17593 const { p: p } = super( dict, dataview, name ); 17594 this.majorVersion = p.uint16; 17595 this.minorVersion = p.uint16; 17596 } 17597 } 17598 var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } ); 17599 class EBSC extends SimpleTable { 17600 constructor( dict, dataview ) { 17601 const { p: p } = super( dict, dataview ); 17602 this.majorVersion = p.uint16; 17603 this.minorVersion = p.uint16; 17604 this.numSizes = p.uint32; 17605 lazy$1( this, `bitmapScales`, () => 17606 [ ...new Array( this.numSizes ) ].map( 17607 ( _ ) => new BitmapScale( p ) 17608 ) 17609 ); 17610 } 17611 } 17612 var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } ); 17613 class CBLC extends EBLC { 17614 constructor( dict, dataview ) { 17615 super( dict, dataview, `CBLC` ); 17616 } 17617 } 17618 var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } ); 17619 class CBDT extends EBDT { 17620 constructor( dict, dataview ) { 17621 super( dict, dataview, `CBDT` ); 17622 } 17623 } 17624 var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } ); 17625 class sbix extends SimpleTable { 17626 constructor( dict, dataview ) { 17627 const { p: p } = super( dict, dataview ); 17628 this.version = p.uint16; 17629 this.flags = p.flags( 16 ); 17630 this.numStrikes = p.uint32; 17631 lazy$1( this, `strikeOffsets`, () => 17632 [ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 ) 17633 ); 17634 } 17635 } 17636 var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } ); 17637 class COLR extends SimpleTable { 17638 constructor( dict, dataview ) { 17639 const { p: p } = super( dict, dataview ); 17640 this.version = p.uint16; 17641 this.numBaseGlyphRecords = p.uint16; 17642 this.baseGlyphRecordsOffset = p.Offset32; 17643 this.layerRecordsOffset = p.Offset32; 17644 this.numLayerRecords = p.uint16; 17645 } 17646 getBaseGlyphRecord( glyphID ) { 17647 let start = this.tableStart + this.baseGlyphRecordsOffset; 17648 this.parser.currentPosition = start; 17649 let first = new BaseGlyphRecord( this.parser ); 17650 let firstID = first.gID; 17651 let end = this.tableStart + this.layerRecordsOffset - 6; 17652 this.parser.currentPosition = end; 17653 let last = new BaseGlyphRecord( this.parser ); 17654 let lastID = last.gID; 17655 if ( firstID === glyphID ) return first; 17656 if ( lastID === glyphID ) return last; 17657 while ( true ) { 17658 if ( start === end ) break; 17659 let mid = start + ( end - start ) / 12; 17660 this.parser.currentPosition = mid; 17661 let middle = new BaseGlyphRecord( this.parser ); 17662 let midID = middle.gID; 17663 if ( midID === glyphID ) return middle; 17664 else if ( midID > glyphID ) { 17665 end = mid; 17666 } else if ( midID < glyphID ) { 17667 start = mid; 17668 } 17669 } 17670 return false; 17671 } 17672 getLayers( glyphID ) { 17673 let record = this.getBaseGlyphRecord( glyphID ); 17674 this.parser.currentPosition = 17675 this.tableStart + 17676 this.layerRecordsOffset + 17677 4 * record.firstLayerIndex; 17678 return [ ...new Array( record.numLayers ) ].map( 17679 ( _ ) => new LayerRecord( p ) 17680 ); 17681 } 17682 } 17683 class BaseGlyphRecord { 17684 constructor( p ) { 17685 this.gID = p.uint16; 17686 this.firstLayerIndex = p.uint16; 17687 this.numLayers = p.uint16; 17688 } 17689 } 17690 class LayerRecord { 17691 constructor( p ) { 17692 this.gID = p.uint16; 17693 this.paletteIndex = p.uint16; 17694 } 17695 } 17696 var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } ); 17697 class CPAL extends SimpleTable { 17698 constructor( dict, dataview ) { 17699 const { p: p } = super( dict, dataview ); 17700 this.version = p.uint16; 17701 this.numPaletteEntries = p.uint16; 17702 const numPalettes = ( this.numPalettes = p.uint16 ); 17703 this.numColorRecords = p.uint16; 17704 this.offsetFirstColorRecord = p.Offset32; 17705 this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map( 17706 ( _ ) => p.uint16 17707 ); 17708 lazy$1( this, `colorRecords`, () => { 17709 p.currentPosition = this.tableStart + this.offsetFirstColorRecord; 17710 return [ ...new Array( this.numColorRecords ) ].map( 17711 ( _ ) => new ColorRecord( p ) 17712 ); 17713 } ); 17714 if ( this.version === 1 ) { 17715 this.offsetPaletteTypeArray = p.Offset32; 17716 this.offsetPaletteLabelArray = p.Offset32; 17717 this.offsetPaletteEntryLabelArray = p.Offset32; 17718 lazy$1( this, `paletteTypeArray`, () => { 17719 p.currentPosition = 17720 this.tableStart + this.offsetPaletteTypeArray; 17721 return new PaletteTypeArray( p, numPalettes ); 17722 } ); 17723 lazy$1( this, `paletteLabelArray`, () => { 17724 p.currentPosition = 17725 this.tableStart + this.offsetPaletteLabelArray; 17726 return new PaletteLabelsArray( p, numPalettes ); 17727 } ); 17728 lazy$1( this, `paletteEntryLabelArray`, () => { 17729 p.currentPosition = 17730 this.tableStart + this.offsetPaletteEntryLabelArray; 17731 return new PaletteEntryLabelArray( p, numPalettes ); 17732 } ); 17733 } 17734 } 17735 } 17736 class ColorRecord { 17737 constructor( p ) { 17738 this.blue = p.uint8; 17739 this.green = p.uint8; 17740 this.red = p.uint8; 17741 this.alpha = p.uint8; 17742 } 17743 } 17744 class PaletteTypeArray { 17745 constructor( p, numPalettes ) { 17746 this.paletteTypes = [ ...new Array( numPalettes ) ].map( 17747 ( _ ) => p.uint32 17748 ); 17749 } 17750 } 17751 class PaletteLabelsArray { 17752 constructor( p, numPalettes ) { 17753 this.paletteLabels = [ ...new Array( numPalettes ) ].map( 17754 ( _ ) => p.uint16 17755 ); 17756 } 17757 } 17758 class PaletteEntryLabelArray { 17759 constructor( p, numPalettes ) { 17760 this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map( 17761 ( _ ) => p.uint16 17762 ); 17763 } 17764 } 17765 var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } ); 17766 class DSIG extends SimpleTable { 17767 constructor( dict, dataview ) { 17768 const { p: p } = super( dict, dataview ); 17769 this.version = p.uint32; 17770 this.numSignatures = p.uint16; 17771 this.flags = p.uint16; 17772 this.signatureRecords = [ ...new Array( this.numSignatures ) ].map( 17773 ( _ ) => new SignatureRecord( p ) 17774 ); 17775 } 17776 getData( signatureID ) { 17777 const record = this.signatureRecords[ signatureID ]; 17778 this.parser.currentPosition = this.tableStart + record.offset; 17779 return new SignatureBlockFormat1( this.parser ); 17780 } 17781 } 17782 class SignatureRecord { 17783 constructor( p ) { 17784 this.format = p.uint32; 17785 this.length = p.uint32; 17786 this.offset = p.Offset32; 17787 } 17788 } 17789 class SignatureBlockFormat1 { 17790 constructor( p ) { 17791 p.uint16; 17792 p.uint16; 17793 this.signatureLength = p.uint32; 17794 this.signature = p.readBytes( this.signatureLength ); 17795 } 17796 } 17797 var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } ); 17798 class hdmx extends SimpleTable { 17799 constructor( dict, dataview, tables ) { 17800 const { p: p } = super( dict, dataview ); 17801 const numGlyphs = tables.hmtx.numGlyphs; 17802 this.version = p.uint16; 17803 this.numRecords = p.int16; 17804 this.sizeDeviceRecord = p.int32; 17805 this.records = [ ...new Array( numRecords ) ].map( 17806 ( _ ) => new DeviceRecord( p, numGlyphs ) 17807 ); 17808 } 17809 } 17810 class DeviceRecord { 17811 constructor( p, numGlyphs ) { 17812 this.pixelSize = p.uint8; 17813 this.maxWidth = p.uint8; 17814 this.widths = p.readBytes( numGlyphs ); 17815 } 17816 } 17817 var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } ); 17818 class kern extends SimpleTable { 17819 constructor( dict, dataview ) { 17820 const { p: p } = super( dict, dataview ); 17821 this.version = p.uint16; 17822 this.nTables = p.uint16; 17823 lazy$1( this, `tables`, () => { 17824 let offset = this.tableStart + 4; 17825 const tables = []; 17826 for ( let i = 0; i < this.nTables; i++ ) { 17827 p.currentPosition = offset; 17828 let subtable = new KernSubTable( p ); 17829 tables.push( subtable ); 17830 offset += subtable; 17831 } 17832 return tables; 17833 } ); 17834 } 17835 } 17836 class KernSubTable { 17837 constructor( p ) { 17838 this.version = p.uint16; 17839 this.length = p.uint16; 17840 this.coverage = p.flags( 8 ); 17841 this.format = p.uint8; 17842 if ( this.format === 0 ) { 17843 this.nPairs = p.uint16; 17844 this.searchRange = p.uint16; 17845 this.entrySelector = p.uint16; 17846 this.rangeShift = p.uint16; 17847 lazy$1( this, `pairs`, () => 17848 [ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) ) 17849 ); 17850 } 17851 if ( this.format === 2 ) { 17852 console.warn( 17853 `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` 17854 ); 17855 } 17856 } 17857 get horizontal() { 17858 return this.coverage[ 0 ]; 17859 } 17860 get minimum() { 17861 return this.coverage[ 1 ]; 17862 } 17863 get crossstream() { 17864 return this.coverage[ 2 ]; 17865 } 17866 get override() { 17867 return this.coverage[ 3 ]; 17868 } 17869 } 17870 class Pair { 17871 constructor( p ) { 17872 this.left = p.uint16; 17873 this.right = p.uint16; 17874 this.value = p.fword; 17875 } 17876 } 17877 var kern$1 = Object.freeze( { __proto__: null, kern: kern } ); 17878 class LTSH extends SimpleTable { 17879 constructor( dict, dataview ) { 17880 const { p: p } = super( dict, dataview ); 17881 this.version = p.uint16; 17882 this.numGlyphs = p.uint16; 17883 this.yPels = p.readBytes( this.numGlyphs ); 17884 } 17885 } 17886 var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } ); 17887 class MERG extends SimpleTable { 17888 constructor( dict, dataview ) { 17889 const { p: p } = super( dict, dataview ); 17890 this.version = p.uint16; 17891 this.mergeClassCount = p.uint16; 17892 this.mergeDataOffset = p.Offset16; 17893 this.classDefCount = p.uint16; 17894 this.offsetToClassDefOffsets = p.Offset16; 17895 lazy$1( this, `mergeEntryMatrix`, () => 17896 [ ...new Array( this.mergeClassCount ) ].map( ( _ ) => 17897 p.readBytes( this.mergeClassCount ) 17898 ) 17899 ); 17900 console.warn( `Full MERG parsing is currently not supported.` ); 17901 console.warn( 17902 `If you need this table parsed, please file an issue, or better yet, a PR.` 17903 ); 17904 } 17905 } 17906 var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } ); 17907 class meta extends SimpleTable { 17908 constructor( dict, dataview ) { 17909 const { p: p } = super( dict, dataview ); 17910 this.version = p.uint32; 17911 this.flags = p.uint32; 17912 p.uint32; 17913 this.dataMapsCount = p.uint32; 17914 this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map( 17915 ( _ ) => new DataMap( this.tableStart, p ) 17916 ); 17917 } 17918 } 17919 class DataMap { 17920 constructor( tableStart, p ) { 17921 this.tableStart = tableStart; 17922 this.parser = p; 17923 this.tag = p.tag; 17924 this.dataOffset = p.Offset32; 17925 this.dataLength = p.uint32; 17926 } 17927 getData() { 17928 this.parser.currentField = this.tableStart + this.dataOffset; 17929 return this.parser.readBytes( this.dataLength ); 17930 } 17931 } 17932 var meta$1 = Object.freeze( { __proto__: null, meta: meta } ); 17933 class PCLT extends SimpleTable { 17934 constructor( dict, dataview ) { 17935 super( dict, dataview ); 17936 console.warn( 17937 `This font uses a PCLT table, which is currently not supported by this parser.` 17938 ); 17939 console.warn( 17940 `If you need this table parsed, please file an issue, or better yet, a PR.` 17941 ); 17942 } 17943 } 17944 var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } ); 17945 class VDMX extends SimpleTable { 17946 constructor( dict, dataview ) { 17947 const { p: p } = super( dict, dataview ); 17948 this.version = p.uint16; 17949 this.numRecs = p.uint16; 17950 this.numRatios = p.uint16; 17951 this.ratRanges = [ ...new Array( this.numRatios ) ].map( 17952 ( _ ) => new RatioRange( p ) 17953 ); 17954 this.offsets = [ ...new Array( this.numRatios ) ].map( 17955 ( _ ) => p.Offset16 17956 ); 17957 this.VDMXGroups = [ ...new Array( this.numRecs ) ].map( 17958 ( _ ) => new VDMXGroup( p ) 17959 ); 17960 } 17961 } 17962 class RatioRange { 17963 constructor( p ) { 17964 this.bCharSet = p.uint8; 17965 this.xRatio = p.uint8; 17966 this.yStartRatio = p.uint8; 17967 this.yEndRatio = p.uint8; 17968 } 17969 } 17970 class VDMXGroup { 17971 constructor( p ) { 17972 this.recs = p.uint16; 17973 this.startsz = p.uint8; 17974 this.endsz = p.uint8; 17975 this.records = [ ...new Array( this.recs ) ].map( 17976 ( _ ) => new vTable( p ) 17977 ); 17978 } 17979 } 17980 class vTable { 17981 constructor( p ) { 17982 this.yPelHeight = p.uint16; 17983 this.yMax = p.int16; 17984 this.yMin = p.int16; 17985 } 17986 } 17987 var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } ); 17988 class vhea extends SimpleTable { 17989 constructor( dict, dataview ) { 17990 const { p: p } = super( dict, dataview ); 17991 this.version = p.fixed; 17992 this.ascent = this.vertTypoAscender = p.int16; 17993 this.descent = this.vertTypoDescender = p.int16; 17994 this.lineGap = this.vertTypoLineGap = p.int16; 17995 this.advanceHeightMax = p.int16; 17996 this.minTopSideBearing = p.int16; 17997 this.minBottomSideBearing = p.int16; 17998 this.yMaxExtent = p.int16; 17999 this.caretSlopeRise = p.int16; 18000 this.caretSlopeRun = p.int16; 18001 this.caretOffset = p.int16; 18002 this.reserved = p.int16; 18003 this.reserved = p.int16; 18004 this.reserved = p.int16; 18005 this.reserved = p.int16; 18006 this.metricDataFormat = p.int16; 18007 this.numOfLongVerMetrics = p.uint16; 18008 p.verifyLength(); 18009 } 18010 } 18011 var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } ); 18012 class vmtx extends SimpleTable { 18013 constructor( dict, dataview, tables ) { 18014 super( dict, dataview ); 18015 const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; 18016 const numGlyphs = tables.maxp.numGlyphs; 18017 const metricsStart = p.currentPosition; 18018 lazy( this, `vMetrics`, () => { 18019 p.currentPosition = metricsStart; 18020 return [ ...new Array( numOfLongVerMetrics ) ].map( 18021 ( _ ) => new LongVertMetric( p.uint16, p.int16 ) 18022 ); 18023 } ); 18024 if ( numOfLongVerMetrics < numGlyphs ) { 18025 const tsbStart = metricsStart + numOfLongVerMetrics * 4; 18026 lazy( this, `topSideBearings`, () => { 18027 p.currentPosition = tsbStart; 18028 return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map( 18029 ( _ ) => p.int16 18030 ); 18031 } ); 18032 } 18033 } 18034 } 18035 class LongVertMetric { 18036 constructor( h, b ) { 18037 this.advanceHeight = h; 18038 this.topSideBearing = b; 18039 } 18040 } 18041 var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } ); 18042 18043 /* eslint-enable */ 18044 18045 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js 18046 18047 18048 const { kebabCase: make_families_from_faces_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 18049 function makeFamiliesFromFaces(fontFaces) { 18050 const fontFamiliesObject = fontFaces.reduce((acc, item) => { 18051 if (!acc[item.fontFamily]) { 18052 acc[item.fontFamily] = { 18053 name: item.fontFamily, 18054 fontFamily: item.fontFamily, 18055 slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()), 18056 fontFace: [] 18057 }; 18058 } 18059 acc[item.fontFamily].fontFace.push(item); 18060 return acc; 18061 }, {}); 18062 return Object.values(fontFamiliesObject); 18063 } 18064 18065 18066 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 function UploadFonts() { 18077 const { installFonts } = (0,external_wp_element_.useContext)(FontLibraryContext); 18078 const [isUploading, setIsUploading] = (0,external_wp_element_.useState)(false); 18079 const [notice, setNotice] = (0,external_wp_element_.useState)(false); 18080 const handleDropZone = (files) => { 18081 handleFilesUpload(files); 18082 }; 18083 const onFilesUpload = (event) => { 18084 handleFilesUpload(event.target.files); 18085 }; 18086 const handleFilesUpload = async (files) => { 18087 setNotice(null); 18088 setIsUploading(true); 18089 const uniqueFilenames = /* @__PURE__ */ new Set(); 18090 const selectedFiles = [...files]; 18091 let hasInvalidFiles = false; 18092 const checkFilesPromises = selectedFiles.map(async (file) => { 18093 const isFont = await isFontFile(file); 18094 if (!isFont) { 18095 hasInvalidFiles = true; 18096 return null; 18097 } 18098 if (uniqueFilenames.has(file.name)) { 18099 return null; 18100 } 18101 const fileExtension = file.name.split(".").pop().toLowerCase(); 18102 if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) { 18103 uniqueFilenames.add(file.name); 18104 return file; 18105 } 18106 return null; 18107 }); 18108 const allowedFiles = (await Promise.all(checkFilesPromises)).filter( 18109 (file) => null !== file 18110 ); 18111 if (allowedFiles.length > 0) { 18112 loadFiles(allowedFiles); 18113 } else { 18114 const message = hasInvalidFiles ? (0,external_wp_i18n_namespaceObject.__)("Sorry, you are not allowed to upload this file type.") : (0,external_wp_i18n_namespaceObject.__)("No fonts found to install."); 18115 setNotice({ 18116 type: "error", 18117 message 18118 }); 18119 setIsUploading(false); 18120 } 18121 }; 18122 const loadFiles = async (files) => { 18123 const fontFacesLoaded = await Promise.all( 18124 files.map(async (fontFile) => { 18125 const fontFaceData = await getFontFaceMetadata(fontFile); 18126 await loadFontFaceInBrowser( 18127 fontFaceData, 18128 fontFaceData.file, 18129 "all" 18130 ); 18131 return fontFaceData; 18132 }) 18133 ); 18134 handleInstall(fontFacesLoaded); 18135 }; 18136 async function isFontFile(file) { 18137 const font = new Font("Uploaded Font"); 18138 try { 18139 const buffer = await readFileAsArrayBuffer(file); 18140 await font.fromDataBuffer(buffer, "font"); 18141 return true; 18142 } catch (error) { 18143 return false; 18144 } 18145 } 18146 async function readFileAsArrayBuffer(file) { 18147 return new Promise((resolve, reject) => { 18148 const reader = new window.FileReader(); 18149 reader.readAsArrayBuffer(file); 18150 reader.onload = () => resolve(reader.result); 18151 reader.onerror = reject; 18152 }); 18153 } 18154 const getFontFaceMetadata = async (fontFile) => { 18155 const buffer = await readFileAsArrayBuffer(fontFile); 18156 const fontObj = new Font("Uploaded Font"); 18157 fontObj.fromDataBuffer(buffer, fontFile.name); 18158 const onloadEvent = await new Promise( 18159 (resolve) => fontObj.onload = resolve 18160 ); 18161 const font = onloadEvent.detail.font; 18162 const { name } = font.opentype.tables; 18163 const fontName = name.get(16) || name.get(1); 18164 const isItalic = name.get(2).toLowerCase().includes("italic"); 18165 const fontWeight = font.opentype.tables["OS/2"].usWeightClass || "normal"; 18166 const isVariable = !!font.opentype.tables.fvar; 18167 const weightAxis = isVariable && font.opentype.tables.fvar.axes.find( 18168 ({ tag }) => tag === "wght" 18169 ); 18170 const weightRange = weightAxis ? `$weightAxis.minValue} $weightAxis.maxValue}` : null; 18171 return { 18172 file: fontFile, 18173 fontFamily: fontName, 18174 fontStyle: isItalic ? "italic" : "normal", 18175 fontWeight: weightRange || fontWeight 18176 }; 18177 }; 18178 const handleInstall = async (fontFaces) => { 18179 const fontFamilies = makeFamiliesFromFaces(fontFaces); 18180 try { 18181 await installFonts(fontFamilies); 18182 setNotice({ 18183 type: "success", 18184 message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.") 18185 }); 18186 } catch (error) { 18187 setNotice({ 18188 type: "error", 18189 message: error.message, 18190 errors: error?.installationErrors 18191 }); 18192 } 18193 setIsUploading(false); 18194 }; 18195 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [ 18196 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: handleDropZone }), 18197 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "font-library-modal__local-fonts", children: [ 18198 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 18199 external_wp_components_namespaceObject.Notice, 18200 { 18201 status: notice.type, 18202 __unstableHTML: true, 18203 onRemove: () => setNotice(null), 18204 children: [ 18205 notice.message, 18206 notice.errors && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { children: notice.errors.map((error, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: error }, index)) }) 18207 ] 18208 } 18209 ), 18210 isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__upload-area", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }) }), 18211 !isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18212 external_wp_components_namespaceObject.FormFileUpload, 18213 { 18214 accept: ALLOWED_FILE_EXTENSIONS.map( 18215 (ext) => `.$ext}` 18216 ).join(","), 18217 multiple: true, 18218 onChange: onFilesUpload, 18219 render: ({ openFileDialog }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18220 external_wp_components_namespaceObject.Button, 18221 { 18222 __next40pxDefaultSize: true, 18223 className: "font-library-modal__upload-area", 18224 onClick: openFileDialog, 18225 children: (0,external_wp_i18n_namespaceObject.__)("Upload font") 18226 } 18227 ) 18228 } 18229 ), 18230 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 2 }), 18231 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__upload-area__text", children: (0,external_wp_i18n_namespaceObject.__)( 18232 "Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2." 18233 ) }) 18234 ] }) 18235 ] }); 18236 } 18237 var upload_fonts_default = UploadFonts; 18238 18239 18240 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 18253 const DEFAULT_TAB = { 18254 id: "installed-fonts", 18255 title: (0,external_wp_i18n_namespaceObject._x)("Library", "Font library") 18256 }; 18257 const UPLOAD_TAB = { 18258 id: "upload-fonts", 18259 title: (0,external_wp_i18n_namespaceObject._x)("Upload", "noun") 18260 }; 18261 const tabsFromCollections = (collections) => collections.map(({ slug, name }) => ({ 18262 id: slug, 18263 title: collections.length === 1 && slug === "google-fonts" ? (0,external_wp_i18n_namespaceObject.__)("Install Fonts") : name 18264 })); 18265 function FontLibraryModal({ 18266 onRequestClose, 18267 defaultTabId = "installed-fonts" 18268 }) { 18269 const { collections } = (0,external_wp_element_.useContext)(FontLibraryContext); 18270 const canUserCreate = (0,external_wp_data_.useSelect)((select) => { 18271 return select(external_wp_coreData_namespaceObject.store).canUser("create", { 18272 kind: "postType", 18273 name: "wp_font_family" 18274 }); 18275 }, []); 18276 const tabs = [DEFAULT_TAB]; 18277 if (canUserCreate) { 18278 tabs.push(UPLOAD_TAB); 18279 tabs.push(...tabsFromCollections(collections || [])); 18280 } 18281 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18282 external_wp_components_namespaceObject.Modal, 18283 { 18284 title: (0,external_wp_i18n_namespaceObject.__)("Fonts"), 18285 onRequestClose, 18286 isFullScreen: true, 18287 className: "font-library-modal", 18288 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { defaultTabId, children: [ 18289 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__tablist-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { children: tabs.map(({ id, title }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: id, children: title }, id)) }) }), 18290 tabs.map(({ id }) => { 18291 let contents; 18292 switch (id) { 18293 case "upload-fonts": 18294 contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts_default, {}); 18295 break; 18296 case "installed-fonts": 18297 contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts_default, {}); 18298 break; 18299 default: 18300 contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection_default, { slug: id }); 18301 } 18302 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18303 Tabs.TabPanel, 18304 { 18305 tabId: id, 18306 focusable: false, 18307 children: contents 18308 }, 18309 id 18310 ); 18311 }) 18312 ] }) 18313 } 18314 ); 18315 } 18316 var font_library_modal_default = FontLibraryModal; 18317 18318 18319 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js 18320 18321 18322 18323 18324 18325 18326 function FontFamilyItem({ font }) { 18327 const { handleSetLibraryFontSelected, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext); 18328 const variantsCount = font?.fontFace?.length || 1; 18329 const handleClick = () => { 18330 handleSetLibraryFontSelected(font); 18331 setModalTabOpen("installed-fonts"); 18332 }; 18333 const previewStyle = getFamilyPreviewStyle(font); 18334 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { onClick: handleClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 18335 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: previewStyle, children: font.name }), 18336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles-screen-typography__font-variants-count", children: (0,external_wp_i18n_namespaceObject.sprintf)( 18337 /* translators: %d: Number of font variants. */ 18338 (0,external_wp_i18n_namespaceObject._n)("%d variant", "%d variants", variantsCount), 18339 variantsCount 18340 ) }) 18341 ] }) }); 18342 } 18343 var font_family_item_default = FontFamilyItem; 18344 18345 18346 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 const { useGlobalSetting: font_families_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 18360 function mapFontsWithSource(fonts, source) { 18361 return fonts ? fonts.map((f) => setUIValuesNeeded(f, { source })) : []; 18362 } 18363 function FontFamilies() { 18364 const { baseCustomFonts, modalTabOpen, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext); 18365 const [fontFamilies] = font_families_useGlobalSetting("typography.fontFamilies"); 18366 const [baseFontFamilies] = font_families_useGlobalSetting( 18367 "typography.fontFamilies", 18368 void 0, 18369 "base" 18370 ); 18371 const themeFonts = mapFontsWithSource(fontFamilies?.theme, "theme"); 18372 const customFonts = mapFontsWithSource(fontFamilies?.custom, "custom"); 18373 const activeFonts = [...themeFonts, ...customFonts].sort( 18374 (a, b) => a.name.localeCompare(b.name) 18375 ); 18376 const hasFonts = 0 < activeFonts.length; 18377 const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0; 18378 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 18379 !!modalTabOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18380 font_library_modal_default, 18381 { 18382 onRequestClose: () => setModalTabOpen(null), 18383 defaultTabId: modalTabOpen 18384 } 18385 ), 18386 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ 18387 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 18388 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Fonts") }), 18389 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18390 external_wp_components_namespaceObject.Button, 18391 { 18392 onClick: () => setModalTabOpen("installed-fonts"), 18393 label: (0,external_wp_i18n_namespaceObject.__)("Manage fonts"), 18394 icon: settings_default, 18395 size: "small" 18396 } 18397 ) 18398 ] }), 18399 activeFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { size: "large", isBordered: true, isSeparated: true, children: activeFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18400 font_family_item_default, 18401 { 18402 font 18403 }, 18404 font.slug 18405 )) }) }), 18406 !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 18407 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)("No fonts activated.") : (0,external_wp_i18n_namespaceObject.__)("No fonts installed.") }), 18408 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18409 external_wp_components_namespaceObject.Button, 18410 { 18411 className: "edit-site-global-styles-font-families__manage-fonts", 18412 variant: "secondary", 18413 __next40pxDefaultSize: true, 18414 onClick: () => { 18415 setModalTabOpen( 18416 hasInstalledFonts ? "installed-fonts" : "upload-fonts" 18417 ); 18418 }, 18419 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)("Manage fonts") : (0,external_wp_i18n_namespaceObject.__)("Add fonts") 18420 } 18421 ) 18422 ] }) 18423 ] }) 18424 ] }); 18425 } 18426 var font_families_default = ({ ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { ...props }) }); 18427 18428 18429 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 function ScreenTypography() { 18441 const fontLibraryEnabled = (0,external_wp_data_.useSelect)( 18442 (select) => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled, 18443 [] 18444 ); 18445 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 18446 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18447 header_default, 18448 { 18449 title: (0,external_wp_i18n_namespaceObject.__)("Typography"), 18450 description: (0,external_wp_i18n_namespaceObject.__)( 18451 "Available fonts, typographic styles, and the application of those styles." 18452 ) 18453 } 18454 ), 18455 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [ 18456 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typesets") }), 18457 fontLibraryEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families_default, {}), 18458 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements_default, {}), 18459 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_count_default, {}) 18460 ] }) }) 18461 ] }); 18462 } 18463 var screen_typography_default = ScreenTypography; 18464 18465 18466 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js 18467 18468 18469 18470 const { 18471 useGlobalStyle: typography_panel_useGlobalStyle, 18472 useGlobalSetting: typography_panel_useGlobalSetting, 18473 useSettingsForBlockElement: typography_panel_useSettingsForBlockElement, 18474 TypographyPanel: typography_panel_StylesTypographyPanel 18475 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 18476 function TypographyPanel({ element, headingLevel }) { 18477 let prefixParts = []; 18478 if (element === "heading") { 18479 prefixParts = prefixParts.concat(["elements", headingLevel]); 18480 } else if (element && element !== "text") { 18481 prefixParts = prefixParts.concat(["elements", element]); 18482 } 18483 const prefix = prefixParts.join("."); 18484 const [style] = typography_panel_useGlobalStyle(prefix, void 0, "user", { 18485 shouldDecodeEncode: false 18486 }); 18487 const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle( 18488 prefix, 18489 void 0, 18490 "all", 18491 { 18492 shouldDecodeEncode: false 18493 } 18494 ); 18495 const [rawSettings] = typography_panel_useGlobalSetting(""); 18496 const usedElement = element === "heading" ? headingLevel : element; 18497 const settings = typography_panel_useSettingsForBlockElement( 18498 rawSettings, 18499 void 0, 18500 usedElement 18501 ); 18502 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18503 typography_panel_StylesTypographyPanel, 18504 { 18505 inheritedValue: inheritedStyle, 18506 value: style, 18507 onChange: setStyle, 18508 settings 18509 } 18510 ); 18511 } 18512 18513 18514 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js 18515 18516 18517 18518 const { useGlobalStyle: typography_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 18519 function TypographyPreview({ name, element, headingLevel }) { 18520 let prefix = ""; 18521 if (element === "heading") { 18522 prefix = `elements.$headingLevel}.`; 18523 } else if (element && element !== "text") { 18524 prefix = `elements.$element}.`; 18525 } 18526 const [fontFamily] = typography_preview_useGlobalStyle( 18527 prefix + "typography.fontFamily", 18528 name 18529 ); 18530 const [gradientValue] = typography_preview_useGlobalStyle(prefix + "color.gradient", name); 18531 const [backgroundColor] = typography_preview_useGlobalStyle( 18532 prefix + "color.background", 18533 name 18534 ); 18535 const [fallbackBackgroundColor] = typography_preview_useGlobalStyle("color.background"); 18536 const [color] = typography_preview_useGlobalStyle(prefix + "color.text", name); 18537 const [fontSize] = typography_preview_useGlobalStyle(prefix + "typography.fontSize", name); 18538 const [fontStyle] = typography_preview_useGlobalStyle( 18539 prefix + "typography.fontStyle", 18540 name 18541 ); 18542 const [fontWeight] = typography_preview_useGlobalStyle( 18543 prefix + "typography.fontWeight", 18544 name 18545 ); 18546 const [letterSpacing] = typography_preview_useGlobalStyle( 18547 prefix + "typography.letterSpacing", 18548 name 18549 ); 18550 const extraStyles = element === "link" ? { 18551 textDecoration: "underline" 18552 } : {}; 18553 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18554 "div", 18555 { 18556 className: "edit-site-typography-preview", 18557 style: { 18558 fontFamily: fontFamily ?? "serif", 18559 background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor, 18560 color, 18561 fontSize, 18562 fontStyle, 18563 fontWeight, 18564 letterSpacing, 18565 ...extraStyles 18566 }, 18567 children: "Aa" 18568 } 18569 ); 18570 } 18571 18572 18573 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js 18574 18575 18576 18577 18578 18579 18580 18581 const screen_typography_element_elements = { 18582 text: { 18583 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts used on the site."), 18584 title: (0,external_wp_i18n_namespaceObject.__)("Text") 18585 }, 18586 link: { 18587 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on the links."), 18588 title: (0,external_wp_i18n_namespaceObject.__)("Links") 18589 }, 18590 heading: { 18591 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on headings."), 18592 title: (0,external_wp_i18n_namespaceObject.__)("Headings") 18593 }, 18594 caption: { 18595 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on captions."), 18596 title: (0,external_wp_i18n_namespaceObject.__)("Captions") 18597 }, 18598 button: { 18599 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on buttons."), 18600 title: (0,external_wp_i18n_namespaceObject.__)("Buttons") 18601 } 18602 }; 18603 function ScreenTypographyElement({ element }) { 18604 const [headingLevel, setHeadingLevel] = (0,external_wp_element_.useState)("heading"); 18605 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 18606 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18607 header_default, 18608 { 18609 title: screen_typography_element_elements[element].title, 18610 description: screen_typography_element_elements[element].description 18611 } 18612 ), 18613 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18614 TypographyPreview, 18615 { 18616 element, 18617 headingLevel 18618 } 18619 ) }), 18620 element === "heading" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: "1em", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 18621 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 18622 { 18623 label: (0,external_wp_i18n_namespaceObject.__)("Select heading level"), 18624 hideLabelFromVision: true, 18625 value: headingLevel, 18626 onChange: setHeadingLevel, 18627 isBlock: true, 18628 size: "__unstable-large", 18629 __nextHasNoMarginBottom: true, 18630 children: [ 18631 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18632 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 18633 { 18634 value: "heading", 18635 showTooltip: true, 18636 "aria-label": (0,external_wp_i18n_namespaceObject.__)("All headings"), 18637 label: (0,external_wp_i18n_namespaceObject._x)("All", "heading levels") 18638 } 18639 ), 18640 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18641 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 18642 { 18643 value: "h1", 18644 showTooltip: true, 18645 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 1"), 18646 label: (0,external_wp_i18n_namespaceObject.__)("H1") 18647 } 18648 ), 18649 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18650 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 18651 { 18652 value: "h2", 18653 showTooltip: true, 18654 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 2"), 18655 label: (0,external_wp_i18n_namespaceObject.__)("H2") 18656 } 18657 ), 18658 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18659 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 18660 { 18661 value: "h3", 18662 showTooltip: true, 18663 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 3"), 18664 label: (0,external_wp_i18n_namespaceObject.__)("H3") 18665 } 18666 ), 18667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18668 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 18669 { 18670 value: "h4", 18671 showTooltip: true, 18672 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 4"), 18673 label: (0,external_wp_i18n_namespaceObject.__)("H4") 18674 } 18675 ), 18676 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18677 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 18678 { 18679 value: "h5", 18680 showTooltip: true, 18681 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 5"), 18682 label: (0,external_wp_i18n_namespaceObject.__)("H5") 18683 } 18684 ), 18685 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18686 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 18687 { 18688 value: "h6", 18689 showTooltip: true, 18690 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 6"), 18691 label: (0,external_wp_i18n_namespaceObject.__)("H6") 18692 } 18693 ) 18694 ] 18695 } 18696 ) }), 18697 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18698 TypographyPanel, 18699 { 18700 element, 18701 headingLevel 18702 } 18703 ) 18704 ] }); 18705 } 18706 var screen_typography_element_default = ScreenTypographyElement; 18707 18708 18709 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js 18710 18711 18712 18713 18714 const { useGlobalStyle: font_size_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 18715 function FontSizePreview({ fontSize }) { 18716 const [font] = font_size_preview_useGlobalStyle("typography"); 18717 const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? { 18718 minimumFontSize: fontSize.fluid.min, 18719 maximumFontSize: fontSize.fluid.max 18720 } : { 18721 fontSize: fontSize.size 18722 }; 18723 const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input); 18724 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18725 "div", 18726 { 18727 className: "edit-site-typography-preview", 18728 style: { 18729 fontSize: computedFontSize, 18730 fontFamily: font?.fontFamily ?? "serif" 18731 }, 18732 children: (0,external_wp_i18n_namespaceObject.__)("Aa") 18733 } 18734 ); 18735 } 18736 var font_size_preview_default = FontSizePreview; 18737 18738 18739 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js 18740 18741 18742 18743 function ConfirmDeleteFontSizeDialog({ 18744 fontSize, 18745 isOpen, 18746 toggleOpen, 18747 handleRemoveFontSize 18748 }) { 18749 const handleConfirm = async () => { 18750 toggleOpen(); 18751 handleRemoveFontSize(fontSize); 18752 }; 18753 const handleCancel = () => { 18754 toggleOpen(); 18755 }; 18756 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18757 external_wp_components_namespaceObject.__experimentalConfirmDialog, 18758 { 18759 isOpen, 18760 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), 18761 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), 18762 onCancel: handleCancel, 18763 onConfirm: handleConfirm, 18764 size: "medium", 18765 children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)( 18766 /* translators: %s: Name of the font size preset. */ 18767 (0,external_wp_i18n_namespaceObject.__)( 18768 'Are you sure you want to delete "%s" font size preset?' 18769 ), 18770 fontSize.name 18771 ) 18772 } 18773 ); 18774 } 18775 var confirm_delete_font_size_dialog_default = ConfirmDeleteFontSizeDialog; 18776 18777 18778 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js 18779 18780 18781 18782 18783 function RenameFontSizeDialog({ fontSize, toggleOpen, handleRename }) { 18784 const [newName, setNewName] = (0,external_wp_element_.useState)(fontSize.name); 18785 const handleConfirm = () => { 18786 if (newName.trim()) { 18787 handleRename(newName); 18788 } 18789 toggleOpen(); 18790 }; 18791 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18792 external_wp_components_namespaceObject.Modal, 18793 { 18794 onRequestClose: toggleOpen, 18795 focusOnMount: "firstContentElement", 18796 title: (0,external_wp_i18n_namespaceObject.__)("Rename"), 18797 size: "small", 18798 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18799 "form", 18800 { 18801 onSubmit: (event) => { 18802 event.preventDefault(); 18803 handleConfirm(); 18804 toggleOpen(); 18805 }, 18806 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ 18807 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18808 external_wp_components_namespaceObject.__experimentalInputControl, 18809 { 18810 __next40pxDefaultSize: true, 18811 autoComplete: "off", 18812 value: newName, 18813 onChange: setNewName, 18814 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 18815 placeholder: (0,external_wp_i18n_namespaceObject.__)("Font size preset name") 18816 } 18817 ), 18818 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 18819 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18820 external_wp_components_namespaceObject.Button, 18821 { 18822 __next40pxDefaultSize: true, 18823 variant: "tertiary", 18824 onClick: toggleOpen, 18825 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 18826 } 18827 ), 18828 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18829 external_wp_components_namespaceObject.Button, 18830 { 18831 __next40pxDefaultSize: true, 18832 variant: "primary", 18833 type: "submit", 18834 children: (0,external_wp_i18n_namespaceObject.__)("Save") 18835 } 18836 ) 18837 ] }) 18838 ] }) 18839 } 18840 ) 18841 } 18842 ); 18843 } 18844 var rename_font_size_dialog_default = RenameFontSizeDialog; 18845 18846 18847 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js 18848 18849 18850 const DEFAULT_UNITS = ["px", "em", "rem", "vw", "vh"]; 18851 function SizeControl({ 18852 // Do not allow manipulation of margin bottom 18853 __nextHasNoMarginBottom, 18854 ...props 18855 }) { 18856 const { baseControlProps } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props); 18857 const { value, onChange, fallbackValue, disabled, label } = props; 18858 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 18859 availableUnits: DEFAULT_UNITS 18860 }); 18861 const [valueQuantity, valueUnit = "px"] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units); 18862 const isValueUnitRelative = !!valueUnit && ["em", "rem", "vw", "vh"].includes(valueUnit); 18863 const handleUnitControlChange = (newValue) => { 18864 onChange(newValue); 18865 }; 18866 const handleRangeControlChange = (newValue) => { 18867 onChange?.(newValue + valueUnit); 18868 }; 18869 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { ...baseControlProps, __nextHasNoMarginBottom: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ 18870 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18871 external_wp_components_namespaceObject.__experimentalUnitControl, 18872 { 18873 __next40pxDefaultSize: true, 18874 __nextHasNoMarginBottom: true, 18875 label, 18876 hideLabelFromVision: true, 18877 value, 18878 onChange: handleUnitControlChange, 18879 units, 18880 min: 0, 18881 disabled 18882 } 18883 ) }), 18884 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 2, marginBottom: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18885 external_wp_components_namespaceObject.RangeControl, 18886 { 18887 __next40pxDefaultSize: true, 18888 __nextHasNoMarginBottom: true, 18889 label, 18890 hideLabelFromVision: true, 18891 value: valueQuantity, 18892 initialPosition: fallbackValue, 18893 withInputField: false, 18894 onChange: handleRangeControlChange, 18895 min: 0, 18896 max: isValueUnitRelative ? 10 : 100, 18897 step: isValueUnitRelative ? 0.1 : 1, 18898 disabled 18899 } 18900 ) }) }) 18901 ] }) }); 18902 } 18903 var size_control_default = SizeControl; 18904 18905 18906 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 const { Menu } = unlock(external_wp_components_namespaceObject.privateApis); 18920 const { useGlobalSetting: font_size_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 18921 function FontSize() { 18922 const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_.useState)(false); 18923 const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_.useState)(false); 18924 const { 18925 params: { origin, slug }, 18926 goBack 18927 } = (0,external_wp_components_namespaceObject.useNavigator)(); 18928 const [fontSizes, setFontSizes] = font_size_useGlobalSetting( 18929 "typography.fontSizes" 18930 ); 18931 const [globalFluid] = font_size_useGlobalSetting("typography.fluid"); 18932 const sizes = fontSizes[origin] ?? []; 18933 const fontSize = sizes.find((size) => size.slug === slug); 18934 (0,external_wp_element_.useEffect)(() => { 18935 if (!!slug && !fontSize) { 18936 goBack(); 18937 } 18938 }, [slug, fontSize, goBack]); 18939 if (!origin || !slug || !fontSize) { 18940 return null; 18941 } 18942 const isFluid = fontSize?.fluid !== void 0 ? !!fontSize.fluid : !!globalFluid; 18943 const isCustomFluid = typeof fontSize?.fluid === "object"; 18944 const handleNameChange = (value) => { 18945 updateFontSize("name", value); 18946 }; 18947 const handleFontSizeChange = (value) => { 18948 updateFontSize("size", value); 18949 }; 18950 const handleFluidChange = (value) => { 18951 updateFontSize("fluid", value); 18952 }; 18953 const handleCustomFluidValues = (value) => { 18954 if (value) { 18955 updateFontSize("fluid", { 18956 min: fontSize.size, 18957 max: fontSize.size 18958 }); 18959 } else { 18960 updateFontSize("fluid", true); 18961 } 18962 }; 18963 const handleMinChange = (value) => { 18964 updateFontSize("fluid", { ...fontSize.fluid, min: value }); 18965 }; 18966 const handleMaxChange = (value) => { 18967 updateFontSize("fluid", { ...fontSize.fluid, max: value }); 18968 }; 18969 const updateFontSize = (key, value) => { 18970 const newFontSizes = sizes.map((size) => { 18971 if (size.slug === slug) { 18972 return { ...size, [key]: value }; 18973 } 18974 return size; 18975 }); 18976 setFontSizes({ 18977 ...fontSizes, 18978 [origin]: newFontSizes 18979 }); 18980 }; 18981 const handleRemoveFontSize = () => { 18982 const newFontSizes = sizes.filter((size) => size.slug !== slug); 18983 setFontSizes({ 18984 ...fontSizes, 18985 [origin]: newFontSizes 18986 }); 18987 }; 18988 const toggleDeleteConfirm = () => { 18989 setIsDeleteConfirmOpen(!isDeleteConfirmOpen); 18990 }; 18991 const toggleRenameDialog = () => { 18992 setIsRenameDialogOpen(!isRenameDialogOpen); 18993 }; 18994 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 18995 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18996 confirm_delete_font_size_dialog_default, 18997 { 18998 fontSize, 18999 isOpen: isDeleteConfirmOpen, 19000 toggleOpen: toggleDeleteConfirm, 19001 handleRemoveFontSize 19002 } 19003 ), 19004 isRenameDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19005 rename_font_size_dialog_default, 19006 { 19007 fontSize, 19008 toggleOpen: toggleRenameDialog, 19009 handleRename: handleNameChange 19010 } 19011 ), 19012 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 19013 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", align: "flex-start", children: [ 19014 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19015 header_default, 19016 { 19017 title: fontSize.name, 19018 description: (0,external_wp_i18n_namespaceObject.sprintf)( 19019 /* translators: %s: font size preset name. */ 19020 (0,external_wp_i18n_namespaceObject.__)("Manage the font size %s."), 19021 fontSize.name 19022 ) 19023 } 19024 ), 19025 origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19026 external_wp_components_namespaceObject.__experimentalSpacer, 19027 { 19028 marginTop: 3, 19029 marginBottom: 0, 19030 paddingX: 4, 19031 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { children: [ 19032 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19033 Menu.TriggerButton, 19034 { 19035 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19036 external_wp_components_namespaceObject.Button, 19037 { 19038 size: "small", 19039 icon: more_vertical_default, 19040 label: (0,external_wp_i18n_namespaceObject.__)( 19041 "Font size options" 19042 ) 19043 } 19044 ) 19045 } 19046 ), 19047 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Popover, { children: [ 19048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19049 Menu.Item, 19050 { 19051 onClick: toggleRenameDialog, 19052 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Rename") }) 19053 } 19054 ), 19055 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19056 Menu.Item, 19057 { 19058 onClick: toggleDeleteConfirm, 19059 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Delete") }) 19060 } 19061 ) 19062 ] }) 19063 ] }) 19064 } 19065 ) }) 19066 ] }), 19067 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19068 external_wp_components_namespaceObject.__experimentalSpacer, 19069 { 19070 paddingX: 4, 19071 marginBottom: 0, 19072 paddingBottom: 6, 19073 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 19074 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview_default, { fontSize }) }), 19075 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19076 size_control_default, 19077 { 19078 label: (0,external_wp_i18n_namespaceObject.__)("Size"), 19079 value: !isCustomFluid ? fontSize.size : "", 19080 onChange: handleFontSizeChange, 19081 disabled: isCustomFluid 19082 } 19083 ), 19084 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19085 external_wp_components_namespaceObject.ToggleControl, 19086 { 19087 label: (0,external_wp_i18n_namespaceObject.__)("Fluid typography"), 19088 help: (0,external_wp_i18n_namespaceObject.__)( 19089 "Scale the font size dynamically to fit the screen or viewport." 19090 ), 19091 checked: isFluid, 19092 onChange: handleFluidChange, 19093 __nextHasNoMarginBottom: true 19094 } 19095 ), 19096 isFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19097 external_wp_components_namespaceObject.ToggleControl, 19098 { 19099 label: (0,external_wp_i18n_namespaceObject.__)("Custom fluid values"), 19100 help: (0,external_wp_i18n_namespaceObject.__)( 19101 "Set custom min and max values for the fluid font size." 19102 ), 19103 checked: isCustomFluid, 19104 onChange: handleCustomFluidValues, 19105 __nextHasNoMarginBottom: true 19106 } 19107 ), 19108 isCustomFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19109 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19110 size_control_default, 19111 { 19112 label: (0,external_wp_i18n_namespaceObject.__)("Minimum"), 19113 value: fontSize.fluid?.min, 19114 onChange: handleMinChange 19115 } 19116 ), 19117 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19118 size_control_default, 19119 { 19120 label: (0,external_wp_i18n_namespaceObject.__)("Maximum"), 19121 value: fontSize.fluid?.max, 19122 onChange: handleMaxChange 19123 } 19124 ) 19125 ] }) 19126 ] }) 19127 } 19128 ) }) 19129 ] }) 19130 ] }); 19131 } 19132 var font_size_default = FontSize; 19133 19134 19135 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 19136 19137 19138 var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); 19139 19140 19141 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js 19142 19143 19144 19145 function ConfirmResetFontSizesDialog({ 19146 text, 19147 confirmButtonText, 19148 isOpen, 19149 toggleOpen, 19150 onConfirm 19151 }) { 19152 const handleConfirm = async () => { 19153 toggleOpen(); 19154 onConfirm(); 19155 }; 19156 const handleCancel = () => { 19157 toggleOpen(); 19158 }; 19159 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19160 external_wp_components_namespaceObject.__experimentalConfirmDialog, 19161 { 19162 isOpen, 19163 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), 19164 confirmButtonText, 19165 onCancel: handleCancel, 19166 onConfirm: handleConfirm, 19167 size: "medium", 19168 children: text 19169 } 19170 ); 19171 } 19172 var confirm_reset_font_sizes_dialog_default = ConfirmResetFontSizesDialog; 19173 19174 19175 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 const { Menu: font_sizes_Menu } = unlock(external_wp_components_namespaceObject.privateApis); 19189 const { useGlobalSetting: font_sizes_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19190 function FontSizeGroup({ 19191 label, 19192 origin, 19193 sizes, 19194 handleAddFontSize, 19195 handleResetFontSizes 19196 }) { 19197 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false); 19198 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); 19199 const resetDialogText = origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)( 19200 "Are you sure you want to remove all custom font size presets?" 19201 ) : (0,external_wp_i18n_namespaceObject.__)( 19202 "Are you sure you want to reset all font size presets to their default values?" 19203 ); 19204 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19205 isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19206 confirm_reset_font_sizes_dialog_default, 19207 { 19208 text: resetDialogText, 19209 confirmButtonText: origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)("Remove") : (0,external_wp_i18n_namespaceObject.__)("Reset"), 19210 isOpen: isResetDialogOpen, 19211 toggleOpen: toggleResetDialog, 19212 onConfirm: handleResetFontSizes 19213 } 19214 ), 19215 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 19216 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 19217 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }), 19218 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__typography-panel__options-container", children: [ 19219 origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19220 external_wp_components_namespaceObject.Button, 19221 { 19222 label: (0,external_wp_i18n_namespaceObject.__)("Add font size"), 19223 icon: plus_default, 19224 size: "small", 19225 onClick: handleAddFontSize 19226 } 19227 ), 19228 !!handleResetFontSizes && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(font_sizes_Menu, { children: [ 19229 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19230 font_sizes_Menu.TriggerButton, 19231 { 19232 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19233 external_wp_components_namespaceObject.Button, 19234 { 19235 size: "small", 19236 icon: more_vertical_default, 19237 label: (0,external_wp_i18n_namespaceObject.__)( 19238 "Font size presets options" 19239 ) 19240 } 19241 ) 19242 } 19243 ), 19244 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Item, { onClick: toggleResetDialog, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.ItemLabel, { children: origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)( 19245 "Remove font size presets" 19246 ) : (0,external_wp_i18n_namespaceObject.__)( 19247 "Reset font size presets" 19248 ) }) }) }) 19249 ] }) 19250 ] }) 19251 ] }), 19252 !!sizes.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: sizes.map((size) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19253 NavigationButtonAsItem, 19254 { 19255 path: `/typography/font-sizes/$origin}/$size.slug}`, 19256 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 19257 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-font-size__item", children: size.name }), 19258 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { display: "flex", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19259 icon_default, 19260 { 19261 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default 19262 } 19263 ) }) 19264 ] }) 19265 }, 19266 size.slug 19267 )) }) 19268 ] }) 19269 ] }); 19270 } 19271 function font_sizes_FontSizes() { 19272 const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting( 19273 "typography.fontSizes.theme" 19274 ); 19275 const [baseThemeFontSizes] = font_sizes_useGlobalSetting( 19276 "typography.fontSizes.theme", 19277 null, 19278 "base" 19279 ); 19280 const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting( 19281 "typography.fontSizes.default" 19282 ); 19283 const [baseDefaultFontSizes] = font_sizes_useGlobalSetting( 19284 "typography.fontSizes.default", 19285 null, 19286 "base" 19287 ); 19288 const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting( 19289 "typography.fontSizes.custom" 19290 ); 19291 const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting( 19292 "typography.defaultFontSizes" 19293 ); 19294 const handleAddFontSize = () => { 19295 const index = getNewIndexFromPresets(customFontSizes, "custom-"); 19296 const newFontSize = { 19297 /* translators: %d: font size index */ 19298 name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("New Font Size %d"), index), 19299 size: "16px", 19300 slug: `custom-$index}` 19301 }; 19302 setCustomFontSizes([...customFontSizes, newFontSize]); 19303 }; 19304 const hasSameSizeValues = (arr1, arr2) => arr1.map((item) => item.size).join("") === arr2.map((item) => item.size).join(""); 19305 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ 19306 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19307 header_default, 19308 { 19309 title: (0,external_wp_i18n_namespaceObject.__)("Font size presets"), 19310 description: (0,external_wp_i18n_namespaceObject.__)( 19311 "Create and edit the presets used for font sizes across the site." 19312 ) 19313 } 19314 ), 19315 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { paddingX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 8, children: [ 19316 !!themeFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19317 FontSizeGroup, 19318 { 19319 label: (0,external_wp_i18n_namespaceObject.__)("Theme"), 19320 origin: "theme", 19321 sizes: themeFontSizes, 19322 baseSizes: baseThemeFontSizes, 19323 handleAddFontSize, 19324 handleResetFontSizes: hasSameSizeValues( 19325 themeFontSizes, 19326 baseThemeFontSizes 19327 ) ? null : () => setThemeFontSizes( 19328 baseThemeFontSizes 19329 ) 19330 } 19331 ), 19332 defaultFontSizesEnabled && !!defaultFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19333 FontSizeGroup, 19334 { 19335 label: (0,external_wp_i18n_namespaceObject.__)("Default"), 19336 origin: "default", 19337 sizes: defaultFontSizes, 19338 baseSizes: baseDefaultFontSizes, 19339 handleAddFontSize, 19340 handleResetFontSizes: hasSameSizeValues( 19341 defaultFontSizes, 19342 baseDefaultFontSizes 19343 ) ? null : () => setDefaultFontSizes( 19344 baseDefaultFontSizes 19345 ) 19346 } 19347 ), 19348 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19349 FontSizeGroup, 19350 { 19351 label: (0,external_wp_i18n_namespaceObject.__)("Custom"), 19352 origin: "custom", 19353 sizes: customFontSizes, 19354 handleAddFontSize, 19355 handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null 19356 } 19357 ) 19358 ] }) }) }) 19359 ] }); 19360 } 19361 var font_sizes_default = font_sizes_FontSizes; 19362 19363 19364 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js 19365 19366 19367 19368 function ColorIndicatorWrapper({ className, ...props }) { 19369 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19370 external_wp_components_namespaceObject.Flex, 19371 { 19372 className: dist_clsx( 19373 "edit-site-global-styles__color-indicator-wrapper", 19374 className 19375 ), 19376 ...props 19377 } 19378 ); 19379 } 19380 var color_indicator_wrapper_default = ColorIndicatorWrapper; 19381 19382 19383 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 const { useGlobalSetting: palette_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19395 const EMPTY_COLORS = []; 19396 function Palette({ name }) { 19397 const [customColors] = palette_useGlobalSetting("color.palette.custom"); 19398 const [themeColors] = palette_useGlobalSetting("color.palette.theme"); 19399 const [defaultColors] = palette_useGlobalSetting("color.palette.default"); 19400 const [defaultPaletteEnabled] = palette_useGlobalSetting( 19401 "color.defaultPalette", 19402 name 19403 ); 19404 const colors = (0,external_wp_element_.useMemo)( 19405 () => [ 19406 ...customColors || EMPTY_COLORS, 19407 ...themeColors || EMPTY_COLORS, 19408 ...defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS 19409 ], 19410 [customColors, themeColors, defaultColors, defaultPaletteEnabled] 19411 ); 19412 const screenPath = !name ? "/colors/palette" : "/blocks/" + encodeURIComponent(name) + "/colors/palette"; 19413 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 19414 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Palette") }), 19415 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: screenPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [ 19416 colors.length > 0 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19417 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: colors.slice(0, 5).map(({ color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19418 color_indicator_wrapper_default, 19419 { 19420 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19421 external_wp_components_namespaceObject.ColorIndicator, 19422 { 19423 colorValue: color 19424 } 19425 ) 19426 }, 19427 `$color}-$index}` 19428 )) }), 19429 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: (0,external_wp_i18n_namespaceObject.__)("Edit palette") }) 19430 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Add colors") }), 19431 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) 19432 ] }) }) }) 19433 ] }); 19434 } 19435 var palette_default = Palette; 19436 19437 19438 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js 19439 19440 19441 19442 19443 19444 19445 19446 const { 19447 useGlobalStyle: screen_colors_useGlobalStyle, 19448 useGlobalSetting: screen_colors_useGlobalSetting, 19449 useSettingsForBlockElement: screen_colors_useSettingsForBlockElement, 19450 ColorPanel: screen_colors_StylesColorPanel 19451 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19452 function ScreenColors() { 19453 const [style] = screen_colors_useGlobalStyle("", void 0, "user", { 19454 shouldDecodeEncode: false 19455 }); 19456 const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle("", void 0, "all", { 19457 shouldDecodeEncode: false 19458 }); 19459 const [rawSettings] = screen_colors_useGlobalSetting(""); 19460 const settings = screen_colors_useSettingsForBlockElement(rawSettings); 19461 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19462 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19463 header_default, 19464 { 19465 title: (0,external_wp_i18n_namespaceObject.__)("Colors"), 19466 description: (0,external_wp_i18n_namespaceObject.__)( 19467 "Palette colors and the application of those colors on site elements." 19468 ) 19469 } 19470 ), 19471 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [ 19472 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(palette_default, {}), 19473 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19474 screen_colors_StylesColorPanel, 19475 { 19476 inheritedValue: inheritedStyle, 19477 value: style, 19478 onChange: setStyle, 19479 settings 19480 } 19481 ) 19482 ] }) }) 19483 ] }); 19484 } 19485 var screen_colors_default = ScreenColors; 19486 19487 19488 ;// ./node_modules/@wordpress/icons/build-module/library/shuffle.js 19489 19490 19491 var shuffle_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/SVG", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" }) }); 19492 19493 19494 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js 19495 19496 19497 function PresetColors() { 19498 const { paletteColors } = useStylesPreviewColors(); 19499 return paletteColors.slice(0, 4).map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19500 "div", 19501 { 19502 style: { 19503 flexGrow: 1, 19504 height: "100%", 19505 background: color 19506 } 19507 }, 19508 `$slug}-$index}` 19509 )); 19510 } 19511 19512 19513 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js 19514 19515 19516 19517 19518 const preview_colors_firstFrameVariants = { 19519 start: { 19520 scale: 1, 19521 opacity: 1 19522 }, 19523 hover: { 19524 scale: 0, 19525 opacity: 0 19526 } 19527 }; 19528 const StylesPreviewColors = ({ label, isFocused, withHoverView }) => { 19529 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19530 PreviewWrapper, 19531 { 19532 label, 19533 isFocused, 19534 withHoverView, 19535 children: ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19536 external_wp_components_namespaceObject.__unstableMotion.div, 19537 { 19538 variants: preview_colors_firstFrameVariants, 19539 style: { 19540 height: "100%", 19541 overflow: "hidden" 19542 }, 19543 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19544 external_wp_components_namespaceObject.__experimentalHStack, 19545 { 19546 spacing: 0, 19547 justify: "center", 19548 style: { 19549 height: "100%", 19550 overflow: "hidden" 19551 }, 19552 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {}) 19553 } 19554 ) 19555 }, 19556 key 19557 ) 19558 } 19559 ); 19560 }; 19561 var preview_colors_default = StylesPreviewColors; 19562 19563 19564 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js 19565 19566 19567 19568 19569 19570 19571 function ColorVariations({ title, gap = 2 }) { 19572 const propertiesToFilter = ["color"]; 19573 const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 19574 if (colorVariations?.length <= 1) { 19575 return null; 19576 } 19577 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 19578 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }), 19579 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { spacing: gap, children: colorVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19580 Variation, 19581 { 19582 variation, 19583 isPill: true, 19584 properties: propertiesToFilter, 19585 showTooltip: true, 19586 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors_default, {}) 19587 }, 19588 index 19589 )) }) 19590 ] }); 19591 } 19592 19593 19594 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js 19595 19596 19597 19598 19599 19600 19601 19602 19603 19604 const { useGlobalSetting: color_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19605 const mobilePopoverProps = { placement: "bottom-start", offset: 8 }; 19606 function ColorPalettePanel({ name }) { 19607 const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting( 19608 "color.palette.theme", 19609 name 19610 ); 19611 const [baseThemeColors] = color_palette_panel_useGlobalSetting( 19612 "color.palette.theme", 19613 name, 19614 "base" 19615 ); 19616 const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting( 19617 "color.palette.default", 19618 name 19619 ); 19620 const [baseDefaultColors] = color_palette_panel_useGlobalSetting( 19621 "color.palette.default", 19622 name, 19623 "base" 19624 ); 19625 const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting( 19626 "color.palette.custom", 19627 name 19628 ); 19629 const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting( 19630 "color.defaultPalette", 19631 name 19632 ); 19633 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<"); 19634 const popoverProps = isMobileViewport ? mobilePopoverProps : void 0; 19635 const [randomizeThemeColors] = useColorRandomizer(); 19636 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 19637 external_wp_components_namespaceObject.__experimentalVStack, 19638 { 19639 className: "edit-site-global-styles-color-palette-panel", 19640 spacing: 8, 19641 children: [ 19642 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 19643 !!themeColors && !!themeColors.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19644 external_wp_components_namespaceObject.__experimentalPaletteEdit, 19645 { 19646 canReset: themeColors !== baseThemeColors, 19647 canOnlyChangeValues: true, 19648 colors: themeColors, 19649 onChange: setThemeColors, 19650 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"), 19651 paletteLabelHeadingLevel: 3, 19652 popoverProps 19653 } 19654 ), 19655 window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19656 external_wp_components_namespaceObject.Button, 19657 { 19658 __next40pxDefaultSize: true, 19659 variant: "secondary", 19660 icon: shuffle_default, 19661 onClick: randomizeThemeColors, 19662 children: (0,external_wp_i18n_namespaceObject.__)("Randomize colors") 19663 } 19664 ) 19665 ] }), 19666 !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19667 external_wp_components_namespaceObject.__experimentalPaletteEdit, 19668 { 19669 canReset: defaultColors !== baseDefaultColors, 19670 canOnlyChangeValues: true, 19671 colors: defaultColors, 19672 onChange: setDefaultColors, 19673 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"), 19674 paletteLabelHeadingLevel: 3, 19675 popoverProps 19676 } 19677 ), 19678 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19679 external_wp_components_namespaceObject.__experimentalPaletteEdit, 19680 { 19681 colors: customColors, 19682 onChange: setCustomColors, 19683 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"), 19684 paletteLabelHeadingLevel: 3, 19685 slugPrefix: "custom-", 19686 popoverProps 19687 } 19688 ), 19689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes") }) 19690 ] 19691 } 19692 ); 19693 } 19694 19695 19696 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js 19697 19698 19699 19700 19701 19702 19703 19704 const { useGlobalSetting: gradients_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19705 const gradients_palette_panel_mobilePopoverProps = { placement: "bottom-start", offset: 8 }; 19706 const noop = () => { 19707 }; 19708 function GradientPalettePanel({ name }) { 19709 const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting( 19710 "color.gradients.theme", 19711 name 19712 ); 19713 const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting( 19714 "color.gradients.theme", 19715 name, 19716 "base" 19717 ); 19718 const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting( 19719 "color.gradients.default", 19720 name 19721 ); 19722 const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting( 19723 "color.gradients.default", 19724 name, 19725 "base" 19726 ); 19727 const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting( 19728 "color.gradients.custom", 19729 name 19730 ); 19731 const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting( 19732 "color.defaultGradients", 19733 name 19734 ); 19735 const [customDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.custom") || []; 19736 const [defaultDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.default") || []; 19737 const [themeDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.theme") || []; 19738 const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting( 19739 "color.defaultDuotone" 19740 ); 19741 const duotonePalette = [ 19742 ...customDuotone || [], 19743 ...themeDuotone || [], 19744 ...defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [] 19745 ]; 19746 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<"); 19747 const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : void 0; 19748 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 19749 external_wp_components_namespaceObject.__experimentalVStack, 19750 { 19751 className: "edit-site-global-styles-gradient-palette-panel", 19752 spacing: 8, 19753 children: [ 19754 !!themeGradients && !!themeGradients.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19755 external_wp_components_namespaceObject.__experimentalPaletteEdit, 19756 { 19757 canReset: themeGradients !== baseThemeGradients, 19758 canOnlyChangeValues: true, 19759 gradients: themeGradients, 19760 onChange: setThemeGradients, 19761 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"), 19762 paletteLabelHeadingLevel: 3, 19763 popoverProps 19764 } 19765 ), 19766 !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19767 external_wp_components_namespaceObject.__experimentalPaletteEdit, 19768 { 19769 canReset: defaultGradients !== baseDefaultGradients, 19770 canOnlyChangeValues: true, 19771 gradients: defaultGradients, 19772 onChange: setDefaultGradients, 19773 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"), 19774 paletteLabelLevel: 3, 19775 popoverProps 19776 } 19777 ), 19778 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19779 external_wp_components_namespaceObject.__experimentalPaletteEdit, 19780 { 19781 gradients: customGradients, 19782 onChange: setCustomGradients, 19783 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"), 19784 paletteLabelLevel: 3, 19785 slugPrefix: "custom-", 19786 popoverProps 19787 } 19788 ), 19789 !!duotonePalette && !!duotonePalette.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 19790 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Duotone") }), 19791 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }), 19792 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19793 external_wp_components_namespaceObject.DuotonePicker, 19794 { 19795 duotonePalette, 19796 disableCustomDuotone: true, 19797 disableCustomColors: true, 19798 clearable: false, 19799 onChange: noop 19800 } 19801 ) 19802 ] }) 19803 ] 19804 } 19805 ); 19806 } 19807 19808 19809 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js 19810 19811 19812 19813 19814 19815 19816 19817 const { Tabs: screen_color_palette_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 19818 function ScreenColorPalette({ name }) { 19819 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19820 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19821 header_default, 19822 { 19823 title: (0,external_wp_i18n_namespaceObject.__)("Edit palette"), 19824 description: (0,external_wp_i18n_namespaceObject.__)( 19825 "The combination of colors used across the site and in color pickers." 19826 ) 19827 } 19828 ), 19829 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { children: [ 19830 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { children: [ 19831 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "color", children: (0,external_wp_i18n_namespaceObject.__)("Color") }), 19832 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "gradient", children: (0,external_wp_i18n_namespaceObject.__)("Gradient") }) 19833 ] }), 19834 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "color", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { name }) }), 19835 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "gradient", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { name }) }) 19836 ] }) 19837 ] }); 19838 } 19839 var screen_color_palette_default = ScreenColorPalette; 19840 19841 19842 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js 19843 19844 19845 19846 const BACKGROUND_DEFAULT_VALUES = { 19847 backgroundSize: "auto" 19848 }; 19849 const { 19850 useGlobalStyle: background_panel_useGlobalStyle, 19851 useGlobalSetting: background_panel_useGlobalSetting, 19852 BackgroundPanel: background_panel_StylesBackgroundPanel 19853 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19854 function hasBackgroundImageValue(style) { 19855 return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === "string"; 19856 } 19857 function BackgroundPanel() { 19858 const [style] = background_panel_useGlobalStyle("", void 0, "user", { 19859 shouldDecodeEncode: false 19860 }); 19861 const [inheritedStyle, setStyle] = background_panel_useGlobalStyle("", void 0, "all", { 19862 shouldDecodeEncode: false 19863 }); 19864 const [settings] = background_panel_useGlobalSetting(""); 19865 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19866 background_panel_StylesBackgroundPanel, 19867 { 19868 inheritedValue: inheritedStyle, 19869 value: style, 19870 onChange: setStyle, 19871 settings, 19872 defaultValues: BACKGROUND_DEFAULT_VALUES 19873 } 19874 ); 19875 } 19876 19877 19878 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js 19879 19880 19881 19882 19883 19884 19885 19886 const { useHasBackgroundPanel: screen_background_useHasBackgroundPanel, useGlobalSetting: screen_background_useGlobalSetting } = unlock( 19887 external_wp_blockEditor_namespaceObject.privateApis 19888 ); 19889 function ScreenBackground() { 19890 const [settings] = screen_background_useGlobalSetting(""); 19891 const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings); 19892 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19893 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19894 header_default, 19895 { 19896 title: (0,external_wp_i18n_namespaceObject.__)("Background"), 19897 description: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Set styles for the site\u2019s background.") }) 19898 } 19899 ), 19900 hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {}) 19901 ] }); 19902 } 19903 var screen_background_default = ScreenBackground; 19904 19905 19906 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/confirm-reset-shadow-dialog.js 19907 19908 19909 19910 function ConfirmResetShadowDialog({ 19911 text, 19912 confirmButtonText, 19913 isOpen, 19914 toggleOpen, 19915 onConfirm 19916 }) { 19917 const handleConfirm = async () => { 19918 toggleOpen(); 19919 onConfirm(); 19920 }; 19921 const handleCancel = () => { 19922 toggleOpen(); 19923 }; 19924 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19925 external_wp_components_namespaceObject.__experimentalConfirmDialog, 19926 { 19927 isOpen, 19928 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), 19929 confirmButtonText, 19930 onCancel: handleCancel, 19931 onConfirm: handleConfirm, 19932 size: "medium", 19933 children: text 19934 } 19935 ); 19936 } 19937 var confirm_reset_shadow_dialog_default = ConfirmResetShadowDialog; 19938 19939 19940 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 const { useGlobalSetting: shadows_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19954 const { Menu: shadows_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis); 19955 const defaultShadow = "6px 6px 9px rgba(0, 0, 0, 0.2)"; 19956 function ShadowsPanel() { 19957 const [defaultShadows] = shadows_panel_useGlobalSetting("shadow.presets.default"); 19958 const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting( 19959 "shadow.defaultPresets" 19960 ); 19961 const [themeShadows] = shadows_panel_useGlobalSetting("shadow.presets.theme"); 19962 const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting( 19963 "shadow.presets.custom" 19964 ); 19965 const onCreateShadow = (shadow) => { 19966 setCustomShadows([...customShadows || [], shadow]); 19967 }; 19968 const handleResetShadows = () => { 19969 setCustomShadows([]); 19970 }; 19971 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false); 19972 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); 19973 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19974 isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19975 confirm_reset_shadow_dialog_default, 19976 { 19977 text: (0,external_wp_i18n_namespaceObject.__)( 19978 "Are you sure you want to remove all custom shadows?" 19979 ), 19980 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Remove"), 19981 isOpen: isResetDialogOpen, 19982 toggleOpen: toggleResetDialog, 19983 onConfirm: handleResetShadows 19984 } 19985 ), 19986 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19987 header_default, 19988 { 19989 title: (0,external_wp_i18n_namespaceObject.__)("Shadows"), 19990 description: (0,external_wp_i18n_namespaceObject.__)( 19991 "Manage and create shadow styles for use across the site." 19992 ) 19993 } 19994 ), 19995 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 19996 external_wp_components_namespaceObject.__experimentalVStack, 19997 { 19998 className: "edit-site-global-styles__shadows-panel", 19999 spacing: 7, 20000 children: [ 20001 defaultShadowsEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20002 ShadowList, 20003 { 20004 label: (0,external_wp_i18n_namespaceObject.__)("Default"), 20005 shadows: defaultShadows || [], 20006 category: "default" 20007 } 20008 ), 20009 themeShadows && themeShadows.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20010 ShadowList, 20011 { 20012 label: (0,external_wp_i18n_namespaceObject.__)("Theme"), 20013 shadows: themeShadows || [], 20014 category: "theme" 20015 } 20016 ), 20017 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20018 ShadowList, 20019 { 20020 label: (0,external_wp_i18n_namespaceObject.__)("Custom"), 20021 shadows: customShadows || [], 20022 category: "custom", 20023 canCreate: true, 20024 onCreate: onCreateShadow, 20025 onReset: toggleResetDialog 20026 } 20027 ) 20028 ] 20029 } 20030 ) }) 20031 ] }); 20032 } 20033 function ShadowList({ 20034 label, 20035 shadows, 20036 category, 20037 canCreate, 20038 onCreate, 20039 onReset 20040 }) { 20041 const handleAddShadow = () => { 20042 const newIndex = getNewIndexFromPresets(shadows, "shadow-"); 20043 onCreate({ 20044 name: (0,external_wp_i18n_namespaceObject.sprintf)( 20045 /* translators: %s: is an index for a preset */ 20046 (0,external_wp_i18n_namespaceObject.__)("Shadow %s"), 20047 newIndex 20048 ), 20049 shadow: defaultShadow, 20050 slug: `shadow-$newIndex}` 20051 }); 20052 }; 20053 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ 20054 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 20055 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }), 20056 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: [ 20057 canCreate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20058 external_wp_components_namespaceObject.Button, 20059 { 20060 size: "small", 20061 icon: plus_default, 20062 label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"), 20063 onClick: () => { 20064 handleAddShadow(); 20065 } 20066 } 20067 ), 20068 !!shadows?.length && category === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_panel_Menu, { children: [ 20069 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20070 shadows_panel_Menu.TriggerButton, 20071 { 20072 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20073 external_wp_components_namespaceObject.Button, 20074 { 20075 size: "small", 20076 icon: more_vertical_default, 20077 label: (0,external_wp_i18n_namespaceObject.__)("Shadow options") 20078 } 20079 ) 20080 } 20081 ), 20082 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Item, { onClick: onReset, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Remove all custom shadows") }) }) }) 20083 ] }) 20084 ] }) 20085 ] }), 20086 shadows.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadows.map((shadow) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20087 ShadowItem, 20088 { 20089 shadow, 20090 category 20091 }, 20092 shadow.slug 20093 )) }) 20094 ] }); 20095 } 20096 function ShadowItem({ shadow, category }) { 20097 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20098 NavigationButtonAsItem, 20099 { 20100 path: `/shadows/edit/$category}/$shadow.slug}`, 20101 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 20102 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: shadow.name }), 20103 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) 20104 ] }) 20105 } 20106 ); 20107 } 20108 20109 20110 ;// ./node_modules/@wordpress/icons/build-module/library/reset.js 20111 20112 20113 var reset_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) }); 20114 20115 20116 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js 20117 const CUSTOM_VALUE_SETTINGS = { 20118 px: { max: 20, step: 1 }, 20119 "%": { max: 100, step: 1 }, 20120 vw: { max: 100, step: 1 }, 20121 vh: { max: 100, step: 1 }, 20122 em: { max: 10, step: 0.1 }, 20123 rm: { max: 10, step: 0.1 }, 20124 svw: { max: 100, step: 1 }, 20125 lvw: { max: 100, step: 1 }, 20126 dvw: { max: 100, step: 1 }, 20127 svh: { max: 100, step: 1 }, 20128 lvh: { max: 100, step: 1 }, 20129 dvh: { max: 100, step: 1 }, 20130 vi: { max: 100, step: 1 }, 20131 svi: { max: 100, step: 1 }, 20132 lvi: { max: 100, step: 1 }, 20133 dvi: { max: 100, step: 1 }, 20134 vb: { max: 100, step: 1 }, 20135 svb: { max: 100, step: 1 }, 20136 lvb: { max: 100, step: 1 }, 20137 dvb: { max: 100, step: 1 }, 20138 vmin: { max: 100, step: 1 }, 20139 svmin: { max: 100, step: 1 }, 20140 lvmin: { max: 100, step: 1 }, 20141 dvmin: { max: 100, step: 1 }, 20142 vmax: { max: 100, step: 1 }, 20143 svmax: { max: 100, step: 1 }, 20144 lvmax: { max: 100, step: 1 }, 20145 dvmax: { max: 100, step: 1 } 20146 }; 20147 function getShadowParts(shadow) { 20148 const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || []; 20149 return shadowValues.map((value) => value.trim()); 20150 } 20151 function shadowStringToObject(shadowValue) { 20152 const defaultShadow = { 20153 x: "0", 20154 y: "0", 20155 blur: "0", 20156 spread: "0", 20157 color: "#000", 20158 inset: false 20159 }; 20160 if (!shadowValue) { 20161 return defaultShadow; 20162 } 20163 if (shadowValue.includes("none")) { 20164 return defaultShadow; 20165 } 20166 const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g; 20167 const matches = shadowValue.match(lengthsRegex) || []; 20168 if (matches.length !== 1) { 20169 return defaultShadow; 20170 } 20171 const lengths = matches[0].split(" ").map((value) => value.trim()).filter((value) => value); 20172 if (lengths.length < 2) { 20173 return defaultShadow; 20174 } 20175 const insets = shadowValue.match(/inset/gi) || []; 20176 if (insets.length > 1) { 20177 return defaultShadow; 20178 } 20179 const hasInset = insets.length === 1; 20180 let colorString = shadowValue.replace(lengthsRegex, "").trim(); 20181 if (hasInset) { 20182 colorString = colorString.replace("inset", "").replace("INSET", "").trim(); 20183 } 20184 const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi; 20185 let colorMatches = (colorString.match(colorRegex) || []).map((value) => value?.trim()).filter((value) => value); 20186 if (colorMatches.length > 1) { 20187 return defaultShadow; 20188 } else if (colorMatches.length === 0) { 20189 colorMatches = colorString.trim().split(" ").filter((value) => value); 20190 if (colorMatches.length > 1) { 20191 return defaultShadow; 20192 } 20193 } 20194 const [x, y, blur, spread] = lengths; 20195 return { 20196 x, 20197 y, 20198 blur: blur || defaultShadow.blur, 20199 spread: spread || defaultShadow.spread, 20200 inset: hasInset, 20201 color: colorString || defaultShadow.color 20202 }; 20203 } 20204 function shadowObjectToString(shadowObj) { 20205 const shadowString = `$shadowObj.x || "0px"} $shadowObj.y || "0px"} $shadowObj.blur || "0px"} $shadowObj.spread || "0px"}`; 20206 return `$shadowObj.inset ? "inset" : ""} $shadowString} $shadowObj.color || ""}`.trim(); 20207 } 20208 20209 20210 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 const { useGlobalSetting: shadows_edit_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20224 const { Menu: shadows_edit_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis); 20225 const customShadowMenuItems = [ 20226 { 20227 label: (0,external_wp_i18n_namespaceObject.__)("Rename"), 20228 action: "rename" 20229 }, 20230 { 20231 label: (0,external_wp_i18n_namespaceObject.__)("Delete"), 20232 action: "delete" 20233 } 20234 ]; 20235 const presetShadowMenuItems = [ 20236 { 20237 label: (0,external_wp_i18n_namespaceObject.__)("Reset"), 20238 action: "reset" 20239 } 20240 ]; 20241 function ShadowsEditPanel() { 20242 const { 20243 goBack, 20244 params: { category, slug } 20245 } = (0,external_wp_components_namespaceObject.useNavigator)(); 20246 const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting( 20247 `shadow.presets.$category}` 20248 ); 20249 (0,external_wp_element_.useEffect)(() => { 20250 const hasCurrentShadow = shadows?.some( 20251 (shadow) => shadow.slug === slug 20252 ); 20253 if (!!slug && !hasCurrentShadow) { 20254 goBack(); 20255 } 20256 }, [shadows, slug, goBack]); 20257 const [baseShadows] = shadows_edit_panel_useGlobalSetting( 20258 `shadow.presets.$category}`, 20259 void 0, 20260 "base" 20261 ); 20262 const [selectedShadow, setSelectedShadow] = (0,external_wp_element_.useState)( 20263 () => (shadows || []).find((shadow) => shadow.slug === slug) 20264 ); 20265 const baseSelectedShadow = (0,external_wp_element_.useMemo)( 20266 () => (baseShadows || []).find((b) => b.slug === slug), 20267 [baseShadows, slug] 20268 ); 20269 const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_.useState)(false); 20270 const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_.useState)(false); 20271 const [shadowName, setShadowName] = (0,external_wp_element_.useState)(selectedShadow.name); 20272 if (!category || !slug) { 20273 return null; 20274 } 20275 const onShadowChange = (shadow) => { 20276 setSelectedShadow({ ...selectedShadow, shadow }); 20277 const updatedShadows = shadows.map( 20278 (s) => s.slug === slug ? { ...selectedShadow, shadow } : s 20279 ); 20280 setShadows(updatedShadows); 20281 }; 20282 const onMenuClick = (action) => { 20283 if (action === "reset") { 20284 const updatedShadows = shadows.map( 20285 (s) => s.slug === slug ? baseSelectedShadow : s 20286 ); 20287 setSelectedShadow(baseSelectedShadow); 20288 setShadows(updatedShadows); 20289 } else if (action === "delete") { 20290 setIsConfirmDialogVisible(true); 20291 } else if (action === "rename") { 20292 setIsRenameModalVisible(true); 20293 } 20294 }; 20295 const handleShadowDelete = () => { 20296 setShadows(shadows.filter((s) => s.slug !== slug)); 20297 }; 20298 const handleShadowRename = (newName) => { 20299 if (!newName) { 20300 return; 20301 } 20302 const updatedShadows = shadows.map( 20303 (s) => s.slug === slug ? { ...selectedShadow, name: newName } : s 20304 ); 20305 setSelectedShadow({ ...selectedShadow, name: newName }); 20306 setShadows(updatedShadows); 20307 }; 20308 return !selectedShadow ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: "" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20309 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 20310 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: selectedShadow.name }), 20311 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginTop: 2, marginBottom: 0, paddingX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_edit_panel_Menu, { children: [ 20312 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20313 shadows_edit_panel_Menu.TriggerButton, 20314 { 20315 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20316 external_wp_components_namespaceObject.Button, 20317 { 20318 size: "small", 20319 icon: more_vertical_default, 20320 label: (0,external_wp_i18n_namespaceObject.__)("Menu") 20321 } 20322 ) 20323 } 20324 ), 20325 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Popover, { children: (category === "custom" ? customShadowMenuItems : presetShadowMenuItems).map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20326 shadows_edit_panel_Menu.Item, 20327 { 20328 onClick: () => onMenuClick(item.action), 20329 disabled: item.action === "reset" && selectedShadow.shadow === baseSelectedShadow.shadow, 20330 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.ItemLabel, { children: item.label }) 20331 }, 20332 item.action 20333 )) }) 20334 ] }) }) }) 20335 ] }), 20336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-global-styles-screen", children: [ 20337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { shadow: selectedShadow.shadow }), 20338 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20339 ShadowEditor, 20340 { 20341 shadow: selectedShadow.shadow, 20342 onChange: onShadowChange 20343 } 20344 ) 20345 ] }), 20346 isConfirmDialogVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20347 external_wp_components_namespaceObject.__experimentalConfirmDialog, 20348 { 20349 isOpen: true, 20350 onConfirm: () => { 20351 handleShadowDelete(); 20352 setIsConfirmDialogVisible(false); 20353 }, 20354 onCancel: () => { 20355 setIsConfirmDialogVisible(false); 20356 }, 20357 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), 20358 size: "medium", 20359 children: (0,external_wp_i18n_namespaceObject.sprintf)( 20360 /* translators: %s: Name of the shadow preset. */ 20361 (0,external_wp_i18n_namespaceObject.__)( 20362 'Are you sure you want to delete "%s" shadow preset?' 20363 ), 20364 selectedShadow.name 20365 ) 20366 } 20367 ), 20368 isRenameModalVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20369 external_wp_components_namespaceObject.Modal, 20370 { 20371 title: (0,external_wp_i18n_namespaceObject.__)("Rename"), 20372 onRequestClose: () => setIsRenameModalVisible(false), 20373 size: "small", 20374 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20375 "form", 20376 { 20377 onSubmit: (event) => { 20378 event.preventDefault(); 20379 handleShadowRename(shadowName); 20380 setIsRenameModalVisible(false); 20381 }, 20382 children: [ 20383 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20384 external_wp_components_namespaceObject.__experimentalInputControl, 20385 { 20386 __next40pxDefaultSize: true, 20387 autoComplete: "off", 20388 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 20389 placeholder: (0,external_wp_i18n_namespaceObject.__)("Shadow name"), 20390 value: shadowName, 20391 onChange: (value) => setShadowName(value) 20392 } 20393 ), 20394 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 6 }), 20395 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20396 external_wp_components_namespaceObject.Flex, 20397 { 20398 className: "block-editor-shadow-edit-modal__actions", 20399 justify: "flex-end", 20400 expanded: false, 20401 children: [ 20402 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20403 external_wp_components_namespaceObject.Button, 20404 { 20405 __next40pxDefaultSize: true, 20406 variant: "tertiary", 20407 onClick: () => setIsRenameModalVisible(false), 20408 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 20409 } 20410 ) }), 20411 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20412 external_wp_components_namespaceObject.Button, 20413 { 20414 __next40pxDefaultSize: true, 20415 variant: "primary", 20416 type: "submit", 20417 children: (0,external_wp_i18n_namespaceObject.__)("Save") 20418 } 20419 ) }) 20420 ] 20421 } 20422 ) 20423 ] 20424 } 20425 ) 20426 } 20427 ) 20428 ] }); 20429 } 20430 function ShadowsPreview({ shadow }) { 20431 const shadowStyle = { 20432 boxShadow: shadow 20433 }; 20434 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 4, marginTop: -2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20435 external_wp_components_namespaceObject.__experimentalHStack, 20436 { 20437 align: "center", 20438 justify: "center", 20439 className: "edit-site-global-styles__shadow-preview-panel", 20440 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20441 "div", 20442 { 20443 className: "edit-site-global-styles__shadow-preview-block", 20444 style: shadowStyle 20445 } 20446 ) 20447 } 20448 ) }); 20449 } 20450 function ShadowEditor({ shadow, onChange }) { 20451 const addShadowButtonRef = (0,external_wp_element_.useRef)(); 20452 const shadowParts = (0,external_wp_element_.useMemo)(() => getShadowParts(shadow), [shadow]); 20453 const onChangeShadowPart = (index, part) => { 20454 const newShadowParts = [...shadowParts]; 20455 newShadowParts[index] = part; 20456 onChange(newShadowParts.join(", ")); 20457 }; 20458 const onAddShadowPart = () => { 20459 onChange([...shadowParts, defaultShadow].join(", ")); 20460 }; 20461 const onRemoveShadowPart = (index) => { 20462 onChange(shadowParts.filter((p, i) => i !== index).join(", ")); 20463 addShadowButtonRef.current.focus(); 20464 }; 20465 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20466 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ 20467 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }), 20468 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20469 external_wp_components_namespaceObject.Button, 20470 { 20471 size: "small", 20472 icon: plus_default, 20473 label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"), 20474 onClick: () => { 20475 onAddShadowPart(); 20476 }, 20477 ref: addShadowButtonRef 20478 } 20479 ) }) 20480 ] }) }), 20481 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), 20482 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadowParts.map((part, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20483 shadows_edit_panel_ShadowItem, 20484 { 20485 shadow: part, 20486 onChange: (value) => onChangeShadowPart(index, value), 20487 canRemove: shadowParts.length > 1, 20488 onRemove: () => onRemoveShadowPart(index) 20489 }, 20490 index 20491 )) }) 20492 ] }); 20493 } 20494 function shadows_edit_panel_ShadowItem({ shadow, onChange, canRemove, onRemove }) { 20495 const popoverProps = { 20496 placement: "left-start", 20497 offset: 36, 20498 shift: true 20499 }; 20500 const shadowObj = (0,external_wp_element_.useMemo)( 20501 () => shadowStringToObject(shadow), 20502 [shadow] 20503 ); 20504 const onShadowChange = (newShadow) => { 20505 onChange(shadowObjectToString(newShadow)); 20506 }; 20507 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20508 external_wp_components_namespaceObject.Dropdown, 20509 { 20510 popoverProps, 20511 className: "edit-site-global-styles__shadow-editor__dropdown", 20512 renderToggle: ({ onToggle, isOpen }) => { 20513 const toggleProps = { 20514 onClick: onToggle, 20515 className: dist_clsx( 20516 "edit-site-global-styles__shadow-editor__dropdown-toggle", 20517 { "is-open": isOpen } 20518 ), 20519 "aria-expanded": isOpen 20520 }; 20521 const removeButtonProps = { 20522 onClick: () => { 20523 if (isOpen) { 20524 onToggle(); 20525 } 20526 onRemove(); 20527 }, 20528 className: dist_clsx( 20529 "edit-site-global-styles__shadow-editor__remove-button", 20530 { "is-open": isOpen } 20531 ), 20532 label: (0,external_wp_i18n_namespaceObject.__)("Remove shadow") 20533 }; 20534 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20535 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20536 external_wp_components_namespaceObject.Button, 20537 { 20538 __next40pxDefaultSize: true, 20539 icon: shadow_default, 20540 ...toggleProps, 20541 children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)("Inner shadow") : (0,external_wp_i18n_namespaceObject.__)("Drop shadow") 20542 } 20543 ), 20544 canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20545 external_wp_components_namespaceObject.Button, 20546 { 20547 size: "small", 20548 icon: reset_default, 20549 ...removeButtonProps 20550 } 20551 ) 20552 ] }); 20553 }, 20554 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20555 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, 20556 { 20557 paddingSize: "medium", 20558 className: "edit-site-global-styles__shadow-editor__dropdown-content", 20559 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20560 ShadowPopover, 20561 { 20562 shadowObj, 20563 onChange: onShadowChange 20564 } 20565 ) 20566 } 20567 ) 20568 } 20569 ); 20570 } 20571 function ShadowPopover({ shadowObj, onChange }) { 20572 const __experimentalIsRenderedInSidebar = true; 20573 const enableAlpha = true; 20574 const onShadowChange = (key, value) => { 20575 const newShadow = { 20576 ...shadowObj, 20577 [key]: value 20578 }; 20579 onChange(newShadow); 20580 }; 20581 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20582 external_wp_components_namespaceObject.__experimentalVStack, 20583 { 20584 spacing: 4, 20585 className: "edit-site-global-styles__shadow-editor-panel", 20586 children: [ 20587 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20588 external_wp_components_namespaceObject.ColorPalette, 20589 { 20590 clearable: false, 20591 enableAlpha, 20592 __experimentalIsRenderedInSidebar, 20593 value: shadowObj.color, 20594 onChange: (value) => onShadowChange("color", value) 20595 } 20596 ), 20597 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20598 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 20599 { 20600 __nextHasNoMarginBottom: true, 20601 value: shadowObj.inset ? "inset" : "outset", 20602 isBlock: true, 20603 onChange: (value) => onShadowChange("inset", value === "inset"), 20604 hideLabelFromVision: true, 20605 __next40pxDefaultSize: true, 20606 children: [ 20607 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20608 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 20609 { 20610 value: "outset", 20611 label: (0,external_wp_i18n_namespaceObject.__)("Outset") 20612 } 20613 ), 20614 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20615 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 20616 { 20617 value: "inset", 20618 label: (0,external_wp_i18n_namespaceObject.__)("Inset") 20619 } 20620 ) 20621 ] 20622 } 20623 ), 20624 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, gap: 4, children: [ 20625 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20626 ShadowInputControl, 20627 { 20628 label: (0,external_wp_i18n_namespaceObject.__)("X Position"), 20629 value: shadowObj.x, 20630 onChange: (value) => onShadowChange("x", value) 20631 } 20632 ), 20633 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20634 ShadowInputControl, 20635 { 20636 label: (0,external_wp_i18n_namespaceObject.__)("Y Position"), 20637 value: shadowObj.y, 20638 onChange: (value) => onShadowChange("y", value) 20639 } 20640 ), 20641 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20642 ShadowInputControl, 20643 { 20644 label: (0,external_wp_i18n_namespaceObject.__)("Blur"), 20645 value: shadowObj.blur, 20646 onChange: (value) => onShadowChange("blur", value) 20647 } 20648 ), 20649 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20650 ShadowInputControl, 20651 { 20652 label: (0,external_wp_i18n_namespaceObject.__)("Spread"), 20653 value: shadowObj.spread, 20654 onChange: (value) => onShadowChange("spread", value) 20655 } 20656 ) 20657 ] }) 20658 ] 20659 } 20660 ); 20661 } 20662 function ShadowInputControl({ label, value, onChange }) { 20663 const onValueChange = (next) => { 20664 const isNumeric = next !== void 0 && !isNaN(parseFloat(next)); 20665 const nextValue = isNumeric ? next : "0px"; 20666 onChange(nextValue); 20667 }; 20668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20669 external_wp_components_namespaceObject.__experimentalUnitControl, 20670 { 20671 label, 20672 __next40pxDefaultSize: true, 20673 value, 20674 onChange: onValueChange 20675 } 20676 ); 20677 } 20678 20679 20680 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js 20681 20682 20683 20684 function ScreenShadows() { 20685 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {}); 20686 } 20687 function ScreenShadowsEdit() { 20688 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {}); 20689 } 20690 20691 20692 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js 20693 20694 20695 20696 20697 const { 20698 useGlobalStyle: dimensions_panel_useGlobalStyle, 20699 useGlobalSetting: dimensions_panel_useGlobalSetting, 20700 useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement, 20701 DimensionsPanel: dimensions_panel_StylesDimensionsPanel 20702 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20703 const DEFAULT_CONTROLS = { 20704 contentSize: true, 20705 wideSize: true, 20706 padding: true, 20707 margin: true, 20708 blockGap: true, 20709 minHeight: true, 20710 childLayout: false 20711 }; 20712 function DimensionsPanel() { 20713 const [style] = dimensions_panel_useGlobalStyle("", void 0, "user", { 20714 shouldDecodeEncode: false 20715 }); 20716 const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle("", void 0, "all", { 20717 shouldDecodeEncode: false 20718 }); 20719 const [userSettings] = dimensions_panel_useGlobalSetting("", void 0, "user"); 20720 const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting(""); 20721 const settings = dimensions_panel_useSettingsForBlockElement(rawSettings); 20722 const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => { 20723 return { 20724 ...inheritedStyle, 20725 layout: settings.layout 20726 }; 20727 }, [inheritedStyle, settings.layout]); 20728 const styleWithLayout = (0,external_wp_element_.useMemo)(() => { 20729 return { 20730 ...style, 20731 layout: userSettings.layout 20732 }; 20733 }, [style, userSettings.layout]); 20734 const onChange = (newStyle) => { 20735 const updatedStyle = { ...newStyle }; 20736 delete updatedStyle.layout; 20737 setStyle(updatedStyle); 20738 if (newStyle.layout !== userSettings.layout) { 20739 const updatedSettings = { 20740 ...userSettings, 20741 layout: newStyle.layout 20742 }; 20743 if (updatedSettings.layout?.definitions) { 20744 delete updatedSettings.layout.definitions; 20745 } 20746 setSettings(updatedSettings); 20747 } 20748 }; 20749 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20750 dimensions_panel_StylesDimensionsPanel, 20751 { 20752 inheritedValue: inheritedStyleWithLayout, 20753 value: styleWithLayout, 20754 onChange, 20755 settings, 20756 includeLayoutControls: true, 20757 defaultControls: DEFAULT_CONTROLS 20758 } 20759 ); 20760 } 20761 20762 20763 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js 20764 20765 20766 20767 20768 20769 20770 const { useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, useGlobalSetting: screen_layout_useGlobalSetting, useSettingsForBlockElement: screen_layout_useSettingsForBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20771 function ScreenLayout() { 20772 const [rawSettings] = screen_layout_useGlobalSetting(""); 20773 const settings = screen_layout_useSettingsForBlockElement(rawSettings); 20774 const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings); 20775 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20776 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Layout") }), 20777 hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {}) 20778 ] }); 20779 } 20780 var screen_layout_default = ScreenLayout; 20781 20782 20783 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js 20784 20785 20786 20787 20788 20789 20790 20791 20792 20793 20794 20795 const { GlobalStylesContext: style_variations_container_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20796 function StyleVariationsContainer({ gap = 2 }) { 20797 const { user } = (0,external_wp_element_.useContext)(style_variations_container_GlobalStylesContext); 20798 const userStyles = user?.styles; 20799 const variations = (0,external_wp_data_.useSelect)((select) => { 20800 return select( 20801 external_wp_coreData_namespaceObject.store 20802 ).__experimentalGetCurrentThemeGlobalStylesVariations(); 20803 }, []); 20804 const fullStyleVariations = variations?.filter((variation) => { 20805 return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [ 20806 "typography", 20807 "spacing" 20808 ]); 20809 }); 20810 const themeVariations = (0,external_wp_element_.useMemo)(() => { 20811 const withEmptyVariation = [ 20812 { 20813 title: (0,external_wp_i18n_namespaceObject.__)("Default"), 20814 settings: {}, 20815 styles: {} 20816 }, 20817 ...fullStyleVariations ?? [] 20818 ]; 20819 return [ 20820 ...withEmptyVariation.map((variation) => { 20821 const blockStyles = { ...variation?.styles?.blocks }; 20822 if (userStyles?.blocks) { 20823 Object.keys(userStyles.blocks).forEach((blockName) => { 20824 if (userStyles.blocks[blockName].css) { 20825 const variationBlockStyles = blockStyles[blockName] || {}; 20826 const customCSS = { 20827 css: `$blockStyles[blockName]?.css || ""} $userStyles.blocks[blockName].css.trim() || ""}` 20828 }; 20829 blockStyles[blockName] = { 20830 ...variationBlockStyles, 20831 ...customCSS 20832 }; 20833 } 20834 }); 20835 } 20836 const css = userStyles?.css || variation.styles?.css ? { 20837 css: `$variation.styles?.css || ""} $userStyles?.css || ""}` 20838 } : {}; 20839 const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {}; 20840 const styles = { 20841 ...variation.styles, 20842 ...css, 20843 ...blocks 20844 }; 20845 return { 20846 ...variation, 20847 settings: variation.settings ?? {}, 20848 styles 20849 }; 20850 }) 20851 ]; 20852 }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); 20853 if (!fullStyleVariations || fullStyleVariations?.length < 1) { 20854 return null; 20855 } 20856 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20857 external_wp_components_namespaceObject.__experimentalGrid, 20858 { 20859 columns: 2, 20860 className: "edit-site-global-styles-style-variations-container", 20861 gap, 20862 children: themeVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20863 preview_styles_default, 20864 { 20865 label: variation?.title, 20866 withHoverView: true, 20867 isFocused, 20868 variation 20869 } 20870 ) }, index)) 20871 } 20872 ); 20873 } 20874 20875 20876 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js 20877 20878 20879 20880 20881 20882 20883 function SidebarNavigationScreenGlobalStylesContent() { 20884 const gap = 3; 20885 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20886 external_wp_components_namespaceObject.__experimentalVStack, 20887 { 20888 spacing: 10, 20889 className: "edit-site-global-styles-variation-container", 20890 children: [ 20891 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { gap }), 20892 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes"), gap }), 20893 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typography"), gap }) 20894 ] 20895 } 20896 ); 20897 } 20898 20899 20900 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js 20901 20902 20903 20904 20905 20906 20907 20908 20909 const { useZoomOut } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20910 function ScreenStyleVariations() { 20911 const isPreviewMode = (0,external_wp_data_.useSelect)((select) => { 20912 return select(external_wp_blockEditor_namespaceObject.store).getSettings().isPreviewMode; 20913 }, []); 20914 useZoomOut(!isPreviewMode); 20915 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20916 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20917 header_default, 20918 { 20919 title: (0,external_wp_i18n_namespaceObject.__)("Browse styles"), 20920 description: (0,external_wp_i18n_namespaceObject.__)( 20921 "Choose a variation to change the look of the site." 20922 ) 20923 } 20924 ), 20925 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20926 external_wp_components_namespaceObject.Card, 20927 { 20928 size: "small", 20929 isBorderless: true, 20930 className: "edit-site-global-styles-screen-style-variations", 20931 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) }) 20932 } 20933 ) 20934 ] }); 20935 } 20936 var screen_style_variations_default = ScreenStyleVariations; 20937 20938 20939 ;// external ["wp","mediaUtils"] 20940 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 20941 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/constants.js 20942 20943 const STYLE_BOOK_COLOR_GROUPS = [ 20944 { 20945 slug: "theme-colors", 20946 title: (0,external_wp_i18n_namespaceObject.__)("Theme Colors"), 20947 origin: "theme", 20948 type: "colors" 20949 }, 20950 { 20951 slug: "theme-gradients", 20952 title: (0,external_wp_i18n_namespaceObject.__)("Theme Gradients"), 20953 origin: "theme", 20954 type: "gradients" 20955 }, 20956 { 20957 slug: "custom-colors", 20958 title: (0,external_wp_i18n_namespaceObject.__)("Custom Colors"), 20959 origin: "custom", 20960 type: "colors" 20961 }, 20962 { 20963 slug: "custom-gradients", 20964 title: (0,external_wp_i18n_namespaceObject.__)("Custom Gradients"), 20965 origin: "custom", 20966 // User. 20967 type: "gradients" 20968 }, 20969 { 20970 slug: "duotones", 20971 title: (0,external_wp_i18n_namespaceObject.__)("Duotones"), 20972 origin: "theme", 20973 type: "duotones" 20974 }, 20975 { 20976 slug: "default-colors", 20977 title: (0,external_wp_i18n_namespaceObject.__)("Default Colors"), 20978 origin: "default", 20979 type: "colors" 20980 }, 20981 { 20982 slug: "default-gradients", 20983 title: (0,external_wp_i18n_namespaceObject.__)("Default Gradients"), 20984 origin: "default", 20985 type: "gradients" 20986 } 20987 ]; 20988 const STYLE_BOOK_THEME_SUBCATEGORIES = [ 20989 { 20990 slug: "site-identity", 20991 title: (0,external_wp_i18n_namespaceObject.__)("Site Identity"), 20992 blocks: ["core/site-logo", "core/site-title", "core/site-tagline"] 20993 }, 20994 { 20995 slug: "design", 20996 title: (0,external_wp_i18n_namespaceObject.__)("Design"), 20997 blocks: ["core/navigation", "core/avatar", "core/post-time-to-read"], 20998 exclude: ["core/home-link", "core/navigation-link"] 20999 }, 21000 { 21001 slug: "posts", 21002 title: (0,external_wp_i18n_namespaceObject.__)("Posts"), 21003 blocks: [ 21004 "core/post-title", 21005 "core/post-excerpt", 21006 "core/post-author", 21007 "core/post-author-name", 21008 "core/post-author-biography", 21009 "core/post-date", 21010 "core/post-terms", 21011 "core/term-description", 21012 "core/query-title", 21013 "core/query-no-results", 21014 "core/query-pagination", 21015 "core/query-numbers" 21016 ] 21017 }, 21018 { 21019 slug: "comments", 21020 title: (0,external_wp_i18n_namespaceObject.__)("Comments"), 21021 blocks: [ 21022 "core/comments-title", 21023 "core/comments-pagination", 21024 "core/comments-pagination-numbers", 21025 "core/comments", 21026 "core/comments-author-name", 21027 "core/comment-content", 21028 "core/comment-date", 21029 "core/comment-edit-link", 21030 "core/comment-reply-link", 21031 "core/comment-template", 21032 "core/post-comments-count", 21033 "core/post-comments-link" 21034 ] 21035 } 21036 ]; 21037 const STYLE_BOOK_CATEGORIES = [ 21038 { 21039 slug: "overview", 21040 title: (0,external_wp_i18n_namespaceObject.__)("Overview"), 21041 blocks: [] 21042 }, 21043 { 21044 slug: "text", 21045 title: (0,external_wp_i18n_namespaceObject.__)("Text"), 21046 blocks: [ 21047 "core/post-content", 21048 "core/home-link", 21049 "core/navigation-link" 21050 ] 21051 }, 21052 { 21053 slug: "colors", 21054 title: (0,external_wp_i18n_namespaceObject.__)("Colors"), 21055 blocks: [] 21056 }, 21057 { 21058 slug: "theme", 21059 title: (0,external_wp_i18n_namespaceObject.__)("Theme"), 21060 subcategories: STYLE_BOOK_THEME_SUBCATEGORIES 21061 }, 21062 { 21063 slug: "media", 21064 title: (0,external_wp_i18n_namespaceObject.__)("Media"), 21065 blocks: ["core/post-featured-image"] 21066 }, 21067 { 21068 slug: "widgets", 21069 title: (0,external_wp_i18n_namespaceObject.__)("Widgets"), 21070 blocks: [] 21071 }, 21072 { 21073 slug: "embed", 21074 title: (0,external_wp_i18n_namespaceObject.__)("Embeds"), 21075 include: [] 21076 } 21077 ]; 21078 const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [ 21079 ...STYLE_BOOK_THEME_SUBCATEGORIES, 21080 { 21081 slug: "media", 21082 title: (0,external_wp_i18n_namespaceObject.__)("Media"), 21083 blocks: ["core/post-featured-image"] 21084 }, 21085 { 21086 slug: "widgets", 21087 title: (0,external_wp_i18n_namespaceObject.__)("Widgets"), 21088 blocks: [] 21089 }, 21090 { 21091 slug: "embed", 21092 title: (0,external_wp_i18n_namespaceObject.__)("Embeds"), 21093 include: [] 21094 } 21095 ]; 21096 const STYLE_BOOK_PREVIEW_CATEGORIES = [ 21097 { 21098 slug: "overview", 21099 title: (0,external_wp_i18n_namespaceObject.__)("Overview"), 21100 blocks: [] 21101 }, 21102 { 21103 slug: "text", 21104 title: (0,external_wp_i18n_namespaceObject.__)("Text"), 21105 blocks: [ 21106 "core/post-content", 21107 "core/home-link", 21108 "core/navigation-link" 21109 ] 21110 }, 21111 { 21112 slug: "colors", 21113 title: (0,external_wp_i18n_namespaceObject.__)("Colors"), 21114 blocks: [] 21115 }, 21116 { 21117 slug: "blocks", 21118 title: (0,external_wp_i18n_namespaceObject.__)("All Blocks"), 21119 blocks: [], 21120 subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES 21121 } 21122 ]; 21123 const ROOT_CONTAINER = ` 21124 .is-root-container { 21125 display: flow-root; 21126 } 21127 `; 21128 const STYLE_BOOK_IFRAME_STYLES = ` 21129 body { 21130 position: relative; 21131 padding: 32px !important; 21132 } 21133 21134 $ROOT_CONTAINER} 21135 21136 .edit-site-style-book__examples { 21137 max-width: 1200px; 21138 margin: 0 auto; 21139 } 21140 21141 .edit-site-style-book__example { 21142 max-width: 900px; 21143 border-radius: 2px; 21144 cursor: pointer; 21145 display: flex; 21146 flex-direction: column; 21147 gap: 40px; 21148 padding: 16px; 21149 width: 100%; 21150 box-sizing: border-box; 21151 scroll-margin-top: 32px; 21152 scroll-margin-bottom: 32px; 21153 margin: 0 auto 40px auto; 21154 } 21155 21156 .edit-site-style-book__example.is-selected { 21157 box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 21158 } 21159 21160 .edit-site-style-book__example.is-disabled-example { 21161 pointer-events: none; 21162 } 21163 21164 .edit-site-style-book__example:focus:not(:disabled) { 21165 box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 21166 outline: 3px solid transparent; 21167 } 21168 21169 .edit-site-style-book__duotone-example > div:first-child { 21170 display: flex; 21171 aspect-ratio: 16 / 9; 21172 grid-row: span 1; 21173 grid-column: span 2; 21174 } 21175 .edit-site-style-book__duotone-example img { 21176 width: 100%; 21177 height: 100%; 21178 object-fit: cover; 21179 } 21180 .edit-site-style-book__duotone-example > div:not(:first-child) { 21181 height: 20px; 21182 border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 21183 } 21184 21185 .edit-site-style-book__color-example { 21186 border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 21187 } 21188 21189 .edit-site-style-book__subcategory-title, 21190 .edit-site-style-book__example-title { 21191 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 21192 font-size: 13px; 21193 font-weight: normal; 21194 line-height: normal; 21195 margin: 0; 21196 text-align: left; 21197 padding-top: 8px; 21198 border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 21199 color: color-mix( in srgb, currentColor 60%, transparent ); 21200 } 21201 21202 .edit-site-style-book__subcategory-title { 21203 font-size: 16px; 21204 margin-bottom: 40px; 21205 padding-bottom: 8px; 21206 } 21207 21208 .edit-site-style-book__example-preview { 21209 width: 100%; 21210 } 21211 21212 .edit-site-style-book__example-preview .block-editor-block-list__insertion-point, 21213 .edit-site-style-book__example-preview .block-list-appender { 21214 display: none; 21215 } 21216 :where(.is-root-container > .wp-block:first-child) { 21217 margin-top: 0; 21218 } 21219 :where(.is-root-container > .wp-block:last-child) { 21220 margin-bottom: 0; 21221 } 21222 `; 21223 21224 21225 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/categories.js 21226 21227 21228 function getExamplesByCategory(categoryDefinition, examples) { 21229 if (!categoryDefinition?.slug || !examples?.length) { 21230 return; 21231 } 21232 const categories = categoryDefinition?.subcategories ?? []; 21233 if (categories.length) { 21234 return categories.reduce( 21235 (acc, subcategoryDefinition) => { 21236 const subcategoryExamples = getExamplesByCategory( 21237 subcategoryDefinition, 21238 examples 21239 ); 21240 if (subcategoryExamples) { 21241 if (!acc.subcategories) { 21242 acc.subcategories = []; 21243 } 21244 acc.subcategories = [ 21245 ...acc.subcategories, 21246 subcategoryExamples 21247 ]; 21248 } 21249 return acc; 21250 }, 21251 { 21252 title: categoryDefinition.title, 21253 slug: categoryDefinition.slug 21254 } 21255 ); 21256 } 21257 const blocksToInclude = categoryDefinition?.blocks || []; 21258 const blocksToExclude = categoryDefinition?.exclude || []; 21259 const categoryExamples = examples.filter((example) => { 21260 return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name)); 21261 }); 21262 if (!categoryExamples.length) { 21263 return; 21264 } 21265 return { 21266 title: categoryDefinition.title, 21267 slug: categoryDefinition.slug, 21268 examples: categoryExamples 21269 }; 21270 } 21271 function getTopLevelStyleBookCategories() { 21272 const reservedCategories = [ 21273 ...STYLE_BOOK_THEME_SUBCATEGORIES, 21274 ...STYLE_BOOK_CATEGORIES 21275 ].map(({ slug }) => slug); 21276 const extraCategories = (0,external_wp_blocks_namespaceObject.getCategories)(); 21277 const extraCategoriesFiltered = extraCategories.filter( 21278 ({ slug }) => !reservedCategories.includes(slug) 21279 ); 21280 return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered]; 21281 } 21282 21283 21284 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/color-examples.js 21285 21286 21287 21288 21289 21290 const ColorExamples = ({ 21291 colors, 21292 type, 21293 templateColumns = "1fr 1fr", 21294 itemHeight = "52px" 21295 }) => { 21296 if (!colors) { 21297 return null; 21298 } 21299 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { templateColumns, rowGap: 8, columnGap: 16, children: colors.map((color) => { 21300 const className = type === "gradients" ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(color.slug) : (0,external_wp_blockEditor_namespaceObject.getColorClassName)("background-color", color.slug); 21301 const classes = dist_clsx( 21302 "edit-site-style-book__color-example", 21303 className 21304 ); 21305 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21306 external_wp_primitives_namespaceObject.View, 21307 { 21308 className: classes, 21309 style: { height: itemHeight } 21310 }, 21311 color.slug 21312 ); 21313 }) }); 21314 }; 21315 var color_examples_default = ColorExamples; 21316 21317 21318 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/duotone-examples.js 21319 21320 21321 21322 const DuotoneExamples = ({ 21323 duotones 21324 }) => { 21325 if (!duotones) { 21326 return null; 21327 } 21328 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, rowGap: 16, columnGap: 16, children: duotones.map((duotone) => { 21329 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21330 external_wp_components_namespaceObject.__experimentalGrid, 21331 { 21332 className: "edit-site-style-book__duotone-example", 21333 columns: 2, 21334 rowGap: 8, 21335 columnGap: 8, 21336 children: [ 21337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21338 "img", 21339 { 21340 alt: `Duotone example: $duotone.slug}`, 21341 src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg", 21342 style: { 21343 filter: `url(#wp-duotone-$duotone.slug})` 21344 } 21345 } 21346 ) }), 21347 duotone.colors.map((color) => { 21348 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21349 external_wp_primitives_namespaceObject.View, 21350 { 21351 className: "edit-site-style-book__color-example", 21352 style: { backgroundColor: color } 21353 }, 21354 color 21355 ); 21356 }) 21357 ] 21358 }, 21359 duotone.slug 21360 ); 21361 }) }); 21362 }; 21363 var duotone_examples_default = DuotoneExamples; 21364 21365 21366 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/examples.js 21367 21368 21369 21370 21371 21372 21373 function getColorExamples(colors) { 21374 if (!colors) { 21375 return []; 21376 } 21377 const examples = []; 21378 STYLE_BOOK_COLOR_GROUPS.forEach((group) => { 21379 const palette = colors[group.type]; 21380 const paletteFiltered = Array.isArray(palette) ? palette.find( 21381 (origin) => origin.slug === group.origin 21382 ) : void 0; 21383 if (paletteFiltered?.[group.type]) { 21384 const example = { 21385 name: group.slug, 21386 title: group.title, 21387 category: "colors" 21388 }; 21389 if (group.type === "duotones") { 21390 example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21391 duotone_examples_default, 21392 { 21393 duotones: paletteFiltered[group.type] 21394 } 21395 ); 21396 examples.push(example); 21397 } else { 21398 example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21399 color_examples_default, 21400 { 21401 colors: paletteFiltered[group.type], 21402 type: group.type 21403 } 21404 ); 21405 examples.push(example); 21406 } 21407 } 21408 }); 21409 return examples; 21410 } 21411 function getOverviewBlockExamples(colors) { 21412 const examples = []; 21413 const themePalette = Array.isArray(colors?.colors) ? colors.colors.find( 21414 (origin) => origin.slug === "theme" 21415 ) : void 0; 21416 if (themePalette) { 21417 const themeColorexample = { 21418 name: "theme-colors", 21419 title: (0,external_wp_i18n_namespaceObject.__)("Colors"), 21420 category: "overview", 21421 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21422 color_examples_default, 21423 { 21424 colors: themePalette.colors, 21425 type: "colors", 21426 templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))", 21427 itemHeight: "32px" 21428 } 21429 ) 21430 }; 21431 examples.push(themeColorexample); 21432 } 21433 const typographyBlockExamples = []; 21434 if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/heading")) { 21435 const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", { 21436 // translators: Typography example. Your local alphabet, numbers and some common special characters. 21437 content: (0,external_wp_i18n_namespaceObject.__)( 21438 `AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789X{(\u2026)},.-<>?!*&:/A@HELFO\u2122\xA9` 21439 ), 21440 level: 1 21441 }); 21442 typographyBlockExamples.push(headingBlock); 21443 } 21444 if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/paragraph")) { 21445 const firstParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", { 21446 content: (0,external_wp_i18n_namespaceObject.__)( 21447 `A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.` 21448 ) 21449 }); 21450 const secondParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", { 21451 content: (0,external_wp_i18n_namespaceObject.__)( 21452 `Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.` 21453 ) 21454 }); 21455 if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/group")) { 21456 const groupBlock = (0,external_wp_blocks_namespaceObject.createBlock)( 21457 "core/group", 21458 { 21459 layout: { 21460 type: "grid", 21461 columnCount: 2, 21462 minimumColumnWidth: "12rem" 21463 }, 21464 style: { 21465 spacing: { 21466 blockGap: "1.5rem" 21467 } 21468 } 21469 }, 21470 [firstParagraphBlock, secondParagraphBlock] 21471 ); 21472 typographyBlockExamples.push(groupBlock); 21473 } else { 21474 typographyBlockExamples.push(firstParagraphBlock); 21475 } 21476 } 21477 if (!!typographyBlockExamples.length) { 21478 examples.push({ 21479 name: "typography", 21480 title: (0,external_wp_i18n_namespaceObject.__)("Typography"), 21481 category: "overview", 21482 blocks: typographyBlockExamples 21483 }); 21484 } 21485 const otherBlockExamples = [ 21486 "core/image", 21487 "core/separator", 21488 "core/buttons", 21489 "core/pullquote", 21490 "core/search" 21491 ]; 21492 otherBlockExamples.forEach((blockName) => { 21493 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 21494 if (blockType && blockType.example) { 21495 const blockExample = { 21496 name: blockName, 21497 title: blockType.title, 21498 category: "overview", 21499 /* 21500 * CSS generated from style attributes will take precedence over global styles CSS, 21501 * so remove the style attribute from the example to ensure the example 21502 * demonstrates changes to global styles. 21503 */ 21504 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { 21505 ...blockType.example, 21506 attributes: { 21507 ...blockType.example.attributes, 21508 style: void 0 21509 } 21510 }) 21511 }; 21512 examples.push(blockExample); 21513 } 21514 }); 21515 return examples; 21516 } 21517 function getExamples(colors) { 21518 const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter((blockType) => { 21519 const { name, example, supports } = blockType; 21520 return name !== "core/heading" && !!example && supports?.inserter !== false; 21521 }).map((blockType) => ({ 21522 name: blockType.name, 21523 title: blockType.title, 21524 category: blockType.category, 21525 /* 21526 * CSS generated from style attributes will take precedence over global styles CSS, 21527 * so remove the style attribute from the example to ensure the example 21528 * demonstrates changes to global styles. 21529 */ 21530 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, { 21531 ...blockType.example, 21532 attributes: { 21533 ...blockType.example.attributes, 21534 style: void 0 21535 } 21536 }) 21537 })); 21538 const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)("core/heading"); 21539 if (!isHeadingBlockRegistered) { 21540 return nonHeadingBlockExamples; 21541 } 21542 const headingsExample = { 21543 name: "core/heading", 21544 title: (0,external_wp_i18n_namespaceObject.__)("Headings"), 21545 category: "text", 21546 blocks: [1, 2, 3, 4, 5, 6].map((level) => { 21547 return (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", { 21548 content: (0,external_wp_i18n_namespaceObject.sprintf)( 21549 // translators: %d: heading level e.g: "1", "2", "3" 21550 (0,external_wp_i18n_namespaceObject.__)("Heading %d"), 21551 level 21552 ), 21553 level 21554 }); 21555 }) 21556 }; 21557 const colorExamples = getColorExamples(colors); 21558 const overviewBlockExamples = getOverviewBlockExamples(colors); 21559 return [ 21560 headingsExample, 21561 ...colorExamples, 21562 ...nonHeadingBlockExamples, 21563 ...overviewBlockExamples 21564 ]; 21565 } 21566 21567 21568 ;// ./node_modules/@wordpress/admin-ui/build-module/page/header.js 21569 21570 21571 function Header({ 21572 breadcrumbs, 21573 badges, 21574 title, 21575 subTitle, 21576 actions 21577 }) { 21578 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "admin-ui-page__header", as: "header", children: [ 21579 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21580 external_wp_components_namespaceObject.__experimentalHStack, 21581 { 21582 className: "admin-ui-page__header-title", 21583 justify: "space-between", 21584 spacing: 2, 21585 children: [ 21586 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [ 21587 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { as: "h2", level: 3, weight: 500, truncate: true, children: title }), 21588 breadcrumbs, 21589 badges 21590 ] }), 21591 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21592 external_wp_components_namespaceObject.__experimentalHStack, 21593 { 21594 style: { width: "auto", flexShrink: 0 }, 21595 spacing: 2, 21596 className: "admin-ui-page__header-actions", 21597 children: actions 21598 } 21599 ) 21600 ] 21601 } 21602 ), 21603 subTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "admin-ui-page__header-subtitle", children: subTitle }) 21604 ] }); 21605 } 21606 21607 21608 ;// ./node_modules/@wordpress/admin-ui/build-module/page/index.js 21609 21610 21611 21612 21613 function Page({ 21614 breadcrumbs, 21615 badges, 21616 title, 21617 subTitle, 21618 children, 21619 className, 21620 actions, 21621 hasPadding = false 21622 }) { 21623 const classes = dist_clsx("admin-ui-page", className); 21624 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(navigable_region_default, { className: classes, ariaLabel: title, children: [ 21625 (title || breadcrumbs || badges) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21626 Header, 21627 { 21628 breadcrumbs, 21629 badges, 21630 title, 21631 subTitle, 21632 actions 21633 } 21634 ), 21635 hasPadding ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "admin-ui-page__content has-padding", children }) : children 21636 ] }); 21637 } 21638 var page_page_default = Page; 21639 21640 21641 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-global-styles-wrapper/index.js 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 21653 21654 21655 const { useLocation: sidebar_global_styles_wrapper_useLocation, useHistory: sidebar_global_styles_wrapper_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 21656 const GlobalStylesPageActions = ({ 21657 isStyleBookOpened, 21658 setIsStyleBookOpened, 21659 path 21660 }) => { 21661 const history = sidebar_global_styles_wrapper_useHistory(); 21662 const canEditCSS = (0,external_wp_data_.useSelect)((select) => { 21663 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); 21664 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 21665 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; 21666 return !!globalStyles?._links?.["wp:action-edit-css"]; 21667 }, []); 21668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 21669 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21670 external_wp_components_namespaceObject.Button, 21671 { 21672 isPressed: isStyleBookOpened, 21673 icon: seen_default, 21674 label: (0,external_wp_i18n_namespaceObject.__)("Style Book"), 21675 onClick: () => { 21676 setIsStyleBookOpened(!isStyleBookOpened); 21677 const updatedPath = !isStyleBookOpened ? (0,external_wp_url_namespaceObject.addQueryArgs)(path, { preview: "stylebook" }) : (0,external_wp_url_namespaceObject.removeQueryArgs)(path, "preview"); 21678 history.navigate(updatedPath); 21679 }, 21680 size: "compact" 21681 } 21682 ), 21683 canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21684 external_wp_components_namespaceObject.DropdownMenu, 21685 { 21686 icon: more_vertical_default, 21687 label: (0,external_wp_i18n_namespaceObject.__)("More"), 21688 toggleProps: { size: "compact" }, 21689 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21690 external_wp_components_namespaceObject.MenuItem, 21691 { 21692 onClick: () => { 21693 onClose(); 21694 history.navigate( 21695 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 21696 section: "/css" 21697 }) 21698 ); 21699 }, 21700 children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS") 21701 } 21702 ) }) 21703 } 21704 ) 21705 ] }); 21706 }; 21707 const useSection = () => { 21708 const { path, query } = sidebar_global_styles_wrapper_useLocation(); 21709 const history = sidebar_global_styles_wrapper_useHistory(); 21710 return (0,external_wp_element_.useMemo)(() => { 21711 return [ 21712 query.section ?? "/", 21713 (updatedSection) => { 21714 history.navigate( 21715 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 21716 section: updatedSection 21717 }) 21718 ); 21719 } 21720 ]; 21721 }, [path, query.section, history]); 21722 }; 21723 function GlobalStylesUIWrapper() { 21724 const { path } = sidebar_global_styles_wrapper_useLocation(); 21725 const [isStyleBookOpened, setIsStyleBookOpened] = (0,external_wp_element_.useState)( 21726 path.includes("preview=stylebook") 21727 ); 21728 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 21729 const [section, onChangeSection] = useSection(); 21730 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21731 page_page_default, 21732 { 21733 actions: !isMobileViewport ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21734 GlobalStylesPageActions, 21735 { 21736 isStyleBookOpened, 21737 setIsStyleBookOpened, 21738 path 21739 } 21740 ) : null, 21741 className: "edit-site-styles", 21742 title: (0,external_wp_i18n_namespaceObject.__)("Styles"), 21743 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { path: section, onPathChange: onChangeSection }) 21744 } 21745 ); 21746 } 21747 21748 21749 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js 21750 21751 21752 21753 21754 21755 21756 21757 21758 21759 21760 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 const { 21772 ExperimentalBlockEditorProvider, 21773 useGlobalStyle: style_book_useGlobalStyle, 21774 GlobalStylesContext: style_book_GlobalStylesContext, 21775 useGlobalStylesOutputWithConfig 21776 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21777 const { mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); 21778 const { Tabs: style_book_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 21779 function isObjectEmpty(object) { 21780 return !object || Object.keys(object).length === 0; 21781 } 21782 const scrollToSection = (anchorId, iframe) => { 21783 if (!anchorId || !iframe || !iframe?.contentDocument) { 21784 return; 21785 } 21786 const element = anchorId === "top" ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId); 21787 if (element) { 21788 element.scrollIntoView({ 21789 behavior: "smooth" 21790 }); 21791 } 21792 }; 21793 const getStyleBookNavigationFromPath = (path) => { 21794 if (path && typeof path === "string") { 21795 if (path === "/" || path.startsWith("/typography") || path.startsWith("/colors") || path.startsWith("/blocks")) { 21796 return { 21797 top: true 21798 }; 21799 } 21800 } 21801 return null; 21802 }; 21803 function useMultiOriginPalettes() { 21804 const { colors, gradients } = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)(); 21805 const [ 21806 shouldDisplayDefaultDuotones, 21807 customDuotones, 21808 themeDuotones, 21809 defaultDuotones 21810 ] = (0,external_wp_blockEditor_namespaceObject.useSettings)( 21811 "color.defaultDuotone", 21812 "color.duotone.custom", 21813 "color.duotone.theme", 21814 "color.duotone.default" 21815 ); 21816 const palettes = (0,external_wp_element_.useMemo)(() => { 21817 const result = { colors, gradients, duotones: [] }; 21818 if (themeDuotones && themeDuotones.length) { 21819 result.duotones.push({ 21820 name: (0,external_wp_i18n_namespaceObject._x)( 21821 "Theme", 21822 "Indicates these duotone filters come from the theme." 21823 ), 21824 slug: "theme", 21825 duotones: themeDuotones 21826 }); 21827 } 21828 if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) { 21829 result.duotones.push({ 21830 name: (0,external_wp_i18n_namespaceObject._x)( 21831 "Default", 21832 "Indicates these duotone filters come from WordPress." 21833 ), 21834 slug: "default", 21835 duotones: defaultDuotones 21836 }); 21837 } 21838 if (customDuotones && customDuotones.length) { 21839 result.duotones.push({ 21840 name: (0,external_wp_i18n_namespaceObject._x)( 21841 "Custom", 21842 "Indicates these doutone filters are created by the user." 21843 ), 21844 slug: "custom", 21845 duotones: customDuotones 21846 }); 21847 } 21848 return result; 21849 }, [ 21850 colors, 21851 gradients, 21852 customDuotones, 21853 themeDuotones, 21854 defaultDuotones, 21855 shouldDisplayDefaultDuotones 21856 ]); 21857 return palettes; 21858 } 21859 function getExamplesForSinglePageUse(examples) { 21860 const examplesForSinglePageUse = []; 21861 const overviewCategoryExamples = getExamplesByCategory( 21862 { slug: "overview" }, 21863 examples 21864 ); 21865 examplesForSinglePageUse.push(...overviewCategoryExamples.examples); 21866 const otherExamples = examples.filter((example) => { 21867 return example.category !== "overview" && !overviewCategoryExamples.examples.find( 21868 (overviewExample) => overviewExample.name === example.name 21869 ); 21870 }); 21871 examplesForSinglePageUse.push(...otherExamples); 21872 return examplesForSinglePageUse; 21873 } 21874 function applyBlockVariationsToExamples(examples, variation) { 21875 if (!variation) { 21876 return examples; 21877 } 21878 return examples.map((example) => ({ 21879 ...example, 21880 variation, 21881 blocks: { 21882 ...example.blocks, 21883 attributes: { 21884 ...example.blocks.attributes, 21885 style: void 0, 21886 className: getVariationClassName(variation) 21887 } 21888 } 21889 })); 21890 } 21891 function StyleBook({ 21892 enableResizing = true, 21893 isSelected, 21894 onClick, 21895 onSelect, 21896 showCloseButton = true, 21897 onClose, 21898 showTabs = true, 21899 userConfig = {}, 21900 path = "" 21901 }) { 21902 const [textColor] = style_book_useGlobalStyle("color.text"); 21903 const [backgroundColor] = style_book_useGlobalStyle("color.background"); 21904 const colors = useMultiOriginPalettes(); 21905 const examples = (0,external_wp_element_.useMemo)(() => getExamples(colors), [colors]); 21906 const tabs = (0,external_wp_element_.useMemo)( 21907 () => getTopLevelStyleBookCategories().filter( 21908 (category) => examples.some( 21909 (example) => example.category === category.slug 21910 ) 21911 ), 21912 [examples] 21913 ); 21914 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); 21915 const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext); 21916 const goTo = getStyleBookNavigationFromPath(path); 21917 const mergedConfig = (0,external_wp_element_.useMemo)(() => { 21918 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 21919 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 21920 } 21921 return {}; 21922 }, [baseConfig, userConfig]); 21923 const originalSettings = (0,external_wp_data_.useSelect)( 21924 (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(), 21925 [] 21926 ); 21927 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 21928 const settings = (0,external_wp_element_.useMemo)( 21929 () => ({ 21930 ...originalSettings, 21931 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles, 21932 isPreviewMode: true 21933 }), 21934 [globalStyles, originalSettings, userConfig] 21935 ); 21936 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21937 editor_canvas_container_default, 21938 { 21939 onClose, 21940 enableResizing, 21941 closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)("Close") : null, 21942 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21943 "div", 21944 { 21945 className: dist_clsx("edit-site-style-book", { 21946 "is-button": !!onClick 21947 }), 21948 style: { 21949 color: textColor, 21950 background: backgroundColor 21951 }, 21952 children: showTabs ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { children: [ 21953 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book__tablist-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21954 style_book_Tabs.Tab, 21955 { 21956 tabId: tab.slug, 21957 children: tab.title 21958 }, 21959 tab.slug 21960 )) }) }), 21961 tabs.map((tab) => { 21962 const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find( 21963 (_category) => _category.slug === tab.slug 21964 ) : null; 21965 const filteredExamples = categoryDefinition ? getExamplesByCategory( 21966 categoryDefinition, 21967 examples 21968 ) : { examples }; 21969 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21970 style_book_Tabs.TabPanel, 21971 { 21972 tabId: tab.slug, 21973 focusable: false, 21974 className: "edit-site-style-book__tabpanel", 21975 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21976 StyleBookBody, 21977 { 21978 category: tab.slug, 21979 examples: filteredExamples, 21980 isSelected, 21981 onSelect, 21982 settings, 21983 title: tab.title, 21984 goTo 21985 } 21986 ) 21987 }, 21988 tab.slug 21989 ); 21990 }) 21991 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21992 StyleBookBody, 21993 { 21994 examples: { examples: examplesForSinglePageUse }, 21995 isSelected, 21996 onClick, 21997 onSelect, 21998 settings, 21999 goTo 22000 } 22001 ) 22002 } 22003 ) 22004 } 22005 ); 22006 } 22007 const StyleBookPreview = ({ userConfig = {}, isStatic = false }) => { 22008 const siteEditorSettings = (0,external_wp_data_.useSelect)( 22009 (select) => select(store).getSettings(), 22010 [] 22011 ); 22012 const canUserUploadMedia = (0,external_wp_data_.useSelect)( 22013 (select) => select(external_wp_coreData_namespaceObject.store).canUser("create", { 22014 kind: "postType", 22015 name: "attachment" 22016 }), 22017 [] 22018 ); 22019 (0,external_wp_element_.useEffect)(() => { 22020 (0,external_wp_data_.dispatch)(external_wp_blockEditor_namespaceObject.store).updateSettings({ 22021 ...siteEditorSettings, 22022 mediaUpload: canUserUploadMedia ? external_wp_mediaUtils_namespaceObject.uploadMedia : void 0 22023 }); 22024 }, [siteEditorSettings, canUserUploadMedia]); 22025 const [section, onChangeSection] = useSection(); 22026 const isSelected = (blockName) => { 22027 return section === `/blocks/$encodeURIComponent(blockName)}` || section.startsWith( 22028 `/blocks/$encodeURIComponent(blockName)}/` 22029 ); 22030 }; 22031 const onSelect = (blockName, isBlockVariation = false) => { 22032 if (STYLE_BOOK_COLOR_GROUPS.find( 22033 (group) => group.slug === blockName 22034 )) { 22035 onChangeSection("/colors/palette"); 22036 return; 22037 } 22038 if (blockName === "typography") { 22039 onChangeSection("/typography"); 22040 return; 22041 } 22042 if (isBlockVariation) { 22043 return; 22044 } 22045 onChangeSection(`/blocks/$encodeURIComponent(blockName)}`); 22046 }; 22047 const colors = useMultiOriginPalettes(); 22048 const examples = getExamples(colors); 22049 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); 22050 let previewCategory = null; 22051 let blockVariation = null; 22052 if (section.includes("/colors")) { 22053 previewCategory = "colors"; 22054 } else if (section.includes("/typography")) { 22055 previewCategory = "text"; 22056 } else if (section.includes("/blocks")) { 22057 previewCategory = "blocks"; 22058 let blockName = decodeURIComponent(section).split("/blocks/")[1]; 22059 if (blockName?.includes("/variations")) { 22060 [blockName, blockVariation] = blockName.split("/variations/"); 22061 } 22062 if (blockName && examples.find((example) => example.name === blockName)) { 22063 previewCategory = blockName; 22064 } 22065 } else if (!isStatic) { 22066 previewCategory = "overview"; 22067 } 22068 const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find( 22069 (category) => category.slug === previewCategory 22070 ); 22071 const filteredExamples = (0,external_wp_element_.useMemo)(() => { 22072 if (!categoryDefinition) { 22073 return { 22074 examples: [ 22075 examples.find( 22076 (example) => example.name === previewCategory 22077 ) 22078 ] 22079 }; 22080 } 22081 return getExamplesByCategory(categoryDefinition, examples); 22082 }, [categoryDefinition, examples, previewCategory]); 22083 const displayedExamples = (0,external_wp_element_.useMemo)(() => { 22084 if (!previewCategory) { 22085 return { examples: examplesForSinglePageUse }; 22086 } 22087 if (blockVariation) { 22088 return { 22089 examples: applyBlockVariationsToExamples( 22090 filteredExamples.examples, 22091 blockVariation 22092 ) 22093 }; 22094 } 22095 return filteredExamples; 22096 }, [ 22097 previewCategory, 22098 examplesForSinglePageUse, 22099 blockVariation, 22100 filteredExamples 22101 ]); 22102 const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext); 22103 const goTo = getStyleBookNavigationFromPath(section); 22104 const mergedConfig = (0,external_wp_element_.useMemo)(() => { 22105 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 22106 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 22107 } 22108 return {}; 22109 }, [baseConfig, userConfig]); 22110 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 22111 const settings = (0,external_wp_element_.useMemo)( 22112 () => ({ 22113 ...siteEditorSettings, 22114 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : siteEditorSettings.styles, 22115 isPreviewMode: true 22116 }), 22117 [globalStyles, siteEditorSettings, userConfig] 22118 ); 22119 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { settings, children: [ 22120 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { disableRootPadding: true }), 22121 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22122 StyleBookBody, 22123 { 22124 examples: displayedExamples, 22125 settings, 22126 goTo, 22127 isSelected: !isStatic ? isSelected : null, 22128 onSelect: !isStatic ? onSelect : null 22129 } 22130 ) 22131 ] }) }); 22132 }; 22133 const StyleBookBody = ({ 22134 examples, 22135 isSelected, 22136 onClick, 22137 onSelect, 22138 settings, 22139 title, 22140 goTo 22141 }) => { 22142 const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false); 22143 const [hasIframeLoaded, setHasIframeLoaded] = (0,external_wp_element_.useState)(false); 22144 const iframeRef = (0,external_wp_element_.useRef)(null); 22145 const buttonModeProps = { 22146 role: "button", 22147 onFocus: () => setIsFocused(true), 22148 onBlur: () => setIsFocused(false), 22149 onKeyDown: (event) => { 22150 if (event.defaultPrevented) { 22151 return; 22152 } 22153 const { keyCode } = event; 22154 if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) { 22155 event.preventDefault(); 22156 onClick(event); 22157 } 22158 }, 22159 onClick: (event) => { 22160 if (event.defaultPrevented) { 22161 return; 22162 } 22163 if (onClick) { 22164 event.preventDefault(); 22165 onClick(event); 22166 } 22167 }, 22168 readonly: true 22169 }; 22170 const handleLoad = () => setHasIframeLoaded(true); 22171 (0,external_wp_element_.useLayoutEffect)(() => { 22172 if (hasIframeLoaded && iframeRef?.current) { 22173 if (goTo?.top) { 22174 scrollToSection("top", iframeRef?.current); 22175 } 22176 } 22177 }, [iframeRef?.current, goTo, scrollToSection, hasIframeLoaded]); 22178 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22179 external_wp_blockEditor_namespaceObject.__unstableIframe, 22180 { 22181 onLoad: handleLoad, 22182 ref: iframeRef, 22183 className: dist_clsx("edit-site-style-book__iframe", { 22184 "is-focused": isFocused && !!onClick, 22185 "is-button": !!onClick 22186 }), 22187 name: "style-book-canvas", 22188 tabIndex: 0, 22189 ...onClick ? buttonModeProps : {}, 22190 children: [ 22191 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: settings.styles }), 22192 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("style", { children: [ 22193 STYLE_BOOK_IFRAME_STYLES, 22194 !!onClick && "body { cursor: pointer; } body * { pointer-events: none; }" 22195 ] }), 22196 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22197 Examples, 22198 { 22199 className: "edit-site-style-book__examples", 22200 filteredExamples: examples, 22201 label: title ? (0,external_wp_i18n_namespaceObject.sprintf)( 22202 // translators: %s: Category of blocks, e.g. Text. 22203 (0,external_wp_i18n_namespaceObject.__)("Examples of blocks in the %s category"), 22204 title 22205 ) : (0,external_wp_i18n_namespaceObject.__)("Examples of blocks"), 22206 isSelected, 22207 onSelect 22208 }, 22209 title 22210 ) 22211 ] 22212 } 22213 ); 22214 }; 22215 const Examples = (0,external_wp_element_.memo)( 22216 ({ className, filteredExamples, label, isSelected, onSelect }) => { 22217 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22218 external_wp_components_namespaceObject.Composite, 22219 { 22220 orientation: "vertical", 22221 className, 22222 "aria-label": label, 22223 role: "grid", 22224 children: [ 22225 !!filteredExamples?.examples?.length && filteredExamples.examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22226 Example, 22227 { 22228 id: `example-$example.name}`, 22229 title: example.title, 22230 content: example.content, 22231 blocks: example.blocks, 22232 isSelected: isSelected?.(example.name), 22233 onClick: !!onSelect ? () => onSelect( 22234 example.name, 22235 !!example.variation 22236 ) : null 22237 }, 22238 example.name 22239 )), 22240 !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map((subcategory) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22241 external_wp_components_namespaceObject.Composite.Group, 22242 { 22243 className: "edit-site-style-book__subcategory", 22244 children: [ 22245 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.GroupLabel, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-style-book__subcategory-title", children: subcategory.title }) }), 22246 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22247 Subcategory, 22248 { 22249 examples: subcategory.examples, 22250 isSelected, 22251 onSelect 22252 } 22253 ) 22254 ] 22255 }, 22256 `subcategory-$subcategory.slug}` 22257 )) 22258 ] 22259 } 22260 ); 22261 } 22262 ); 22263 const Subcategory = ({ examples, isSelected, onSelect }) => { 22264 return !!examples?.length && examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22265 Example, 22266 { 22267 id: `example-$example.name}`, 22268 title: example.title, 22269 content: example.content, 22270 blocks: example.blocks, 22271 isSelected: isSelected?.(example.name), 22272 onClick: !!onSelect ? () => onSelect(example.name) : null 22273 }, 22274 example.name 22275 )); 22276 }; 22277 const disabledExamples = ["example-duotones"]; 22278 const Example = ({ id, title, blocks, isSelected, onClick, content }) => { 22279 const originalSettings = (0,external_wp_data_.useSelect)( 22280 (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(), 22281 [] 22282 ); 22283 const settings = (0,external_wp_element_.useMemo)( 22284 () => ({ 22285 ...originalSettings, 22286 focusMode: false, 22287 // Disable "Spotlight mode". 22288 isPreviewMode: true 22289 }), 22290 [originalSettings] 22291 ); 22292 const renderedBlocks = (0,external_wp_element_.useMemo)( 22293 () => Array.isArray(blocks) ? blocks : [blocks], 22294 [blocks] 22295 ); 22296 const disabledProps = disabledExamples.includes(id) || !onClick ? { 22297 disabled: true, 22298 accessibleWhenDisabled: !!onClick 22299 } : {}; 22300 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22301 external_wp_components_namespaceObject.Composite.Item, 22302 { 22303 className: dist_clsx("edit-site-style-book__example", { 22304 "is-selected": isSelected, 22305 "is-disabled-example": !!disabledProps?.disabled 22306 }), 22307 id, 22308 "aria-label": !!onClick ? (0,external_wp_i18n_namespaceObject.sprintf)( 22309 // translators: %s: Title of a block, e.g. Heading. 22310 (0,external_wp_i18n_namespaceObject.__)("Open %s styles in Styles panel"), 22311 title 22312 ) : void 0, 22313 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 22314 role: !!onClick ? "button" : null, 22315 onClick, 22316 ...disabledProps, 22317 children: [ 22318 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-style-book__example-title", children: title }), 22319 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22320 "div", 22321 { 22322 className: "edit-site-style-book__example-preview", 22323 "aria-hidden": true, 22324 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-style-book__example-preview__content", children: content ? content : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22325 ExperimentalBlockEditorProvider, 22326 { 22327 value: renderedBlocks, 22328 settings, 22329 children: [ 22330 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {}), 22331 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false }) 22332 ] 22333 } 22334 ) }) 22335 } 22336 ) 22337 ] 22338 } 22339 ) }) }); 22340 }; 22341 var style_book_default = StyleBook; 22342 22343 22344 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js 22345 22346 22347 22348 22349 22350 22351 22352 22353 const { useGlobalStyle: screen_css_useGlobalStyle, AdvancedPanel: screen_css_StylesAdvancedPanel } = unlock( 22354 external_wp_blockEditor_namespaceObject.privateApis 22355 ); 22356 function ScreenCSS() { 22357 const [style] = screen_css_useGlobalStyle("", void 0, "user", { 22358 shouldDecodeEncode: false 22359 }); 22360 const [inheritedStyle, setStyle] = screen_css_useGlobalStyle("", void 0, "all", { 22361 shouldDecodeEncode: false 22362 }); 22363 const { setEditorCanvasContainerView } = unlock( 22364 (0,external_wp_data_.useDispatch)(store) 22365 ); 22366 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22367 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22368 header_default, 22369 { 22370 title: (0,external_wp_i18n_namespaceObject.__)("Additional CSS"), 22371 description: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22372 (0,external_wp_i18n_namespaceObject.__)( 22373 "You can add custom CSS to further customize the appearance and layout of your site." 22374 ), 22375 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), 22376 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22377 external_wp_components_namespaceObject.ExternalLink, 22378 { 22379 href: (0,external_wp_i18n_namespaceObject.__)( 22380 "https://developer.wordpress.org/advanced-administration/wordpress/css/" 22381 ), 22382 className: "edit-site-global-styles-screen-css-help-link", 22383 children: (0,external_wp_i18n_namespaceObject.__)("Learn more about CSS") 22384 } 22385 ) 22386 ] }), 22387 onBack: () => { 22388 setEditorCanvasContainerView(void 0); 22389 } 22390 } 22391 ), 22392 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22393 screen_css_StylesAdvancedPanel, 22394 { 22395 value: style, 22396 onChange: setStyle, 22397 inheritedValue: inheritedStyle 22398 } 22399 ) }) 22400 ] }); 22401 } 22402 var screen_css_default = ScreenCSS; 22403 22404 22405 ;// ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js 22406 22407 22408 22409 22410 22411 22412 22413 22414 22415 const { 22416 ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider, 22417 GlobalStylesContext: revisions_GlobalStylesContext, 22418 useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig, 22419 __unstableBlockStyleVariationOverridesWithConfig 22420 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22421 const { mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); 22422 function revisions_isObjectEmpty(object) { 22423 return !object || Object.keys(object).length === 0; 22424 } 22425 function Revisions({ userConfig, blocks }) { 22426 const { base: baseConfig } = (0,external_wp_element_.useContext)(revisions_GlobalStylesContext); 22427 const mergedConfig = (0,external_wp_element_.useMemo)(() => { 22428 if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) { 22429 return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig); 22430 } 22431 return {}; 22432 }, [baseConfig, userConfig]); 22433 const renderedBlocksArray = (0,external_wp_element_.useMemo)( 22434 () => Array.isArray(blocks) ? blocks : [blocks], 22435 [blocks] 22436 ); 22437 const originalSettings = (0,external_wp_data_.useSelect)( 22438 (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(), 22439 [] 22440 ); 22441 const settings = (0,external_wp_element_.useMemo)( 22442 () => ({ 22443 ...originalSettings, 22444 isPreviewMode: true 22445 }), 22446 [originalSettings] 22447 ); 22448 const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig); 22449 const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles; 22450 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22451 editor_canvas_container_default, 22452 { 22453 title: (0,external_wp_i18n_namespaceObject.__)("Revisions"), 22454 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions"), 22455 enableResizing: true, 22456 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22457 external_wp_blockEditor_namespaceObject.__unstableIframe, 22458 { 22459 className: "edit-site-revisions__iframe", 22460 name: "revisions", 22461 tabIndex: 0, 22462 children: [ 22463 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { 22464 // Forming a "block formatting context" to prevent margin collapsing. 22465 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 22466 children: `.is-root-container { display: flow-root; }` 22467 }), 22468 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-revisions__example-preview__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22469 revisions_ExperimentalBlockEditorProvider, 22470 { 22471 value: renderedBlocksArray, 22472 settings, 22473 children: [ 22474 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false }), 22475 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: editorStyles }), 22476 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22477 __unstableBlockStyleVariationOverridesWithConfig, 22478 { 22479 config: mergedConfig 22480 } 22481 ) 22482 ] 22483 } 22484 ) }) 22485 ] 22486 } 22487 ) 22488 } 22489 ); 22490 } 22491 var revisions_default = Revisions; 22492 22493 22494 ;// external ["wp","date"] 22495 const external_wp_date_namespaceObject = window["wp"]["date"]; 22496 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js 22497 22498 22499 22500 22501 22502 22503 22504 22505 22506 const DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24; 22507 const { getGlobalStylesChanges } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22508 function ChangesSummary({ revision, previousRevision }) { 22509 const changes = getGlobalStylesChanges(revision, previousRevision, { 22510 maxResults: 7 22511 }); 22512 if (!changes.length) { 22513 return null; 22514 } 22515 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22516 "ul", 22517 { 22518 "data-testid": "global-styles-revision-changes", 22519 className: "edit-site-global-styles-screen-revisions__changes", 22520 children: changes.map((change) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change)) 22521 } 22522 ); 22523 } 22524 function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) { 22525 if ("parent" === id) { 22526 return (0,external_wp_i18n_namespaceObject.__)("Reset the styles to the theme defaults"); 22527 } 22528 if ("unsaved" === id) { 22529 return (0,external_wp_i18n_namespaceObject.sprintf)( 22530 /* translators: %s: author display name */ 22531 (0,external_wp_i18n_namespaceObject.__)("Unsaved changes by %s"), 22532 authorDisplayName 22533 ); 22534 } 22535 return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)( 22536 // translators: 1: author display name. 2: revision creation date. 22537 (0,external_wp_i18n_namespaceObject.__)( 22538 "Changes saved by %1$s on %2$s. This revision matches current editor styles." 22539 ), 22540 authorDisplayName, 22541 formattedModifiedDate 22542 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 22543 // translators: 1: author display name. 2: revision creation date. 22544 (0,external_wp_i18n_namespaceObject.__)("Changes saved by %1$s on %2$s"), 22545 authorDisplayName, 22546 formattedModifiedDate 22547 ); 22548 } 22549 function RevisionsButtons({ 22550 userRevisions, 22551 selectedRevisionId, 22552 onChange, 22553 canApplyRevision, 22554 onApplyRevision 22555 }) { 22556 const { currentThemeName, currentUser } = (0,external_wp_data_.useSelect)((select) => { 22557 const { getCurrentTheme, getCurrentUser } = select(external_wp_coreData_namespaceObject.store); 22558 const currentTheme = getCurrentTheme(); 22559 return { 22560 currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet, 22561 currentUser: getCurrentUser() 22562 }; 22563 }, []); 22564 const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime(); 22565 const { datetimeAbbreviated } = (0,external_wp_date_namespaceObject.getSettings)().formats; 22566 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22567 external_wp_components_namespaceObject.Composite, 22568 { 22569 orientation: "vertical", 22570 className: "edit-site-global-styles-screen-revisions__revisions-list", 22571 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Global styles revisions list"), 22572 role: "listbox", 22573 children: userRevisions.map((revision, index) => { 22574 const { id, author, modified } = revision; 22575 const isUnsaved = "unsaved" === id; 22576 const revisionAuthor = isUnsaved ? currentUser : author; 22577 const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)("User"); 22578 const authorAvatar = revisionAuthor?.avatar_urls?.["48"]; 22579 const isFirstItem = index === 0; 22580 const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem; 22581 const areStylesEqual = !canApplyRevision && isSelected; 22582 const isReset = "parent" === id; 22583 const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified); 22584 const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified); 22585 const revisionLabel = getRevisionLabel( 22586 id, 22587 authorDisplayName, 22588 (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), 22589 areStylesEqual 22590 ); 22591 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22592 external_wp_components_namespaceObject.Composite.Item, 22593 { 22594 className: "edit-site-global-styles-screen-revisions__revision-item", 22595 "aria-current": isSelected, 22596 role: "option", 22597 onKeyDown: (event) => { 22598 const { keyCode } = event; 22599 if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) { 22600 onChange(revision); 22601 } 22602 }, 22603 onClick: (event) => { 22604 event.preventDefault(); 22605 onChange(revision); 22606 }, 22607 "aria-selected": isSelected, 22608 "aria-label": revisionLabel, 22609 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 22610 children: [ 22611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__revision-item-wrapper", children: isReset ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [ 22612 (0,external_wp_i18n_namespaceObject.__)("Default styles"), 22613 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: currentThemeName }) 22614 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [ 22615 isUnsaved ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__date", children: (0,external_wp_i18n_namespaceObject.__)("(Unsaved)") }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22616 "time", 22617 { 22618 className: "edit-site-global-styles-screen-revisions__date", 22619 dateTime: modified, 22620 children: displayDate 22621 } 22622 ), 22623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: [ 22624 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22625 "img", 22626 { 22627 alt: authorDisplayName, 22628 src: authorAvatar 22629 } 22630 ), 22631 authorDisplayName 22632 ] }), 22633 isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22634 ChangesSummary, 22635 { 22636 revision, 22637 previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {} 22638 } 22639 ) 22640 ] }) }), 22641 isSelected && (areStylesEqual ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-screen-revisions__applied-text", children: (0,external_wp_i18n_namespaceObject.__)( 22642 "These styles are already applied to your site." 22643 ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22644 external_wp_components_namespaceObject.Button, 22645 { 22646 size: "compact", 22647 variant: "primary", 22648 className: "edit-site-global-styles-screen-revisions__apply-button", 22649 onClick: onApplyRevision, 22650 "aria-label": (0,external_wp_i18n_namespaceObject.__)( 22651 "Apply the selected revision to your site." 22652 ), 22653 children: isReset ? (0,external_wp_i18n_namespaceObject.__)("Reset to defaults") : (0,external_wp_i18n_namespaceObject.__)("Apply") 22654 } 22655 )) 22656 ] 22657 }, 22658 id 22659 ); 22660 }) 22661 } 22662 ); 22663 } 22664 var revisions_buttons_default = RevisionsButtons; 22665 22666 22667 ;// ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js 22668 22669 22670 22671 22672 22673 function Pagination({ 22674 currentPage, 22675 numPages, 22676 changePage, 22677 totalItems, 22678 className, 22679 disabled = false, 22680 buttonVariant = "tertiary", 22681 label = (0,external_wp_i18n_namespaceObject.__)("Pagination") 22682 }) { 22683 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22684 external_wp_components_namespaceObject.__experimentalHStack, 22685 { 22686 expanded: false, 22687 as: "nav", 22688 "aria-label": label, 22689 spacing: 3, 22690 justify: "flex-start", 22691 className: dist_clsx("edit-site-pagination", className), 22692 children: [ 22693 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 22694 variant: "muted", 22695 className: "edit-site-pagination__total", 22696 // translators: %s: Total number of patterns. 22697 children: (0,external_wp_i18n_namespaceObject.sprintf)( 22698 // translators: %s: Total number of patterns. 22699 (0,external_wp_i18n_namespaceObject._n)("%s item", "%s items", totalItems), 22700 totalItems 22701 ) 22702 }), 22703 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [ 22704 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22705 external_wp_components_namespaceObject.Button, 22706 { 22707 variant: buttonVariant, 22708 onClick: () => changePage(1), 22709 accessibleWhenDisabled: true, 22710 disabled: disabled || currentPage === 1, 22711 label: (0,external_wp_i18n_namespaceObject.__)("First page"), 22712 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default, 22713 size: "compact" 22714 } 22715 ), 22716 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22717 external_wp_components_namespaceObject.Button, 22718 { 22719 variant: buttonVariant, 22720 onClick: () => changePage(currentPage - 1), 22721 accessibleWhenDisabled: true, 22722 disabled: disabled || currentPage === 1, 22723 label: (0,external_wp_i18n_namespaceObject.__)("Previous page"), 22724 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 22725 size: "compact" 22726 } 22727 ) 22728 ] }), 22729 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( 22730 // translators: 1: Current page number. 2: Total number of pages. 22731 (0,external_wp_i18n_namespaceObject._x)("%1$s of %2$s", "paging"), 22732 currentPage, 22733 numPages 22734 ) }), 22735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [ 22736 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22737 external_wp_components_namespaceObject.Button, 22738 { 22739 variant: buttonVariant, 22740 onClick: () => changePage(currentPage + 1), 22741 accessibleWhenDisabled: true, 22742 disabled: disabled || currentPage === numPages, 22743 label: (0,external_wp_i18n_namespaceObject.__)("Next page"), 22744 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default, 22745 size: "compact" 22746 } 22747 ), 22748 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22749 external_wp_components_namespaceObject.Button, 22750 { 22751 variant: buttonVariant, 22752 onClick: () => changePage(numPages), 22753 accessibleWhenDisabled: true, 22754 disabled: disabled || currentPage === numPages, 22755 label: (0,external_wp_i18n_namespaceObject.__)("Last page"), 22756 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default, 22757 size: "compact" 22758 } 22759 ) 22760 ] }) 22761 ] 22762 } 22763 ); 22764 } 22765 22766 22767 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js 22768 22769 22770 22771 22772 22773 22774 22775 22776 22777 22778 22779 22780 22781 22782 const { GlobalStylesContext: screen_revisions_GlobalStylesContext, areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual } = unlock( 22783 external_wp_blockEditor_namespaceObject.privateApis 22784 ); 22785 const PAGE_SIZE = 10; 22786 function ScreenRevisions() { 22787 const { user: currentEditorGlobalStyles, setUserConfig } = (0,external_wp_element_.useContext)(screen_revisions_GlobalStylesContext); 22788 const { blocks, editorCanvasContainerView } = (0,external_wp_data_.useSelect)( 22789 (select) => ({ 22790 editorCanvasContainerView: unlock( 22791 select(store) 22792 ).getEditorCanvasContainerView(), 22793 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() 22794 }), 22795 [] 22796 ); 22797 const [currentPage, setCurrentPage] = (0,external_wp_element_.useState)(1); 22798 const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_.useState)([]); 22799 const { revisions, isLoading, hasUnsavedChanges, revisionsCount } = useGlobalStylesRevisions({ 22800 query: { 22801 per_page: PAGE_SIZE, 22802 page: currentPage 22803 } 22804 }); 22805 const numPages = Math.ceil(revisionsCount / PAGE_SIZE); 22806 const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_.useState)(currentEditorGlobalStyles); 22807 const [ 22808 isLoadingRevisionWithUnsavedChanges, 22809 setIsLoadingRevisionWithUnsavedChanges 22810 ] = (0,external_wp_element_.useState)(false); 22811 const { setEditorCanvasContainerView } = unlock( 22812 (0,external_wp_data_.useDispatch)(store) 22813 ); 22814 const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual( 22815 currentlySelectedRevision, 22816 currentEditorGlobalStyles 22817 ); 22818 const onCloseRevisions = () => { 22819 const canvasContainerView = editorCanvasContainerView === "global-styles-revisions:style-book" ? "style-book" : void 0; 22820 setEditorCanvasContainerView(canvasContainerView); 22821 }; 22822 const restoreRevision = (revision) => { 22823 setUserConfig(() => revision); 22824 setIsLoadingRevisionWithUnsavedChanges(false); 22825 onCloseRevisions(); 22826 }; 22827 (0,external_wp_element_.useEffect)(() => { 22828 if (!isLoading && revisions.length) { 22829 setCurrentRevisions(revisions); 22830 } 22831 }, [revisions, isLoading]); 22832 const firstRevision = revisions[0]; 22833 const currentlySelectedRevisionId = currentlySelectedRevision?.id; 22834 const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId; 22835 (0,external_wp_element_.useEffect)(() => { 22836 if (shouldSelectFirstItem) { 22837 setCurrentlySelectedRevision(firstRevision); 22838 } 22839 }, [shouldSelectFirstItem, firstRevision]); 22840 const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== "unsaved" && !selectedRevisionMatchesEditorStyles; 22841 const hasRevisions = !!currentRevisions.length; 22842 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22843 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22844 header_default, 22845 { 22846 title: revisionsCount && // translators: %s: number of revisions. 22847 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Revisions (%s)"), revisionsCount), 22848 description: (0,external_wp_i18n_namespaceObject.__)( 22849 `Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you're ready, use the Save button to save your changes.` 22850 ), 22851 onBack: onCloseRevisions 22852 } 22853 ), 22854 !hasRevisions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-global-styles-screen-revisions__loading" }), 22855 hasRevisions && (editorCanvasContainerView === "global-styles-revisions:style-book" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22856 style_book_default, 22857 { 22858 userConfig: currentlySelectedRevision, 22859 isSelected: () => { 22860 }, 22861 onClose: () => { 22862 setEditorCanvasContainerView( 22863 "global-styles-revisions" 22864 ); 22865 } 22866 } 22867 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22868 revisions_default, 22869 { 22870 blocks, 22871 userConfig: currentlySelectedRevision, 22872 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions") 22873 } 22874 )), 22875 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22876 revisions_buttons_default, 22877 { 22878 onChange: setCurrentlySelectedRevision, 22879 selectedRevisionId: currentlySelectedRevisionId, 22880 userRevisions: currentRevisions, 22881 canApplyRevision: isLoadButtonEnabled, 22882 onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision) 22883 } 22884 ), 22885 numPages > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-revisions__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22886 Pagination, 22887 { 22888 className: "edit-site-global-styles-screen-revisions__pagination", 22889 currentPage, 22890 numPages, 22891 changePage: setCurrentPage, 22892 totalItems: revisionsCount, 22893 disabled: isLoading, 22894 label: (0,external_wp_i18n_namespaceObject.__)("Global Styles pagination") 22895 } 22896 ) }), 22897 isLoadingRevisionWithUnsavedChanges && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22898 external_wp_components_namespaceObject.__experimentalConfirmDialog, 22899 { 22900 isOpen: isLoadingRevisionWithUnsavedChanges, 22901 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Apply"), 22902 onConfirm: () => restoreRevision(currentlySelectedRevision), 22903 onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false), 22904 size: "medium", 22905 children: (0,external_wp_i18n_namespaceObject.__)( 22906 "Are you sure you want to apply this revision? Any unsaved changes will be lost." 22907 ) 22908 } 22909 ) 22910 ] }); 22911 } 22912 var screen_revisions_default = ScreenRevisions; 22913 22914 22915 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js 22916 22917 22918 22919 22920 22921 22922 22923 22924 22925 22926 22927 22928 22929 22930 22931 22932 22933 22934 22935 22936 22937 22938 22939 22940 22941 22942 22943 22944 22945 22946 const SLOT_FILL_NAME = "GlobalStylesMenu"; 22947 const { useGlobalStylesReset: ui_useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22948 const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME); 22949 function GlobalStylesActionMenu() { 22950 const [canReset, onReset] = ui_useGlobalStylesReset(); 22951 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 22952 const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => { 22953 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); 22954 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 22955 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; 22956 return { 22957 canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"] 22958 }; 22959 }, []); 22960 const { setEditorCanvasContainerView } = unlock( 22961 (0,external_wp_data_.useDispatch)(store) 22962 ); 22963 const loadCustomCSS = () => { 22964 setEditorCanvasContainerView("global-styles-css"); 22965 }; 22966 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22967 external_wp_components_namespaceObject.DropdownMenu, 22968 { 22969 icon: more_vertical_default, 22970 label: (0,external_wp_i18n_namespaceObject.__)("More"), 22971 toggleProps: { size: "compact" }, 22972 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22973 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 22974 canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: loadCustomCSS, children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS") }), 22975 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22976 external_wp_components_namespaceObject.MenuItem, 22977 { 22978 onClick: () => { 22979 toggle( 22980 "core/edit-site", 22981 "welcomeGuideStyles" 22982 ); 22983 onClose(); 22984 }, 22985 children: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide") 22986 } 22987 ) 22988 ] }), 22989 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22990 external_wp_components_namespaceObject.MenuItem, 22991 { 22992 onClick: () => { 22993 onReset(); 22994 onClose(); 22995 }, 22996 disabled: !canReset, 22997 children: (0,external_wp_i18n_namespaceObject.__)("Reset styles") 22998 } 22999 ) }) 23000 ] }) 23001 } 23002 ) }); 23003 } 23004 function GlobalStylesNavigationScreen({ className, ...props }) { 23005 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23006 external_wp_components_namespaceObject.Navigator.Screen, 23007 { 23008 className: [ 23009 "edit-site-global-styles-sidebar__navigator-screen", 23010 className 23011 ].filter(Boolean).join(" "), 23012 ...props 23013 } 23014 ); 23015 } 23016 function BlockStylesNavigationScreens({ 23017 parentMenu, 23018 blockStyles, 23019 blockName 23020 }) { 23021 return blockStyles.map((style, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23022 GlobalStylesNavigationScreen, 23023 { 23024 path: parentMenu + "/variations/" + style.name, 23025 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: blockName, variation: style.name }) 23026 }, 23027 index 23028 )); 23029 } 23030 function ContextScreens({ name, parentMenu = "" }) { 23031 const blockStyleVariations = (0,external_wp_data_.useSelect)( 23032 (select) => { 23033 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); 23034 return getBlockStyles(name); 23035 }, 23036 [name] 23037 ); 23038 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 23039 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23040 GlobalStylesNavigationScreen, 23041 { 23042 path: parentMenu + "/colors/palette", 23043 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_default, { name }) 23044 } 23045 ), 23046 !!blockStyleVariations?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23047 BlockStylesNavigationScreens, 23048 { 23049 parentMenu, 23050 blockStyles: blockStyleVariations, 23051 blockName: name 23052 } 23053 ) 23054 ] }); 23055 } 23056 function GlobalStylesStyleBook() { 23057 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 23058 const { path } = navigator.location; 23059 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23060 style_book_default, 23061 { 23062 isSelected: (blockName) => ( 23063 // Match '/blocks/core%2Fbutton' and 23064 // '/blocks/core%2Fbutton/typography', but not 23065 // '/blocks/core%2Fbuttons'. 23066 path === `/blocks/$encodeURIComponent(blockName)}` || path.startsWith( 23067 `/blocks/$encodeURIComponent(blockName)}/` 23068 ) 23069 ), 23070 onSelect: (blockName) => { 23071 if (STYLE_BOOK_COLOR_GROUPS.find( 23072 (group) => group.slug === blockName 23073 )) { 23074 navigator.goTo("/colors/palette"); 23075 return; 23076 } 23077 if (blockName === "typography") { 23078 navigator.goTo("/typography"); 23079 return; 23080 } 23081 navigator.goTo("/blocks/" + encodeURIComponent(blockName)); 23082 } 23083 } 23084 ); 23085 } 23086 function GlobalStylesBlockLink() { 23087 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 23088 const { selectedBlockName, selectedBlockClientId } = (0,external_wp_data_.useSelect)( 23089 (select) => { 23090 const { getSelectedBlockClientId, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); 23091 const clientId = getSelectedBlockClientId(); 23092 return { 23093 selectedBlockName: getBlockName(clientId), 23094 selectedBlockClientId: clientId 23095 }; 23096 }, 23097 [] 23098 ); 23099 const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName); 23100 (0,external_wp_element_.useEffect)(() => { 23101 if (!selectedBlockClientId || !blockHasGlobalStyles) { 23102 return; 23103 } 23104 const currentPath = navigator.location.path; 23105 if (currentPath !== "/blocks" && !currentPath.startsWith("/blocks/")) { 23106 return; 23107 } 23108 const newPath = "/blocks/" + encodeURIComponent(selectedBlockName); 23109 if (newPath !== currentPath) { 23110 navigator.goTo(newPath, { skipFocus: true }); 23111 } 23112 }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]); 23113 } 23114 function GlobalStylesEditorCanvasContainerLink() { 23115 const { goTo, location } = (0,external_wp_components_namespaceObject.useNavigator)(); 23116 const editorCanvasContainerView = (0,external_wp_data_.useSelect)( 23117 (select) => unlock(select(store)).getEditorCanvasContainerView(), 23118 [] 23119 ); 23120 const path = location?.path; 23121 const isRevisionsOpen = path === "/revisions"; 23122 (0,external_wp_element_.useEffect)(() => { 23123 switch (editorCanvasContainerView) { 23124 case "global-styles-revisions": 23125 case "global-styles-revisions:style-book": 23126 if (!isRevisionsOpen) { 23127 goTo("/revisions"); 23128 } 23129 break; 23130 case "global-styles-css": 23131 goTo("/css"); 23132 break; 23133 // The stand-alone style book is open 23134 // and the revisions panel is open, 23135 // close the revisions panel. 23136 // Otherwise keep the style book open while 23137 // browsing global styles panel. 23138 // 23139 // Falling through as it matches the default scenario. 23140 case "style-book": 23141 default: 23142 if (isRevisionsOpen) { 23143 goTo("/", { isBack: true }); 23144 } 23145 break; 23146 } 23147 }, [editorCanvasContainerView, isRevisionsOpen, goTo]); 23148 } 23149 function useNavigatorSync(parentPath, onPathChange) { 23150 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 23151 const { path: childPath } = navigator.location; 23152 const previousParentPath = (0,external_wp_compose_namespaceObject.usePrevious)(parentPath); 23153 const previousChildPath = (0,external_wp_compose_namespaceObject.usePrevious)(childPath); 23154 (0,external_wp_element_.useEffect)(() => { 23155 if (parentPath !== childPath) { 23156 if (parentPath !== previousParentPath) { 23157 navigator.goTo(parentPath); 23158 } else if (childPath !== previousChildPath) { 23159 onPathChange(childPath); 23160 } 23161 } 23162 }, [ 23163 onPathChange, 23164 parentPath, 23165 previousChildPath, 23166 previousParentPath, 23167 childPath, 23168 navigator 23169 ]); 23170 } 23171 function NavigationSync({ path: parentPath, onPathChange, children }) { 23172 useNavigatorSync(parentPath, onPathChange); 23173 return children; 23174 } 23175 function GlobalStylesUI({ path, onPathChange }) { 23176 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); 23177 const editorCanvasContainerView = (0,external_wp_data_.useSelect)( 23178 (select) => unlock(select(store)).getEditorCanvasContainerView(), 23179 [] 23180 ); 23181 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23182 external_wp_components_namespaceObject.Navigator, 23183 { 23184 className: "edit-site-global-styles-sidebar__navigator-provider", 23185 initialPath: "/", 23186 children: [ 23187 path && onPathChange && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSync, { path, onPathChange }), 23188 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root_default, {}) }), 23189 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations_default, {}) }), 23190 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list_default, {}) }), 23191 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_default, {}) }), 23192 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_default, {}) }), 23193 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes/:origin/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_default, {}) }), 23194 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/text", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "text" }) }), 23195 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/link", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "link" }) }), 23196 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/heading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "heading" }) }), 23197 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/caption", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "caption" }) }), 23198 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "button" }) }), 23199 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/colors", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_default, {}) }), 23200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) }), 23201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows/edit/:category/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) }), 23202 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/layout", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout_default, {}) }), 23203 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_default, {}) }), 23204 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/revisions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions_default, {}) }), 23205 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/background", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background_default, {}) }), 23206 blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23207 GlobalStylesNavigationScreen, 23208 { 23209 path: "/blocks/" + encodeURIComponent(block.name), 23210 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: block.name }) 23211 }, 23212 "menu-block-" + block.name 23213 )), 23214 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), 23215 blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23216 ContextScreens, 23217 { 23218 name: block.name, 23219 parentMenu: "/blocks/" + encodeURIComponent(block.name) 23220 }, 23221 "screens-block-" + block.name 23222 )), 23223 "style-book" === editorCanvasContainerView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}), 23224 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}), 23225 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}), 23226 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {}) 23227 ] 23228 } 23229 ); 23230 } 23231 var ui_default = GlobalStylesUI; 23232 23233 23234 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js 23235 23236 23237 23238 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js 23239 23240 23241 23242 const { ComplementaryArea, ComplementaryAreaMoreMenuItem } = unlock(external_wp_editor_namespaceObject.privateApis); 23243 function DefaultSidebar({ 23244 className, 23245 identifier, 23246 title, 23247 icon, 23248 children, 23249 closeLabel, 23250 header, 23251 headerClassName, 23252 panelClassName, 23253 isActiveByDefault 23254 }) { 23255 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 23256 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23257 ComplementaryArea, 23258 { 23259 className, 23260 scope: "core", 23261 identifier, 23262 title, 23263 icon, 23264 closeLabel, 23265 header, 23266 headerClassName, 23267 panelClassName, 23268 isActiveByDefault, 23269 children 23270 } 23271 ), 23272 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23273 ComplementaryAreaMoreMenuItem, 23274 { 23275 scope: "core", 23276 identifier, 23277 icon, 23278 children: title 23279 } 23280 ) 23281 ] }); 23282 } 23283 23284 23285 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js 23286 23287 23288 23289 23290 23291 23292 23293 23294 23295 23296 23297 23298 23299 23300 23301 23302 const { interfaceStore: global_styles_sidebar_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); 23303 const { useLocation: global_styles_sidebar_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 23304 function GlobalStylesSidebar() { 23305 const { query } = global_styles_sidebar_useLocation(); 23306 const { canvas = "view", name } = query; 23307 const { 23308 shouldClearCanvasContainerView, 23309 isStyleBookOpened, 23310 showListViewByDefault, 23311 hasRevisions, 23312 isRevisionsOpened, 23313 isRevisionsStyleBookOpened 23314 } = (0,external_wp_data_.useSelect)( 23315 (select) => { 23316 const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select(global_styles_sidebar_interfaceStore); 23317 const { getEditorCanvasContainerView } = unlock( 23318 select(store) 23319 ); 23320 const canvasContainerView = getEditorCanvasContainerView(); 23321 const _isVisualEditorMode = "visual" === select(external_wp_editor_namespaceObject.store).getEditorMode(); 23322 const _isEditCanvasMode = "edit" === canvas; 23323 const _showListViewByDefault = select(external_wp_preferences_.store).get( 23324 "core", 23325 "showListViewByDefault" 23326 ); 23327 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); 23328 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 23329 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; 23330 return { 23331 isStyleBookOpened: "style-book" === canvasContainerView, 23332 shouldClearCanvasContainerView: "edit-site/global-styles" !== getActiveComplementaryArea2("core") || !_isVisualEditorMode || !_isEditCanvasMode, 23333 showListViewByDefault: _showListViewByDefault, 23334 hasRevisions: !!globalStyles?._links?.["version-history"]?.[0]?.count, 23335 isRevisionsStyleBookOpened: "global-styles-revisions:style-book" === canvasContainerView, 23336 isRevisionsOpened: "global-styles-revisions" === canvasContainerView 23337 }; 23338 }, 23339 [canvas] 23340 ); 23341 const { setEditorCanvasContainerView } = unlock( 23342 (0,external_wp_data_.useDispatch)(store) 23343 ); 23344 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 23345 (0,external_wp_element_.useEffect)(() => { 23346 if (shouldClearCanvasContainerView) { 23347 setEditorCanvasContainerView(void 0); 23348 } 23349 }, [shouldClearCanvasContainerView, setEditorCanvasContainerView]); 23350 const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); 23351 const toggleRevisions = () => { 23352 setIsListViewOpened(false); 23353 if (isRevisionsStyleBookOpened) { 23354 setEditorCanvasContainerView("style-book"); 23355 return; 23356 } 23357 if (isRevisionsOpened) { 23358 setEditorCanvasContainerView(void 0); 23359 return; 23360 } 23361 if (isStyleBookOpened) { 23362 setEditorCanvasContainerView( 23363 "global-styles-revisions:style-book" 23364 ); 23365 } else { 23366 setEditorCanvasContainerView("global-styles-revisions"); 23367 } 23368 }; 23369 const toggleStyleBook = () => { 23370 if (isRevisionsOpened) { 23371 setEditorCanvasContainerView( 23372 "global-styles-revisions:style-book" 23373 ); 23374 return; 23375 } 23376 if (isRevisionsStyleBookOpened) { 23377 setEditorCanvasContainerView("global-styles-revisions"); 23378 return; 23379 } 23380 setIsListViewOpened(isStyleBookOpened && showListViewByDefault); 23381 setEditorCanvasContainerView( 23382 isStyleBookOpened ? void 0 : "style-book" 23383 ); 23384 }; 23385 const { getActiveComplementaryArea } = (0,external_wp_data_.useSelect)(global_styles_sidebar_interfaceStore); 23386 const { enableComplementaryArea } = (0,external_wp_data_.useDispatch)(global_styles_sidebar_interfaceStore); 23387 const previousActiveAreaRef = (0,external_wp_element_.useRef)(null); 23388 (0,external_wp_element_.useEffect)(() => { 23389 if (name === "styles" && canvas === "edit") { 23390 previousActiveAreaRef.current = getActiveComplementaryArea("core"); 23391 enableComplementaryArea("core", "edit-site/global-styles"); 23392 } else if (previousActiveAreaRef.current) { 23393 enableComplementaryArea("core", previousActiveAreaRef.current); 23394 } 23395 }, [name, enableComplementaryArea, canvas, getActiveComplementaryArea]); 23396 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23397 DefaultSidebar, 23398 { 23399 className: "edit-site-global-styles-sidebar", 23400 identifier: "edit-site/global-styles", 23401 title: (0,external_wp_i18n_namespaceObject.__)("Styles"), 23402 icon: styles_default, 23403 closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Styles"), 23404 panelClassName: "edit-site-global-styles-sidebar__panel", 23405 header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23406 external_wp_components_namespaceObject.Flex, 23407 { 23408 className: "edit-site-global-styles-sidebar__header", 23409 gap: 1, 23410 children: [ 23411 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-global-styles-sidebar__header-title", children: (0,external_wp_i18n_namespaceObject.__)("Styles") }) }), 23412 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23413 external_wp_components_namespaceObject.Flex, 23414 { 23415 justify: "flex-end", 23416 gap: 1, 23417 className: "edit-site-global-styles-sidebar__header-actions", 23418 children: [ 23419 !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23420 external_wp_components_namespaceObject.Button, 23421 { 23422 icon: seen_default, 23423 label: (0,external_wp_i18n_namespaceObject.__)("Style Book"), 23424 isPressed: isStyleBookOpened || isRevisionsStyleBookOpened, 23425 accessibleWhenDisabled: true, 23426 disabled: shouldClearCanvasContainerView, 23427 onClick: toggleStyleBook, 23428 size: "compact" 23429 } 23430 ) }), 23431 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23432 external_wp_components_namespaceObject.Button, 23433 { 23434 label: (0,external_wp_i18n_namespaceObject.__)("Revisions"), 23435 icon: backup_default, 23436 onClick: toggleRevisions, 23437 accessibleWhenDisabled: true, 23438 disabled: !hasRevisions, 23439 isPressed: isRevisionsOpened || isRevisionsStyleBookOpened, 23440 size: "compact" 23441 } 23442 ) }), 23443 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {}) 23444 ] 23445 } 23446 ) 23447 ] 23448 } 23449 ), 23450 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, {}) 23451 } 23452 ); 23453 } 23454 23455 23456 ;// ./node_modules/@wordpress/icons/build-module/library/download.js 23457 23458 23459 var download_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) }); 23460 23461 23462 ;// external ["wp","blob"] 23463 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 23464 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js 23465 23466 23467 23468 23469 23470 23471 23472 23473 23474 function SiteExport() { 23475 const canExport = (0,external_wp_data_.useSelect)((select) => { 23476 const targetHints = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?._links?.["wp:export-theme"]?.[0]?.targetHints ?? {}; 23477 return !!targetHints.allow?.includes("GET"); 23478 }, []); 23479 const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 23480 if (!canExport) { 23481 return null; 23482 } 23483 async function handleExport() { 23484 try { 23485 const response = await external_wp_apiFetch_default()({ 23486 path: "/wp-block-editor/v1/export", 23487 parse: false, 23488 headers: { 23489 Accept: "application/zip" 23490 } 23491 }); 23492 const blob = await response.blob(); 23493 const contentDisposition = response.headers.get( 23494 "content-disposition" 23495 ); 23496 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); 23497 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : "edit-site-export"; 23498 (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + ".zip", blob, "application/zip"); 23499 } catch (errorResponse) { 23500 let error = {}; 23501 try { 23502 error = await errorResponse.json(); 23503 } catch (e) { 23504 } 23505 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the site export."); 23506 createErrorNotice(errorMessage, { type: "snackbar" }); 23507 } 23508 } 23509 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23510 external_wp_components_namespaceObject.MenuItem, 23511 { 23512 role: "menuitem", 23513 icon: download_default, 23514 onClick: handleExport, 23515 info: (0,external_wp_i18n_namespaceObject.__)( 23516 "Download your theme with updated templates and styles." 23517 ), 23518 children: (0,external_wp_i18n_namespaceObject._x)("Export", "site exporter menu item") 23519 } 23520 ); 23521 } 23522 23523 23524 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js 23525 23526 23527 23528 23529 23530 function WelcomeGuideMenuItem() { 23531 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 23532 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => toggle("core/edit-site", "welcomeGuide"), children: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide") }); 23533 } 23534 23535 23536 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js 23537 23538 23539 23540 23541 23542 const { ToolsMoreMenuGroup, PreferencesModal } = unlock(external_wp_editor_namespaceObject.privateApis); 23543 function MoreMenu() { 23544 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 23545 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { children: [ 23546 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), 23547 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {}) 23548 ] }), 23549 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {}) 23550 ] }); 23551 } 23552 23553 23554 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js 23555 23556 23557 23558 23559 23560 23561 23562 23563 23564 const { useLocation: use_editor_iframe_props_useLocation, useHistory: use_editor_iframe_props_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 23565 function useEditorIframeProps() { 23566 const { query, path } = use_editor_iframe_props_useLocation(); 23567 const history = use_editor_iframe_props_useHistory(); 23568 const { canvas = "view" } = query; 23569 const currentPostIsTrashed = (0,external_wp_data_.useSelect)((select) => { 23570 return select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash"; 23571 }, []); 23572 const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false); 23573 (0,external_wp_element_.useEffect)(() => { 23574 if (canvas === "edit") { 23575 setIsFocused(false); 23576 } 23577 }, [canvas]); 23578 const viewModeIframeProps = { 23579 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Edit"), 23580 "aria-disabled": currentPostIsTrashed, 23581 title: null, 23582 role: "button", 23583 tabIndex: 0, 23584 onFocus: () => setIsFocused(true), 23585 onBlur: () => setIsFocused(false), 23586 onKeyDown: (event) => { 23587 const { keyCode } = event; 23588 if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) { 23589 event.preventDefault(); 23590 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), { 23591 transition: "canvas-mode-edit-transition" 23592 }); 23593 } 23594 }, 23595 onClick: () => history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), { 23596 transition: "canvas-mode-edit-transition" 23597 }), 23598 onClickCapture: (event) => { 23599 if (currentPostIsTrashed) { 23600 event.preventDefault(); 23601 event.stopPropagation(); 23602 } 23603 }, 23604 readonly: true 23605 }; 23606 return { 23607 className: dist_clsx("edit-site-visual-editor__editor-canvas", { 23608 "is-focused": isFocused && canvas === "view" 23609 }), 23610 ...canvas === "view" ? viewModeIframeProps : {} 23611 }; 23612 } 23613 23614 23615 ;// ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js 23616 23617 23618 23619 23620 23621 23622 23623 23624 const { useLocation: use_title_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 23625 function useTitle(title) { 23626 const location = use_title_useLocation(); 23627 const siteTitle = (0,external_wp_data_.useSelect)( 23628 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "site")?.title, 23629 [] 23630 ); 23631 const isInitialLocationRef = (0,external_wp_element_.useRef)(true); 23632 (0,external_wp_element_.useEffect)(() => { 23633 isInitialLocationRef.current = false; 23634 }, [location]); 23635 (0,external_wp_element_.useEffect)(() => { 23636 if (isInitialLocationRef.current) { 23637 return; 23638 } 23639 if (title && siteTitle) { 23640 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 23641 /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ 23642 (0,external_wp_i18n_namespaceObject.__)("%1$s \u2039 %2$s \u2039 Editor \u2014 WordPress"), 23643 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), 23644 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) 23645 ); 23646 document.title = formattedTitle; 23647 (0,external_wp_a11y_namespaceObject.speak)(title, "assertive"); 23648 } 23649 }, [title, siteTitle, location]); 23650 } 23651 23652 23653 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js 23654 23655 23656 23657 23658 23659 23660 23661 23662 const { getTemplateInfo } = unlock(external_wp_editor_namespaceObject.privateApis); 23663 function useEditorTitle(postType, postId) { 23664 const { title, isLoaded } = (0,external_wp_data_.useSelect)( 23665 (select) => { 23666 const { 23667 getEditedEntityRecord, 23668 getCurrentTheme, 23669 hasFinishedResolution 23670 } = select(external_wp_coreData_namespaceObject.store); 23671 if (!postId) { 23672 return { isLoaded: false }; 23673 } 23674 const _record = getEditedEntityRecord( 23675 "postType", 23676 postType, 23677 postId 23678 ); 23679 const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {}; 23680 const templateInfo = getTemplateInfo({ 23681 template: _record, 23682 templateTypes 23683 }); 23684 const _isLoaded = hasFinishedResolution("getEditedEntityRecord", [ 23685 "postType", 23686 postType, 23687 postId 23688 ]); 23689 return { 23690 title: templateInfo.title, 23691 isLoaded: _isLoaded 23692 }; 23693 }, 23694 [postType, postId] 23695 ); 23696 let editorTitle; 23697 if (isLoaded) { 23698 editorTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 23699 // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part). 23700 (0,external_wp_i18n_namespaceObject._x)("%1$s \u2039 %2$s", "breadcrumb trail"), 23701 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), 23702 POST_TYPE_LABELS[postType] ?? POST_TYPE_LABELS[TEMPLATE_POST_TYPE] 23703 ); 23704 } 23705 useTitle(isLoaded && editorTitle); 23706 } 23707 var use_editor_title_default = useEditorTitle; 23708 23709 23710 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.js 23711 23712 23713 23714 23715 23716 function useAdaptEditorToCanvas(canvas) { 23717 const { clearSelectedBlock } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); 23718 const { 23719 setDeviceType, 23720 closePublishSidebar, 23721 setIsListViewOpened, 23722 setIsInserterOpened 23723 } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); 23724 const { get: getPreference } = (0,external_wp_data_.useSelect)(external_wp_preferences_.store); 23725 const registry = (0,external_wp_data_.useRegistry)(); 23726 (0,external_wp_element_.useLayoutEffect)(() => { 23727 const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches; 23728 registry.batch(() => { 23729 clearSelectedBlock(); 23730 setDeviceType("Desktop"); 23731 closePublishSidebar(); 23732 setIsInserterOpened(false); 23733 if (isMediumOrBigger && canvas === "edit" && getPreference("core", "showListViewByDefault") && !getPreference("core", "distractionFree")) { 23734 setIsListViewOpened(true); 23735 } else { 23736 setIsListViewOpened(false); 23737 } 23738 }); 23739 }, [ 23740 canvas, 23741 registry, 23742 clearSelectedBlock, 23743 setDeviceType, 23744 closePublishSidebar, 23745 setIsInserterOpened, 23746 setIsListViewOpened, 23747 getPreference 23748 ]); 23749 } 23750 23751 23752 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-resolve-edited-entity.js 23753 23754 23755 23756 23757 23758 23759 23760 const { useLocation: use_resolve_edited_entity_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 23761 const postTypesWithoutParentTemplate = [ 23762 TEMPLATE_POST_TYPE, 23763 TEMPLATE_PART_POST_TYPE, 23764 NAVIGATION_POST_TYPE, 23765 PATTERN_TYPES.user 23766 ]; 23767 const authorizedPostTypes = ["page", "post"]; 23768 function getPostType(name) { 23769 let postType; 23770 if (name === "navigation-item") { 23771 postType = NAVIGATION_POST_TYPE; 23772 } else if (name === "pattern-item") { 23773 postType = PATTERN_TYPES.user; 23774 } else if (name === "template-part-item") { 23775 postType = TEMPLATE_PART_POST_TYPE; 23776 } else if (name === "templates") { 23777 postType = TEMPLATE_POST_TYPE; 23778 } else if (name === "template-item") { 23779 postType = TEMPLATE_POST_TYPE; 23780 } else if (name === "page-item" || name === "pages") { 23781 postType = "page"; 23782 } else if (name === "post-item" || name === "posts") { 23783 postType = "post"; 23784 } 23785 return postType; 23786 } 23787 function useResolveEditedEntity() { 23788 const { name, params = {}, query } = use_resolve_edited_entity_useLocation(); 23789 const { postId = query?.postId } = params; 23790 const postType = getPostType(name, postId) ?? query?.postType; 23791 const homePage = (0,external_wp_data_.useSelect)((select) => { 23792 const { getHomePage } = unlock(select(external_wp_coreData_namespaceObject.store)); 23793 return getHomePage(); 23794 }, []); 23795 const resolvedTemplateId = (0,external_wp_data_.useSelect)( 23796 (select) => { 23797 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 23798 return; 23799 } 23800 if (postId && postId.includes(",")) { 23801 return; 23802 } 23803 const { getTemplateId } = unlock(select(external_wp_coreData_namespaceObject.store)); 23804 if (postType && postId && authorizedPostTypes.includes(postType)) { 23805 return getTemplateId(postType, postId); 23806 } 23807 if (homePage?.postType === "page") { 23808 return getTemplateId("page", homePage?.postId); 23809 } 23810 if (homePage?.postType === "wp_template") { 23811 return homePage?.postId; 23812 } 23813 }, 23814 [homePage, postId, postType] 23815 ); 23816 const context = (0,external_wp_element_.useMemo)(() => { 23817 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 23818 return {}; 23819 } 23820 if (postType && postId && authorizedPostTypes.includes(postType)) { 23821 return { postType, postId }; 23822 } 23823 if (homePage?.postType === "page") { 23824 return { postType: "page", postId: homePage?.postId }; 23825 } 23826 return {}; 23827 }, [homePage, postType, postId]); 23828 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 23829 return { isReady: true, postType, postId, context }; 23830 } 23831 if (!!homePage) { 23832 return { 23833 isReady: resolvedTemplateId !== void 0, 23834 postType: TEMPLATE_POST_TYPE, 23835 postId: resolvedTemplateId, 23836 context 23837 }; 23838 } 23839 return { isReady: false }; 23840 } 23841 function useSyncDeprecatedEntityIntoState({ 23842 postType, 23843 postId, 23844 context, 23845 isReady 23846 }) { 23847 const { setEditedEntity } = (0,external_wp_data_.useDispatch)(store); 23848 (0,external_wp_element_.useEffect)(() => { 23849 if (isReady) { 23850 setEditedEntity(postType, String(postId), context); 23851 } 23852 }, [isReady, postType, postId, context, setEditedEntity]); 23853 } 23854 23855 23856 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/site-preview.js 23857 23858 23859 23860 23861 23862 23863 function SitePreview() { 23864 const siteUrl = (0,external_wp_data_.useSelect)((select) => { 23865 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 23866 const siteData = getEntityRecord("root", "__unstableBase"); 23867 return siteData?.home; 23868 }, []); 23869 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23870 "iframe", 23871 { 23872 src: (0,external_wp_url_namespaceObject.addQueryArgs)(siteUrl, { 23873 // Parameter for hiding the admin bar. 23874 wp_site_preview: 1 23875 }), 23876 title: (0,external_wp_i18n_namespaceObject.__)("Site Preview"), 23877 style: { 23878 display: "block", 23879 width: "100%", 23880 height: "100%", 23881 backgroundColor: "#fff" 23882 }, 23883 onLoad: (event) => { 23884 const document = event.target.contentDocument; 23885 const focusableElements = external_wp_dom_namespaceObject.focus.focusable.find(document); 23886 focusableElements.forEach((element) => { 23887 element.style.pointerEvents = "none"; 23888 element.tabIndex = -1; 23889 element.setAttribute("aria-hidden", "true"); 23890 }); 23891 } 23892 } 23893 ); 23894 } 23895 23896 23897 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js 23898 23899 23900 23901 23902 23903 23904 23905 23906 23907 23908 23909 23910 23911 23912 23913 23914 23915 23916 23917 23918 23919 23920 23921 23922 23923 23924 23925 23926 23927 23928 23929 23930 23931 23932 23933 23934 23935 const { Editor, BackButton } = unlock(external_wp_editor_namespaceObject.privateApis); 23936 const { useHistory: editor_useHistory, useLocation: editor_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 23937 const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); 23938 const toggleHomeIconVariants = { 23939 edit: { 23940 opacity: 0, 23941 scale: 0.2 23942 }, 23943 hover: { 23944 opacity: 1, 23945 scale: 1, 23946 clipPath: "inset( 22% round 2px )" 23947 } 23948 }; 23949 const siteIconVariants = { 23950 edit: { 23951 clipPath: "inset(0% round 0px)" 23952 }, 23953 hover: { 23954 clipPath: "inset( 22% round 2px )" 23955 }, 23956 tap: { 23957 clipPath: "inset(0% round 0px)" 23958 } 23959 }; 23960 function getListPathForPostType(postType) { 23961 switch (postType) { 23962 case "navigation": 23963 return "/navigation"; 23964 case "wp_block": 23965 return "/pattern?postType=wp_block"; 23966 case "wp_template_part": 23967 return "/pattern?postType=wp_template_part"; 23968 case "wp_template": 23969 return "/template"; 23970 case "page": 23971 return "/page"; 23972 case "post": 23973 return "/"; 23974 } 23975 throw "Unknown post type"; 23976 } 23977 function getNavigationPath(location, postType) { 23978 const { path, name } = location; 23979 if ([ 23980 "pattern-item", 23981 "template-part-item", 23982 "page-item", 23983 "template-item", 23984 "static-template-item", 23985 "post-item" 23986 ].includes(name)) { 23987 return getListPathForPostType(postType); 23988 } 23989 return (0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: void 0 }); 23990 } 23991 function EditSiteEditor({ 23992 isHomeRoute = false, 23993 isPostsList = false 23994 }) { 23995 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 23996 const location = editor_useLocation(); 23997 const { canvas = "view" } = location.query; 23998 const isLoading = useIsSiteEditorLoading(); 23999 useAdaptEditorToCanvas(canvas); 24000 const entity = useResolveEditedEntity(); 24001 useSyncDeprecatedEntityIntoState(entity); 24002 const { postType, postId, context } = entity; 24003 const { 24004 isBlockBasedTheme, 24005 editorCanvasView, 24006 currentPostIsTrashed, 24007 hasSiteIcon 24008 } = (0,external_wp_data_.useSelect)((select) => { 24009 const { getEditorCanvasContainerView } = unlock( 24010 select(store) 24011 ); 24012 const { getCurrentTheme, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 24013 const siteData = getEntityRecord("root", "__unstableBase", void 0); 24014 return { 24015 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 24016 editorCanvasView: getEditorCanvasContainerView(), 24017 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash", 24018 hasSiteIcon: !!siteData?.site_icon_url 24019 }; 24020 }, []); 24021 const postWithTemplate = !!context?.postId; 24022 use_editor_title_default( 24023 postWithTemplate ? context.postType : postType, 24024 postWithTemplate ? context.postId : postId 24025 ); 24026 const _isPreviewingTheme = isPreviewingTheme(); 24027 const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer(); 24028 const iframeProps = useEditorIframeProps(); 24029 const isEditMode = canvas === "edit"; 24030 const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)( 24031 CanvasLoader, 24032 "edit-site-editor__loading-progress" 24033 ); 24034 const settings = useSpecificEditorSettings(); 24035 const styles = (0,external_wp_element_.useMemo)( 24036 () => [ 24037 ...settings.styles, 24038 { 24039 // Forming a "block formatting context" to prevent margin collapsing. 24040 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 24041 css: canvas === "view" ? `body{min-height: 100vh; $currentPostIsTrashed ? "" : "cursor: pointer;"}}` : void 0 24042 } 24043 ], 24044 [settings.styles, canvas, currentPostIsTrashed] 24045 ); 24046 const { resetZoomLevel } = unlock((0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 24047 const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 24048 const history = editor_useHistory(); 24049 const onActionPerformed = (0,external_wp_element_.useCallback)( 24050 (actionId, items) => { 24051 switch (actionId) { 24052 case "move-to-trash": 24053 case "delete-post": 24054 { 24055 history.navigate( 24056 getListPathForPostType( 24057 postWithTemplate ? context.postType : postType 24058 ) 24059 ); 24060 } 24061 break; 24062 case "duplicate-post": 24063 { 24064 const newItem = items[0]; 24065 const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered; 24066 createSuccessNotice( 24067 (0,external_wp_i18n_namespaceObject.sprintf)( 24068 // translators: %s: Title of the created post or template, e.g: "Hello world". 24069 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), 24070 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title) || (0,external_wp_i18n_namespaceObject.__)("(no title)") 24071 ), 24072 { 24073 type: "snackbar", 24074 id: "duplicate-post-action", 24075 actions: [ 24076 { 24077 label: (0,external_wp_i18n_namespaceObject.__)("Edit"), 24078 onClick: () => { 24079 history.navigate( 24080 `/$newItem.type}/$newItem.id}?canvas=edit` 24081 ); 24082 } 24083 } 24084 ] 24085 } 24086 ); 24087 } 24088 break; 24089 } 24090 }, 24091 [ 24092 postType, 24093 context?.postType, 24094 postWithTemplate, 24095 history, 24096 createSuccessNotice 24097 ] 24098 ); 24099 const title = getEditorCanvasContainerTitle(editorCanvasView); 24100 const isReady = !isLoading; 24101 const transition = { 24102 duration: disableMotion ? 0 : 0.2 24103 }; 24104 return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SitePreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24105 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24106 GlobalStylesRenderer, 24107 { 24108 disableRootPadding: postType !== TEMPLATE_POST_TYPE 24109 } 24110 ), 24111 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), 24112 isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), 24113 !isReady ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, { id: loadingProgressId }) : null, 24114 isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24115 WelcomeGuide, 24116 { 24117 postType: postWithTemplate ? context.postType : postType 24118 } 24119 ), 24120 isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 24121 Editor, 24122 { 24123 postType: postWithTemplate ? context.postType : postType, 24124 postId: postWithTemplate ? context.postId : postId, 24125 templateId: postWithTemplate ? postId : void 0, 24126 settings, 24127 className: "edit-site-editor__editor-interface", 24128 styles, 24129 customSaveButton: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { size: "compact" }), 24130 customSavePanel: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}), 24131 forceDisableBlockTools: !hasDefaultEditorCanvasView, 24132 title, 24133 iframeProps, 24134 onActionPerformed, 24135 extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel_default.Slot, {}), 24136 children: [ 24137 isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 24138 external_wp_components_namespaceObject.__unstableMotion.div, 24139 { 24140 className: "edit-site-editor__view-mode-toggle", 24141 transition, 24142 animate: "edit", 24143 initial: "edit", 24144 whileHover: "hover", 24145 whileTap: "tap", 24146 children: [ 24147 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24148 external_wp_components_namespaceObject.Button, 24149 { 24150 __next40pxDefaultSize: true, 24151 label: (0,external_wp_i18n_namespaceObject.__)("Open Navigation"), 24152 showTooltip: true, 24153 tooltipPosition: "middle right", 24154 onClick: () => { 24155 resetZoomLevel(); 24156 if (isPostsList && location.query?.focusMode) { 24157 history.navigate("/", { 24158 transition: "canvas-mode-view-transition" 24159 }); 24160 } else { 24161 history.navigate( 24162 getNavigationPath( 24163 location, 24164 postWithTemplate ? context.postType : postType 24165 ), 24166 { 24167 transition: "canvas-mode-view-transition" 24168 } 24169 ); 24170 } 24171 }, 24172 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24173 external_wp_components_namespaceObject.__unstableMotion.div, 24174 { 24175 variants: siteIconVariants, 24176 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-editor__view-mode-toggle-icon" }) 24177 } 24178 ) 24179 } 24180 ), 24181 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24182 external_wp_components_namespaceObject.__unstableMotion.div, 24183 { 24184 className: dist_clsx( 24185 "edit-site-editor__back-icon", 24186 { 24187 "has-site-icon": hasSiteIcon 24188 } 24189 ), 24190 variants: toggleHomeIconVariants, 24191 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: arrow_up_left_default }) 24192 } 24193 ) 24194 ] 24195 } 24196 ) }), 24197 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), 24198 isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {}) 24199 ] 24200 } 24201 ) 24202 ] }); 24203 } 24204 24205 24206 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/utils.js 24207 function isClassicThemeWithStyleBookSupport(siteData) { 24208 const isBlockTheme = siteData.currentTheme?.is_block_theme; 24209 const supportsEditorStyles = siteData.currentTheme?.theme_supports["editor-styles"]; 24210 const hasThemeJson = siteData.editorSettings?.supportsLayout; 24211 return !isBlockTheme && (supportsEditorStyles || hasThemeJson); 24212 } 24213 24214 24215 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/home.js 24216 24217 24218 24219 24220 24221 const homeRoute = { 24222 name: "home", 24223 path: "/", 24224 areas: { 24225 sidebar({ siteData }) { 24226 const isBlockTheme = siteData.currentTheme?.is_block_theme; 24227 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 24228 }, 24229 preview({ siteData }) { 24230 const isBlockTheme = siteData.currentTheme?.is_block_theme; 24231 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isHomeRoute: true }) : void 0; 24232 }, 24233 mobile({ siteData }) { 24234 const isBlockTheme = siteData.currentTheme?.is_block_theme; 24235 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 24236 } 24237 } 24238 }; 24239 24240 24241 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/styles.js 24242 24243 24244 24245 24246 24247 24248 24249 const { useLocation: styles_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 24250 function MobileGlobalStylesUI() { 24251 const { query = {} } = styles_useLocation(); 24252 const { canvas } = query; 24253 if (canvas === "edit") { 24254 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); 24255 } 24256 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}); 24257 } 24258 const stylesRoute = { 24259 name: "styles", 24260 path: "/styles", 24261 areas: { 24262 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}), 24263 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { backPath: "/" }), 24264 preview({ query }) { 24265 const isStylebook = query.preview === "stylebook"; 24266 return isStylebook ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); 24267 }, 24268 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileGlobalStylesUI, {}) 24269 }, 24270 widths: { 24271 content: 380 24272 } 24273 }; 24274 24275 24276 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js 24277 const PRELOADED_NAVIGATION_MENUS_QUERY = { 24278 per_page: 100, 24279 status: ["publish", "draft"], 24280 order: "desc", 24281 orderby: "date" 24282 }; 24283 24284 24285 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js 24286 24287 24288 24289 24290 const notEmptyString = (testString) => testString?.trim()?.length > 0; 24291 function RenameModal({ menuTitle, onClose, onSave }) { 24292 const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_.useState)(menuTitle); 24293 const titleHasChanged = editedMenuTitle !== menuTitle; 24294 const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); 24295 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24296 external_wp_components_namespaceObject.Modal, 24297 { 24298 title: (0,external_wp_i18n_namespaceObject.__)("Rename"), 24299 onRequestClose: onClose, 24300 focusOnMount: "firstContentElement", 24301 size: "small", 24302 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { className: "sidebar-navigation__rename-modal-form", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ 24303 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24304 external_wp_components_namespaceObject.TextControl, 24305 { 24306 __nextHasNoMarginBottom: true, 24307 __next40pxDefaultSize: true, 24308 value: editedMenuTitle, 24309 placeholder: (0,external_wp_i18n_namespaceObject.__)("Navigation title"), 24310 onChange: setEditedMenuTitle, 24311 label: (0,external_wp_i18n_namespaceObject.__)("Name") 24312 } 24313 ), 24314 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 24315 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24316 external_wp_components_namespaceObject.Button, 24317 { 24318 __next40pxDefaultSize: true, 24319 variant: "tertiary", 24320 onClick: onClose, 24321 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 24322 } 24323 ), 24324 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24325 external_wp_components_namespaceObject.Button, 24326 { 24327 __next40pxDefaultSize: true, 24328 accessibleWhenDisabled: true, 24329 disabled: !isEditedMenuTitleValid, 24330 variant: "primary", 24331 type: "submit", 24332 onClick: (e) => { 24333 e.preventDefault(); 24334 if (!isEditedMenuTitleValid) { 24335 return; 24336 } 24337 onSave({ title: editedMenuTitle }); 24338 onClose(); 24339 }, 24340 children: (0,external_wp_i18n_namespaceObject.__)("Save") 24341 } 24342 ) 24343 ] }) 24344 ] }) }) 24345 } 24346 ); 24347 } 24348 24349 24350 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js 24351 24352 24353 24354 function DeleteConfirmDialog({ onClose, onConfirm }) { 24355 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24356 external_wp_components_namespaceObject.__experimentalConfirmDialog, 24357 { 24358 isOpen: true, 24359 onConfirm: () => { 24360 onConfirm(); 24361 onClose(); 24362 }, 24363 onCancel: onClose, 24364 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), 24365 size: "medium", 24366 children: (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to delete this Navigation Menu?") 24367 } 24368 ); 24369 } 24370 24371 24372 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 const { useHistory: more_menu_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 24383 const POPOVER_PROPS = { 24384 position: "bottom right" 24385 }; 24386 function ScreenNavigationMoreMenu(props) { 24387 const { onDelete, onSave, onDuplicate, menuTitle, menuId } = props; 24388 const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_.useState)(false); 24389 const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_.useState)(false); 24390 const history = more_menu_useHistory(); 24391 const closeModals = () => { 24392 setRenameModalOpen(false); 24393 setDeleteConfirmDialogOpen(false); 24394 }; 24395 const openRenameModal = () => setRenameModalOpen(true); 24396 const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); 24397 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24398 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24399 external_wp_components_namespaceObject.DropdownMenu, 24400 { 24401 className: "sidebar-navigation__more-menu", 24402 label: (0,external_wp_i18n_namespaceObject.__)("Actions"), 24403 icon: more_vertical_default, 24404 popoverProps: POPOVER_PROPS, 24405 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 24406 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24407 external_wp_components_namespaceObject.MenuItem, 24408 { 24409 onClick: () => { 24410 openRenameModal(); 24411 onClose(); 24412 }, 24413 children: (0,external_wp_i18n_namespaceObject.__)("Rename") 24414 } 24415 ), 24416 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24417 external_wp_components_namespaceObject.MenuItem, 24418 { 24419 onClick: () => { 24420 history.navigate( 24421 `/wp_navigation/$menuId}?canvas=edit` 24422 ); 24423 }, 24424 children: (0,external_wp_i18n_namespaceObject.__)("Edit") 24425 } 24426 ), 24427 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24428 external_wp_components_namespaceObject.MenuItem, 24429 { 24430 onClick: () => { 24431 onDuplicate(); 24432 onClose(); 24433 }, 24434 children: (0,external_wp_i18n_namespaceObject.__)("Duplicate") 24435 } 24436 ), 24437 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24438 external_wp_components_namespaceObject.MenuItem, 24439 { 24440 isDestructive: true, 24441 onClick: () => { 24442 openDeleteConfirmDialog(); 24443 onClose(); 24444 }, 24445 children: (0,external_wp_i18n_namespaceObject.__)("Delete") 24446 } 24447 ) 24448 ] }) 24449 } 24450 ), 24451 deleteConfirmDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24452 DeleteConfirmDialog, 24453 { 24454 onClose: closeModals, 24455 onConfirm: onDelete 24456 } 24457 ), 24458 renameModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24459 RenameModal, 24460 { 24461 onClose: closeModals, 24462 menuTitle, 24463 onSave 24464 } 24465 ) 24466 ] }); 24467 } 24468 24469 24470 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 24471 24472 24473 var chevron_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); 24474 24475 24476 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 24477 24478 24479 var chevron_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); 24480 24481 24482 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js 24483 24484 24485 24486 24487 24488 24489 24490 24491 const leaf_more_menu_POPOVER_PROPS = { 24492 className: "block-editor-block-settings-menu__popover", 24493 placement: "bottom-start" 24494 }; 24495 24496 const { useHistory: leaf_more_menu_useHistory, useLocation: leaf_more_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 24497 function LeafMoreMenu(props) { 24498 const history = leaf_more_menu_useHistory(); 24499 const { path } = leaf_more_menu_useLocation(); 24500 const { block } = props; 24501 const { clientId } = block; 24502 const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); 24503 const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 24504 /* translators: %s: block name */ 24505 (0,external_wp_i18n_namespaceObject.__)("Remove %s"), 24506 (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 }) 24507 ); 24508 const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 24509 /* translators: %s: block name */ 24510 (0,external_wp_i18n_namespaceObject.__)("Go to %s"), 24511 (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 }) 24512 ); 24513 const rootClientId = (0,external_wp_data_.useSelect)( 24514 (select) => { 24515 const { getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); 24516 return getBlockRootClientId(clientId); 24517 }, 24518 [clientId] 24519 ); 24520 const onGoToPage = (0,external_wp_element_.useCallback)( 24521 (selectedBlock) => { 24522 const { attributes, name } = selectedBlock; 24523 if (attributes.kind === "post-type" && attributes.id && attributes.type && history) { 24524 history.navigate( 24525 `/$attributes.type}/$attributes.id}?canvas=edit`, 24526 { 24527 state: { backPath: path } 24528 } 24529 ); 24530 } 24531 if (name === "core/page-list-item" && attributes.id && history) { 24532 history.navigate(`/page/$attributes.id}?canvas=edit`, { 24533 state: { backPath: path } 24534 }); 24535 } 24536 }, 24537 [path, history] 24538 ); 24539 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24540 external_wp_components_namespaceObject.DropdownMenu, 24541 { 24542 icon: more_vertical_default, 24543 label: (0,external_wp_i18n_namespaceObject.__)("Options"), 24544 className: "block-editor-block-settings-menu", 24545 popoverProps: leaf_more_menu_POPOVER_PROPS, 24546 noIcons: true, 24547 ...props, 24548 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24549 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 24550 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24551 external_wp_components_namespaceObject.MenuItem, 24552 { 24553 icon: chevron_up_default, 24554 onClick: () => { 24555 moveBlocksUp([clientId], rootClientId); 24556 onClose(); 24557 }, 24558 children: (0,external_wp_i18n_namespaceObject.__)("Move up") 24559 } 24560 ), 24561 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24562 external_wp_components_namespaceObject.MenuItem, 24563 { 24564 icon: chevron_down_default, 24565 onClick: () => { 24566 moveBlocksDown([clientId], rootClientId); 24567 onClose(); 24568 }, 24569 children: (0,external_wp_i18n_namespaceObject.__)("Move down") 24570 } 24571 ), 24572 block.attributes?.type === "page" && block.attributes?.id && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24573 external_wp_components_namespaceObject.MenuItem, 24574 { 24575 onClick: () => { 24576 onGoToPage(block); 24577 onClose(); 24578 }, 24579 children: goToLabel 24580 } 24581 ) 24582 ] }), 24583 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24584 external_wp_components_namespaceObject.MenuItem, 24585 { 24586 onClick: () => { 24587 removeBlocks([clientId], false); 24588 onClose(); 24589 }, 24590 children: removeLabel 24591 } 24592 ) }) 24593 ] }) 24594 } 24595 ); 24596 } 24597 24598 24599 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js 24600 24601 24602 24603 24604 24605 24606 24607 24608 const { PrivateListView } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 24609 const MAX_PAGE_COUNT = 100; 24610 const PAGES_QUERY = [ 24611 "postType", 24612 "page", 24613 { 24614 per_page: MAX_PAGE_COUNT, 24615 _fields: ["id", "link", "menu_order", "parent", "title", "type"], 24616 // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby 24617 // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent 24618 // sort. 24619 orderby: "menu_order", 24620 order: "asc" 24621 } 24622 ]; 24623 function NavigationMenuContent({ rootClientId }) { 24624 const { listViewRootClientId, isLoading } = (0,external_wp_data_.useSelect)( 24625 (select) => { 24626 const { 24627 areInnerBlocksControlled, 24628 getBlockName, 24629 getBlockCount, 24630 getBlockOrder 24631 } = select(external_wp_blockEditor_namespaceObject.store); 24632 const { isResolving } = select(external_wp_coreData_namespaceObject.store); 24633 const blockClientIds = getBlockOrder(rootClientId); 24634 const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === "core/page-list"; 24635 const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; 24636 const isLoadingPages = isResolving( 24637 "getEntityRecords", 24638 PAGES_QUERY 24639 ); 24640 return { 24641 listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, 24642 // This is a small hack to wait for the navigation block 24643 // to actually load its inner blocks. 24644 isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages 24645 }; 24646 }, 24647 [rootClientId] 24648 ); 24649 const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); 24650 const offCanvasOnselect = (0,external_wp_element_.useCallback)( 24651 (block) => { 24652 if (block.name === "core/navigation-link" && !block.attributes.url) { 24653 __unstableMarkNextChangeAsNotPersistent(); 24654 replaceBlock( 24655 block.clientId, 24656 (0,external_wp_blocks_namespaceObject.createBlock)("core/navigation-link", block.attributes) 24657 ); 24658 } 24659 }, 24660 [__unstableMarkNextChangeAsNotPersistent, replaceBlock] 24661 ); 24662 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24663 !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24664 PrivateListView, 24665 { 24666 rootClientId: listViewRootClientId, 24667 onSelect: offCanvasOnselect, 24668 blockSettingsMenu: LeafMoreMenu, 24669 showAppender: false, 24670 isExpanded: true 24671 } 24672 ), 24673 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) }) 24674 ] }); 24675 } 24676 24677 24678 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js 24679 24680 24681 24682 24683 24684 24685 24686 24687 const navigation_menu_editor_noop = () => { 24688 }; 24689 function NavigationMenuEditor({ navigationMenuId }) { 24690 const { storedSettings } = (0,external_wp_data_.useSelect)((select) => { 24691 const { getSettings } = unlock(select(store)); 24692 return { 24693 storedSettings: getSettings() 24694 }; 24695 }, []); 24696 const blocks = (0,external_wp_element_.useMemo)(() => { 24697 if (!navigationMenuId) { 24698 return []; 24699 } 24700 return [(0,external_wp_blocks_namespaceObject.createBlock)("core/navigation", { ref: navigationMenuId })]; 24701 }, [navigationMenuId]); 24702 if (!navigationMenuId || !blocks?.length) { 24703 return null; 24704 } 24705 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24706 external_wp_blockEditor_namespaceObject.BlockEditorProvider, 24707 { 24708 settings: storedSettings, 24709 value: blocks, 24710 onChange: navigation_menu_editor_noop, 24711 onInput: navigation_menu_editor_noop, 24712 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { rootClientId: blocks[0].clientId }) }) 24713 } 24714 ); 24715 } 24716 24717 24718 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js 24719 24720 24721 function buildNavigationLabel(title, id, status) { 24722 if (!title?.rendered) { 24723 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id); 24724 } 24725 if (status === "publish") { 24726 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered); 24727 } 24728 return (0,external_wp_i18n_namespaceObject.sprintf)( 24729 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 24730 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"), 24731 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), 24732 status 24733 ); 24734 } 24735 24736 24737 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js 24738 24739 24740 24741 24742 24743 24744 24745 function SingleNavigationMenu({ 24746 navigationMenu, 24747 backPath, 24748 handleDelete, 24749 handleDuplicate, 24750 handleSave 24751 }) { 24752 const menuTitle = navigationMenu?.title?.rendered; 24753 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24754 SidebarNavigationScreenWrapper, 24755 { 24756 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24757 ScreenNavigationMoreMenu, 24758 { 24759 menuId: navigationMenu?.id, 24760 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 24761 onDelete: handleDelete, 24762 onSave: handleSave, 24763 onDuplicate: handleDuplicate 24764 } 24765 ) }), 24766 backPath, 24767 title: buildNavigationLabel( 24768 navigationMenu?.title, 24769 navigationMenu?.id, 24770 navigationMenu?.status 24771 ), 24772 description: (0,external_wp_i18n_namespaceObject.__)( 24773 "Navigation Menus are a curated collection of blocks that allow visitors to get around your site." 24774 ), 24775 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { navigationMenuId: navigationMenu?.id }) 24776 } 24777 ); 24778 } 24779 24780 24781 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js 24782 24783 24784 24785 24786 24787 24788 24789 24790 24791 24792 24793 24794 24795 const { useLocation: sidebar_navigation_screen_navigation_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 24796 const postType = `wp_navigation`; 24797 function SidebarNavigationScreenNavigationMenu({ backPath }) { 24798 const { 24799 params: { postId } 24800 } = sidebar_navigation_screen_navigation_menu_useLocation(); 24801 const { record: navigationMenu, isResolving } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( 24802 "postType", 24803 postType, 24804 postId 24805 ); 24806 const { isSaving, isDeleting } = (0,external_wp_data_.useSelect)( 24807 (select) => { 24808 const { isSavingEntityRecord, isDeletingEntityRecord } = select(external_wp_coreData_namespaceObject.store); 24809 return { 24810 isSaving: isSavingEntityRecord("postType", postType, postId), 24811 isDeleting: isDeletingEntityRecord( 24812 "postType", 24813 postType, 24814 postId 24815 ) 24816 }; 24817 }, 24818 [postId] 24819 ); 24820 const isLoading = isResolving || isSaving || isDeleting; 24821 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 24822 const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); 24823 const _handleDelete = () => handleDelete(navigationMenu); 24824 const _handleSave = (edits) => handleSave(navigationMenu, edits); 24825 const _handleDuplicate = () => handleDuplicate(navigationMenu); 24826 if (isLoading) { 24827 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24828 SidebarNavigationScreenWrapper, 24829 { 24830 description: (0,external_wp_i18n_namespaceObject.__)( 24831 "Navigation Menus are a curated collection of blocks that allow visitors to get around your site." 24832 ), 24833 backPath, 24834 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) 24835 } 24836 ); 24837 } 24838 if (!isLoading && !navigationMenu) { 24839 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24840 SidebarNavigationScreenWrapper, 24841 { 24842 description: (0,external_wp_i18n_namespaceObject.__)("Navigation Menu missing."), 24843 backPath 24844 } 24845 ); 24846 } 24847 if (!navigationMenu?.content?.raw) { 24848 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24849 SidebarNavigationScreenWrapper, 24850 { 24851 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24852 ScreenNavigationMoreMenu, 24853 { 24854 menuId: navigationMenu?.id, 24855 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 24856 onDelete: _handleDelete, 24857 onSave: _handleSave, 24858 onDuplicate: _handleDuplicate 24859 } 24860 ), 24861 backPath, 24862 title: buildNavigationLabel( 24863 navigationMenu?.title, 24864 navigationMenu?.id, 24865 navigationMenu?.status 24866 ), 24867 description: (0,external_wp_i18n_namespaceObject.__)("This Navigation Menu is empty.") 24868 } 24869 ); 24870 } 24871 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24872 SingleNavigationMenu, 24873 { 24874 navigationMenu, 24875 backPath, 24876 handleDelete: _handleDelete, 24877 handleSave: _handleSave, 24878 handleDuplicate: _handleDuplicate 24879 } 24880 ); 24881 } 24882 24883 24884 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js 24885 24886 24887 24888 24889 24890 24891 24892 24893 const { useHistory: use_navigation_menu_handlers_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 24894 function useDeleteNavigationMenu() { 24895 const { deleteEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 24896 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 24897 const history = use_navigation_menu_handlers_useHistory(); 24898 const handleDelete = async (navigationMenu) => { 24899 const postId = navigationMenu?.id; 24900 try { 24901 await deleteEntityRecord( 24902 "postType", 24903 postType, 24904 postId, 24905 { 24906 force: true 24907 }, 24908 { 24909 throwOnError: true 24910 } 24911 ); 24912 createSuccessNotice( 24913 (0,external_wp_i18n_namespaceObject.__)("Navigation Menu successfully deleted."), 24914 { 24915 type: "snackbar" 24916 } 24917 ); 24918 history.navigate("/navigation"); 24919 } catch (error) { 24920 createErrorNotice( 24921 (0,external_wp_i18n_namespaceObject.sprintf)( 24922 /* translators: %s: error message describing why the navigation menu could not be deleted. */ 24923 (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), 24924 error?.message 24925 ), 24926 { 24927 type: "snackbar" 24928 } 24929 ); 24930 } 24931 }; 24932 return handleDelete; 24933 } 24934 function useSaveNavigationMenu() { 24935 const { getEditedEntityRecord } = (0,external_wp_data_.useSelect)((select) => { 24936 const { getEditedEntityRecord: getEditedEntityRecordSelector } = select(external_wp_coreData_namespaceObject.store); 24937 return { 24938 getEditedEntityRecord: getEditedEntityRecordSelector 24939 }; 24940 }, []); 24941 const { 24942 editEntityRecord, 24943 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 24944 } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 24945 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 24946 const handleSave = async (navigationMenu, edits) => { 24947 if (!edits) { 24948 return; 24949 } 24950 const postId = navigationMenu?.id; 24951 const originalRecord = getEditedEntityRecord( 24952 "postType", 24953 NAVIGATION_POST_TYPE, 24954 postId 24955 ); 24956 editEntityRecord("postType", postType, postId, edits); 24957 const recordPropertiesToSave = Object.keys(edits); 24958 try { 24959 await saveSpecifiedEntityEdits( 24960 "postType", 24961 postType, 24962 postId, 24963 recordPropertiesToSave, 24964 { 24965 throwOnError: true 24966 } 24967 ); 24968 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Renamed Navigation Menu"), { 24969 type: "snackbar" 24970 }); 24971 } catch (error) { 24972 editEntityRecord("postType", postType, postId, originalRecord); 24973 createErrorNotice( 24974 (0,external_wp_i18n_namespaceObject.sprintf)( 24975 /* translators: %s: error message describing why the navigation menu could not be renamed. */ 24976 (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), 24977 error?.message 24978 ), 24979 { 24980 type: "snackbar" 24981 } 24982 ); 24983 } 24984 }; 24985 return handleSave; 24986 } 24987 function useDuplicateNavigationMenu() { 24988 const history = use_navigation_menu_handlers_useHistory(); 24989 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 24990 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 24991 const handleDuplicate = async (navigationMenu) => { 24992 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 24993 try { 24994 const savedRecord = await saveEntityRecord( 24995 "postType", 24996 postType, 24997 { 24998 title: (0,external_wp_i18n_namespaceObject.sprintf)( 24999 /* translators: %s: Navigation menu title */ 25000 (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "navigation menu"), 25001 menuTitle 25002 ), 25003 content: navigationMenu?.content?.raw, 25004 status: "publish" 25005 }, 25006 { 25007 throwOnError: true 25008 } 25009 ); 25010 if (savedRecord) { 25011 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Duplicated Navigation Menu"), { 25012 type: "snackbar" 25013 }); 25014 history.navigate(`/wp_navigation/$savedRecord.id}`); 25015 } 25016 } catch (error) { 25017 createErrorNotice( 25018 (0,external_wp_i18n_namespaceObject.sprintf)( 25019 /* translators: %s: error message describing why the navigation menu could not be deleted. */ 25020 (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), 25021 error?.message 25022 ), 25023 { 25024 type: "snackbar" 25025 } 25026 ); 25027 } 25028 }; 25029 return handleDuplicate; 25030 } 25031 function useNavigationMenuHandlers() { 25032 return { 25033 handleDelete: useDeleteNavigationMenu(), 25034 handleSave: useSaveNavigationMenu(), 25035 handleDuplicate: useDuplicateNavigationMenu() 25036 }; 25037 } 25038 25039 25040 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js 25041 25042 25043 25044 25045 25046 25047 25048 25049 25050 25051 25052 25053 25054 25055 function buildMenuLabel(title, id, status) { 25056 if (!title) { 25057 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id); 25058 } 25059 if (status === "publish") { 25060 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); 25061 } 25062 return (0,external_wp_i18n_namespaceObject.sprintf)( 25063 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 25064 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"), 25065 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), 25066 status 25067 ); 25068 } 25069 function SidebarNavigationScreenNavigationMenus({ backPath }) { 25070 const { 25071 records: navigationMenus, 25072 isResolving: isResolvingNavigationMenus, 25073 hasResolved: hasResolvedNavigationMenus 25074 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( 25075 "postType", 25076 NAVIGATION_POST_TYPE, 25077 PRELOADED_NAVIGATION_MENUS_QUERY 25078 ); 25079 const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; 25080 const { getNavigationFallbackId } = unlock((0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store)); 25081 const isCreatingNavigationFallback = (0,external_wp_data_.useSelect)( 25082 (select) => select(external_wp_coreData_namespaceObject.store).isResolving("getNavigationFallbackId"), 25083 [] 25084 ); 25085 const firstNavigationMenu = navigationMenus?.[0]; 25086 if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && // Ensure a fallback navigation is created only once 25087 !isCreatingNavigationFallback) { 25088 getNavigationFallbackId(); 25089 } 25090 const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); 25091 const hasNavigationMenus = !!navigationMenus?.length; 25092 if (isLoading) { 25093 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) }); 25094 } 25095 if (!isLoading && !hasNavigationMenus) { 25096 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25097 SidebarNavigationScreenWrapper, 25098 { 25099 description: (0,external_wp_i18n_namespaceObject.__)("No Navigation Menus found."), 25100 backPath 25101 } 25102 ); 25103 } 25104 if (navigationMenus?.length === 1) { 25105 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25106 SingleNavigationMenu, 25107 { 25108 navigationMenu: firstNavigationMenu, 25109 backPath, 25110 handleDelete: () => handleDelete(firstNavigationMenu), 25111 handleDuplicate: () => handleDuplicate(firstNavigationMenu), 25112 handleSave: (edits) => handleSave(firstNavigationMenu, edits) 25113 } 25114 ); 25115 } 25116 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-navigation-menus", children: navigationMenus?.map(({ id, title, status }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25117 NavMenuItem, 25118 { 25119 postId: id, 25120 withChevron: true, 25121 icon: navigation_default, 25122 children: buildMenuLabel(title?.rendered, index + 1, status) 25123 }, 25124 id 25125 )) }) }); 25126 } 25127 function SidebarNavigationScreenWrapper({ 25128 children, 25129 actions, 25130 title, 25131 description, 25132 backPath 25133 }) { 25134 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25135 SidebarNavigationScreen, 25136 { 25137 title: title || (0,external_wp_i18n_namespaceObject.__)("Navigation"), 25138 actions, 25139 description: description || (0,external_wp_i18n_namespaceObject.__)("Manage your Navigation Menus."), 25140 backPath, 25141 content: children 25142 } 25143 ); 25144 } 25145 const NavMenuItem = ({ postId, ...props }) => { 25146 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25147 SidebarNavigationItem, 25148 { 25149 to: `/wp_navigation/$postId}`, 25150 ...props 25151 } 25152 ); 25153 }; 25154 25155 25156 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation.js 25157 25158 25159 25160 25161 25162 25163 const { useLocation: navigation_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 25164 function MobileNavigationView() { 25165 const { query = {} } = navigation_useLocation(); 25166 const { canvas = "view" } = query; 25167 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }); 25168 } 25169 const navigationRoute = { 25170 name: "navigation", 25171 path: "/navigation", 25172 areas: { 25173 sidebar({ siteData }) { 25174 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25175 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 25176 }, 25177 preview({ siteData }) { 25178 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25179 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0; 25180 }, 25181 mobile({ siteData }) { 25182 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25183 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 25184 } 25185 } 25186 }; 25187 25188 25189 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation-item.js 25190 25191 25192 25193 25194 25195 25196 const { useLocation: navigation_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 25197 function MobileNavigationItemView() { 25198 const { query = {} } = navigation_item_useLocation(); 25199 const { canvas = "view" } = query; 25200 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }); 25201 } 25202 const navigationItemRoute = { 25203 name: "navigation-item", 25204 path: "/wp_navigation/:postId", 25205 areas: { 25206 sidebar({ siteData }) { 25207 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25208 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 25209 }, 25210 preview({ siteData }) { 25211 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25212 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 25213 }, 25214 mobile({ siteData }) { 25215 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25216 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationItemView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 25217 } 25218 } 25219 }; 25220 25221 25222 ;// ./node_modules/@wordpress/icons/build-module/library/file.js 25223 25224 25225 var file_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25226 external_wp_primitives_namespaceObject.Path, 25227 { 25228 fillRule: "evenodd", 25229 clipRule: "evenodd", 25230 d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" 25231 } 25232 ) }); 25233 25234 25235 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js 25236 25237 25238 function CategoryItem({ 25239 count, 25240 icon, 25241 id, 25242 isActive, 25243 label, 25244 type 25245 }) { 25246 if (!count) { 25247 return; 25248 } 25249 const queryArgs = [`postType=$type}`]; 25250 if (id) { 25251 queryArgs.push(`categoryId=$id}`); 25252 } 25253 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25254 SidebarNavigationItem, 25255 { 25256 icon, 25257 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: count }), 25258 "aria-current": isActive ? "true" : void 0, 25259 to: `/pattern?$queryArgs.join("&")}`, 25260 children: label 25261 } 25262 ); 25263 } 25264 25265 25266 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js 25267 25268 25269 25270 25271 function useDefaultPatternCategories() { 25272 const blockPatternCategories = (0,external_wp_data_.useSelect)((select) => { 25273 const { getSettings } = unlock(select(store)); 25274 const settings = getSettings(); 25275 return settings.__experimentalAdditionalBlockPatternCategories ?? settings.__experimentalBlockPatternCategories; 25276 }); 25277 const restBlockPatternCategories = (0,external_wp_data_.useSelect)( 25278 (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories() 25279 ); 25280 return [ 25281 ...blockPatternCategories || [], 25282 ...restBlockPatternCategories || [] 25283 ]; 25284 } 25285 25286 25287 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js 25288 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex((item) => currentItem.name === item.name); 25289 25290 25291 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js 25292 25293 25294 25295 25296 25297 25298 25299 function useThemePatterns() { 25300 const blockPatterns = (0,external_wp_data_.useSelect)((select) => { 25301 const { getSettings } = unlock(select(store)); 25302 return getSettings().__experimentalAdditionalBlockPatterns ?? getSettings().__experimentalBlockPatterns; 25303 }); 25304 const restBlockPatterns = (0,external_wp_data_.useSelect)( 25305 (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatterns() 25306 ); 25307 const patterns = (0,external_wp_element_.useMemo)( 25308 () => [...blockPatterns || [], ...restBlockPatterns || []].filter( 25309 (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source) 25310 ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false), 25311 [blockPatterns, restBlockPatterns] 25312 ); 25313 return patterns; 25314 } 25315 25316 25317 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js 25318 25319 25320 const { extractWords, getNormalizedSearchTerms, normalizeString } = unlock( 25321 external_wp_blockEditor_namespaceObject.privateApis 25322 ); 25323 25324 const defaultGetName = (item) => { 25325 if (item.type === PATTERN_TYPES.user) { 25326 return item.slug; 25327 } 25328 if (item.type === TEMPLATE_PART_POST_TYPE) { 25329 return ""; 25330 } 25331 return item.name || ""; 25332 }; 25333 const defaultGetTitle = (item) => { 25334 if (typeof item.title === "string") { 25335 return item.title; 25336 } 25337 if (item.title && item.title.rendered) { 25338 return item.title.rendered; 25339 } 25340 if (item.title && item.title.raw) { 25341 return item.title.raw; 25342 } 25343 return ""; 25344 }; 25345 const defaultGetDescription = (item) => { 25346 if (item.type === PATTERN_TYPES.user) { 25347 return item.excerpt.raw; 25348 } 25349 return item.description || ""; 25350 }; 25351 const defaultGetKeywords = (item) => item.keywords || []; 25352 const defaultHasCategory = () => false; 25353 const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 25354 return unmatchedTerms.filter( 25355 (term) => !getNormalizedSearchTerms(unprocessedTerms).some( 25356 (unprocessedTerm) => unprocessedTerm.includes(term) 25357 ) 25358 ); 25359 }; 25360 const searchItems = (items = [], searchInput = "", config = {}) => { 25361 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 25362 const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; 25363 const searchRankConfig = { ...config, onlyFilterByCategory }; 25364 const threshold = onlyFilterByCategory ? 0 : 1; 25365 const rankedItems = items.map((item) => { 25366 return [ 25367 item, 25368 getItemSearchRank(item, searchInput, searchRankConfig) 25369 ]; 25370 }).filter(([, rank]) => rank > threshold); 25371 if (normalizedSearchTerms.length === 0) { 25372 return rankedItems.map(([item]) => item); 25373 } 25374 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 25375 return rankedItems.map(([item]) => item); 25376 }; 25377 function getItemSearchRank(item, searchTerm, config) { 25378 const { 25379 categoryId, 25380 getName = defaultGetName, 25381 getTitle = defaultGetTitle, 25382 getDescription = defaultGetDescription, 25383 getKeywords = defaultGetKeywords, 25384 hasCategory = defaultHasCategory, 25385 onlyFilterByCategory 25386 } = config; 25387 let rank = categoryId === PATTERN_DEFAULT_CATEGORY || categoryId === TEMPLATE_PART_ALL_AREAS_CATEGORY || categoryId === PATTERN_USER_CATEGORY && item.type === PATTERN_TYPES.user || hasCategory(item, categoryId) ? 1 : 0; 25388 if (!rank || onlyFilterByCategory) { 25389 return rank; 25390 } 25391 const name = getName(item); 25392 const title = getTitle(item); 25393 const description = getDescription(item); 25394 const keywords = getKeywords(item); 25395 const normalizedSearchInput = normalizeString(searchTerm); 25396 const normalizedTitle = normalizeString(title); 25397 if (normalizedSearchInput === normalizedTitle) { 25398 rank += 30; 25399 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 25400 rank += 20; 25401 } else { 25402 const terms = [name, title, description, ...keywords].join(" "); 25403 const normalizedSearchTerms = extractWords(normalizedSearchInput); 25404 const unmatchedTerms = removeMatchingTerms( 25405 normalizedSearchTerms, 25406 terms 25407 ); 25408 if (unmatchedTerms.length === 0) { 25409 rank += 10; 25410 } 25411 } 25412 return rank; 25413 } 25414 25415 25416 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js 25417 25418 25419 25420 25421 25422 25423 25424 25425 25426 const EMPTY_PATTERN_LIST = []; 25427 const selectTemplateParts = (0,external_wp_data_.createSelector)( 25428 (select, categoryId, search = "") => { 25429 const { 25430 getEntityRecords, 25431 getCurrentTheme, 25432 isResolving: isResolvingSelector 25433 } = select(external_wp_coreData_namespaceObject.store); 25434 const query = { per_page: -1 }; 25435 const templateParts = getEntityRecords("postType", TEMPLATE_PART_POST_TYPE, query) ?? EMPTY_PATTERN_LIST; 25436 const knownAreas = getCurrentTheme()?.default_template_part_areas || []; 25437 const templatePartAreas = knownAreas.map((area) => area.area); 25438 const templatePartHasCategory = (item, category) => { 25439 if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { 25440 return item.area === category; 25441 } 25442 return item.area === category || !templatePartAreas.includes(item.area); 25443 }; 25444 const isResolving = isResolvingSelector("getEntityRecords", [ 25445 "postType", 25446 TEMPLATE_PART_POST_TYPE, 25447 query 25448 ]); 25449 const patterns = searchItems(templateParts, search, { 25450 categoryId, 25451 hasCategory: templatePartHasCategory 25452 }); 25453 return { patterns, isResolving }; 25454 }, 25455 (select) => [ 25456 select(external_wp_coreData_namespaceObject.store).getEntityRecords( 25457 "postType", 25458 TEMPLATE_PART_POST_TYPE, 25459 { 25460 per_page: -1 25461 } 25462 ), 25463 select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [ 25464 "postType", 25465 TEMPLATE_PART_POST_TYPE, 25466 { per_page: -1 } 25467 ]), 25468 select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas 25469 ] 25470 ); 25471 const selectThemePatterns = (0,external_wp_data_.createSelector)( 25472 (select) => { 25473 const { getSettings } = unlock(select(store)); 25474 const { isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store); 25475 const settings = getSettings(); 25476 const blockPatterns = settings.__experimentalAdditionalBlockPatterns ?? settings.__experimentalBlockPatterns; 25477 const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns(); 25478 const patterns = [ 25479 ...blockPatterns || [], 25480 ...restBlockPatterns || [] 25481 ].filter( 25482 (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source) 25483 ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false).map((pattern) => ({ 25484 ...pattern, 25485 keywords: pattern.keywords || [], 25486 type: PATTERN_TYPES.theme, 25487 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 25488 __unstableSkipMigrationLogs: true 25489 }) 25490 })); 25491 return { 25492 patterns, 25493 isResolving: isResolvingSelector("getBlockPatterns") 25494 }; 25495 }, 25496 (select) => [ 25497 select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), 25498 select(external_wp_coreData_namespaceObject.store).isResolving("getBlockPatterns"), 25499 unlock(select(store)).getSettings() 25500 ] 25501 ); 25502 const selectPatterns = (0,external_wp_data_.createSelector)( 25503 (select, categoryId, syncStatus, search = "") => { 25504 const { 25505 patterns: themePatterns, 25506 isResolving: isResolvingThemePatterns 25507 } = selectThemePatterns(select); 25508 const { 25509 patterns: userPatterns, 25510 isResolving: isResolvingUserPatterns, 25511 categories: userPatternCategories 25512 } = selectUserPatterns(select); 25513 let patterns = [ 25514 ...themePatterns || [], 25515 ...userPatterns || [] 25516 ]; 25517 if (syncStatus) { 25518 patterns = patterns.filter((pattern) => { 25519 return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; 25520 }); 25521 } 25522 if (categoryId) { 25523 patterns = searchItems(patterns, search, { 25524 categoryId, 25525 hasCategory: (item, currentCategory) => { 25526 if (item.type === PATTERN_TYPES.user) { 25527 return item.wp_pattern_category?.some( 25528 (catId) => userPatternCategories.find( 25529 (cat) => cat.id === catId 25530 )?.slug === currentCategory 25531 ); 25532 } 25533 return item.categories?.includes(currentCategory); 25534 } 25535 }); 25536 } else { 25537 patterns = searchItems(patterns, search, { 25538 hasCategory: (item) => { 25539 if (item.type === PATTERN_TYPES.user) { 25540 return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some( 25541 (catId) => userPatternCategories.find( 25542 (cat) => cat.id === catId 25543 ) 25544 )); 25545 } 25546 return !item.hasOwnProperty("categories"); 25547 } 25548 }); 25549 } 25550 return { 25551 patterns, 25552 isResolving: isResolvingThemePatterns || isResolvingUserPatterns 25553 }; 25554 }, 25555 (select) => [ 25556 selectThemePatterns(select), 25557 selectUserPatterns(select) 25558 ] 25559 ); 25560 const selectUserPatterns = (0,external_wp_data_.createSelector)( 25561 (select, syncStatus, search = "") => { 25562 const { 25563 getEntityRecords, 25564 isResolving: isResolvingSelector, 25565 getUserPatternCategories 25566 } = select(external_wp_coreData_namespaceObject.store); 25567 const query = { per_page: -1 }; 25568 const patternPosts = getEntityRecords( 25569 "postType", 25570 PATTERN_TYPES.user, 25571 query 25572 ); 25573 const userPatternCategories = getUserPatternCategories(); 25574 const categories = /* @__PURE__ */ new Map(); 25575 userPatternCategories.forEach( 25576 (userCategory) => categories.set(userCategory.id, userCategory) 25577 ); 25578 let patterns = patternPosts ?? EMPTY_PATTERN_LIST; 25579 const isResolving = isResolvingSelector("getEntityRecords", [ 25580 "postType", 25581 PATTERN_TYPES.user, 25582 query 25583 ]); 25584 if (syncStatus) { 25585 patterns = patterns.filter( 25586 (pattern) => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus 25587 ); 25588 } 25589 patterns = searchItems(patterns, search, { 25590 // We exit user pattern retrieval early if we aren't in the 25591 // catch-all category for user created patterns, so it has 25592 // to be in the category. 25593 hasCategory: () => true 25594 }); 25595 return { 25596 patterns, 25597 isResolving, 25598 categories: userPatternCategories 25599 }; 25600 }, 25601 (select) => [ 25602 select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", PATTERN_TYPES.user, { 25603 per_page: -1 25604 }), 25605 select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [ 25606 "postType", 25607 PATTERN_TYPES.user, 25608 { per_page: -1 } 25609 ]), 25610 select(external_wp_coreData_namespaceObject.store).getUserPatternCategories() 25611 ] 25612 ); 25613 function useAugmentPatternsWithPermissions(patterns) { 25614 const idsAndTypes = (0,external_wp_element_.useMemo)( 25615 () => patterns?.filter((record) => record.type !== PATTERN_TYPES.theme).map((record) => [record.type, record.id]) ?? [], 25616 [patterns] 25617 ); 25618 const permissions = (0,external_wp_data_.useSelect)( 25619 (select) => { 25620 const { getEntityRecordPermissions } = unlock( 25621 select(external_wp_coreData_namespaceObject.store) 25622 ); 25623 return idsAndTypes.reduce((acc, [type, id]) => { 25624 acc[id] = getEntityRecordPermissions("postType", type, id); 25625 return acc; 25626 }, {}); 25627 }, 25628 [idsAndTypes] 25629 ); 25630 return (0,external_wp_element_.useMemo)( 25631 () => patterns?.map((record) => ({ 25632 ...record, 25633 permissions: permissions?.[record.id] ?? {} 25634 })) ?? [], 25635 [patterns, permissions] 25636 ); 25637 } 25638 const usePatterns = (postType, categoryId, { search = "", syncStatus } = {}) => { 25639 return (0,external_wp_data_.useSelect)( 25640 (select) => { 25641 if (postType === TEMPLATE_PART_POST_TYPE) { 25642 return selectTemplateParts(select, categoryId, search); 25643 } else if (postType === PATTERN_TYPES.user && !!categoryId) { 25644 const appliedCategory = categoryId === "uncategorized" ? "" : categoryId; 25645 return selectPatterns( 25646 select, 25647 appliedCategory, 25648 syncStatus, 25649 search 25650 ); 25651 } else if (postType === PATTERN_TYPES.user) { 25652 return selectUserPatterns(select, syncStatus, search); 25653 } 25654 return { 25655 patterns: EMPTY_PATTERN_LIST, 25656 isResolving: false 25657 }; 25658 }, 25659 [categoryId, postType, search, syncStatus] 25660 ); 25661 }; 25662 var use_patterns_default = usePatterns; 25663 25664 25665 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js 25666 25667 25668 25669 25670 25671 25672 function usePatternCategories() { 25673 const defaultCategories = useDefaultPatternCategories(); 25674 defaultCategories.push({ 25675 name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, 25676 label: (0,external_wp_i18n_namespaceObject.__)("Uncategorized") 25677 }); 25678 const themePatterns = useThemePatterns(); 25679 const { patterns: userPatterns, categories: userPatternCategories } = use_patterns_default(PATTERN_TYPES.user); 25680 const patternCategories = (0,external_wp_element_.useMemo)(() => { 25681 const categoryMap = {}; 25682 const categoriesWithCounts = []; 25683 defaultCategories.forEach((category) => { 25684 if (!categoryMap[category.name]) { 25685 categoryMap[category.name] = { ...category, count: 0 }; 25686 } 25687 }); 25688 userPatternCategories.forEach((category) => { 25689 if (!categoryMap[category.name]) { 25690 categoryMap[category.name] = { ...category, count: 0 }; 25691 } 25692 }); 25693 themePatterns.forEach((pattern) => { 25694 pattern.categories?.forEach((category) => { 25695 if (categoryMap[category]) { 25696 categoryMap[category].count += 1; 25697 } 25698 }); 25699 if (!pattern.categories?.length) { 25700 categoryMap.uncategorized.count += 1; 25701 } 25702 }); 25703 userPatterns.forEach((pattern) => { 25704 pattern.wp_pattern_category?.forEach((catId) => { 25705 const category = userPatternCategories.find( 25706 (cat) => cat.id === catId 25707 )?.name; 25708 if (categoryMap[category]) { 25709 categoryMap[category].count += 1; 25710 } 25711 }); 25712 if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some( 25713 (catId) => userPatternCategories.find((cat) => cat.id === catId) 25714 )) { 25715 categoryMap.uncategorized.count += 1; 25716 } 25717 }); 25718 [...defaultCategories, ...userPatternCategories].forEach( 25719 (category) => { 25720 if (categoryMap[category.name].count && !categoriesWithCounts.find( 25721 (cat) => cat.name === category.name 25722 )) { 25723 categoriesWithCounts.push(categoryMap[category.name]); 25724 } 25725 } 25726 ); 25727 const sortedCategories = categoriesWithCounts.sort( 25728 (a, b) => a.label.localeCompare(b.label) 25729 ); 25730 sortedCategories.unshift({ 25731 name: PATTERN_USER_CATEGORY, 25732 label: (0,external_wp_i18n_namespaceObject.__)("My patterns"), 25733 count: userPatterns.length 25734 }); 25735 sortedCategories.unshift({ 25736 name: PATTERN_DEFAULT_CATEGORY, 25737 label: (0,external_wp_i18n_namespaceObject.__)("All patterns"), 25738 description: (0,external_wp_i18n_namespaceObject.__)("A list of all patterns from all sources."), 25739 count: themePatterns.length + userPatterns.length 25740 }); 25741 return sortedCategories; 25742 }, [ 25743 defaultCategories, 25744 themePatterns, 25745 userPatternCategories, 25746 userPatterns 25747 ]); 25748 return { patternCategories, hasPatterns: !!patternCategories.length }; 25749 } 25750 25751 25752 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js 25753 25754 25755 25756 const useTemplatePartsGroupedByArea = (items) => { 25757 const allItems = items || []; 25758 const templatePartAreas = (0,external_wp_data_.useSelect)( 25759 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [], 25760 [] 25761 ); 25762 const knownAreas = { 25763 header: {}, 25764 footer: {}, 25765 sidebar: {}, 25766 uncategorized: {} 25767 }; 25768 templatePartAreas.forEach( 25769 (templatePartArea) => knownAreas[templatePartArea.area] = { 25770 ...templatePartArea, 25771 templateParts: [] 25772 } 25773 ); 25774 const groupedByArea = allItems.reduce((accumulator, item) => { 25775 const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; 25776 accumulator[key]?.templateParts?.push(item); 25777 return accumulator; 25778 }, knownAreas); 25779 return groupedByArea; 25780 }; 25781 function useTemplatePartAreas() { 25782 const { records: templateParts, isResolving: isLoading } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( 25783 "postType", 25784 TEMPLATE_PART_POST_TYPE, 25785 { per_page: -1 } 25786 ); 25787 return { 25788 hasTemplateParts: templateParts ? !!templateParts.length : false, 25789 isLoading, 25790 templatePartAreas: useTemplatePartsGroupedByArea(templateParts) 25791 }; 25792 } 25793 25794 25795 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js 25796 25797 25798 25799 25800 25801 25802 25803 25804 25805 25806 25807 25808 const { useLocation: sidebar_navigation_screen_patterns_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 25809 function CategoriesGroup({ 25810 templatePartAreas, 25811 patternCategories, 25812 currentCategory, 25813 currentType 25814 }) { 25815 const [allPatterns, ...otherPatterns] = patternCategories; 25816 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: [ 25817 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25818 CategoryItem, 25819 { 25820 count: Object.values(templatePartAreas).map(({ templateParts }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0), 25821 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(), 25822 label: (0,external_wp_i18n_namespaceObject.__)("All template parts"), 25823 id: TEMPLATE_PART_ALL_AREAS_CATEGORY, 25824 type: TEMPLATE_PART_POST_TYPE, 25825 isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE 25826 }, 25827 "all" 25828 ), 25829 Object.entries(templatePartAreas).map( 25830 ([area, { label, templateParts }]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25831 CategoryItem, 25832 { 25833 count: templateParts?.length, 25834 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area), 25835 label, 25836 id: area, 25837 type: TEMPLATE_PART_POST_TYPE, 25838 isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE 25839 }, 25840 area 25841 ) 25842 ), 25843 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-patterns__divider" }), 25844 allPatterns && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25845 CategoryItem, 25846 { 25847 count: allPatterns.count, 25848 label: allPatterns.label, 25849 icon: file_default, 25850 id: allPatterns.name, 25851 type: PATTERN_TYPES.user, 25852 isActive: currentCategory === `$allPatterns.name}` && currentType === PATTERN_TYPES.user 25853 }, 25854 allPatterns.name 25855 ), 25856 otherPatterns.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25857 CategoryItem, 25858 { 25859 count: category.count, 25860 label: category.label, 25861 icon: file_default, 25862 id: category.name, 25863 type: PATTERN_TYPES.user, 25864 isActive: currentCategory === `$category.name}` && currentType === PATTERN_TYPES.user 25865 }, 25866 category.name 25867 )) 25868 ] }); 25869 } 25870 function SidebarNavigationScreenPatterns({ backPath }) { 25871 const { 25872 query: { postType = "wp_block", categoryId } 25873 } = sidebar_navigation_screen_patterns_useLocation(); 25874 const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); 25875 const { templatePartAreas, hasTemplateParts, isLoading } = useTemplatePartAreas(); 25876 const { patternCategories, hasPatterns } = usePatternCategories(); 25877 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25878 SidebarNavigationScreen, 25879 { 25880 title: (0,external_wp_i18n_namespaceObject.__)("Patterns"), 25881 description: (0,external_wp_i18n_namespaceObject.__)( 25882 "Manage what patterns are available when editing the site." 25883 ), 25884 isRoot: !backPath, 25885 backPath, 25886 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 25887 isLoading && (0,external_wp_i18n_namespaceObject.__)("Loading items\u2026"), 25888 !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 25889 !hasTemplateParts && !hasPatterns && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: (0,external_wp_i18n_namespaceObject.__)("No items found") }) }), 25890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25891 CategoriesGroup, 25892 { 25893 templatePartAreas, 25894 patternCategories, 25895 currentCategory, 25896 currentType: postType 25897 } 25898 ) 25899 ] }) 25900 ] }) 25901 } 25902 ); 25903 } 25904 25905 25906 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 25907 var remove_accents = __webpack_require__(9681); 25908 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 25909 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constants.js 25910 /** 25911 * @module constants 25912 * @summary Useful constants 25913 * @description 25914 * Collection of useful date constants. 25915 * 25916 * The constants could be imported from `date-fns/constants`: 25917 * 25918 * ```ts 25919 * import { maxTime, minTime } from "./constants/date-fns/constants"; 25920 * 25921 * function isAllowedTime(time) { 25922 * return time <= maxTime && time >= minTime; 25923 * } 25924 * ``` 25925 */ 25926 25927 /** 25928 * @constant 25929 * @name daysInWeek 25930 * @summary Days in 1 week. 25931 */ 25932 const daysInWeek = 7; 25933 25934 /** 25935 * @constant 25936 * @name daysInYear 25937 * @summary Days in 1 year. 25938 * 25939 * @description 25940 * How many days in a year. 25941 * 25942 * One years equals 365.2425 days according to the formula: 25943 * 25944 * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400. 25945 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days 25946 */ 25947 const daysInYear = 365.2425; 25948 25949 /** 25950 * @constant 25951 * @name maxTime 25952 * @summary Maximum allowed time. 25953 * 25954 * @example 25955 * import { maxTime } from "./constants/date-fns/constants"; 25956 * 25957 * const isValid = 8640000000000001 <= maxTime; 25958 * //=> false 25959 * 25960 * new Date(8640000000000001); 25961 * //=> Invalid Date 25962 */ 25963 const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; 25964 25965 /** 25966 * @constant 25967 * @name minTime 25968 * @summary Minimum allowed time. 25969 * 25970 * @example 25971 * import { minTime } from "./constants/date-fns/constants"; 25972 * 25973 * const isValid = -8640000000000001 >= minTime; 25974 * //=> false 25975 * 25976 * new Date(-8640000000000001) 25977 * //=> Invalid Date 25978 */ 25979 const minTime = -maxTime; 25980 25981 /** 25982 * @constant 25983 * @name millisecondsInWeek 25984 * @summary Milliseconds in 1 week. 25985 */ 25986 const millisecondsInWeek = 604800000; 25987 25988 /** 25989 * @constant 25990 * @name millisecondsInDay 25991 * @summary Milliseconds in 1 day. 25992 */ 25993 const millisecondsInDay = 86400000; 25994 25995 /** 25996 * @constant 25997 * @name millisecondsInMinute 25998 * @summary Milliseconds in 1 minute 25999 */ 26000 const millisecondsInMinute = 60000; 26001 26002 /** 26003 * @constant 26004 * @name millisecondsInHour 26005 * @summary Milliseconds in 1 hour 26006 */ 26007 const millisecondsInHour = 3600000; 26008 26009 /** 26010 * @constant 26011 * @name millisecondsInSecond 26012 * @summary Milliseconds in 1 second 26013 */ 26014 const millisecondsInSecond = 1000; 26015 26016 /** 26017 * @constant 26018 * @name minutesInYear 26019 * @summary Minutes in 1 year. 26020 */ 26021 const minutesInYear = 525600; 26022 26023 /** 26024 * @constant 26025 * @name minutesInMonth 26026 * @summary Minutes in 1 month. 26027 */ 26028 const minutesInMonth = 43200; 26029 26030 /** 26031 * @constant 26032 * @name minutesInDay 26033 * @summary Minutes in 1 day. 26034 */ 26035 const minutesInDay = 1440; 26036 26037 /** 26038 * @constant 26039 * @name minutesInHour 26040 * @summary Minutes in 1 hour. 26041 */ 26042 const minutesInHour = 60; 26043 26044 /** 26045 * @constant 26046 * @name monthsInQuarter 26047 * @summary Months in 1 quarter. 26048 */ 26049 const monthsInQuarter = 3; 26050 26051 /** 26052 * @constant 26053 * @name monthsInYear 26054 * @summary Months in 1 year. 26055 */ 26056 const monthsInYear = 12; 26057 26058 /** 26059 * @constant 26060 * @name quartersInYear 26061 * @summary Quarters in 1 year 26062 */ 26063 const quartersInYear = 4; 26064 26065 /** 26066 * @constant 26067 * @name secondsInHour 26068 * @summary Seconds in 1 hour. 26069 */ 26070 const secondsInHour = 3600; 26071 26072 /** 26073 * @constant 26074 * @name secondsInMinute 26075 * @summary Seconds in 1 minute. 26076 */ 26077 const secondsInMinute = 60; 26078 26079 /** 26080 * @constant 26081 * @name secondsInDay 26082 * @summary Seconds in 1 day. 26083 */ 26084 const secondsInDay = secondsInHour * 24; 26085 26086 /** 26087 * @constant 26088 * @name secondsInWeek 26089 * @summary Seconds in 1 week. 26090 */ 26091 const secondsInWeek = secondsInDay * 7; 26092 26093 /** 26094 * @constant 26095 * @name secondsInYear 26096 * @summary Seconds in 1 year. 26097 */ 26098 const secondsInYear = secondsInDay * daysInYear; 26099 26100 /** 26101 * @constant 26102 * @name secondsInMonth 26103 * @summary Seconds in 1 month 26104 */ 26105 const secondsInMonth = secondsInYear / 12; 26106 26107 /** 26108 * @constant 26109 * @name secondsInQuarter 26110 * @summary Seconds in 1 quarter. 26111 */ 26112 const secondsInQuarter = secondsInMonth * 3; 26113 26114 /** 26115 * @constant 26116 * @name constructFromSymbol 26117 * @summary Symbol enabling Date extensions to inherit properties from the reference date. 26118 * 26119 * The symbol is used to enable the `constructFrom` function to construct a date 26120 * using a reference date and a value. It allows to transfer extra properties 26121 * from the reference date to the new date. It's useful for extensions like 26122 * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as 26123 * a constructor argument. 26124 */ 26125 const constructFromSymbol = Symbol.for("constructDateFrom"); 26126 26127 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constructFrom.js 26128 26129 26130 /** 26131 * @name constructFrom 26132 * @category Generic Helpers 26133 * @summary Constructs a date using the reference date and the value 26134 * 26135 * @description 26136 * The function constructs a new date using the constructor from the reference 26137 * date and the given value. It helps to build generic functions that accept 26138 * date extensions. 26139 * 26140 * It defaults to `Date` if the passed reference date is a number or a string. 26141 * 26142 * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]` 26143 * enabling to transfer extra properties from the reference date to the new date. 26144 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) 26145 * that accept a time zone as a constructor argument. 26146 * 26147 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26148 * 26149 * @param date - The reference date to take constructor from 26150 * @param value - The value to create the date 26151 * 26152 * @returns Date initialized using the given date and value 26153 * 26154 * @example 26155 * import { constructFrom } from "./constructFrom/date-fns"; 26156 * 26157 * // A function that clones a date preserving the original type 26158 * function cloneDate<DateType extends Date>(date: DateType): DateType { 26159 * return constructFrom( 26160 * date, // Use constructor from the given date 26161 * date.getTime() // Use the date value to create a new date 26162 * ); 26163 * } 26164 */ 26165 function constructFrom(date, value) { 26166 if (typeof date === "function") return date(value); 26167 26168 if (date && typeof date === "object" && constructFromSymbol in date) 26169 return date[constructFromSymbol](value); 26170 26171 if (date instanceof Date) return new date.constructor(value); 26172 26173 return new Date(value); 26174 } 26175 26176 // Fallback for modularized imports: 26177 /* harmony default export */ const date_fns_constructFrom = ((/* unused pure expression or super */ null && (constructFrom))); 26178 26179 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/toDate.js 26180 26181 26182 /** 26183 * @name toDate 26184 * @category Common Helpers 26185 * @summary Convert the given argument to an instance of Date. 26186 * 26187 * @description 26188 * Convert the given argument to an instance of Date. 26189 * 26190 * If the argument is an instance of Date, the function returns its clone. 26191 * 26192 * If the argument is a number, it is treated as a timestamp. 26193 * 26194 * If the argument is none of the above, the function returns Invalid Date. 26195 * 26196 * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]` 26197 * enabling to transfer extra properties from the reference date to the new date. 26198 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) 26199 * that accept a time zone as a constructor argument. 26200 * 26201 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. 26202 * 26203 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26204 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26205 * 26206 * @param argument - The value to convert 26207 * 26208 * @returns The parsed date in the local time zone 26209 * 26210 * @example 26211 * // Clone the date: 26212 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) 26213 * //=> Tue Feb 11 2014 11:30:30 26214 * 26215 * @example 26216 * // Convert the timestamp to date: 26217 * const result = toDate(1392098430000) 26218 * //=> Tue Feb 11 2014 11:30:30 26219 */ 26220 function toDate(argument, context) { 26221 // [TODO] Get rid of `toDate` or `constructFrom`? 26222 return constructFrom(context || argument, argument); 26223 } 26224 26225 // Fallback for modularized imports: 26226 /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); 26227 26228 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addDays.js 26229 26230 26231 26232 /** 26233 * The {@link addDays} function options. 26234 */ 26235 26236 /** 26237 * @name addDays 26238 * @category Day Helpers 26239 * @summary Add the specified number of days to the given date. 26240 * 26241 * @description 26242 * Add the specified number of days to the given date. 26243 * 26244 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26245 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26246 * 26247 * @param date - The date to be changed 26248 * @param amount - The amount of days to be added. 26249 * @param options - An object with options 26250 * 26251 * @returns The new date with the days added 26252 * 26253 * @example 26254 * // Add 10 days to 1 September 2014: 26255 * const result = addDays(new Date(2014, 8, 1), 10) 26256 * //=> Thu Sep 11 2014 00:00:00 26257 */ 26258 function addDays(date, amount, options) { 26259 const _date = toDate(date, options?.in); 26260 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 26261 26262 // If 0 days, no-op to avoid changing times in the hour before end of DST 26263 if (!amount) return _date; 26264 26265 _date.setDate(_date.getDate() + amount); 26266 return _date; 26267 } 26268 26269 // Fallback for modularized imports: 26270 /* harmony default export */ const date_fns_addDays = ((/* unused pure expression or super */ null && (addDays))); 26271 26272 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subDays.js 26273 26274 26275 /** 26276 * The {@link subDays} function options. 26277 */ 26278 26279 /** 26280 * @name subDays 26281 * @category Day Helpers 26282 * @summary Subtract the specified number of days from the given date. 26283 * 26284 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26285 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26286 * 26287 * @param date - The date to be changed 26288 * @param amount - The amount of days to be subtracted. 26289 * @param options - An object with options 26290 * 26291 * @returns The new date with the days subtracted 26292 * 26293 * @example 26294 * // Subtract 10 days from 1 September 2014: 26295 * const result = subDays(new Date(2014, 8, 1), 10) 26296 * //=> Fri Aug 22 2014 00:00:00 26297 */ 26298 function subDays(date, amount, options) { 26299 return addDays(date, -amount, options); 26300 } 26301 26302 // Fallback for modularized imports: 26303 /* harmony default export */ const date_fns_subDays = ((/* unused pure expression or super */ null && (subDays))); 26304 26305 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addWeeks.js 26306 26307 26308 /** 26309 * The {@link addWeeks} function options. 26310 */ 26311 26312 /** 26313 * @name addWeeks 26314 * @category Week Helpers 26315 * @summary Add the specified number of weeks to the given date. 26316 * 26317 * @description 26318 * Add the specified number of weeks to the given date. 26319 * 26320 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26321 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26322 * 26323 * @param date - The date to be changed 26324 * @param amount - The amount of weeks to be added. 26325 * @param options - An object with options 26326 * 26327 * @returns The new date with the weeks added 26328 * 26329 * @example 26330 * // Add 4 weeks to 1 September 2014: 26331 * const result = addWeeks(new Date(2014, 8, 1), 4) 26332 * //=> Mon Sep 29 2014 00:00:00 26333 */ 26334 function addWeeks(date, amount, options) { 26335 return addDays(date, amount * 7, options); 26336 } 26337 26338 // Fallback for modularized imports: 26339 /* harmony default export */ const date_fns_addWeeks = ((/* unused pure expression or super */ null && (addWeeks))); 26340 26341 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subWeeks.js 26342 26343 26344 /** 26345 * The {@link subWeeks} function options. 26346 */ 26347 26348 /** 26349 * @name subWeeks 26350 * @category Week Helpers 26351 * @summary Subtract the specified number of weeks from the given date. 26352 * 26353 * @description 26354 * Subtract the specified number of weeks from the given date. 26355 * 26356 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26357 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26358 * 26359 * @param date - The date to be changed 26360 * @param amount - The amount of weeks to be subtracted. 26361 * @param options - An object with options 26362 * 26363 * @returns The new date with the weeks subtracted 26364 * 26365 * @example 26366 * // Subtract 4 weeks from 1 September 2014: 26367 * const result = subWeeks(new Date(2014, 8, 1), 4) 26368 * //=> Mon Aug 04 2014 00:00:00 26369 */ 26370 function subWeeks(date, amount, options) { 26371 return addWeeks(date, -amount, options); 26372 } 26373 26374 // Fallback for modularized imports: 26375 /* harmony default export */ const date_fns_subWeeks = ((/* unused pure expression or super */ null && (subWeeks))); 26376 26377 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addMonths.js 26378 26379 26380 26381 /** 26382 * The {@link addMonths} function options. 26383 */ 26384 26385 /** 26386 * @name addMonths 26387 * @category Month Helpers 26388 * @summary Add the specified number of months to the given date. 26389 * 26390 * @description 26391 * Add the specified number of months to the given date. 26392 * 26393 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26394 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26395 * 26396 * @param date - The date to be changed 26397 * @param amount - The amount of months to be added. 26398 * @param options - The options object 26399 * 26400 * @returns The new date with the months added 26401 * 26402 * @example 26403 * // Add 5 months to 1 September 2014: 26404 * const result = addMonths(new Date(2014, 8, 1), 5) 26405 * //=> Sun Feb 01 2015 00:00:00 26406 * 26407 * // Add one month to 30 January 2023: 26408 * const result = addMonths(new Date(2023, 0, 30), 1) 26409 * //=> Tue Feb 28 2023 00:00:00 26410 */ 26411 function addMonths(date, amount, options) { 26412 const _date = toDate(date, options?.in); 26413 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 26414 if (!amount) { 26415 // If 0 months, no-op to avoid changing times in the hour before end of DST 26416 return _date; 26417 } 26418 const dayOfMonth = _date.getDate(); 26419 26420 // The JS Date object supports date math by accepting out-of-bounds values for 26421 // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and 26422 // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we 26423 // want except that dates will wrap around the end of a month, meaning that 26424 // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So 26425 // we'll default to the end of the desired month by adding 1 to the desired 26426 // month and using a date of 0 to back up one day to the end of the desired 26427 // month. 26428 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); 26429 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); 26430 const daysInMonth = endOfDesiredMonth.getDate(); 26431 if (dayOfMonth >= daysInMonth) { 26432 // If we're already at the end of the month, then this is the correct date 26433 // and we're done. 26434 return endOfDesiredMonth; 26435 } else { 26436 // Otherwise, we now know that setting the original day-of-month value won't 26437 // cause an overflow, so set the desired day-of-month. Note that we can't 26438 // just set the date of `endOfDesiredMonth` because that object may have had 26439 // its time changed in the unusual case where where a DST transition was on 26440 // the last day of the month and its local time was in the hour skipped or 26441 // repeated next to a DST transition. So we use `date` instead which is 26442 // guaranteed to still have the original time. 26443 _date.setFullYear( 26444 endOfDesiredMonth.getFullYear(), 26445 endOfDesiredMonth.getMonth(), 26446 dayOfMonth, 26447 ); 26448 return _date; 26449 } 26450 } 26451 26452 // Fallback for modularized imports: 26453 /* harmony default export */ const date_fns_addMonths = ((/* unused pure expression or super */ null && (addMonths))); 26454 26455 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subMonths.js 26456 26457 26458 /** 26459 * The subMonths function options. 26460 */ 26461 26462 /** 26463 * @name subMonths 26464 * @category Month Helpers 26465 * @summary Subtract the specified number of months from the given date. 26466 * 26467 * @description 26468 * Subtract the specified number of months from the given date. 26469 * 26470 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26471 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26472 * 26473 * @param date - The date to be changed 26474 * @param amount - The amount of months to be subtracted. 26475 * @param options - An object with options 26476 * 26477 * @returns The new date with the months subtracted 26478 * 26479 * @example 26480 * // Subtract 5 months from 1 February 2015: 26481 * const result = subMonths(new Date(2015, 1, 1), 5) 26482 * //=> Mon Sep 01 2014 00:00:00 26483 */ 26484 function subMonths(date, amount, options) { 26485 return addMonths(date, -amount, options); 26486 } 26487 26488 // Fallback for modularized imports: 26489 /* harmony default export */ const date_fns_subMonths = ((/* unused pure expression or super */ null && (subMonths))); 26490 26491 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addYears.js 26492 26493 26494 /** 26495 * The {@link addYears} function options. 26496 */ 26497 26498 /** 26499 * @name addYears 26500 * @category Year Helpers 26501 * @summary Add the specified number of years to the given date. 26502 * 26503 * @description 26504 * Add the specified number of years to the given date. 26505 * 26506 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26507 * @typeParam ResultDate - The result `Date` type. 26508 * 26509 * @param date - The date to be changed 26510 * @param amount - The amount of years to be added. 26511 * @param options - The options 26512 * 26513 * @returns The new date with the years added 26514 * 26515 * @example 26516 * // Add 5 years to 1 September 2014: 26517 * const result = addYears(new Date(2014, 8, 1), 5) 26518 * //=> Sun Sep 01 2019 00:00:00 26519 */ 26520 function addYears(date, amount, options) { 26521 return addMonths(date, amount * 12, options); 26522 } 26523 26524 // Fallback for modularized imports: 26525 /* harmony default export */ const date_fns_addYears = ((/* unused pure expression or super */ null && (addYears))); 26526 26527 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subYears.js 26528 26529 26530 /** 26531 * The {@link subYears} function options. 26532 */ 26533 26534 /** 26535 * @name subYears 26536 * @category Year Helpers 26537 * @summary Subtract the specified number of years from the given date. 26538 * 26539 * @description 26540 * Subtract the specified number of years from the given date. 26541 * 26542 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 26543 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 26544 * 26545 * @param date - The date to be changed 26546 * @param amount - The amount of years to be subtracted. 26547 * @param options - An object with options 26548 * 26549 * @returns The new date with the years subtracted 26550 * 26551 * @example 26552 * // Subtract 5 years from 1 September 2014: 26553 * const result = subYears(new Date(2014, 8, 1), 5) 26554 * //=> Tue Sep 01 2009 00:00:00 26555 */ 26556 function subYears(date, amount, options) { 26557 return addYears(date, -amount, options); 26558 } 26559 26560 // Fallback for modularized imports: 26561 /* harmony default export */ const date_fns_subYears = ((/* unused pure expression or super */ null && (subYears))); 26562 26563 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up.js 26564 26565 26566 var arrow_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) }); 26567 26568 26569 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js 26570 26571 26572 var arrow_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) }); 26573 26574 26575 ;// ./node_modules/@wordpress/dataviews/build-module/constants.js 26576 26577 26578 const constants_OPERATOR_IS = "is"; 26579 const constants_OPERATOR_IS_NOT = "isNot"; 26580 const constants_OPERATOR_IS_ANY = "isAny"; 26581 const constants_OPERATOR_IS_NONE = "isNone"; 26582 const OPERATOR_IS_ALL = "isAll"; 26583 const OPERATOR_IS_NOT_ALL = "isNotAll"; 26584 const OPERATOR_LESS_THAN = "lessThan"; 26585 const OPERATOR_GREATER_THAN = "greaterThan"; 26586 const OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; 26587 const OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; 26588 const OPERATOR_BEFORE = "before"; 26589 const OPERATOR_AFTER = "after"; 26590 const OPERATOR_BEFORE_INC = "beforeInc"; 26591 const OPERATOR_AFTER_INC = "afterInc"; 26592 const OPERATOR_CONTAINS = "contains"; 26593 const OPERATOR_NOT_CONTAINS = "notContains"; 26594 const OPERATOR_STARTS_WITH = "startsWith"; 26595 const OPERATOR_BETWEEN = "between"; 26596 const OPERATOR_ON = "on"; 26597 const OPERATOR_NOT_ON = "notOn"; 26598 const OPERATOR_IN_THE_PAST = "inThePast"; 26599 const OPERATOR_OVER = "over"; 26600 const ALL_OPERATORS = [ 26601 constants_OPERATOR_IS, 26602 constants_OPERATOR_IS_NOT, 26603 constants_OPERATOR_IS_ANY, 26604 constants_OPERATOR_IS_NONE, 26605 OPERATOR_IS_ALL, 26606 OPERATOR_IS_NOT_ALL, 26607 OPERATOR_LESS_THAN, 26608 OPERATOR_GREATER_THAN, 26609 OPERATOR_LESS_THAN_OR_EQUAL, 26610 OPERATOR_GREATER_THAN_OR_EQUAL, 26611 OPERATOR_BEFORE, 26612 OPERATOR_AFTER, 26613 OPERATOR_BEFORE_INC, 26614 OPERATOR_AFTER_INC, 26615 OPERATOR_CONTAINS, 26616 OPERATOR_NOT_CONTAINS, 26617 OPERATOR_STARTS_WITH, 26618 OPERATOR_BETWEEN, 26619 OPERATOR_ON, 26620 OPERATOR_NOT_ON, 26621 OPERATOR_IN_THE_PAST, 26622 OPERATOR_OVER 26623 ]; 26624 const SINGLE_SELECTION_OPERATORS = [ 26625 constants_OPERATOR_IS, 26626 constants_OPERATOR_IS_NOT, 26627 OPERATOR_LESS_THAN, 26628 OPERATOR_GREATER_THAN, 26629 OPERATOR_LESS_THAN_OR_EQUAL, 26630 OPERATOR_GREATER_THAN_OR_EQUAL, 26631 OPERATOR_BEFORE, 26632 OPERATOR_AFTER, 26633 OPERATOR_BEFORE_INC, 26634 OPERATOR_AFTER_INC, 26635 OPERATOR_CONTAINS, 26636 OPERATOR_NOT_CONTAINS, 26637 OPERATOR_STARTS_WITH, 26638 OPERATOR_ON, 26639 OPERATOR_NOT_ON 26640 ]; 26641 const OPERATORS = { 26642 [constants_OPERATOR_IS]: { 26643 key: "is-filter", 26644 label: (0,external_wp_i18n_namespaceObject.__)("Is") 26645 }, 26646 [constants_OPERATOR_IS_NOT]: { 26647 key: "is-not-filter", 26648 label: (0,external_wp_i18n_namespaceObject.__)("Is not") 26649 }, 26650 [constants_OPERATOR_IS_ANY]: { 26651 key: "is-any-filter", 26652 label: (0,external_wp_i18n_namespaceObject.__)("Is any") 26653 }, 26654 [constants_OPERATOR_IS_NONE]: { 26655 key: "is-none-filter", 26656 label: (0,external_wp_i18n_namespaceObject.__)("Is none") 26657 }, 26658 [OPERATOR_IS_ALL]: { 26659 key: "is-all-filter", 26660 label: (0,external_wp_i18n_namespaceObject.__)("Is all") 26661 }, 26662 [OPERATOR_IS_NOT_ALL]: { 26663 key: "is-not-all-filter", 26664 label: (0,external_wp_i18n_namespaceObject.__)("Is not all") 26665 }, 26666 [OPERATOR_LESS_THAN]: { 26667 key: "less-than-filter", 26668 label: (0,external_wp_i18n_namespaceObject.__)("Less than") 26669 }, 26670 [OPERATOR_GREATER_THAN]: { 26671 key: "greater-than-filter", 26672 label: (0,external_wp_i18n_namespaceObject.__)("Greater than") 26673 }, 26674 [OPERATOR_LESS_THAN_OR_EQUAL]: { 26675 key: "less-than-or-equal-filter", 26676 label: (0,external_wp_i18n_namespaceObject.__)("Less than or equal") 26677 }, 26678 [OPERATOR_GREATER_THAN_OR_EQUAL]: { 26679 key: "greater-than-or-equal-filter", 26680 label: (0,external_wp_i18n_namespaceObject.__)("Greater than or equal") 26681 }, 26682 [OPERATOR_BEFORE]: { 26683 key: "before-filter", 26684 label: (0,external_wp_i18n_namespaceObject.__)("Before") 26685 }, 26686 [OPERATOR_AFTER]: { 26687 key: "after-filter", 26688 label: (0,external_wp_i18n_namespaceObject.__)("After") 26689 }, 26690 [OPERATOR_BEFORE_INC]: { 26691 key: "before-inc-filter", 26692 label: (0,external_wp_i18n_namespaceObject.__)("Before (inc)") 26693 }, 26694 [OPERATOR_AFTER_INC]: { 26695 key: "after-inc-filter", 26696 label: (0,external_wp_i18n_namespaceObject.__)("After (inc)") 26697 }, 26698 [OPERATOR_CONTAINS]: { 26699 key: "contains-filter", 26700 label: (0,external_wp_i18n_namespaceObject.__)("Contains") 26701 }, 26702 [OPERATOR_NOT_CONTAINS]: { 26703 key: "not-contains-filter", 26704 label: (0,external_wp_i18n_namespaceObject.__)("Doesn't contain") 26705 }, 26706 [OPERATOR_STARTS_WITH]: { 26707 key: "starts-with-filter", 26708 label: (0,external_wp_i18n_namespaceObject.__)("Starts with") 26709 }, 26710 [OPERATOR_BETWEEN]: { 26711 key: "between-filter", 26712 label: (0,external_wp_i18n_namespaceObject.__)("Between (inc)") 26713 }, 26714 [OPERATOR_ON]: { 26715 key: "on-filter", 26716 label: (0,external_wp_i18n_namespaceObject.__)("On") 26717 }, 26718 [OPERATOR_NOT_ON]: { 26719 key: "not-on-filter", 26720 label: (0,external_wp_i18n_namespaceObject.__)("Not on") 26721 }, 26722 [OPERATOR_IN_THE_PAST]: { 26723 key: "in-the-past-filter", 26724 label: (0,external_wp_i18n_namespaceObject.__)("In the past") 26725 }, 26726 [OPERATOR_OVER]: { 26727 key: "over-filter", 26728 label: (0,external_wp_i18n_namespaceObject.__)("Over") 26729 } 26730 }; 26731 const SORTING_DIRECTIONS = ["asc", "desc"]; 26732 const sortArrows = { asc: "\u2191", desc: "\u2193" }; 26733 const sortValues = { asc: "ascending", desc: "descending" }; 26734 const sortLabels = { 26735 asc: (0,external_wp_i18n_namespaceObject.__)("Sort ascending"), 26736 desc: (0,external_wp_i18n_namespaceObject.__)("Sort descending") 26737 }; 26738 const sortIcons = { 26739 asc: arrow_up_default, 26740 desc: arrow_down_default 26741 }; 26742 const constants_LAYOUT_TABLE = "table"; 26743 const constants_LAYOUT_GRID = "grid"; 26744 const constants_LAYOUT_LIST = "list"; 26745 const LAYOUT_PICKER_GRID = "pickerGrid"; 26746 26747 26748 ;// ./node_modules/@wordpress/dataviews/build-module/hooks/use-elements.js 26749 26750 const use_elements_EMPTY_ARRAY = []; 26751 function useElements({ 26752 elements, 26753 getElements 26754 }) { 26755 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : use_elements_EMPTY_ARRAY; 26756 const [records, setRecords] = (0,external_wp_element_.useState)(staticElements); 26757 const [isLoading, setIsLoading] = (0,external_wp_element_.useState)(false); 26758 (0,external_wp_element_.useEffect)(() => { 26759 if (!getElements) { 26760 setRecords(staticElements); 26761 return; 26762 } 26763 let cancelled = false; 26764 setIsLoading(true); 26765 getElements().then((fetchedElements) => { 26766 if (!cancelled) { 26767 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; 26768 setRecords(dynamicElements); 26769 } 26770 }).catch(() => { 26771 if (!cancelled) { 26772 setRecords(staticElements); 26773 } 26774 }).finally(() => { 26775 if (!cancelled) { 26776 setIsLoading(false); 26777 } 26778 }); 26779 return () => { 26780 cancelled = true; 26781 }; 26782 }, [getElements, staticElements]); 26783 return { 26784 elements: records, 26785 isLoading 26786 }; 26787 } 26788 26789 26790 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/utils/render-from-elements.js 26791 26792 function RenderFromElements({ 26793 item, 26794 field 26795 }) { 26796 const { elements, isLoading } = useElements({ 26797 elements: field.elements, 26798 getElements: field.getElements 26799 }); 26800 const value = field.getValue({ item }); 26801 if (isLoading) { 26802 return value; 26803 } 26804 if (elements.length === 0) { 26805 return value; 26806 } 26807 return elements?.find((element) => element.value === value)?.label || field.getValue({ item }); 26808 } 26809 26810 26811 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/email.js 26812 26813 26814 26815 26816 function sort(valueA, valueB, direction) { 26817 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 26818 } 26819 const emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; 26820 var email_default = { 26821 sort, 26822 isValid: { 26823 elements: true, 26824 custom: (item, field) => { 26825 const value = field.getValue({ item }); 26826 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) { 26827 return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid email address."); 26828 } 26829 return null; 26830 } 26831 }, 26832 Edit: "email", 26833 render: ({ item, field }) => { 26834 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); 26835 }, 26836 enableSorting: true, 26837 filterBy: { 26838 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], 26839 validOperators: [ 26840 constants_OPERATOR_IS, 26841 constants_OPERATOR_IS_NOT, 26842 OPERATOR_CONTAINS, 26843 OPERATOR_NOT_CONTAINS, 26844 OPERATOR_STARTS_WITH, 26845 // Multiple selection 26846 constants_OPERATOR_IS_ANY, 26847 constants_OPERATOR_IS_NONE, 26848 OPERATOR_IS_ALL, 26849 OPERATOR_IS_NOT_ALL 26850 ] 26851 } 26852 }; 26853 26854 26855 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js 26856 26857 26858 26859 26860 function integer_sort(a, b, direction) { 26861 return direction === "asc" ? a - b : b - a; 26862 } 26863 var integer_default = { 26864 sort: integer_sort, 26865 isValid: { 26866 elements: true, 26867 custom: (item, field) => { 26868 const value = field.getValue({ item }); 26869 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) { 26870 return (0,external_wp_i18n_namespaceObject.__)("Value must be an integer."); 26871 } 26872 return null; 26873 } 26874 }, 26875 Edit: "integer", 26876 render: ({ item, field }) => { 26877 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); 26878 }, 26879 enableSorting: true, 26880 filterBy: { 26881 defaultOperators: [ 26882 constants_OPERATOR_IS, 26883 constants_OPERATOR_IS_NOT, 26884 OPERATOR_LESS_THAN, 26885 OPERATOR_GREATER_THAN, 26886 OPERATOR_LESS_THAN_OR_EQUAL, 26887 OPERATOR_GREATER_THAN_OR_EQUAL, 26888 OPERATOR_BETWEEN 26889 ], 26890 validOperators: [ 26891 // Single-selection 26892 constants_OPERATOR_IS, 26893 constants_OPERATOR_IS_NOT, 26894 OPERATOR_LESS_THAN, 26895 OPERATOR_GREATER_THAN, 26896 OPERATOR_LESS_THAN_OR_EQUAL, 26897 OPERATOR_GREATER_THAN_OR_EQUAL, 26898 OPERATOR_BETWEEN, 26899 // Multiple-selection 26900 constants_OPERATOR_IS_ANY, 26901 constants_OPERATOR_IS_NONE, 26902 OPERATOR_IS_ALL, 26903 OPERATOR_IS_NOT_ALL 26904 ] 26905 } 26906 }; 26907 26908 26909 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/number.js 26910 26911 26912 26913 26914 function number_sort(a, b, direction) { 26915 return direction === "asc" ? a - b : b - a; 26916 } 26917 function isEmpty(value) { 26918 return value === "" || value === void 0 || value === null; 26919 } 26920 var number_default = { 26921 sort: number_sort, 26922 isValid: { 26923 elements: true, 26924 custom: (item, field) => { 26925 const value = field.getValue({ item }); 26926 if (!isEmpty(value) && !Number.isFinite(value)) { 26927 return (0,external_wp_i18n_namespaceObject.__)("Value must be a number."); 26928 } 26929 return null; 26930 } 26931 }, 26932 Edit: "number", 26933 render: ({ item, field }) => { 26934 if (field.hasElements) { 26935 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); 26936 } 26937 const value = field.getValue({ item }); 26938 if (![null, void 0].includes(value)) { 26939 return Number(value).toFixed(2); 26940 } 26941 return null; 26942 }, 26943 enableSorting: true, 26944 filterBy: { 26945 defaultOperators: [ 26946 constants_OPERATOR_IS, 26947 constants_OPERATOR_IS_NOT, 26948 OPERATOR_LESS_THAN, 26949 OPERATOR_GREATER_THAN, 26950 OPERATOR_LESS_THAN_OR_EQUAL, 26951 OPERATOR_GREATER_THAN_OR_EQUAL, 26952 OPERATOR_BETWEEN 26953 ], 26954 validOperators: [ 26955 // Single-selection 26956 constants_OPERATOR_IS, 26957 constants_OPERATOR_IS_NOT, 26958 OPERATOR_LESS_THAN, 26959 OPERATOR_GREATER_THAN, 26960 OPERATOR_LESS_THAN_OR_EQUAL, 26961 OPERATOR_GREATER_THAN_OR_EQUAL, 26962 OPERATOR_BETWEEN, 26963 // Multiple-selection 26964 constants_OPERATOR_IS_ANY, 26965 constants_OPERATOR_IS_NONE, 26966 OPERATOR_IS_ALL, 26967 OPERATOR_IS_NOT_ALL 26968 ] 26969 } 26970 }; 26971 26972 26973 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js 26974 26975 26976 26977 function text_sort(valueA, valueB, direction) { 26978 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 26979 } 26980 var text_default = { 26981 sort: text_sort, 26982 isValid: { 26983 elements: true, 26984 custom: () => null 26985 }, 26986 Edit: "text", 26987 render: ({ item, field }) => { 26988 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); 26989 }, 26990 enableSorting: true, 26991 filterBy: { 26992 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], 26993 validOperators: [ 26994 // Single selection 26995 constants_OPERATOR_IS, 26996 constants_OPERATOR_IS_NOT, 26997 OPERATOR_CONTAINS, 26998 OPERATOR_NOT_CONTAINS, 26999 OPERATOR_STARTS_WITH, 27000 // Multiple selection 27001 constants_OPERATOR_IS_ANY, 27002 constants_OPERATOR_IS_NONE, 27003 OPERATOR_IS_ALL, 27004 OPERATOR_IS_NOT_ALL 27005 ] 27006 } 27007 }; 27008 27009 27010 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js 27011 27012 27013 27014 function datetime_sort(a, b, direction) { 27015 const timeA = new Date(a).getTime(); 27016 const timeB = new Date(b).getTime(); 27017 return direction === "asc" ? timeA - timeB : timeB - timeA; 27018 } 27019 var datetime_default = { 27020 sort: datetime_sort, 27021 isValid: { 27022 elements: true, 27023 custom: () => null 27024 }, 27025 Edit: "datetime", 27026 render: ({ item, field }) => { 27027 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); 27028 }, 27029 enableSorting: true, 27030 filterBy: { 27031 defaultOperators: [ 27032 OPERATOR_ON, 27033 OPERATOR_NOT_ON, 27034 OPERATOR_BEFORE, 27035 OPERATOR_AFTER, 27036 OPERATOR_BEFORE_INC, 27037 OPERATOR_AFTER_INC, 27038 OPERATOR_IN_THE_PAST, 27039 OPERATOR_OVER 27040 ], 27041 validOperators: [ 27042 OPERATOR_ON, 27043 OPERATOR_NOT_ON, 27044 OPERATOR_BEFORE, 27045 OPERATOR_AFTER, 27046 OPERATOR_BEFORE_INC, 27047 OPERATOR_AFTER_INC, 27048 OPERATOR_IN_THE_PAST, 27049 OPERATOR_OVER 27050 ] 27051 } 27052 }; 27053 27054 27055 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/date.js 27056 27057 27058 27059 27060 const getFormattedDate = (dateToDisplay) => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.date, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay)); 27061 function date_sort(a, b, direction) { 27062 const timeA = new Date(a).getTime(); 27063 const timeB = new Date(b).getTime(); 27064 return direction === "asc" ? timeA - timeB : timeB - timeA; 27065 } 27066 var date_default = { 27067 sort: date_sort, 27068 Edit: "date", 27069 isValid: { 27070 elements: true, 27071 custom: () => null 27072 }, 27073 render: ({ item, field }) => { 27074 if (field.hasElements) { 27075 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); 27076 } 27077 const value = field.getValue({ item }); 27078 if (!value) { 27079 return ""; 27080 } 27081 return getFormattedDate(value); 27082 }, 27083 enableSorting: true, 27084 filterBy: { 27085 defaultOperators: [ 27086 OPERATOR_ON, 27087 OPERATOR_NOT_ON, 27088 OPERATOR_BEFORE, 27089 OPERATOR_AFTER, 27090 OPERATOR_BEFORE_INC, 27091 OPERATOR_AFTER_INC, 27092 OPERATOR_IN_THE_PAST, 27093 OPERATOR_OVER, 27094 OPERATOR_BETWEEN 27095 ], 27096 validOperators: [ 27097 OPERATOR_ON, 27098 OPERATOR_NOT_ON, 27099 OPERATOR_BEFORE, 27100 OPERATOR_AFTER, 27101 OPERATOR_BEFORE_INC, 27102 OPERATOR_AFTER_INC, 27103 OPERATOR_IN_THE_PAST, 27104 OPERATOR_OVER, 27105 OPERATOR_BETWEEN 27106 ] 27107 } 27108 }; 27109 27110 27111 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/boolean.js 27112 27113 27114 27115 27116 function boolean_sort(a, b, direction) { 27117 const boolA = Boolean(a); 27118 const boolB = Boolean(b); 27119 if (boolA === boolB) { 27120 return 0; 27121 } 27122 if (direction === "asc") { 27123 return boolA ? 1 : -1; 27124 } 27125 return boolA ? -1 : 1; 27126 } 27127 var boolean_default = { 27128 sort: boolean_sort, 27129 isValid: { 27130 elements: true, 27131 custom: (item, field) => { 27132 const value = field.getValue({ item }); 27133 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) { 27134 return (0,external_wp_i18n_namespaceObject.__)("Value must be true, false, or undefined"); 27135 } 27136 return null; 27137 } 27138 }, 27139 Edit: "checkbox", 27140 render: ({ item, field }) => { 27141 if (field.hasElements) { 27142 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); 27143 } 27144 if (field.getValue({ item }) === true) { 27145 return (0,external_wp_i18n_namespaceObject.__)("True"); 27146 } 27147 if (field.getValue({ item }) === false) { 27148 return (0,external_wp_i18n_namespaceObject.__)("False"); 27149 } 27150 return null; 27151 }, 27152 enableSorting: true, 27153 filterBy: { 27154 defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT], 27155 validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT] 27156 } 27157 }; 27158 27159 27160 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/media.js 27161 function media_sort() { 27162 return 0; 27163 } 27164 var media_default = { 27165 sort: media_sort, 27166 isValid: { 27167 elements: true, 27168 custom: () => null 27169 }, 27170 Edit: null, 27171 render: () => null, 27172 enableSorting: false, 27173 filterBy: false 27174 }; 27175 27176 27177 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/array.js 27178 27179 27180 function array_sort(valueA, valueB, direction) { 27181 const arrA = Array.isArray(valueA) ? valueA : []; 27182 const arrB = Array.isArray(valueB) ? valueB : []; 27183 if (arrA.length !== arrB.length) { 27184 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length; 27185 } 27186 const joinedA = arrA.join(","); 27187 const joinedB = arrB.join(","); 27188 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA); 27189 } 27190 function render({ item, field }) { 27191 const value = field.getValue({ item }) || []; 27192 return value.join(", "); 27193 } 27194 const arrayFieldType = { 27195 sort: array_sort, 27196 isValid: { 27197 elements: true, 27198 custom: (item, field) => { 27199 const value = field.getValue({ item }); 27200 if (![void 0, "", null].includes(value) && !Array.isArray(value)) { 27201 return (0,external_wp_i18n_namespaceObject.__)("Value must be an array."); 27202 } 27203 if (!value.every((v) => typeof v === "string")) { 27204 return (0,external_wp_i18n_namespaceObject.__)("Every value must be a string."); 27205 } 27206 return null; 27207 } 27208 }, 27209 Edit: "array", 27210 // Use array control 27211 render, 27212 enableSorting: true, 27213 filterBy: { 27214 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], 27215 validOperators: [ 27216 constants_OPERATOR_IS_ANY, 27217 constants_OPERATOR_IS_NONE, 27218 OPERATOR_IS_ALL, 27219 OPERATOR_IS_NOT_ALL 27220 ] 27221 } 27222 }; 27223 var array_default = arrayFieldType; 27224 27225 27226 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/password.js 27227 27228 27229 function password_sort(valueA, valueB, direction) { 27230 return 0; 27231 } 27232 var password_default = { 27233 sort: password_sort, 27234 isValid: { 27235 elements: true, 27236 custom: () => null 27237 }, 27238 Edit: "password", 27239 render: ({ item, field }) => { 27240 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"; 27241 }, 27242 enableSorting: false, 27243 filterBy: false 27244 }; 27245 27246 27247 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/telephone.js 27248 27249 27250 27251 function telephone_sort(valueA, valueB, direction) { 27252 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 27253 } 27254 var telephone_default = { 27255 sort: telephone_sort, 27256 isValid: { 27257 elements: true, 27258 custom: () => null 27259 }, 27260 Edit: "telephone", 27261 render: ({ item, field }) => { 27262 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); 27263 }, 27264 enableSorting: true, 27265 filterBy: { 27266 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], 27267 validOperators: [ 27268 constants_OPERATOR_IS, 27269 constants_OPERATOR_IS_NOT, 27270 OPERATOR_CONTAINS, 27271 OPERATOR_NOT_CONTAINS, 27272 OPERATOR_STARTS_WITH, 27273 // Multiple selection 27274 constants_OPERATOR_IS_ANY, 27275 constants_OPERATOR_IS_NONE, 27276 OPERATOR_IS_ALL, 27277 OPERATOR_IS_NOT_ALL 27278 ] 27279 } 27280 }; 27281 27282 27283 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/color.js 27284 27285 27286 27287 27288 27289 function color_sort(valueA, valueB, direction) { 27290 const colorA = w(valueA); 27291 const colorB = w(valueB); 27292 if (!colorA.isValid() && !colorB.isValid()) { 27293 return 0; 27294 } 27295 if (!colorA.isValid()) { 27296 return direction === "asc" ? 1 : -1; 27297 } 27298 if (!colorB.isValid()) { 27299 return direction === "asc" ? -1 : 1; 27300 } 27301 const hslA = colorA.toHsl(); 27302 const hslB = colorB.toHsl(); 27303 if (hslA.h !== hslB.h) { 27304 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h; 27305 } 27306 if (hslA.s !== hslB.s) { 27307 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s; 27308 } 27309 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l; 27310 } 27311 var color_color_default = { 27312 sort: color_sort, 27313 isValid: { 27314 elements: true, 27315 custom: (item, field) => { 27316 const value = field.getValue({ item }); 27317 if (![void 0, "", null].includes(value) && !w(value).isValid()) { 27318 return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid color."); 27319 } 27320 return null; 27321 } 27322 }, 27323 Edit: "color", 27324 render: ({ item, field }) => { 27325 if (field.hasElements) { 27326 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); 27327 } 27328 const value = field.getValue({ item }); 27329 if (!value || !w(value).isValid()) { 27330 return value; 27331 } 27332 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 27333 "div", 27334 { 27335 style: { display: "flex", alignItems: "center", gap: "8px" }, 27336 children: [ 27337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27338 "div", 27339 { 27340 style: { 27341 width: "16px", 27342 height: "16px", 27343 borderRadius: "50%", 27344 backgroundColor: value, 27345 border: "1px solid #ddd", 27346 flexShrink: 0 27347 } 27348 } 27349 ), 27350 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: value }) 27351 ] 27352 } 27353 ); 27354 }, 27355 enableSorting: true, 27356 filterBy: { 27357 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], 27358 validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT] 27359 } 27360 }; 27361 27362 27363 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/url.js 27364 27365 27366 27367 function url_sort(valueA, valueB, direction) { 27368 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 27369 } 27370 var url_default = { 27371 sort: url_sort, 27372 isValid: { 27373 elements: true, 27374 custom: () => null 27375 }, 27376 Edit: "url", 27377 render: ({ item, field }) => { 27378 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); 27379 }, 27380 enableSorting: true, 27381 filterBy: { 27382 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], 27383 validOperators: [ 27384 constants_OPERATOR_IS, 27385 constants_OPERATOR_IS_NOT, 27386 OPERATOR_CONTAINS, 27387 OPERATOR_NOT_CONTAINS, 27388 OPERATOR_STARTS_WITH, 27389 // Multiple selection 27390 constants_OPERATOR_IS_ANY, 27391 constants_OPERATOR_IS_NONE, 27392 OPERATOR_IS_ALL, 27393 OPERATOR_IS_NOT_ALL 27394 ] 27395 } 27396 }; 27397 27398 27399 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 27412 27413 27414 27415 27416 function getFieldTypeDefinition(type) { 27417 if ("email" === type) { 27418 return email_default; 27419 } 27420 if ("integer" === type) { 27421 return integer_default; 27422 } 27423 if ("number" === type) { 27424 return number_default; 27425 } 27426 if ("text" === type) { 27427 return text_default; 27428 } 27429 if ("datetime" === type) { 27430 return datetime_default; 27431 } 27432 if ("date" === type) { 27433 return date_default; 27434 } 27435 if ("boolean" === type) { 27436 return boolean_default; 27437 } 27438 if ("media" === type) { 27439 return media_default; 27440 } 27441 if ("array" === type) { 27442 return array_default; 27443 } 27444 if ("password" === type) { 27445 return password_default; 27446 } 27447 if ("telephone" === type) { 27448 return telephone_default; 27449 } 27450 if ("color" === type) { 27451 return color_color_default; 27452 } 27453 if ("url" === type) { 27454 return url_default; 27455 } 27456 return { 27457 sort: (a, b, direction) => { 27458 if (typeof a === "number" && typeof b === "number") { 27459 return direction === "asc" ? a - b : b - a; 27460 } 27461 return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a); 27462 }, 27463 isValid: { 27464 elements: true, 27465 custom: () => null 27466 }, 27467 Edit: null, 27468 render: ({ item, field }) => { 27469 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); 27470 }, 27471 enableSorting: true, 27472 filterBy: { 27473 defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT], 27474 validOperators: ALL_OPERATORS 27475 } 27476 }; 27477 } 27478 27479 27480 ;// ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js 27481 27482 const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 27483 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 27484 "@wordpress/dataviews" 27485 ); 27486 27487 27488 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/get-custom-validity.js 27489 function getCustomValidity(isValid, validity) { 27490 let customValidity; 27491 if (isValid?.required && validity?.required) { 27492 customValidity = validity?.required?.message ? validity.required : void 0; 27493 } else if (isValid?.elements && validity?.elements) { 27494 customValidity = validity.elements; 27495 } else if (validity?.custom) { 27496 customValidity = validity.custom; 27497 } 27498 return customValidity; 27499 } 27500 27501 27502 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/checkbox.js 27503 27504 27505 27506 27507 27508 const { ValidatedCheckboxControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 27509 function Checkbox({ 27510 field, 27511 onChange, 27512 data, 27513 hideLabelFromVision, 27514 validity 27515 }) { 27516 const { getValue, setValue, label, description, isValid } = field; 27517 const onChangeControl = (0,external_wp_element_.useCallback)(() => { 27518 onChange( 27519 setValue({ item: data, value: !getValue({ item: data }) }) 27520 ); 27521 }, [data, getValue, onChange, setValue]); 27522 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27523 ValidatedCheckboxControl, 27524 { 27525 required: !!field.isValid?.required, 27526 customValidity: getCustomValidity(isValid, validity), 27527 hidden: hideLabelFromVision, 27528 label, 27529 help: description, 27530 checked: getValue({ item: data }), 27531 onChange: onChangeControl 27532 } 27533 ); 27534 } 27535 27536 27537 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isDate.js 27538 /** 27539 * @name isDate 27540 * @category Common Helpers 27541 * @summary Is the given value a date? 27542 * 27543 * @description 27544 * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes. 27545 * 27546 * @param value - The value to check 27547 * 27548 * @returns True if the given value is a date 27549 * 27550 * @example 27551 * // For a valid date: 27552 * const result = isDate(new Date()) 27553 * //=> true 27554 * 27555 * @example 27556 * // For an invalid date: 27557 * const result = isDate(new Date(NaN)) 27558 * //=> true 27559 * 27560 * @example 27561 * // For some value: 27562 * const result = isDate('2014-02-31') 27563 * //=> false 27564 * 27565 * @example 27566 * // For an object: 27567 * const result = isDate({}) 27568 * //=> false 27569 */ 27570 function isDate(value) { 27571 return ( 27572 value instanceof Date || 27573 (typeof value === "object" && 27574 Object.prototype.toString.call(value) === "[object Date]") 27575 ); 27576 } 27577 27578 // Fallback for modularized imports: 27579 /* harmony default export */ const date_fns_isDate = ((/* unused pure expression or super */ null && (isDate))); 27580 27581 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isValid.js 27582 27583 27584 27585 /** 27586 * @name isValid 27587 * @category Common Helpers 27588 * @summary Is the given date valid? 27589 * 27590 * @description 27591 * Returns false if argument is Invalid Date and true otherwise. 27592 * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate) 27593 * Invalid Date is a Date, whose time value is NaN. 27594 * 27595 * Time value of Date: http://es5.github.io/#x15.9.1.1 27596 * 27597 * @param date - The date to check 27598 * 27599 * @returns The date is valid 27600 * 27601 * @example 27602 * // For the valid date: 27603 * const result = isValid(new Date(2014, 1, 31)) 27604 * //=> true 27605 * 27606 * @example 27607 * // For the value, convertible into a date: 27608 * const result = isValid(1393804800000) 27609 * //=> true 27610 * 27611 * @example 27612 * // For the invalid date: 27613 * const result = isValid(new Date('')) 27614 * //=> false 27615 */ 27616 function isValid(date) { 27617 return !((!isDate(date) && typeof date !== "number") || isNaN(+toDate(date))); 27618 } 27619 27620 // Fallback for modularized imports: 27621 /* harmony default export */ const date_fns_isValid = ((/* unused pure expression or super */ null && (isValid))); 27622 27623 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatDistance.js 27624 const formatDistanceLocale = { 27625 lessThanXSeconds: { 27626 one: "less than a second", 27627 other: "less than {{count}} seconds", 27628 }, 27629 27630 xSeconds: { 27631 one: "1 second", 27632 other: "{{count}} seconds", 27633 }, 27634 27635 halfAMinute: "half a minute", 27636 27637 lessThanXMinutes: { 27638 one: "less than a minute", 27639 other: "less than {{count}} minutes", 27640 }, 27641 27642 xMinutes: { 27643 one: "1 minute", 27644 other: "{{count}} minutes", 27645 }, 27646 27647 aboutXHours: { 27648 one: "about 1 hour", 27649 other: "about {{count}} hours", 27650 }, 27651 27652 xHours: { 27653 one: "1 hour", 27654 other: "{{count}} hours", 27655 }, 27656 27657 xDays: { 27658 one: "1 day", 27659 other: "{{count}} days", 27660 }, 27661 27662 aboutXWeeks: { 27663 one: "about 1 week", 27664 other: "about {{count}} weeks", 27665 }, 27666 27667 xWeeks: { 27668 one: "1 week", 27669 other: "{{count}} weeks", 27670 }, 27671 27672 aboutXMonths: { 27673 one: "about 1 month", 27674 other: "about {{count}} months", 27675 }, 27676 27677 xMonths: { 27678 one: "1 month", 27679 other: "{{count}} months", 27680 }, 27681 27682 aboutXYears: { 27683 one: "about 1 year", 27684 other: "about {{count}} years", 27685 }, 27686 27687 xYears: { 27688 one: "1 year", 27689 other: "{{count}} years", 27690 }, 27691 27692 overXYears: { 27693 one: "over 1 year", 27694 other: "over {{count}} years", 27695 }, 27696 27697 almostXYears: { 27698 one: "almost 1 year", 27699 other: "almost {{count}} years", 27700 }, 27701 }; 27702 27703 const formatDistance = (token, count, options) => { 27704 let result; 27705 27706 const tokenValue = formatDistanceLocale[token]; 27707 if (typeof tokenValue === "string") { 27708 result = tokenValue; 27709 } else if (count === 1) { 27710 result = tokenValue.one; 27711 } else { 27712 result = tokenValue.other.replace("{{count}}", count.toString()); 27713 } 27714 27715 if (options?.addSuffix) { 27716 if (options.comparison && options.comparison > 0) { 27717 return "in " + result; 27718 } else { 27719 return result + " ago"; 27720 } 27721 } 27722 27723 return result; 27724 }; 27725 27726 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildFormatLongFn.js 27727 function buildFormatLongFn(args) { 27728 return (options = {}) => { 27729 // TODO: Remove String() 27730 const width = options.width ? String(options.width) : args.defaultWidth; 27731 const format = args.formats[width] || args.formats[args.defaultWidth]; 27732 return format; 27733 }; 27734 } 27735 27736 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatLong.js 27737 27738 27739 const dateFormats = { 27740 full: "EEEE, MMMM do, y", 27741 long: "MMMM do, y", 27742 medium: "MMM d, y", 27743 short: "MM/dd/yyyy", 27744 }; 27745 27746 const timeFormats = { 27747 full: "h:mm:ss a zzzz", 27748 long: "h:mm:ss a z", 27749 medium: "h:mm:ss a", 27750 short: "h:mm a", 27751 }; 27752 27753 const dateTimeFormats = { 27754 full: "{{date}} 'at' {{time}}", 27755 long: "{{date}} 'at' {{time}}", 27756 medium: "{{date}}, {{time}}", 27757 short: "{{date}}, {{time}}", 27758 }; 27759 27760 const formatLong = { 27761 date: buildFormatLongFn({ 27762 formats: dateFormats, 27763 defaultWidth: "full", 27764 }), 27765 27766 time: buildFormatLongFn({ 27767 formats: timeFormats, 27768 defaultWidth: "full", 27769 }), 27770 27771 dateTime: buildFormatLongFn({ 27772 formats: dateTimeFormats, 27773 defaultWidth: "full", 27774 }), 27775 }; 27776 27777 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatRelative.js 27778 const formatRelativeLocale = { 27779 lastWeek: "'last' eeee 'at' p", 27780 yesterday: "'yesterday at' p", 27781 today: "'today at' p", 27782 tomorrow: "'tomorrow at' p", 27783 nextWeek: "eeee 'at' p", 27784 other: "P", 27785 }; 27786 27787 const formatRelative = (token, _date, _baseDate, _options) => 27788 formatRelativeLocale[token]; 27789 27790 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildLocalizeFn.js 27791 /** 27792 * The localize function argument callback which allows to convert raw value to 27793 * the actual type. 27794 * 27795 * @param value - The value to convert 27796 * 27797 * @returns The converted value 27798 */ 27799 27800 /** 27801 * The map of localized values for each width. 27802 */ 27803 27804 /** 27805 * The index type of the locale unit value. It types conversion of units of 27806 * values that don't start at 0 (i.e. quarters). 27807 */ 27808 27809 /** 27810 * Converts the unit value to the tuple of values. 27811 */ 27812 27813 /** 27814 * The tuple of localized era values. The first element represents BC, 27815 * the second element represents AD. 27816 */ 27817 27818 /** 27819 * The tuple of localized quarter values. The first element represents Q1. 27820 */ 27821 27822 /** 27823 * The tuple of localized day values. The first element represents Sunday. 27824 */ 27825 27826 /** 27827 * The tuple of localized month values. The first element represents January. 27828 */ 27829 27830 function buildLocalizeFn(args) { 27831 return (value, options) => { 27832 const context = options?.context ? String(options.context) : "standalone"; 27833 27834 let valuesArray; 27835 if (context === "formatting" && args.formattingValues) { 27836 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; 27837 const width = options?.width ? String(options.width) : defaultWidth; 27838 27839 valuesArray = 27840 args.formattingValues[width] || args.formattingValues[defaultWidth]; 27841 } else { 27842 const defaultWidth = args.defaultWidth; 27843 const width = options?.width ? String(options.width) : args.defaultWidth; 27844 27845 valuesArray = args.values[width] || args.values[defaultWidth]; 27846 } 27847 const index = args.argumentCallback ? args.argumentCallback(value) : value; 27848 27849 // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it! 27850 return valuesArray[index]; 27851 }; 27852 } 27853 27854 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/localize.js 27855 27856 27857 const eraValues = { 27858 narrow: ["B", "A"], 27859 abbreviated: ["BC", "AD"], 27860 wide: ["Before Christ", "Anno Domini"], 27861 }; 27862 27863 const quarterValues = { 27864 narrow: ["1", "2", "3", "4"], 27865 abbreviated: ["Q1", "Q2", "Q3", "Q4"], 27866 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"], 27867 }; 27868 27869 // Note: in English, the names of days of the week and months are capitalized. 27870 // If you are making a new locale based on this one, check if the same is true for the language you're working on. 27871 // Generally, formatted dates should look like they are in the middle of a sentence, 27872 // e.g. in Spanish language the weekdays and months should be in the lowercase. 27873 const monthValues = { 27874 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], 27875 abbreviated: [ 27876 "Jan", 27877 "Feb", 27878 "Mar", 27879 "Apr", 27880 "May", 27881 "Jun", 27882 "Jul", 27883 "Aug", 27884 "Sep", 27885 "Oct", 27886 "Nov", 27887 "Dec", 27888 ], 27889 27890 wide: [ 27891 "January", 27892 "February", 27893 "March", 27894 "April", 27895 "May", 27896 "June", 27897 "July", 27898 "August", 27899 "September", 27900 "October", 27901 "November", 27902 "December", 27903 ], 27904 }; 27905 27906 const dayValues = { 27907 narrow: ["S", "M", "T", "W", "T", "F", "S"], 27908 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 27909 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 27910 wide: [ 27911 "Sunday", 27912 "Monday", 27913 "Tuesday", 27914 "Wednesday", 27915 "Thursday", 27916 "Friday", 27917 "Saturday", 27918 ], 27919 }; 27920 27921 const dayPeriodValues = { 27922 narrow: { 27923 am: "a", 27924 pm: "p", 27925 midnight: "mi", 27926 noon: "n", 27927 morning: "morning", 27928 afternoon: "afternoon", 27929 evening: "evening", 27930 night: "night", 27931 }, 27932 abbreviated: { 27933 am: "AM", 27934 pm: "PM", 27935 midnight: "midnight", 27936 noon: "noon", 27937 morning: "morning", 27938 afternoon: "afternoon", 27939 evening: "evening", 27940 night: "night", 27941 }, 27942 wide: { 27943 am: "a.m.", 27944 pm: "p.m.", 27945 midnight: "midnight", 27946 noon: "noon", 27947 morning: "morning", 27948 afternoon: "afternoon", 27949 evening: "evening", 27950 night: "night", 27951 }, 27952 }; 27953 27954 const formattingDayPeriodValues = { 27955 narrow: { 27956 am: "a", 27957 pm: "p", 27958 midnight: "mi", 27959 noon: "n", 27960 morning: "in the morning", 27961 afternoon: "in the afternoon", 27962 evening: "in the evening", 27963 night: "at night", 27964 }, 27965 abbreviated: { 27966 am: "AM", 27967 pm: "PM", 27968 midnight: "midnight", 27969 noon: "noon", 27970 morning: "in the morning", 27971 afternoon: "in the afternoon", 27972 evening: "in the evening", 27973 night: "at night", 27974 }, 27975 wide: { 27976 am: "a.m.", 27977 pm: "p.m.", 27978 midnight: "midnight", 27979 noon: "noon", 27980 morning: "in the morning", 27981 afternoon: "in the afternoon", 27982 evening: "in the evening", 27983 night: "at night", 27984 }, 27985 }; 27986 27987 const ordinalNumber = (dirtyNumber, _options) => { 27988 const number = Number(dirtyNumber); 27989 27990 // If ordinal numbers depend on context, for example, 27991 // if they are different for different grammatical genders, 27992 // use `options.unit`. 27993 // 27994 // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear', 27995 // 'day', 'hour', 'minute', 'second'. 27996 27997 const rem100 = number % 100; 27998 if (rem100 > 20 || rem100 < 10) { 27999 switch (rem100 % 10) { 28000 case 1: 28001 return number + "st"; 28002 case 2: 28003 return number + "nd"; 28004 case 3: 28005 return number + "rd"; 28006 } 28007 } 28008 return number + "th"; 28009 }; 28010 28011 const localize = { 28012 ordinalNumber, 28013 28014 era: buildLocalizeFn({ 28015 values: eraValues, 28016 defaultWidth: "wide", 28017 }), 28018 28019 quarter: buildLocalizeFn({ 28020 values: quarterValues, 28021 defaultWidth: "wide", 28022 argumentCallback: (quarter) => quarter - 1, 28023 }), 28024 28025 month: buildLocalizeFn({ 28026 values: monthValues, 28027 defaultWidth: "wide", 28028 }), 28029 28030 day: buildLocalizeFn({ 28031 values: dayValues, 28032 defaultWidth: "wide", 28033 }), 28034 28035 dayPeriod: buildLocalizeFn({ 28036 values: dayPeriodValues, 28037 defaultWidth: "wide", 28038 formattingValues: formattingDayPeriodValues, 28039 defaultFormattingWidth: "wide", 28040 }), 28041 }; 28042 28043 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchFn.js 28044 function buildMatchFn(args) { 28045 return (string, options = {}) => { 28046 const width = options.width; 28047 28048 const matchPattern = 28049 (width && args.matchPatterns[width]) || 28050 args.matchPatterns[args.defaultMatchWidth]; 28051 const matchResult = string.match(matchPattern); 28052 28053 if (!matchResult) { 28054 return null; 28055 } 28056 const matchedString = matchResult[0]; 28057 28058 const parsePatterns = 28059 (width && args.parsePatterns[width]) || 28060 args.parsePatterns[args.defaultParseWidth]; 28061 28062 const key = Array.isArray(parsePatterns) 28063 ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) 28064 : // [TODO] -- I challenge you to fix the type 28065 findKey(parsePatterns, (pattern) => pattern.test(matchedString)); 28066 28067 let value; 28068 28069 value = args.valueCallback ? args.valueCallback(key) : key; 28070 value = options.valueCallback 28071 ? // [TODO] -- I challenge you to fix the type 28072 options.valueCallback(value) 28073 : value; 28074 28075 const rest = string.slice(matchedString.length); 28076 28077 return { value, rest }; 28078 }; 28079 } 28080 28081 function findKey(object, predicate) { 28082 for (const key in object) { 28083 if ( 28084 Object.prototype.hasOwnProperty.call(object, key) && 28085 predicate(object[key]) 28086 ) { 28087 return key; 28088 } 28089 } 28090 return undefined; 28091 } 28092 28093 function findIndex(array, predicate) { 28094 for (let key = 0; key < array.length; key++) { 28095 if (predicate(array[key])) { 28096 return key; 28097 } 28098 } 28099 return undefined; 28100 } 28101 28102 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js 28103 function buildMatchPatternFn(args) { 28104 return (string, options = {}) => { 28105 const matchResult = string.match(args.matchPattern); 28106 if (!matchResult) return null; 28107 const matchedString = matchResult[0]; 28108 28109 const parseResult = string.match(args.parsePattern); 28110 if (!parseResult) return null; 28111 let value = args.valueCallback 28112 ? args.valueCallback(parseResult[0]) 28113 : parseResult[0]; 28114 28115 // [TODO] I challenge you to fix the type 28116 value = options.valueCallback ? options.valueCallback(value) : value; 28117 28118 const rest = string.slice(matchedString.length); 28119 28120 return { value, rest }; 28121 }; 28122 } 28123 28124 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/match.js 28125 28126 28127 28128 const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; 28129 const parseOrdinalNumberPattern = /\d+/i; 28130 28131 const matchEraPatterns = { 28132 narrow: /^(b|a)/i, 28133 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, 28134 wide: /^(before christ|before common era|anno domini|common era)/i, 28135 }; 28136 const parseEraPatterns = { 28137 any: [/^b/i, /^(a|c)/i], 28138 }; 28139 28140 const matchQuarterPatterns = { 28141 narrow: /^[1234]/i, 28142 abbreviated: /^q[1234]/i, 28143 wide: /^[1234](th|st|nd|rd)? quarter/i, 28144 }; 28145 const parseQuarterPatterns = { 28146 any: [/1/i, /2/i, /3/i, /4/i], 28147 }; 28148 28149 const matchMonthPatterns = { 28150 narrow: /^[jfmasond]/i, 28151 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, 28152 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i, 28153 }; 28154 const parseMonthPatterns = { 28155 narrow: [ 28156 /^j/i, 28157 /^f/i, 28158 /^m/i, 28159 /^a/i, 28160 /^m/i, 28161 /^j/i, 28162 /^j/i, 28163 /^a/i, 28164 /^s/i, 28165 /^o/i, 28166 /^n/i, 28167 /^d/i, 28168 ], 28169 28170 any: [ 28171 /^ja/i, 28172 /^f/i, 28173 /^mar/i, 28174 /^ap/i, 28175 /^may/i, 28176 /^jun/i, 28177 /^jul/i, 28178 /^au/i, 28179 /^s/i, 28180 /^o/i, 28181 /^n/i, 28182 /^d/i, 28183 ], 28184 }; 28185 28186 const matchDayPatterns = { 28187 narrow: /^[smtwf]/i, 28188 short: /^(su|mo|tu|we|th|fr|sa)/i, 28189 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, 28190 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i, 28191 }; 28192 const parseDayPatterns = { 28193 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], 28194 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i], 28195 }; 28196 28197 const matchDayPeriodPatterns = { 28198 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, 28199 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i, 28200 }; 28201 const parseDayPeriodPatterns = { 28202 any: { 28203 am: /^a/i, 28204 pm: /^p/i, 28205 midnight: /^mi/i, 28206 noon: /^no/i, 28207 morning: /morning/i, 28208 afternoon: /afternoon/i, 28209 evening: /evening/i, 28210 night: /night/i, 28211 }, 28212 }; 28213 28214 const match_match = { 28215 ordinalNumber: buildMatchPatternFn({ 28216 matchPattern: matchOrdinalNumberPattern, 28217 parsePattern: parseOrdinalNumberPattern, 28218 valueCallback: (value) => parseInt(value, 10), 28219 }), 28220 28221 era: buildMatchFn({ 28222 matchPatterns: matchEraPatterns, 28223 defaultMatchWidth: "wide", 28224 parsePatterns: parseEraPatterns, 28225 defaultParseWidth: "any", 28226 }), 28227 28228 quarter: buildMatchFn({ 28229 matchPatterns: matchQuarterPatterns, 28230 defaultMatchWidth: "wide", 28231 parsePatterns: parseQuarterPatterns, 28232 defaultParseWidth: "any", 28233 valueCallback: (index) => index + 1, 28234 }), 28235 28236 month: buildMatchFn({ 28237 matchPatterns: matchMonthPatterns, 28238 defaultMatchWidth: "wide", 28239 parsePatterns: parseMonthPatterns, 28240 defaultParseWidth: "any", 28241 }), 28242 28243 day: buildMatchFn({ 28244 matchPatterns: matchDayPatterns, 28245 defaultMatchWidth: "wide", 28246 parsePatterns: parseDayPatterns, 28247 defaultParseWidth: "any", 28248 }), 28249 28250 dayPeriod: buildMatchFn({ 28251 matchPatterns: matchDayPeriodPatterns, 28252 defaultMatchWidth: "any", 28253 parsePatterns: parseDayPeriodPatterns, 28254 defaultParseWidth: "any", 28255 }), 28256 }; 28257 28258 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US.js 28259 28260 28261 28262 28263 28264 28265 /** 28266 * @category Locales 28267 * @summary English locale (United States). 28268 * @language English 28269 * @iso-639-2 eng 28270 * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp) 28271 * @author Lesha Koss [@leshakoss](https://github.com/leshakoss) 28272 */ 28273 const enUS = { 28274 code: "en-US", 28275 formatDistance: formatDistance, 28276 formatLong: formatLong, 28277 formatRelative: formatRelative, 28278 localize: localize, 28279 match: match_match, 28280 options: { 28281 weekStartsOn: 0 /* Sunday */, 28282 firstWeekContainsDate: 1, 28283 }, 28284 }; 28285 28286 // Fallback for modularized imports: 28287 /* harmony default export */ const en_US = ((/* unused pure expression or super */ null && (enUS))); 28288 28289 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/defaultOptions.js 28290 let defaultOptions = {}; 28291 28292 function getDefaultOptions() { 28293 return defaultOptions; 28294 } 28295 28296 function setDefaultOptions(newOptions) { 28297 defaultOptions = newOptions; 28298 } 28299 28300 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js 28301 28302 28303 /** 28304 * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds. 28305 * They usually appear for dates that denote time before the timezones were introduced 28306 * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891 28307 * and GMT+01:00:00 after that date) 28308 * 28309 * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above, 28310 * which would lead to incorrect calculations. 28311 * 28312 * This function returns the timezone offset in milliseconds that takes seconds in account. 28313 */ 28314 function getTimezoneOffsetInMilliseconds(date) { 28315 const _date = toDate(date); 28316 const utcDate = new Date( 28317 Date.UTC( 28318 _date.getFullYear(), 28319 _date.getMonth(), 28320 _date.getDate(), 28321 _date.getHours(), 28322 _date.getMinutes(), 28323 _date.getSeconds(), 28324 _date.getMilliseconds(), 28325 ), 28326 ); 28327 utcDate.setUTCFullYear(_date.getFullYear()); 28328 return +date - +utcDate; 28329 } 28330 28331 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/normalizeDates.js 28332 28333 28334 function normalizeDates(context, ...dates) { 28335 const normalize = constructFrom.bind( 28336 null, 28337 context || dates.find((date) => typeof date === "object"), 28338 ); 28339 return dates.map(normalize); 28340 } 28341 28342 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfDay.js 28343 28344 28345 /** 28346 * The {@link startOfDay} function options. 28347 */ 28348 28349 /** 28350 * @name startOfDay 28351 * @category Day Helpers 28352 * @summary Return the start of a day for the given date. 28353 * 28354 * @description 28355 * Return the start of a day for the given date. 28356 * The result will be in the local timezone. 28357 * 28358 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 28359 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 28360 * 28361 * @param date - The original date 28362 * @param options - The options 28363 * 28364 * @returns The start of a day 28365 * 28366 * @example 28367 * // The start of a day for 2 September 2014 11:55:00: 28368 * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0)) 28369 * //=> Tue Sep 02 2014 00:00:00 28370 */ 28371 function startOfDay(date, options) { 28372 const _date = toDate(date, options?.in); 28373 _date.setHours(0, 0, 0, 0); 28374 return _date; 28375 } 28376 28377 // Fallback for modularized imports: 28378 /* harmony default export */ const date_fns_startOfDay = ((/* unused pure expression or super */ null && (startOfDay))); 28379 28380 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/differenceInCalendarDays.js 28381 28382 28383 28384 28385 28386 /** 28387 * The {@link differenceInCalendarDays} function options. 28388 */ 28389 28390 /** 28391 * @name differenceInCalendarDays 28392 * @category Day Helpers 28393 * @summary Get the number of calendar days between the given dates. 28394 * 28395 * @description 28396 * Get the number of calendar days between the given dates. This means that the times are removed 28397 * from the dates and then the difference in days is calculated. 28398 * 28399 * @param laterDate - The later date 28400 * @param earlierDate - The earlier date 28401 * @param options - The options object 28402 * 28403 * @returns The number of calendar days 28404 * 28405 * @example 28406 * // How many calendar days are between 28407 * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00? 28408 * const result = differenceInCalendarDays( 28409 * new Date(2012, 6, 2, 0, 0), 28410 * new Date(2011, 6, 2, 23, 0) 28411 * ) 28412 * //=> 366 28413 * // How many calendar days are between 28414 * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00? 28415 * const result = differenceInCalendarDays( 28416 * new Date(2011, 6, 3, 0, 1), 28417 * new Date(2011, 6, 2, 23, 59) 28418 * ) 28419 * //=> 1 28420 */ 28421 function differenceInCalendarDays(laterDate, earlierDate, options) { 28422 const [laterDate_, earlierDate_] = normalizeDates( 28423 options?.in, 28424 laterDate, 28425 earlierDate, 28426 ); 28427 28428 const laterStartOfDay = startOfDay(laterDate_); 28429 const earlierStartOfDay = startOfDay(earlierDate_); 28430 28431 const laterTimestamp = 28432 +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); 28433 const earlierTimestamp = 28434 +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); 28435 28436 // Round the number of days to the nearest integer because the number of 28437 // milliseconds in a day is not constant (e.g. it's different in the week of 28438 // the daylight saving time clock shift). 28439 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); 28440 } 28441 28442 // Fallback for modularized imports: 28443 /* harmony default export */ const date_fns_differenceInCalendarDays = ((/* unused pure expression or super */ null && (differenceInCalendarDays))); 28444 28445 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfYear.js 28446 28447 28448 /** 28449 * The {@link startOfYear} function options. 28450 */ 28451 28452 /** 28453 * @name startOfYear 28454 * @category Year Helpers 28455 * @summary Return the start of a year for the given date. 28456 * 28457 * @description 28458 * Return the start of a year for the given date. 28459 * The result will be in the local timezone. 28460 * 28461 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 28462 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 28463 * 28464 * @param date - The original date 28465 * @param options - The options 28466 * 28467 * @returns The start of a year 28468 * 28469 * @example 28470 * // The start of a year for 2 September 2014 11:55:00: 28471 * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00)) 28472 * //=> Wed Jan 01 2014 00:00:00 28473 */ 28474 function startOfYear(date, options) { 28475 const date_ = toDate(date, options?.in); 28476 date_.setFullYear(date_.getFullYear(), 0, 1); 28477 date_.setHours(0, 0, 0, 0); 28478 return date_; 28479 } 28480 28481 // Fallback for modularized imports: 28482 /* harmony default export */ const date_fns_startOfYear = ((/* unused pure expression or super */ null && (startOfYear))); 28483 28484 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getDayOfYear.js 28485 28486 28487 28488 28489 /** 28490 * The {@link getDayOfYear} function options. 28491 */ 28492 28493 /** 28494 * @name getDayOfYear 28495 * @category Day Helpers 28496 * @summary Get the day of the year of the given date. 28497 * 28498 * @description 28499 * Get the day of the year of the given date. 28500 * 28501 * @param date - The given date 28502 * @param options - The options 28503 * 28504 * @returns The day of year 28505 * 28506 * @example 28507 * // Which day of the year is 2 July 2014? 28508 * const result = getDayOfYear(new Date(2014, 6, 2)) 28509 * //=> 183 28510 */ 28511 function getDayOfYear(date, options) { 28512 const _date = toDate(date, options?.in); 28513 const diff = differenceInCalendarDays(_date, startOfYear(_date)); 28514 const dayOfYear = diff + 1; 28515 return dayOfYear; 28516 } 28517 28518 // Fallback for modularized imports: 28519 /* harmony default export */ const date_fns_getDayOfYear = ((/* unused pure expression or super */ null && (getDayOfYear))); 28520 28521 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeek.js 28522 28523 28524 28525 /** 28526 * The {@link startOfWeek} function options. 28527 */ 28528 28529 /** 28530 * @name startOfWeek 28531 * @category Week Helpers 28532 * @summary Return the start of a week for the given date. 28533 * 28534 * @description 28535 * Return the start of a week for the given date. 28536 * The result will be in the local timezone. 28537 * 28538 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 28539 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 28540 * 28541 * @param date - The original date 28542 * @param options - An object with options 28543 * 28544 * @returns The start of a week 28545 * 28546 * @example 28547 * // The start of a week for 2 September 2014 11:55:00: 28548 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0)) 28549 * //=> Sun Aug 31 2014 00:00:00 28550 * 28551 * @example 28552 * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00: 28553 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) 28554 * //=> Mon Sep 01 2014 00:00:00 28555 */ 28556 function startOfWeek(date, options) { 28557 const defaultOptions = getDefaultOptions(); 28558 const weekStartsOn = 28559 options?.weekStartsOn ?? 28560 options?.locale?.options?.weekStartsOn ?? 28561 defaultOptions.weekStartsOn ?? 28562 defaultOptions.locale?.options?.weekStartsOn ?? 28563 0; 28564 28565 const _date = toDate(date, options?.in); 28566 const day = _date.getDay(); 28567 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; 28568 28569 _date.setDate(_date.getDate() - diff); 28570 _date.setHours(0, 0, 0, 0); 28571 return _date; 28572 } 28573 28574 // Fallback for modularized imports: 28575 /* harmony default export */ const date_fns_startOfWeek = ((/* unused pure expression or super */ null && (startOfWeek))); 28576 28577 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeek.js 28578 28579 28580 /** 28581 * The {@link startOfISOWeek} function options. 28582 */ 28583 28584 /** 28585 * @name startOfISOWeek 28586 * @category ISO Week Helpers 28587 * @summary Return the start of an ISO week for the given date. 28588 * 28589 * @description 28590 * Return the start of an ISO week for the given date. 28591 * The result will be in the local timezone. 28592 * 28593 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date 28594 * 28595 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 28596 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 28597 * 28598 * @param date - The original date 28599 * @param options - An object with options 28600 * 28601 * @returns The start of an ISO week 28602 * 28603 * @example 28604 * // The start of an ISO week for 2 September 2014 11:55:00: 28605 * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0)) 28606 * //=> Mon Sep 01 2014 00:00:00 28607 */ 28608 function startOfISOWeek(date, options) { 28609 return startOfWeek(date, { ...options, weekStartsOn: 1 }); 28610 } 28611 28612 // Fallback for modularized imports: 28613 /* harmony default export */ const date_fns_startOfISOWeek = ((/* unused pure expression or super */ null && (startOfISOWeek))); 28614 28615 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeekYear.js 28616 28617 28618 28619 28620 /** 28621 * The {@link getISOWeekYear} function options. 28622 */ 28623 28624 /** 28625 * @name getISOWeekYear 28626 * @category ISO Week-Numbering Year Helpers 28627 * @summary Get the ISO week-numbering year of the given date. 28628 * 28629 * @description 28630 * Get the ISO week-numbering year of the given date, 28631 * which always starts 3 days before the year's first Thursday. 28632 * 28633 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date 28634 * 28635 * @param date - The given date 28636 * 28637 * @returns The ISO week-numbering year 28638 * 28639 * @example 28640 * // Which ISO-week numbering year is 2 January 2005? 28641 * const result = getISOWeekYear(new Date(2005, 0, 2)) 28642 * //=> 2004 28643 */ 28644 function getISOWeekYear(date, options) { 28645 const _date = toDate(date, options?.in); 28646 const year = _date.getFullYear(); 28647 28648 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); 28649 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); 28650 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); 28651 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); 28652 28653 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); 28654 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); 28655 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); 28656 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); 28657 28658 if (_date.getTime() >= startOfNextYear.getTime()) { 28659 return year + 1; 28660 } else if (_date.getTime() >= startOfThisYear.getTime()) { 28661 return year; 28662 } else { 28663 return year - 1; 28664 } 28665 } 28666 28667 // Fallback for modularized imports: 28668 /* harmony default export */ const date_fns_getISOWeekYear = ((/* unused pure expression or super */ null && (getISOWeekYear))); 28669 28670 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeekYear.js 28671 28672 28673 28674 28675 /** 28676 * The {@link startOfISOWeekYear} function options. 28677 */ 28678 28679 /** 28680 * @name startOfISOWeekYear 28681 * @category ISO Week-Numbering Year Helpers 28682 * @summary Return the start of an ISO week-numbering year for the given date. 28683 * 28684 * @description 28685 * Return the start of an ISO week-numbering year, 28686 * which always starts 3 days before the year's first Thursday. 28687 * The result will be in the local timezone. 28688 * 28689 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date 28690 * 28691 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 28692 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. 28693 * 28694 * @param date - The original date 28695 * @param options - An object with options 28696 * 28697 * @returns The start of an ISO week-numbering year 28698 * 28699 * @example 28700 * // The start of an ISO week-numbering year for 2 July 2005: 28701 * const result = startOfISOWeekYear(new Date(2005, 6, 2)) 28702 * //=> Mon Jan 03 2005 00:00:00 28703 */ 28704 function startOfISOWeekYear(date, options) { 28705 const year = getISOWeekYear(date, options); 28706 const fourthOfJanuary = constructFrom(options?.in || date, 0); 28707 fourthOfJanuary.setFullYear(year, 0, 4); 28708 fourthOfJanuary.setHours(0, 0, 0, 0); 28709 return startOfISOWeek(fourthOfJanuary); 28710 } 28711 28712 // Fallback for modularized imports: 28713 /* harmony default export */ const date_fns_startOfISOWeekYear = ((/* unused pure expression or super */ null && (startOfISOWeekYear))); 28714 28715 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeek.js 28716 28717 28718 28719 28720 28721 /** 28722 * The {@link getISOWeek} function options. 28723 */ 28724 28725 /** 28726 * @name getISOWeek 28727 * @category ISO Week Helpers 28728 * @summary Get the ISO week of the given date. 28729 * 28730 * @description 28731 * Get the ISO week of the given date. 28732 * 28733 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date 28734 * 28735 * @param date - The given date 28736 * @param options - The options 28737 * 28738 * @returns The ISO week 28739 * 28740 * @example 28741 * // Which week of the ISO-week numbering year is 2 January 2005? 28742 * const result = getISOWeek(new Date(2005, 0, 2)) 28743 * //=> 53 28744 */ 28745 function getISOWeek(date, options) { 28746 const _date = toDate(date, options?.in); 28747 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); 28748 28749 // Round the number of weeks to the nearest integer because the number of 28750 // milliseconds in a week is not constant (e.g. it's different in the week of 28751 // the daylight saving time clock shift). 28752 return Math.round(diff / millisecondsInWeek) + 1; 28753 } 28754 28755 // Fallback for modularized imports: 28756 /* harmony default export */ const date_fns_getISOWeek = ((/* unused pure expression or super */ null && (getISOWeek))); 28757 28758 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeekYear.js 28759 28760 28761 28762 28763 28764 /** 28765 * The {@link getWeekYear} function options. 28766 */ 28767 28768 /** 28769 * @name getWeekYear 28770 * @category Week-Numbering Year Helpers 28771 * @summary Get the local week-numbering year of the given date. 28772 * 28773 * @description 28774 * Get the local week-numbering year of the given date. 28775 * The exact calculation depends on the values of 28776 * `options.weekStartsOn` (which is the index of the first day of the week) 28777 * and `options.firstWeekContainsDate` (which is the day of January, which is always in 28778 * the first week of the week-numbering year) 28779 * 28780 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system 28781 * 28782 * @param date - The given date 28783 * @param options - An object with options. 28784 * 28785 * @returns The local week-numbering year 28786 * 28787 * @example 28788 * // Which week numbering year is 26 December 2004 with the default settings? 28789 * const result = getWeekYear(new Date(2004, 11, 26)) 28790 * //=> 2005 28791 * 28792 * @example 28793 * // Which week numbering year is 26 December 2004 if week starts on Saturday? 28794 * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 }) 28795 * //=> 2004 28796 * 28797 * @example 28798 * // Which week numbering year is 26 December 2004 if the first week contains 4 January? 28799 * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 }) 28800 * //=> 2004 28801 */ 28802 function getWeekYear(date, options) { 28803 const _date = toDate(date, options?.in); 28804 const year = _date.getFullYear(); 28805 28806 const defaultOptions = getDefaultOptions(); 28807 const firstWeekContainsDate = 28808 options?.firstWeekContainsDate ?? 28809 options?.locale?.options?.firstWeekContainsDate ?? 28810 defaultOptions.firstWeekContainsDate ?? 28811 defaultOptions.locale?.options?.firstWeekContainsDate ?? 28812 1; 28813 28814 const firstWeekOfNextYear = constructFrom(options?.in || date, 0); 28815 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); 28816 firstWeekOfNextYear.setHours(0, 0, 0, 0); 28817 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); 28818 28819 const firstWeekOfThisYear = constructFrom(options?.in || date, 0); 28820 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); 28821 firstWeekOfThisYear.setHours(0, 0, 0, 0); 28822 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); 28823 28824 if (+_date >= +startOfNextYear) { 28825 return year + 1; 28826 } else if (+_date >= +startOfThisYear) { 28827 return year; 28828 } else { 28829 return year - 1; 28830 } 28831 } 28832 28833 // Fallback for modularized imports: 28834 /* harmony default export */ const date_fns_getWeekYear = ((/* unused pure expression or super */ null && (getWeekYear))); 28835 28836 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeekYear.js 28837 28838 28839 28840 28841 28842 /** 28843 * The {@link startOfWeekYear} function options. 28844 */ 28845 28846 /** 28847 * @name startOfWeekYear 28848 * @category Week-Numbering Year Helpers 28849 * @summary Return the start of a local week-numbering year for the given date. 28850 * 28851 * @description 28852 * Return the start of a local week-numbering year. 28853 * The exact calculation depends on the values of 28854 * `options.weekStartsOn` (which is the index of the first day of the week) 28855 * and `options.firstWeekContainsDate` (which is the day of January, which is always in 28856 * the first week of the week-numbering year) 28857 * 28858 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system 28859 * 28860 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 28861 * @typeParam ResultDate - The result `Date` type. 28862 * 28863 * @param date - The original date 28864 * @param options - An object with options 28865 * 28866 * @returns The start of a week-numbering year 28867 * 28868 * @example 28869 * // The start of an a week-numbering year for 2 July 2005 with default settings: 28870 * const result = startOfWeekYear(new Date(2005, 6, 2)) 28871 * //=> Sun Dec 26 2004 00:00:00 28872 * 28873 * @example 28874 * // The start of a week-numbering year for 2 July 2005 28875 * // if Monday is the first day of week 28876 * // and 4 January is always in the first week of the year: 28877 * const result = startOfWeekYear(new Date(2005, 6, 2), { 28878 * weekStartsOn: 1, 28879 * firstWeekContainsDate: 4 28880 * }) 28881 * //=> Mon Jan 03 2005 00:00:00 28882 */ 28883 function startOfWeekYear(date, options) { 28884 const defaultOptions = getDefaultOptions(); 28885 const firstWeekContainsDate = 28886 options?.firstWeekContainsDate ?? 28887 options?.locale?.options?.firstWeekContainsDate ?? 28888 defaultOptions.firstWeekContainsDate ?? 28889 defaultOptions.locale?.options?.firstWeekContainsDate ?? 28890 1; 28891 28892 const year = getWeekYear(date, options); 28893 const firstWeek = constructFrom(options?.in || date, 0); 28894 firstWeek.setFullYear(year, 0, firstWeekContainsDate); 28895 firstWeek.setHours(0, 0, 0, 0); 28896 const _date = startOfWeek(firstWeek, options); 28897 return _date; 28898 } 28899 28900 // Fallback for modularized imports: 28901 /* harmony default export */ const date_fns_startOfWeekYear = ((/* unused pure expression or super */ null && (startOfWeekYear))); 28902 28903 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeek.js 28904 28905 28906 28907 28908 28909 /** 28910 * The {@link getWeek} function options. 28911 */ 28912 28913 /** 28914 * @name getWeek 28915 * @category Week Helpers 28916 * @summary Get the local week index of the given date. 28917 * 28918 * @description 28919 * Get the local week index of the given date. 28920 * The exact calculation depends on the values of 28921 * `options.weekStartsOn` (which is the index of the first day of the week) 28922 * and `options.firstWeekContainsDate` (which is the day of January, which is always in 28923 * the first week of the week-numbering year) 28924 * 28925 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system 28926 * 28927 * @param date - The given date 28928 * @param options - An object with options 28929 * 28930 * @returns The week 28931 * 28932 * @example 28933 * // Which week of the local week numbering year is 2 January 2005 with default options? 28934 * const result = getWeek(new Date(2005, 0, 2)) 28935 * //=> 2 28936 * 28937 * @example 28938 * // Which week of the local week numbering year is 2 January 2005, 28939 * // if Monday is the first day of the week, 28940 * // and the first week of the year always contains 4 January? 28941 * const result = getWeek(new Date(2005, 0, 2), { 28942 * weekStartsOn: 1, 28943 * firstWeekContainsDate: 4 28944 * }) 28945 * //=> 53 28946 */ 28947 function getWeek(date, options) { 28948 const _date = toDate(date, options?.in); 28949 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); 28950 28951 // Round the number of weeks to the nearest integer because the number of 28952 // milliseconds in a week is not constant (e.g. it's different in the week of 28953 // the daylight saving time clock shift). 28954 return Math.round(diff / millisecondsInWeek) + 1; 28955 } 28956 28957 // Fallback for modularized imports: 28958 /* harmony default export */ const date_fns_getWeek = ((/* unused pure expression or super */ null && (getWeek))); 28959 28960 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/addLeadingZeros.js 28961 function addLeadingZeros(number, targetLength) { 28962 const sign = number < 0 ? "-" : ""; 28963 const output = Math.abs(number).toString().padStart(targetLength, "0"); 28964 return sign + output; 28965 } 28966 28967 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/lightFormatters.js 28968 28969 28970 /* 28971 * | | Unit | | Unit | 28972 * |-----|--------------------------------|-----|--------------------------------| 28973 * | a | AM, PM | A* | | 28974 * | d | Day of month | D | | 28975 * | h | Hour [1-12] | H | Hour [0-23] | 28976 * | m | Minute | M | Month | 28977 * | s | Second | S | Fraction of second | 28978 * | y | Year (abs) | Y | | 28979 * 28980 * Letters marked by * are not implemented but reserved by Unicode standard. 28981 */ 28982 28983 const lightFormatters = { 28984 // Year 28985 y(date, token) { 28986 // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens 28987 // | Year | y | yy | yyy | yyyy | yyyyy | 28988 // |----------|-------|----|-------|-------|-------| 28989 // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | 28990 // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | 28991 // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | 28992 // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | 28993 // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | 28994 28995 const signedYear = date.getFullYear(); 28996 // Returns 1 for 1 BC (which is year 0 in JavaScript) 28997 const year = signedYear > 0 ? signedYear : 1 - signedYear; 28998 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); 28999 }, 29000 29001 // Month 29002 M(date, token) { 29003 const month = date.getMonth(); 29004 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); 29005 }, 29006 29007 // Day of the month 29008 d(date, token) { 29009 return addLeadingZeros(date.getDate(), token.length); 29010 }, 29011 29012 // AM or PM 29013 a(date, token) { 29014 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; 29015 29016 switch (token) { 29017 case "a": 29018 case "aa": 29019 return dayPeriodEnumValue.toUpperCase(); 29020 case "aaa": 29021 return dayPeriodEnumValue; 29022 case "aaaaa": 29023 return dayPeriodEnumValue[0]; 29024 case "aaaa": 29025 default: 29026 return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; 29027 } 29028 }, 29029 29030 // Hour [1-12] 29031 h(date, token) { 29032 return addLeadingZeros(date.getHours() % 12 || 12, token.length); 29033 }, 29034 29035 // Hour [0-23] 29036 H(date, token) { 29037 return addLeadingZeros(date.getHours(), token.length); 29038 }, 29039 29040 // Minute 29041 m(date, token) { 29042 return addLeadingZeros(date.getMinutes(), token.length); 29043 }, 29044 29045 // Second 29046 s(date, token) { 29047 return addLeadingZeros(date.getSeconds(), token.length); 29048 }, 29049 29050 // Fraction of second 29051 S(date, token) { 29052 const numberOfDigits = token.length; 29053 const milliseconds = date.getMilliseconds(); 29054 const fractionalSeconds = Math.trunc( 29055 milliseconds * Math.pow(10, numberOfDigits - 3), 29056 ); 29057 return addLeadingZeros(fractionalSeconds, token.length); 29058 }, 29059 }; 29060 29061 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/formatters.js 29062 29063 29064 29065 29066 29067 29068 29069 29070 29071 const dayPeriodEnum = { 29072 am: "am", 29073 pm: "pm", 29074 midnight: "midnight", 29075 noon: "noon", 29076 morning: "morning", 29077 afternoon: "afternoon", 29078 evening: "evening", 29079 night: "night", 29080 }; 29081 29082 /* 29083 * | | Unit | | Unit | 29084 * |-----|--------------------------------|-----|--------------------------------| 29085 * | a | AM, PM | A* | Milliseconds in day | 29086 * | b | AM, PM, noon, midnight | B | Flexible day period | 29087 * | c | Stand-alone local day of week | C* | Localized hour w/ day period | 29088 * | d | Day of month | D | Day of year | 29089 * | e | Local day of week | E | Day of week | 29090 * | f | | F* | Day of week in month | 29091 * | g* | Modified Julian day | G | Era | 29092 * | h | Hour [1-12] | H | Hour [0-23] | 29093 * | i! | ISO day of week | I! | ISO week of year | 29094 * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | 29095 * | k | Hour [1-24] | K | Hour [0-11] | 29096 * | l* | (deprecated) | L | Stand-alone month | 29097 * | m | Minute | M | Month | 29098 * | n | | N | | 29099 * | o! | Ordinal number modifier | O | Timezone (GMT) | 29100 * | p! | Long localized time | P! | Long localized date | 29101 * | q | Stand-alone quarter | Q | Quarter | 29102 * | r* | Related Gregorian year | R! | ISO week-numbering year | 29103 * | s | Second | S | Fraction of second | 29104 * | t! | Seconds timestamp | T! | Milliseconds timestamp | 29105 * | u | Extended year | U* | Cyclic year | 29106 * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | 29107 * | w | Local week of year | W* | Week of month | 29108 * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | 29109 * | y | Year (abs) | Y | Local week-numbering year | 29110 * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | 29111 * 29112 * Letters marked by * are not implemented but reserved by Unicode standard. 29113 * 29114 * Letters marked by ! are non-standard, but implemented by date-fns: 29115 * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) 29116 * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, 29117 * i.e. 7 for Sunday, 1 for Monday, etc. 29118 * - `I` is ISO week of year, as opposed to `w` which is local week of year. 29119 * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. 29120 * `R` is supposed to be used in conjunction with `I` and `i` 29121 * for universal ISO week-numbering date, whereas 29122 * `Y` is supposed to be used in conjunction with `w` and `e` 29123 * for week-numbering date specific to the locale. 29124 * - `P` is long localized date format 29125 * - `p` is long localized time format 29126 */ 29127 29128 const formatters = { 29129 // Era 29130 G: function (date, token, localize) { 29131 const era = date.getFullYear() > 0 ? 1 : 0; 29132 switch (token) { 29133 // AD, BC 29134 case "G": 29135 case "GG": 29136 case "GGG": 29137 return localize.era(era, { width: "abbreviated" }); 29138 // A, B 29139 case "GGGGG": 29140 return localize.era(era, { width: "narrow" }); 29141 // Anno Domini, Before Christ 29142 case "GGGG": 29143 default: 29144 return localize.era(era, { width: "wide" }); 29145 } 29146 }, 29147 29148 // Year 29149 y: function (date, token, localize) { 29150 // Ordinal number 29151 if (token === "yo") { 29152 const signedYear = date.getFullYear(); 29153 // Returns 1 for 1 BC (which is year 0 in JavaScript) 29154 const year = signedYear > 0 ? signedYear : 1 - signedYear; 29155 return localize.ordinalNumber(year, { unit: "year" }); 29156 } 29157 29158 return lightFormatters.y(date, token); 29159 }, 29160 29161 // Local week-numbering year 29162 Y: function (date, token, localize, options) { 29163 const signedWeekYear = getWeekYear(date, options); 29164 // Returns 1 for 1 BC (which is year 0 in JavaScript) 29165 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; 29166 29167 // Two digit year 29168 if (token === "YY") { 29169 const twoDigitYear = weekYear % 100; 29170 return addLeadingZeros(twoDigitYear, 2); 29171 } 29172 29173 // Ordinal number 29174 if (token === "Yo") { 29175 return localize.ordinalNumber(weekYear, { unit: "year" }); 29176 } 29177 29178 // Padding 29179 return addLeadingZeros(weekYear, token.length); 29180 }, 29181 29182 // ISO week-numbering year 29183 R: function (date, token) { 29184 const isoWeekYear = getISOWeekYear(date); 29185 29186 // Padding 29187 return addLeadingZeros(isoWeekYear, token.length); 29188 }, 29189 29190 // Extended year. This is a single number designating the year of this calendar system. 29191 // The main difference between `y` and `u` localizers are B.C. years: 29192 // | Year | `y` | `u` | 29193 // |------|-----|-----| 29194 // | AC 1 | 1 | 1 | 29195 // | BC 1 | 1 | 0 | 29196 // | BC 2 | 2 | -1 | 29197 // Also `yy` always returns the last two digits of a year, 29198 // while `uu` pads single digit years to 2 characters and returns other years unchanged. 29199 u: function (date, token) { 29200 const year = date.getFullYear(); 29201 return addLeadingZeros(year, token.length); 29202 }, 29203 29204 // Quarter 29205 Q: function (date, token, localize) { 29206 const quarter = Math.ceil((date.getMonth() + 1) / 3); 29207 switch (token) { 29208 // 1, 2, 3, 4 29209 case "Q": 29210 return String(quarter); 29211 // 01, 02, 03, 04 29212 case "QQ": 29213 return addLeadingZeros(quarter, 2); 29214 // 1st, 2nd, 3rd, 4th 29215 case "Qo": 29216 return localize.ordinalNumber(quarter, { unit: "quarter" }); 29217 // Q1, Q2, Q3, Q4 29218 case "QQQ": 29219 return localize.quarter(quarter, { 29220 width: "abbreviated", 29221 context: "formatting", 29222 }); 29223 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 29224 case "QQQQQ": 29225 return localize.quarter(quarter, { 29226 width: "narrow", 29227 context: "formatting", 29228 }); 29229 // 1st quarter, 2nd quarter, ... 29230 case "QQQQ": 29231 default: 29232 return localize.quarter(quarter, { 29233 width: "wide", 29234 context: "formatting", 29235 }); 29236 } 29237 }, 29238 29239 // Stand-alone quarter 29240 q: function (date, token, localize) { 29241 const quarter = Math.ceil((date.getMonth() + 1) / 3); 29242 switch (token) { 29243 // 1, 2, 3, 4 29244 case "q": 29245 return String(quarter); 29246 // 01, 02, 03, 04 29247 case "qq": 29248 return addLeadingZeros(quarter, 2); 29249 // 1st, 2nd, 3rd, 4th 29250 case "qo": 29251 return localize.ordinalNumber(quarter, { unit: "quarter" }); 29252 // Q1, Q2, Q3, Q4 29253 case "qqq": 29254 return localize.quarter(quarter, { 29255 width: "abbreviated", 29256 context: "standalone", 29257 }); 29258 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 29259 case "qqqqq": 29260 return localize.quarter(quarter, { 29261 width: "narrow", 29262 context: "standalone", 29263 }); 29264 // 1st quarter, 2nd quarter, ... 29265 case "qqqq": 29266 default: 29267 return localize.quarter(quarter, { 29268 width: "wide", 29269 context: "standalone", 29270 }); 29271 } 29272 }, 29273 29274 // Month 29275 M: function (date, token, localize) { 29276 const month = date.getMonth(); 29277 switch (token) { 29278 case "M": 29279 case "MM": 29280 return lightFormatters.M(date, token); 29281 // 1st, 2nd, ..., 12th 29282 case "Mo": 29283 return localize.ordinalNumber(month + 1, { unit: "month" }); 29284 // Jan, Feb, ..., Dec 29285 case "MMM": 29286 return localize.month(month, { 29287 width: "abbreviated", 29288 context: "formatting", 29289 }); 29290 // J, F, ..., D 29291 case "MMMMM": 29292 return localize.month(month, { 29293 width: "narrow", 29294 context: "formatting", 29295 }); 29296 // January, February, ..., December 29297 case "MMMM": 29298 default: 29299 return localize.month(month, { width: "wide", context: "formatting" }); 29300 } 29301 }, 29302 29303 // Stand-alone month 29304 L: function (date, token, localize) { 29305 const month = date.getMonth(); 29306 switch (token) { 29307 // 1, 2, ..., 12 29308 case "L": 29309 return String(month + 1); 29310 // 01, 02, ..., 12 29311 case "LL": 29312 return addLeadingZeros(month + 1, 2); 29313 // 1st, 2nd, ..., 12th 29314 case "Lo": 29315 return localize.ordinalNumber(month + 1, { unit: "month" }); 29316 // Jan, Feb, ..., Dec 29317 case "LLL": 29318 return localize.month(month, { 29319 width: "abbreviated", 29320 context: "standalone", 29321 }); 29322 // J, F, ..., D 29323 case "LLLLL": 29324 return localize.month(month, { 29325 width: "narrow", 29326 context: "standalone", 29327 }); 29328 // January, February, ..., December 29329 case "LLLL": 29330 default: 29331 return localize.month(month, { width: "wide", context: "standalone" }); 29332 } 29333 }, 29334 29335 // Local week of year 29336 w: function (date, token, localize, options) { 29337 const week = getWeek(date, options); 29338 29339 if (token === "wo") { 29340 return localize.ordinalNumber(week, { unit: "week" }); 29341 } 29342 29343 return addLeadingZeros(week, token.length); 29344 }, 29345 29346 // ISO week of year 29347 I: function (date, token, localize) { 29348 const isoWeek = getISOWeek(date); 29349 29350 if (token === "Io") { 29351 return localize.ordinalNumber(isoWeek, { unit: "week" }); 29352 } 29353 29354 return addLeadingZeros(isoWeek, token.length); 29355 }, 29356 29357 // Day of the month 29358 d: function (date, token, localize) { 29359 if (token === "do") { 29360 return localize.ordinalNumber(date.getDate(), { unit: "date" }); 29361 } 29362 29363 return lightFormatters.d(date, token); 29364 }, 29365 29366 // Day of year 29367 D: function (date, token, localize) { 29368 const dayOfYear = getDayOfYear(date); 29369 29370 if (token === "Do") { 29371 return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); 29372 } 29373 29374 return addLeadingZeros(dayOfYear, token.length); 29375 }, 29376 29377 // Day of week 29378 E: function (date, token, localize) { 29379 const dayOfWeek = date.getDay(); 29380 switch (token) { 29381 // Tue 29382 case "E": 29383 case "EE": 29384 case "EEE": 29385 return localize.day(dayOfWeek, { 29386 width: "abbreviated", 29387 context: "formatting", 29388 }); 29389 // T 29390 case "EEEEE": 29391 return localize.day(dayOfWeek, { 29392 width: "narrow", 29393 context: "formatting", 29394 }); 29395 // Tu 29396 case "EEEEEE": 29397 return localize.day(dayOfWeek, { 29398 width: "short", 29399 context: "formatting", 29400 }); 29401 // Tuesday 29402 case "EEEE": 29403 default: 29404 return localize.day(dayOfWeek, { 29405 width: "wide", 29406 context: "formatting", 29407 }); 29408 } 29409 }, 29410 29411 // Local day of week 29412 e: function (date, token, localize, options) { 29413 const dayOfWeek = date.getDay(); 29414 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 29415 switch (token) { 29416 // Numerical value (Nth day of week with current locale or weekStartsOn) 29417 case "e": 29418 return String(localDayOfWeek); 29419 // Padded numerical value 29420 case "ee": 29421 return addLeadingZeros(localDayOfWeek, 2); 29422 // 1st, 2nd, ..., 7th 29423 case "eo": 29424 return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); 29425 case "eee": 29426 return localize.day(dayOfWeek, { 29427 width: "abbreviated", 29428 context: "formatting", 29429 }); 29430 // T 29431 case "eeeee": 29432 return localize.day(dayOfWeek, { 29433 width: "narrow", 29434 context: "formatting", 29435 }); 29436 // Tu 29437 case "eeeeee": 29438 return localize.day(dayOfWeek, { 29439 width: "short", 29440 context: "formatting", 29441 }); 29442 // Tuesday 29443 case "eeee": 29444 default: 29445 return localize.day(dayOfWeek, { 29446 width: "wide", 29447 context: "formatting", 29448 }); 29449 } 29450 }, 29451 29452 // Stand-alone local day of week 29453 c: function (date, token, localize, options) { 29454 const dayOfWeek = date.getDay(); 29455 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 29456 switch (token) { 29457 // Numerical value (same as in `e`) 29458 case "c": 29459 return String(localDayOfWeek); 29460 // Padded numerical value 29461 case "cc": 29462 return addLeadingZeros(localDayOfWeek, token.length); 29463 // 1st, 2nd, ..., 7th 29464 case "co": 29465 return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); 29466 case "ccc": 29467 return localize.day(dayOfWeek, { 29468 width: "abbreviated", 29469 context: "standalone", 29470 }); 29471 // T 29472 case "ccccc": 29473 return localize.day(dayOfWeek, { 29474 width: "narrow", 29475 context: "standalone", 29476 }); 29477 // Tu 29478 case "cccccc": 29479 return localize.day(dayOfWeek, { 29480 width: "short", 29481 context: "standalone", 29482 }); 29483 // Tuesday 29484 case "cccc": 29485 default: 29486 return localize.day(dayOfWeek, { 29487 width: "wide", 29488 context: "standalone", 29489 }); 29490 } 29491 }, 29492 29493 // ISO day of week 29494 i: function (date, token, localize) { 29495 const dayOfWeek = date.getDay(); 29496 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; 29497 switch (token) { 29498 // 2 29499 case "i": 29500 return String(isoDayOfWeek); 29501 // 02 29502 case "ii": 29503 return addLeadingZeros(isoDayOfWeek, token.length); 29504 // 2nd 29505 case "io": 29506 return localize.ordinalNumber(isoDayOfWeek, { unit: "day" }); 29507 // Tue 29508 case "iii": 29509 return localize.day(dayOfWeek, { 29510 width: "abbreviated", 29511 context: "formatting", 29512 }); 29513 // T 29514 case "iiiii": 29515 return localize.day(dayOfWeek, { 29516 width: "narrow", 29517 context: "formatting", 29518 }); 29519 // Tu 29520 case "iiiiii": 29521 return localize.day(dayOfWeek, { 29522 width: "short", 29523 context: "formatting", 29524 }); 29525 // Tuesday 29526 case "iiii": 29527 default: 29528 return localize.day(dayOfWeek, { 29529 width: "wide", 29530 context: "formatting", 29531 }); 29532 } 29533 }, 29534 29535 // AM or PM 29536 a: function (date, token, localize) { 29537 const hours = date.getHours(); 29538 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 29539 29540 switch (token) { 29541 case "a": 29542 case "aa": 29543 return localize.dayPeriod(dayPeriodEnumValue, { 29544 width: "abbreviated", 29545 context: "formatting", 29546 }); 29547 case "aaa": 29548 return localize 29549 .dayPeriod(dayPeriodEnumValue, { 29550 width: "abbreviated", 29551 context: "formatting", 29552 }) 29553 .toLowerCase(); 29554 case "aaaaa": 29555 return localize.dayPeriod(dayPeriodEnumValue, { 29556 width: "narrow", 29557 context: "formatting", 29558 }); 29559 case "aaaa": 29560 default: 29561 return localize.dayPeriod(dayPeriodEnumValue, { 29562 width: "wide", 29563 context: "formatting", 29564 }); 29565 } 29566 }, 29567 29568 // AM, PM, midnight, noon 29569 b: function (date, token, localize) { 29570 const hours = date.getHours(); 29571 let dayPeriodEnumValue; 29572 if (hours === 12) { 29573 dayPeriodEnumValue = dayPeriodEnum.noon; 29574 } else if (hours === 0) { 29575 dayPeriodEnumValue = dayPeriodEnum.midnight; 29576 } else { 29577 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 29578 } 29579 29580 switch (token) { 29581 case "b": 29582 case "bb": 29583 return localize.dayPeriod(dayPeriodEnumValue, { 29584 width: "abbreviated", 29585 context: "formatting", 29586 }); 29587 case "bbb": 29588 return localize 29589 .dayPeriod(dayPeriodEnumValue, { 29590 width: "abbreviated", 29591 context: "formatting", 29592 }) 29593 .toLowerCase(); 29594 case "bbbbb": 29595 return localize.dayPeriod(dayPeriodEnumValue, { 29596 width: "narrow", 29597 context: "formatting", 29598 }); 29599 case "bbbb": 29600 default: 29601 return localize.dayPeriod(dayPeriodEnumValue, { 29602 width: "wide", 29603 context: "formatting", 29604 }); 29605 } 29606 }, 29607 29608 // in the morning, in the afternoon, in the evening, at night 29609 B: function (date, token, localize) { 29610 const hours = date.getHours(); 29611 let dayPeriodEnumValue; 29612 if (hours >= 17) { 29613 dayPeriodEnumValue = dayPeriodEnum.evening; 29614 } else if (hours >= 12) { 29615 dayPeriodEnumValue = dayPeriodEnum.afternoon; 29616 } else if (hours >= 4) { 29617 dayPeriodEnumValue = dayPeriodEnum.morning; 29618 } else { 29619 dayPeriodEnumValue = dayPeriodEnum.night; 29620 } 29621 29622 switch (token) { 29623 case "B": 29624 case "BB": 29625 case "BBB": 29626 return localize.dayPeriod(dayPeriodEnumValue, { 29627 width: "abbreviated", 29628 context: "formatting", 29629 }); 29630 case "BBBBB": 29631 return localize.dayPeriod(dayPeriodEnumValue, { 29632 width: "narrow", 29633 context: "formatting", 29634 }); 29635 case "BBBB": 29636 default: 29637 return localize.dayPeriod(dayPeriodEnumValue, { 29638 width: "wide", 29639 context: "formatting", 29640 }); 29641 } 29642 }, 29643 29644 // Hour [1-12] 29645 h: function (date, token, localize) { 29646 if (token === "ho") { 29647 let hours = date.getHours() % 12; 29648 if (hours === 0) hours = 12; 29649 return localize.ordinalNumber(hours, { unit: "hour" }); 29650 } 29651 29652 return lightFormatters.h(date, token); 29653 }, 29654 29655 // Hour [0-23] 29656 H: function (date, token, localize) { 29657 if (token === "Ho") { 29658 return localize.ordinalNumber(date.getHours(), { unit: "hour" }); 29659 } 29660 29661 return lightFormatters.H(date, token); 29662 }, 29663 29664 // Hour [0-11] 29665 K: function (date, token, localize) { 29666 const hours = date.getHours() % 12; 29667 29668 if (token === "Ko") { 29669 return localize.ordinalNumber(hours, { unit: "hour" }); 29670 } 29671 29672 return addLeadingZeros(hours, token.length); 29673 }, 29674 29675 // Hour [1-24] 29676 k: function (date, token, localize) { 29677 let hours = date.getHours(); 29678 if (hours === 0) hours = 24; 29679 29680 if (token === "ko") { 29681 return localize.ordinalNumber(hours, { unit: "hour" }); 29682 } 29683 29684 return addLeadingZeros(hours, token.length); 29685 }, 29686 29687 // Minute 29688 m: function (date, token, localize) { 29689 if (token === "mo") { 29690 return localize.ordinalNumber(date.getMinutes(), { unit: "minute" }); 29691 } 29692 29693 return lightFormatters.m(date, token); 29694 }, 29695 29696 // Second 29697 s: function (date, token, localize) { 29698 if (token === "so") { 29699 return localize.ordinalNumber(date.getSeconds(), { unit: "second" }); 29700 } 29701 29702 return lightFormatters.s(date, token); 29703 }, 29704 29705 // Fraction of second 29706 S: function (date, token) { 29707 return lightFormatters.S(date, token); 29708 }, 29709 29710 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) 29711 X: function (date, token, _localize) { 29712 const timezoneOffset = date.getTimezoneOffset(); 29713 29714 if (timezoneOffset === 0) { 29715 return "Z"; 29716 } 29717 29718 switch (token) { 29719 // Hours and optional minutes 29720 case "X": 29721 return formatTimezoneWithOptionalMinutes(timezoneOffset); 29722 29723 // Hours, minutes and optional seconds without `:` delimiter 29724 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 29725 // so this token always has the same output as `XX` 29726 case "XXXX": 29727 case "XX": // Hours and minutes without `:` delimiter 29728 return formatTimezone(timezoneOffset); 29729 29730 // Hours, minutes and optional seconds with `:` delimiter 29731 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 29732 // so this token always has the same output as `XXX` 29733 case "XXXXX": 29734 case "XXX": // Hours and minutes with `:` delimiter 29735 default: 29736 return formatTimezone(timezoneOffset, ":"); 29737 } 29738 }, 29739 29740 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) 29741 x: function (date, token, _localize) { 29742 const timezoneOffset = date.getTimezoneOffset(); 29743 29744 switch (token) { 29745 // Hours and optional minutes 29746 case "x": 29747 return formatTimezoneWithOptionalMinutes(timezoneOffset); 29748 29749 // Hours, minutes and optional seconds without `:` delimiter 29750 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 29751 // so this token always has the same output as `xx` 29752 case "xxxx": 29753 case "xx": // Hours and minutes without `:` delimiter 29754 return formatTimezone(timezoneOffset); 29755 29756 // Hours, minutes and optional seconds with `:` delimiter 29757 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 29758 // so this token always has the same output as `xxx` 29759 case "xxxxx": 29760 case "xxx": // Hours and minutes with `:` delimiter 29761 default: 29762 return formatTimezone(timezoneOffset, ":"); 29763 } 29764 }, 29765 29766 // Timezone (GMT) 29767 O: function (date, token, _localize) { 29768 const timezoneOffset = date.getTimezoneOffset(); 29769 29770 switch (token) { 29771 // Short 29772 case "O": 29773 case "OO": 29774 case "OOO": 29775 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 29776 // Long 29777 case "OOOO": 29778 default: 29779 return "GMT" + formatTimezone(timezoneOffset, ":"); 29780 } 29781 }, 29782 29783 // Timezone (specific non-location) 29784 z: function (date, token, _localize) { 29785 const timezoneOffset = date.getTimezoneOffset(); 29786 29787 switch (token) { 29788 // Short 29789 case "z": 29790 case "zz": 29791 case "zzz": 29792 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 29793 // Long 29794 case "zzzz": 29795 default: 29796 return "GMT" + formatTimezone(timezoneOffset, ":"); 29797 } 29798 }, 29799 29800 // Seconds timestamp 29801 t: function (date, token, _localize) { 29802 const timestamp = Math.trunc(+date / 1000); 29803 return addLeadingZeros(timestamp, token.length); 29804 }, 29805 29806 // Milliseconds timestamp 29807 T: function (date, token, _localize) { 29808 return addLeadingZeros(+date, token.length); 29809 }, 29810 }; 29811 29812 function formatTimezoneShort(offset, delimiter = "") { 29813 const sign = offset > 0 ? "-" : "+"; 29814 const absOffset = Math.abs(offset); 29815 const hours = Math.trunc(absOffset / 60); 29816 const minutes = absOffset % 60; 29817 if (minutes === 0) { 29818 return sign + String(hours); 29819 } 29820 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); 29821 } 29822 29823 function formatTimezoneWithOptionalMinutes(offset, delimiter) { 29824 if (offset % 60 === 0) { 29825 const sign = offset > 0 ? "-" : "+"; 29826 return sign + addLeadingZeros(Math.abs(offset) / 60, 2); 29827 } 29828 return formatTimezone(offset, delimiter); 29829 } 29830 29831 function formatTimezone(offset, delimiter = "") { 29832 const sign = offset > 0 ? "-" : "+"; 29833 const absOffset = Math.abs(offset); 29834 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); 29835 const minutes = addLeadingZeros(absOffset % 60, 2); 29836 return sign + hours + delimiter + minutes; 29837 } 29838 29839 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/longFormatters.js 29840 const dateLongFormatter = (pattern, formatLong) => { 29841 switch (pattern) { 29842 case "P": 29843 return formatLong.date({ width: "short" }); 29844 case "PP": 29845 return formatLong.date({ width: "medium" }); 29846 case "PPP": 29847 return formatLong.date({ width: "long" }); 29848 case "PPPP": 29849 default: 29850 return formatLong.date({ width: "full" }); 29851 } 29852 }; 29853 29854 const timeLongFormatter = (pattern, formatLong) => { 29855 switch (pattern) { 29856 case "p": 29857 return formatLong.time({ width: "short" }); 29858 case "pp": 29859 return formatLong.time({ width: "medium" }); 29860 case "ppp": 29861 return formatLong.time({ width: "long" }); 29862 case "pppp": 29863 default: 29864 return formatLong.time({ width: "full" }); 29865 } 29866 }; 29867 29868 const dateTimeLongFormatter = (pattern, formatLong) => { 29869 const matchResult = pattern.match(/(P+)(p+)?/) || []; 29870 const datePattern = matchResult[1]; 29871 const timePattern = matchResult[2]; 29872 29873 if (!timePattern) { 29874 return dateLongFormatter(pattern, formatLong); 29875 } 29876 29877 let dateTimeFormat; 29878 29879 switch (datePattern) { 29880 case "P": 29881 dateTimeFormat = formatLong.dateTime({ width: "short" }); 29882 break; 29883 case "PP": 29884 dateTimeFormat = formatLong.dateTime({ width: "medium" }); 29885 break; 29886 case "PPP": 29887 dateTimeFormat = formatLong.dateTime({ width: "long" }); 29888 break; 29889 case "PPPP": 29890 default: 29891 dateTimeFormat = formatLong.dateTime({ width: "full" }); 29892 break; 29893 } 29894 29895 return dateTimeFormat 29896 .replace("{{date}}", dateLongFormatter(datePattern, formatLong)) 29897 .replace("{{time}}", timeLongFormatter(timePattern, formatLong)); 29898 }; 29899 29900 const longFormatters = { 29901 p: timeLongFormatter, 29902 P: dateTimeLongFormatter, 29903 }; 29904 29905 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/protectedTokens.js 29906 const dayOfYearTokenRE = /^D+$/; 29907 const weekYearTokenRE = /^Y+$/; 29908 29909 const throwTokens = ["D", "DD", "YY", "YYYY"]; 29910 29911 function isProtectedDayOfYearToken(token) { 29912 return dayOfYearTokenRE.test(token); 29913 } 29914 29915 function isProtectedWeekYearToken(token) { 29916 return weekYearTokenRE.test(token); 29917 } 29918 29919 function warnOrThrowProtectedError(token, format, input) { 29920 const _message = message(token, format, input); 29921 console.warn(_message); 29922 if (throwTokens.includes(token)) throw new RangeError(_message); 29923 } 29924 29925 function message(token, format, input) { 29926 const subject = token[0] === "Y" ? "years" : "days of the month"; 29927 return `Use \`$token.toLowerCase()}\` instead of \`$token}\` (in \`$format}\`) for formatting $subject} to the input \`$input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; 29928 } 29929 29930 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/format.js 29931 29932 29933 29934 29935 29936 29937 29938 29939 // Rexports of internal for libraries to use. 29940 // See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874 29941 29942 29943 // This RegExp consists of three parts separated by `|`: 29944 // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token 29945 // (one of the certain letters followed by `o`) 29946 // - (\w)\1* matches any sequences of the same letter 29947 // - '' matches two quote characters in a row 29948 // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), 29949 // except a single quote symbol, which ends the sequence. 29950 // Two quote characters do not end the sequence. 29951 // If there is no matching single quote 29952 // then the sequence will continue until the end of the string. 29953 // - . matches any single character unmatched by previous parts of the RegExps 29954 const formattingTokensRegExp = 29955 /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; 29956 29957 // This RegExp catches symbols escaped by quotes, and also 29958 // sequences of symbols P, p, and the combinations like `PPPPPPPppppp` 29959 const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; 29960 29961 const escapedStringRegExp = /^'([^]*?)'?$/; 29962 const doubleQuoteRegExp = /''/g; 29963 const unescapedLatinCharacterRegExp = /[a-zA-Z]/; 29964 29965 29966 29967 /** 29968 * The {@link format} function options. 29969 */ 29970 29971 /** 29972 * @name format 29973 * @alias formatDate 29974 * @category Common Helpers 29975 * @summary Format the date. 29976 * 29977 * @description 29978 * Return the formatted date string in the given format. The result may vary by locale. 29979 * 29980 * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries. 29981 * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md 29982 * 29983 * The characters wrapped between two single quotes characters (') are escaped. 29984 * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. 29985 * (see the last example) 29986 * 29987 * Format of the string is based on Unicode Technical Standard #35: 29988 * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table 29989 * with a few additions (see note 7 below the table). 29990 * 29991 * Accepted patterns: 29992 * | Unit | Pattern | Result examples | Notes | 29993 * |---------------------------------|---------|-----------------------------------|-------| 29994 * | Era | G..GGG | AD, BC | | 29995 * | | GGGG | Anno Domini, Before Christ | 2 | 29996 * | | GGGGG | A, B | | 29997 * | Calendar year | y | 44, 1, 1900, 2017 | 5 | 29998 * | | yo | 44th, 1st, 0th, 17th | 5,7 | 29999 * | | yy | 44, 01, 00, 17 | 5 | 30000 * | | yyy | 044, 001, 1900, 2017 | 5 | 30001 * | | yyyy | 0044, 0001, 1900, 2017 | 5 | 30002 * | | yyyyy | ... | 3,5 | 30003 * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 | 30004 * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 | 30005 * | | YY | 44, 01, 00, 17 | 5,8 | 30006 * | | YYY | 044, 001, 1900, 2017 | 5 | 30007 * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 | 30008 * | | YYYYY | ... | 3,5 | 30009 * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 | 30010 * | | RR | -43, 00, 01, 1900, 2017 | 5,7 | 30011 * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 | 30012 * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 | 30013 * | | RRRRR | ... | 3,5,7 | 30014 * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 | 30015 * | | uu | -43, 01, 1900, 2017 | 5 | 30016 * | | uuu | -043, 001, 1900, 2017 | 5 | 30017 * | | uuuu | -0043, 0001, 1900, 2017 | 5 | 30018 * | | uuuuu | ... | 3,5 | 30019 * | Quarter (formatting) | Q | 1, 2, 3, 4 | | 30020 * | | Qo | 1st, 2nd, 3rd, 4th | 7 | 30021 * | | QQ | 01, 02, 03, 04 | | 30022 * | | QQQ | Q1, Q2, Q3, Q4 | | 30023 * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 | 30024 * | | QQQQQ | 1, 2, 3, 4 | 4 | 30025 * | Quarter (stand-alone) | q | 1, 2, 3, 4 | | 30026 * | | qo | 1st, 2nd, 3rd, 4th | 7 | 30027 * | | qq | 01, 02, 03, 04 | | 30028 * | | qqq | Q1, Q2, Q3, Q4 | | 30029 * | | qqqq | 1st quarter, 2nd quarter, ... | 2 | 30030 * | | qqqqq | 1, 2, 3, 4 | 4 | 30031 * | Month (formatting) | M | 1, 2, ..., 12 | | 30032 * | | Mo | 1st, 2nd, ..., 12th | 7 | 30033 * | | MM | 01, 02, ..., 12 | | 30034 * | | MMM | Jan, Feb, ..., Dec | | 30035 * | | MMMM | January, February, ..., December | 2 | 30036 * | | MMMMM | J, F, ..., D | | 30037 * | Month (stand-alone) | L | 1, 2, ..., 12 | | 30038 * | | Lo | 1st, 2nd, ..., 12th | 7 | 30039 * | | LL | 01, 02, ..., 12 | | 30040 * | | LLL | Jan, Feb, ..., Dec | | 30041 * | | LLLL | January, February, ..., December | 2 | 30042 * | | LLLLL | J, F, ..., D | | 30043 * | Local week of year | w | 1, 2, ..., 53 | | 30044 * | | wo | 1st, 2nd, ..., 53th | 7 | 30045 * | | ww | 01, 02, ..., 53 | | 30046 * | ISO week of year | I | 1, 2, ..., 53 | 7 | 30047 * | | Io | 1st, 2nd, ..., 53th | 7 | 30048 * | | II | 01, 02, ..., 53 | 7 | 30049 * | Day of month | d | 1, 2, ..., 31 | | 30050 * | | do | 1st, 2nd, ..., 31st | 7 | 30051 * | | dd | 01, 02, ..., 31 | | 30052 * | Day of year | D | 1, 2, ..., 365, 366 | 9 | 30053 * | | Do | 1st, 2nd, ..., 365th, 366th | 7 | 30054 * | | DD | 01, 02, ..., 365, 366 | 9 | 30055 * | | DDD | 001, 002, ..., 365, 366 | | 30056 * | | DDDD | ... | 3 | 30057 * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | | 30058 * | | EEEE | Monday, Tuesday, ..., Sunday | 2 | 30059 * | | EEEEE | M, T, W, T, F, S, S | | 30060 * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | | 30061 * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 | 30062 * | | io | 1st, 2nd, ..., 7th | 7 | 30063 * | | ii | 01, 02, ..., 07 | 7 | 30064 * | | iii | Mon, Tue, Wed, ..., Sun | 7 | 30065 * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 | 30066 * | | iiiii | M, T, W, T, F, S, S | 7 | 30067 * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 | 30068 * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | | 30069 * | | eo | 2nd, 3rd, ..., 1st | 7 | 30070 * | | ee | 02, 03, ..., 01 | | 30071 * | | eee | Mon, Tue, Wed, ..., Sun | | 30072 * | | eeee | Monday, Tuesday, ..., Sunday | 2 | 30073 * | | eeeee | M, T, W, T, F, S, S | | 30074 * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | | 30075 * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | | 30076 * | | co | 2nd, 3rd, ..., 1st | 7 | 30077 * | | cc | 02, 03, ..., 01 | | 30078 * | | ccc | Mon, Tue, Wed, ..., Sun | | 30079 * | | cccc | Monday, Tuesday, ..., Sunday | 2 | 30080 * | | ccccc | M, T, W, T, F, S, S | | 30081 * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | | 30082 * | AM, PM | a..aa | AM, PM | | 30083 * | | aaa | am, pm | | 30084 * | | aaaa | a.m., p.m. | 2 | 30085 * | | aaaaa | a, p | | 30086 * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | | 30087 * | | bbb | am, pm, noon, midnight | | 30088 * | | bbbb | a.m., p.m., noon, midnight | 2 | 30089 * | | bbbbb | a, p, n, mi | | 30090 * | Flexible day period | B..BBB | at night, in the morning, ... | | 30091 * | | BBBB | at night, in the morning, ... | 2 | 30092 * | | BBBBB | at night, in the morning, ... | | 30093 * | Hour [1-12] | h | 1, 2, ..., 11, 12 | | 30094 * | | ho | 1st, 2nd, ..., 11th, 12th | 7 | 30095 * | | hh | 01, 02, ..., 11, 12 | | 30096 * | Hour [0-23] | H | 0, 1, 2, ..., 23 | | 30097 * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 | 30098 * | | HH | 00, 01, 02, ..., 23 | | 30099 * | Hour [0-11] | K | 1, 2, ..., 11, 0 | | 30100 * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 | 30101 * | | KK | 01, 02, ..., 11, 00 | | 30102 * | Hour [1-24] | k | 24, 1, 2, ..., 23 | | 30103 * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 | 30104 * | | kk | 24, 01, 02, ..., 23 | | 30105 * | Minute | m | 0, 1, ..., 59 | | 30106 * | | mo | 0th, 1st, ..., 59th | 7 | 30107 * | | mm | 00, 01, ..., 59 | | 30108 * | Second | s | 0, 1, ..., 59 | | 30109 * | | so | 0th, 1st, ..., 59th | 7 | 30110 * | | ss | 00, 01, ..., 59 | | 30111 * | Fraction of second | S | 0, 1, ..., 9 | | 30112 * | | SS | 00, 01, ..., 99 | | 30113 * | | SSS | 000, 001, ..., 999 | | 30114 * | | SSSS | ... | 3 | 30115 * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | | 30116 * | | XX | -0800, +0530, Z | | 30117 * | | XXX | -08:00, +05:30, Z | | 30118 * | | XXXX | -0800, +0530, Z, +123456 | 2 | 30119 * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | | 30120 * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | | 30121 * | | xx | -0800, +0530, +0000 | | 30122 * | | xxx | -08:00, +05:30, +00:00 | 2 | 30123 * | | xxxx | -0800, +0530, +0000, +123456 | | 30124 * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | | 30125 * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | | 30126 * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 | 30127 * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 | 30128 * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 | 30129 * | Seconds timestamp | t | 512969520 | 7 | 30130 * | | tt | ... | 3,7 | 30131 * | Milliseconds timestamp | T | 512969520900 | 7 | 30132 * | | TT | ... | 3,7 | 30133 * | Long localized date | P | 04/29/1453 | 7 | 30134 * | | PP | Apr 29, 1453 | 7 | 30135 * | | PPP | April 29th, 1453 | 7 | 30136 * | | PPPP | Friday, April 29th, 1453 | 2,7 | 30137 * | Long localized time | p | 12:00 AM | 7 | 30138 * | | pp | 12:00:00 AM | 7 | 30139 * | | ppp | 12:00:00 AM GMT+2 | 7 | 30140 * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 | 30141 * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 | 30142 * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 | 30143 * | | PPPppp | April 29th, 1453 at ... | 7 | 30144 * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 | 30145 * Notes: 30146 * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale 30147 * are the same as "stand-alone" units, but are different in some languages. 30148 * "Formatting" units are declined according to the rules of the language 30149 * in the context of a date. "Stand-alone" units are always nominative singular: 30150 * 30151 * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'` 30152 * 30153 * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'` 30154 * 30155 * 2. Any sequence of the identical letters is a pattern, unless it is escaped by 30156 * the single quote characters (see below). 30157 * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`) 30158 * the output will be the same as default pattern for this unit, usually 30159 * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units 30160 * are marked with "2" in the last column of the table. 30161 * 30162 * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'` 30163 * 30164 * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'` 30165 * 30166 * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'` 30167 * 30168 * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'` 30169 * 30170 * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'` 30171 * 30172 * 3. Some patterns could be unlimited length (such as `yyyyyyyy`). 30173 * The output will be padded with zeros to match the length of the pattern. 30174 * 30175 * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'` 30176 * 30177 * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales. 30178 * These tokens represent the shortest form of the quarter. 30179 * 30180 * 5. The main difference between `y` and `u` patterns are B.C. years: 30181 * 30182 * | Year | `y` | `u` | 30183 * |------|-----|-----| 30184 * | AC 1 | 1 | 1 | 30185 * | BC 1 | 1 | 0 | 30186 * | BC 2 | 2 | -1 | 30187 * 30188 * Also `yy` always returns the last two digits of a year, 30189 * while `uu` pads single digit years to 2 characters and returns other years unchanged: 30190 * 30191 * | Year | `yy` | `uu` | 30192 * |------|------|------| 30193 * | 1 | 01 | 01 | 30194 * | 14 | 14 | 14 | 30195 * | 376 | 76 | 376 | 30196 * | 1453 | 53 | 1453 | 30197 * 30198 * The same difference is true for local and ISO week-numbering years (`Y` and `R`), 30199 * except local week-numbering years are dependent on `options.weekStartsOn` 30200 * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear) 30201 * and [getWeekYear](https://date-fns.org/docs/getWeekYear)). 30202 * 30203 * 6. Specific non-location timezones are currently unavailable in `date-fns`, 30204 * so right now these tokens fall back to GMT timezones. 30205 * 30206 * 7. These patterns are not in the Unicode Technical Standard #35: 30207 * - `i`: ISO day of week 30208 * - `I`: ISO week of year 30209 * - `R`: ISO week-numbering year 30210 * - `t`: seconds timestamp 30211 * - `T`: milliseconds timestamp 30212 * - `o`: ordinal number modifier 30213 * - `P`: long localized date 30214 * - `p`: long localized time 30215 * 30216 * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years. 30217 * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md 30218 * 30219 * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month. 30220 * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md 30221 * 30222 * @param date - The original date 30223 * @param format - The string of tokens 30224 * @param options - An object with options 30225 * 30226 * @returns The formatted date string 30227 * 30228 * @throws `date` must not be Invalid Date 30229 * @throws `options.locale` must contain `localize` property 30230 * @throws `options.locale` must contain `formatLong` property 30231 * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md 30232 * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md 30233 * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md 30234 * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md 30235 * @throws format string contains an unescaped latin alphabet character 30236 * 30237 * @example 30238 * // Represent 11 February 2014 in middle-endian format: 30239 * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy') 30240 * //=> '02/11/2014' 30241 * 30242 * @example 30243 * // Represent 2 July 2014 in Esperanto: 30244 * import { eoLocale } from 'date-fns/locale/eo' 30245 * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", { 30246 * locale: eoLocale 30247 * }) 30248 * //=> '2-a de julio 2014' 30249 * 30250 * @example 30251 * // Escape string by single quote characters: 30252 * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'") 30253 * //=> "3 o'clock" 30254 */ 30255 function format(date, formatStr, options) { 30256 const defaultOptions = getDefaultOptions(); 30257 const locale = options?.locale ?? defaultOptions.locale ?? enUS; 30258 30259 const firstWeekContainsDate = 30260 options?.firstWeekContainsDate ?? 30261 options?.locale?.options?.firstWeekContainsDate ?? 30262 defaultOptions.firstWeekContainsDate ?? 30263 defaultOptions.locale?.options?.firstWeekContainsDate ?? 30264 1; 30265 30266 const weekStartsOn = 30267 options?.weekStartsOn ?? 30268 options?.locale?.options?.weekStartsOn ?? 30269 defaultOptions.weekStartsOn ?? 30270 defaultOptions.locale?.options?.weekStartsOn ?? 30271 0; 30272 30273 const originalDate = toDate(date, options?.in); 30274 30275 if (!isValid(originalDate)) { 30276 throw new RangeError("Invalid time value"); 30277 } 30278 30279 let parts = formatStr 30280 .match(longFormattingTokensRegExp) 30281 .map((substring) => { 30282 const firstCharacter = substring[0]; 30283 if (firstCharacter === "p" || firstCharacter === "P") { 30284 const longFormatter = longFormatters[firstCharacter]; 30285 return longFormatter(substring, locale.formatLong); 30286 } 30287 return substring; 30288 }) 30289 .join("") 30290 .match(formattingTokensRegExp) 30291 .map((substring) => { 30292 // Replace two single quote characters with one single quote character 30293 if (substring === "''") { 30294 return { isToken: false, value: "'" }; 30295 } 30296 30297 const firstCharacter = substring[0]; 30298 if (firstCharacter === "'") { 30299 return { isToken: false, value: cleanEscapedString(substring) }; 30300 } 30301 30302 if (formatters[firstCharacter]) { 30303 return { isToken: true, value: substring }; 30304 } 30305 30306 if (firstCharacter.match(unescapedLatinCharacterRegExp)) { 30307 throw new RangeError( 30308 "Format string contains an unescaped latin alphabet character `" + 30309 firstCharacter + 30310 "`", 30311 ); 30312 } 30313 30314 return { isToken: false, value: substring }; 30315 }); 30316 30317 // invoke localize preprocessor (only for french locales at the moment) 30318 if (locale.localize.preprocessor) { 30319 parts = locale.localize.preprocessor(originalDate, parts); 30320 } 30321 30322 const formatterOptions = { 30323 firstWeekContainsDate, 30324 weekStartsOn, 30325 locale, 30326 }; 30327 30328 return parts 30329 .map((part) => { 30330 if (!part.isToken) return part.value; 30331 30332 const token = part.value; 30333 30334 if ( 30335 (!options?.useAdditionalWeekYearTokens && 30336 isProtectedWeekYearToken(token)) || 30337 (!options?.useAdditionalDayOfYearTokens && 30338 isProtectedDayOfYearToken(token)) 30339 ) { 30340 warnOrThrowProtectedError(token, formatStr, String(date)); 30341 } 30342 30343 const formatter = formatters[token[0]]; 30344 return formatter(originalDate, token, locale.localize, formatterOptions); 30345 }) 30346 .join(""); 30347 } 30348 30349 function cleanEscapedString(input) { 30350 const matched = input.match(escapedStringRegExp); 30351 30352 if (!matched) { 30353 return input; 30354 } 30355 30356 return matched[1].replace(doubleQuoteRegExp, "'"); 30357 } 30358 30359 // Fallback for modularized imports: 30360 /* harmony default export */ const date_fns_format = ((/* unused pure expression or super */ null && (format))); 30361 30362 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/relative-date-control.js 30363 30364 30365 30366 30367 30368 30369 const TIME_UNITS_OPTIONS = { 30370 [OPERATOR_IN_THE_PAST]: [ 30371 { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days") }, 30372 { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks") }, 30373 { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months") }, 30374 { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years") } 30375 ], 30376 [OPERATOR_OVER]: [ 30377 { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days ago") }, 30378 { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks ago") }, 30379 { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months ago") }, 30380 { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years ago") } 30381 ] 30382 }; 30383 function RelativeDateControl({ 30384 className, 30385 data, 30386 field, 30387 onChange, 30388 hideLabelFromVision, 30389 operator 30390 }) { 30391 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"]; 30392 const { id, label, getValue, setValue } = field; 30393 const fieldValue = getValue({ item: data }); 30394 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {}; 30395 const onChangeValue = (0,external_wp_element_.useCallback)( 30396 (newValue) => onChange( 30397 setValue({ 30398 item: data, 30399 value: { value: Number(newValue), unit } 30400 }) 30401 ), 30402 [onChange, setValue, data, unit] 30403 ); 30404 const onChangeUnit = (0,external_wp_element_.useCallback)( 30405 (newUnit) => onChange( 30406 setValue({ 30407 item: data, 30408 value: { value: relValue, unit: newUnit } 30409 }) 30410 ), 30411 [onChange, setValue, data, relValue] 30412 ); 30413 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30414 external_wp_components_namespaceObject.BaseControl, 30415 { 30416 id, 30417 __nextHasNoMarginBottom: true, 30418 className: dist_clsx(className, "dataviews-controls__relative-date"), 30419 label, 30420 hideLabelFromVision, 30421 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2.5, children: [ 30422 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30423 external_wp_components_namespaceObject.__experimentalNumberControl, 30424 { 30425 __next40pxDefaultSize: true, 30426 className: "dataviews-controls__relative-date-number", 30427 spinControls: "none", 30428 min: 1, 30429 step: 1, 30430 value: relValue, 30431 onChange: onChangeValue 30432 } 30433 ), 30434 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30435 external_wp_components_namespaceObject.SelectControl, 30436 { 30437 className: "dataviews-controls__relative-date-unit", 30438 __next40pxDefaultSize: true, 30439 __nextHasNoMarginBottom: true, 30440 label: (0,external_wp_i18n_namespaceObject.__)("Unit"), 30441 value: unit, 30442 options, 30443 onChange: onChangeUnit, 30444 hideLabelFromVision: true 30445 } 30446 ) 30447 ] }) 30448 } 30449 ); 30450 } 30451 30452 30453 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js 30454 30455 30456 30457 30458 30459 30460 30461 30462 30463 30464 const { DateCalendar, ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 30465 const parseDateTime = (dateTimeString) => { 30466 if (!dateTimeString) { 30467 return null; 30468 } 30469 const parsed = (0,external_wp_date_namespaceObject.getDate)(dateTimeString); 30470 return parsed && isValid(parsed) ? parsed : null; 30471 }; 30472 const formatDateTime = (date) => { 30473 if (!date) { 30474 return ""; 30475 } 30476 if (typeof date === "string") { 30477 return date; 30478 } 30479 return format(date, "yyyy-MM-dd'T'HH:mm"); 30480 }; 30481 function CalendarDateTimeControl({ 30482 data, 30483 field, 30484 onChange, 30485 hideLabelFromVision, 30486 validity 30487 }) { 30488 const { id, label, description, setValue, getValue, isValid } = field; 30489 const fieldValue = getValue({ item: data }); 30490 const value = typeof fieldValue === "string" ? fieldValue : void 0; 30491 const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => { 30492 const parsedDate = parseDateTime(value); 30493 return parsedDate || /* @__PURE__ */ new Date(); 30494 }); 30495 const inputControlRef = (0,external_wp_element_.useRef)(null); 30496 const validationTimeoutRef = (0,external_wp_element_.useRef)(); 30497 const previousFocusRef = (0,external_wp_element_.useRef)(null); 30498 const onChangeCallback = (0,external_wp_element_.useCallback)( 30499 (newValue) => onChange(setValue({ item: data, value: newValue })), 30500 [data, onChange, setValue] 30501 ); 30502 (0,external_wp_element_.useEffect)(() => { 30503 return () => { 30504 if (validationTimeoutRef.current) { 30505 clearTimeout(validationTimeoutRef.current); 30506 } 30507 }; 30508 }, []); 30509 const onSelectDate = (0,external_wp_element_.useCallback)( 30510 (newDate) => { 30511 let dateTimeValue; 30512 if (newDate) { 30513 let finalDateTime = newDate; 30514 if (value) { 30515 const currentDateTime = parseDateTime(value); 30516 if (currentDateTime) { 30517 finalDateTime = new Date(newDate); 30518 finalDateTime.setHours(currentDateTime.getHours()); 30519 finalDateTime.setMinutes( 30520 currentDateTime.getMinutes() 30521 ); 30522 } 30523 } 30524 dateTimeValue = finalDateTime.toISOString(); 30525 onChangeCallback(dateTimeValue); 30526 if (validationTimeoutRef.current) { 30527 clearTimeout(validationTimeoutRef.current); 30528 } 30529 } else { 30530 onChangeCallback(void 0); 30531 } 30532 previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement; 30533 validationTimeoutRef.current = setTimeout(() => { 30534 if (inputControlRef.current) { 30535 inputControlRef.current.focus(); 30536 inputControlRef.current.blur(); 30537 onChangeCallback(dateTimeValue); 30538 if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) { 30539 previousFocusRef.current.focus(); 30540 } 30541 } 30542 }, 0); 30543 }, 30544 [onChangeCallback, value] 30545 ); 30546 const handleManualDateTimeChange = (0,external_wp_element_.useCallback)( 30547 (newValue) => { 30548 if (newValue) { 30549 const dateTime = new Date(newValue); 30550 onChangeCallback(dateTime.toISOString()); 30551 const parsedDate = parseDateTime(dateTime.toISOString()); 30552 if (parsedDate) { 30553 setCalendarMonth(parsedDate); 30554 } 30555 } else { 30556 onChangeCallback(void 0); 30557 } 30558 }, 30559 [onChangeCallback] 30560 ); 30561 const { 30562 timezone: { string: timezoneString }, 30563 l10n: { startOfWeek } 30564 } = (0,external_wp_date_namespaceObject.getSettings)(); 30565 const displayLabel = isValid?.required && !hideLabelFromVision ? `$label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label; 30566 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30567 external_wp_components_namespaceObject.BaseControl, 30568 { 30569 __nextHasNoMarginBottom: true, 30570 id, 30571 label: displayLabel, 30572 help: description, 30573 hideLabelFromVision, 30574 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 30575 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30576 DateCalendar, 30577 { 30578 style: { width: "100%" }, 30579 selected: value ? parseDateTime(value) || void 0 : void 0, 30580 onSelect: onSelectDate, 30581 month: calendarMonth, 30582 onMonthChange: setCalendarMonth, 30583 timeZone: timezoneString || void 0, 30584 weekStartsOn: startOfWeek 30585 } 30586 ), 30587 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30588 ValidatedInputControl, 30589 { 30590 ref: inputControlRef, 30591 __next40pxDefaultSize: true, 30592 required: !!isValid?.required, 30593 customValidity: getCustomValidity(isValid, validity), 30594 type: "datetime-local", 30595 label: (0,external_wp_i18n_namespaceObject.__)("Date time"), 30596 hideLabelFromVision: true, 30597 value: value ? formatDateTime( 30598 parseDateTime(value) || void 0 30599 ) : "", 30600 onChange: handleManualDateTimeChange 30601 } 30602 ) 30603 ] }) 30604 } 30605 ); 30606 } 30607 function DateTime({ 30608 data, 30609 field, 30610 onChange, 30611 hideLabelFromVision, 30612 operator, 30613 validity 30614 }) { 30615 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 30616 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30617 RelativeDateControl, 30618 { 30619 className: "dataviews-controls__datetime", 30620 data, 30621 field, 30622 onChange, 30623 hideLabelFromVision, 30624 operator 30625 } 30626 ); 30627 } 30628 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30629 CalendarDateTimeControl, 30630 { 30631 data, 30632 field, 30633 onChange, 30634 hideLabelFromVision, 30635 validity 30636 } 30637 ); 30638 } 30639 30640 30641 ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfMonth.js 30642 30643 30644 /** 30645 * The {@link startOfMonth} function options. 30646 */ 30647 30648 /** 30649 * @name startOfMonth 30650 * @category Month Helpers 30651 * @summary Return the start of a month for the given date. 30652 * 30653 * @description 30654 * Return the start of a month for the given date. The result will be in the local timezone. 30655 * 30656 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. 30657 * Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 30658 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, 30659 * or inferred from the arguments. 30660 * 30661 * @param date - The original date 30662 * @param options - An object with options 30663 * 30664 * @returns The start of a month 30665 * 30666 * @example 30667 * // The start of a month for 2 September 2014 11:55:00: 30668 * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) 30669 * //=> Mon Sep 01 2014 00:00:00 30670 */ 30671 function startOfMonth(date, options) { 30672 const _date = toDate(date, options?.in); 30673 _date.setDate(1); 30674 _date.setHours(0, 0, 0, 0); 30675 return _date; 30676 } 30677 30678 // Fallback for modularized imports: 30679 /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); 30680 30681 ;// ./node_modules/@wordpress/icons/build-module/library/error.js 30682 30683 30684 var error_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30685 external_wp_primitives_namespaceObject.Path, 30686 { 30687 fillRule: "evenodd", 30688 clipRule: "evenodd", 30689 d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" 30690 } 30691 ) }); 30692 30693 30694 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/date.js 30695 30696 30697 30698 30699 30700 30701 30702 30703 30704 30705 30706 30707 const { DateCalendar: date_DateCalendar, DateRangeCalendar } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 30708 const DATE_PRESETS = [ 30709 { 30710 id: "today", 30711 label: (0,external_wp_i18n_namespaceObject.__)("Today"), 30712 getValue: () => (0,external_wp_date_namespaceObject.getDate)(null) 30713 }, 30714 { 30715 id: "yesterday", 30716 label: (0,external_wp_i18n_namespaceObject.__)("Yesterday"), 30717 getValue: () => { 30718 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30719 return subDays(today, 1); 30720 } 30721 }, 30722 { 30723 id: "past-week", 30724 label: (0,external_wp_i18n_namespaceObject.__)("Past week"), 30725 getValue: () => { 30726 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30727 return subDays(today, 7); 30728 } 30729 }, 30730 { 30731 id: "past-month", 30732 label: (0,external_wp_i18n_namespaceObject.__)("Past month"), 30733 getValue: () => { 30734 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30735 return subMonths(today, 1); 30736 } 30737 } 30738 ]; 30739 const DATE_RANGE_PRESETS = [ 30740 { 30741 id: "last-7-days", 30742 label: (0,external_wp_i18n_namespaceObject.__)("Last 7 days"), 30743 getValue: () => { 30744 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30745 return [subDays(today, 7), today]; 30746 } 30747 }, 30748 { 30749 id: "last-30-days", 30750 label: (0,external_wp_i18n_namespaceObject.__)("Last 30 days"), 30751 getValue: () => { 30752 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30753 return [subDays(today, 30), today]; 30754 } 30755 }, 30756 { 30757 id: "month-to-date", 30758 label: (0,external_wp_i18n_namespaceObject.__)("Month to date"), 30759 getValue: () => { 30760 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30761 return [startOfMonth(today), today]; 30762 } 30763 }, 30764 { 30765 id: "last-year", 30766 label: (0,external_wp_i18n_namespaceObject.__)("Last year"), 30767 getValue: () => { 30768 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30769 return [subYears(today, 1), today]; 30770 } 30771 }, 30772 { 30773 id: "year-to-date", 30774 label: (0,external_wp_i18n_namespaceObject.__)("Year to date"), 30775 getValue: () => { 30776 const today = (0,external_wp_date_namespaceObject.getDate)(null); 30777 return [startOfYear(today), today]; 30778 } 30779 } 30780 ]; 30781 const parseDate = (dateString) => { 30782 if (!dateString) { 30783 return null; 30784 } 30785 const parsed = (0,external_wp_date_namespaceObject.getDate)(dateString); 30786 return parsed && isValid(parsed) ? parsed : null; 30787 }; 30788 const formatDate = (date) => { 30789 if (!date) { 30790 return ""; 30791 } 30792 return typeof date === "string" ? date : format(date, "yyyy-MM-dd"); 30793 }; 30794 function ValidatedDateControl({ 30795 field, 30796 validity, 30797 inputRefs, 30798 isTouched, 30799 setIsTouched, 30800 children 30801 }) { 30802 const { isValid } = field; 30803 const [customValidity, setCustomValidity] = (0,external_wp_element_.useState)(void 0); 30804 const validateRefs = (0,external_wp_element_.useCallback)(() => { 30805 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 30806 for (const ref of refs) { 30807 const input = ref.current; 30808 if (input && !input.validity.valid) { 30809 setCustomValidity({ 30810 type: "invalid", 30811 message: input.validationMessage 30812 }); 30813 return; 30814 } 30815 } 30816 setCustomValidity(void 0); 30817 }, [inputRefs]); 30818 (0,external_wp_element_.useEffect)(() => { 30819 if (isTouched) { 30820 const timeoutId = setTimeout(() => { 30821 if (validity) { 30822 setCustomValidity(getCustomValidity(isValid, validity)); 30823 } else { 30824 validateRefs(); 30825 } 30826 }, 0); 30827 return () => clearTimeout(timeoutId); 30828 } 30829 return void 0; 30830 }, [isTouched, isValid, validity, validateRefs]); 30831 const onBlur = (event) => { 30832 if (isTouched) { 30833 return; 30834 } 30835 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { 30836 setIsTouched(true); 30837 } 30838 }; 30839 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { onBlur, children: [ 30840 children, 30841 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 30842 "p", 30843 { 30844 className: dist_clsx( 30845 "components-validated-control__indicator", 30846 customValidity.type === "invalid" ? "is-invalid" : void 0, 30847 customValidity.type === "valid" ? "is-valid" : void 0 30848 ), 30849 children: [ 30850 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30851 external_wp_components_namespaceObject.Icon, 30852 { 30853 className: "components-validated-control__indicator-icon", 30854 icon: error_default, 30855 size: 16, 30856 fill: "currentColor" 30857 } 30858 ), 30859 customValidity.message 30860 ] 30861 } 30862 ) }) 30863 ] }); 30864 } 30865 function CalendarDateControl({ 30866 data, 30867 field, 30868 onChange, 30869 hideLabelFromVision, 30870 validity 30871 }) { 30872 const { id, label, setValue, getValue, isValid } = field; 30873 const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)( 30874 null 30875 ); 30876 const fieldValue = getValue({ item: data }); 30877 const value = typeof fieldValue === "string" ? fieldValue : void 0; 30878 const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => { 30879 const parsedDate = parseDate(value); 30880 return parsedDate || /* @__PURE__ */ new Date(); 30881 }); 30882 const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false); 30883 const validityTargetRef = (0,external_wp_element_.useRef)(null); 30884 const onChangeCallback = (0,external_wp_element_.useCallback)( 30885 (newValue) => onChange(setValue({ item: data, value: newValue })), 30886 [data, onChange, setValue] 30887 ); 30888 const onSelectDate = (0,external_wp_element_.useCallback)( 30889 (newDate) => { 30890 const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0; 30891 onChangeCallback(dateValue); 30892 setSelectedPresetId(null); 30893 setIsTouched(true); 30894 }, 30895 [onChangeCallback] 30896 ); 30897 const handlePresetClick = (0,external_wp_element_.useCallback)( 30898 (preset) => { 30899 const presetDate = preset.getValue(); 30900 const dateValue = formatDate(presetDate); 30901 setCalendarMonth(presetDate); 30902 onChangeCallback(dateValue); 30903 setSelectedPresetId(preset.id); 30904 setIsTouched(true); 30905 }, 30906 [onChangeCallback] 30907 ); 30908 const handleManualDateChange = (0,external_wp_element_.useCallback)( 30909 (newValue) => { 30910 onChangeCallback(newValue); 30911 if (newValue) { 30912 const parsedDate = parseDate(newValue); 30913 if (parsedDate) { 30914 setCalendarMonth(parsedDate); 30915 } 30916 } 30917 setSelectedPresetId(null); 30918 setIsTouched(true); 30919 }, 30920 [onChangeCallback] 30921 ); 30922 const { 30923 timezone: { string: timezoneString }, 30924 l10n: { startOfWeek } 30925 } = (0,external_wp_date_namespaceObject.getSettings)(); 30926 const displayLabel = isValid?.required ? `$label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label; 30927 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30928 ValidatedDateControl, 30929 { 30930 field, 30931 validity, 30932 inputRefs: validityTargetRef, 30933 isTouched, 30934 setIsTouched, 30935 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30936 external_wp_components_namespaceObject.BaseControl, 30937 { 30938 __nextHasNoMarginBottom: true, 30939 id, 30940 className: "dataviews-controls__date", 30941 label: displayLabel, 30942 hideLabelFromVision, 30943 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 30944 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [ 30945 DATE_PRESETS.map((preset) => { 30946 const isSelected = selectedPresetId === preset.id; 30947 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30948 external_wp_components_namespaceObject.Button, 30949 { 30950 className: "dataviews-controls__date-preset", 30951 variant: "tertiary", 30952 isPressed: isSelected, 30953 size: "small", 30954 onClick: () => handlePresetClick(preset), 30955 children: preset.label 30956 }, 30957 preset.id 30958 ); 30959 }), 30960 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30961 external_wp_components_namespaceObject.Button, 30962 { 30963 className: "dataviews-controls__date-preset", 30964 variant: "tertiary", 30965 isPressed: !selectedPresetId, 30966 size: "small", 30967 disabled: !!selectedPresetId, 30968 accessibleWhenDisabled: false, 30969 children: (0,external_wp_i18n_namespaceObject.__)("Custom") 30970 } 30971 ) 30972 ] }), 30973 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30974 external_wp_components_namespaceObject.__experimentalInputControl, 30975 { 30976 __next40pxDefaultSize: true, 30977 ref: validityTargetRef, 30978 type: "date", 30979 label: (0,external_wp_i18n_namespaceObject.__)("Date"), 30980 hideLabelFromVision: true, 30981 value, 30982 onChange: handleManualDateChange, 30983 required: !!field.isValid?.required 30984 } 30985 ), 30986 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30987 date_DateCalendar, 30988 { 30989 style: { width: "100%" }, 30990 selected: value ? parseDate(value) || void 0 : void 0, 30991 onSelect: onSelectDate, 30992 month: calendarMonth, 30993 onMonthChange: setCalendarMonth, 30994 timeZone: timezoneString || void 0, 30995 weekStartsOn: startOfWeek 30996 } 30997 ) 30998 ] }) 30999 } 31000 ) 31001 } 31002 ); 31003 } 31004 function CalendarDateRangeControl({ 31005 data, 31006 field, 31007 onChange, 31008 hideLabelFromVision, 31009 validity 31010 }) { 31011 const { id, label, getValue, setValue } = field; 31012 let value; 31013 const fieldValue = getValue({ item: data }); 31014 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) { 31015 value = fieldValue; 31016 } 31017 const onChangeCallback = (0,external_wp_element_.useCallback)( 31018 (newValue) => { 31019 onChange( 31020 setValue({ 31021 item: data, 31022 value: newValue 31023 }) 31024 ); 31025 }, 31026 [data, onChange, setValue] 31027 ); 31028 const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)( 31029 null 31030 ); 31031 const selectedRange = (0,external_wp_element_.useMemo)(() => { 31032 if (!value) { 31033 return { from: void 0, to: void 0 }; 31034 } 31035 const [from, to] = value; 31036 return { 31037 from: parseDate(from) || void 0, 31038 to: parseDate(to) || void 0 31039 }; 31040 }, [value]); 31041 const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => { 31042 return selectedRange.from || /* @__PURE__ */ new Date(); 31043 }); 31044 const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false); 31045 const fromInputRef = (0,external_wp_element_.useRef)(null); 31046 const toInputRef = (0,external_wp_element_.useRef)(null); 31047 const updateDateRange = (0,external_wp_element_.useCallback)( 31048 (fromDate, toDate) => { 31049 if (fromDate && toDate) { 31050 onChangeCallback([ 31051 formatDate(fromDate), 31052 formatDate(toDate) 31053 ]); 31054 } else if (!fromDate && !toDate) { 31055 onChangeCallback(void 0); 31056 } 31057 }, 31058 [onChangeCallback] 31059 ); 31060 const onSelectCalendarRange = (0,external_wp_element_.useCallback)( 31061 (newRange) => { 31062 updateDateRange(newRange?.from, newRange?.to); 31063 setSelectedPresetId(null); 31064 setIsTouched(true); 31065 }, 31066 [updateDateRange] 31067 ); 31068 const handlePresetClick = (0,external_wp_element_.useCallback)( 31069 (preset) => { 31070 const [startDate, endDate] = preset.getValue(); 31071 setCalendarMonth(startDate); 31072 updateDateRange(startDate, endDate); 31073 setSelectedPresetId(preset.id); 31074 setIsTouched(true); 31075 }, 31076 [updateDateRange] 31077 ); 31078 const handleManualDateChange = (0,external_wp_element_.useCallback)( 31079 (fromOrTo, newValue) => { 31080 const [currentFrom, currentTo] = value || [ 31081 void 0, 31082 void 0 31083 ]; 31084 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom; 31085 const updatedTo = fromOrTo === "to" ? newValue : currentTo; 31086 updateDateRange(updatedFrom, updatedTo); 31087 if (newValue) { 31088 const parsedDate = parseDate(newValue); 31089 if (parsedDate) { 31090 setCalendarMonth(parsedDate); 31091 } 31092 } 31093 setSelectedPresetId(null); 31094 setIsTouched(true); 31095 }, 31096 [value, updateDateRange] 31097 ); 31098 const { timezone, l10n } = (0,external_wp_date_namespaceObject.getSettings)(); 31099 const displayLabel = field.isValid?.required ? `$label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label; 31100 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31101 ValidatedDateControl, 31102 { 31103 field, 31104 validity, 31105 inputRefs: [fromInputRef, toInputRef], 31106 isTouched, 31107 setIsTouched, 31108 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31109 external_wp_components_namespaceObject.BaseControl, 31110 { 31111 __nextHasNoMarginBottom: true, 31112 id, 31113 className: "dataviews-controls__date", 31114 label: displayLabel, 31115 hideLabelFromVision, 31116 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 31117 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [ 31118 DATE_RANGE_PRESETS.map((preset) => { 31119 const isSelected = selectedPresetId === preset.id; 31120 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31121 external_wp_components_namespaceObject.Button, 31122 { 31123 className: "dataviews-controls__date-preset", 31124 variant: "tertiary", 31125 isPressed: isSelected, 31126 size: "small", 31127 onClick: () => handlePresetClick(preset), 31128 children: preset.label 31129 }, 31130 preset.id 31131 ); 31132 }), 31133 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31134 external_wp_components_namespaceObject.Button, 31135 { 31136 className: "dataviews-controls__date-preset", 31137 variant: "tertiary", 31138 isPressed: !selectedPresetId, 31139 size: "small", 31140 accessibleWhenDisabled: false, 31141 disabled: !!selectedPresetId, 31142 children: (0,external_wp_i18n_namespaceObject.__)("Custom") 31143 } 31144 ) 31145 ] }), 31146 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [ 31147 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31148 external_wp_components_namespaceObject.__experimentalInputControl, 31149 { 31150 __next40pxDefaultSize: true, 31151 ref: fromInputRef, 31152 type: "date", 31153 label: (0,external_wp_i18n_namespaceObject.__)("From"), 31154 hideLabelFromVision: true, 31155 value: value?.[0], 31156 onChange: (newValue) => handleManualDateChange("from", newValue), 31157 required: !!field.isValid?.required 31158 } 31159 ), 31160 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31161 external_wp_components_namespaceObject.__experimentalInputControl, 31162 { 31163 __next40pxDefaultSize: true, 31164 ref: toInputRef, 31165 type: "date", 31166 label: (0,external_wp_i18n_namespaceObject.__)("To"), 31167 hideLabelFromVision: true, 31168 value: value?.[1], 31169 onChange: (newValue) => handleManualDateChange("to", newValue), 31170 required: !!field.isValid?.required 31171 } 31172 ) 31173 ] }), 31174 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31175 DateRangeCalendar, 31176 { 31177 style: { width: "100%" }, 31178 selected: selectedRange, 31179 onSelect: onSelectCalendarRange, 31180 month: calendarMonth, 31181 onMonthChange: setCalendarMonth, 31182 timeZone: timezone.string || void 0, 31183 weekStartsOn: l10n.startOfWeek 31184 } 31185 ) 31186 ] }) 31187 } 31188 ) 31189 } 31190 ); 31191 } 31192 function DateControl({ 31193 data, 31194 field, 31195 onChange, 31196 hideLabelFromVision, 31197 operator, 31198 validity 31199 }) { 31200 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 31201 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31202 RelativeDateControl, 31203 { 31204 className: "dataviews-controls__date", 31205 data, 31206 field, 31207 onChange, 31208 hideLabelFromVision, 31209 operator 31210 } 31211 ); 31212 } 31213 if (operator === OPERATOR_BETWEEN) { 31214 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31215 CalendarDateRangeControl, 31216 { 31217 data, 31218 field, 31219 onChange, 31220 hideLabelFromVision, 31221 validity 31222 } 31223 ); 31224 } 31225 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31226 CalendarDateControl, 31227 { 31228 data, 31229 field, 31230 onChange, 31231 hideLabelFromVision, 31232 validity 31233 } 31234 ); 31235 } 31236 31237 31238 ;// ./node_modules/@wordpress/icons/build-module/library/at-symbol.js 31239 31240 31241 var at_symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12.5939 21C14.1472 21 16.1269 20.5701 17.0711 20.1975L16.6447 18.879C16.0964 19.051 14.3299 19.6242 12.6548 19.6242C7.4467 19.6242 4.67513 16.8726 4.67513 12C4.67513 7.21338 7.50762 4.34713 12.2893 4.34713C17.132 4.34713 19.4162 7.55732 19.4162 10.7675C19.4162 14.035 19.0508 15.4968 17.4975 15.4968C16.5838 15.4968 16.0964 14.7803 16.0964 13.9777V7.5H14.4822V8.30255H14.3909C14.1777 7.67198 12.9898 7.12739 11.467 7.2707C9.18274 7.5 7.4467 9.27707 7.4467 11.8567C7.4467 14.5796 8.81726 16.672 11.467 16.758C13.203 16.8153 14.1168 16.0127 14.4822 15.1815H14.5736C14.7563 16.414 16.401 16.8439 17.467 16.8439C20.6954 16.8439 21 13.5764 21 10.7962C21 6.86943 18.0761 3 12.3807 3C6.50254 3 3 6.3535 3 11.9427C3 17.7325 6.38071 21 12.5939 21ZM11.7107 15.2962C9.73096 15.2962 9.03046 13.6051 9.03046 11.7707C9.03046 10.1083 10.0355 8.67516 11.7716 8.67516C13.599 8.67516 14.5736 9.36306 14.5736 11.7707C14.5736 14.1497 13.7513 15.2962 11.7107 15.2962Z" }) }); 31242 31243 31244 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-input.js 31245 31246 31247 31248 31249 31250 const { ValidatedInputControl: validated_input_ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31251 function ValidatedText({ 31252 data, 31253 field, 31254 onChange, 31255 hideLabelFromVision, 31256 type, 31257 prefix, 31258 suffix, 31259 validity 31260 }) { 31261 const { label, placeholder, description, getValue, setValue, isValid } = field; 31262 const value = getValue({ item: data }); 31263 const onChangeControl = (0,external_wp_element_.useCallback)( 31264 (newValue) => onChange( 31265 setValue({ 31266 item: data, 31267 value: newValue 31268 }) 31269 ), 31270 [data, setValue, onChange] 31271 ); 31272 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31273 validated_input_ValidatedInputControl, 31274 { 31275 required: !!isValid?.required, 31276 customValidity: getCustomValidity(isValid, validity), 31277 label, 31278 placeholder, 31279 value: value ?? "", 31280 help: description, 31281 onChange: onChangeControl, 31282 hideLabelFromVision, 31283 type, 31284 prefix, 31285 suffix, 31286 __next40pxDefaultSize: true 31287 } 31288 ); 31289 } 31290 31291 31292 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/email.js 31293 31294 31295 31296 31297 function Email({ 31298 data, 31299 field, 31300 onChange, 31301 hideLabelFromVision, 31302 validity 31303 }) { 31304 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31305 ValidatedText, 31306 { 31307 ...{ 31308 data, 31309 field, 31310 onChange, 31311 hideLabelFromVision, 31312 validity, 31313 type: "email", 31314 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: at_symbol_default }) }) 31315 } 31316 } 31317 ); 31318 } 31319 31320 31321 ;// ./node_modules/@wordpress/icons/build-module/library/mobile.js 31322 31323 31324 var mobile_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) }); 31325 31326 31327 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/telephone.js 31328 31329 31330 31331 31332 function Telephone({ 31333 data, 31334 field, 31335 onChange, 31336 hideLabelFromVision, 31337 validity 31338 }) { 31339 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31340 ValidatedText, 31341 { 31342 ...{ 31343 data, 31344 field, 31345 onChange, 31346 hideLabelFromVision, 31347 validity, 31348 type: "tel", 31349 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: mobile_default }) }) 31350 } 31351 } 31352 ); 31353 } 31354 31355 31356 ;// ./node_modules/@wordpress/icons/build-module/library/link.js 31357 31358 31359 var link_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); 31360 31361 31362 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/url.js 31363 31364 31365 31366 31367 function Url({ 31368 data, 31369 field, 31370 onChange, 31371 hideLabelFromVision, 31372 validity 31373 }) { 31374 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31375 ValidatedText, 31376 { 31377 ...{ 31378 data, 31379 field, 31380 onChange, 31381 hideLabelFromVision, 31382 validity, 31383 type: "url", 31384 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: link_default }) }) 31385 } 31386 } 31387 ); 31388 } 31389 31390 31391 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-number.js 31392 31393 31394 31395 31396 31397 31398 31399 const { ValidatedNumberControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31400 function toNumberOrEmpty(value) { 31401 if (value === "" || value === void 0) { 31402 return ""; 31403 } 31404 const number = Number(value); 31405 return Number.isFinite(number) ? number : ""; 31406 } 31407 function BetweenControls({ 31408 value, 31409 onChange, 31410 hideLabelFromVision, 31411 step 31412 }) { 31413 const [min = "", max = ""] = value; 31414 const onChangeMin = (0,external_wp_element_.useCallback)( 31415 (newValue) => onChange([toNumberOrEmpty(newValue), max]), 31416 [onChange, max] 31417 ); 31418 const onChangeMax = (0,external_wp_element_.useCallback)( 31419 (newValue) => onChange([min, toNumberOrEmpty(newValue)]), 31420 [onChange, min] 31421 ); 31422 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31423 external_wp_components_namespaceObject.BaseControl, 31424 { 31425 __nextHasNoMarginBottom: true, 31426 help: (0,external_wp_i18n_namespaceObject.__)("The max. value must be greater than the min. value."), 31427 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "row", gap: 4, children: [ 31428 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31429 external_wp_components_namespaceObject.__experimentalNumberControl, 31430 { 31431 label: (0,external_wp_i18n_namespaceObject.__)("Min."), 31432 value: min, 31433 max: max ? Number(max) - step : void 0, 31434 onChange: onChangeMin, 31435 __next40pxDefaultSize: true, 31436 hideLabelFromVision, 31437 step 31438 } 31439 ), 31440 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31441 external_wp_components_namespaceObject.__experimentalNumberControl, 31442 { 31443 label: (0,external_wp_i18n_namespaceObject.__)("Max."), 31444 value: max, 31445 min: min ? Number(min) + step : void 0, 31446 onChange: onChangeMax, 31447 __next40pxDefaultSize: true, 31448 hideLabelFromVision, 31449 step 31450 } 31451 ) 31452 ] }) 31453 } 31454 ); 31455 } 31456 function ValidatedNumber({ 31457 data, 31458 field, 31459 onChange, 31460 hideLabelFromVision, 31461 operator, 31462 decimals, 31463 validity 31464 }) { 31465 const step = Math.pow(10, Math.abs(decimals) * -1); 31466 const { label, description, getValue, setValue, isValid } = field; 31467 const value = getValue({ item: data }) ?? ""; 31468 const onChangeControl = (0,external_wp_element_.useCallback)( 31469 (newValue) => { 31470 onChange( 31471 setValue({ 31472 item: data, 31473 // Do not convert an empty string or undefined to a number, 31474 // otherwise there's a mismatch between the UI control (empty) 31475 // and the data relied by onChange (0). 31476 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue) 31477 }) 31478 ); 31479 }, 31480 [data, onChange, setValue] 31481 ); 31482 const onChangeBetweenControls = (0,external_wp_element_.useCallback)( 31483 (newValue) => { 31484 onChange( 31485 setValue({ 31486 item: data, 31487 value: newValue 31488 }) 31489 ); 31490 }, 31491 [data, onChange, setValue] 31492 ); 31493 if (operator === OPERATOR_BETWEEN) { 31494 let valueBetween = ["", ""]; 31495 if (Array.isArray(value) && value.length === 2 && value.every( 31496 (element) => typeof element === "number" || element === "" 31497 )) { 31498 valueBetween = value; 31499 } 31500 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31501 BetweenControls, 31502 { 31503 value: valueBetween, 31504 onChange: onChangeBetweenControls, 31505 hideLabelFromVision, 31506 step 31507 } 31508 ); 31509 } 31510 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31511 ValidatedNumberControl, 31512 { 31513 required: !!isValid?.required, 31514 customValidity: getCustomValidity(isValid, validity), 31515 label, 31516 help: description, 31517 value, 31518 onChange: onChangeControl, 31519 __next40pxDefaultSize: true, 31520 hideLabelFromVision, 31521 step 31522 } 31523 ); 31524 } 31525 31526 31527 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js 31528 31529 31530 function integer_Number(props) { 31531 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 0 }); 31532 } 31533 31534 31535 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/number.js 31536 31537 31538 function number_Number(props) { 31539 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 2 }); 31540 } 31541 31542 31543 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js 31544 31545 31546 31547 31548 31549 31550 const { ValidatedRadioControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31551 function Radio({ 31552 data, 31553 field, 31554 onChange, 31555 hideLabelFromVision, 31556 validity 31557 }) { 31558 const { label, description, getValue, setValue, isValid } = field; 31559 const { elements, isLoading } = useElements({ 31560 elements: field.elements, 31561 getElements: field.getElements 31562 }); 31563 const value = getValue({ item: data }); 31564 const onChangeControl = (0,external_wp_element_.useCallback)( 31565 (newValue) => onChange(setValue({ item: data, value: newValue })), 31566 [data, onChange, setValue] 31567 ); 31568 if (isLoading) { 31569 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); 31570 } 31571 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31572 ValidatedRadioControl, 31573 { 31574 required: !!field.isValid?.required, 31575 customValidity: getCustomValidity(isValid, validity), 31576 label, 31577 help: description, 31578 onChange: onChangeControl, 31579 options: elements, 31580 selected: value, 31581 hideLabelFromVision 31582 } 31583 ); 31584 } 31585 31586 31587 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js 31588 31589 31590 31591 31592 31593 31594 const { ValidatedSelectControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31595 function Select({ 31596 data, 31597 field, 31598 onChange, 31599 hideLabelFromVision, 31600 validity 31601 }) { 31602 const { type, label, description, getValue, setValue, isValid } = field; 31603 const isMultiple = type === "array"; 31604 const value = getValue({ item: data }) ?? (isMultiple ? [] : ""); 31605 const onChangeControl = (0,external_wp_element_.useCallback)( 31606 (newValue) => onChange(setValue({ item: data, value: newValue })), 31607 [data, onChange, setValue] 31608 ); 31609 const { elements, isLoading } = useElements({ 31610 elements: field.elements, 31611 getElements: field.getElements 31612 }); 31613 if (isLoading) { 31614 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); 31615 } 31616 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31617 ValidatedSelectControl, 31618 { 31619 required: !!field.isValid?.required, 31620 customValidity: getCustomValidity(isValid, validity), 31621 label, 31622 value, 31623 help: description, 31624 options: elements, 31625 onChange: onChangeControl, 31626 __next40pxDefaultSize: true, 31627 __nextHasNoMarginBottom: true, 31628 hideLabelFromVision, 31629 multiple: isMultiple 31630 } 31631 ); 31632 } 31633 31634 31635 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js 31636 31637 31638 31639 function Text({ 31640 data, 31641 field, 31642 onChange, 31643 hideLabelFromVision, 31644 config, 31645 validity 31646 }) { 31647 const { prefix, suffix } = config || {}; 31648 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31649 ValidatedText, 31650 { 31651 ...{ 31652 data, 31653 field, 31654 onChange, 31655 hideLabelFromVision, 31656 validity, 31657 prefix: prefix ? (0,external_wp_element_.createElement)(prefix) : void 0, 31658 suffix: suffix ? (0,external_wp_element_.createElement)(suffix) : void 0 31659 } 31660 } 31661 ); 31662 } 31663 31664 31665 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle.js 31666 31667 31668 31669 31670 31671 const { ValidatedToggleControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31672 function Toggle({ 31673 field, 31674 onChange, 31675 data, 31676 hideLabelFromVision, 31677 validity 31678 }) { 31679 const { label, description, getValue, setValue, isValid } = field; 31680 const onChangeControl = (0,external_wp_element_.useCallback)(() => { 31681 onChange( 31682 setValue({ item: data, value: !getValue({ item: data }) }) 31683 ); 31684 }, [onChange, setValue, data, getValue]); 31685 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31686 ValidatedToggleControl, 31687 { 31688 required: !!isValid.required, 31689 customValidity: getCustomValidity(isValid, validity), 31690 hidden: hideLabelFromVision, 31691 __nextHasNoMarginBottom: true, 31692 label, 31693 help: description, 31694 checked: getValue({ item: data }), 31695 onChange: onChangeControl 31696 } 31697 ); 31698 } 31699 31700 31701 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/textarea.js 31702 31703 31704 31705 31706 31707 const { ValidatedTextareaControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31708 function Textarea({ 31709 data, 31710 field, 31711 onChange, 31712 hideLabelFromVision, 31713 config, 31714 validity 31715 }) { 31716 const { rows = 4 } = config || {}; 31717 const { label, placeholder, description, setValue, isValid } = field; 31718 const value = field.getValue({ item: data }); 31719 const onChangeControl = (0,external_wp_element_.useCallback)( 31720 (newValue) => onChange(setValue({ item: data, value: newValue })), 31721 [data, onChange, setValue] 31722 ); 31723 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31724 ValidatedTextareaControl, 31725 { 31726 required: !!isValid?.required, 31727 customValidity: getCustomValidity(isValid, validity), 31728 label, 31729 placeholder, 31730 value: value ?? "", 31731 help: description, 31732 onChange: onChangeControl, 31733 rows, 31734 __next40pxDefaultSize: true, 31735 __nextHasNoMarginBottom: true, 31736 hideLabelFromVision 31737 } 31738 ); 31739 } 31740 31741 31742 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle-group.js 31743 31744 31745 31746 31747 31748 31749 const { ValidatedToggleGroupControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31750 function ToggleGroup({ 31751 data, 31752 field, 31753 onChange, 31754 hideLabelFromVision, 31755 validity 31756 }) { 31757 const { getValue, setValue, isValid } = field; 31758 const value = getValue({ item: data }); 31759 const onChangeControl = (0,external_wp_element_.useCallback)( 31760 (newValue) => onChange(setValue({ item: data, value: newValue })), 31761 [data, onChange, setValue] 31762 ); 31763 const { elements, isLoading } = useElements({ 31764 elements: field.elements, 31765 getElements: field.getElements 31766 }); 31767 if (isLoading) { 31768 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); 31769 } 31770 if (elements.length === 0) { 31771 return null; 31772 } 31773 const selectedOption = elements.find((el) => el.value === value); 31774 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31775 ValidatedToggleGroupControl, 31776 { 31777 required: !!field.isValid?.required, 31778 customValidity: getCustomValidity(isValid, validity), 31779 __next40pxDefaultSize: true, 31780 __nextHasNoMarginBottom: true, 31781 isBlock: true, 31782 label: field.label, 31783 help: selectedOption?.description || field.description, 31784 onChange: onChangeControl, 31785 value, 31786 hideLabelFromVision, 31787 children: elements.map((el) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31788 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 31789 { 31790 label: el.label, 31791 value: el.value 31792 }, 31793 el.value 31794 )) 31795 } 31796 ); 31797 } 31798 31799 31800 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/array.js 31801 31802 31803 31804 31805 31806 31807 const { ValidatedFormTokenField } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31808 function ArrayControl({ 31809 data, 31810 field, 31811 onChange, 31812 hideLabelFromVision, 31813 validity 31814 }) { 31815 const { label, placeholder, getValue, setValue, isValid } = field; 31816 const value = getValue({ item: data }); 31817 const { elements, isLoading } = useElements({ 31818 elements: field.elements, 31819 getElements: field.getElements 31820 }); 31821 const arrayValueAsElements = (0,external_wp_element_.useMemo)( 31822 () => Array.isArray(value) ? value.map((token) => { 31823 const element = elements?.find( 31824 (suggestion) => suggestion.value === token 31825 ); 31826 return element || { value: token, label: token }; 31827 }) : [], 31828 [value, elements] 31829 ); 31830 const onChangeControl = (0,external_wp_element_.useCallback)( 31831 (tokens) => { 31832 const valueTokens = tokens.map((token) => { 31833 if (typeof token === "object" && "value" in token) { 31834 return token.value; 31835 } 31836 return token; 31837 }); 31838 onChange(setValue({ item: data, value: valueTokens })); 31839 }, 31840 [onChange, setValue, data] 31841 ); 31842 if (isLoading) { 31843 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); 31844 } 31845 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31846 ValidatedFormTokenField, 31847 { 31848 required: !!isValid?.required, 31849 customValidity: getCustomValidity(isValid, validity), 31850 label: hideLabelFromVision ? void 0 : label, 31851 value: arrayValueAsElements, 31852 onChange: onChangeControl, 31853 placeholder, 31854 suggestions: elements?.map((element) => element.value), 31855 __experimentalValidateInput: (token) => { 31856 if (field.isValid?.elements && elements) { 31857 return elements.some( 31858 (element) => element.value === token || element.label === token 31859 ); 31860 } 31861 return true; 31862 }, 31863 __experimentalExpandOnFocus: elements && elements.length > 0, 31864 __experimentalShowHowTo: !field.isValid?.elements, 31865 displayTransform: (token) => { 31866 if (typeof token === "object" && "label" in token) { 31867 return token.label; 31868 } 31869 if (typeof token === "string" && elements) { 31870 const element = elements.find( 31871 (el) => el.value === token 31872 ); 31873 return element?.label || token; 31874 } 31875 return token; 31876 }, 31877 __experimentalRenderItem: ({ item }) => { 31878 if (typeof item === "string" && elements) { 31879 const element = elements.find( 31880 (el) => el.value === item 31881 ); 31882 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element?.label || item }); 31883 } 31884 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: item }); 31885 } 31886 } 31887 ); 31888 } 31889 31890 31891 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/color.js 31892 31893 31894 31895 31896 31897 31898 const { ValidatedInputControl: color_ValidatedInputControl, Picker } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31899 const ColorPicker = ({ 31900 color, 31901 onColorChange 31902 }) => { 31903 const validColor = color && w(color).isValid() ? color : "#ffffff"; 31904 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31905 external_wp_components_namespaceObject.Dropdown, 31906 { 31907 renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31908 "button", 31909 { 31910 type: "button", 31911 onClick: onToggle, 31912 style: { 31913 width: "24px", 31914 height: "24px", 31915 borderRadius: "50%", 31916 backgroundColor: validColor, 31917 border: "1px solid #ddd", 31918 cursor: "pointer", 31919 outline: isOpen ? "2px solid #007cba" : "none", 31920 outlineOffset: "2px", 31921 display: "flex", 31922 alignItems: "center", 31923 justifyContent: "center", 31924 padding: 0, 31925 margin: 0 31926 }, 31927 "aria-label": "Open color picker" 31928 } 31929 ) }), 31930 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { padding: "16px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31931 Picker, 31932 { 31933 color: w(validColor), 31934 onChange: onColorChange, 31935 enableAlpha: true 31936 } 31937 ) }) 31938 } 31939 ); 31940 }; 31941 function Color({ 31942 data, 31943 field, 31944 onChange, 31945 hideLabelFromVision, 31946 validity 31947 }) { 31948 const { label, placeholder, description, setValue, isValid } = field; 31949 const value = field.getValue({ item: data }) || ""; 31950 const handleColorChange = (0,external_wp_element_.useCallback)( 31951 (colorObject) => { 31952 onChange(setValue({ item: data, value: colorObject.toHex() })); 31953 }, 31954 [data, onChange, setValue] 31955 ); 31956 const handleInputChange = (0,external_wp_element_.useCallback)( 31957 (newValue) => { 31958 onChange(setValue({ item: data, value: newValue || "" })); 31959 }, 31960 [data, onChange, setValue] 31961 ); 31962 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31963 color_ValidatedInputControl, 31964 { 31965 required: !!field.isValid?.required, 31966 customValidity: getCustomValidity(isValid, validity), 31967 label, 31968 placeholder, 31969 value, 31970 help: description, 31971 onChange: handleInputChange, 31972 hideLabelFromVision, 31973 type: "text", 31974 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31975 ColorPicker, 31976 { 31977 color: value, 31978 onColorChange: handleColorChange 31979 } 31980 ) 31981 } 31982 ); 31983 } 31984 31985 31986 ;// ./node_modules/@wordpress/icons/build-module/library/unseen.js 31987 31988 31989 var unseen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) }); 31990 31991 31992 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/password.js 31993 31994 31995 31996 31997 31998 31999 function Password({ 32000 data, 32001 field, 32002 onChange, 32003 hideLabelFromVision, 32004 validity 32005 }) { 32006 const [isVisible, setIsVisible] = (0,external_wp_element_.useState)(false); 32007 const toggleVisibility = (0,external_wp_element_.useCallback)(() => { 32008 setIsVisible((prev) => !prev); 32009 }, []); 32010 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32011 ValidatedText, 32012 { 32013 ...{ 32014 data, 32015 field, 32016 onChange, 32017 hideLabelFromVision, 32018 validity, 32019 type: isVisible ? "text" : "password", 32020 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32021 external_wp_components_namespaceObject.Button, 32022 { 32023 icon: isVisible ? unseen_default : seen_default, 32024 onClick: toggleVisibility, 32025 size: "small", 32026 variant: "tertiary", 32027 "aria-label": isVisible ? (0,external_wp_i18n_namespaceObject.__)("Hide password") : (0,external_wp_i18n_namespaceObject.__)("Show password") 32028 } 32029 ) 32030 } 32031 } 32032 ); 32033 } 32034 32035 32036 ;// ./node_modules/@wordpress/dataviews/build-module/utils/has-elements.js 32037 function hasElements(field) { 32038 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function"; 32039 } 32040 32041 32042 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js 32043 32044 32045 32046 32047 32048 32049 32050 32051 32052 32053 32054 32055 32056 32057 32058 32059 32060 32061 32062 const FORM_CONTROLS = { 32063 array: ArrayControl, 32064 checkbox: Checkbox, 32065 color: Color, 32066 datetime: DateTime, 32067 date: DateControl, 32068 email: Email, 32069 telephone: Telephone, 32070 url: Url, 32071 integer: integer_Number, 32072 number: number_Number, 32073 password: Password, 32074 radio: Radio, 32075 select: Select, 32076 text: Text, 32077 toggle: Toggle, 32078 textarea: Textarea, 32079 toggleGroup: ToggleGroup 32080 }; 32081 function isEditConfig(value) { 32082 return value && typeof value === "object" && typeof value.control === "string"; 32083 } 32084 function createConfiguredControl(config) { 32085 const { control, ...controlConfig } = config; 32086 const BaseControlType = getControlByType(control); 32087 return function ConfiguredControl(props) { 32088 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseControlType, { ...props, config: controlConfig }); 32089 }; 32090 } 32091 function getControl(field, fieldTypeDefinition) { 32092 if (typeof field.Edit === "function") { 32093 return field.Edit; 32094 } 32095 if (typeof field.Edit === "string") { 32096 return getControlByType(field.Edit); 32097 } 32098 if (isEditConfig(field.Edit)) { 32099 return createConfiguredControl(field.Edit); 32100 } 32101 if (hasElements(field) && field.type !== "array") { 32102 return getControlByType("select"); 32103 } 32104 if (typeof fieldTypeDefinition.Edit === "string") { 32105 return getControlByType(fieldTypeDefinition.Edit); 32106 } 32107 if (isEditConfig(fieldTypeDefinition.Edit)) { 32108 return createConfiguredControl(fieldTypeDefinition.Edit); 32109 } 32110 return fieldTypeDefinition.Edit; 32111 } 32112 function getControlByType(type) { 32113 if (Object.keys(FORM_CONTROLS).includes(type)) { 32114 return FORM_CONTROLS[type]; 32115 } 32116 throw "Control " + type + " not found"; 32117 } 32118 32119 32120 ;// ./node_modules/@wordpress/dataviews/build-module/utils/normalize-fields.js 32121 32122 32123 32124 32125 const getValueFromId = (id) => ({ item }) => { 32126 const path = id.split("."); 32127 let value = item; 32128 for (const segment of path) { 32129 if (value.hasOwnProperty(segment)) { 32130 value = value[segment]; 32131 } else { 32132 value = void 0; 32133 } 32134 } 32135 return value; 32136 }; 32137 const setValueFromId = (id) => ({ value }) => { 32138 const path = id.split("."); 32139 const result = {}; 32140 let current = result; 32141 for (const segment of path.slice(0, -1)) { 32142 current[segment] = {}; 32143 current = current[segment]; 32144 } 32145 current[path.at(-1)] = value; 32146 return result; 32147 }; 32148 function getFilterBy(field, fieldTypeDefinition) { 32149 if (field.filterBy === false) { 32150 return false; 32151 } 32152 if (typeof field.filterBy === "object") { 32153 let operators = field.filterBy.operators; 32154 if (!operators || !Array.isArray(operators)) { 32155 operators = !!fieldTypeDefinition.filterBy ? fieldTypeDefinition.filterBy.defaultOperators : []; 32156 } 32157 let validOperators = ALL_OPERATORS; 32158 if (typeof fieldTypeDefinition.filterBy === "object") { 32159 validOperators = fieldTypeDefinition.filterBy.validOperators; 32160 } 32161 operators = operators.filter( 32162 (operator) => validOperators.includes(operator) 32163 ); 32164 if (hasElements(field) && operators.includes(OPERATOR_BETWEEN)) { 32165 operators = operators.filter( 32166 (operator) => operator !== OPERATOR_BETWEEN 32167 ); 32168 } 32169 const hasSingleSelectionOperator = operators.some( 32170 (operator) => SINGLE_SELECTION_OPERATORS.includes(operator) 32171 ); 32172 if (hasSingleSelectionOperator) { 32173 operators = operators.filter( 32174 (operator) => ( 32175 // The 'Between' operator is unique as it can be combined with single selection operators. 32176 [...SINGLE_SELECTION_OPERATORS, OPERATOR_BETWEEN].includes( 32177 operator 32178 ) 32179 ) 32180 ); 32181 } 32182 if (operators.length === 0) { 32183 return false; 32184 } 32185 return { 32186 isPrimary: !!field.filterBy.isPrimary, 32187 operators 32188 }; 32189 } 32190 if (fieldTypeDefinition.filterBy === false) { 32191 return false; 32192 } 32193 let defaultOperators = fieldTypeDefinition.filterBy.defaultOperators; 32194 if (hasElements(field) && defaultOperators.includes(OPERATOR_BETWEEN)) { 32195 defaultOperators = defaultOperators.filter( 32196 (operator) => operator !== OPERATOR_BETWEEN 32197 ); 32198 } 32199 return { 32200 operators: defaultOperators 32201 }; 32202 } 32203 function normalizeFields(fields) { 32204 return fields.map((field) => { 32205 const fieldTypeDefinition = getFieldTypeDefinition( 32206 field.type 32207 ); 32208 const getValue = field.getValue || getValueFromId(field.id); 32209 const setValue = field.setValue || setValueFromId(field.id); 32210 const sort = field.sort ?? function sort2(a, b, direction) { 32211 return fieldTypeDefinition.sort( 32212 getValue({ item: a }), 32213 getValue({ item: b }), 32214 direction 32215 ); 32216 }; 32217 const isValid = { 32218 ...fieldTypeDefinition.isValid, 32219 ...field.isValid 32220 }; 32221 const Edit = getControl(field, fieldTypeDefinition); 32222 const render = field.render ?? function render2({ 32223 item, 32224 field: renderedField 32225 }) { 32226 return fieldTypeDefinition.render({ item, field: renderedField }); 32227 }; 32228 const filterBy = getFilterBy(field, fieldTypeDefinition); 32229 return { 32230 ...field, 32231 label: field.label || field.id, 32232 header: field.header || field.label || field.id, 32233 getValue, 32234 setValue, 32235 render, 32236 sort, 32237 isValid, 32238 Edit, 32239 hasElements: hasElements(field), 32240 enableHiding: field.enableHiding ?? true, 32241 enableSorting: field.enableSorting ?? fieldTypeDefinition.enableSorting ?? true, 32242 filterBy, 32243 readOnly: field.readOnly ?? fieldTypeDefinition.readOnly ?? false 32244 }; 32245 }); 32246 } 32247 32248 32249 ;// ./node_modules/@wordpress/dataviews/build-module/utils/filter-sort-and-paginate.js 32250 32251 32252 32253 32254 32255 function normalizeSearchInput(input = "") { 32256 return remove_accents_default()(input.trim().toLowerCase()); 32257 } 32258 const filter_sort_and_paginate_EMPTY_ARRAY = []; 32259 function getRelativeDate(value, unit) { 32260 switch (unit) { 32261 case "days": 32262 return subDays(/* @__PURE__ */ new Date(), value); 32263 case "weeks": 32264 return subWeeks(/* @__PURE__ */ new Date(), value); 32265 case "months": 32266 return subMonths(/* @__PURE__ */ new Date(), value); 32267 case "years": 32268 return subYears(/* @__PURE__ */ new Date(), value); 32269 default: 32270 return /* @__PURE__ */ new Date(); 32271 } 32272 } 32273 function filterSortAndPaginate(data, view, fields) { 32274 if (!data) { 32275 return { 32276 data: filter_sort_and_paginate_EMPTY_ARRAY, 32277 paginationInfo: { totalItems: 0, totalPages: 0 } 32278 }; 32279 } 32280 const _fields = normalizeFields(fields); 32281 let filteredData = [...data]; 32282 if (view.search) { 32283 const normalizedSearch = normalizeSearchInput(view.search); 32284 filteredData = filteredData.filter((item) => { 32285 return _fields.filter((field) => field.enableGlobalSearch).some((field) => { 32286 const fieldValue = field.getValue({ item }); 32287 const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue]; 32288 return values.some( 32289 (value) => normalizeSearchInput(String(value)).includes( 32290 normalizedSearch 32291 ) 32292 ); 32293 }); 32294 }); 32295 } 32296 if (view.filters && view.filters?.length > 0) { 32297 view.filters.forEach((filter) => { 32298 const field = _fields.find( 32299 (_field) => _field.id === filter.field 32300 ); 32301 if (field) { 32302 if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) { 32303 filteredData = filteredData.filter((item) => { 32304 const fieldValue = field.getValue({ item }); 32305 if (Array.isArray(fieldValue)) { 32306 return filter.value.some( 32307 (filterValue) => fieldValue.includes(filterValue) 32308 ); 32309 } else if (typeof fieldValue === "string") { 32310 return filter.value.includes(fieldValue); 32311 } 32312 return false; 32313 }); 32314 } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) { 32315 filteredData = filteredData.filter((item) => { 32316 const fieldValue = field.getValue({ item }); 32317 if (Array.isArray(fieldValue)) { 32318 return !filter.value.some( 32319 (filterValue) => fieldValue.includes(filterValue) 32320 ); 32321 } else if (typeof fieldValue === "string") { 32322 return !filter.value.includes(fieldValue); 32323 } 32324 return false; 32325 }); 32326 } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) { 32327 filteredData = filteredData.filter((item) => { 32328 return filter.value.every((value) => { 32329 return field.getValue({ item })?.includes(value); 32330 }); 32331 }); 32332 } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) { 32333 filteredData = filteredData.filter((item) => { 32334 return filter.value.every((value) => { 32335 return !field.getValue({ item })?.includes(value); 32336 }); 32337 }); 32338 } else if (filter.operator === constants_OPERATOR_IS) { 32339 filteredData = filteredData.filter((item) => { 32340 return filter.value === field.getValue({ item }) || filter.value === void 0; 32341 }); 32342 } else if (filter.operator === constants_OPERATOR_IS_NOT) { 32343 filteredData = filteredData.filter((item) => { 32344 return filter.value !== field.getValue({ item }); 32345 }); 32346 } else if (filter.operator === OPERATOR_ON && filter.value !== void 0) { 32347 const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value); 32348 filteredData = filteredData.filter((item) => { 32349 const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item })); 32350 return filterDate.getTime() === fieldDate.getTime(); 32351 }); 32352 } else if (filter.operator === OPERATOR_NOT_ON && filter.value !== void 0) { 32353 const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value); 32354 filteredData = filteredData.filter((item) => { 32355 const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item })); 32356 return filterDate.getTime() !== fieldDate.getTime(); 32357 }); 32358 } else if (filter.operator === OPERATOR_LESS_THAN && filter.value !== void 0) { 32359 filteredData = filteredData.filter((item) => { 32360 const fieldValue = field.getValue({ item }); 32361 return fieldValue < filter.value; 32362 }); 32363 } else if (filter.operator === OPERATOR_GREATER_THAN && filter.value !== void 0) { 32364 filteredData = filteredData.filter((item) => { 32365 const fieldValue = field.getValue({ item }); 32366 return fieldValue > filter.value; 32367 }); 32368 } else if (filter.operator === OPERATOR_LESS_THAN_OR_EQUAL && filter.value !== void 0) { 32369 filteredData = filteredData.filter((item) => { 32370 const fieldValue = field.getValue({ item }); 32371 return fieldValue <= filter.value; 32372 }); 32373 } else if (filter.operator === OPERATOR_GREATER_THAN_OR_EQUAL && filter.value !== void 0) { 32374 filteredData = filteredData.filter((item) => { 32375 const fieldValue = field.getValue({ item }); 32376 return fieldValue >= filter.value; 32377 }); 32378 } else if (filter.operator === OPERATOR_CONTAINS && filter?.value !== void 0) { 32379 filteredData = filteredData.filter((item) => { 32380 const fieldValue = field.getValue({ item }); 32381 return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().includes( 32382 String(filter.value).toLowerCase() 32383 ); 32384 }); 32385 } else if (filter.operator === OPERATOR_NOT_CONTAINS && filter?.value !== void 0) { 32386 filteredData = filteredData.filter((item) => { 32387 const fieldValue = field.getValue({ item }); 32388 return typeof fieldValue === "string" && filter.value && !fieldValue.toLowerCase().includes( 32389 String(filter.value).toLowerCase() 32390 ); 32391 }); 32392 } else if (filter.operator === OPERATOR_STARTS_WITH && filter?.value !== void 0) { 32393 filteredData = filteredData.filter((item) => { 32394 const fieldValue = field.getValue({ item }); 32395 return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().startsWith( 32396 String(filter.value).toLowerCase() 32397 ); 32398 }); 32399 } else if (filter.operator === OPERATOR_BEFORE && filter.value !== void 0) { 32400 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); 32401 filteredData = filteredData.filter((item) => { 32402 const fieldValue = (0,external_wp_date_namespaceObject.getDate)( 32403 field.getValue({ item }) 32404 ); 32405 return fieldValue < filterValue; 32406 }); 32407 } else if (filter.operator === OPERATOR_AFTER && filter.value !== void 0) { 32408 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); 32409 filteredData = filteredData.filter((item) => { 32410 const fieldValue = (0,external_wp_date_namespaceObject.getDate)( 32411 field.getValue({ item }) 32412 ); 32413 return fieldValue > filterValue; 32414 }); 32415 } else if (filter.operator === OPERATOR_BEFORE_INC && filter.value !== void 0) { 32416 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); 32417 filteredData = filteredData.filter((item) => { 32418 const fieldValue = (0,external_wp_date_namespaceObject.getDate)( 32419 field.getValue({ item }) 32420 ); 32421 return fieldValue <= filterValue; 32422 }); 32423 } else if (filter.operator === OPERATOR_AFTER_INC && filter.value !== void 0) { 32424 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); 32425 filteredData = filteredData.filter((item) => { 32426 const fieldValue = (0,external_wp_date_namespaceObject.getDate)( 32427 field.getValue({ item }) 32428 ); 32429 return fieldValue >= filterValue; 32430 }); 32431 } else if (filter.operator === OPERATOR_BETWEEN && Array.isArray(filter.value) && filter.value.length === 2 && filter.value[0] !== void 0 && filter.value[1] !== void 0) { 32432 filteredData = filteredData.filter((item) => { 32433 const fieldValue = field.getValue({ item }); 32434 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") { 32435 return fieldValue >= filter.value[0] && fieldValue <= filter.value[1]; 32436 } 32437 return false; 32438 }); 32439 } else if (filter.operator === OPERATOR_IN_THE_PAST && filter.value?.value !== void 0 && filter.value?.unit !== void 0) { 32440 const targetDate = getRelativeDate( 32441 filter.value.value, 32442 filter.value.unit 32443 ); 32444 filteredData = filteredData.filter((item) => { 32445 const fieldValue = (0,external_wp_date_namespaceObject.getDate)( 32446 field.getValue({ item }) 32447 ); 32448 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date(); 32449 }); 32450 } else if (filter.operator === OPERATOR_OVER && filter.value?.value !== void 0 && filter.value?.unit !== void 0) { 32451 const targetDate = getRelativeDate( 32452 filter.value.value, 32453 filter.value.unit 32454 ); 32455 filteredData = filteredData.filter((item) => { 32456 const fieldValue = (0,external_wp_date_namespaceObject.getDate)( 32457 field.getValue({ item }) 32458 ); 32459 return fieldValue < targetDate; 32460 }); 32461 } 32462 } 32463 }); 32464 } 32465 const sortByField = view.sort?.field ? _fields.find((field) => { 32466 return field.id === view.sort?.field; 32467 }) : null; 32468 const groupByField = view.groupByField ? _fields.find((field) => { 32469 return field.id === view.groupByField; 32470 }) : null; 32471 if (sortByField || groupByField) { 32472 filteredData.sort((a, b) => { 32473 if (groupByField) { 32474 const groupCompare = groupByField.sort(a, b, "asc"); 32475 if (groupCompare !== 0) { 32476 return groupCompare; 32477 } 32478 } 32479 if (sortByField) { 32480 return sortByField.sort(a, b, view.sort?.direction ?? "desc"); 32481 } 32482 return 0; 32483 }); 32484 } 32485 let totalItems = filteredData.length; 32486 let totalPages = 1; 32487 if (view.page !== void 0 && view.perPage !== void 0) { 32488 const start = (view.page - 1) * view.perPage; 32489 totalItems = filteredData?.length || 0; 32490 totalPages = Math.ceil(totalItems / view.perPage); 32491 filteredData = filteredData?.slice(start, start + view.perPage); 32492 } 32493 return { 32494 data: filteredData, 32495 paginationInfo: { 32496 totalItems, 32497 totalPages 32498 } 32499 }; 32500 } 32501 32502 32503 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js 32504 32505 32506 const dataviews_context_DataViewsContext = (0,external_wp_element_.createContext)({ 32507 view: { type: constants_LAYOUT_TABLE }, 32508 onChangeView: () => { 32509 }, 32510 fields: [], 32511 data: [], 32512 paginationInfo: { 32513 totalItems: 0, 32514 totalPages: 0 32515 }, 32516 selection: [], 32517 onChangeSelection: () => { 32518 }, 32519 setOpenedFilter: () => { 32520 }, 32521 openedFilter: null, 32522 getItemId: (item) => item.id, 32523 isItemClickable: () => true, 32524 renderItemLink: void 0, 32525 containerWidth: 0, 32526 containerRef: (0,external_wp_element_.createRef)(), 32527 resizeObserverRef: () => { 32528 }, 32529 defaultLayouts: { list: {}, grid: {}, table: {} }, 32530 filters: [], 32531 isShowingFilter: false, 32532 setIsShowingFilter: () => { 32533 }, 32534 hasInfiniteScrollHandler: false, 32535 config: { 32536 perPageSizes: [] 32537 } 32538 }); 32539 dataviews_context_DataViewsContext.displayName = "DataViewsContext"; 32540 var dataviews_context_default = dataviews_context_DataViewsContext; 32541 32542 32543 ;// ./node_modules/@wordpress/icons/build-module/library/block-table.js 32544 32545 32546 var block_table_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) }); 32547 32548 32549 ;// ./node_modules/@wordpress/icons/build-module/library/category.js 32550 32551 32552 var category_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32553 external_wp_primitives_namespaceObject.Path, 32554 { 32555 d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", 32556 fillRule: "evenodd", 32557 clipRule: "evenodd" 32558 } 32559 ) }); 32560 32561 32562 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js 32563 32564 32565 var format_list_bullets_rtl_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) }); 32566 32567 32568 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 32569 32570 32571 var format_list_bullets_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); 32572 32573 32574 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js 32575 32576 32577 32578 function DataViewsSelectionCheckbox({ 32579 selection, 32580 onChangeSelection, 32581 item, 32582 getItemId, 32583 titleField, 32584 disabled, 32585 ...extraProps 32586 }) { 32587 const id = getItemId(item); 32588 const checked = !disabled && selection.includes(id); 32589 const selectionLabel = titleField?.getValue?.({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)"); 32590 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32591 external_wp_components_namespaceObject.CheckboxControl, 32592 { 32593 className: "dataviews-selection-checkbox", 32594 __nextHasNoMarginBottom: true, 32595 "aria-label": selectionLabel, 32596 "aria-disabled": disabled, 32597 checked, 32598 onChange: () => { 32599 if (disabled) { 32600 return; 32601 } 32602 onChangeSelection( 32603 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] 32604 ); 32605 }, 32606 ...extraProps 32607 } 32608 ); 32609 } 32610 32611 32612 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js 32613 32614 32615 32616 32617 32618 32619 32620 const { Menu: dataviews_item_actions_Menu, kebabCase: dataviews_item_actions_kebabCase } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 32621 function ButtonTrigger({ 32622 action, 32623 onClick, 32624 items 32625 }) { 32626 const label = typeof action.label === "string" ? action.label : action.label(items); 32627 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32628 external_wp_components_namespaceObject.Button, 32629 { 32630 disabled: !!action.disabled, 32631 accessibleWhenDisabled: true, 32632 size: "compact", 32633 onClick, 32634 children: label 32635 } 32636 ); 32637 } 32638 function MenuItemTrigger({ 32639 action, 32640 onClick, 32641 items 32642 }) { 32643 const label = typeof action.label === "string" ? action.label : action.label(items); 32644 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.ItemLabel, { children: label }) }); 32645 } 32646 function ActionModal({ 32647 action, 32648 items, 32649 closeModal 32650 }) { 32651 const label = typeof action.label === "string" ? action.label : action.label(items); 32652 const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader; 32653 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32654 external_wp_components_namespaceObject.Modal, 32655 { 32656 title: modalHeader || label, 32657 __experimentalHideHeader: !!action.hideModalHeader, 32658 onRequestClose: closeModal, 32659 focusOnMount: action.modalFocusOnMount ?? true, 32660 size: action.modalSize || "medium", 32661 overlayClassName: `dataviews-action-modal dataviews-action-modal__$dataviews_item_actions_kebabCase( 32662 action.id 32663 )}`, 32664 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items, closeModal }) 32665 } 32666 ); 32667 } 32668 function ActionsMenuGroup({ 32669 actions, 32670 item, 32671 registry, 32672 setActiveModalAction 32673 }) { 32674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Group, { children: actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32675 MenuItemTrigger, 32676 { 32677 action, 32678 onClick: () => { 32679 if ("RenderModal" in action) { 32680 setActiveModalAction(action); 32681 return; 32682 } 32683 action.callback([item], { registry }); 32684 }, 32685 items: [item] 32686 }, 32687 action.id 32688 )) }); 32689 } 32690 function ItemActions({ 32691 item, 32692 actions, 32693 isCompact 32694 }) { 32695 const registry = (0,external_wp_data_.useRegistry)(); 32696 const { primaryActions, eligibleActions } = (0,external_wp_element_.useMemo)(() => { 32697 const _eligibleActions = actions.filter( 32698 (action) => !action.isEligible || action.isEligible(item) 32699 ); 32700 const _primaryActions = _eligibleActions.filter( 32701 (action) => action.isPrimary 32702 ); 32703 return { 32704 primaryActions: _primaryActions, 32705 eligibleActions: _eligibleActions 32706 }; 32707 }, [actions, item]); 32708 if (isCompact) { 32709 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32710 CompactItemActions, 32711 { 32712 item, 32713 actions: eligibleActions, 32714 isSmall: true, 32715 registry 32716 } 32717 ); 32718 } 32719 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 32720 external_wp_components_namespaceObject.__experimentalHStack, 32721 { 32722 spacing: 0, 32723 justify: "flex-end", 32724 className: "dataviews-item-actions", 32725 style: { 32726 flexShrink: 0, 32727 width: "auto" 32728 }, 32729 children: [ 32730 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32731 PrimaryActions, 32732 { 32733 item, 32734 actions: primaryActions, 32735 registry 32736 } 32737 ), 32738 primaryActions.length < eligibleActions.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32739 CompactItemActions, 32740 { 32741 item, 32742 actions: eligibleActions, 32743 registry 32744 } 32745 ) 32746 ] 32747 } 32748 ); 32749 } 32750 function CompactItemActions({ 32751 item, 32752 actions, 32753 isSmall, 32754 registry 32755 }) { 32756 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)( 32757 null 32758 ); 32759 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 32760 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_item_actions_Menu, { placement: "bottom-end", children: [ 32761 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32762 dataviews_item_actions_Menu.TriggerButton, 32763 { 32764 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32765 external_wp_components_namespaceObject.Button, 32766 { 32767 size: isSmall ? "small" : "compact", 32768 icon: more_vertical_default, 32769 label: (0,external_wp_i18n_namespaceObject.__)("Actions"), 32770 accessibleWhenDisabled: true, 32771 disabled: !actions.length, 32772 className: "dataviews-all-actions-button" 32773 } 32774 ) 32775 } 32776 ), 32777 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32778 ActionsMenuGroup, 32779 { 32780 actions, 32781 item, 32782 registry, 32783 setActiveModalAction 32784 } 32785 ) }) 32786 ] }), 32787 !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32788 ActionModal, 32789 { 32790 action: activeModalAction, 32791 items: [item], 32792 closeModal: () => setActiveModalAction(null) 32793 } 32794 ) 32795 ] }); 32796 } 32797 function PrimaryActions({ 32798 item, 32799 actions, 32800 registry 32801 }) { 32802 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(null); 32803 if (!Array.isArray(actions) || actions.length === 0) { 32804 return null; 32805 } 32806 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 32807 actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32808 ButtonTrigger, 32809 { 32810 action, 32811 onClick: () => { 32812 if ("RenderModal" in action) { 32813 setActiveModalAction(action); 32814 return; 32815 } 32816 action.callback([item], { registry }); 32817 }, 32818 items: [item] 32819 }, 32820 action.id 32821 )), 32822 !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32823 ActionModal, 32824 { 32825 action: activeModalAction, 32826 items: [item], 32827 closeModal: () => setActiveModalAction(null) 32828 } 32829 ) 32830 ] }); 32831 } 32832 32833 32834 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js 32835 32836 32837 32838 32839 32840 32841 32842 32843 function ActionWithModal({ 32844 action, 32845 items, 32846 ActionTriggerComponent 32847 }) { 32848 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false); 32849 const actionTriggerProps = { 32850 action, 32851 onClick: () => { 32852 setIsModalOpen(true); 32853 }, 32854 items 32855 }; 32856 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 32857 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTriggerComponent, { ...actionTriggerProps }), 32858 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32859 ActionModal, 32860 { 32861 action, 32862 items, 32863 closeModal: () => setIsModalOpen(false) 32864 } 32865 ) 32866 ] }); 32867 } 32868 function useHasAPossibleBulkAction(actions, item) { 32869 return (0,external_wp_element_.useMemo)(() => { 32870 return actions.some((action) => { 32871 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 32872 }); 32873 }, [actions, item]); 32874 } 32875 function useSomeItemHasAPossibleBulkAction(actions, data) { 32876 return (0,external_wp_element_.useMemo)(() => { 32877 return data.some((item) => { 32878 return actions.some((action) => { 32879 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 32880 }); 32881 }); 32882 }, [actions, data]); 32883 } 32884 function BulkSelectionCheckbox({ 32885 selection, 32886 onChangeSelection, 32887 data, 32888 actions, 32889 getItemId 32890 }) { 32891 const selectableItems = (0,external_wp_element_.useMemo)(() => { 32892 return data.filter((item) => { 32893 return actions.some( 32894 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) 32895 ); 32896 }); 32897 }, [data, actions]); 32898 const selectedItems = data.filter( 32899 (item) => selection.includes(getItemId(item)) && selectableItems.includes(item) 32900 ); 32901 const areAllSelected = selectedItems.length === selectableItems.length; 32902 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32903 external_wp_components_namespaceObject.CheckboxControl, 32904 { 32905 className: "dataviews-view-table-selection-checkbox", 32906 __nextHasNoMarginBottom: true, 32907 checked: areAllSelected, 32908 indeterminate: !areAllSelected && !!selectedItems.length, 32909 onChange: () => { 32910 if (areAllSelected) { 32911 onChangeSelection([]); 32912 } else { 32913 onChangeSelection( 32914 selectableItems.map((item) => getItemId(item)) 32915 ); 32916 } 32917 }, 32918 "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)("Deselect all") : (0,external_wp_i18n_namespaceObject.__)("Select all") 32919 } 32920 ); 32921 } 32922 function ActionTrigger({ 32923 action, 32924 onClick, 32925 isBusy, 32926 items 32927 }) { 32928 const label = typeof action.label === "string" ? action.label : action.label(items); 32929 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32930 external_wp_components_namespaceObject.Button, 32931 { 32932 disabled: isBusy, 32933 accessibleWhenDisabled: true, 32934 size: "compact", 32935 onClick, 32936 isBusy, 32937 children: label 32938 } 32939 ); 32940 } 32941 const dataviews_bulk_actions_EMPTY_ARRAY = []; 32942 function ActionButton({ 32943 action, 32944 selectedItems, 32945 actionInProgress, 32946 setActionInProgress 32947 }) { 32948 const registry = (0,external_wp_data_.useRegistry)(); 32949 const selectedEligibleItems = (0,external_wp_element_.useMemo)(() => { 32950 return selectedItems.filter((item) => { 32951 return !action.isEligible || action.isEligible(item); 32952 }); 32953 }, [action, selectedItems]); 32954 if ("RenderModal" in action) { 32955 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32956 ActionWithModal, 32957 { 32958 action, 32959 items: selectedEligibleItems, 32960 ActionTriggerComponent: ActionTrigger 32961 }, 32962 action.id 32963 ); 32964 } 32965 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32966 ActionTrigger, 32967 { 32968 action, 32969 onClick: async () => { 32970 setActionInProgress(action.id); 32971 await action.callback(selectedItems, { 32972 registry 32973 }); 32974 setActionInProgress(null); 32975 }, 32976 items: selectedEligibleItems, 32977 isBusy: actionInProgress === action.id 32978 }, 32979 action.id 32980 ); 32981 } 32982 function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) { 32983 const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( 32984 /* translators: %d: number of items. */ 32985 (0,external_wp_i18n_namespaceObject._n)( 32986 "%d Item selected", 32987 "%d Items selected", 32988 selectedItems.length 32989 ), 32990 selectedItems.length 32991 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 32992 /* translators: %d: number of items. */ 32993 (0,external_wp_i18n_namespaceObject._n)("%d Item", "%d Items", data.length), 32994 data.length 32995 ); 32996 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 32997 external_wp_components_namespaceObject.__experimentalHStack, 32998 { 32999 expanded: false, 33000 className: "dataviews-bulk-actions-footer__container", 33001 spacing: 3, 33002 children: [ 33003 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33004 BulkSelectionCheckbox, 33005 { 33006 selection, 33007 onChangeSelection, 33008 data, 33009 actions, 33010 getItemId 33011 } 33012 ), 33013 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message }), 33014 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 33015 external_wp_components_namespaceObject.__experimentalHStack, 33016 { 33017 className: "dataviews-bulk-actions-footer__action-buttons", 33018 expanded: false, 33019 spacing: 1, 33020 children: [ 33021 actionsToShow.map((action) => { 33022 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33023 ActionButton, 33024 { 33025 action, 33026 selectedItems, 33027 actionInProgress, 33028 setActionInProgress 33029 }, 33030 action.id 33031 ); 33032 }), 33033 selectedItems.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33034 external_wp_components_namespaceObject.Button, 33035 { 33036 icon: close_small_default, 33037 showTooltip: true, 33038 tooltipPosition: "top", 33039 size: "compact", 33040 label: (0,external_wp_i18n_namespaceObject.__)("Cancel"), 33041 disabled: !!actionInProgress, 33042 accessibleWhenDisabled: false, 33043 onClick: () => { 33044 onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY); 33045 } 33046 } 33047 ) 33048 ] 33049 } 33050 ) 33051 ] 33052 } 33053 ); 33054 } 33055 function FooterContent({ 33056 selection, 33057 actions, 33058 onChangeSelection, 33059 data, 33060 getItemId 33061 }) { 33062 const [actionInProgress, setActionInProgress] = (0,external_wp_element_.useState)( 33063 null 33064 ); 33065 const footerContentRef = (0,external_wp_element_.useRef)(null); 33066 const bulkActions = (0,external_wp_element_.useMemo)( 33067 () => actions.filter((action) => action.supportsBulk), 33068 [actions] 33069 ); 33070 const selectableItems = (0,external_wp_element_.useMemo)(() => { 33071 return data.filter((item) => { 33072 return bulkActions.some( 33073 (action) => !action.isEligible || action.isEligible(item) 33074 ); 33075 }); 33076 }, [data, bulkActions]); 33077 const selectedItems = (0,external_wp_element_.useMemo)(() => { 33078 return data.filter( 33079 (item) => selection.includes(getItemId(item)) && selectableItems.includes(item) 33080 ); 33081 }, [selection, data, getItemId, selectableItems]); 33082 const actionsToShow = (0,external_wp_element_.useMemo)( 33083 () => actions.filter((action) => { 33084 return action.supportsBulk && selectedItems.some( 33085 (item) => !action.isEligible || action.isEligible(item) 33086 ); 33087 }), 33088 [actions, selectedItems] 33089 ); 33090 if (!actionInProgress) { 33091 if (footerContentRef.current) { 33092 footerContentRef.current = null; 33093 } 33094 return renderFooterContent( 33095 data, 33096 actions, 33097 getItemId, 33098 selection, 33099 actionsToShow, 33100 selectedItems, 33101 actionInProgress, 33102 setActionInProgress, 33103 onChangeSelection 33104 ); 33105 } else if (!footerContentRef.current) { 33106 footerContentRef.current = renderFooterContent( 33107 data, 33108 actions, 33109 getItemId, 33110 selection, 33111 actionsToShow, 33112 selectedItems, 33113 actionInProgress, 33114 setActionInProgress, 33115 onChangeSelection 33116 ); 33117 } 33118 return footerContentRef.current; 33119 } 33120 function BulkActionsFooter() { 33121 const { 33122 data, 33123 selection, 33124 actions = dataviews_bulk_actions_EMPTY_ARRAY, 33125 onChangeSelection, 33126 getItemId 33127 } = (0,external_wp_element_.useContext)(dataviews_context_default); 33128 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33129 FooterContent, 33130 { 33131 selection, 33132 onChangeSelection, 33133 data, 33134 actions, 33135 getItemId 33136 } 33137 ); 33138 } 33139 33140 33141 ;// ./node_modules/@wordpress/icons/build-module/library/funnel.js 33142 33143 33144 var funnel_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) }); 33145 33146 33147 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 33148 33149 33150 var arrow_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); 33151 33152 33153 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js 33154 33155 33156 var arrow_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); 33157 33158 33159 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js 33160 33161 33162 33163 33164 33165 33166 33167 const { Menu: column_header_menu_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 33168 function WithMenuSeparators({ children }) { 33169 return external_wp_element_.Children.toArray(children).filter(Boolean).map((child, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_.Fragment, { children: [ 33170 i > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Separator, {}), 33171 child 33172 ] }, i)); 33173 } 33174 const _HeaderMenu = (0,external_wp_element_.forwardRef)(function HeaderMenu({ 33175 fieldId, 33176 view, 33177 fields, 33178 onChangeView, 33179 onHide, 33180 setOpenedFilter, 33181 canMove = true 33182 }, ref) { 33183 const visibleFieldIds = view.fields ?? []; 33184 const index = visibleFieldIds?.indexOf(fieldId); 33185 const isSorted = view.sort?.field === fieldId; 33186 let isHidable = false; 33187 let isSortable = false; 33188 let canAddFilter = false; 33189 let operators = []; 33190 const field = fields.find((f) => f.id === fieldId); 33191 if (!field) { 33192 return null; 33193 } 33194 isHidable = field.enableHiding !== false; 33195 isSortable = field.enableSorting !== false; 33196 const header = field.header; 33197 operators = !!field.filterBy && field.filterBy?.operators || []; 33198 canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary; 33199 if (!isSortable && !canMove && !isHidable && !canAddFilter) { 33200 return header; 33201 } 33202 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu, { children: [ 33203 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 33204 column_header_menu_Menu.TriggerButton, 33205 { 33206 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33207 external_wp_components_namespaceObject.Button, 33208 { 33209 size: "compact", 33210 className: "dataviews-view-table-header-button", 33211 ref, 33212 variant: "tertiary" 33213 } 33214 ), 33215 children: [ 33216 header, 33217 view.sort && isSorted && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] }) 33218 ] 33219 } 33220 ), 33221 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithMenuSeparators, { children: [ 33222 isSortable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: SORTING_DIRECTIONS.map( 33223 (direction) => { 33224 const isChecked = view.sort && isSorted && view.sort.direction === direction; 33225 const value = `$fieldId}-$direction}`; 33226 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33227 column_header_menu_Menu.RadioItem, 33228 { 33229 name: "view-table-sorting", 33230 value, 33231 checked: isChecked, 33232 onChange: () => { 33233 onChangeView({ 33234 ...view, 33235 sort: { 33236 field: fieldId, 33237 direction 33238 }, 33239 showLevels: false 33240 }); 33241 }, 33242 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: sortLabels[direction] }) 33243 }, 33244 value 33245 ); 33246 } 33247 ) }), 33248 canAddFilter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33249 column_header_menu_Menu.Item, 33250 { 33251 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: funnel_default }), 33252 onClick: () => { 33253 setOpenedFilter(fieldId); 33254 onChangeView({ 33255 ...view, 33256 page: 1, 33257 filters: [ 33258 ...view.filters || [], 33259 { 33260 field: fieldId, 33261 value: void 0, 33262 operator: operators[0] 33263 } 33264 ] 33265 }); 33266 }, 33267 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Add filter") }) 33268 } 33269 ) }), 33270 (canMove || isHidable) && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.Group, { children: [ 33271 canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33272 column_header_menu_Menu.Item, 33273 { 33274 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_left_default }), 33275 disabled: index < 1, 33276 onClick: () => { 33277 onChangeView({ 33278 ...view, 33279 fields: [ 33280 ...visibleFieldIds.slice( 33281 0, 33282 index - 1 33283 ) ?? [], 33284 fieldId, 33285 visibleFieldIds[index - 1], 33286 ...visibleFieldIds.slice( 33287 index + 1 33288 ) 33289 ] 33290 }); 33291 }, 33292 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move left") }) 33293 } 33294 ), 33295 canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33296 column_header_menu_Menu.Item, 33297 { 33298 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_right_default }), 33299 disabled: index >= visibleFieldIds.length - 1, 33300 onClick: () => { 33301 onChangeView({ 33302 ...view, 33303 fields: [ 33304 ...visibleFieldIds.slice( 33305 0, 33306 index 33307 ) ?? [], 33308 visibleFieldIds[index + 1], 33309 fieldId, 33310 ...visibleFieldIds.slice( 33311 index + 2 33312 ) 33313 ] 33314 }); 33315 }, 33316 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move right") }) 33317 } 33318 ), 33319 isHidable && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33320 column_header_menu_Menu.Item, 33321 { 33322 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: unseen_default }), 33323 onClick: () => { 33324 onHide(field); 33325 onChangeView({ 33326 ...view, 33327 fields: visibleFieldIds.filter( 33328 (id) => id !== fieldId 33329 ) 33330 }); 33331 }, 33332 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Hide column") }) 33333 } 33334 ) 33335 ] }) 33336 ] }) }) 33337 ] }); 33338 }); 33339 const ColumnHeaderMenu = _HeaderMenu; 33340 var column_header_menu_default = ColumnHeaderMenu; 33341 33342 33343 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/item-click-wrapper.js 33344 33345 33346 function getClickableItemProps({ 33347 item, 33348 isItemClickable, 33349 onClickItem, 33350 className 33351 }) { 33352 if (!isItemClickable(item) || !onClickItem) { 33353 return { className }; 33354 } 33355 return { 33356 className: className ? `$className} $className}--clickable` : void 0, 33357 role: "button", 33358 tabIndex: 0, 33359 onClick: (event) => { 33360 event.stopPropagation(); 33361 onClickItem(item); 33362 }, 33363 onKeyDown: (event) => { 33364 if (event.key === "Enter" || event.key === "" || event.key === " ") { 33365 event.stopPropagation(); 33366 onClickItem(item); 33367 } 33368 } 33369 }; 33370 } 33371 function ItemClickWrapper({ 33372 item, 33373 isItemClickable, 33374 onClickItem, 33375 renderItemLink, 33376 className, 33377 children, 33378 ...extraProps 33379 }) { 33380 if (!isItemClickable(item)) { 33381 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, ...extraProps, children }); 33382 } 33383 if (renderItemLink) { 33384 const renderedElement = renderItemLink({ 33385 item, 33386 className: `$className} $className}--clickable`, 33387 ...extraProps, 33388 children 33389 }); 33390 return (0,external_wp_element_.cloneElement)(renderedElement, { 33391 onClick: (event) => { 33392 event.stopPropagation(); 33393 if (renderedElement.props.onClick) { 33394 renderedElement.props.onClick(event); 33395 } 33396 }, 33397 onKeyDown: (event) => { 33398 if (event.key === "Enter" || event.key === "" || event.key === " ") { 33399 event.stopPropagation(); 33400 if (renderedElement.props.onKeyDown) { 33401 renderedElement.props.onKeyDown(event); 33402 } 33403 } 33404 } 33405 }); 33406 } 33407 const clickProps = getClickableItemProps({ 33408 item, 33409 isItemClickable, 33410 onClickItem, 33411 className 33412 }); 33413 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...clickProps, ...extraProps, children }); 33414 } 33415 33416 33417 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-primary.js 33418 33419 33420 33421 33422 function ColumnPrimary({ 33423 item, 33424 level, 33425 titleField, 33426 mediaField, 33427 descriptionField, 33428 onClickItem, 33429 renderItemLink, 33430 isItemClickable 33431 }) { 33432 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "flex-start", children: [ 33433 mediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33434 ItemClickWrapper, 33435 { 33436 item, 33437 isItemClickable, 33438 onClickItem, 33439 renderItemLink, 33440 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", 33441 "aria-label": titleField ? (0,external_wp_i18n_namespaceObject.sprintf)( 33442 // translators: %s is the item title. 33443 (0,external_wp_i18n_namespaceObject.__)("Click item: %s"), 33444 titleField.getValue?.({ item }) 33445 ) : void 0, 33446 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33447 mediaField.render, 33448 { 33449 item, 33450 field: mediaField, 33451 config: { sizes: "32px" } 33452 } 33453 ) 33454 } 33455 ), 33456 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 33457 external_wp_components_namespaceObject.__experimentalVStack, 33458 { 33459 spacing: 0, 33460 alignment: "flex-start", 33461 className: "dataviews-view-table__primary-column-content", 33462 children: [ 33463 titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 33464 ItemClickWrapper, 33465 { 33466 item, 33467 isItemClickable, 33468 onClickItem, 33469 renderItemLink, 33470 className: "dataviews-view-table__cell-content-wrapper dataviews-title-field", 33471 children: [ 33472 level !== void 0 && level > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-view-table__level", children: [ 33473 "\u2014".repeat(level), 33474 "\xA0" 33475 ] }), 33476 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) 33477 ] 33478 } 33479 ), 33480 descriptionField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33481 descriptionField.render, 33482 { 33483 item, 33484 field: descriptionField 33485 } 33486 ) 33487 ] 33488 } 33489 ) 33490 ] }); 33491 } 33492 var column_primary_default = ColumnPrimary; 33493 33494 33495 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/use-is-horizontal-scroll-end.js 33496 33497 33498 33499 const isScrolledToEnd = (element) => { 33500 if ((0,external_wp_i18n_namespaceObject.isRTL)()) { 33501 const scrollLeft = Math.abs(element.scrollLeft); 33502 return scrollLeft <= 1; 33503 } 33504 return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1; 33505 }; 33506 function useIsHorizontalScrollEnd({ 33507 scrollContainerRef, 33508 enabled = false 33509 }) { 33510 const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0,external_wp_element_.useState)(false); 33511 const handleIsHorizontalScrollEnd = (0,external_wp_compose_namespaceObject.useDebounce)( 33512 (0,external_wp_element_.useCallback)(() => { 33513 const scrollContainer = scrollContainerRef.current; 33514 if (scrollContainer) { 33515 setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer)); 33516 } 33517 }, [scrollContainerRef, setIsHorizontalScrollEnd]), 33518 200 33519 ); 33520 (0,external_wp_element_.useEffect)(() => { 33521 if (typeof window === "undefined" || !enabled || !scrollContainerRef.current) { 33522 return () => { 33523 }; 33524 } 33525 handleIsHorizontalScrollEnd(); 33526 scrollContainerRef.current.addEventListener( 33527 "scroll", 33528 handleIsHorizontalScrollEnd 33529 ); 33530 window.addEventListener("resize", handleIsHorizontalScrollEnd); 33531 return () => { 33532 scrollContainerRef.current?.removeEventListener( 33533 "scroll", 33534 handleIsHorizontalScrollEnd 33535 ); 33536 window.removeEventListener("resize", handleIsHorizontalScrollEnd); 33537 }; 33538 }, [scrollContainerRef, enabled]); 33539 return isHorizontalScrollEnd; 33540 } 33541 33542 33543 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/get-data-by-group.js 33544 function getDataByGroup(data, groupByField) { 33545 return data.reduce((groups, item) => { 33546 const groupName = groupByField.getValue({ item }); 33547 if (!groups.has(groupName)) { 33548 groups.set(groupName, []); 33549 } 33550 groups.get(groupName)?.push(item); 33551 return groups; 33552 }, /* @__PURE__ */ new Map()); 33553 } 33554 33555 33556 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js 33557 33558 33559 33560 33561 33562 33563 33564 33565 33566 33567 33568 33569 33570 33571 33572 function TableColumnField({ 33573 item, 33574 fields, 33575 column, 33576 align 33577 }) { 33578 const field = fields.find((f) => f.id === column); 33579 if (!field) { 33580 return null; 33581 } 33582 const className = dist_clsx("dataviews-view-table__cell-content-wrapper", { 33583 "dataviews-view-table__cell-align-end": align === "end", 33584 "dataviews-view-table__cell-align-center": align === "center" 33585 }); 33586 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item, field }) }); 33587 } 33588 function TableRow({ 33589 hasBulkActions, 33590 item, 33591 level, 33592 actions, 33593 fields, 33594 id, 33595 view, 33596 titleField, 33597 mediaField, 33598 descriptionField, 33599 selection, 33600 getItemId, 33601 isItemClickable, 33602 onClickItem, 33603 renderItemLink, 33604 onChangeSelection, 33605 isActionsColumnSticky, 33606 posinset 33607 }) { 33608 const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default); 33609 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 33610 const isSelected = hasPossibleBulkAction && selection.includes(id); 33611 const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false); 33612 const { 33613 showTitle = true, 33614 showMedia = true, 33615 showDescription = true, 33616 infiniteScrollEnabled 33617 } = view; 33618 const handleMouseEnter = () => { 33619 setIsHovered(true); 33620 }; 33621 const handleMouseLeave = () => { 33622 setIsHovered(false); 33623 }; 33624 const isTouchDeviceRef = (0,external_wp_element_.useRef)(false); 33625 const columns = view.fields ?? []; 33626 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 33627 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 33628 "tr", 33629 { 33630 className: dist_clsx("dataviews-view-table__row", { 33631 "is-selected": hasPossibleBulkAction && isSelected, 33632 "is-hovered": isHovered, 33633 "has-bulk-actions": hasPossibleBulkAction 33634 }), 33635 onMouseEnter: handleMouseEnter, 33636 onMouseLeave: handleMouseLeave, 33637 onTouchStart: () => { 33638 isTouchDeviceRef.current = true; 33639 }, 33640 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 33641 "aria-posinset": posinset, 33642 role: infiniteScrollEnabled ? "article" : void 0, 33643 onClick: (event) => { 33644 if (!hasPossibleBulkAction) { 33645 return; 33646 } 33647 if (!isTouchDeviceRef.current && document.getSelection()?.type !== "Range") { 33648 if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) { 33649 onChangeSelection( 33650 selection.includes(id) ? selection.filter( 33651 (itemId) => id !== itemId 33652 ) : [...selection, id] 33653 ); 33654 } else { 33655 onChangeSelection( 33656 selection.includes(id) ? selection.filter( 33657 (itemId) => id !== itemId 33658 ) : [id] 33659 ); 33660 } 33661 } 33662 }, 33663 children: [ 33664 hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33665 DataViewsSelectionCheckbox, 33666 { 33667 item, 33668 selection, 33669 onChangeSelection, 33670 getItemId, 33671 titleField, 33672 disabled: !hasPossibleBulkAction 33673 } 33674 ) }) }), 33675 hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33676 column_primary_default, 33677 { 33678 item, 33679 level, 33680 titleField: showTitle ? titleField : void 0, 33681 mediaField: showMedia ? mediaField : void 0, 33682 descriptionField: showDescription ? descriptionField : void 0, 33683 isItemClickable, 33684 onClickItem, 33685 renderItemLink 33686 } 33687 ) }), 33688 columns.map((column) => { 33689 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 33690 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33691 "td", 33692 { 33693 style: { 33694 width, 33695 maxWidth, 33696 minWidth 33697 }, 33698 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33699 TableColumnField, 33700 { 33701 fields, 33702 item, 33703 column, 33704 align 33705 } 33706 ) 33707 }, 33708 column 33709 ); 33710 }), 33711 !!actions?.length && // Disable reason: we are not making the element interactive, 33712 // but preventing any click events from bubbling up to the 33713 // table row. This allows us to add a click handler to the row 33714 // itself (to toggle row selection) without erroneously 33715 // intercepting click events from ItemActions. 33716 /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ 33717 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33718 "td", 33719 { 33720 className: dist_clsx("dataviews-view-table__actions-column", { 33721 "dataviews-view-table__actions-column--sticky": true, 33722 "dataviews-view-table__actions-column--stuck": isActionsColumnSticky 33723 }), 33724 onClick: (e) => e.stopPropagation(), 33725 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item, actions }) 33726 } 33727 ) 33728 ] 33729 } 33730 ); 33731 } 33732 function ViewTable({ 33733 actions, 33734 data, 33735 fields, 33736 getItemId, 33737 getItemLevel, 33738 isLoading = false, 33739 onChangeView, 33740 onChangeSelection, 33741 selection, 33742 setOpenedFilter, 33743 onClickItem, 33744 isItemClickable, 33745 renderItemLink, 33746 view, 33747 className, 33748 empty 33749 }) { 33750 const { containerRef } = (0,external_wp_element_.useContext)(dataviews_context_default); 33751 const headerMenuRefs = (0,external_wp_element_.useRef)(/* @__PURE__ */ new Map()); 33752 const headerMenuToFocusRef = (0,external_wp_element_.useRef)(); 33753 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_.useState)(); 33754 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 33755 (0,external_wp_element_.useEffect)(() => { 33756 if (headerMenuToFocusRef.current) { 33757 headerMenuToFocusRef.current.focus(); 33758 headerMenuToFocusRef.current = void 0; 33759 } 33760 }); 33761 const tableNoticeId = (0,external_wp_element_.useId)(); 33762 const isHorizontalScrollEnd = useIsHorizontalScrollEnd({ 33763 scrollContainerRef: containerRef, 33764 enabled: !!actions?.length 33765 }); 33766 if (nextHeaderMenuToFocus) { 33767 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 33768 setNextHeaderMenuToFocus(void 0); 33769 return; 33770 } 33771 const onHide = (field) => { 33772 const hidden = headerMenuRefs.current.get(field.id); 33773 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 33774 setNextHeaderMenuToFocus(fallback?.node); 33775 }; 33776 const hasData = !!data?.length; 33777 const titleField = fields.find((field) => field.id === view.titleField); 33778 const mediaField = fields.find((field) => field.id === view.mediaField); 33779 const descriptionField = fields.find( 33780 (field) => field.id === view.descriptionField 33781 ); 33782 const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null; 33783 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 33784 const { showTitle = true, showMedia = true, showDescription = true } = view; 33785 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 33786 const columns = view.fields ?? []; 33787 const headerMenuRef = (column, index) => (node) => { 33788 if (node) { 33789 headerMenuRefs.current.set(column, { 33790 node, 33791 fallback: columns[index > 0 ? index - 1 : 1] 33792 }); 33793 } else { 33794 headerMenuRefs.current.delete(column); 33795 } 33796 }; 33797 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 33798 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 33799 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 33800 "table", 33801 { 33802 className: dist_clsx("dataviews-view-table", className, { 33803 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 33804 view.layout.density 33805 ) 33806 }), 33807 "aria-busy": isLoading, 33808 "aria-describedby": tableNoticeId, 33809 role: isInfiniteScroll ? "feed" : void 0, 33810 children: [ 33811 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { className: "dataviews-view-table__row", children: [ 33812 hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33813 "th", 33814 { 33815 className: "dataviews-view-table__checkbox-column", 33816 scope: "col", 33817 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33818 BulkSelectionCheckbox, 33819 { 33820 selection, 33821 onChangeSelection, 33822 data, 33823 actions, 33824 getItemId 33825 } 33826 ) 33827 } 33828 ), 33829 hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33830 column_header_menu_default, 33831 { 33832 ref: headerMenuRef( 33833 titleField.id, 33834 0 33835 ), 33836 fieldId: titleField.id, 33837 view, 33838 fields, 33839 onChangeView, 33840 onHide, 33841 setOpenedFilter, 33842 canMove: false 33843 } 33844 ) }), 33845 columns.map((column, index) => { 33846 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 33847 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33848 "th", 33849 { 33850 style: { 33851 width, 33852 maxWidth, 33853 minWidth, 33854 textAlign: align 33855 }, 33856 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 33857 scope: "col", 33858 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33859 column_header_menu_default, 33860 { 33861 ref: headerMenuRef(column, index), 33862 fieldId: column, 33863 view, 33864 fields, 33865 onChangeView, 33866 onHide, 33867 setOpenedFilter, 33868 canMove: view.layout?.enableMoving ?? true 33869 } 33870 ) 33871 }, 33872 column 33873 ); 33874 }), 33875 !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33876 "th", 33877 { 33878 className: dist_clsx( 33879 "dataviews-view-table__actions-column", 33880 { 33881 "dataviews-view-table__actions-column--sticky": true, 33882 "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd 33883 } 33884 ), 33885 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-table-header", children: (0,external_wp_i18n_namespaceObject.__)("Actions") }) 33886 } 33887 ) 33888 ] }) }), 33889 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 33890 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tbody", { children: [ 33891 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33892 "td", 33893 { 33894 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0), 33895 className: "dataviews-view-table__group-header-cell", 33896 children: (0,external_wp_i18n_namespaceObject.sprintf)( 33897 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 33898 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), 33899 groupField.label, 33900 groupName 33901 ) 33902 } 33903 ) }), 33904 groupItems.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33905 TableRow, 33906 { 33907 item, 33908 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 33909 hasBulkActions, 33910 actions, 33911 fields, 33912 id: getItemId(item) || index.toString(), 33913 view, 33914 titleField, 33915 mediaField, 33916 descriptionField, 33917 selection, 33918 getItemId, 33919 onChangeSelection, 33920 onClickItem, 33921 renderItemLink, 33922 isItemClickable, 33923 isActionsColumnSticky: !isHorizontalScrollEnd 33924 }, 33925 getItemId(item) 33926 )) 33927 ] }, `group-$groupName}`) 33928 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { children: hasData && data.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33929 TableRow, 33930 { 33931 item, 33932 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 33933 hasBulkActions, 33934 actions, 33935 fields, 33936 id: getItemId(item) || index.toString(), 33937 view, 33938 titleField, 33939 mediaField, 33940 descriptionField, 33941 selection, 33942 getItemId, 33943 onChangeSelection, 33944 onClickItem, 33945 renderItemLink, 33946 isItemClickable, 33947 isActionsColumnSticky: !isHorizontalScrollEnd, 33948 posinset: isInfiniteScroll ? index + 1 : void 0 33949 }, 33950 getItemId(item) 33951 )) }) 33952 ] 33953 } 33954 ), 33955 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 33956 "div", 33957 { 33958 className: dist_clsx({ 33959 "dataviews-loading": isLoading, 33960 "dataviews-no-results": !hasData && !isLoading 33961 }), 33962 id: tableNoticeId, 33963 children: [ 33964 !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty), 33965 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) 33966 ] 33967 } 33968 ) 33969 ] }); 33970 } 33971 var table_default = ViewTable; 33972 33973 33974 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/grid-items.js 33975 33976 33977 33978 const GridItems = (0,external_wp_element_.forwardRef)(({ className, previewSize, ...props }, ref) => { 33979 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33980 "div", 33981 { 33982 ref, 33983 className: dist_clsx("dataviews-view-grid-items", className), 33984 style: { 33985 gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))` 33986 }, 33987 ...props 33988 } 33989 ); 33990 }); 33991 33992 33993 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js 33994 33995 33996 33997 33998 33999 34000 34001 34002 34003 34004 34005 34006 34007 34008 const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 34009 34010 function GridItem({ 34011 view, 34012 selection, 34013 onChangeSelection, 34014 onClickItem, 34015 isItemClickable, 34016 renderItemLink, 34017 getItemId, 34018 item, 34019 actions, 34020 mediaField, 34021 titleField, 34022 descriptionField, 34023 regularFields, 34024 badgeFields, 34025 hasBulkActions, 34026 config, 34027 posinset 34028 }) { 34029 const { 34030 showTitle = true, 34031 showMedia = true, 34032 showDescription = true, 34033 infiniteScrollEnabled 34034 } = view; 34035 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 34036 const id = getItemId(item); 34037 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItem); 34038 const isSelected = selection.includes(id); 34039 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34040 mediaField.render, 34041 { 34042 item, 34043 field: mediaField, 34044 config 34045 } 34046 ) : null; 34047 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null; 34048 const shouldRenderMedia = showMedia && renderedMediaField; 34049 let mediaA11yProps; 34050 let titleA11yProps; 34051 if (isItemClickable(item) && onClickItem) { 34052 if (renderedTitleField) { 34053 mediaA11yProps = { 34054 "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}` 34055 }; 34056 titleA11yProps = { 34057 id: `dataviews-view-grid__title-field-$instanceId}` 34058 }; 34059 } else { 34060 mediaA11yProps = { 34061 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Navigate to item") 34062 }; 34063 } 34064 } 34065 const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default); 34066 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 34067 external_wp_components_namespaceObject.__experimentalVStack, 34068 { 34069 spacing: 0, 34070 className: dist_clsx("dataviews-view-grid__card", { 34071 "is-selected": hasBulkAction && isSelected 34072 }), 34073 onClickCapture: (event) => { 34074 if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) { 34075 event.stopPropagation(); 34076 event.preventDefault(); 34077 if (!hasBulkAction) { 34078 return; 34079 } 34080 onChangeSelection( 34081 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] 34082 ); 34083 } 34084 }, 34085 role: infiniteScrollEnabled ? "article" : void 0, 34086 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 34087 "aria-posinset": posinset, 34088 children: [ 34089 shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34090 ItemClickWrapper, 34091 { 34092 item, 34093 isItemClickable, 34094 onClickItem, 34095 renderItemLink, 34096 className: "dataviews-view-grid__media", 34097 ...mediaA11yProps, 34098 children: renderedMediaField 34099 } 34100 ), 34101 hasBulkActions && shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34102 DataViewsSelectionCheckbox, 34103 { 34104 item, 34105 selection, 34106 onChangeSelection, 34107 getItemId, 34108 titleField, 34109 disabled: !hasBulkAction 34110 } 34111 ), 34112 !showTitle && shouldRenderMedia && !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item, actions, isCompact: true }) }), 34113 showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 34114 external_wp_components_namespaceObject.__experimentalHStack, 34115 { 34116 justify: "space-between", 34117 className: "dataviews-view-grid__title-actions", 34118 children: [ 34119 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34120 ItemClickWrapper, 34121 { 34122 item, 34123 isItemClickable, 34124 onClickItem, 34125 renderItemLink, 34126 className: "dataviews-view-grid__title-field dataviews-title-field", 34127 ...titleA11yProps, 34128 children: renderedTitleField 34129 } 34130 ), 34131 !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34132 ItemActions, 34133 { 34134 item, 34135 actions, 34136 isCompact: true 34137 } 34138 ) 34139 ] 34140 } 34141 ), 34142 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ 34143 showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34144 descriptionField.render, 34145 { 34146 item, 34147 field: descriptionField 34148 } 34149 ), 34150 !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34151 external_wp_components_namespaceObject.__experimentalHStack, 34152 { 34153 className: "dataviews-view-grid__badge-fields", 34154 spacing: 2, 34155 wrap: true, 34156 alignment: "top", 34157 justify: "flex-start", 34158 children: badgeFields.map((field) => { 34159 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34160 Badge, 34161 { 34162 className: "dataviews-view-grid__field-value", 34163 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34164 field.render, 34165 { 34166 item, 34167 field 34168 } 34169 ) 34170 }, 34171 field.id 34172 ); 34173 }) 34174 } 34175 ), 34176 !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34177 external_wp_components_namespaceObject.__experimentalVStack, 34178 { 34179 className: "dataviews-view-grid__fields", 34180 spacing: 1, 34181 children: regularFields.map((field) => { 34182 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34183 external_wp_components_namespaceObject.Flex, 34184 { 34185 className: "dataviews-view-grid__field", 34186 gap: 1, 34187 justify: "flex-start", 34188 expanded: true, 34189 style: { height: "auto" }, 34190 direction: "row", 34191 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 34192 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: field.label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) }), 34193 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34194 external_wp_components_namespaceObject.FlexItem, 34195 { 34196 className: "dataviews-view-grid__field-value", 34197 style: { maxHeight: "none" }, 34198 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34199 field.render, 34200 { 34201 item, 34202 field 34203 } 34204 ) 34205 } 34206 ) 34207 ] }) 34208 }, 34209 field.id 34210 ); 34211 }) 34212 } 34213 ) 34214 ] }) 34215 ] 34216 }, 34217 id 34218 ); 34219 } 34220 function ViewGrid({ 34221 actions, 34222 data, 34223 fields, 34224 getItemId, 34225 isLoading, 34226 onChangeSelection, 34227 onClickItem, 34228 isItemClickable, 34229 renderItemLink, 34230 selection, 34231 view, 34232 className, 34233 empty 34234 }) { 34235 const { resizeObserverRef } = (0,external_wp_element_.useContext)(dataviews_context_default); 34236 const titleField = fields.find( 34237 (field) => field.id === view?.titleField 34238 ); 34239 const mediaField = fields.find( 34240 (field) => field.id === view?.mediaField 34241 ); 34242 const descriptionField = fields.find( 34243 (field) => field.id === view?.descriptionField 34244 ); 34245 const otherFields = view.fields ?? []; 34246 const { regularFields, badgeFields } = otherFields.reduce( 34247 (accumulator, fieldId) => { 34248 const field = fields.find((f) => f.id === fieldId); 34249 if (!field) { 34250 return accumulator; 34251 } 34252 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 34253 accumulator[key].push(field); 34254 return accumulator; 34255 }, 34256 { regularFields: [], badgeFields: [] } 34257 ); 34258 const hasData = !!data?.length; 34259 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 34260 const usedPreviewSize = view.layout?.previewSize; 34261 const size = "900px"; 34262 const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null; 34263 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 34264 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 34265 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34266 // Render multiple groups. 34267 children: [ 34268 hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: Array.from(dataByGroup.entries()).map( 34269 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ 34270 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-grid__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)( 34271 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 34272 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), 34273 groupField.label, 34274 groupName 34275 ) }), 34276 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34277 GridItems, 34278 { 34279 className: dist_clsx( 34280 "dataviews-view-grid", 34281 className 34282 ), 34283 previewSize: usedPreviewSize, 34284 "aria-busy": isLoading, 34285 ref: resizeObserverRef, 34286 children: groupItems.map((item) => { 34287 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34288 GridItem, 34289 { 34290 view, 34291 selection, 34292 onChangeSelection, 34293 onClickItem, 34294 isItemClickable, 34295 renderItemLink, 34296 getItemId, 34297 item, 34298 actions, 34299 mediaField, 34300 titleField, 34301 descriptionField, 34302 regularFields, 34303 badgeFields, 34304 hasBulkActions, 34305 config: { 34306 sizes: size 34307 } 34308 }, 34309 getItemId(item) 34310 ); 34311 }) 34312 } 34313 ) 34314 ] }, groupName) 34315 ) }), 34316 // Render a single grid with all data. 34317 hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34318 GridItems, 34319 { 34320 className: dist_clsx("dataviews-view-grid", className), 34321 previewSize: usedPreviewSize, 34322 "aria-busy": isLoading, 34323 ref: resizeObserverRef, 34324 role: isInfiniteScroll ? "feed" : void 0, 34325 children: data.map((item, index) => { 34326 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34327 GridItem, 34328 { 34329 view, 34330 selection, 34331 onChangeSelection, 34332 onClickItem, 34333 isItemClickable, 34334 renderItemLink, 34335 getItemId, 34336 item, 34337 actions, 34338 mediaField, 34339 titleField, 34340 descriptionField, 34341 regularFields, 34342 badgeFields, 34343 hasBulkActions, 34344 config: { 34345 sizes: size 34346 }, 34347 posinset: isInfiniteScroll ? index + 1 : void 0 34348 }, 34349 getItemId(item) 34350 ); 34351 }) 34352 } 34353 ), 34354 // Render empty state. 34355 !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34356 "div", 34357 { 34358 className: dist_clsx({ 34359 "dataviews-loading": isLoading, 34360 "dataviews-no-results": !isLoading 34361 }), 34362 children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty 34363 } 34364 ), 34365 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) 34366 ] 34367 }); 34368 } 34369 var grid_default = ViewGrid; 34370 34371 34372 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js 34373 34374 34375 34376 34377 34378 34379 34380 34381 34382 34383 34384 34385 const { Menu: list_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 34386 function generateItemWrapperCompositeId(idPrefix) { 34387 return `$idPrefix}-item-wrapper`; 34388 } 34389 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 34390 return `$idPrefix}-primary-action-$primaryActionId}`; 34391 } 34392 function generateDropdownTriggerCompositeId(idPrefix) { 34393 return `$idPrefix}-dropdown`; 34394 } 34395 function PrimaryActionGridCell({ 34396 idPrefix, 34397 primaryAction, 34398 item 34399 }) { 34400 const registry = (0,external_wp_data_.useRegistry)(); 34401 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false); 34402 const compositeItemId = generatePrimaryActionCompositeId( 34403 idPrefix, 34404 primaryAction.id 34405 ); 34406 const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]); 34407 return "RenderModal" in primaryAction ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34408 external_wp_components_namespaceObject.Composite.Item, 34409 { 34410 id: compositeItemId, 34411 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34412 external_wp_components_namespaceObject.Button, 34413 { 34414 disabled: !!primaryAction.disabled, 34415 accessibleWhenDisabled: true, 34416 size: "small", 34417 onClick: () => setIsModalOpen(true), 34418 variant: "link", 34419 children: label 34420 } 34421 ), 34422 children: isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34423 ActionModal, 34424 { 34425 action: primaryAction, 34426 items: [item], 34427 closeModal: () => setIsModalOpen(false) 34428 } 34429 ) 34430 } 34431 ) }, primaryAction.id) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34432 external_wp_components_namespaceObject.Composite.Item, 34433 { 34434 id: compositeItemId, 34435 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34436 external_wp_components_namespaceObject.Button, 34437 { 34438 disabled: !!primaryAction.disabled, 34439 accessibleWhenDisabled: true, 34440 size: "small", 34441 onClick: () => { 34442 primaryAction.callback([item], { registry }); 34443 }, 34444 variant: "link", 34445 children: label 34446 } 34447 ) 34448 } 34449 ) }, primaryAction.id); 34450 } 34451 function ListItem({ 34452 view, 34453 actions, 34454 idPrefix, 34455 isSelected, 34456 item, 34457 titleField, 34458 mediaField, 34459 descriptionField, 34460 onSelect, 34461 otherFields, 34462 onDropdownTriggerKeyDown, 34463 posinset 34464 }) { 34465 const { 34466 showTitle = true, 34467 showMedia = true, 34468 showDescription = true, 34469 infiniteScrollEnabled 34470 } = view; 34471 const itemRef = (0,external_wp_element_.useRef)(null); 34472 const labelId = `$idPrefix}-label`; 34473 const descriptionId = `$idPrefix}-description`; 34474 const registry = (0,external_wp_data_.useRegistry)(); 34475 const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false); 34476 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)( 34477 null 34478 ); 34479 const handleHover = ({ type }) => { 34480 const isHover = type === "mouseenter"; 34481 setIsHovered(isHover); 34482 }; 34483 const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default); 34484 (0,external_wp_element_.useEffect)(() => { 34485 if (isSelected) { 34486 itemRef.current?.scrollIntoView({ 34487 behavior: "auto", 34488 block: "nearest", 34489 inline: "nearest" 34490 }); 34491 } 34492 }, [isSelected]); 34493 const { primaryAction, eligibleActions } = (0,external_wp_element_.useMemo)(() => { 34494 const _eligibleActions = actions.filter( 34495 (action) => !action.isEligible || action.isEligible(item) 34496 ); 34497 const _primaryActions = _eligibleActions.filter( 34498 (action) => action.isPrimary 34499 ); 34500 return { 34501 primaryAction: _primaryActions[0], 34502 eligibleActions: _eligibleActions 34503 }; 34504 }, [actions, item]); 34505 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; 34506 const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34507 mediaField.render, 34508 { 34509 item, 34510 field: mediaField, 34511 config: { sizes: "52px" } 34512 } 34513 ) }) : null; 34514 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null; 34515 const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, className: "dataviews-view-list__item-actions", children: [ 34516 primaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34517 PrimaryActionGridCell, 34518 { 34519 idPrefix, 34520 primaryAction, 34521 item 34522 } 34523 ), 34524 !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { role: "gridcell", children: [ 34525 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(list_Menu, { placement: "bottom-end", children: [ 34526 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34527 list_Menu.TriggerButton, 34528 { 34529 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34530 external_wp_components_namespaceObject.Composite.Item, 34531 { 34532 id: generateDropdownTriggerCompositeId( 34533 idPrefix 34534 ), 34535 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34536 external_wp_components_namespaceObject.Button, 34537 { 34538 size: "small", 34539 icon: more_vertical_default, 34540 label: (0,external_wp_i18n_namespaceObject.__)("Actions"), 34541 accessibleWhenDisabled: true, 34542 disabled: !actions.length, 34543 onKeyDown: onDropdownTriggerKeyDown 34544 } 34545 ) 34546 } 34547 ) 34548 } 34549 ), 34550 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34551 ActionsMenuGroup, 34552 { 34553 actions: eligibleActions, 34554 item, 34555 registry, 34556 setActiveModalAction 34557 } 34558 ) }) 34559 ] }), 34560 !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34561 ActionModal, 34562 { 34563 action: activeModalAction, 34564 items: [item], 34565 closeModal: () => setActiveModalAction(null) 34566 } 34567 ) 34568 ] }) 34569 ] }); 34570 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34571 external_wp_components_namespaceObject.Composite.Row, 34572 { 34573 ref: itemRef, 34574 render: ( 34575 /* aria-posinset breaks Composite.Row if passed to it directly. */ 34576 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34577 "div", 34578 { 34579 "aria-posinset": posinset, 34580 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0 34581 } 34582 ) 34583 ), 34584 role: infiniteScrollEnabled ? "article" : "row", 34585 className: dist_clsx({ 34586 "is-selected": isSelected, 34587 "is-hovered": isHovered 34588 }), 34589 onMouseEnter: handleHover, 34590 onMouseLeave: handleHover, 34591 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-list__item-wrapper", spacing: 0, children: [ 34592 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34593 external_wp_components_namespaceObject.Composite.Item, 34594 { 34595 id: generateItemWrapperCompositeId(idPrefix), 34596 "aria-pressed": isSelected, 34597 "aria-labelledby": labelId, 34598 "aria-describedby": descriptionId, 34599 className: "dataviews-view-list__item", 34600 onClick: () => onSelect(item) 34601 } 34602 ) }), 34603 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "start", alignment: "flex-start", children: [ 34604 renderedMediaField, 34605 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 34606 external_wp_components_namespaceObject.__experimentalVStack, 34607 { 34608 spacing: 1, 34609 className: "dataviews-view-list__field-wrapper", 34610 children: [ 34611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, children: [ 34612 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34613 "div", 34614 { 34615 className: "dataviews-title-field", 34616 id: labelId, 34617 children: renderedTitleField 34618 } 34619 ), 34620 usedActions 34621 ] }), 34622 showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34623 descriptionField.render, 34624 { 34625 item, 34626 field: descriptionField 34627 } 34628 ) }), 34629 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34630 "div", 34631 { 34632 className: "dataviews-view-list__fields", 34633 id: descriptionId, 34634 children: otherFields.map((field) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 34635 "div", 34636 { 34637 className: "dataviews-view-list__field", 34638 children: [ 34639 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34640 external_wp_components_namespaceObject.VisuallyHidden, 34641 { 34642 as: "span", 34643 className: "dataviews-view-list__field-label", 34644 children: field.label 34645 } 34646 ), 34647 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34648 field.render, 34649 { 34650 item, 34651 field 34652 } 34653 ) }) 34654 ] 34655 }, 34656 field.id 34657 )) 34658 } 34659 ) 34660 ] 34661 } 34662 ) 34663 ] }) 34664 ] }) 34665 } 34666 ); 34667 } 34668 function isDefined(item) { 34669 return !!item; 34670 } 34671 function ViewList(props) { 34672 const { 34673 actions, 34674 data, 34675 fields, 34676 getItemId, 34677 isLoading, 34678 onChangeSelection, 34679 selection, 34680 view, 34681 className, 34682 empty 34683 } = props; 34684 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, "view-list"); 34685 const selectedItem = data?.findLast( 34686 (item) => selection.includes(getItemId(item)) 34687 ); 34688 const titleField = fields.find((field) => field.id === view.titleField); 34689 const mediaField = fields.find((field) => field.id === view.mediaField); 34690 const descriptionField = fields.find( 34691 (field) => field.id === view.descriptionField 34692 ); 34693 const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f) => fieldId === f.id)).filter(isDefined); 34694 const onSelect = (item) => onChangeSelection([getItemId(item)]); 34695 const generateCompositeItemIdPrefix = (0,external_wp_element_.useCallback)( 34696 (item) => `$baseId}-$getItemId(item)}`, 34697 [baseId, getItemId] 34698 ); 34699 const isActiveCompositeItem = (0,external_wp_element_.useCallback)( 34700 (item, idToCheck) => { 34701 return idToCheck.startsWith( 34702 generateCompositeItemIdPrefix(item) 34703 ); 34704 }, 34705 [generateCompositeItemIdPrefix] 34706 ); 34707 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_.useState)(void 0); 34708 (0,external_wp_element_.useEffect)(() => { 34709 if (selectedItem) { 34710 setActiveCompositeId( 34711 generateItemWrapperCompositeId( 34712 generateCompositeItemIdPrefix(selectedItem) 34713 ) 34714 ); 34715 } 34716 }, [selectedItem, generateCompositeItemIdPrefix]); 34717 const activeItemIndex = data.findIndex( 34718 (item) => isActiveCompositeItem(item, activeCompositeId ?? "") 34719 ); 34720 const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex); 34721 const isActiveIdInList = activeItemIndex !== -1; 34722 const selectCompositeItem = (0,external_wp_element_.useCallback)( 34723 (targetIndex, generateCompositeId) => { 34724 const clampedIndex = Math.min( 34725 data.length - 1, 34726 Math.max(0, targetIndex) 34727 ); 34728 if (!data[clampedIndex]) { 34729 return; 34730 } 34731 const itemIdPrefix = generateCompositeItemIdPrefix( 34732 data[clampedIndex] 34733 ); 34734 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 34735 setActiveCompositeId(targetCompositeItemId); 34736 document.getElementById(targetCompositeItemId)?.focus(); 34737 }, 34738 [data, generateCompositeItemIdPrefix] 34739 ); 34740 (0,external_wp_element_.useEffect)(() => { 34741 const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1; 34742 if (!isActiveIdInList && wasActiveIdInList) { 34743 selectCompositeItem( 34744 previousActiveItemIndex, 34745 generateItemWrapperCompositeId 34746 ); 34747 } 34748 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 34749 const onDropdownTriggerKeyDown = (0,external_wp_element_.useCallback)( 34750 (event) => { 34751 if (event.key === "ArrowDown") { 34752 event.preventDefault(); 34753 selectCompositeItem( 34754 activeItemIndex + 1, 34755 generateDropdownTriggerCompositeId 34756 ); 34757 } 34758 if (event.key === "ArrowUp") { 34759 event.preventDefault(); 34760 selectCompositeItem( 34761 activeItemIndex - 1, 34762 generateDropdownTriggerCompositeId 34763 ); 34764 } 34765 }, 34766 [selectCompositeItem, activeItemIndex] 34767 ); 34768 const hasData = data?.length; 34769 if (!hasData) { 34770 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34771 "div", 34772 { 34773 className: dist_clsx({ 34774 "dataviews-loading": isLoading, 34775 "dataviews-no-results": !hasData && !isLoading 34776 }), 34777 children: !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty) 34778 } 34779 ); 34780 } 34781 const groupField = view.groupByField ? fields.find((field) => field.id === view.groupByField) : null; 34782 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 34783 if (hasData && groupField && dataByGroup) { 34784 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34785 external_wp_components_namespaceObject.Composite, 34786 { 34787 id: `$baseId}`, 34788 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 34789 className: "dataviews-view-list__group", 34790 role: "grid", 34791 activeId: activeCompositeId, 34792 setActiveId: setActiveCompositeId, 34793 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34794 external_wp_components_namespaceObject.__experimentalVStack, 34795 { 34796 spacing: 4, 34797 className: dist_clsx("dataviews-view-list", className), 34798 children: Array.from(dataByGroup.entries()).map( 34799 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ 34800 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-list__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)( 34801 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 34802 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), 34803 groupField.label, 34804 groupName 34805 ) }), 34806 groupItems.map((item) => { 34807 const id = generateCompositeItemIdPrefix(item); 34808 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34809 ListItem, 34810 { 34811 view, 34812 idPrefix: id, 34813 actions, 34814 item, 34815 isSelected: item === selectedItem, 34816 onSelect, 34817 mediaField, 34818 titleField, 34819 descriptionField, 34820 otherFields, 34821 onDropdownTriggerKeyDown 34822 }, 34823 id 34824 ); 34825 }) 34826 ] }, groupName) 34827 ) 34828 } 34829 ) 34830 } 34831 ); 34832 } 34833 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 34834 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34835 external_wp_components_namespaceObject.Composite, 34836 { 34837 id: baseId, 34838 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 34839 className: dist_clsx("dataviews-view-list", className), 34840 role: view.infiniteScrollEnabled ? "feed" : "grid", 34841 activeId: activeCompositeId, 34842 setActiveId: setActiveCompositeId, 34843 children: data.map((item, index) => { 34844 const id = generateCompositeItemIdPrefix(item); 34845 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34846 ListItem, 34847 { 34848 view, 34849 idPrefix: id, 34850 actions, 34851 item, 34852 isSelected: item === selectedItem, 34853 onSelect, 34854 mediaField, 34855 titleField, 34856 descriptionField, 34857 otherFields, 34858 onDropdownTriggerKeyDown, 34859 posinset: view.infiniteScrollEnabled ? index + 1 : void 0 34860 }, 34861 id 34862 ); 34863 }) 34864 } 34865 ), 34866 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) 34867 ] }); 34868 } 34869 34870 34871 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-picker/footer.js 34872 34873 34874 34875 34876 34877 34878 34879 const footer_EMPTY_ARRAY = (/* unused pure expression or super */ null && ([])); 34880 function useIsMultiselectPicker(actions) { 34881 return (0,external_wp_element_.useMemo)(() => { 34882 return actions?.every((action) => action.supportsBulk); 34883 }, [actions]); 34884 } 34885 function footer_BulkSelectionCheckbox({ 34886 selection, 34887 selectedItems, 34888 onChangeSelection, 34889 data, 34890 getItemId 34891 }) { 34892 const areAllSelected = selectedItems.length === data.length; 34893 return /* @__PURE__ */ jsx( 34894 CheckboxControl, 34895 { 34896 className: "dataviews-view-table-selection-checkbox", 34897 __nextHasNoMarginBottom: true, 34898 checked: areAllSelected, 34899 indeterminate: !areAllSelected && !!selectedItems.length, 34900 onChange: () => { 34901 if (areAllSelected) { 34902 onChangeSelection( 34903 selection.filter( 34904 (id) => !data.some( 34905 (item) => id === getItemId(item) 34906 ) 34907 ) 34908 ); 34909 } else { 34910 const selectionSet = /* @__PURE__ */ new Set([ 34911 ...selection, 34912 ...data.map((item) => getItemId(item)) 34913 ]); 34914 onChangeSelection(Array.from(selectionSet)); 34915 } 34916 }, 34917 "aria-label": areAllSelected ? __("Deselect all") : __("Select all") 34918 } 34919 ); 34920 } 34921 function ActionButtons({ 34922 actions, 34923 items, 34924 selection 34925 }) { 34926 const registry = useRegistry(); 34927 const [actionInProgress, setActionInProgress] = useState( 34928 null 34929 ); 34930 return /* @__PURE__ */ jsx(HStack, { expanded: false, spacing: 1, children: actions.map((action) => { 34931 if (!("callback" in action)) { 34932 return null; 34933 } 34934 const { id, label, icon, isPrimary, callback } = action; 34935 const _label = typeof label === "string" ? label : label(items); 34936 const variant = isPrimary ? "primary" : "tertiary"; 34937 const isInProgress = id === actionInProgress; 34938 return /* @__PURE__ */ jsx( 34939 Button, 34940 { 34941 accessibleWhenDisabled: true, 34942 icon, 34943 disabled: isInProgress || !selection?.length, 34944 isBusy: isInProgress, 34945 onClick: async () => { 34946 setActionInProgress(id); 34947 await callback(items, { 34948 registry 34949 }); 34950 setActionInProgress(null); 34951 }, 34952 size: "compact", 34953 variant, 34954 children: _label 34955 }, 34956 id 34957 ); 34958 }) }); 34959 } 34960 function DataViewsPickerFooter() { 34961 const { 34962 data, 34963 selection, 34964 onChangeSelection, 34965 getItemId, 34966 actions = footer_EMPTY_ARRAY 34967 } = useContext(DataViewsContext); 34968 const selectionCount = selection.length; 34969 const isMultiselect = useIsMultiselectPicker(actions); 34970 const message = selectionCount > 0 ? sprintf( 34971 /* translators: %d: number of items. */ 34972 _n( 34973 "%d Item selected", 34974 "%d Items selected", 34975 selectionCount 34976 ), 34977 selectionCount 34978 ) : sprintf( 34979 /* translators: %d: number of items. */ 34980 _n("%d Item", "%d Items", data.length), 34981 data.length 34982 ); 34983 const selectedItems = useMemo( 34984 () => data.filter((item) => selection.includes(getItemId(item))), 34985 [selection, getItemId, data] 34986 ); 34987 return /* @__PURE__ */ jsxs( 34988 HStack, 34989 { 34990 expanded: false, 34991 justify: "space-between", 34992 className: "dataviews-footer", 34993 children: [ 34994 /* @__PURE__ */ jsxs( 34995 HStack, 34996 { 34997 className: "dataviews-picker-footer__bulk-selection", 34998 expanded: false, 34999 spacing: 3, 35000 children: [ 35001 isMultiselect && /* @__PURE__ */ jsx( 35002 footer_BulkSelectionCheckbox, 35003 { 35004 selection, 35005 selectedItems, 35006 onChangeSelection, 35007 data, 35008 getItemId 35009 } 35010 ), 35011 /* @__PURE__ */ jsx("span", { className: "dataviews-bulk-actions-footer__item-count", children: message }) 35012 ] 35013 } 35014 ), 35015 /* @__PURE__ */ jsx(DataViewsPagination, {}), 35016 Boolean(actions?.length) && /* @__PURE__ */ jsx("div", { className: "dataviews-picker-footer__actions", children: /* @__PURE__ */ jsx( 35017 ActionButtons, 35018 { 35019 actions, 35020 items: selectedItems, 35021 selection 35022 } 35023 ) }) 35024 ] 35025 } 35026 ); 35027 } 35028 35029 35030 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/picker-grid/index.js 35031 35032 35033 35034 35035 35036 35037 35038 35039 35040 35041 35042 const { Badge: picker_grid_Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 35043 35044 function picker_grid_GridItem({ 35045 view, 35046 multiselect, 35047 selection, 35048 onChangeSelection, 35049 getItemId, 35050 item, 35051 mediaField, 35052 titleField, 35053 descriptionField, 35054 regularFields, 35055 badgeFields, 35056 config, 35057 posinset, 35058 setsize 35059 }) { 35060 const { showTitle = true, showMedia = true, showDescription = true } = view; 35061 const id = getItemId(item); 35062 const isSelected = selection.includes(id); 35063 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35064 mediaField.render, 35065 { 35066 item, 35067 field: mediaField, 35068 config 35069 } 35070 ) : null; 35071 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null; 35072 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 35073 external_wp_components_namespaceObject.Composite.Item, 35074 { 35075 "aria-label": titleField ? titleField.getValue({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)") : void 0, 35076 render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children, ...props }), 35077 role: "option", 35078 "aria-posinset": posinset, 35079 "aria-setsize": setsize, 35080 className: dist_clsx("dataviews-view-picker-grid__card", { 35081 "is-selected": isSelected 35082 }), 35083 "aria-selected": isSelected, 35084 onClick: () => { 35085 if (isSelected) { 35086 onChangeSelection( 35087 selection.filter((itemId) => id !== itemId) 35088 ); 35089 } else { 35090 const newSelection = multiselect ? [...selection, id] : [id]; 35091 onChangeSelection(newSelection); 35092 } 35093 }, 35094 children: [ 35095 showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }), 35096 showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35097 DataViewsSelectionCheckbox, 35098 { 35099 item, 35100 selection, 35101 onChangeSelection, 35102 getItemId, 35103 titleField, 35104 disabled: false, 35105 "aria-hidden": true, 35106 tabIndex: -1 35107 } 35108 ), 35109 showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35110 external_wp_components_namespaceObject.__experimentalHStack, 35111 { 35112 justify: "space-between", 35113 className: "dataviews-view-picker-grid__title-actions", 35114 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField }) 35115 } 35116 ), 35117 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ 35118 showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35119 descriptionField.render, 35120 { 35121 item, 35122 field: descriptionField 35123 } 35124 ), 35125 !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35126 external_wp_components_namespaceObject.__experimentalHStack, 35127 { 35128 className: "dataviews-view-picker-grid__badge-fields", 35129 spacing: 2, 35130 wrap: true, 35131 alignment: "top", 35132 justify: "flex-start", 35133 children: badgeFields.map((field) => { 35134 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35135 picker_grid_Badge, 35136 { 35137 className: "dataviews-view-picker-grid__field-value", 35138 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35139 field.render, 35140 { 35141 item, 35142 field 35143 } 35144 ) 35145 }, 35146 field.id 35147 ); 35148 }) 35149 } 35150 ), 35151 !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35152 external_wp_components_namespaceObject.__experimentalVStack, 35153 { 35154 className: "dataviews-view-picker-grid__fields", 35155 spacing: 1, 35156 children: regularFields.map((field) => { 35157 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35158 external_wp_components_namespaceObject.Flex, 35159 { 35160 className: "dataviews-view-picker-grid__field", 35161 gap: 1, 35162 justify: "flex-start", 35163 expanded: true, 35164 style: { height: "auto" }, 35165 direction: "row", 35166 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 35167 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }), 35168 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35169 external_wp_components_namespaceObject.FlexItem, 35170 { 35171 className: "dataviews-view-picker-grid__field-value", 35172 style: { maxHeight: "none" }, 35173 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35174 field.render, 35175 { 35176 item, 35177 field 35178 } 35179 ) 35180 } 35181 ) 35182 ] }) 35183 }, 35184 field.id 35185 ); 35186 }) 35187 } 35188 ) 35189 ] }) 35190 ] 35191 }, 35192 id 35193 ); 35194 } 35195 function GridGroup({ 35196 groupName, 35197 groupField, 35198 children 35199 }) { 35200 const headerId = (0,external_wp_compose_namespaceObject.useInstanceId)( 35201 GridGroup, 35202 "dataviews-view-picker-grid-group__header" 35203 ); 35204 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 35205 external_wp_components_namespaceObject.__experimentalVStack, 35206 { 35207 spacing: 2, 35208 role: "group", 35209 "aria-labelledby": headerId, 35210 children: [ 35211 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35212 "h3", 35213 { 35214 className: "dataviews-view-picker-grid-group__header", 35215 id: headerId, 35216 children: (0,external_wp_i18n_namespaceObject.sprintf)( 35217 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 35218 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), 35219 groupField.label, 35220 groupName 35221 ) 35222 } 35223 ), 35224 children 35225 ] 35226 }, 35227 groupName 35228 ); 35229 } 35230 function ViewPickerGrid({ 35231 actions, 35232 data, 35233 fields, 35234 getItemId, 35235 isLoading, 35236 onChangeSelection, 35237 selection, 35238 view, 35239 className, 35240 empty 35241 }) { 35242 const { resizeObserverRef, paginationInfo, itemListLabel } = (0,external_wp_element_.useContext)(dataviews_context_default); 35243 const titleField = fields.find( 35244 (field) => field.id === view?.titleField 35245 ); 35246 const mediaField = fields.find( 35247 (field) => field.id === view?.mediaField 35248 ); 35249 const descriptionField = fields.find( 35250 (field) => field.id === view?.descriptionField 35251 ); 35252 const otherFields = view.fields ?? []; 35253 const { regularFields, badgeFields } = otherFields.reduce( 35254 (accumulator, fieldId) => { 35255 const field = fields.find((f) => f.id === fieldId); 35256 if (!field) { 35257 return accumulator; 35258 } 35259 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 35260 accumulator[key].push(field); 35261 return accumulator; 35262 }, 35263 { regularFields: [], badgeFields: [] } 35264 ); 35265 const hasData = !!data?.length; 35266 const usedPreviewSize = view.layout?.previewSize; 35267 const isMultiselect = useIsMultiselectPicker(actions); 35268 const size = "900px"; 35269 const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null; 35270 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 35271 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 35272 const currentPage = view?.page ?? 1; 35273 const perPage = view?.perPage ?? 0; 35274 const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 35275 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35276 // Render multiple groups. 35277 children: [ 35278 hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35279 external_wp_components_namespaceObject.Composite, 35280 { 35281 virtualFocus: true, 35282 orientation: "horizontal", 35283 role: "listbox", 35284 "aria-multiselectable": isMultiselect, 35285 className: dist_clsx( 35286 "dataviews-view-picker-grid", 35287 className 35288 ), 35289 "aria-label": itemListLabel, 35290 render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35291 external_wp_components_namespaceObject.__experimentalVStack, 35292 { 35293 spacing: 4, 35294 children, 35295 ...props 35296 } 35297 ), 35298 children: Array.from(dataByGroup.entries()).map( 35299 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35300 GridGroup, 35301 { 35302 groupName, 35303 groupField, 35304 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35305 GridItems, 35306 { 35307 previewSize: usedPreviewSize, 35308 style: { 35309 gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax($usedPreviewSize}px, 1fr))` 35310 }, 35311 "aria-busy": isLoading, 35312 ref: resizeObserverRef, 35313 children: groupItems.map((item) => { 35314 const posInSet = (currentPage - 1) * perPage + data.indexOf(item) + 1; 35315 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35316 picker_grid_GridItem, 35317 { 35318 view, 35319 multiselect: isMultiselect, 35320 selection, 35321 onChangeSelection, 35322 getItemId, 35323 item, 35324 mediaField, 35325 titleField, 35326 descriptionField, 35327 regularFields, 35328 badgeFields, 35329 config: { 35330 sizes: size 35331 }, 35332 posinset: posInSet, 35333 setsize: setSize 35334 }, 35335 getItemId(item) 35336 ); 35337 }) 35338 } 35339 ) 35340 }, 35341 groupName 35342 ) 35343 ) 35344 } 35345 ), 35346 // Render a single grid with all data. 35347 hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35348 external_wp_components_namespaceObject.Composite, 35349 { 35350 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35351 GridItems, 35352 { 35353 className: dist_clsx( 35354 "dataviews-view-picker-grid", 35355 className 35356 ), 35357 previewSize: usedPreviewSize, 35358 "aria-busy": isLoading, 35359 ref: resizeObserverRef 35360 } 35361 ), 35362 virtualFocus: true, 35363 orientation: "horizontal", 35364 role: "listbox", 35365 "aria-multiselectable": isMultiselect, 35366 "aria-label": itemListLabel, 35367 children: data.map((item, index) => { 35368 let posinset = isInfiniteScroll ? index + 1 : void 0; 35369 if (!isInfiniteScroll) { 35370 posinset = (currentPage - 1) * perPage + index + 1; 35371 } 35372 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35373 picker_grid_GridItem, 35374 { 35375 view, 35376 multiselect: isMultiselect, 35377 selection, 35378 onChangeSelection, 35379 getItemId, 35380 item, 35381 mediaField, 35382 titleField, 35383 descriptionField, 35384 regularFields, 35385 badgeFields, 35386 config: { 35387 sizes: size 35388 }, 35389 posinset, 35390 setsize: setSize 35391 }, 35392 getItemId(item) 35393 ); 35394 }) 35395 } 35396 ), 35397 // Render empty state. 35398 !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35399 "div", 35400 { 35401 className: dist_clsx({ 35402 "dataviews-loading": isLoading, 35403 "dataviews-no-results": !isLoading 35404 }), 35405 children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty 35406 } 35407 ), 35408 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) 35409 ] 35410 }); 35411 } 35412 var picker_grid_default = ViewPickerGrid; 35413 35414 35415 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/preview-size-picker.js 35416 35417 35418 35419 35420 35421 const imageSizes = [ 35422 { 35423 value: 120, 35424 breakpoint: 1 35425 }, 35426 { 35427 value: 170, 35428 breakpoint: 1 35429 }, 35430 { 35431 value: 230, 35432 breakpoint: 1 35433 }, 35434 { 35435 value: 290, 35436 breakpoint: 1112 35437 // at minimum image width, 4 images display at this container size 35438 }, 35439 { 35440 value: 350, 35441 breakpoint: 1636 35442 // at minimum image width, 6 images display at this container size 35443 }, 35444 { 35445 value: 430, 35446 breakpoint: 588 35447 // at minimum image width, 2 images display at this container size 35448 } 35449 ]; 35450 function PreviewSizePicker() { 35451 const context = (0,external_wp_element_.useContext)(dataviews_context_default); 35452 const view = context.view; 35453 const breakValues = imageSizes.filter((size) => { 35454 return context.containerWidth >= size.breakpoint; 35455 }); 35456 const layoutPreviewSize = view.layout?.previewSize ?? 230; 35457 const previewSizeToUse = breakValues.map((size, index) => ({ ...size, index })).filter((size) => size.value <= layoutPreviewSize).sort((a, b) => b.value - a.value)[0]?.index ?? 0; 35458 const marks = breakValues.map((size, index) => { 35459 return { 35460 value: index 35461 }; 35462 }); 35463 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35464 external_wp_components_namespaceObject.RangeControl, 35465 { 35466 __nextHasNoMarginBottom: true, 35467 __next40pxDefaultSize: true, 35468 showTooltip: false, 35469 label: (0,external_wp_i18n_namespaceObject.__)("Preview size"), 35470 value: previewSizeToUse, 35471 min: 0, 35472 max: breakValues.length - 1, 35473 withInputField: false, 35474 onChange: (value = 0) => { 35475 context.onChangeView({ 35476 ...view, 35477 layout: { 35478 ...view.layout, 35479 previewSize: breakValues[value].value 35480 } 35481 }); 35482 }, 35483 step: 1, 35484 marks 35485 } 35486 ); 35487 } 35488 35489 35490 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/density-picker.js 35491 35492 35493 35494 35495 35496 function DensityPicker() { 35497 const context = (0,external_wp_element_.useContext)(dataviews_context_default); 35498 const view = context.view; 35499 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 35500 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 35501 { 35502 __nextHasNoMarginBottom: true, 35503 size: "__unstable-large", 35504 label: (0,external_wp_i18n_namespaceObject.__)("Density"), 35505 value: view.layout?.density || "balanced", 35506 onChange: (value) => { 35507 context.onChangeView({ 35508 ...view, 35509 layout: { 35510 ...view.layout, 35511 density: value 35512 } 35513 }); 35514 }, 35515 isBlock: true, 35516 children: [ 35517 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35518 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 35519 { 35520 value: "comfortable", 35521 label: (0,external_wp_i18n_namespaceObject._x)( 35522 "Comfortable", 35523 "Density option for DataView layout" 35524 ) 35525 }, 35526 "comfortable" 35527 ), 35528 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35529 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 35530 { 35531 value: "balanced", 35532 label: (0,external_wp_i18n_namespaceObject._x)("Balanced", "Density option for DataView layout") 35533 }, 35534 "balanced" 35535 ), 35536 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35537 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 35538 { 35539 value: "compact", 35540 label: (0,external_wp_i18n_namespaceObject._x)("Compact", "Density option for DataView layout") 35541 }, 35542 "compact" 35543 ) 35544 ] 35545 } 35546 ); 35547 } 35548 35549 35550 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js 35551 35552 35553 35554 35555 35556 35557 35558 35559 35560 const VIEW_LAYOUTS = [ 35561 { 35562 type: constants_LAYOUT_TABLE, 35563 label: (0,external_wp_i18n_namespaceObject.__)("Table"), 35564 component: table_default, 35565 icon: block_table_default, 35566 viewConfigOptions: DensityPicker 35567 }, 35568 { 35569 type: constants_LAYOUT_GRID, 35570 label: (0,external_wp_i18n_namespaceObject.__)("Grid"), 35571 component: grid_default, 35572 icon: category_default, 35573 viewConfigOptions: PreviewSizePicker 35574 }, 35575 { 35576 type: constants_LAYOUT_LIST, 35577 label: (0,external_wp_i18n_namespaceObject.__)("List"), 35578 component: ViewList, 35579 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default 35580 }, 35581 { 35582 type: LAYOUT_PICKER_GRID, 35583 label: (0,external_wp_i18n_namespaceObject.__)("Grid"), 35584 component: picker_grid_default, 35585 icon: category_default, 35586 viewConfigOptions: PreviewSizePicker, 35587 isPicker: true 35588 } 35589 ]; 35590 35591 35592 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js 35593 35594 35595 35596 35597 35598 const { Menu: add_filter_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 35599 function AddFilterMenu({ 35600 filters, 35601 view, 35602 onChangeView, 35603 setOpenedFilter, 35604 triggerProps 35605 }) { 35606 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 35607 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_filter_Menu, { children: [ 35608 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.TriggerButton, { ...triggerProps }), 35609 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Popover, { children: inactiveFilters.map((filter) => { 35610 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35611 add_filter_Menu.Item, 35612 { 35613 onClick: () => { 35614 setOpenedFilter(filter.field); 35615 onChangeView({ 35616 ...view, 35617 page: 1, 35618 filters: [ 35619 ...view.filters || [], 35620 { 35621 field: filter.field, 35622 value: void 0, 35623 operator: filter.operators[0] 35624 } 35625 ] 35626 }); 35627 }, 35628 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.ItemLabel, { children: filter.name }) 35629 }, 35630 filter.field 35631 ); 35632 }) }) 35633 ] }); 35634 } 35635 function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) { 35636 if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) { 35637 return null; 35638 } 35639 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 35640 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35641 AddFilterMenu, 35642 { 35643 triggerProps: { 35644 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35645 external_wp_components_namespaceObject.Button, 35646 { 35647 accessibleWhenDisabled: true, 35648 size: "compact", 35649 className: "dataviews-filters-button", 35650 variant: "tertiary", 35651 disabled: !inactiveFilters.length, 35652 ref 35653 } 35654 ), 35655 children: (0,external_wp_i18n_namespaceObject.__)("Add filter") 35656 }, 35657 ...{ filters, view, onChangeView, setOpenedFilter } 35658 } 35659 ); 35660 } 35661 var add_filter_default = (0,external_wp_element_.forwardRef)(AddFilter); 35662 35663 35664 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/toggle.js 35665 35666 35667 35668 35669 35670 35671 35672 function FiltersToggle() { 35673 const { 35674 filters, 35675 view, 35676 onChangeView, 35677 setOpenedFilter, 35678 isShowingFilter, 35679 setIsShowingFilter 35680 } = (0,external_wp_element_.useContext)(dataviews_context_default); 35681 const buttonRef = (0,external_wp_element_.useRef)(null); 35682 const onChangeViewWithFilterVisibility = (0,external_wp_element_.useCallback)( 35683 (_view) => { 35684 onChangeView(_view); 35685 setIsShowingFilter(true); 35686 }, 35687 [onChangeView, setIsShowingFilter] 35688 ); 35689 const visibleFilters = filters.filter((filter) => filter.isVisible); 35690 const hasVisibleFilters = !!visibleFilters.length; 35691 if (filters.length === 0) { 35692 return null; 35693 } 35694 const addFilterButtonProps = { 35695 label: (0,external_wp_i18n_namespaceObject.__)("Add filter"), 35696 "aria-expanded": false, 35697 isPressed: false 35698 }; 35699 const toggleFiltersButtonProps = { 35700 label: (0,external_wp_i18n_namespaceObject._x)("Filter", "verb"), 35701 "aria-expanded": isShowingFilter, 35702 isPressed: isShowingFilter, 35703 onClick: () => { 35704 if (!isShowingFilter) { 35705 setOpenedFilter(null); 35706 } 35707 setIsShowingFilter(!isShowingFilter); 35708 } 35709 }; 35710 const buttonComponent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35711 external_wp_components_namespaceObject.Button, 35712 { 35713 ref: buttonRef, 35714 className: "dataviews-filters__visibility-toggle", 35715 size: "compact", 35716 icon: funnel_default, 35717 ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps 35718 } 35719 ); 35720 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35721 AddFilterMenu, 35722 { 35723 filters, 35724 view, 35725 onChangeView: onChangeViewWithFilterVisibility, 35726 setOpenedFilter, 35727 triggerProps: { render: buttonComponent } 35728 } 35729 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35730 FilterVisibilityToggle, 35731 { 35732 buttonRef, 35733 filtersCount: view.filters?.length, 35734 children: buttonComponent 35735 } 35736 ) }); 35737 } 35738 function FilterVisibilityToggle({ 35739 buttonRef, 35740 filtersCount, 35741 children 35742 }) { 35743 (0,external_wp_element_.useEffect)( 35744 () => () => { 35745 buttonRef.current?.focus(); 35746 }, 35747 [buttonRef] 35748 ); 35749 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 35750 children, 35751 !!filtersCount && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount }) 35752 ] }); 35753 } 35754 var toggle_default = FiltersToggle; 35755 35756 35757 ;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js 35758 "use client"; 35759 var __defProp = Object.defineProperty; 35760 var __defProps = Object.defineProperties; 35761 var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 35762 var __getOwnPropSymbols = Object.getOwnPropertySymbols; 35763 var __hasOwnProp = Object.prototype.hasOwnProperty; 35764 var __propIsEnum = Object.prototype.propertyIsEnumerable; 35765 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 35766 var _3YLGPPWQ_spreadValues = (a, b) => { 35767 for (var prop in b || (b = {})) 35768 if (__hasOwnProp.call(b, prop)) 35769 __defNormalProp(a, prop, b[prop]); 35770 if (__getOwnPropSymbols) 35771 for (var prop of __getOwnPropSymbols(b)) { 35772 if (__propIsEnum.call(b, prop)) 35773 __defNormalProp(a, prop, b[prop]); 35774 } 35775 return a; 35776 }; 35777 var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 35778 var __objRest = (source, exclude) => { 35779 var target = {}; 35780 for (var prop in source) 35781 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 35782 target[prop] = source[prop]; 35783 if (source != null && __getOwnPropSymbols) 35784 for (var prop of __getOwnPropSymbols(source)) { 35785 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) 35786 target[prop] = source[prop]; 35787 } 35788 return target; 35789 }; 35790 35791 35792 35793 ;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js 35794 "use client"; 35795 var _3YLGPPWQ_defProp = Object.defineProperty; 35796 var _3YLGPPWQ_defProps = Object.defineProperties; 35797 var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; 35798 var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; 35799 var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; 35800 var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; 35801 var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 35802 var _chunks_3YLGPPWQ_spreadValues = (a, b) => { 35803 for (var prop in b || (b = {})) 35804 if (_3YLGPPWQ_hasOwnProp.call(b, prop)) 35805 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 35806 if (_3YLGPPWQ_getOwnPropSymbols) 35807 for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { 35808 if (_3YLGPPWQ_propIsEnum.call(b, prop)) 35809 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 35810 } 35811 return a; 35812 }; 35813 var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); 35814 var _3YLGPPWQ_objRest = (source, exclude) => { 35815 var target = {}; 35816 for (var prop in source) 35817 if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 35818 target[prop] = source[prop]; 35819 if (source != null && _3YLGPPWQ_getOwnPropSymbols) 35820 for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { 35821 if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) 35822 target[prop] = source[prop]; 35823 } 35824 return target; 35825 }; 35826 35827 35828 35829 ;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js 35830 "use client"; 35831 35832 35833 // src/utils/misc.ts 35834 function PBFD2E7P_noop(..._) { 35835 } 35836 function shallowEqual(a, b) { 35837 if (a === b) return true; 35838 if (!a) return false; 35839 if (!b) return false; 35840 if (typeof a !== "object") return false; 35841 if (typeof b !== "object") return false; 35842 const aKeys = Object.keys(a); 35843 const bKeys = Object.keys(b); 35844 const { length } = aKeys; 35845 if (bKeys.length !== length) return false; 35846 for (const key of aKeys) { 35847 if (a[key] !== b[key]) { 35848 return false; 35849 } 35850 } 35851 return true; 35852 } 35853 function applyState(argument, currentValue) { 35854 if (isUpdater(argument)) { 35855 const value = isLazyValue(currentValue) ? currentValue() : currentValue; 35856 return argument(value); 35857 } 35858 return argument; 35859 } 35860 function isUpdater(argument) { 35861 return typeof argument === "function"; 35862 } 35863 function isLazyValue(value) { 35864 return typeof value === "function"; 35865 } 35866 function isObject(arg) { 35867 return typeof arg === "object" && arg != null; 35868 } 35869 function PBFD2E7P_isEmpty(arg) { 35870 if (Array.isArray(arg)) return !arg.length; 35871 if (isObject(arg)) return !Object.keys(arg).length; 35872 if (arg == null) return true; 35873 if (arg === "") return true; 35874 return false; 35875 } 35876 function isInteger(arg) { 35877 if (typeof arg === "number") { 35878 return Math.floor(arg) === arg; 35879 } 35880 return String(Math.floor(Number(arg))) === arg; 35881 } 35882 function PBFD2E7P_hasOwnProperty(object, prop) { 35883 if (typeof Object.hasOwn === "function") { 35884 return Object.hasOwn(object, prop); 35885 } 35886 return Object.prototype.hasOwnProperty.call(object, prop); 35887 } 35888 function chain(...fns) { 35889 return (...args) => { 35890 for (const fn of fns) { 35891 if (typeof fn === "function") { 35892 fn(...args); 35893 } 35894 } 35895 }; 35896 } 35897 function cx(...args) { 35898 return args.filter(Boolean).join(" ") || void 0; 35899 } 35900 function PBFD2E7P_normalizeString(str) { 35901 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 35902 } 35903 function omit(object, keys) { 35904 const result = _chunks_3YLGPPWQ_spreadValues({}, object); 35905 for (const key of keys) { 35906 if (PBFD2E7P_hasOwnProperty(result, key)) { 35907 delete result[key]; 35908 } 35909 } 35910 return result; 35911 } 35912 function pick(object, paths) { 35913 const result = {}; 35914 for (const key of paths) { 35915 if (PBFD2E7P_hasOwnProperty(object, key)) { 35916 result[key] = object[key]; 35917 } 35918 } 35919 return result; 35920 } 35921 function identity(value) { 35922 return value; 35923 } 35924 function beforePaint(cb = PBFD2E7P_noop) { 35925 const raf = requestAnimationFrame(cb); 35926 return () => cancelAnimationFrame(raf); 35927 } 35928 function afterPaint(cb = PBFD2E7P_noop) { 35929 let raf = requestAnimationFrame(() => { 35930 raf = requestAnimationFrame(cb); 35931 }); 35932 return () => cancelAnimationFrame(raf); 35933 } 35934 function invariant(condition, message) { 35935 if (condition) return; 35936 if (typeof message !== "string") throw new Error("Invariant failed"); 35937 throw new Error(message); 35938 } 35939 function getKeys(obj) { 35940 return Object.keys(obj); 35941 } 35942 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 35943 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 35944 if (result == null) return false; 35945 return !result; 35946 } 35947 function disabledFromProps(props) { 35948 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 35949 } 35950 function removeUndefinedValues(obj) { 35951 const result = {}; 35952 for (const key in obj) { 35953 if (obj[key] !== void 0) { 35954 result[key] = obj[key]; 35955 } 35956 } 35957 return result; 35958 } 35959 function defaultValue(...values) { 35960 for (const value of values) { 35961 if (value !== void 0) return value; 35962 } 35963 return void 0; 35964 } 35965 35966 35967 35968 ;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js 35969 "use client"; 35970 35971 35972 // src/utils/misc.ts 35973 35974 35975 function setRef(ref, value) { 35976 if (typeof ref === "function") { 35977 ref(value); 35978 } else if (ref) { 35979 ref.current = value; 35980 } 35981 } 35982 function isValidElementWithRef(element) { 35983 if (!element) return false; 35984 if (!(0,external_React_.isValidElement)(element)) return false; 35985 if ("ref" in element.props) return true; 35986 if ("ref" in element) return true; 35987 return false; 35988 } 35989 function getRefProperty(element) { 35990 if (!isValidElementWithRef(element)) return null; 35991 const props = _3YLGPPWQ_spreadValues({}, element.props); 35992 return props.ref || element.ref; 35993 } 35994 function mergeProps(base, overrides) { 35995 const props = _3YLGPPWQ_spreadValues({}, base); 35996 for (const key in overrides) { 35997 if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; 35998 if (key === "className") { 35999 const prop = "className"; 36000 props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop]; 36001 continue; 36002 } 36003 if (key === "style") { 36004 const prop = "style"; 36005 props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; 36006 continue; 36007 } 36008 const overrideValue = overrides[key]; 36009 if (typeof overrideValue === "function" && key.startsWith("on")) { 36010 const baseValue = base[key]; 36011 if (typeof baseValue === "function") { 36012 props[key] = (...args) => { 36013 overrideValue(...args); 36014 baseValue(...args); 36015 }; 36016 continue; 36017 } 36018 } 36019 props[key] = overrideValue; 36020 } 36021 return props; 36022 } 36023 36024 36025 36026 ;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js 36027 "use client"; 36028 36029 // src/utils/dom.ts 36030 var DTR5TSDJ_canUseDOM = checkIsBrowser(); 36031 function checkIsBrowser() { 36032 var _a; 36033 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); 36034 } 36035 function getDocument(node) { 36036 if (!node) return document; 36037 if ("self" in node) return node.document; 36038 return node.ownerDocument || document; 36039 } 36040 function getWindow(node) { 36041 if (!node) return self; 36042 if ("self" in node) return node.self; 36043 return getDocument(node).defaultView || window; 36044 } 36045 function DTR5TSDJ_getActiveElement(node, activeDescendant = false) { 36046 const { activeElement } = getDocument(node); 36047 if (!(activeElement == null ? void 0 : activeElement.nodeName)) { 36048 return null; 36049 } 36050 if (DTR5TSDJ_isFrame(activeElement) && activeElement.contentDocument) { 36051 return DTR5TSDJ_getActiveElement( 36052 activeElement.contentDocument.body, 36053 activeDescendant 36054 ); 36055 } 36056 if (activeDescendant) { 36057 const id = activeElement.getAttribute("aria-activedescendant"); 36058 if (id) { 36059 const element = getDocument(activeElement).getElementById(id); 36060 if (element) { 36061 return element; 36062 } 36063 } 36064 } 36065 return activeElement; 36066 } 36067 function contains(parent, child) { 36068 return parent === child || parent.contains(child); 36069 } 36070 function DTR5TSDJ_isFrame(element) { 36071 return element.tagName === "IFRAME"; 36072 } 36073 function isButton(element) { 36074 const tagName = element.tagName.toLowerCase(); 36075 if (tagName === "button") return true; 36076 if (tagName === "input" && element.type) { 36077 return buttonInputTypes.indexOf(element.type) !== -1; 36078 } 36079 return false; 36080 } 36081 var buttonInputTypes = [ 36082 "button", 36083 "color", 36084 "file", 36085 "image", 36086 "reset", 36087 "submit" 36088 ]; 36089 function isVisible(element) { 36090 if (typeof element.checkVisibility === "function") { 36091 return element.checkVisibility(); 36092 } 36093 const htmlElement = element; 36094 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 36095 } 36096 function isTextField(element) { 36097 try { 36098 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 36099 const isTextArea = element.tagName === "TEXTAREA"; 36100 return isTextInput || isTextArea || false; 36101 } catch (error) { 36102 return false; 36103 } 36104 } 36105 function isTextbox(element) { 36106 return element.isContentEditable || isTextField(element); 36107 } 36108 function getTextboxValue(element) { 36109 if (isTextField(element)) { 36110 return element.value; 36111 } 36112 if (element.isContentEditable) { 36113 const range = getDocument(element).createRange(); 36114 range.selectNodeContents(element); 36115 return range.toString(); 36116 } 36117 return ""; 36118 } 36119 function getTextboxSelection(element) { 36120 let start = 0; 36121 let end = 0; 36122 if (isTextField(element)) { 36123 start = element.selectionStart || 0; 36124 end = element.selectionEnd || 0; 36125 } else if (element.isContentEditable) { 36126 const selection = getDocument(element).getSelection(); 36127 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { 36128 const range = selection.getRangeAt(0); 36129 const nextRange = range.cloneRange(); 36130 nextRange.selectNodeContents(element); 36131 nextRange.setEnd(range.startContainer, range.startOffset); 36132 start = nextRange.toString().length; 36133 nextRange.setEnd(range.endContainer, range.endOffset); 36134 end = nextRange.toString().length; 36135 } 36136 } 36137 return { start, end }; 36138 } 36139 function getPopupRole(element, fallback) { 36140 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; 36141 const role = element == null ? void 0 : element.getAttribute("role"); 36142 if (role && allowedPopupRoles.indexOf(role) !== -1) { 36143 return role; 36144 } 36145 return fallback; 36146 } 36147 function getPopupItemRole(element, fallback) { 36148 var _a; 36149 const itemRoleByPopupRole = { 36150 menu: "menuitem", 36151 listbox: "option", 36152 tree: "treeitem" 36153 }; 36154 const popupRole = getPopupRole(element); 36155 if (!popupRole) return fallback; 36156 const key = popupRole; 36157 return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; 36158 } 36159 function scrollIntoViewIfNeeded(element, arg) { 36160 if (isPartiallyHidden(element) && "scrollIntoView" in element) { 36161 element.scrollIntoView(arg); 36162 } 36163 } 36164 function getScrollingElement(element) { 36165 if (!element) return null; 36166 const isScrollableOverflow = (overflow) => { 36167 if (overflow === "auto") return true; 36168 if (overflow === "scroll") return true; 36169 return false; 36170 }; 36171 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 36172 const { overflowY } = getComputedStyle(element); 36173 if (isScrollableOverflow(overflowY)) return element; 36174 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 36175 const { overflowX } = getComputedStyle(element); 36176 if (isScrollableOverflow(overflowX)) return element; 36177 } 36178 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; 36179 } 36180 function isPartiallyHidden(element) { 36181 const elementRect = element.getBoundingClientRect(); 36182 const scroller = getScrollingElement(element); 36183 if (!scroller) return false; 36184 const scrollerRect = scroller.getBoundingClientRect(); 36185 const isHTML = scroller.tagName === "HTML"; 36186 const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; 36187 const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; 36188 const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; 36189 const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; 36190 const top = elementRect.top < scrollerTop; 36191 const left = elementRect.left < scrollerLeft; 36192 const bottom = elementRect.bottom > scrollerBottom; 36193 const right = elementRect.right > scrollerRight; 36194 return top || left || bottom || right; 36195 } 36196 function setSelectionRange(element, ...args) { 36197 if (/text|search|password|tel|url/i.test(element.type)) { 36198 element.setSelectionRange(...args); 36199 } 36200 } 36201 function sortBasedOnDOMPosition(items, getElement) { 36202 const pairs = items.map((item, index) => [index, item]); 36203 let isOrderDifferent = false; 36204 pairs.sort(([indexA, a], [indexB, b]) => { 36205 const elementA = getElement(a); 36206 const elementB = getElement(b); 36207 if (elementA === elementB) return 0; 36208 if (!elementA || !elementB) return 0; 36209 if (isElementPreceding(elementA, elementB)) { 36210 if (indexA > indexB) { 36211 isOrderDifferent = true; 36212 } 36213 return -1; 36214 } 36215 if (indexA < indexB) { 36216 isOrderDifferent = true; 36217 } 36218 return 1; 36219 }); 36220 if (isOrderDifferent) { 36221 return pairs.map(([_, item]) => item); 36222 } 36223 return items; 36224 } 36225 function isElementPreceding(a, b) { 36226 return Boolean( 36227 b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING 36228 ); 36229 } 36230 36231 36232 36233 ;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js 36234 "use client"; 36235 36236 36237 // src/utils/platform.ts 36238 function isTouchDevice() { 36239 return DTR5TSDJ_canUseDOM && !!navigator.maxTouchPoints; 36240 } 36241 function isApple() { 36242 if (!DTR5TSDJ_canUseDOM) return false; 36243 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 36244 } 36245 function isSafari() { 36246 return DTR5TSDJ_canUseDOM && isApple() && /apple/i.test(navigator.vendor); 36247 } 36248 function isFirefox() { 36249 return DTR5TSDJ_canUseDOM && /firefox\//i.test(navigator.userAgent); 36250 } 36251 function isMac() { 36252 return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); 36253 } 36254 36255 36256 36257 ;// ./node_modules/@ariakit/core/esm/utils/events.js 36258 "use client"; 36259 36260 36261 36262 36263 // src/utils/events.ts 36264 function isPortalEvent(event) { 36265 return Boolean( 36266 event.currentTarget && !contains(event.currentTarget, event.target) 36267 ); 36268 } 36269 function isSelfTarget(event) { 36270 return event.target === event.currentTarget; 36271 } 36272 function isOpeningInNewTab(event) { 36273 const element = event.currentTarget; 36274 if (!element) return false; 36275 const isAppleDevice = isApple(); 36276 if (isAppleDevice && !event.metaKey) return false; 36277 if (!isAppleDevice && !event.ctrlKey) return false; 36278 const tagName = element.tagName.toLowerCase(); 36279 if (tagName === "a") return true; 36280 if (tagName === "button" && element.type === "submit") return true; 36281 if (tagName === "input" && element.type === "submit") return true; 36282 return false; 36283 } 36284 function isDownloading(event) { 36285 const element = event.currentTarget; 36286 if (!element) return false; 36287 const tagName = element.tagName.toLowerCase(); 36288 if (!event.altKey) return false; 36289 if (tagName === "a") return true; 36290 if (tagName === "button" && element.type === "submit") return true; 36291 if (tagName === "input" && element.type === "submit") return true; 36292 return false; 36293 } 36294 function fireEvent(element, type, eventInit) { 36295 const event = new Event(type, eventInit); 36296 return element.dispatchEvent(event); 36297 } 36298 function fireBlurEvent(element, eventInit) { 36299 const event = new FocusEvent("blur", eventInit); 36300 const defaultAllowed = element.dispatchEvent(event); 36301 const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); 36302 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 36303 return defaultAllowed; 36304 } 36305 function fireFocusEvent(element, eventInit) { 36306 const event = new FocusEvent("focus", eventInit); 36307 const defaultAllowed = element.dispatchEvent(event); 36308 const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); 36309 element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); 36310 return defaultAllowed; 36311 } 36312 function fireKeyboardEvent(element, type, eventInit) { 36313 const event = new KeyboardEvent(type, eventInit); 36314 return element.dispatchEvent(event); 36315 } 36316 function fireClickEvent(element, eventInit) { 36317 const event = new MouseEvent("click", eventInit); 36318 return element.dispatchEvent(event); 36319 } 36320 function isFocusEventOutside(event, container) { 36321 const containerElement = container || event.currentTarget; 36322 const relatedTarget = event.relatedTarget; 36323 return !relatedTarget || !contains(containerElement, relatedTarget); 36324 } 36325 function getInputType(event) { 36326 const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; 36327 if (!nativeEvent) return; 36328 if (!("inputType" in nativeEvent)) return; 36329 if (typeof nativeEvent.inputType !== "string") return; 36330 return nativeEvent.inputType; 36331 } 36332 function queueBeforeEvent(element, type, callback, timeout) { 36333 const createTimer = (callback2) => { 36334 if (timeout) { 36335 const timerId2 = setTimeout(callback2, timeout); 36336 return () => clearTimeout(timerId2); 36337 } 36338 const timerId = requestAnimationFrame(callback2); 36339 return () => cancelAnimationFrame(timerId); 36340 }; 36341 const cancelTimer = createTimer(() => { 36342 element.removeEventListener(type, callSync, true); 36343 callback(); 36344 }); 36345 const callSync = () => { 36346 cancelTimer(); 36347 callback(); 36348 }; 36349 element.addEventListener(type, callSync, { once: true, capture: true }); 36350 return cancelTimer; 36351 } 36352 function addGlobalEventListener(type, listener, options, scope = window) { 36353 const children = []; 36354 try { 36355 scope.document.addEventListener(type, listener, options); 36356 for (const frame of Array.from(scope.frames)) { 36357 children.push(addGlobalEventListener(type, listener, options, frame)); 36358 } 36359 } catch (e) { 36360 } 36361 const removeEventListener = () => { 36362 try { 36363 scope.document.removeEventListener(type, listener, options); 36364 } catch (e) { 36365 } 36366 for (const remove of children) { 36367 remove(); 36368 } 36369 }; 36370 return removeEventListener; 36371 } 36372 36373 36374 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js 36375 "use client"; 36376 36377 36378 36379 // src/utils/hooks.ts 36380 36381 36382 36383 36384 var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); 36385 var useReactId = _React.useId; 36386 var useReactDeferredValue = _React.useDeferredValue; 36387 var useReactInsertionEffect = _React.useInsertionEffect; 36388 var useSafeLayoutEffect = DTR5TSDJ_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; 36389 function useInitialValue(value) { 36390 const [initialValue] = (0,external_React_.useState)(value); 36391 return initialValue; 36392 } 36393 function useLazyValue(init) { 36394 const ref = useRef(); 36395 if (ref.current === void 0) { 36396 ref.current = init(); 36397 } 36398 return ref.current; 36399 } 36400 function useLiveRef(value) { 36401 const ref = (0,external_React_.useRef)(value); 36402 useSafeLayoutEffect(() => { 36403 ref.current = value; 36404 }); 36405 return ref; 36406 } 36407 function usePreviousValue(value) { 36408 const [previousValue, setPreviousValue] = useState(value); 36409 if (value !== previousValue) { 36410 setPreviousValue(value); 36411 } 36412 return previousValue; 36413 } 36414 function useEvent(callback) { 36415 const ref = (0,external_React_.useRef)(() => { 36416 throw new Error("Cannot call an event handler while rendering."); 36417 }); 36418 if (useReactInsertionEffect) { 36419 useReactInsertionEffect(() => { 36420 ref.current = callback; 36421 }); 36422 } else { 36423 ref.current = callback; 36424 } 36425 return (0,external_React_.useCallback)((...args) => { 36426 var _a; 36427 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); 36428 }, []); 36429 } 36430 function useTransactionState(callback) { 36431 const [state, setState] = (0,external_React_.useState)(null); 36432 useSafeLayoutEffect(() => { 36433 if (state == null) return; 36434 if (!callback) return; 36435 let prevState = null; 36436 callback((prev) => { 36437 prevState = prev; 36438 return state; 36439 }); 36440 return () => { 36441 callback(prevState); 36442 }; 36443 }, [state, callback]); 36444 return [state, setState]; 36445 } 36446 function useMergeRefs(...refs) { 36447 return (0,external_React_.useMemo)(() => { 36448 if (!refs.some(Boolean)) return; 36449 return (value) => { 36450 for (const ref of refs) { 36451 setRef(ref, value); 36452 } 36453 }; 36454 }, refs); 36455 } 36456 function useId(defaultId) { 36457 if (useReactId) { 36458 const reactId = useReactId(); 36459 if (defaultId) return defaultId; 36460 return reactId; 36461 } 36462 const [id, setId] = (0,external_React_.useState)(defaultId); 36463 useSafeLayoutEffect(() => { 36464 if (defaultId || id) return; 36465 const random = Math.random().toString(36).slice(2, 8); 36466 setId(`id-$random}`); 36467 }, [defaultId, id]); 36468 return defaultId || id; 36469 } 36470 function useDeferredValue(value) { 36471 if (useReactDeferredValue) { 36472 return useReactDeferredValue(value); 36473 } 36474 const [deferredValue, setDeferredValue] = useState(value); 36475 useEffect(() => { 36476 const raf = requestAnimationFrame(() => setDeferredValue(value)); 36477 return () => cancelAnimationFrame(raf); 36478 }, [value]); 36479 return deferredValue; 36480 } 36481 function useTagName(refOrElement, type) { 36482 const stringOrUndefined = (type2) => { 36483 if (typeof type2 !== "string") return; 36484 return type2; 36485 }; 36486 const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); 36487 useSafeLayoutEffect(() => { 36488 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 36489 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); 36490 }, [refOrElement, type]); 36491 return tagName; 36492 } 36493 function useAttribute(refOrElement, attributeName, defaultValue) { 36494 const initialValue = useInitialValue(defaultValue); 36495 const [attribute, setAttribute] = (0,external_React_.useState)(initialValue); 36496 (0,external_React_.useEffect)(() => { 36497 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 36498 if (!element) return; 36499 const callback = () => { 36500 const value = element.getAttribute(attributeName); 36501 setAttribute(value == null ? initialValue : value); 36502 }; 36503 const observer = new MutationObserver(callback); 36504 observer.observe(element, { attributeFilter: [attributeName] }); 36505 callback(); 36506 return () => observer.disconnect(); 36507 }, [refOrElement, attributeName, initialValue]); 36508 return attribute; 36509 } 36510 function useUpdateEffect(effect, deps) { 36511 const mounted = (0,external_React_.useRef)(false); 36512 (0,external_React_.useEffect)(() => { 36513 if (mounted.current) { 36514 return effect(); 36515 } 36516 mounted.current = true; 36517 }, deps); 36518 (0,external_React_.useEffect)( 36519 () => () => { 36520 mounted.current = false; 36521 }, 36522 [] 36523 ); 36524 } 36525 function useUpdateLayoutEffect(effect, deps) { 36526 const mounted = (0,external_React_.useRef)(false); 36527 useSafeLayoutEffect(() => { 36528 if (mounted.current) { 36529 return effect(); 36530 } 36531 mounted.current = true; 36532 }, deps); 36533 useSafeLayoutEffect( 36534 () => () => { 36535 mounted.current = false; 36536 }, 36537 [] 36538 ); 36539 } 36540 function useForceUpdate() { 36541 return (0,external_React_.useReducer)(() => [], []); 36542 } 36543 function useBooleanEvent(booleanOrCallback) { 36544 return useEvent( 36545 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback 36546 ); 36547 } 36548 function useWrapElement(props, callback, deps = []) { 36549 const wrapElement = (0,external_React_.useCallback)( 36550 (element) => { 36551 if (props.wrapElement) { 36552 element = props.wrapElement(element); 36553 } 36554 return callback(element); 36555 }, 36556 [...deps, props.wrapElement] 36557 ); 36558 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); 36559 } 36560 function usePortalRef(portalProp = false, portalRefProp) { 36561 const [portalNode, setPortalNode] = useState(null); 36562 const portalRef = useMergeRefs(setPortalNode, portalRefProp); 36563 const domReady = !portalProp || portalNode; 36564 return { portalRef, portalNode, domReady }; 36565 } 36566 function useMetadataProps(props, key, value) { 36567 const parent = props.onLoadedMetadataCapture; 36568 const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { 36569 return Object.assign(() => { 36570 }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); 36571 }, [parent, key, value]); 36572 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; 36573 } 36574 function useIsMouseMoving() { 36575 (0,external_React_.useEffect)(() => { 36576 addGlobalEventListener("mousemove", setMouseMoving, true); 36577 addGlobalEventListener("mousedown", resetMouseMoving, true); 36578 addGlobalEventListener("mouseup", resetMouseMoving, true); 36579 addGlobalEventListener("keydown", resetMouseMoving, true); 36580 addGlobalEventListener("scroll", resetMouseMoving, true); 36581 }, []); 36582 const isMouseMoving = useEvent(() => mouseMoving); 36583 return isMouseMoving; 36584 } 36585 var mouseMoving = false; 36586 var previousScreenX = 0; 36587 var previousScreenY = 0; 36588 function hasMouseMovement(event) { 36589 const movementX = event.movementX || event.screenX - previousScreenX; 36590 const movementY = event.movementY || event.screenY - previousScreenY; 36591 previousScreenX = event.screenX; 36592 previousScreenY = event.screenY; 36593 return movementX || movementY || "production" === "test"; 36594 } 36595 function setMouseMoving(event) { 36596 if (!hasMouseMovement(event)) return; 36597 mouseMoving = true; 36598 } 36599 function resetMouseMoving() { 36600 mouseMoving = false; 36601 } 36602 36603 36604 36605 ;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js 36606 "use client"; 36607 36608 36609 36610 36611 // src/utils/system.tsx 36612 36613 36614 function forwardRef2(render) { 36615 const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); 36616 Role.displayName = render.displayName || render.name; 36617 return Role; 36618 } 36619 function memo2(Component, propsAreEqual) { 36620 return external_React_.memo(Component, propsAreEqual); 36621 } 36622 function createElement(Type, props) { 36623 const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); 36624 const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); 36625 let element; 36626 if (external_React_.isValidElement(render)) { 36627 const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); 36628 element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); 36629 } else if (render) { 36630 element = render(rest); 36631 } else { 36632 element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); 36633 } 36634 if (wrapElement) { 36635 return wrapElement(element); 36636 } 36637 return element; 36638 } 36639 function createHook(useProps) { 36640 const useRole = (props = {}) => { 36641 return useProps(props); 36642 }; 36643 useRole.displayName = useProps.name; 36644 return useRole; 36645 } 36646 function createStoreContext(providers = [], scopedProviders = []) { 36647 const context = external_React_.createContext(void 0); 36648 const scopedContext = external_React_.createContext(void 0); 36649 const useContext2 = () => external_React_.useContext(context); 36650 const useScopedContext = (onlyScoped = false) => { 36651 const scoped = external_React_.useContext(scopedContext); 36652 const store = useContext2(); 36653 if (onlyScoped) return scoped; 36654 return scoped || store; 36655 }; 36656 const useProviderContext = () => { 36657 const scoped = external_React_.useContext(scopedContext); 36658 const store = useContext2(); 36659 if (scoped && scoped === store) return; 36660 return store; 36661 }; 36662 const ContextProvider = (props) => { 36663 return providers.reduceRight( 36664 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 36665 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) 36666 ); 36667 }; 36668 const ScopedContextProvider = (props) => { 36669 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( 36670 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 36671 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) 36672 ) })); 36673 }; 36674 return { 36675 context, 36676 scopedContext, 36677 useContext: useContext2, 36678 useScopedContext, 36679 useProviderContext, 36680 ContextProvider, 36681 ScopedContextProvider 36682 }; 36683 } 36684 36685 36686 36687 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js 36688 "use client"; 36689 36690 36691 // src/collection/collection-context.tsx 36692 var ctx = createStoreContext(); 36693 var useCollectionContext = ctx.useContext; 36694 var useCollectionScopedContext = ctx.useScopedContext; 36695 var useCollectionProviderContext = ctx.useProviderContext; 36696 var CollectionContextProvider = ctx.ContextProvider; 36697 var CollectionScopedContextProvider = ctx.ScopedContextProvider; 36698 36699 36700 36701 ;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js 36702 "use client"; 36703 36704 36705 36706 // src/composite/composite-context.tsx 36707 36708 var P7GR5CS5_ctx = createStoreContext( 36709 [CollectionContextProvider], 36710 [CollectionScopedContextProvider] 36711 ); 36712 var useCompositeContext = P7GR5CS5_ctx.useContext; 36713 var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext; 36714 var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext; 36715 var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider; 36716 var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider; 36717 var CompositeItemContext = (0,external_React_.createContext)( 36718 void 0 36719 ); 36720 var CompositeRowContext = (0,external_React_.createContext)( 36721 void 0 36722 ); 36723 36724 36725 36726 ;// ./node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js 36727 "use client"; 36728 36729 36730 36731 // src/tag/tag-context.tsx 36732 36733 var TagValueContext = (0,external_React_.createContext)(null); 36734 var TagRemoveIdContext = (0,external_React_.createContext)( 36735 null 36736 ); 36737 var _3XAVFTCA_ctx = createStoreContext( 36738 [CompositeContextProvider], 36739 [CompositeScopedContextProvider] 36740 ); 36741 var useTagContext = _3XAVFTCA_ctx.useContext; 36742 var useTagScopedContext = _3XAVFTCA_ctx.useScopedContext; 36743 var useTagProviderContext = _3XAVFTCA_ctx.useProviderContext; 36744 var TagContextProvider = _3XAVFTCA_ctx.ContextProvider; 36745 var TagScopedContextProvider = _3XAVFTCA_ctx.ScopedContextProvider; 36746 36747 36748 36749 ;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js 36750 "use client"; 36751 36752 36753 36754 // src/utils/store.ts 36755 function getInternal(store, key) { 36756 const internals = store.__unstableInternals; 36757 invariant(internals, "Invalid store"); 36758 return internals[key]; 36759 } 36760 function createStore(initialState, ...stores) { 36761 let state = initialState; 36762 let prevStateBatch = state; 36763 let lastUpdate = Symbol(); 36764 let destroy = PBFD2E7P_noop; 36765 const instances = /* @__PURE__ */ new Set(); 36766 const updatedKeys = /* @__PURE__ */ new Set(); 36767 const setups = /* @__PURE__ */ new Set(); 36768 const listeners = /* @__PURE__ */ new Set(); 36769 const batchListeners = /* @__PURE__ */ new Set(); 36770 const disposables = /* @__PURE__ */ new WeakMap(); 36771 const listenerKeys = /* @__PURE__ */ new WeakMap(); 36772 const storeSetup = (callback) => { 36773 setups.add(callback); 36774 return () => setups.delete(callback); 36775 }; 36776 const storeInit = () => { 36777 const initialized = instances.size; 36778 const instance = Symbol(); 36779 instances.add(instance); 36780 const maybeDestroy = () => { 36781 instances.delete(instance); 36782 if (instances.size) return; 36783 destroy(); 36784 }; 36785 if (initialized) return maybeDestroy; 36786 const desyncs = getKeys(state).map( 36787 (key) => chain( 36788 ...stores.map((store) => { 36789 var _a; 36790 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); 36791 if (!storeState) return; 36792 if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; 36793 return sync(store, [key], (state2) => { 36794 setState( 36795 key, 36796 state2[key], 36797 // @ts-expect-error - Not public API. This is just to prevent 36798 // infinite loops. 36799 true 36800 ); 36801 }); 36802 }) 36803 ) 36804 ); 36805 const teardowns = []; 36806 for (const setup2 of setups) { 36807 teardowns.push(setup2()); 36808 } 36809 const cleanups = stores.map(init); 36810 destroy = chain(...desyncs, ...teardowns, ...cleanups); 36811 return maybeDestroy; 36812 }; 36813 const sub = (keys, listener, set = listeners) => { 36814 set.add(listener); 36815 listenerKeys.set(listener, keys); 36816 return () => { 36817 var _a; 36818 (_a = disposables.get(listener)) == null ? void 0 : _a(); 36819 disposables.delete(listener); 36820 listenerKeys.delete(listener); 36821 set.delete(listener); 36822 }; 36823 }; 36824 const storeSubscribe = (keys, listener) => sub(keys, listener); 36825 const storeSync = (keys, listener) => { 36826 disposables.set(listener, listener(state, state)); 36827 return sub(keys, listener); 36828 }; 36829 const storeBatch = (keys, listener) => { 36830 disposables.set(listener, listener(state, prevStateBatch)); 36831 return sub(keys, listener, batchListeners); 36832 }; 36833 const storePick = (keys) => createStore(pick(state, keys), finalStore); 36834 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 36835 const getState = () => state; 36836 const setState = (key, value, fromStores = false) => { 36837 var _a; 36838 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 36839 const nextValue = applyState(value, state[key]); 36840 if (nextValue === state[key]) return; 36841 if (!fromStores) { 36842 for (const store of stores) { 36843 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); 36844 } 36845 } 36846 const prevState = state; 36847 state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); 36848 const thisUpdate = Symbol(); 36849 lastUpdate = thisUpdate; 36850 updatedKeys.add(key); 36851 const run = (listener, prev, uKeys) => { 36852 var _a2; 36853 const keys = listenerKeys.get(listener); 36854 const updated = (k) => uKeys ? uKeys.has(k) : k === key; 36855 if (!keys || keys.some(updated)) { 36856 (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); 36857 disposables.set(listener, listener(state, prev)); 36858 } 36859 }; 36860 for (const listener of listeners) { 36861 run(listener, prevState); 36862 } 36863 queueMicrotask(() => { 36864 if (lastUpdate !== thisUpdate) return; 36865 const snapshot = state; 36866 for (const listener of batchListeners) { 36867 run(listener, prevStateBatch, updatedKeys); 36868 } 36869 prevStateBatch = snapshot; 36870 updatedKeys.clear(); 36871 }); 36872 }; 36873 const finalStore = { 36874 getState, 36875 setState, 36876 __unstableInternals: { 36877 setup: storeSetup, 36878 init: storeInit, 36879 subscribe: storeSubscribe, 36880 sync: storeSync, 36881 batch: storeBatch, 36882 pick: storePick, 36883 omit: storeOmit 36884 } 36885 }; 36886 return finalStore; 36887 } 36888 function setup(store, ...args) { 36889 if (!store) return; 36890 return getInternal(store, "setup")(...args); 36891 } 36892 function init(store, ...args) { 36893 if (!store) return; 36894 return getInternal(store, "init")(...args); 36895 } 36896 function subscribe(store, ...args) { 36897 if (!store) return; 36898 return getInternal(store, "subscribe")(...args); 36899 } 36900 function sync(store, ...args) { 36901 if (!store) return; 36902 return getInternal(store, "sync")(...args); 36903 } 36904 function batch(store, ...args) { 36905 if (!store) return; 36906 return getInternal(store, "batch")(...args); 36907 } 36908 function omit2(store, ...args) { 36909 if (!store) return; 36910 return getInternal(store, "omit")(...args); 36911 } 36912 function pick2(store, ...args) { 36913 if (!store) return; 36914 return getInternal(store, "pick")(...args); 36915 } 36916 function mergeStore(...stores) { 36917 const initialState = stores.reduce((state, store2) => { 36918 var _a; 36919 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); 36920 if (!nextState) return state; 36921 return Object.assign(state, nextState); 36922 }, {}); 36923 const store = createStore(initialState, ...stores); 36924 return Object.assign({}, ...stores, store); 36925 } 36926 function throwOnConflictingProps(props, store) { 36927 if (true) return; 36928 if (!store) return; 36929 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 36930 var _a; 36931 const stateKey = key.replace("default", ""); 36932 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`; 36933 }); 36934 if (!defaultKeys.length) return; 36935 const storeState = store.getState(); 36936 const conflictingProps = defaultKeys.filter( 36937 (key) => PBFD2E7P_hasOwnProperty(storeState, key) 36938 ); 36939 if (!conflictingProps.length) return; 36940 throw new Error( 36941 `Passing a store prop in conjunction with a default state is not supported. 36942 36943 const store = useSelectStore(); 36944 <SelectProvider store={store} defaultValue="Apple" /> 36945 ^ ^ 36946 36947 Instead, pass the default state to the topmost store: 36948 36949 const store = useSelectStore({ defaultValue: "Apple" }); 36950 <SelectProvider store={store} /> 36951 36952 See https://github.com/ariakit/ariakit/pull/2745 for more details. 36953 36954 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 36955 ` 36956 ); 36957 } 36958 36959 36960 36961 // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js 36962 var shim = __webpack_require__(422); 36963 ;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js 36964 "use client"; 36965 36966 36967 36968 // src/utils/store.tsx 36969 36970 36971 36972 36973 var { useSyncExternalStore } = shim; 36974 var noopSubscribe = () => () => { 36975 }; 36976 function useStoreState(store, keyOrSelector = identity) { 36977 const storeSubscribe = external_React_.useCallback( 36978 (callback) => { 36979 if (!store) return noopSubscribe(); 36980 return subscribe(store, null, callback); 36981 }, 36982 [store] 36983 ); 36984 const getSnapshot = () => { 36985 const key = typeof keyOrSelector === "string" ? keyOrSelector : null; 36986 const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; 36987 const state = store == null ? void 0 : store.getState(); 36988 if (selector) return selector(state); 36989 if (!state) return; 36990 if (!key) return; 36991 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 36992 return state[key]; 36993 }; 36994 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 36995 } 36996 function useStoreStateObject(store, object) { 36997 const objRef = external_React_.useRef( 36998 {} 36999 ); 37000 const storeSubscribe = external_React_.useCallback( 37001 (callback) => { 37002 if (!store) return noopSubscribe(); 37003 return subscribe(store, null, callback); 37004 }, 37005 [store] 37006 ); 37007 const getSnapshot = () => { 37008 const state = store == null ? void 0 : store.getState(); 37009 let updated = false; 37010 const obj = objRef.current; 37011 for (const prop in object) { 37012 const keyOrSelector = object[prop]; 37013 if (typeof keyOrSelector === "function") { 37014 const value = keyOrSelector(state); 37015 if (value !== obj[prop]) { 37016 obj[prop] = value; 37017 updated = true; 37018 } 37019 } 37020 if (typeof keyOrSelector === "string") { 37021 if (!state) continue; 37022 if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue; 37023 const value = state[keyOrSelector]; 37024 if (value !== obj[prop]) { 37025 obj[prop] = value; 37026 updated = true; 37027 } 37028 } 37029 } 37030 if (updated) { 37031 objRef.current = _3YLGPPWQ_spreadValues({}, obj); 37032 } 37033 return objRef.current; 37034 }; 37035 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 37036 } 37037 function useStoreProps(store, props, key, setKey) { 37038 const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; 37039 const setValue = setKey ? props[setKey] : void 0; 37040 const propsRef = useLiveRef({ value, setValue }); 37041 useSafeLayoutEffect(() => { 37042 return sync(store, [key], (state, prev) => { 37043 const { value: value2, setValue: setValue2 } = propsRef.current; 37044 if (!setValue2) return; 37045 if (state[key] === prev[key]) return; 37046 if (state[key] === value2) return; 37047 setValue2(state[key]); 37048 }); 37049 }, [store, key]); 37050 useSafeLayoutEffect(() => { 37051 if (value === void 0) return; 37052 store.setState(key, value); 37053 return batch(store, [key], () => { 37054 if (value === void 0) return; 37055 store.setState(key, value); 37056 }); 37057 }); 37058 } 37059 function YV4JVR4I_useStore(createStore, props) { 37060 const [store, setStore] = external_React_.useState(() => createStore(props)); 37061 useSafeLayoutEffect(() => init(store), [store]); 37062 const useState2 = external_React_.useCallback( 37063 (keyOrSelector) => useStoreState(store, keyOrSelector), 37064 [store] 37065 ); 37066 const memoizedStore = external_React_.useMemo( 37067 () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), 37068 [store, useState2] 37069 ); 37070 const updateStore = useEvent(() => { 37071 setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); 37072 }); 37073 return [memoizedStore, updateStore]; 37074 } 37075 37076 37077 37078 ;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js 37079 "use client"; 37080 37081 37082 37083 // src/collection/collection-store.ts 37084 37085 function useCollectionStoreProps(store, update, props) { 37086 useUpdateEffect(update, [props.store]); 37087 useStoreProps(store, props, "items", "setItems"); 37088 return store; 37089 } 37090 function useCollectionStore(props = {}) { 37091 const [store, update] = useStore(Core.createCollectionStore, props); 37092 return useCollectionStoreProps(store, update, props); 37093 } 37094 37095 37096 37097 ;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js 37098 "use client"; 37099 37100 37101 37102 37103 37104 // src/composite/composite-store.ts 37105 37106 function useCompositeStoreOptions(props) { 37107 const id = useId(props.id); 37108 return _3YLGPPWQ_spreadValues({ id }, props); 37109 } 37110 function useCompositeStoreProps(store, update, props) { 37111 store = useCollectionStoreProps(store, update, props); 37112 useStoreProps(store, props, "activeId", "setActiveId"); 37113 useStoreProps(store, props, "includesBaseElement"); 37114 useStoreProps(store, props, "virtualFocus"); 37115 useStoreProps(store, props, "orientation"); 37116 useStoreProps(store, props, "rtl"); 37117 useStoreProps(store, props, "focusLoop"); 37118 useStoreProps(store, props, "focusWrap"); 37119 useStoreProps(store, props, "focusShift"); 37120 return store; 37121 } 37122 function useCompositeStore(props = {}) { 37123 props = useCompositeStoreOptions(props); 37124 const [store, update] = useStore(Core.createCompositeStore, props); 37125 return useCompositeStoreProps(store, update, props); 37126 } 37127 37128 37129 37130 ;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js 37131 "use client"; 37132 37133 37134 37135 // src/disclosure/disclosure-store.ts 37136 37137 function useDisclosureStoreProps(store, update, props) { 37138 useUpdateEffect(update, [props.store, props.disclosure]); 37139 useStoreProps(store, props, "open", "setOpen"); 37140 useStoreProps(store, props, "mounted", "setMounted"); 37141 useStoreProps(store, props, "animated"); 37142 return Object.assign(store, { disclosure: props.disclosure }); 37143 } 37144 function useDisclosureStore(props = {}) { 37145 const [store, update] = useStore(Core.createDisclosureStore, props); 37146 return useDisclosureStoreProps(store, update, props); 37147 } 37148 37149 37150 37151 ;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js 37152 "use client"; 37153 37154 37155 37156 // src/dialog/dialog-store.ts 37157 37158 function useDialogStoreProps(store, update, props) { 37159 return useDisclosureStoreProps(store, update, props); 37160 } 37161 function useDialogStore(props = {}) { 37162 const [store, update] = useStore(Core.createDialogStore, props); 37163 return useDialogStoreProps(store, update, props); 37164 } 37165 37166 37167 37168 ;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js 37169 "use client"; 37170 37171 37172 37173 37174 // src/popover/popover-store.ts 37175 37176 function usePopoverStoreProps(store, update, props) { 37177 useUpdateEffect(update, [props.popover]); 37178 useStoreProps(store, props, "placement"); 37179 return useDialogStoreProps(store, update, props); 37180 } 37181 function usePopoverStore(props = {}) { 37182 const [store, update] = useStore(Core.createPopoverStore, props); 37183 return usePopoverStoreProps(store, update, props); 37184 } 37185 37186 37187 37188 ;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js 37189 "use client"; 37190 37191 37192 37193 37194 37195 // src/collection/collection-store.ts 37196 function getCommonParent(items) { 37197 var _a; 37198 const firstItem = items.find((item) => !!item.element); 37199 const lastItem = [...items].reverse().find((item) => !!item.element); 37200 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; 37201 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { 37202 const parent = parentElement; 37203 if (lastItem && parent.contains(lastItem.element)) { 37204 return parentElement; 37205 } 37206 parentElement = parentElement.parentElement; 37207 } 37208 return getDocument(parentElement).body; 37209 } 37210 function getPrivateStore(store) { 37211 return store == null ? void 0 : store.__unstablePrivateStore; 37212 } 37213 function createCollectionStore(props = {}) { 37214 var _a; 37215 throwOnConflictingProps(props, props.store); 37216 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 37217 const items = defaultValue( 37218 props.items, 37219 syncState == null ? void 0 : syncState.items, 37220 props.defaultItems, 37221 [] 37222 ); 37223 const itemsMap = new Map(items.map((item) => [item.id, item])); 37224 const initialState = { 37225 items, 37226 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) 37227 }; 37228 const syncPrivateStore = getPrivateStore(props.store); 37229 const privateStore = createStore( 37230 { items, renderedItems: initialState.renderedItems }, 37231 syncPrivateStore 37232 ); 37233 const collection = createStore(initialState, props.store); 37234 const sortItems = (renderedItems) => { 37235 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element); 37236 privateStore.setState("renderedItems", sortedItems); 37237 collection.setState("renderedItems", sortedItems); 37238 }; 37239 setup(collection, () => init(privateStore)); 37240 setup(privateStore, () => { 37241 return batch(privateStore, ["items"], (state) => { 37242 collection.setState("items", state.items); 37243 }); 37244 }); 37245 setup(privateStore, () => { 37246 return batch(privateStore, ["renderedItems"], (state) => { 37247 let firstRun = true; 37248 let raf = requestAnimationFrame(() => { 37249 const { renderedItems } = collection.getState(); 37250 if (state.renderedItems === renderedItems) return; 37251 sortItems(state.renderedItems); 37252 }); 37253 if (typeof IntersectionObserver !== "function") { 37254 return () => cancelAnimationFrame(raf); 37255 } 37256 const ioCallback = () => { 37257 if (firstRun) { 37258 firstRun = false; 37259 return; 37260 } 37261 cancelAnimationFrame(raf); 37262 raf = requestAnimationFrame(() => sortItems(state.renderedItems)); 37263 }; 37264 const root = getCommonParent(state.renderedItems); 37265 const observer = new IntersectionObserver(ioCallback, { root }); 37266 for (const item of state.renderedItems) { 37267 if (!item.element) continue; 37268 observer.observe(item.element); 37269 } 37270 return () => { 37271 cancelAnimationFrame(raf); 37272 observer.disconnect(); 37273 }; 37274 }); 37275 }); 37276 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 37277 let prevItem; 37278 setItems((items2) => { 37279 const index = items2.findIndex(({ id }) => id === item.id); 37280 const nextItems = items2.slice(); 37281 if (index !== -1) { 37282 prevItem = items2[index]; 37283 const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); 37284 nextItems[index] = nextItem; 37285 itemsMap.set(item.id, nextItem); 37286 } else { 37287 nextItems.push(item); 37288 itemsMap.set(item.id, item); 37289 } 37290 return nextItems; 37291 }); 37292 const unmergeItem = () => { 37293 setItems((items2) => { 37294 if (!prevItem) { 37295 if (canDeleteFromMap) { 37296 itemsMap.delete(item.id); 37297 } 37298 return items2.filter(({ id }) => id !== item.id); 37299 } 37300 const index = items2.findIndex(({ id }) => id === item.id); 37301 if (index === -1) return items2; 37302 const nextItems = items2.slice(); 37303 nextItems[index] = prevItem; 37304 itemsMap.set(item.id, prevItem); 37305 return nextItems; 37306 }); 37307 }; 37308 return unmergeItem; 37309 }; 37310 const registerItem = (item) => mergeItem( 37311 item, 37312 (getItems) => privateStore.setState("items", getItems), 37313 true 37314 ); 37315 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { 37316 registerItem, 37317 renderItem: (item) => chain( 37318 registerItem(item), 37319 mergeItem( 37320 item, 37321 (getItems) => privateStore.setState("renderedItems", getItems) 37322 ) 37323 ), 37324 item: (id) => { 37325 if (!id) return null; 37326 let item = itemsMap.get(id); 37327 if (!item) { 37328 const { items: items2 } = privateStore.getState(); 37329 item = items2.find((item2) => item2.id === id); 37330 if (item) { 37331 itemsMap.set(id, item); 37332 } 37333 } 37334 return item || null; 37335 }, 37336 // @ts-expect-error Internal 37337 __unstablePrivateStore: privateStore 37338 }); 37339 } 37340 37341 37342 37343 ;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js 37344 "use client"; 37345 37346 // src/utils/array.ts 37347 function toArray(arg) { 37348 if (Array.isArray(arg)) { 37349 return arg; 37350 } 37351 return typeof arg !== "undefined" ? [arg] : []; 37352 } 37353 function addItemToArray(array, item, index = -1) { 37354 if (!(index in array)) { 37355 return [...array, item]; 37356 } 37357 return [...array.slice(0, index), item, ...array.slice(index)]; 37358 } 37359 function flatten2DArray(array) { 37360 const flattened = []; 37361 for (const row of array) { 37362 flattened.push(...row); 37363 } 37364 return flattened; 37365 } 37366 function reverseArray(array) { 37367 return array.slice().reverse(); 37368 } 37369 37370 37371 37372 ;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js 37373 "use client"; 37374 37375 37376 37377 37378 37379 37380 // src/composite/composite-store.ts 37381 var NULL_ITEM = { id: null }; 37382 function findFirstEnabledItem(items, excludeId) { 37383 return items.find((item) => { 37384 if (excludeId) { 37385 return !item.disabled && item.id !== excludeId; 37386 } 37387 return !item.disabled; 37388 }); 37389 } 37390 function getEnabledItems(items, excludeId) { 37391 return items.filter((item) => { 37392 if (excludeId) { 37393 return !item.disabled && item.id !== excludeId; 37394 } 37395 return !item.disabled; 37396 }); 37397 } 37398 function getItemsInRow(items, rowId) { 37399 return items.filter((item) => item.rowId === rowId); 37400 } 37401 function flipItems(items, activeId, shouldInsertNullItem = false) { 37402 const index = items.findIndex((item) => item.id === activeId); 37403 return [ 37404 ...items.slice(index + 1), 37405 ...shouldInsertNullItem ? [NULL_ITEM] : [], 37406 ...items.slice(0, index) 37407 ]; 37408 } 37409 function groupItemsByRows(items) { 37410 const rows = []; 37411 for (const item of items) { 37412 const row = rows.find((currentRow) => { 37413 var _a; 37414 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 37415 }); 37416 if (row) { 37417 row.push(item); 37418 } else { 37419 rows.push([item]); 37420 } 37421 } 37422 return rows; 37423 } 37424 function getMaxRowLength(array) { 37425 let maxLength = 0; 37426 for (const { length } of array) { 37427 if (length > maxLength) { 37428 maxLength = length; 37429 } 37430 } 37431 return maxLength; 37432 } 37433 function createEmptyItem(rowId) { 37434 return { 37435 id: "__EMPTY_ITEM__", 37436 disabled: true, 37437 rowId 37438 }; 37439 } 37440 function normalizeRows(rows, activeId, focusShift) { 37441 const maxLength = getMaxRowLength(rows); 37442 for (const row of rows) { 37443 for (let i = 0; i < maxLength; i += 1) { 37444 const item = row[i]; 37445 if (!item || focusShift && item.disabled) { 37446 const isFirst = i === 0; 37447 const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; 37448 row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); 37449 } 37450 } 37451 } 37452 return rows; 37453 } 37454 function verticalizeItems(items) { 37455 const rows = groupItemsByRows(items); 37456 const maxLength = getMaxRowLength(rows); 37457 const verticalized = []; 37458 for (let i = 0; i < maxLength; i += 1) { 37459 for (const row of rows) { 37460 const item = row[i]; 37461 if (item) { 37462 verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { 37463 // If there's no rowId, it means that it's not a grid composite, but 37464 // a single row instead. So, instead of verticalizing it, that is, 37465 // assigning a different rowId based on the column index, we keep it 37466 // undefined so they will be part of the same row. This is useful 37467 // when using up/down on one-dimensional composites. 37468 rowId: item.rowId ? `$i}` : void 0 37469 })); 37470 } 37471 } 37472 } 37473 return verticalized; 37474 } 37475 function createCompositeStore(props = {}) { 37476 var _a; 37477 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 37478 const collection = createCollectionStore(props); 37479 const activeId = defaultValue( 37480 props.activeId, 37481 syncState == null ? void 0 : syncState.activeId, 37482 props.defaultActiveId 37483 ); 37484 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { 37485 id: defaultValue( 37486 props.id, 37487 syncState == null ? void 0 : syncState.id, 37488 `id-$Math.random().toString(36).slice(2, 8)}` 37489 ), 37490 activeId, 37491 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), 37492 includesBaseElement: defaultValue( 37493 props.includesBaseElement, 37494 syncState == null ? void 0 : syncState.includesBaseElement, 37495 activeId === null 37496 ), 37497 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), 37498 orientation: defaultValue( 37499 props.orientation, 37500 syncState == null ? void 0 : syncState.orientation, 37501 "both" 37502 ), 37503 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), 37504 virtualFocus: defaultValue( 37505 props.virtualFocus, 37506 syncState == null ? void 0 : syncState.virtualFocus, 37507 false 37508 ), 37509 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), 37510 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), 37511 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) 37512 }); 37513 const composite = createStore(initialState, collection, props.store); 37514 setup( 37515 composite, 37516 () => sync(composite, ["renderedItems", "activeId"], (state) => { 37517 composite.setState("activeId", (activeId2) => { 37518 var _a2; 37519 if (activeId2 !== void 0) return activeId2; 37520 return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; 37521 }); 37522 }) 37523 ); 37524 const getNextId = (direction = "next", options = {}) => { 37525 var _a2, _b; 37526 const defaultState = composite.getState(); 37527 const { 37528 skip = 0, 37529 activeId: activeId2 = defaultState.activeId, 37530 focusShift = defaultState.focusShift, 37531 focusLoop = defaultState.focusLoop, 37532 focusWrap = defaultState.focusWrap, 37533 includesBaseElement = defaultState.includesBaseElement, 37534 renderedItems = defaultState.renderedItems, 37535 rtl = defaultState.rtl 37536 } = options; 37537 const isVerticalDirection = direction === "up" || direction === "down"; 37538 const isNextDirection = direction === "next" || direction === "down"; 37539 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; 37540 const canShift = focusShift && !skip; 37541 let items = !isVerticalDirection ? renderedItems : flatten2DArray( 37542 normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift) 37543 ); 37544 items = canReverse ? reverseArray(items) : items; 37545 items = isVerticalDirection ? verticalizeItems(items) : items; 37546 if (activeId2 == null) { 37547 return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id; 37548 } 37549 const activeItem = items.find((item) => item.id === activeId2); 37550 if (!activeItem) { 37551 return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id; 37552 } 37553 const isGrid = items.some((item) => item.rowId); 37554 const activeIndex = items.indexOf(activeItem); 37555 const nextItems = items.slice(activeIndex + 1); 37556 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 37557 if (skip) { 37558 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 37559 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. 37560 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; 37561 return nextItem2 == null ? void 0 : nextItem2.id; 37562 } 37563 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); 37564 const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); 37565 const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; 37566 if (canLoop) { 37567 const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); 37568 const sortedItems = flipItems(loopItems, activeId2, hasNullItem); 37569 const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); 37570 return nextItem2 == null ? void 0 : nextItem2.id; 37571 } 37572 if (canWrap) { 37573 const nextItem2 = findFirstEnabledItem( 37574 // We can use nextItems, which contains all the next items, including 37575 // items from other rows, to wrap between rows. However, if there is a 37576 // null item (the composite container), we'll only use the next items in 37577 // the row. So moving next from the last item will focus on the 37578 // composite container. On grid composites, horizontal navigation never 37579 // focuses on the composite container, only vertical. 37580 hasNullItem ? nextItemsInRow : nextItems, 37581 activeId2 37582 ); 37583 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; 37584 return nextId; 37585 } 37586 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); 37587 if (!nextItem && hasNullItem) { 37588 return null; 37589 } 37590 return nextItem == null ? void 0 : nextItem.id; 37591 }; 37592 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { 37593 setBaseElement: (element) => composite.setState("baseElement", element), 37594 setActiveId: (id) => composite.setState("activeId", id), 37595 move: (id) => { 37596 if (id === void 0) return; 37597 composite.setState("activeId", id); 37598 composite.setState("moves", (moves) => moves + 1); 37599 }, 37600 first: () => { 37601 var _a2; 37602 return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; 37603 }, 37604 last: () => { 37605 var _a2; 37606 return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; 37607 }, 37608 next: (options) => { 37609 if (options !== void 0 && typeof options === "number") { 37610 options = { skip: options }; 37611 } 37612 return getNextId("next", options); 37613 }, 37614 previous: (options) => { 37615 if (options !== void 0 && typeof options === "number") { 37616 options = { skip: options }; 37617 } 37618 return getNextId("previous", options); 37619 }, 37620 down: (options) => { 37621 if (options !== void 0 && typeof options === "number") { 37622 options = { skip: options }; 37623 } 37624 return getNextId("down", options); 37625 }, 37626 up: (options) => { 37627 if (options !== void 0 && typeof options === "number") { 37628 options = { skip: options }; 37629 } 37630 return getNextId("up", options); 37631 } 37632 }); 37633 } 37634 37635 37636 37637 ;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js 37638 "use client"; 37639 37640 37641 37642 37643 // src/disclosure/disclosure-store.ts 37644 function createDisclosureStore(props = {}) { 37645 const store = mergeStore( 37646 props.store, 37647 omit2(props.disclosure, ["contentElement", "disclosureElement"]) 37648 ); 37649 throwOnConflictingProps(props, store); 37650 const syncState = store == null ? void 0 : store.getState(); 37651 const open = defaultValue( 37652 props.open, 37653 syncState == null ? void 0 : syncState.open, 37654 props.defaultOpen, 37655 false 37656 ); 37657 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); 37658 const initialState = { 37659 open, 37660 animated, 37661 animating: !!animated && open, 37662 mounted: open, 37663 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), 37664 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) 37665 }; 37666 const disclosure = createStore(initialState, store); 37667 setup( 37668 disclosure, 37669 () => sync(disclosure, ["animated", "animating"], (state) => { 37670 if (state.animated) return; 37671 disclosure.setState("animating", false); 37672 }) 37673 ); 37674 setup( 37675 disclosure, 37676 () => subscribe(disclosure, ["open"], () => { 37677 if (!disclosure.getState().animated) return; 37678 disclosure.setState("animating", true); 37679 }) 37680 ); 37681 setup( 37682 disclosure, 37683 () => sync(disclosure, ["open", "animating"], (state) => { 37684 disclosure.setState("mounted", state.open || state.animating); 37685 }) 37686 ); 37687 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { 37688 disclosure: props.disclosure, 37689 setOpen: (value) => disclosure.setState("open", value), 37690 show: () => disclosure.setState("open", true), 37691 hide: () => disclosure.setState("open", false), 37692 toggle: () => disclosure.setState("open", (open2) => !open2), 37693 stopAnimation: () => disclosure.setState("animating", false), 37694 setContentElement: (value) => disclosure.setState("contentElement", value), 37695 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 37696 }); 37697 } 37698 37699 37700 37701 ;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js 37702 "use client"; 37703 37704 37705 // src/dialog/dialog-store.ts 37706 function createDialogStore(props = {}) { 37707 return createDisclosureStore(props); 37708 } 37709 37710 37711 37712 ;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js 37713 "use client"; 37714 37715 37716 37717 37718 37719 // src/popover/popover-store.ts 37720 function createPopoverStore(_a = {}) { 37721 var _b = _a, { 37722 popover: otherPopover 37723 } = _b, props = _3YLGPPWQ_objRest(_b, [ 37724 "popover" 37725 ]); 37726 const store = mergeStore( 37727 props.store, 37728 omit2(otherPopover, [ 37729 "arrowElement", 37730 "anchorElement", 37731 "contentElement", 37732 "popoverElement", 37733 "disclosureElement" 37734 ]) 37735 ); 37736 throwOnConflictingProps(props, store); 37737 const syncState = store == null ? void 0 : store.getState(); 37738 const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); 37739 const placement = defaultValue( 37740 props.placement, 37741 syncState == null ? void 0 : syncState.placement, 37742 "bottom" 37743 ); 37744 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { 37745 placement, 37746 currentPlacement: placement, 37747 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), 37748 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), 37749 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), 37750 rendered: Symbol("rendered") 37751 }); 37752 const popover = createStore(initialState, dialog, store); 37753 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { 37754 setAnchorElement: (element) => popover.setState("anchorElement", element), 37755 setPopoverElement: (element) => popover.setState("popoverElement", element), 37756 setArrowElement: (element) => popover.setState("arrowElement", element), 37757 render: () => popover.setState("rendered", Symbol("rendered")) 37758 }); 37759 } 37760 37761 37762 37763 ;// ./node_modules/@ariakit/core/esm/combobox/combobox-store.js 37764 "use client"; 37765 37766 37767 37768 37769 37770 37771 37772 37773 37774 37775 37776 37777 // src/combobox/combobox-store.ts 37778 var isTouchSafari = isSafari() && isTouchDevice(); 37779 function createComboboxStore(_a = {}) { 37780 var _b = _a, { 37781 tag 37782 } = _b, props = _3YLGPPWQ_objRest(_b, [ 37783 "tag" 37784 ]); 37785 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 37786 throwOnConflictingProps(props, store); 37787 const tagState = tag == null ? void 0 : tag.getState(); 37788 const syncState = store == null ? void 0 : store.getState(); 37789 const activeId = defaultValue( 37790 props.activeId, 37791 syncState == null ? void 0 : syncState.activeId, 37792 props.defaultActiveId, 37793 null 37794 ); 37795 const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 37796 activeId, 37797 includesBaseElement: defaultValue( 37798 props.includesBaseElement, 37799 syncState == null ? void 0 : syncState.includesBaseElement, 37800 true 37801 ), 37802 orientation: defaultValue( 37803 props.orientation, 37804 syncState == null ? void 0 : syncState.orientation, 37805 "vertical" 37806 ), 37807 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), 37808 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), 37809 virtualFocus: defaultValue( 37810 props.virtualFocus, 37811 syncState == null ? void 0 : syncState.virtualFocus, 37812 true 37813 ) 37814 })); 37815 const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 37816 placement: defaultValue( 37817 props.placement, 37818 syncState == null ? void 0 : syncState.placement, 37819 "bottom-start" 37820 ) 37821 })); 37822 const value = defaultValue( 37823 props.value, 37824 syncState == null ? void 0 : syncState.value, 37825 props.defaultValue, 37826 "" 37827 ); 37828 const selectedValue = defaultValue( 37829 props.selectedValue, 37830 syncState == null ? void 0 : syncState.selectedValue, 37831 tagState == null ? void 0 : tagState.values, 37832 props.defaultSelectedValue, 37833 "" 37834 ); 37835 const multiSelectable = Array.isArray(selectedValue); 37836 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { 37837 value, 37838 selectedValue, 37839 resetValueOnSelect: defaultValue( 37840 props.resetValueOnSelect, 37841 syncState == null ? void 0 : syncState.resetValueOnSelect, 37842 multiSelectable 37843 ), 37844 resetValueOnHide: defaultValue( 37845 props.resetValueOnHide, 37846 syncState == null ? void 0 : syncState.resetValueOnHide, 37847 multiSelectable && !tag 37848 ), 37849 activeValue: syncState == null ? void 0 : syncState.activeValue 37850 }); 37851 const combobox = createStore(initialState, composite, popover, store); 37852 if (isTouchSafari) { 37853 setup( 37854 combobox, 37855 () => sync(combobox, ["virtualFocus"], () => { 37856 combobox.setState("virtualFocus", false); 37857 }) 37858 ); 37859 } 37860 setup(combobox, () => { 37861 if (!tag) return; 37862 return chain( 37863 sync(combobox, ["selectedValue"], (state) => { 37864 if (!Array.isArray(state.selectedValue)) return; 37865 tag.setValues(state.selectedValue); 37866 }), 37867 sync(tag, ["values"], (state) => { 37868 combobox.setState("selectedValue", state.values); 37869 }) 37870 ); 37871 }); 37872 setup( 37873 combobox, 37874 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { 37875 if (!state.resetValueOnHide) return; 37876 if (state.mounted) return; 37877 combobox.setState("value", value); 37878 }) 37879 ); 37880 setup( 37881 combobox, 37882 () => sync(combobox, ["open"], (state) => { 37883 if (state.open) return; 37884 combobox.setState("activeId", activeId); 37885 combobox.setState("moves", 0); 37886 }) 37887 ); 37888 setup( 37889 combobox, 37890 () => sync(combobox, ["moves", "activeId"], (state, prevState) => { 37891 if (state.moves === prevState.moves) { 37892 combobox.setState("activeValue", void 0); 37893 } 37894 }) 37895 ); 37896 setup( 37897 combobox, 37898 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 37899 if (state.moves === prev.moves) return; 37900 const { activeId: activeId2 } = combobox.getState(); 37901 const activeItem = composite.item(activeId2); 37902 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); 37903 }) 37904 ); 37905 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), { 37906 tag, 37907 setValue: (value2) => combobox.setState("value", value2), 37908 resetValue: () => combobox.setState("value", initialState.value), 37909 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 37910 }); 37911 } 37912 37913 37914 ;// ./node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js 37915 "use client"; 37916 37917 37918 37919 37920 37921 37922 37923 // src/combobox/combobox-store.ts 37924 37925 function useComboboxStoreOptions(props) { 37926 const tag = useTagContext(); 37927 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 37928 tag: props.tag !== void 0 ? props.tag : tag 37929 }); 37930 return useCompositeStoreOptions(props); 37931 } 37932 function useComboboxStoreProps(store, update, props) { 37933 useUpdateEffect(update, [props.tag]); 37934 useStoreProps(store, props, "value", "setValue"); 37935 useStoreProps(store, props, "selectedValue", "setSelectedValue"); 37936 useStoreProps(store, props, "resetValueOnHide"); 37937 useStoreProps(store, props, "resetValueOnSelect"); 37938 return Object.assign( 37939 useCompositeStoreProps( 37940 usePopoverStoreProps(store, update, props), 37941 update, 37942 props 37943 ), 37944 { tag: props.tag } 37945 ); 37946 } 37947 function useComboboxStore(props = {}) { 37948 props = useComboboxStoreOptions(props); 37949 const [store, update] = YV4JVR4I_useStore(createComboboxStore, props); 37950 return useComboboxStoreProps(store, update, props); 37951 } 37952 37953 37954 37955 ;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js 37956 "use client"; 37957 37958 37959 // src/disclosure/disclosure-context.tsx 37960 var S6EF7IVO_ctx = createStoreContext(); 37961 var useDisclosureContext = S6EF7IVO_ctx.useContext; 37962 var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext; 37963 var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext; 37964 var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider; 37965 var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider; 37966 37967 37968 37969 ;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js 37970 "use client"; 37971 37972 37973 37974 // src/dialog/dialog-context.tsx 37975 37976 var RS7LB2H4_ctx = createStoreContext( 37977 [DisclosureContextProvider], 37978 [DisclosureScopedContextProvider] 37979 ); 37980 var useDialogContext = RS7LB2H4_ctx.useContext; 37981 var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext; 37982 var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext; 37983 var DialogContextProvider = RS7LB2H4_ctx.ContextProvider; 37984 var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider; 37985 var DialogHeadingContext = (0,external_React_.createContext)(void 0); 37986 var DialogDescriptionContext = (0,external_React_.createContext)(void 0); 37987 37988 37989 37990 ;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js 37991 "use client"; 37992 37993 37994 37995 // src/popover/popover-context.tsx 37996 var MTZPJQMC_ctx = createStoreContext( 37997 [DialogContextProvider], 37998 [DialogScopedContextProvider] 37999 ); 38000 var usePopoverContext = MTZPJQMC_ctx.useContext; 38001 var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext; 38002 var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext; 38003 var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider; 38004 var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider; 38005 38006 38007 38008 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js 38009 "use client"; 38010 38011 38012 38013 38014 // src/combobox/combobox-context.tsx 38015 38016 var ComboboxListRoleContext = (0,external_React_.createContext)( 38017 void 0 38018 ); 38019 var VEVQD5MH_ctx = createStoreContext( 38020 [PopoverContextProvider, CompositeContextProvider], 38021 [PopoverScopedContextProvider, CompositeScopedContextProvider] 38022 ); 38023 var useComboboxContext = VEVQD5MH_ctx.useContext; 38024 var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext; 38025 var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext; 38026 var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider; 38027 var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider; 38028 var ComboboxItemValueContext = (0,external_React_.createContext)( 38029 void 0 38030 ); 38031 var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); 38032 38033 38034 38035 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js 38036 "use client"; 38037 38038 38039 38040 38041 38042 38043 38044 38045 38046 38047 38048 38049 38050 38051 38052 38053 38054 38055 38056 // src/combobox/combobox-provider.tsx 38057 38058 function ComboboxProvider(props = {}) { 38059 const store = useComboboxStore(props); 38060 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children }); 38061 } 38062 38063 38064 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js 38065 "use client"; 38066 38067 38068 38069 38070 38071 38072 38073 38074 38075 38076 38077 // src/combobox/combobox-label.tsx 38078 38079 var TagName = "label"; 38080 var useComboboxLabel = createHook( 38081 function useComboboxLabel2(_a) { 38082 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 38083 const context = useComboboxProviderContext(); 38084 store = store || context; 38085 invariant( 38086 store, 38087 false && 0 38088 ); 38089 const comboboxId = store.useState((state) => { 38090 var _a2; 38091 return (_a2 = state.baseElement) == null ? void 0 : _a2.id; 38092 }); 38093 props = _3YLGPPWQ_spreadValues({ 38094 htmlFor: comboboxId 38095 }, props); 38096 return removeUndefinedValues(props); 38097 } 38098 ); 38099 var ComboboxLabel = memo2( 38100 forwardRef2(function ComboboxLabel2(props) { 38101 const htmlProps = useComboboxLabel(props); 38102 return createElement(TagName, htmlProps); 38103 }) 38104 ); 38105 38106 38107 ;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js 38108 "use client"; 38109 38110 38111 38112 38113 38114 // src/popover/popover-anchor.tsx 38115 var OMU7RWRV_TagName = "div"; 38116 var usePopoverAnchor = createHook( 38117 function usePopoverAnchor2(_a) { 38118 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 38119 const context = usePopoverProviderContext(); 38120 store = store || context; 38121 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 38122 ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) 38123 }); 38124 return props; 38125 } 38126 ); 38127 var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { 38128 const htmlProps = usePopoverAnchor(props); 38129 return createElement(OMU7RWRV_TagName, htmlProps); 38130 }); 38131 38132 38133 38134 ;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js 38135 "use client"; 38136 38137 // src/composite/utils.ts 38138 38139 var _5VQZOHHZ_NULL_ITEM = { id: null }; 38140 function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { 38141 const index = items.findIndex((item) => item.id === activeId); 38142 return [ 38143 ...items.slice(index + 1), 38144 ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], 38145 ...items.slice(0, index) 38146 ]; 38147 } 38148 function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { 38149 return items.find((item) => { 38150 if (excludeId) { 38151 return !item.disabled && item.id !== excludeId; 38152 } 38153 return !item.disabled; 38154 }); 38155 } 38156 function getEnabledItem(store, id) { 38157 if (!id) return null; 38158 return store.item(id) || null; 38159 } 38160 function _5VQZOHHZ_groupItemsByRows(items) { 38161 const rows = []; 38162 for (const item of items) { 38163 const row = rows.find((currentRow) => { 38164 var _a; 38165 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 38166 }); 38167 if (row) { 38168 row.push(item); 38169 } else { 38170 rows.push([item]); 38171 } 38172 } 38173 return rows; 38174 } 38175 function selectTextField(element, collapseToEnd = false) { 38176 if (isTextField(element)) { 38177 element.setSelectionRange( 38178 collapseToEnd ? element.value.length : 0, 38179 element.value.length 38180 ); 38181 } else if (element.isContentEditable) { 38182 const selection = getDocument(element).getSelection(); 38183 selection == null ? void 0 : selection.selectAllChildren(element); 38184 if (collapseToEnd) { 38185 selection == null ? void 0 : selection.collapseToEnd(); 38186 } 38187 } 38188 } 38189 var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); 38190 function focusSilently(element) { 38191 element[FOCUS_SILENTLY] = true; 38192 element.focus({ preventScroll: true }); 38193 } 38194 function silentlyFocused(element) { 38195 const isSilentlyFocused = element[FOCUS_SILENTLY]; 38196 delete element[FOCUS_SILENTLY]; 38197 return isSilentlyFocused; 38198 } 38199 function isItem(store, element, exclude) { 38200 if (!element) return false; 38201 if (element === exclude) return false; 38202 const item = store.item(element.id); 38203 if (!item) return false; 38204 if (exclude && item.element === exclude) return false; 38205 return true; 38206 } 38207 38208 38209 38210 ;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js 38211 "use client"; 38212 38213 // src/focusable/focusable-context.tsx 38214 38215 var FocusableContext = (0,external_React_.createContext)(true); 38216 38217 38218 38219 ;// ./node_modules/@ariakit/core/esm/utils/focus.js 38220 "use client"; 38221 38222 38223 38224 // src/utils/focus.ts 38225 var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])"; 38226 function hasNegativeTabIndex(element) { 38227 const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); 38228 return tabIndex < 0; 38229 } 38230 function isFocusable(element) { 38231 if (!element.matches(selector)) return false; 38232 if (!isVisible(element)) return false; 38233 if (element.closest("[inert]")) return false; 38234 return true; 38235 } 38236 function isTabbable(element) { 38237 if (!isFocusable(element)) return false; 38238 if (hasNegativeTabIndex(element)) return false; 38239 if (!("form" in element)) return true; 38240 if (!element.form) return true; 38241 if (element.checked) return true; 38242 if (element.type !== "radio") return true; 38243 const radioGroup = element.form.elements.namedItem(element.name); 38244 if (!radioGroup) return true; 38245 if (!("length" in radioGroup)) return true; 38246 const activeElement = getActiveElement(element); 38247 if (!activeElement) return true; 38248 if (activeElement === element) return true; 38249 if (!("form" in activeElement)) return true; 38250 if (activeElement.form !== element.form) return true; 38251 if (activeElement.name !== element.name) return true; 38252 return false; 38253 } 38254 function getAllFocusableIn(container, includeContainer) { 38255 const elements = Array.from( 38256 container.querySelectorAll(selector) 38257 ); 38258 if (includeContainer) { 38259 elements.unshift(container); 38260 } 38261 const focusableElements = elements.filter(isFocusable); 38262 focusableElements.forEach((element, i) => { 38263 if (isFrame(element) && element.contentDocument) { 38264 const frameBody = element.contentDocument.body; 38265 focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); 38266 } 38267 }); 38268 return focusableElements; 38269 } 38270 function getAllFocusable(includeBody) { 38271 return getAllFocusableIn(document.body, includeBody); 38272 } 38273 function getFirstFocusableIn(container, includeContainer) { 38274 const [first] = getAllFocusableIn(container, includeContainer); 38275 return first || null; 38276 } 38277 function getFirstFocusable(includeBody) { 38278 return getFirstFocusableIn(document.body, includeBody); 38279 } 38280 function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { 38281 const elements = Array.from( 38282 container.querySelectorAll(selector) 38283 ); 38284 const tabbableElements = elements.filter(isTabbable); 38285 if (includeContainer && isTabbable(container)) { 38286 tabbableElements.unshift(container); 38287 } 38288 tabbableElements.forEach((element, i) => { 38289 if (isFrame(element) && element.contentDocument) { 38290 const frameBody = element.contentDocument.body; 38291 const allFrameTabbable = getAllTabbableIn( 38292 frameBody, 38293 false, 38294 fallbackToFocusable 38295 ); 38296 tabbableElements.splice(i, 1, ...allFrameTabbable); 38297 } 38298 }); 38299 if (!tabbableElements.length && fallbackToFocusable) { 38300 return elements; 38301 } 38302 return tabbableElements; 38303 } 38304 function getAllTabbable(fallbackToFocusable) { 38305 return getAllTabbableIn(document.body, false, fallbackToFocusable); 38306 } 38307 function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { 38308 const [first] = getAllTabbableIn( 38309 container, 38310 includeContainer, 38311 fallbackToFocusable 38312 ); 38313 return first || null; 38314 } 38315 function getFirstTabbable(fallbackToFocusable) { 38316 return getFirstTabbableIn(document.body, false, fallbackToFocusable); 38317 } 38318 function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { 38319 const allTabbable = getAllTabbableIn( 38320 container, 38321 includeContainer, 38322 fallbackToFocusable 38323 ); 38324 return allTabbable[allTabbable.length - 1] || null; 38325 } 38326 function getLastTabbable(fallbackToFocusable) { 38327 return getLastTabbableIn(document.body, false, fallbackToFocusable); 38328 } 38329 function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { 38330 const activeElement = getActiveElement(container); 38331 const allFocusable = getAllFocusableIn(container, includeContainer); 38332 const activeIndex = allFocusable.indexOf(activeElement); 38333 const nextFocusableElements = allFocusable.slice(activeIndex + 1); 38334 return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; 38335 } 38336 function getNextTabbable(fallbackToFirst, fallbackToFocusable) { 38337 return getNextTabbableIn( 38338 document.body, 38339 false, 38340 fallbackToFirst, 38341 fallbackToFocusable 38342 ); 38343 } 38344 function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { 38345 const activeElement = getActiveElement(container); 38346 const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); 38347 const activeIndex = allFocusable.indexOf(activeElement); 38348 const previousFocusableElements = allFocusable.slice(activeIndex + 1); 38349 return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; 38350 } 38351 function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { 38352 return getPreviousTabbableIn( 38353 document.body, 38354 false, 38355 fallbackToFirst, 38356 fallbackToFocusable 38357 ); 38358 } 38359 function getClosestFocusable(element) { 38360 while (element && !isFocusable(element)) { 38361 element = element.closest(selector); 38362 } 38363 return element || null; 38364 } 38365 function hasFocus(element) { 38366 const activeElement = DTR5TSDJ_getActiveElement(element); 38367 if (!activeElement) return false; 38368 if (activeElement === element) return true; 38369 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 38370 if (!activeDescendant) return false; 38371 return activeDescendant === element.id; 38372 } 38373 function hasFocusWithin(element) { 38374 const activeElement = DTR5TSDJ_getActiveElement(element); 38375 if (!activeElement) return false; 38376 if (contains(element, activeElement)) return true; 38377 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 38378 if (!activeDescendant) return false; 38379 if (!("id" in element)) return false; 38380 if (activeDescendant === element.id) return true; 38381 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 38382 } 38383 function focusIfNeeded(element) { 38384 if (!hasFocusWithin(element) && isFocusable(element)) { 38385 element.focus(); 38386 } 38387 } 38388 function disableFocus(element) { 38389 var _a; 38390 const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; 38391 element.setAttribute("data-tabindex", currentTabindex); 38392 element.setAttribute("tabindex", "-1"); 38393 } 38394 function disableFocusIn(container, includeContainer) { 38395 const tabbableElements = getAllTabbableIn(container, includeContainer); 38396 for (const element of tabbableElements) { 38397 disableFocus(element); 38398 } 38399 } 38400 function restoreFocusIn(container) { 38401 const elements = container.querySelectorAll("[data-tabindex]"); 38402 const restoreTabIndex = (element) => { 38403 const tabindex = element.getAttribute("data-tabindex"); 38404 element.removeAttribute("data-tabindex"); 38405 if (tabindex) { 38406 element.setAttribute("tabindex", tabindex); 38407 } else { 38408 element.removeAttribute("tabindex"); 38409 } 38410 }; 38411 if (container.hasAttribute("data-tabindex")) { 38412 restoreTabIndex(container); 38413 } 38414 for (const element of elements) { 38415 restoreTabIndex(element); 38416 } 38417 } 38418 function focusIntoView(element, options) { 38419 if (!("scrollIntoView" in element)) { 38420 element.focus(); 38421 } else { 38422 element.focus({ preventScroll: true }); 38423 element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); 38424 } 38425 } 38426 38427 38428 ;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js 38429 "use client"; 38430 38431 38432 38433 38434 38435 // src/focusable/focusable.tsx 38436 38437 38438 38439 38440 38441 38442 var LVA2YJMS_TagName = "div"; 38443 var isSafariBrowser = isSafari(); 38444 var alwaysFocusVisibleInputTypes = [ 38445 "text", 38446 "search", 38447 "url", 38448 "tel", 38449 "email", 38450 "password", 38451 "number", 38452 "date", 38453 "month", 38454 "week", 38455 "time", 38456 "datetime", 38457 "datetime-local" 38458 ]; 38459 var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); 38460 function isSafariFocusAncestor(element) { 38461 if (!element) return false; 38462 return !!element[safariFocusAncestorSymbol]; 38463 } 38464 function markSafariFocusAncestor(element, value) { 38465 if (!element) return; 38466 element[safariFocusAncestorSymbol] = value; 38467 } 38468 function isAlwaysFocusVisible(element) { 38469 const { tagName, readOnly, type } = element; 38470 if (tagName === "TEXTAREA" && !readOnly) return true; 38471 if (tagName === "SELECT" && !readOnly) return true; 38472 if (tagName === "INPUT" && !readOnly) { 38473 return alwaysFocusVisibleInputTypes.includes(type); 38474 } 38475 if (element.isContentEditable) return true; 38476 const role = element.getAttribute("role"); 38477 if (role === "combobox" && element.dataset.name) { 38478 return true; 38479 } 38480 return false; 38481 } 38482 function getLabels(element) { 38483 if ("labels" in element) { 38484 return element.labels; 38485 } 38486 return null; 38487 } 38488 function isNativeCheckboxOrRadio(element) { 38489 const tagName = element.tagName.toLowerCase(); 38490 if (tagName === "input" && element.type) { 38491 return element.type === "radio" || element.type === "checkbox"; 38492 } 38493 return false; 38494 } 38495 function isNativeTabbable(tagName) { 38496 if (!tagName) return true; 38497 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 38498 } 38499 function supportsDisabledAttribute(tagName) { 38500 if (!tagName) return true; 38501 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 38502 } 38503 function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { 38504 if (!focusable) { 38505 return tabIndexProp; 38506 } 38507 if (trulyDisabled) { 38508 if (nativeTabbable && !supportsDisabled) { 38509 return -1; 38510 } 38511 return; 38512 } 38513 if (nativeTabbable) { 38514 return tabIndexProp; 38515 } 38516 return tabIndexProp || 0; 38517 } 38518 function useDisableEvent(onEvent, disabled) { 38519 return useEvent((event) => { 38520 onEvent == null ? void 0 : onEvent(event); 38521 if (event.defaultPrevented) return; 38522 if (disabled) { 38523 event.stopPropagation(); 38524 event.preventDefault(); 38525 } 38526 }); 38527 } 38528 var isKeyboardModality = true; 38529 function onGlobalMouseDown(event) { 38530 const target = event.target; 38531 if (target && "hasAttribute" in target) { 38532 if (!target.hasAttribute("data-focus-visible")) { 38533 isKeyboardModality = false; 38534 } 38535 } 38536 } 38537 function onGlobalKeyDown(event) { 38538 if (event.metaKey) return; 38539 if (event.ctrlKey) return; 38540 if (event.altKey) return; 38541 isKeyboardModality = true; 38542 } 38543 var useFocusable = createHook( 38544 function useFocusable2(_a) { 38545 var _b = _a, { 38546 focusable = true, 38547 accessibleWhenDisabled, 38548 autoFocus, 38549 onFocusVisible 38550 } = _b, props = __objRest(_b, [ 38551 "focusable", 38552 "accessibleWhenDisabled", 38553 "autoFocus", 38554 "onFocusVisible" 38555 ]); 38556 const ref = (0,external_React_.useRef)(null); 38557 (0,external_React_.useEffect)(() => { 38558 if (!focusable) return; 38559 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 38560 addGlobalEventListener("keydown", onGlobalKeyDown, true); 38561 }, [focusable]); 38562 if (isSafariBrowser) { 38563 (0,external_React_.useEffect)(() => { 38564 if (!focusable) return; 38565 const element = ref.current; 38566 if (!element) return; 38567 if (!isNativeCheckboxOrRadio(element)) return; 38568 const labels = getLabels(element); 38569 if (!labels) return; 38570 const onMouseUp = () => queueMicrotask(() => element.focus()); 38571 for (const label of labels) { 38572 label.addEventListener("mouseup", onMouseUp); 38573 } 38574 return () => { 38575 for (const label of labels) { 38576 label.removeEventListener("mouseup", onMouseUp); 38577 } 38578 }; 38579 }, [focusable]); 38580 } 38581 const disabled = focusable && disabledFromProps(props); 38582 const trulyDisabled = !!disabled && !accessibleWhenDisabled; 38583 const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); 38584 (0,external_React_.useEffect)(() => { 38585 if (!focusable) return; 38586 if (trulyDisabled && focusVisible) { 38587 setFocusVisible(false); 38588 } 38589 }, [focusable, trulyDisabled, focusVisible]); 38590 (0,external_React_.useEffect)(() => { 38591 if (!focusable) return; 38592 if (!focusVisible) return; 38593 const element = ref.current; 38594 if (!element) return; 38595 if (typeof IntersectionObserver === "undefined") return; 38596 const observer = new IntersectionObserver(() => { 38597 if (!isFocusable(element)) { 38598 setFocusVisible(false); 38599 } 38600 }); 38601 observer.observe(element); 38602 return () => observer.disconnect(); 38603 }, [focusable, focusVisible]); 38604 const onKeyPressCapture = useDisableEvent( 38605 props.onKeyPressCapture, 38606 disabled 38607 ); 38608 const onMouseDownCapture = useDisableEvent( 38609 props.onMouseDownCapture, 38610 disabled 38611 ); 38612 const onClickCapture = useDisableEvent(props.onClickCapture, disabled); 38613 const onMouseDownProp = props.onMouseDown; 38614 const onMouseDown = useEvent((event) => { 38615 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 38616 if (event.defaultPrevented) return; 38617 if (!focusable) return; 38618 const element = event.currentTarget; 38619 if (!isSafariBrowser) return; 38620 if (isPortalEvent(event)) return; 38621 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; 38622 let receivedFocus = false; 38623 const onFocus = () => { 38624 receivedFocus = true; 38625 }; 38626 const options = { capture: true, once: true }; 38627 element.addEventListener("focusin", onFocus, options); 38628 const focusableContainer = getClosestFocusable(element.parentElement); 38629 markSafariFocusAncestor(focusableContainer, true); 38630 queueBeforeEvent(element, "mouseup", () => { 38631 element.removeEventListener("focusin", onFocus, true); 38632 markSafariFocusAncestor(focusableContainer, false); 38633 if (receivedFocus) return; 38634 focusIfNeeded(element); 38635 }); 38636 }); 38637 const handleFocusVisible = (event, currentTarget) => { 38638 if (currentTarget) { 38639 event.currentTarget = currentTarget; 38640 } 38641 if (!focusable) return; 38642 const element = event.currentTarget; 38643 if (!element) return; 38644 if (!hasFocus(element)) return; 38645 onFocusVisible == null ? void 0 : onFocusVisible(event); 38646 if (event.defaultPrevented) return; 38647 element.dataset.focusVisible = "true"; 38648 setFocusVisible(true); 38649 }; 38650 const onKeyDownCaptureProp = props.onKeyDownCapture; 38651 const onKeyDownCapture = useEvent((event) => { 38652 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); 38653 if (event.defaultPrevented) return; 38654 if (!focusable) return; 38655 if (focusVisible) return; 38656 if (event.metaKey) return; 38657 if (event.altKey) return; 38658 if (event.ctrlKey) return; 38659 if (!isSelfTarget(event)) return; 38660 const element = event.currentTarget; 38661 const applyFocusVisible = () => handleFocusVisible(event, element); 38662 queueBeforeEvent(element, "focusout", applyFocusVisible); 38663 }); 38664 const onFocusCaptureProp = props.onFocusCapture; 38665 const onFocusCapture = useEvent((event) => { 38666 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 38667 if (event.defaultPrevented) return; 38668 if (!focusable) return; 38669 if (!isSelfTarget(event)) { 38670 setFocusVisible(false); 38671 return; 38672 } 38673 const element = event.currentTarget; 38674 const applyFocusVisible = () => handleFocusVisible(event, element); 38675 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { 38676 queueBeforeEvent(event.target, "focusout", applyFocusVisible); 38677 } else { 38678 setFocusVisible(false); 38679 } 38680 }); 38681 const onBlurProp = props.onBlur; 38682 const onBlur = useEvent((event) => { 38683 onBlurProp == null ? void 0 : onBlurProp(event); 38684 if (!focusable) return; 38685 if (!isFocusEventOutside(event)) return; 38686 setFocusVisible(false); 38687 }); 38688 const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); 38689 const autoFocusRef = useEvent((element) => { 38690 if (!focusable) return; 38691 if (!autoFocus) return; 38692 if (!element) return; 38693 if (!autoFocusOnShow) return; 38694 queueMicrotask(() => { 38695 if (hasFocus(element)) return; 38696 if (!isFocusable(element)) return; 38697 element.focus(); 38698 }); 38699 }); 38700 const tagName = useTagName(ref); 38701 const nativeTabbable = focusable && isNativeTabbable(tagName); 38702 const supportsDisabled = focusable && supportsDisabledAttribute(tagName); 38703 const styleProp = props.style; 38704 const style = (0,external_React_.useMemo)(() => { 38705 if (trulyDisabled) { 38706 return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); 38707 } 38708 return styleProp; 38709 }, [trulyDisabled, styleProp]); 38710 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 38711 "data-focus-visible": focusable && focusVisible || void 0, 38712 "data-autofocus": autoFocus || void 0, 38713 "aria-disabled": disabled || void 0 38714 }, props), { 38715 ref: useMergeRefs(ref, autoFocusRef, props.ref), 38716 style, 38717 tabIndex: getTabIndex( 38718 focusable, 38719 trulyDisabled, 38720 nativeTabbable, 38721 supportsDisabled, 38722 props.tabIndex 38723 ), 38724 disabled: supportsDisabled && trulyDisabled ? true : void 0, 38725 // TODO: Test Focusable contentEditable. 38726 contentEditable: disabled ? void 0 : props.contentEditable, 38727 onKeyPressCapture, 38728 onClickCapture, 38729 onMouseDownCapture, 38730 onMouseDown, 38731 onKeyDownCapture, 38732 onFocusCapture, 38733 onBlur 38734 }); 38735 return removeUndefinedValues(props); 38736 } 38737 ); 38738 var Focusable = forwardRef2(function Focusable2(props) { 38739 const htmlProps = useFocusable(props); 38740 return createElement(LVA2YJMS_TagName, htmlProps); 38741 }); 38742 38743 38744 38745 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js 38746 "use client"; 38747 38748 38749 38750 38751 38752 38753 38754 // src/composite/composite.tsx 38755 38756 38757 38758 38759 38760 38761 38762 var ITI7HKP4_TagName = "div"; 38763 function isGrid(items) { 38764 return items.some((item) => !!item.rowId); 38765 } 38766 function isPrintableKey(event) { 38767 const target = event.target; 38768 if (target && !isTextField(target)) return false; 38769 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 38770 } 38771 function isModifierKey(event) { 38772 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 38773 } 38774 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { 38775 return useEvent((event) => { 38776 var _a; 38777 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); 38778 if (event.defaultPrevented) return; 38779 if (event.isPropagationStopped()) return; 38780 if (!isSelfTarget(event)) return; 38781 if (isModifierKey(event)) return; 38782 if (isPrintableKey(event)) return; 38783 const state = store.getState(); 38784 const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; 38785 if (!activeElement) return; 38786 const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]); 38787 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; 38788 if (activeElement !== previousElement) { 38789 activeElement.focus(); 38790 } 38791 if (!fireKeyboardEvent(activeElement, event.type, eventInit)) { 38792 event.preventDefault(); 38793 } 38794 if (event.currentTarget.contains(activeElement)) { 38795 event.stopPropagation(); 38796 } 38797 }); 38798 } 38799 function findFirstEnabledItemInTheLastRow(items) { 38800 return _5VQZOHHZ_findFirstEnabledItem( 38801 flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items))) 38802 ); 38803 } 38804 function useScheduleFocus(store) { 38805 const [scheduled, setScheduled] = (0,external_React_.useState)(false); 38806 const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []); 38807 const activeItem = store.useState( 38808 (state) => getEnabledItem(store, state.activeId) 38809 ); 38810 (0,external_React_.useEffect)(() => { 38811 const activeElement = activeItem == null ? void 0 : activeItem.element; 38812 if (!scheduled) return; 38813 if (!activeElement) return; 38814 setScheduled(false); 38815 activeElement.focus({ preventScroll: true }); 38816 }, [activeItem, scheduled]); 38817 return schedule; 38818 } 38819 var useComposite = createHook( 38820 function useComposite2(_a) { 38821 var _b = _a, { 38822 store, 38823 composite = true, 38824 focusOnMove = composite, 38825 moveOnKeyPress = true 38826 } = _b, props = __objRest(_b, [ 38827 "store", 38828 "composite", 38829 "focusOnMove", 38830 "moveOnKeyPress" 38831 ]); 38832 const context = useCompositeProviderContext(); 38833 store = store || context; 38834 invariant( 38835 store, 38836 false && 0 38837 ); 38838 const ref = (0,external_React_.useRef)(null); 38839 const previousElementRef = (0,external_React_.useRef)(null); 38840 const scheduleFocus = useScheduleFocus(store); 38841 const moves = store.useState("moves"); 38842 const [, setBaseElement] = useTransactionState( 38843 composite ? store.setBaseElement : null 38844 ); 38845 (0,external_React_.useEffect)(() => { 38846 var _a2; 38847 if (!store) return; 38848 if (!moves) return; 38849 if (!composite) return; 38850 if (!focusOnMove) return; 38851 const { activeId: activeId2 } = store.getState(); 38852 const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 38853 if (!itemElement) return; 38854 focusIntoView(itemElement); 38855 }, [store, moves, composite, focusOnMove]); 38856 useSafeLayoutEffect(() => { 38857 if (!store) return; 38858 if (!moves) return; 38859 if (!composite) return; 38860 const { baseElement, activeId: activeId2 } = store.getState(); 38861 const isSelfAcive = activeId2 === null; 38862 if (!isSelfAcive) return; 38863 if (!baseElement) return; 38864 const previousElement = previousElementRef.current; 38865 previousElementRef.current = null; 38866 if (previousElement) { 38867 fireBlurEvent(previousElement, { relatedTarget: baseElement }); 38868 } 38869 if (!hasFocus(baseElement)) { 38870 baseElement.focus(); 38871 } 38872 }, [store, moves, composite]); 38873 const activeId = store.useState("activeId"); 38874 const virtualFocus = store.useState("virtualFocus"); 38875 useSafeLayoutEffect(() => { 38876 var _a2; 38877 if (!store) return; 38878 if (!composite) return; 38879 if (!virtualFocus) return; 38880 const previousElement = previousElementRef.current; 38881 previousElementRef.current = null; 38882 if (!previousElement) return; 38883 const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element; 38884 const relatedTarget = activeElement || DTR5TSDJ_getActiveElement(previousElement); 38885 if (relatedTarget === previousElement) return; 38886 fireBlurEvent(previousElement, { relatedTarget }); 38887 }, [store, activeId, virtualFocus, composite]); 38888 const onKeyDownCapture = useKeyboardEventProxy( 38889 store, 38890 props.onKeyDownCapture, 38891 previousElementRef 38892 ); 38893 const onKeyUpCapture = useKeyboardEventProxy( 38894 store, 38895 props.onKeyUpCapture, 38896 previousElementRef 38897 ); 38898 const onFocusCaptureProp = props.onFocusCapture; 38899 const onFocusCapture = useEvent((event) => { 38900 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 38901 if (event.defaultPrevented) return; 38902 if (!store) return; 38903 const { virtualFocus: virtualFocus2 } = store.getState(); 38904 if (!virtualFocus2) return; 38905 const previousActiveElement = event.relatedTarget; 38906 const isSilentlyFocused = silentlyFocused(event.currentTarget); 38907 if (isSelfTarget(event) && isSilentlyFocused) { 38908 event.stopPropagation(); 38909 previousElementRef.current = previousActiveElement; 38910 } 38911 }); 38912 const onFocusProp = props.onFocus; 38913 const onFocus = useEvent((event) => { 38914 onFocusProp == null ? void 0 : onFocusProp(event); 38915 if (event.defaultPrevented) return; 38916 if (!composite) return; 38917 if (!store) return; 38918 const { relatedTarget } = event; 38919 const { virtualFocus: virtualFocus2 } = store.getState(); 38920 if (virtualFocus2) { 38921 if (isSelfTarget(event) && !isItem(store, relatedTarget)) { 38922 queueMicrotask(scheduleFocus); 38923 } 38924 } else if (isSelfTarget(event)) { 38925 store.setActiveId(null); 38926 } 38927 }); 38928 const onBlurCaptureProp = props.onBlurCapture; 38929 const onBlurCapture = useEvent((event) => { 38930 var _a2; 38931 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 38932 if (event.defaultPrevented) return; 38933 if (!store) return; 38934 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); 38935 if (!virtualFocus2) return; 38936 const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 38937 const nextActiveElement = event.relatedTarget; 38938 const nextActiveElementIsItem = isItem(store, nextActiveElement); 38939 const previousElement = previousElementRef.current; 38940 previousElementRef.current = null; 38941 if (isSelfTarget(event) && nextActiveElementIsItem) { 38942 if (nextActiveElement === activeElement) { 38943 if (previousElement && previousElement !== nextActiveElement) { 38944 fireBlurEvent(previousElement, event); 38945 } 38946 } else if (activeElement) { 38947 fireBlurEvent(activeElement, event); 38948 } else if (previousElement) { 38949 fireBlurEvent(previousElement, event); 38950 } 38951 event.stopPropagation(); 38952 } else { 38953 const targetIsItem = isItem(store, event.target); 38954 if (!targetIsItem && activeElement) { 38955 fireBlurEvent(activeElement, event); 38956 } 38957 } 38958 }); 38959 const onKeyDownProp = props.onKeyDown; 38960 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 38961 const onKeyDown = useEvent((event) => { 38962 var _a2; 38963 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 38964 if (event.defaultPrevented) return; 38965 if (!store) return; 38966 if (!isSelfTarget(event)) return; 38967 const { orientation, renderedItems, activeId: activeId2 } = store.getState(); 38968 const activeItem = getEnabledItem(store, activeId2); 38969 if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return; 38970 const isVertical = orientation !== "horizontal"; 38971 const isHorizontal = orientation !== "vertical"; 38972 const grid = isGrid(renderedItems); 38973 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; 38974 if (isHorizontalKey && isTextField(event.currentTarget)) return; 38975 const up = () => { 38976 if (grid) { 38977 const item = findFirstEnabledItemInTheLastRow(renderedItems); 38978 return item == null ? void 0 : item.id; 38979 } 38980 return store == null ? void 0 : store.last(); 38981 }; 38982 const keyMap = { 38983 ArrowUp: (grid || isVertical) && up, 38984 ArrowRight: (grid || isHorizontal) && store.first, 38985 ArrowDown: (grid || isVertical) && store.first, 38986 ArrowLeft: (grid || isHorizontal) && store.last, 38987 Home: store.first, 38988 End: store.last, 38989 PageUp: store.first, 38990 PageDown: store.last 38991 }; 38992 const action = keyMap[event.key]; 38993 if (action) { 38994 const id = action(); 38995 if (id !== void 0) { 38996 if (!moveOnKeyPressProp(event)) return; 38997 event.preventDefault(); 38998 store.move(id); 38999 } 39000 } 39001 }); 39002 props = useWrapElement( 39003 props, 39004 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }), 39005 [store] 39006 ); 39007 const activeDescendant = store.useState((state) => { 39008 var _a2; 39009 if (!store) return; 39010 if (!composite) return; 39011 if (!state.virtualFocus) return; 39012 return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id; 39013 }); 39014 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 39015 "aria-activedescendant": activeDescendant 39016 }, props), { 39017 ref: useMergeRefs(ref, setBaseElement, props.ref), 39018 onKeyDownCapture, 39019 onKeyUpCapture, 39020 onFocusCapture, 39021 onFocus, 39022 onBlurCapture, 39023 onKeyDown 39024 }); 39025 const focusable = store.useState( 39026 (state) => composite && (state.virtualFocus || state.activeId === null) 39027 ); 39028 props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props)); 39029 return props; 39030 } 39031 ); 39032 var Composite = forwardRef2(function Composite2(props) { 39033 const htmlProps = useComposite(props); 39034 return createElement(ITI7HKP4_TagName, htmlProps); 39035 }); 39036 39037 39038 39039 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox.js 39040 "use client"; 39041 39042 39043 39044 39045 39046 39047 39048 39049 39050 39051 39052 39053 39054 39055 39056 39057 // src/combobox/combobox.tsx 39058 39059 39060 39061 39062 39063 39064 var combobox_TagName = "input"; 39065 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 39066 if (!autoSelect) return false; 39067 const firstItem = items.find((item) => !item.disabled && item.value); 39068 return (firstItem == null ? void 0 : firstItem.value) === activeValue; 39069 } 39070 function hasCompletionString(value, activeValue) { 39071 if (!activeValue) return false; 39072 if (value == null) return false; 39073 value = PBFD2E7P_normalizeString(value); 39074 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; 39075 } 39076 function isInputEvent(event) { 39077 return event.type === "input"; 39078 } 39079 function isAriaAutoCompleteValue(value) { 39080 return value === "inline" || value === "list" || value === "both" || value === "none"; 39081 } 39082 function getDefaultAutoSelectId(items) { 39083 const item = items.find((item2) => { 39084 var _a; 39085 if (item2.disabled) return false; 39086 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; 39087 }); 39088 return item == null ? void 0 : item.id; 39089 } 39090 var useCombobox = createHook( 39091 function useCombobox2(_a) { 39092 var _b = _a, { 39093 store, 39094 focusable = true, 39095 autoSelect: autoSelectProp = false, 39096 getAutoSelectId, 39097 setValueOnChange, 39098 showMinLength = 0, 39099 showOnChange, 39100 showOnMouseDown, 39101 showOnClick = showOnMouseDown, 39102 showOnKeyDown, 39103 showOnKeyPress = showOnKeyDown, 39104 blurActiveItemOnClick, 39105 setValueOnClick = true, 39106 moveOnKeyPress = true, 39107 autoComplete = "list" 39108 } = _b, props = __objRest(_b, [ 39109 "store", 39110 "focusable", 39111 "autoSelect", 39112 "getAutoSelectId", 39113 "setValueOnChange", 39114 "showMinLength", 39115 "showOnChange", 39116 "showOnMouseDown", 39117 "showOnClick", 39118 "showOnKeyDown", 39119 "showOnKeyPress", 39120 "blurActiveItemOnClick", 39121 "setValueOnClick", 39122 "moveOnKeyPress", 39123 "autoComplete" 39124 ]); 39125 const context = useComboboxProviderContext(); 39126 store = store || context; 39127 invariant( 39128 store, 39129 false && 0 39130 ); 39131 const ref = (0,external_React_.useRef)(null); 39132 const [valueUpdated, forceValueUpdate] = useForceUpdate(); 39133 const canAutoSelectRef = (0,external_React_.useRef)(false); 39134 const composingRef = (0,external_React_.useRef)(false); 39135 const autoSelect = store.useState( 39136 (state) => state.virtualFocus && autoSelectProp 39137 ); 39138 const inline = autoComplete === "inline" || autoComplete === "both"; 39139 const [canInline, setCanInline] = (0,external_React_.useState)(inline); 39140 useUpdateLayoutEffect(() => { 39141 if (!inline) return; 39142 setCanInline(true); 39143 }, [inline]); 39144 const storeValue = store.useState("value"); 39145 const prevSelectedValueRef = (0,external_React_.useRef)(); 39146 (0,external_React_.useEffect)(() => { 39147 return sync(store, ["selectedValue", "activeId"], (_, prev) => { 39148 prevSelectedValueRef.current = prev.selectedValue; 39149 }); 39150 }, []); 39151 const inlineActiveValue = store.useState((state) => { 39152 var _a2; 39153 if (!inline) return; 39154 if (!canInline) return; 39155 if (state.activeValue && Array.isArray(state.selectedValue)) { 39156 if (state.selectedValue.includes(state.activeValue)) return; 39157 if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return; 39158 } 39159 return state.activeValue; 39160 }); 39161 const items = store.useState("renderedItems"); 39162 const open = store.useState("open"); 39163 const contentElement = store.useState("contentElement"); 39164 const value = (0,external_React_.useMemo)(() => { 39165 if (!inline) return storeValue; 39166 if (!canInline) return storeValue; 39167 const firstItemAutoSelected = isFirstItemAutoSelected( 39168 items, 39169 inlineActiveValue, 39170 autoSelect 39171 ); 39172 if (firstItemAutoSelected) { 39173 if (hasCompletionString(storeValue, inlineActiveValue)) { 39174 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; 39175 return storeValue + slice; 39176 } 39177 return storeValue; 39178 } 39179 return inlineActiveValue || storeValue; 39180 }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]); 39181 (0,external_React_.useEffect)(() => { 39182 const element = ref.current; 39183 if (!element) return; 39184 const onCompositeItemMove = () => setCanInline(true); 39185 element.addEventListener("combobox-item-move", onCompositeItemMove); 39186 return () => { 39187 element.removeEventListener("combobox-item-move", onCompositeItemMove); 39188 }; 39189 }, []); 39190 (0,external_React_.useEffect)(() => { 39191 if (!inline) return; 39192 if (!canInline) return; 39193 if (!inlineActiveValue) return; 39194 const firstItemAutoSelected = isFirstItemAutoSelected( 39195 items, 39196 inlineActiveValue, 39197 autoSelect 39198 ); 39199 if (!firstItemAutoSelected) return; 39200 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 39201 let cleanup = PBFD2E7P_noop; 39202 queueMicrotask(() => { 39203 const element = ref.current; 39204 if (!element) return; 39205 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 39206 const nextStart = storeValue.length; 39207 const nextEnd = inlineActiveValue.length; 39208 setSelectionRange(element, nextStart, nextEnd); 39209 cleanup = () => { 39210 if (!hasFocus(element)) return; 39211 const { start, end } = getTextboxSelection(element); 39212 if (start !== nextStart) return; 39213 if (end !== nextEnd) return; 39214 setSelectionRange(element, prevStart, prevEnd); 39215 }; 39216 }); 39217 return () => cleanup(); 39218 }, [ 39219 valueUpdated, 39220 inline, 39221 canInline, 39222 inlineActiveValue, 39223 items, 39224 autoSelect, 39225 storeValue 39226 ]); 39227 const scrollingElementRef = (0,external_React_.useRef)(null); 39228 const getAutoSelectIdProp = useEvent(getAutoSelectId); 39229 const autoSelectIdRef = (0,external_React_.useRef)(null); 39230 (0,external_React_.useEffect)(() => { 39231 if (!open) return; 39232 if (!contentElement) return; 39233 const scrollingElement = getScrollingElement(contentElement); 39234 if (!scrollingElement) return; 39235 scrollingElementRef.current = scrollingElement; 39236 const onUserScroll = () => { 39237 canAutoSelectRef.current = false; 39238 }; 39239 const onScroll = () => { 39240 if (!store) return; 39241 if (!canAutoSelectRef.current) return; 39242 const { activeId } = store.getState(); 39243 if (activeId === null) return; 39244 if (activeId === autoSelectIdRef.current) return; 39245 canAutoSelectRef.current = false; 39246 }; 39247 const options = { passive: true, capture: true }; 39248 scrollingElement.addEventListener("wheel", onUserScroll, options); 39249 scrollingElement.addEventListener("touchmove", onUserScroll, options); 39250 scrollingElement.addEventListener("scroll", onScroll, options); 39251 return () => { 39252 scrollingElement.removeEventListener("wheel", onUserScroll, true); 39253 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 39254 scrollingElement.removeEventListener("scroll", onScroll, true); 39255 }; 39256 }, [open, contentElement, store]); 39257 useSafeLayoutEffect(() => { 39258 if (!storeValue) return; 39259 if (composingRef.current) return; 39260 canAutoSelectRef.current = true; 39261 }, [storeValue]); 39262 useSafeLayoutEffect(() => { 39263 if (autoSelect !== "always" && open) return; 39264 canAutoSelectRef.current = open; 39265 }, [autoSelect, open]); 39266 const resetValueOnSelect = store.useState("resetValueOnSelect"); 39267 useUpdateEffect(() => { 39268 var _a2, _b2; 39269 const canAutoSelect = canAutoSelectRef.current; 39270 if (!store) return; 39271 if (!open) return; 39272 if (!canAutoSelect && !resetValueOnSelect) return; 39273 const { baseElement, contentElement: contentElement2, activeId } = store.getState(); 39274 if (baseElement && !hasFocus(baseElement)) return; 39275 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { 39276 const observer = new MutationObserver(forceValueUpdate); 39277 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 39278 return () => observer.disconnect(); 39279 } 39280 if (autoSelect && canAutoSelect) { 39281 const userAutoSelectId = getAutoSelectIdProp(items); 39282 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first(); 39283 autoSelectIdRef.current = autoSelectId; 39284 store.move(autoSelectId != null ? autoSelectId : null); 39285 } else { 39286 const element = (_b2 = store.item(activeId || store.first())) == null ? void 0 : _b2.element; 39287 if (element && "scrollIntoView" in element) { 39288 element.scrollIntoView({ block: "nearest", inline: "nearest" }); 39289 } 39290 } 39291 return; 39292 }, [ 39293 store, 39294 open, 39295 valueUpdated, 39296 storeValue, 39297 autoSelect, 39298 resetValueOnSelect, 39299 getAutoSelectIdProp, 39300 items 39301 ]); 39302 (0,external_React_.useEffect)(() => { 39303 if (!inline) return; 39304 const combobox = ref.current; 39305 if (!combobox) return; 39306 const elements = [combobox, contentElement].filter( 39307 (value2) => !!value2 39308 ); 39309 const onBlur2 = (event) => { 39310 if (elements.every((el) => isFocusEventOutside(event, el))) { 39311 store == null ? void 0 : store.setValue(value); 39312 } 39313 }; 39314 for (const element of elements) { 39315 element.addEventListener("focusout", onBlur2); 39316 } 39317 return () => { 39318 for (const element of elements) { 39319 element.removeEventListener("focusout", onBlur2); 39320 } 39321 }; 39322 }, [inline, contentElement, store, value]); 39323 const canShow = (event) => { 39324 const currentTarget = event.currentTarget; 39325 return currentTarget.value.length >= showMinLength; 39326 }; 39327 const onChangeProp = props.onChange; 39328 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); 39329 const setValueOnChangeProp = useBooleanEvent( 39330 // If the combobox is combined with tags, the value will be set by the tag 39331 // input component. 39332 setValueOnChange != null ? setValueOnChange : !store.tag 39333 ); 39334 const onChange = useEvent((event) => { 39335 onChangeProp == null ? void 0 : onChangeProp(event); 39336 if (event.defaultPrevented) return; 39337 if (!store) return; 39338 const currentTarget = event.currentTarget; 39339 const { value: value2, selectionStart, selectionEnd } = currentTarget; 39340 const nativeEvent = event.nativeEvent; 39341 canAutoSelectRef.current = true; 39342 if (isInputEvent(nativeEvent)) { 39343 if (nativeEvent.isComposing) { 39344 canAutoSelectRef.current = false; 39345 composingRef.current = true; 39346 } 39347 if (inline) { 39348 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 39349 const caretAtEnd = selectionStart === value2.length; 39350 setCanInline(textInserted && caretAtEnd); 39351 } 39352 } 39353 if (setValueOnChangeProp(event)) { 39354 const isSameValue = value2 === store.getState().value; 39355 store.setValue(value2); 39356 queueMicrotask(() => { 39357 setSelectionRange(currentTarget, selectionStart, selectionEnd); 39358 }); 39359 if (inline && autoSelect && isSameValue) { 39360 forceValueUpdate(); 39361 } 39362 } 39363 if (showOnChangeProp(event)) { 39364 store.show(); 39365 } 39366 if (!autoSelect || !canAutoSelectRef.current) { 39367 store.setActiveId(null); 39368 } 39369 }); 39370 const onCompositionEndProp = props.onCompositionEnd; 39371 const onCompositionEnd = useEvent((event) => { 39372 canAutoSelectRef.current = true; 39373 composingRef.current = false; 39374 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); 39375 if (event.defaultPrevented) return; 39376 if (!autoSelect) return; 39377 forceValueUpdate(); 39378 }); 39379 const onMouseDownProp = props.onMouseDown; 39380 const blurActiveItemOnClickProp = useBooleanEvent( 39381 blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement) 39382 ); 39383 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 39384 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); 39385 const onMouseDown = useEvent((event) => { 39386 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 39387 if (event.defaultPrevented) return; 39388 if (event.button) return; 39389 if (event.ctrlKey) return; 39390 if (!store) return; 39391 if (blurActiveItemOnClickProp(event)) { 39392 store.setActiveId(null); 39393 } 39394 if (setValueOnClickProp(event)) { 39395 store.setValue(value); 39396 } 39397 if (showOnClickProp(event)) { 39398 queueBeforeEvent(event.currentTarget, "mouseup", store.show); 39399 } 39400 }); 39401 const onKeyDownProp = props.onKeyDown; 39402 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); 39403 const onKeyDown = useEvent((event) => { 39404 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 39405 if (!event.repeat) { 39406 canAutoSelectRef.current = false; 39407 } 39408 if (event.defaultPrevented) return; 39409 if (event.ctrlKey) return; 39410 if (event.altKey) return; 39411 if (event.shiftKey) return; 39412 if (event.metaKey) return; 39413 if (!store) return; 39414 const { open: open2 } = store.getState(); 39415 if (open2) return; 39416 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 39417 if (showOnKeyPressProp(event)) { 39418 event.preventDefault(); 39419 store.show(); 39420 } 39421 } 39422 }); 39423 const onBlurProp = props.onBlur; 39424 const onBlur = useEvent((event) => { 39425 canAutoSelectRef.current = false; 39426 onBlurProp == null ? void 0 : onBlurProp(event); 39427 if (event.defaultPrevented) return; 39428 }); 39429 const id = useId(props.id); 39430 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 39431 const isActiveItem = store.useState((state) => state.activeId === null); 39432 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 39433 id, 39434 role: "combobox", 39435 "aria-autocomplete": ariaAutoComplete, 39436 "aria-haspopup": getPopupRole(contentElement, "listbox"), 39437 "aria-expanded": open, 39438 "aria-controls": contentElement == null ? void 0 : contentElement.id, 39439 "data-active-item": isActiveItem || void 0, 39440 value 39441 }, props), { 39442 ref: useMergeRefs(ref, props.ref), 39443 onChange, 39444 onCompositionEnd, 39445 onMouseDown, 39446 onKeyDown, 39447 onBlur 39448 }); 39449 props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 39450 store, 39451 focusable 39452 }, props), { 39453 // Enable inline autocomplete when the user moves from the combobox input 39454 // to an item. 39455 moveOnKeyPress: (event) => { 39456 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 39457 if (inline) setCanInline(true); 39458 return true; 39459 } 39460 })); 39461 props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props)); 39462 return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props); 39463 } 39464 ); 39465 var Combobox = forwardRef2(function Combobox2(props) { 39466 const htmlProps = useCombobox(props); 39467 return createElement(combobox_TagName, htmlProps); 39468 }); 39469 39470 39471 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js 39472 "use client"; 39473 39474 39475 39476 39477 39478 39479 39480 // src/disclosure/disclosure-content.tsx 39481 39482 39483 39484 39485 var VGCJ63VH_TagName = "div"; 39486 function afterTimeout(timeoutMs, cb) { 39487 const timeoutId = setTimeout(cb, timeoutMs); 39488 return () => clearTimeout(timeoutId); 39489 } 39490 function VGCJ63VH_afterPaint(cb) { 39491 let raf = requestAnimationFrame(() => { 39492 raf = requestAnimationFrame(cb); 39493 }); 39494 return () => cancelAnimationFrame(raf); 39495 } 39496 function parseCSSTime(...times) { 39497 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { 39498 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; 39499 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; 39500 if (currentTime > longestTime) return currentTime; 39501 return longestTime; 39502 }, 0); 39503 } 39504 function isHidden(mounted, hidden, alwaysVisible) { 39505 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 39506 } 39507 var useDisclosureContent = createHook(function useDisclosureContent2(_a) { 39508 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 39509 const context = useDisclosureProviderContext(); 39510 store = store || context; 39511 invariant( 39512 store, 39513 false && 0 39514 ); 39515 const ref = (0,external_React_.useRef)(null); 39516 const id = useId(props.id); 39517 const [transition, setTransition] = (0,external_React_.useState)(null); 39518 const open = store.useState("open"); 39519 const mounted = store.useState("mounted"); 39520 const animated = store.useState("animated"); 39521 const contentElement = store.useState("contentElement"); 39522 const otherElement = useStoreState(store.disclosure, "contentElement"); 39523 useSafeLayoutEffect(() => { 39524 if (!ref.current) return; 39525 store == null ? void 0 : store.setContentElement(ref.current); 39526 }, [store]); 39527 useSafeLayoutEffect(() => { 39528 let previousAnimated; 39529 store == null ? void 0 : store.setState("animated", (animated2) => { 39530 previousAnimated = animated2; 39531 return true; 39532 }); 39533 return () => { 39534 if (previousAnimated === void 0) return; 39535 store == null ? void 0 : store.setState("animated", previousAnimated); 39536 }; 39537 }, [store]); 39538 useSafeLayoutEffect(() => { 39539 if (!animated) return; 39540 if (!(contentElement == null ? void 0 : contentElement.isConnected)) { 39541 setTransition(null); 39542 return; 39543 } 39544 return VGCJ63VH_afterPaint(() => { 39545 setTransition(open ? "enter" : mounted ? "leave" : null); 39546 }); 39547 }, [animated, contentElement, open, mounted]); 39548 useSafeLayoutEffect(() => { 39549 if (!store) return; 39550 if (!animated) return; 39551 if (!transition) return; 39552 if (!contentElement) return; 39553 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); 39554 const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation); 39555 if (transition === "leave" && open) return; 39556 if (transition === "enter" && !open) return; 39557 if (typeof animated === "number") { 39558 const timeout2 = animated; 39559 return afterTimeout(timeout2, stopAnimationSync); 39560 } 39561 const { 39562 transitionDuration, 39563 animationDuration, 39564 transitionDelay, 39565 animationDelay 39566 } = getComputedStyle(contentElement); 39567 const { 39568 transitionDuration: transitionDuration2 = "0", 39569 animationDuration: animationDuration2 = "0", 39570 transitionDelay: transitionDelay2 = "0", 39571 animationDelay: animationDelay2 = "0" 39572 } = otherElement ? getComputedStyle(otherElement) : {}; 39573 const delay = parseCSSTime( 39574 transitionDelay, 39575 animationDelay, 39576 transitionDelay2, 39577 animationDelay2 39578 ); 39579 const duration = parseCSSTime( 39580 transitionDuration, 39581 animationDuration, 39582 transitionDuration2, 39583 animationDuration2 39584 ); 39585 const timeout = delay + duration; 39586 if (!timeout) { 39587 if (transition === "enter") { 39588 store.setState("animated", false); 39589 } 39590 stopAnimation(); 39591 return; 39592 } 39593 const frameRate = 1e3 / 60; 39594 const maxTimeout = Math.max(timeout - frameRate, 0); 39595 return afterTimeout(maxTimeout, stopAnimationSync); 39596 }, [store, animated, contentElement, otherElement, open, transition]); 39597 props = useWrapElement( 39598 props, 39599 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }), 39600 [store] 39601 ); 39602 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 39603 const styleProp = props.style; 39604 const style = (0,external_React_.useMemo)(() => { 39605 if (hidden) { 39606 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" }); 39607 } 39608 return styleProp; 39609 }, [hidden, styleProp]); 39610 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 39611 id, 39612 "data-open": open || void 0, 39613 "data-enter": transition === "enter" || void 0, 39614 "data-leave": transition === "leave" || void 0, 39615 hidden 39616 }, props), { 39617 ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref), 39618 style 39619 }); 39620 return removeUndefinedValues(props); 39621 }); 39622 var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) { 39623 const htmlProps = useDisclosureContent(props); 39624 return createElement(VGCJ63VH_TagName, htmlProps); 39625 }); 39626 var DisclosureContent = forwardRef2(function DisclosureContent2(_a) { 39627 var _b = _a, { 39628 unmountOnHide 39629 } = _b, props = __objRest(_b, [ 39630 "unmountOnHide" 39631 ]); 39632 const context = useDisclosureProviderContext(); 39633 const store = props.store || context; 39634 const mounted = useStoreState( 39635 store, 39636 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) 39637 ); 39638 if (mounted === false) return null; 39639 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props)); 39640 }); 39641 39642 39643 39644 ;// ./node_modules/@ariakit/react-core/esm/__chunks/HUWAI7RB.js 39645 "use client"; 39646 39647 39648 39649 39650 39651 39652 // src/combobox/combobox-list.tsx 39653 39654 39655 39656 var HUWAI7RB_TagName = "div"; 39657 var useComboboxList = createHook( 39658 function useComboboxList2(_a) { 39659 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 39660 const scopedContext = useComboboxScopedContext(true); 39661 const context = useComboboxContext(); 39662 store = store || context; 39663 const scopedContextSameStore = !!store && store === scopedContext; 39664 invariant( 39665 store, 39666 false && 0 39667 ); 39668 const ref = (0,external_React_.useRef)(null); 39669 const id = useId(props.id); 39670 const mounted = store.useState("mounted"); 39671 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 39672 const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; 39673 const multiSelectable = store.useState( 39674 (state) => Array.isArray(state.selectedValue) 39675 ); 39676 const role = useAttribute(ref, "role", props.role); 39677 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; 39678 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; 39679 const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false); 39680 const contentElement = store.useState("contentElement"); 39681 useSafeLayoutEffect(() => { 39682 if (!mounted) return; 39683 const element = ref.current; 39684 if (!element) return; 39685 if (contentElement !== element) return; 39686 const callback = () => { 39687 setHasListboxInside(!!element.querySelector("[role='listbox']")); 39688 }; 39689 const observer = new MutationObserver(callback); 39690 observer.observe(element, { 39691 subtree: true, 39692 childList: true, 39693 attributeFilter: ["role"] 39694 }); 39695 callback(); 39696 return () => observer.disconnect(); 39697 }, [mounted, contentElement]); 39698 if (!hasListboxInside) { 39699 props = _3YLGPPWQ_spreadValues({ 39700 role: "listbox", 39701 "aria-multiselectable": ariaMultiSelectable 39702 }, props); 39703 } 39704 props = useWrapElement( 39705 props, 39706 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), 39707 [store, role] 39708 ); 39709 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; 39710 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 39711 id, 39712 hidden 39713 }, props), { 39714 ref: useMergeRefs(setContentElement, ref, props.ref), 39715 style 39716 }); 39717 return removeUndefinedValues(props); 39718 } 39719 ); 39720 var ComboboxList = forwardRef2(function ComboboxList2(props) { 39721 const htmlProps = useComboboxList(props); 39722 return createElement(HUWAI7RB_TagName, htmlProps); 39723 }); 39724 39725 39726 39727 ;// ./node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js 39728 "use client"; 39729 39730 39731 39732 39733 39734 // src/composite/composite-hover.tsx 39735 39736 39737 39738 39739 var UQQRIHDV_TagName = "div"; 39740 function getMouseDestination(event) { 39741 const relatedTarget = event.relatedTarget; 39742 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { 39743 return relatedTarget; 39744 } 39745 return null; 39746 } 39747 function hoveringInside(event) { 39748 const nextElement = getMouseDestination(event); 39749 if (!nextElement) return false; 39750 return contains(event.currentTarget, nextElement); 39751 } 39752 var symbol = Symbol("composite-hover"); 39753 function movingToAnotherItem(event) { 39754 let dest = getMouseDestination(event); 39755 if (!dest) return false; 39756 do { 39757 if (PBFD2E7P_hasOwnProperty(dest, symbol) && dest[symbol]) return true; 39758 dest = dest.parentElement; 39759 } while (dest); 39760 return false; 39761 } 39762 var useCompositeHover = createHook( 39763 function useCompositeHover2(_a) { 39764 var _b = _a, { 39765 store, 39766 focusOnHover = true, 39767 blurOnHoverEnd = !!focusOnHover 39768 } = _b, props = __objRest(_b, [ 39769 "store", 39770 "focusOnHover", 39771 "blurOnHoverEnd" 39772 ]); 39773 const context = useCompositeContext(); 39774 store = store || context; 39775 invariant( 39776 store, 39777 false && 0 39778 ); 39779 const isMouseMoving = useIsMouseMoving(); 39780 const onMouseMoveProp = props.onMouseMove; 39781 const focusOnHoverProp = useBooleanEvent(focusOnHover); 39782 const onMouseMove = useEvent((event) => { 39783 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); 39784 if (event.defaultPrevented) return; 39785 if (!isMouseMoving()) return; 39786 if (!focusOnHoverProp(event)) return; 39787 if (!hasFocusWithin(event.currentTarget)) { 39788 const baseElement = store == null ? void 0 : store.getState().baseElement; 39789 if (baseElement && !hasFocus(baseElement)) { 39790 baseElement.focus(); 39791 } 39792 } 39793 store == null ? void 0 : store.setActiveId(event.currentTarget.id); 39794 }); 39795 const onMouseLeaveProp = props.onMouseLeave; 39796 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 39797 const onMouseLeave = useEvent((event) => { 39798 var _a2; 39799 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); 39800 if (event.defaultPrevented) return; 39801 if (!isMouseMoving()) return; 39802 if (hoveringInside(event)) return; 39803 if (movingToAnotherItem(event)) return; 39804 if (!focusOnHoverProp(event)) return; 39805 if (!blurOnHoverEndProp(event)) return; 39806 store == null ? void 0 : store.setActiveId(null); 39807 (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus(); 39808 }); 39809 const ref = (0,external_React_.useCallback)((element) => { 39810 if (!element) return; 39811 element[symbol] = true; 39812 }, []); 39813 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 39814 ref: useMergeRefs(ref, props.ref), 39815 onMouseMove, 39816 onMouseLeave 39817 }); 39818 return removeUndefinedValues(props); 39819 } 39820 ); 39821 var CompositeHover = memo2( 39822 forwardRef2(function CompositeHover2(props) { 39823 const htmlProps = useCompositeHover(props); 39824 return createElement(UQQRIHDV_TagName, htmlProps); 39825 }) 39826 ); 39827 39828 39829 39830 ;// ./node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js 39831 "use client"; 39832 39833 39834 39835 39836 39837 // src/collection/collection-item.tsx 39838 39839 39840 var RZ4GPYOB_TagName = "div"; 39841 var useCollectionItem = createHook( 39842 function useCollectionItem2(_a) { 39843 var _b = _a, { 39844 store, 39845 shouldRegisterItem = true, 39846 getItem = identity, 39847 element: element 39848 } = _b, props = __objRest(_b, [ 39849 "store", 39850 "shouldRegisterItem", 39851 "getItem", 39852 // @ts-expect-error This prop may come from a collection renderer. 39853 "element" 39854 ]); 39855 const context = useCollectionContext(); 39856 store = store || context; 39857 const id = useId(props.id); 39858 const ref = (0,external_React_.useRef)(element); 39859 (0,external_React_.useEffect)(() => { 39860 const element2 = ref.current; 39861 if (!id) return; 39862 if (!element2) return; 39863 if (!shouldRegisterItem) return; 39864 const item = getItem({ id, element: element2 }); 39865 return store == null ? void 0 : store.renderItem(item); 39866 }, [id, shouldRegisterItem, getItem, store]); 39867 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 39868 ref: useMergeRefs(ref, props.ref) 39869 }); 39870 return removeUndefinedValues(props); 39871 } 39872 ); 39873 var CollectionItem = forwardRef2(function CollectionItem2(props) { 39874 const htmlProps = useCollectionItem(props); 39875 return createElement(RZ4GPYOB_TagName, htmlProps); 39876 }); 39877 39878 39879 39880 ;// ./node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js 39881 "use client"; 39882 39883 39884 39885 39886 39887 // src/command/command.tsx 39888 39889 39890 39891 39892 39893 var KUU7WJ55_TagName = "button"; 39894 function isNativeClick(event) { 39895 if (!event.isTrusted) return false; 39896 const element = event.currentTarget; 39897 if (event.key === "Enter") { 39898 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 39899 } 39900 if (event.key === " ") { 39901 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 39902 } 39903 return false; 39904 } 39905 var KUU7WJ55_symbol = Symbol("command"); 39906 var useCommand = createHook( 39907 function useCommand2(_a) { 39908 var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]); 39909 const ref = (0,external_React_.useRef)(null); 39910 const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(false); 39911 (0,external_React_.useEffect)(() => { 39912 if (!ref.current) return; 39913 setIsNativeButton(isButton(ref.current)); 39914 }, []); 39915 const [active, setActive] = (0,external_React_.useState)(false); 39916 const activeRef = (0,external_React_.useRef)(false); 39917 const disabled = disabledFromProps(props); 39918 const [isDuplicate, metadataProps] = useMetadataProps(props, KUU7WJ55_symbol, true); 39919 const onKeyDownProp = props.onKeyDown; 39920 const onKeyDown = useEvent((event) => { 39921 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 39922 const element = event.currentTarget; 39923 if (event.defaultPrevented) return; 39924 if (isDuplicate) return; 39925 if (disabled) return; 39926 if (!isSelfTarget(event)) return; 39927 if (isTextField(element)) return; 39928 if (element.isContentEditable) return; 39929 const isEnter = clickOnEnter && event.key === "Enter"; 39930 const isSpace = clickOnSpace && event.key === " "; 39931 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 39932 const shouldPreventSpace = event.key === " " && !clickOnSpace; 39933 if (shouldPreventEnter || shouldPreventSpace) { 39934 event.preventDefault(); 39935 return; 39936 } 39937 if (isEnter || isSpace) { 39938 const nativeClick = isNativeClick(event); 39939 if (isEnter) { 39940 if (!nativeClick) { 39941 event.preventDefault(); 39942 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 39943 const click = () => fireClickEvent(element, eventInit); 39944 if (isFirefox()) { 39945 queueBeforeEvent(element, "keyup", click); 39946 } else { 39947 queueMicrotask(click); 39948 } 39949 } 39950 } else if (isSpace) { 39951 activeRef.current = true; 39952 if (!nativeClick) { 39953 event.preventDefault(); 39954 setActive(true); 39955 } 39956 } 39957 } 39958 }); 39959 const onKeyUpProp = props.onKeyUp; 39960 const onKeyUp = useEvent((event) => { 39961 onKeyUpProp == null ? void 0 : onKeyUpProp(event); 39962 if (event.defaultPrevented) return; 39963 if (isDuplicate) return; 39964 if (disabled) return; 39965 if (event.metaKey) return; 39966 const isSpace = clickOnSpace && event.key === " "; 39967 if (activeRef.current && isSpace) { 39968 activeRef.current = false; 39969 if (!isNativeClick(event)) { 39970 event.preventDefault(); 39971 setActive(false); 39972 const element = event.currentTarget; 39973 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 39974 queueMicrotask(() => fireClickEvent(element, eventInit)); 39975 } 39976 } 39977 }); 39978 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ 39979 "data-active": active || void 0, 39980 type: isNativeButton ? "button" : void 0 39981 }, metadataProps), props), { 39982 ref: useMergeRefs(ref, props.ref), 39983 onKeyDown, 39984 onKeyUp 39985 }); 39986 props = useFocusable(props); 39987 return props; 39988 } 39989 ); 39990 var Command = forwardRef2(function Command2(props) { 39991 const htmlProps = useCommand(props); 39992 return createElement(KUU7WJ55_TagName, htmlProps); 39993 }); 39994 39995 39996 39997 ;// ./node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js 39998 "use client"; 39999 40000 40001 40002 40003 40004 40005 40006 40007 40008 // src/composite/composite-item.tsx 40009 40010 40011 40012 40013 40014 40015 var P2CTZE2T_TagName = "button"; 40016 function isEditableElement(element) { 40017 if (isTextbox(element)) return true; 40018 return element.tagName === "INPUT" && !isButton(element); 40019 } 40020 function getNextPageOffset(scrollingElement, pageUp = false) { 40021 const height = scrollingElement.clientHeight; 40022 const { top } = scrollingElement.getBoundingClientRect(); 40023 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 40024 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 40025 if (scrollingElement.tagName === "HTML") { 40026 return pageOffset + scrollingElement.scrollTop; 40027 } 40028 return pageOffset; 40029 } 40030 function getItemOffset(itemElement, pageUp = false) { 40031 const { top } = itemElement.getBoundingClientRect(); 40032 if (pageUp) { 40033 return top + itemElement.clientHeight; 40034 } 40035 return top; 40036 } 40037 function findNextPageItemId(element, store, next, pageUp = false) { 40038 var _a; 40039 if (!store) return; 40040 if (!next) return; 40041 const { renderedItems } = store.getState(); 40042 const scrollingElement = getScrollingElement(element); 40043 if (!scrollingElement) return; 40044 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 40045 let id; 40046 let prevDifference; 40047 for (let i = 0; i < renderedItems.length; i += 1) { 40048 const previousId = id; 40049 id = next(i); 40050 if (!id) break; 40051 if (id === previousId) continue; 40052 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; 40053 if (!itemElement) continue; 40054 const itemOffset = getItemOffset(itemElement, pageUp); 40055 const difference = itemOffset - nextPageOffset; 40056 const absDifference = Math.abs(difference); 40057 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 40058 if (prevDifference !== void 0 && prevDifference < absDifference) { 40059 id = previousId; 40060 } 40061 break; 40062 } 40063 prevDifference = absDifference; 40064 } 40065 return id; 40066 } 40067 function targetIsAnotherItem(event, store) { 40068 if (isSelfTarget(event)) return false; 40069 return isItem(store, event.target); 40070 } 40071 var useCompositeItem = createHook( 40072 function useCompositeItem2(_a) { 40073 var _b = _a, { 40074 store, 40075 rowId: rowIdProp, 40076 preventScrollOnKeyDown = false, 40077 moveOnKeyPress = true, 40078 tabbable = false, 40079 getItem: getItemProp, 40080 "aria-setsize": ariaSetSizeProp, 40081 "aria-posinset": ariaPosInSetProp 40082 } = _b, props = __objRest(_b, [ 40083 "store", 40084 "rowId", 40085 "preventScrollOnKeyDown", 40086 "moveOnKeyPress", 40087 "tabbable", 40088 "getItem", 40089 "aria-setsize", 40090 "aria-posinset" 40091 ]); 40092 const context = useCompositeContext(); 40093 store = store || context; 40094 const id = useId(props.id); 40095 const ref = (0,external_React_.useRef)(null); 40096 const row = (0,external_React_.useContext)(CompositeRowContext); 40097 const disabled = disabledFromProps(props); 40098 const trulyDisabled = disabled && !props.accessibleWhenDisabled; 40099 const { 40100 rowId, 40101 baseElement, 40102 isActiveItem, 40103 ariaSetSize, 40104 ariaPosInSet, 40105 isTabbable 40106 } = useStoreStateObject(store, { 40107 rowId(state) { 40108 if (rowIdProp) return rowIdProp; 40109 if (!state) return; 40110 if (!(row == null ? void 0 : row.baseElement)) return; 40111 if (row.baseElement !== state.baseElement) return; 40112 return row.id; 40113 }, 40114 baseElement(state) { 40115 return (state == null ? void 0 : state.baseElement) || void 0; 40116 }, 40117 isActiveItem(state) { 40118 return !!state && state.activeId === id; 40119 }, 40120 ariaSetSize(state) { 40121 if (ariaSetSizeProp != null) return ariaSetSizeProp; 40122 if (!state) return; 40123 if (!(row == null ? void 0 : row.ariaSetSize)) return; 40124 if (row.baseElement !== state.baseElement) return; 40125 return row.ariaSetSize; 40126 }, 40127 ariaPosInSet(state) { 40128 if (ariaPosInSetProp != null) return ariaPosInSetProp; 40129 if (!state) return; 40130 if (!(row == null ? void 0 : row.ariaPosInSet)) return; 40131 if (row.baseElement !== state.baseElement) return; 40132 const itemsInRow = state.renderedItems.filter( 40133 (item) => item.rowId === rowId 40134 ); 40135 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 40136 }, 40137 isTabbable(state) { 40138 if (!(state == null ? void 0 : state.renderedItems.length)) return true; 40139 if (state.virtualFocus) return false; 40140 if (tabbable) return true; 40141 if (state.activeId === null) return false; 40142 const item = store == null ? void 0 : store.item(state.activeId); 40143 if (item == null ? void 0 : item.disabled) return true; 40144 if (!(item == null ? void 0 : item.element)) return true; 40145 return state.activeId === id; 40146 } 40147 }); 40148 const getItem = (0,external_React_.useCallback)( 40149 (item) => { 40150 var _a2; 40151 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { 40152 id: id || item.id, 40153 rowId, 40154 disabled: !!trulyDisabled, 40155 children: (_a2 = item.element) == null ? void 0 : _a2.textContent 40156 }); 40157 if (getItemProp) { 40158 return getItemProp(nextItem); 40159 } 40160 return nextItem; 40161 }, 40162 [id, rowId, trulyDisabled, getItemProp] 40163 ); 40164 const onFocusProp = props.onFocus; 40165 const hasFocusedComposite = (0,external_React_.useRef)(false); 40166 const onFocus = useEvent((event) => { 40167 onFocusProp == null ? void 0 : onFocusProp(event); 40168 if (event.defaultPrevented) return; 40169 if (isPortalEvent(event)) return; 40170 if (!id) return; 40171 if (!store) return; 40172 if (targetIsAnotherItem(event, store)) return; 40173 const { virtualFocus, baseElement: baseElement2 } = store.getState(); 40174 store.setActiveId(id); 40175 if (isTextbox(event.currentTarget)) { 40176 selectTextField(event.currentTarget); 40177 } 40178 if (!virtualFocus) return; 40179 if (!isSelfTarget(event)) return; 40180 if (isEditableElement(event.currentTarget)) return; 40181 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; 40182 if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) { 40183 event.currentTarget.scrollIntoView({ 40184 block: "nearest", 40185 inline: "nearest" 40186 }); 40187 } 40188 hasFocusedComposite.current = true; 40189 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); 40190 if (fromComposite) { 40191 focusSilently(baseElement2); 40192 } else { 40193 baseElement2.focus(); 40194 } 40195 }); 40196 const onBlurCaptureProp = props.onBlurCapture; 40197 const onBlurCapture = useEvent((event) => { 40198 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 40199 if (event.defaultPrevented) return; 40200 const state = store == null ? void 0 : store.getState(); 40201 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { 40202 hasFocusedComposite.current = false; 40203 event.preventDefault(); 40204 event.stopPropagation(); 40205 } 40206 }); 40207 const onKeyDownProp = props.onKeyDown; 40208 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 40209 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 40210 const onKeyDown = useEvent((event) => { 40211 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 40212 if (event.defaultPrevented) return; 40213 if (!isSelfTarget(event)) return; 40214 if (!store) return; 40215 const { currentTarget } = event; 40216 const state = store.getState(); 40217 const item = store.item(id); 40218 const isGrid = !!(item == null ? void 0 : item.rowId); 40219 const isVertical = state.orientation !== "horizontal"; 40220 const isHorizontal = state.orientation !== "vertical"; 40221 const canHomeEnd = () => { 40222 if (isGrid) return true; 40223 if (isHorizontal) return true; 40224 if (!state.baseElement) return true; 40225 if (!isTextField(state.baseElement)) return true; 40226 return false; 40227 }; 40228 const keyMap = { 40229 ArrowUp: (isGrid || isVertical) && store.up, 40230 ArrowRight: (isGrid || isHorizontal) && store.next, 40231 ArrowDown: (isGrid || isVertical) && store.down, 40232 ArrowLeft: (isGrid || isHorizontal) && store.previous, 40233 Home: () => { 40234 if (!canHomeEnd()) return; 40235 if (!isGrid || event.ctrlKey) { 40236 return store == null ? void 0 : store.first(); 40237 } 40238 return store == null ? void 0 : store.previous(-1); 40239 }, 40240 End: () => { 40241 if (!canHomeEnd()) return; 40242 if (!isGrid || event.ctrlKey) { 40243 return store == null ? void 0 : store.last(); 40244 } 40245 return store == null ? void 0 : store.next(-1); 40246 }, 40247 PageUp: () => { 40248 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); 40249 }, 40250 PageDown: () => { 40251 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); 40252 } 40253 }; 40254 const action = keyMap[event.key]; 40255 if (action) { 40256 if (isTextbox(currentTarget)) { 40257 const selection = getTextboxSelection(currentTarget); 40258 const isLeft = isHorizontal && event.key === "ArrowLeft"; 40259 const isRight = isHorizontal && event.key === "ArrowRight"; 40260 const isUp = isVertical && event.key === "ArrowUp"; 40261 const isDown = isVertical && event.key === "ArrowDown"; 40262 if (isRight || isDown) { 40263 const { length: valueLength } = getTextboxValue(currentTarget); 40264 if (selection.end !== valueLength) return; 40265 } else if ((isLeft || isUp) && selection.start !== 0) return; 40266 } 40267 const nextId = action(); 40268 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { 40269 if (!moveOnKeyPressProp(event)) return; 40270 event.preventDefault(); 40271 store.move(nextId); 40272 } 40273 } 40274 }); 40275 const providerValue = (0,external_React_.useMemo)( 40276 () => ({ id, baseElement }), 40277 [id, baseElement] 40278 ); 40279 props = useWrapElement( 40280 props, 40281 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), 40282 [providerValue] 40283 ); 40284 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 40285 id, 40286 "data-active-item": isActiveItem || void 0 40287 }, props), { 40288 ref: useMergeRefs(ref, props.ref), 40289 tabIndex: isTabbable ? props.tabIndex : -1, 40290 onFocus, 40291 onBlurCapture, 40292 onKeyDown 40293 }); 40294 props = useCommand(props); 40295 props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 40296 store 40297 }, props), { 40298 getItem, 40299 shouldRegisterItem: id ? props.shouldRegisterItem : false 40300 })); 40301 return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 40302 "aria-setsize": ariaSetSize, 40303 "aria-posinset": ariaPosInSet 40304 })); 40305 } 40306 ); 40307 var CompositeItem = memo2( 40308 forwardRef2(function CompositeItem2(props) { 40309 const htmlProps = useCompositeItem(props); 40310 return createElement(P2CTZE2T_TagName, htmlProps); 40311 }) 40312 ); 40313 40314 40315 40316 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ZTDSJLD6.js 40317 "use client"; 40318 40319 40320 40321 40322 40323 40324 40325 40326 // src/combobox/combobox-item.tsx 40327 40328 40329 40330 40331 40332 40333 var ZTDSJLD6_TagName = "div"; 40334 function isSelected(storeValue, itemValue) { 40335 if (itemValue == null) return; 40336 if (storeValue == null) return false; 40337 if (Array.isArray(storeValue)) { 40338 return storeValue.includes(itemValue); 40339 } 40340 return storeValue === itemValue; 40341 } 40342 function getItemRole(popupRole) { 40343 var _a; 40344 const itemRoleByPopupRole = { 40345 menu: "menuitem", 40346 listbox: "option", 40347 tree: "treeitem" 40348 }; 40349 const key = popupRole; 40350 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option"; 40351 } 40352 var useComboboxItem = createHook( 40353 function useComboboxItem2(_a) { 40354 var _b = _a, { 40355 store, 40356 value, 40357 hideOnClick, 40358 setValueOnClick, 40359 selectValueOnClick = true, 40360 resetValueOnSelect, 40361 focusOnHover = false, 40362 moveOnKeyPress = true, 40363 getItem: getItemProp 40364 } = _b, props = __objRest(_b, [ 40365 "store", 40366 "value", 40367 "hideOnClick", 40368 "setValueOnClick", 40369 "selectValueOnClick", 40370 "resetValueOnSelect", 40371 "focusOnHover", 40372 "moveOnKeyPress", 40373 "getItem" 40374 ]); 40375 var _a2; 40376 const context = useComboboxScopedContext(); 40377 store = store || context; 40378 invariant( 40379 store, 40380 false && 0 40381 ); 40382 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, { 40383 resetValueOnSelectState: "resetValueOnSelect", 40384 multiSelectable(state) { 40385 return Array.isArray(state.selectedValue); 40386 }, 40387 selected(state) { 40388 return isSelected(state.selectedValue, value); 40389 } 40390 }); 40391 const getItem = (0,external_React_.useCallback)( 40392 (item) => { 40393 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value }); 40394 if (getItemProp) { 40395 return getItemProp(nextItem); 40396 } 40397 return nextItem; 40398 }, 40399 [value, getItemProp] 40400 ); 40401 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; 40402 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; 40403 const onClickProp = props.onClick; 40404 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 40405 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 40406 const resetValueOnSelectProp = useBooleanEvent( 40407 (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable 40408 ); 40409 const hideOnClickProp = useBooleanEvent(hideOnClick); 40410 const onClick = useEvent((event) => { 40411 onClickProp == null ? void 0 : onClickProp(event); 40412 if (event.defaultPrevented) return; 40413 if (isDownloading(event)) return; 40414 if (isOpeningInNewTab(event)) return; 40415 if (value != null) { 40416 if (selectValueOnClickProp(event)) { 40417 if (resetValueOnSelectProp(event)) { 40418 store == null ? void 0 : store.resetValue(); 40419 } 40420 store == null ? void 0 : store.setSelectedValue((prevValue) => { 40421 if (!Array.isArray(prevValue)) return value; 40422 if (prevValue.includes(value)) { 40423 return prevValue.filter((v) => v !== value); 40424 } 40425 return [...prevValue, value]; 40426 }); 40427 } 40428 if (setValueOnClickProp(event)) { 40429 store == null ? void 0 : store.setValue(value); 40430 } 40431 } 40432 if (hideOnClickProp(event)) { 40433 store == null ? void 0 : store.hide(); 40434 } 40435 }); 40436 const onKeyDownProp = props.onKeyDown; 40437 const onKeyDown = useEvent((event) => { 40438 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 40439 if (event.defaultPrevented) return; 40440 const baseElement = store == null ? void 0 : store.getState().baseElement; 40441 if (!baseElement) return; 40442 if (hasFocus(baseElement)) return; 40443 const printable = event.key.length === 1; 40444 if (printable || event.key === "Backspace" || event.key === "Delete") { 40445 queueMicrotask(() => baseElement.focus()); 40446 if (isTextField(baseElement)) { 40447 store == null ? void 0 : store.setValue(baseElement.value); 40448 } 40449 } 40450 }); 40451 if (multiSelectable && selected != null) { 40452 props = _3YLGPPWQ_spreadValues({ 40453 "aria-selected": selected 40454 }, props); 40455 } 40456 props = useWrapElement( 40457 props, 40458 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }), 40459 [value, selected] 40460 ); 40461 const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext); 40462 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 40463 role: getItemRole(popupRole), 40464 children: value 40465 }, props), { 40466 onClick, 40467 onKeyDown 40468 }); 40469 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 40470 props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 40471 store 40472 }, props), { 40473 getItem, 40474 // Dispatch a custom event on the combobox input when moving to an item 40475 // with the keyboard so the Combobox component can enable inline 40476 // autocompletion. 40477 moveOnKeyPress: (event) => { 40478 if (!moveOnKeyPressProp(event)) return false; 40479 const moveEvent = new Event("combobox-item-move"); 40480 const baseElement = store == null ? void 0 : store.getState().baseElement; 40481 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); 40482 return true; 40483 } 40484 })); 40485 props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props)); 40486 return props; 40487 } 40488 ); 40489 var ComboboxItem = memo2( 40490 forwardRef2(function ComboboxItem2(props) { 40491 const htmlProps = useComboboxItem(props); 40492 return createElement(ZTDSJLD6_TagName, htmlProps); 40493 }) 40494 ); 40495 40496 40497 40498 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js 40499 "use client"; 40500 40501 40502 40503 40504 40505 40506 40507 40508 40509 40510 40511 40512 // src/combobox/combobox-item-value.tsx 40513 40514 40515 40516 40517 var combobox_item_value_TagName = "span"; 40518 function normalizeValue(value) { 40519 return PBFD2E7P_normalizeString(value).toLowerCase(); 40520 } 40521 function getOffsets(string, values) { 40522 const offsets = []; 40523 for (const value of values) { 40524 let pos = 0; 40525 const length = value.length; 40526 while (string.indexOf(value, pos) !== -1) { 40527 const index = string.indexOf(value, pos); 40528 if (index !== -1) { 40529 offsets.push([index, length]); 40530 } 40531 pos = index + 1; 40532 } 40533 } 40534 return offsets; 40535 } 40536 function filterOverlappingOffsets(offsets) { 40537 return offsets.filter(([offset, length], i, arr) => { 40538 return !arr.some( 40539 ([o, l], j) => j !== i && o <= offset && o + l >= offset + length 40540 ); 40541 }); 40542 } 40543 function sortOffsets(offsets) { 40544 return offsets.sort(([a], [b]) => a - b); 40545 } 40546 function splitValue(itemValue, userValue) { 40547 if (!itemValue) return itemValue; 40548 if (!userValue) return itemValue; 40549 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue); 40550 const parts = []; 40551 const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40552 "span", 40553 { 40554 "data-autocomplete-value": autocomplete ? "" : void 0, 40555 "data-user-value": autocomplete ? void 0 : "", 40556 children: value 40557 }, 40558 parts.length 40559 ); 40560 const offsets = sortOffsets( 40561 filterOverlappingOffsets( 40562 // Convert userValues into a set to avoid duplicates 40563 getOffsets(normalizeValue(itemValue), new Set(userValues)) 40564 ) 40565 ); 40566 if (!offsets.length) { 40567 parts.push(span(itemValue, true)); 40568 return parts; 40569 } 40570 const [firstOffset] = offsets[0]; 40571 const values = [ 40572 itemValue.slice(0, firstOffset), 40573 ...offsets.flatMap(([offset, length], i) => { 40574 var _a; 40575 const value = itemValue.slice(offset, offset + length); 40576 const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0]; 40577 const nextValue = itemValue.slice(offset + length, nextOffset); 40578 return [value, nextValue]; 40579 }) 40580 ]; 40581 values.forEach((value, i) => { 40582 if (!value) return; 40583 parts.push(span(value, i % 2 === 0)); 40584 }); 40585 return parts; 40586 } 40587 var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) { 40588 var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]); 40589 const context = useComboboxScopedContext(); 40590 store = store || context; 40591 const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext); 40592 const itemValue = value != null ? value : itemContext; 40593 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); 40594 const children = (0,external_React_.useMemo)(() => { 40595 if (!itemValue) return; 40596 if (!inputValue) return itemValue; 40597 return splitValue(itemValue, inputValue); 40598 }, [itemValue, inputValue]); 40599 props = _3YLGPPWQ_spreadValues({ 40600 children 40601 }, props); 40602 return removeUndefinedValues(props); 40603 }); 40604 var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) { 40605 const htmlProps = useComboboxItemValue(props); 40606 return createElement(combobox_item_value_TagName, htmlProps); 40607 }); 40608 40609 40610 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/utils.js 40611 const utils_EMPTY_ARRAY = []; 40612 const getCurrentValue = (filterDefinition, currentFilter) => { 40613 if (filterDefinition.singleSelection) { 40614 return currentFilter?.value; 40615 } 40616 if (Array.isArray(currentFilter?.value)) { 40617 return currentFilter.value; 40618 } 40619 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 40620 return [currentFilter.value]; 40621 } 40622 return utils_EMPTY_ARRAY; 40623 }; 40624 40625 40626 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js 40627 40628 40629 40630 40631 40632 40633 40634 40635 40636 40637 40638 function search_widget_normalizeSearchInput(input = "") { 40639 return remove_accents_default()(input.trim().toLowerCase()); 40640 } 40641 const getNewValue = (filterDefinition, currentFilter, value) => { 40642 if (filterDefinition.singleSelection) { 40643 return value; 40644 } 40645 if (Array.isArray(currentFilter?.value)) { 40646 return currentFilter.value.includes(value) ? currentFilter.value.filter((v) => v !== value) : [...currentFilter.value, value]; 40647 } 40648 return [value]; 40649 }; 40650 function generateFilterElementCompositeItemId(prefix, filterElementValue) { 40651 return `$prefix}-$filterElementValue}`; 40652 } 40653 const MultiSelectionOption = ({ selected }) => { 40654 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40655 "span", 40656 { 40657 className: dist_clsx( 40658 "dataviews-filters__search-widget-listitem-multi-selection", 40659 { "is-selected": selected } 40660 ), 40661 children: selected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: check_default }) 40662 } 40663 ); 40664 }; 40665 const SingleSelectionOption = ({ selected }) => { 40666 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40667 "span", 40668 { 40669 className: dist_clsx( 40670 "dataviews-filters__search-widget-listitem-single-selection", 40671 { "is-selected": selected } 40672 ) 40673 } 40674 ); 40675 }; 40676 function ListBox({ view, filter, onChangeView }) { 40677 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, "dataviews-filter-list-box"); 40678 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_.useState)( 40679 // When there are one or less operators, the first item is set as active 40680 // (by setting the initial `activeId` to `undefined`). 40681 // With 2 or more operators, the focus is moved on the operators control 40682 // (by setting the initial `activeId` to `null`), meaning that there won't 40683 // be an active item initially. Focus is then managed via the 40684 // `onFocusVisible` callback. 40685 filter.operators?.length === 1 ? void 0 : null 40686 ); 40687 const currentFilter = view.filters?.find( 40688 (f) => f.field === filter.field 40689 ); 40690 const currentValue = getCurrentValue(filter, currentFilter); 40691 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40692 external_wp_components_namespaceObject.Composite, 40693 { 40694 virtualFocus: true, 40695 focusLoop: true, 40696 activeId: activeCompositeId, 40697 setActiveId: setActiveCompositeId, 40698 role: "listbox", 40699 className: "dataviews-filters__search-widget-listbox", 40700 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 40701 /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 40702 (0,external_wp_i18n_namespaceObject.__)("List of: %1$s"), 40703 filter.name 40704 ), 40705 onFocusVisible: () => { 40706 if (!activeCompositeId && filter.elements.length) { 40707 setActiveCompositeId( 40708 generateFilterElementCompositeItemId( 40709 baseId, 40710 filter.elements[0].value 40711 ) 40712 ); 40713 } 40714 }, 40715 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}), 40716 children: filter.elements.map((element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 40717 external_wp_components_namespaceObject.Composite.Hover, 40718 { 40719 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40720 external_wp_components_namespaceObject.Composite.Item, 40721 { 40722 id: generateFilterElementCompositeItemId( 40723 baseId, 40724 element.value 40725 ), 40726 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40727 "div", 40728 { 40729 "aria-label": element.label, 40730 role: "option", 40731 className: "dataviews-filters__search-widget-listitem" 40732 } 40733 ), 40734 onClick: () => { 40735 const newFilters = currentFilter ? [ 40736 ...(view.filters ?? []).map( 40737 (_filter) => { 40738 if (_filter.field === filter.field) { 40739 return { 40740 ..._filter, 40741 operator: currentFilter.operator || filter.operators[0], 40742 value: getNewValue( 40743 filter, 40744 currentFilter, 40745 element.value 40746 ) 40747 }; 40748 } 40749 return _filter; 40750 } 40751 ) 40752 ] : [ 40753 ...view.filters ?? [], 40754 { 40755 field: filter.field, 40756 operator: filter.operators[0], 40757 value: getNewValue( 40758 filter, 40759 currentFilter, 40760 element.value 40761 ) 40762 } 40763 ]; 40764 onChangeView({ 40765 ...view, 40766 page: 1, 40767 filters: newFilters 40768 }); 40769 } 40770 } 40771 ), 40772 children: [ 40773 filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40774 SingleSelectionOption, 40775 { 40776 selected: currentValue === element.value 40777 } 40778 ), 40779 !filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40780 MultiSelectionOption, 40781 { 40782 selected: currentValue.includes(element.value) 40783 } 40784 ), 40785 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element.label }) 40786 ] 40787 }, 40788 element.value 40789 )) 40790 } 40791 ); 40792 } 40793 function search_widget_ComboboxList({ view, filter, onChangeView }) { 40794 const [searchValue, setSearchValue] = (0,external_wp_element_.useState)(""); 40795 const deferredSearchValue = (0,external_wp_element_.useDeferredValue)(searchValue); 40796 const currentFilter = view.filters?.find( 40797 (_filter) => _filter.field === filter.field 40798 ); 40799 const currentValue = getCurrentValue(filter, currentFilter); 40800 const matches = (0,external_wp_element_.useMemo)(() => { 40801 const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue); 40802 return filter.elements.filter( 40803 (item) => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch) 40804 ); 40805 }, [filter.elements, deferredSearchValue]); 40806 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 40807 ComboboxProvider, 40808 { 40809 selectedValue: currentValue, 40810 setSelectedValue: (value) => { 40811 const newFilters = currentFilter ? [ 40812 ...(view.filters ?? []).map((_filter) => { 40813 if (_filter.field === filter.field) { 40814 return { 40815 ..._filter, 40816 operator: currentFilter.operator || filter.operators[0], 40817 value 40818 }; 40819 } 40820 return _filter; 40821 }) 40822 ] : [ 40823 ...view.filters ?? [], 40824 { 40825 field: filter.field, 40826 operator: filter.operators[0], 40827 value 40828 } 40829 ]; 40830 onChangeView({ 40831 ...view, 40832 page: 1, 40833 filters: newFilters 40834 }); 40835 }, 40836 setValue: setSearchValue, 40837 children: [ 40838 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [ 40839 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40840 ComboboxLabel, 40841 { 40842 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Search items") }), 40843 children: (0,external_wp_i18n_namespaceObject.__)("Search items") 40844 } 40845 ), 40846 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40847 Combobox, 40848 { 40849 autoSelect: "always", 40850 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search"), 40851 className: "dataviews-filters__search-widget-filter-combobox__input" 40852 } 40853 ), 40854 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: search_default }) }) 40855 ] }), 40856 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 40857 ComboboxList, 40858 { 40859 className: "dataviews-filters__search-widget-filter-combobox-list", 40860 alwaysVisible: true, 40861 children: [ 40862 matches.map((element) => { 40863 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 40864 ComboboxItem, 40865 { 40866 resetValueOnSelect: false, 40867 value: element.value, 40868 className: "dataviews-filters__search-widget-listitem", 40869 hideOnClick: false, 40870 setValueOnClick: false, 40871 focusOnHover: true, 40872 children: [ 40873 filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40874 SingleSelectionOption, 40875 { 40876 selected: currentValue === element.value 40877 } 40878 ), 40879 !filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40880 MultiSelectionOption, 40881 { 40882 selected: currentValue.includes( 40883 element.value 40884 ) 40885 } 40886 ), 40887 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { children: [ 40888 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40889 ComboboxItemValue, 40890 { 40891 className: "dataviews-filters__search-widget-filter-combobox-item-value", 40892 value: element.label 40893 } 40894 ), 40895 !!element.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description }) 40896 ] }) 40897 ] 40898 }, 40899 element.value 40900 ); 40901 }), 40902 !matches.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results found") }) 40903 ] 40904 } 40905 ) 40906 ] 40907 } 40908 ); 40909 } 40910 function SearchWidget(props) { 40911 const { elements, isLoading } = useElements({ 40912 elements: props.filter.elements, 40913 getElements: props.filter.getElements 40914 }); 40915 if (isLoading) { 40916 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }); 40917 } 40918 if (elements.length === 0) { 40919 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0,external_wp_i18n_namespaceObject.__)("No elements found") }); 40920 } 40921 const Widget = elements.length > 10 ? search_widget_ComboboxList : ListBox; 40922 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { ...props, filter: { ...props.filter, elements } }); 40923 } 40924 40925 40926 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js 40927 var es6 = __webpack_require__(7734); 40928 var es6_default = /*#__PURE__*/__webpack_require__.n(es6); 40929 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/input-widget.js 40930 40931 40932 40933 40934 40935 40936 function InputWidget({ 40937 filter, 40938 view, 40939 onChangeView, 40940 fields 40941 }) { 40942 const currentFilter = view.filters?.find( 40943 (f) => f.field === filter.field 40944 ); 40945 const currentValue = getCurrentValue(filter, currentFilter); 40946 const field = (0,external_wp_element_.useMemo)(() => { 40947 const currentField = fields.find((f) => f.id === filter.field); 40948 if (currentField) { 40949 return { 40950 ...currentField, 40951 // Deactivate validation for filters. 40952 isValid: { 40953 required: false, 40954 custom: () => null 40955 }, 40956 // Configure getValue/setValue as if Item was a plain object. 40957 getValue: ({ item }) => item[currentField.id], 40958 setValue: ({ value }) => ({ 40959 [currentField.id]: value 40960 }) 40961 }; 40962 } 40963 return currentField; 40964 }, [fields, filter.field]); 40965 const data = (0,external_wp_element_.useMemo)(() => { 40966 return (view.filters ?? []).reduce( 40967 (acc, activeFilter) => { 40968 acc[activeFilter.field] = activeFilter.value; 40969 return acc; 40970 }, 40971 {} 40972 ); 40973 }, [view.filters]); 40974 const handleChange = (0,external_wp_compose_namespaceObject.useEvent)((updatedData) => { 40975 if (!field || !currentFilter) { 40976 return; 40977 } 40978 const nextValue = field.getValue({ item: updatedData }); 40979 if (es6_default()(nextValue, currentValue)) { 40980 return; 40981 } 40982 onChangeView({ 40983 ...view, 40984 filters: (view.filters ?? []).map( 40985 (_filter) => _filter.field === filter.field ? { 40986 ..._filter, 40987 operator: currentFilter.operator || filter.operators[0], 40988 // Consider empty strings as undefined: 40989 // 40990 // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records 40991 // - empty string as value means "search empty string": returns only the records that have an empty string as value 40992 // 40993 // In practice, this means the filter will not be able to find an empty string as the value. 40994 value: nextValue === "" ? void 0 : nextValue 40995 } : _filter 40996 ) 40997 }); 40998 }); 40999 if (!field || !field.Edit || !currentFilter) { 41000 return null; 41001 } 41002 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41003 external_wp_components_namespaceObject.Flex, 41004 { 41005 className: "dataviews-filters__user-input-widget", 41006 gap: 2.5, 41007 direction: "column", 41008 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41009 field.Edit, 41010 { 41011 hideLabelFromVision: true, 41012 data, 41013 field, 41014 operator: currentFilter.operator, 41015 onChange: handleChange 41016 } 41017 ) 41018 } 41019 ); 41020 } 41021 41022 41023 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter.js 41024 41025 41026 41027 41028 41029 41030 const ENTER = "Enter"; 41031 const SPACE = " "; 41032 41033 41034 41035 41036 const FilterText = ({ 41037 activeElements, 41038 filterInView, 41039 filter 41040 }) => { 41041 if (activeElements === void 0 || activeElements.length === 0) { 41042 return filter.name; 41043 } 41044 const filterTextWrappers = { 41045 Name: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }), 41046 Value: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" }) 41047 }; 41048 if (filterInView?.operator === constants_OPERATOR_IS_ANY) { 41049 return (0,external_wp_element_.createInterpolateElement)( 41050 (0,external_wp_i18n_namespaceObject.sprintf)( 41051 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is any: Admin, Editor". */ 41052 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is any: </Name><Value>%2$s</Value>"), 41053 filter.name, 41054 activeElements.map((element) => element.label).join(", ") 41055 ), 41056 filterTextWrappers 41057 ); 41058 } 41059 if (filterInView?.operator === constants_OPERATOR_IS_NONE) { 41060 return (0,external_wp_element_.createInterpolateElement)( 41061 (0,external_wp_i18n_namespaceObject.sprintf)( 41062 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is none: Admin, Editor". */ 41063 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is none: </Name><Value>%2$s</Value>"), 41064 filter.name, 41065 activeElements.map((element) => element.label).join(", ") 41066 ), 41067 filterTextWrappers 41068 ); 41069 } 41070 if (filterInView?.operator === OPERATOR_IS_ALL) { 41071 return (0,external_wp_element_.createInterpolateElement)( 41072 (0,external_wp_i18n_namespaceObject.sprintf)( 41073 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is all: Admin, Editor". */ 41074 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is all: </Name><Value>%2$s</Value>"), 41075 filter.name, 41076 activeElements.map((element) => element.label).join(", ") 41077 ), 41078 filterTextWrappers 41079 ); 41080 } 41081 if (filterInView?.operator === OPERATOR_IS_NOT_ALL) { 41082 return (0,external_wp_element_.createInterpolateElement)( 41083 (0,external_wp_i18n_namespaceObject.sprintf)( 41084 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not all: Admin, Editor". */ 41085 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not all: </Name><Value>%2$s</Value>"), 41086 filter.name, 41087 activeElements.map((element) => element.label).join(", ") 41088 ), 41089 filterTextWrappers 41090 ); 41091 } 41092 if (filterInView?.operator === constants_OPERATOR_IS) { 41093 return (0,external_wp_element_.createInterpolateElement)( 41094 (0,external_wp_i18n_namespaceObject.sprintf)( 41095 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is: Admin". */ 41096 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 41097 filter.name, 41098 activeElements[0].label 41099 ), 41100 filterTextWrappers 41101 ); 41102 } 41103 if (filterInView?.operator === constants_OPERATOR_IS_NOT) { 41104 return (0,external_wp_element_.createInterpolateElement)( 41105 (0,external_wp_i18n_namespaceObject.sprintf)( 41106 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not: Admin". */ 41107 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 41108 filter.name, 41109 activeElements[0].label 41110 ), 41111 filterTextWrappers 41112 ); 41113 } 41114 if (filterInView?.operator === OPERATOR_LESS_THAN) { 41115 return (0,external_wp_element_.createInterpolateElement)( 41116 (0,external_wp_i18n_namespaceObject.sprintf)( 41117 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than: 10". */ 41118 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"), 41119 filter.name, 41120 activeElements[0].label 41121 ), 41122 filterTextWrappers 41123 ); 41124 } 41125 if (filterInView?.operator === OPERATOR_GREATER_THAN) { 41126 return (0,external_wp_element_.createInterpolateElement)( 41127 (0,external_wp_i18n_namespaceObject.sprintf)( 41128 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than: 10". */ 41129 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is greater than: </Name><Value>%2$s</Value>"), 41130 filter.name, 41131 activeElements[0].label 41132 ), 41133 filterTextWrappers 41134 ); 41135 } 41136 if (filterInView?.operator === OPERATOR_LESS_THAN_OR_EQUAL) { 41137 return (0,external_wp_element_.createInterpolateElement)( 41138 (0,external_wp_i18n_namespaceObject.sprintf)( 41139 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than or equal to: 10". */ 41140 (0,external_wp_i18n_namespaceObject.__)( 41141 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>" 41142 ), 41143 filter.name, 41144 activeElements[0].label 41145 ), 41146 filterTextWrappers 41147 ); 41148 } 41149 if (filterInView?.operator === OPERATOR_GREATER_THAN_OR_EQUAL) { 41150 return (0,external_wp_element_.createInterpolateElement)( 41151 (0,external_wp_i18n_namespaceObject.sprintf)( 41152 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than or equal to: 10". */ 41153 (0,external_wp_i18n_namespaceObject.__)( 41154 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>" 41155 ), 41156 filter.name, 41157 activeElements[0].label 41158 ), 41159 filterTextWrappers 41160 ); 41161 } 41162 if (filterInView?.operator === OPERATOR_CONTAINS) { 41163 return (0,external_wp_element_.createInterpolateElement)( 41164 (0,external_wp_i18n_namespaceObject.sprintf)( 41165 /* translators: 1: Filter name. 2: Filter value. e.g.: "Title contains: Mars". */ 41166 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"), 41167 filter.name, 41168 activeElements[0].label 41169 ), 41170 filterTextWrappers 41171 ); 41172 } 41173 if (filterInView?.operator === OPERATOR_NOT_CONTAINS) { 41174 return (0,external_wp_element_.createInterpolateElement)( 41175 (0,external_wp_i18n_namespaceObject.sprintf)( 41176 /* translators: 1: Filter name. 2: Filter value. e.g.: "Description doesn't contain: photo". */ 41177 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"), 41178 filter.name, 41179 activeElements[0].label 41180 ), 41181 filterTextWrappers 41182 ); 41183 } 41184 if (filterInView?.operator === OPERATOR_STARTS_WITH) { 41185 return (0,external_wp_element_.createInterpolateElement)( 41186 (0,external_wp_i18n_namespaceObject.sprintf)( 41187 /* translators: 1: Filter name. 2: Filter value. e.g.: "Title starts with: Mar". */ 41188 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"), 41189 filter.name, 41190 activeElements[0].label 41191 ), 41192 filterTextWrappers 41193 ); 41194 } 41195 if (filterInView?.operator === OPERATOR_BEFORE) { 41196 return (0,external_wp_element_.createInterpolateElement)( 41197 (0,external_wp_i18n_namespaceObject.sprintf)( 41198 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is before: 2024-01-01". */ 41199 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"), 41200 filter.name, 41201 activeElements[0].label 41202 ), 41203 filterTextWrappers 41204 ); 41205 } 41206 if (filterInView?.operator === OPERATOR_AFTER) { 41207 return (0,external_wp_element_.createInterpolateElement)( 41208 (0,external_wp_i18n_namespaceObject.sprintf)( 41209 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is after: 2024-01-01". */ 41210 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"), 41211 filter.name, 41212 activeElements[0].label 41213 ), 41214 filterTextWrappers 41215 ); 41216 } 41217 if (filterInView?.operator === OPERATOR_BEFORE_INC) { 41218 return (0,external_wp_element_.createInterpolateElement)( 41219 (0,external_wp_i18n_namespaceObject.sprintf)( 41220 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or before: 2024-01-01". */ 41221 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is on or before: </Name><Value>%2$s</Value>"), 41222 filter.name, 41223 activeElements[0].label 41224 ), 41225 filterTextWrappers 41226 ); 41227 } 41228 if (filterInView?.operator === OPERATOR_AFTER_INC) { 41229 return (0,external_wp_element_.createInterpolateElement)( 41230 (0,external_wp_i18n_namespaceObject.sprintf)( 41231 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or after: 2024-01-01". */ 41232 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is on or after: </Name><Value>%2$s</Value>"), 41233 filter.name, 41234 activeElements[0].label 41235 ), 41236 filterTextWrappers 41237 ); 41238 } 41239 if (filterInView?.operator === OPERATOR_BETWEEN) { 41240 const { label } = activeElements[0]; 41241 return (0,external_wp_element_.createInterpolateElement)( 41242 (0,external_wp_i18n_namespaceObject.sprintf)( 41243 /* translators: 1: Filter name. 2: Min value. 3: Max value. e.g.: "Item count between (inc): 10 and 180". */ 41244 (0,external_wp_i18n_namespaceObject.__)( 41245 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>" 41246 ), 41247 filter.name, 41248 label[0], 41249 label[1] 41250 ), 41251 filterTextWrappers 41252 ); 41253 } 41254 if (filterInView?.operator === OPERATOR_ON) { 41255 return (0,external_wp_element_.createInterpolateElement)( 41256 (0,external_wp_i18n_namespaceObject.sprintf)( 41257 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is: 2024-01-01". */ 41258 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 41259 filter.name, 41260 activeElements[0].label 41261 ), 41262 filterTextWrappers 41263 ); 41264 } 41265 if (filterInView?.operator === OPERATOR_NOT_ON) { 41266 return (0,external_wp_element_.createInterpolateElement)( 41267 (0,external_wp_i18n_namespaceObject.sprintf)( 41268 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is not: 2024-01-01". */ 41269 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 41270 filter.name, 41271 activeElements[0].label 41272 ), 41273 filterTextWrappers 41274 ); 41275 } 41276 if (filterInView?.operator === OPERATOR_IN_THE_PAST) { 41277 return (0,external_wp_element_.createInterpolateElement)( 41278 (0,external_wp_i18n_namespaceObject.sprintf)( 41279 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is in the past: 1 days". */ 41280 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is in the past: </Name><Value>%2$s</Value>"), 41281 filter.name, 41282 `$activeElements[0].value.value} $activeElements[0].value.unit}` 41283 ), 41284 filterTextWrappers 41285 ); 41286 } 41287 if (filterInView?.operator === OPERATOR_OVER) { 41288 return (0,external_wp_element_.createInterpolateElement)( 41289 (0,external_wp_i18n_namespaceObject.sprintf)( 41290 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is over: 1 days ago". */ 41291 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is over: </Name><Value>%2$s</Value> ago"), 41292 filter.name, 41293 `$activeElements[0].value.value} $activeElements[0].value.unit}` 41294 ), 41295 filterTextWrappers 41296 ); 41297 } 41298 return (0,external_wp_i18n_namespaceObject.sprintf)( 41299 /* translators: 1: Filter name e.g.: "Unknown status for Author". */ 41300 (0,external_wp_i18n_namespaceObject.__)("Unknown status for %1$s"), 41301 filter.name 41302 ); 41303 }; 41304 function OperatorSelector({ 41305 filter, 41306 view, 41307 onChangeView 41308 }) { 41309 const operatorOptions = filter.operators?.map((operator) => ({ 41310 value: operator, 41311 label: OPERATORS[operator]?.label 41312 })); 41313 const currentFilter = view.filters?.find( 41314 (_filter) => _filter.field === filter.field 41315 ); 41316 const value = currentFilter?.operator || filter.operators[0]; 41317 return operatorOptions.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41318 external_wp_components_namespaceObject.__experimentalHStack, 41319 { 41320 spacing: 2, 41321 justify: "flex-start", 41322 className: "dataviews-filters__summary-operators-container", 41323 children: [ 41324 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }), 41325 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41326 external_wp_components_namespaceObject.SelectControl, 41327 { 41328 className: "dataviews-filters__summary-operators-filter-select", 41329 label: (0,external_wp_i18n_namespaceObject.__)("Conditions"), 41330 value, 41331 options: operatorOptions, 41332 onChange: (newValue) => { 41333 const operator = newValue; 41334 const currentOperator = currentFilter?.operator; 41335 const newFilters = currentFilter ? [ 41336 ...(view.filters ?? []).map( 41337 (_filter) => { 41338 if (_filter.field === filter.field) { 41339 const OPERATORS_SHOULD_RESET_VALUE = [ 41340 OPERATOR_BETWEEN, 41341 OPERATOR_IN_THE_PAST, 41342 OPERATOR_OVER 41343 ]; 41344 const shouldResetValue = currentOperator && (OPERATORS_SHOULD_RESET_VALUE.includes( 41345 currentOperator 41346 ) || OPERATORS_SHOULD_RESET_VALUE.includes( 41347 operator 41348 )); 41349 return { 41350 ..._filter, 41351 value: shouldResetValue ? void 0 : _filter.value, 41352 operator 41353 }; 41354 } 41355 return _filter; 41356 } 41357 ) 41358 ] : [ 41359 ...view.filters ?? [], 41360 { 41361 field: filter.field, 41362 operator, 41363 value: void 0 41364 } 41365 ]; 41366 onChangeView({ 41367 ...view, 41368 page: 1, 41369 filters: newFilters 41370 }); 41371 }, 41372 size: "small", 41373 variant: "minimal", 41374 __nextHasNoMarginBottom: true, 41375 hideLabelFromVision: true 41376 } 41377 ) 41378 ] 41379 } 41380 ); 41381 } 41382 function Filter({ 41383 addFilterRef, 41384 openedFilter, 41385 fields, 41386 ...commonProps 41387 }) { 41388 const toggleRef = (0,external_wp_element_.useRef)(null); 41389 const { filter, view, onChangeView } = commonProps; 41390 const filterInView = view.filters?.find( 41391 (f) => f.field === filter.field 41392 ); 41393 let activeElements = []; 41394 const { elements } = useElements({ 41395 elements: filter.elements, 41396 getElements: filter.getElements 41397 }); 41398 if (elements.length > 0) { 41399 activeElements = elements.filter((element) => { 41400 if (filter.singleSelection) { 41401 return element.value === filterInView?.value; 41402 } 41403 return filterInView?.value?.includes(element.value); 41404 }); 41405 } else if (filterInView?.value !== void 0) { 41406 activeElements = [ 41407 { 41408 value: filterInView.value, 41409 label: filterInView.value 41410 } 41411 ]; 41412 } 41413 const isPrimary = filter.isPrimary; 41414 const isLocked = filterInView?.isLocked; 41415 const hasValues = !isLocked && filterInView?.value !== void 0; 41416 const canResetOrRemove = !isLocked && (!isPrimary || hasValues); 41417 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41418 external_wp_components_namespaceObject.Dropdown, 41419 { 41420 defaultOpen: openedFilter === filter.field, 41421 contentClassName: "dataviews-filters__summary-popover", 41422 popoverProps: { placement: "bottom-start", role: "dialog" }, 41423 onClose: () => { 41424 toggleRef.current?.focus(); 41425 }, 41426 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [ 41427 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41428 external_wp_components_namespaceObject.Tooltip, 41429 { 41430 text: (0,external_wp_i18n_namespaceObject.sprintf)( 41431 /* translators: 1: Filter name. */ 41432 (0,external_wp_i18n_namespaceObject.__)("Filter by: %1$s"), 41433 filter.name.toLowerCase() 41434 ), 41435 placement: "top", 41436 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41437 "div", 41438 { 41439 className: dist_clsx( 41440 "dataviews-filters__summary-chip", 41441 { 41442 "has-reset": canResetOrRemove, 41443 "has-values": hasValues, 41444 "is-not-clickable": isLocked 41445 } 41446 ), 41447 role: "button", 41448 tabIndex: isLocked ? -1 : 0, 41449 onClick: () => { 41450 if (!isLocked) { 41451 onToggle(); 41452 } 41453 }, 41454 onKeyDown: (event) => { 41455 if (!isLocked && [ENTER, SPACE].includes(event.key)) { 41456 onToggle(); 41457 event.preventDefault(); 41458 } 41459 }, 41460 "aria-disabled": isLocked, 41461 "aria-pressed": isOpen, 41462 "aria-expanded": isOpen, 41463 ref: toggleRef, 41464 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41465 FilterText, 41466 { 41467 activeElements, 41468 filterInView, 41469 filter 41470 } 41471 ) 41472 } 41473 ) 41474 } 41475 ), 41476 canResetOrRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41477 external_wp_components_namespaceObject.Tooltip, 41478 { 41479 text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)("Reset") : (0,external_wp_i18n_namespaceObject.__)("Remove"), 41480 placement: "top", 41481 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41482 "button", 41483 { 41484 className: dist_clsx( 41485 "dataviews-filters__summary-chip-remove", 41486 { "has-values": hasValues } 41487 ), 41488 onClick: () => { 41489 onChangeView({ 41490 ...view, 41491 page: 1, 41492 filters: view.filters?.filter( 41493 (_filter) => _filter.field !== filter.field 41494 ) 41495 }); 41496 if (!isPrimary) { 41497 addFilterRef.current?.focus(); 41498 } else { 41499 toggleRef.current?.focus(); 41500 } 41501 }, 41502 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: close_small_default }) 41503 } 41504 ) 41505 } 41506 ) 41507 ] }), 41508 renderContent: () => { 41509 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, justify: "flex-start", children: [ 41510 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { ...commonProps }), 41511 commonProps.filter.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41512 SearchWidget, 41513 { 41514 ...commonProps, 41515 filter: { 41516 ...commonProps.filter, 41517 elements 41518 } 41519 } 41520 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWidget, { ...commonProps, fields }) 41521 ] }); 41522 } 41523 } 41524 ); 41525 } 41526 41527 41528 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js 41529 41530 41531 41532 function ResetFilter({ 41533 filters, 41534 view, 41535 onChangeView 41536 }) { 41537 const isPrimary = (field) => filters.some( 41538 (_filter) => _filter.field === field && _filter.isPrimary 41539 ); 41540 const isDisabled = !view.search && !view.filters?.some( 41541 (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field)) 41542 ); 41543 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41544 external_wp_components_namespaceObject.Button, 41545 { 41546 disabled: isDisabled, 41547 accessibleWhenDisabled: true, 41548 size: "compact", 41549 variant: "tertiary", 41550 className: "dataviews-filters__reset-button", 41551 onClick: () => { 41552 onChangeView({ 41553 ...view, 41554 page: 1, 41555 search: "", 41556 filters: view.filters?.filter((f) => !!f.isLocked) || [] 41557 }); 41558 }, 41559 children: (0,external_wp_i18n_namespaceObject.__)("Reset") 41560 } 41561 ); 41562 } 41563 41564 41565 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/use-filters.js 41566 41567 41568 function useFilters(fields, view) { 41569 return (0,external_wp_element_.useMemo)(() => { 41570 const filters = []; 41571 fields.forEach((field) => { 41572 if (field.filterBy === false || !field.hasElements && !field.Edit) { 41573 return; 41574 } 41575 const operators = field.filterBy.operators; 41576 const isPrimary = !!field.filterBy?.isPrimary; 41577 const isLocked = view.filters?.some( 41578 (f) => f.field === field.id && !!f.isLocked 41579 ) ?? false; 41580 filters.push({ 41581 field: field.id, 41582 name: field.label, 41583 elements: field.elements, 41584 getElements: field.getElements, 41585 hasElements: field.hasElements, 41586 singleSelection: operators.some( 41587 (op) => SINGLE_SELECTION_OPERATORS.includes(op) 41588 ), 41589 operators, 41590 isVisible: isLocked || isPrimary || !!view.filters?.some( 41591 (f) => f.field === field.id && ALL_OPERATORS.includes(f.operator) 41592 ), 41593 isPrimary, 41594 isLocked 41595 }); 41596 }); 41597 filters.sort((a, b) => { 41598 if (a.isLocked && !b.isLocked) { 41599 return -1; 41600 } 41601 if (!a.isLocked && b.isLocked) { 41602 return 1; 41603 } 41604 if (a.isPrimary && !b.isPrimary) { 41605 return -1; 41606 } 41607 if (!a.isPrimary && b.isPrimary) { 41608 return 1; 41609 } 41610 return a.name.localeCompare(b.name); 41611 }); 41612 return filters; 41613 }, [fields, view]); 41614 } 41615 var use_filters_default = useFilters; 41616 41617 41618 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filters.js 41619 41620 41621 41622 41623 41624 41625 41626 41627 function Filters({ className }) { 41628 const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0,external_wp_element_.useContext)(dataviews_context_default); 41629 const addFilterRef = (0,external_wp_element_.useRef)(null); 41630 const filters = use_filters_default(fields, view); 41631 const addFilter = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41632 add_filter_default, 41633 { 41634 filters, 41635 view, 41636 onChangeView, 41637 ref: addFilterRef, 41638 setOpenedFilter 41639 }, 41640 "add-filter" 41641 ); 41642 const visibleFilters = filters.filter((filter) => filter.isVisible); 41643 if (visibleFilters.length === 0) { 41644 return null; 41645 } 41646 const filterComponents = [ 41647 ...visibleFilters.map((filter) => { 41648 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41649 Filter, 41650 { 41651 filter, 41652 view, 41653 fields, 41654 onChangeView, 41655 addFilterRef, 41656 openedFilter 41657 }, 41658 filter.field 41659 ); 41660 }), 41661 addFilter 41662 ]; 41663 filterComponents.push( 41664 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41665 ResetFilter, 41666 { 41667 filters, 41668 view, 41669 onChangeView 41670 }, 41671 "reset-filters" 41672 ) 41673 ); 41674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41675 external_wp_components_namespaceObject.__experimentalHStack, 41676 { 41677 justify: "flex-start", 41678 style: { width: "fit-content" }, 41679 wrap: true, 41680 className, 41681 children: filterComponents 41682 } 41683 ); 41684 } 41685 var filters_default = (0,external_wp_element_.memo)(Filters); 41686 41687 41688 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filters-toggled.js 41689 41690 41691 41692 41693 function FiltersToggled(props) { 41694 const { isShowingFilter } = (0,external_wp_element_.useContext)(dataviews_context_default); 41695 if (!isShowingFilter) { 41696 return null; 41697 } 41698 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(filters_default, { ...props }); 41699 } 41700 var filters_toggled_default = FiltersToggled; 41701 41702 41703 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js 41704 41705 41706 41707 41708 41709 function DataViewsLayout({ className }) { 41710 const { 41711 actions = [], 41712 data, 41713 fields, 41714 getItemId, 41715 getItemLevel, 41716 isLoading, 41717 view, 41718 onChangeView, 41719 selection, 41720 onChangeSelection, 41721 setOpenedFilter, 41722 onClickItem, 41723 isItemClickable, 41724 renderItemLink, 41725 defaultLayouts, 41726 empty = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results") }) 41727 } = (0,external_wp_element_.useContext)(dataviews_context_default); 41728 const ViewComponent = VIEW_LAYOUTS.find( 41729 (v) => v.type === view.type && defaultLayouts[v.type] 41730 )?.component; 41731 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41732 ViewComponent, 41733 { 41734 className, 41735 actions, 41736 data, 41737 fields, 41738 getItemId, 41739 getItemLevel, 41740 isLoading, 41741 onChangeView, 41742 onChangeSelection, 41743 selection, 41744 setOpenedFilter, 41745 onClickItem, 41746 renderItemLink, 41747 isItemClickable, 41748 view, 41749 empty 41750 } 41751 ); 41752 } 41753 41754 41755 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js 41756 41757 41758 41759 41760 41761 41762 function dataviews_pagination_DataViewsPagination() { 41763 const { 41764 view, 41765 onChangeView, 41766 paginationInfo: { totalItems = 0, totalPages } 41767 } = (0,external_wp_element_.useContext)(dataviews_context_default); 41768 if (!totalItems || !totalPages || view.infiniteScrollEnabled) { 41769 return null; 41770 } 41771 const currentPage = view.page ?? 1; 41772 const pageSelectOptions = Array.from(Array(totalPages)).map( 41773 (_, i) => { 41774 const page = i + 1; 41775 return { 41776 value: page.toString(), 41777 label: page.toString(), 41778 "aria-label": currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)( 41779 // translators: 1: current page number. 2: total number of pages. 41780 (0,external_wp_i18n_namespaceObject.__)("Page %1$d of %2$d"), 41781 currentPage, 41782 totalPages 41783 ) : page.toString() 41784 }; 41785 } 41786 ); 41787 return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41788 external_wp_components_namespaceObject.__experimentalHStack, 41789 { 41790 expanded: false, 41791 className: "dataviews-pagination", 41792 justify: "end", 41793 spacing: 6, 41794 children: [ 41795 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41796 external_wp_components_namespaceObject.__experimentalHStack, 41797 { 41798 justify: "flex-start", 41799 expanded: false, 41800 spacing: 1, 41801 className: "dataviews-pagination__page-select", 41802 children: (0,external_wp_element_.createInterpolateElement)( 41803 (0,external_wp_i18n_namespaceObject.sprintf)( 41804 // translators: 1: Current page number, 2: Total number of pages. 41805 (0,external_wp_i18n_namespaceObject._x)( 41806 "<div>Page</div>%1$s<div>of %2$d</div>", 41807 "paging" 41808 ), 41809 "<CurrentPage />", 41810 totalPages 41811 ), 41812 { 41813 div: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }), 41814 CurrentPage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41815 external_wp_components_namespaceObject.SelectControl, 41816 { 41817 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Current page"), 41818 value: currentPage.toString(), 41819 options: pageSelectOptions, 41820 onChange: (newValue) => { 41821 onChangeView({ 41822 ...view, 41823 page: +newValue 41824 }); 41825 }, 41826 size: "small", 41827 __nextHasNoMarginBottom: true, 41828 variant: "minimal" 41829 } 41830 ) 41831 } 41832 ) 41833 } 41834 ), 41835 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [ 41836 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41837 external_wp_components_namespaceObject.Button, 41838 { 41839 onClick: () => onChangeView({ 41840 ...view, 41841 page: currentPage - 1 41842 }), 41843 disabled: currentPage === 1, 41844 accessibleWhenDisabled: true, 41845 label: (0,external_wp_i18n_namespaceObject.__)("Previous page"), 41846 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default, 41847 showTooltip: true, 41848 size: "compact", 41849 tooltipPosition: "top" 41850 } 41851 ), 41852 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41853 external_wp_components_namespaceObject.Button, 41854 { 41855 onClick: () => onChangeView({ ...view, page: currentPage + 1 }), 41856 disabled: currentPage >= totalPages, 41857 accessibleWhenDisabled: true, 41858 label: (0,external_wp_i18n_namespaceObject.__)("Next page"), 41859 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default, 41860 showTooltip: true, 41861 size: "compact", 41862 tooltipPosition: "top" 41863 } 41864 ) 41865 ] }) 41866 ] 41867 } 41868 ); 41869 } 41870 var dataviews_pagination_default = (0,external_wp_element_.memo)(dataviews_pagination_DataViewsPagination); 41871 41872 41873 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js 41874 41875 41876 41877 41878 41879 41880 41881 const dataviews_footer_EMPTY_ARRAY = []; 41882 function DataViewsFooter() { 41883 const { 41884 view, 41885 paginationInfo: { totalItems = 0, totalPages }, 41886 data, 41887 actions = dataviews_footer_EMPTY_ARRAY 41888 } = (0,external_wp_element_.useContext)(dataviews_context_default); 41889 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type); 41890 if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) { 41891 return null; 41892 } 41893 return !!totalItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41894 external_wp_components_namespaceObject.__experimentalHStack, 41895 { 41896 expanded: false, 41897 justify: "end", 41898 className: "dataviews-footer", 41899 children: [ 41900 hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}), 41901 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination_default, {}) 41902 ] 41903 } 41904 ); 41905 } 41906 41907 41908 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js 41909 41910 41911 41912 41913 41914 41915 const DataViewsSearch = (0,external_wp_element_.memo)(function Search({ label }) { 41916 const { view, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default); 41917 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)( 41918 view.search 41919 ); 41920 (0,external_wp_element_.useEffect)(() => { 41921 setSearch(view.search ?? ""); 41922 }, [view.search, setSearch]); 41923 const onChangeViewRef = (0,external_wp_element_.useRef)(onChangeView); 41924 const viewRef = (0,external_wp_element_.useRef)(view); 41925 (0,external_wp_element_.useEffect)(() => { 41926 onChangeViewRef.current = onChangeView; 41927 viewRef.current = view; 41928 }, [onChangeView, view]); 41929 (0,external_wp_element_.useEffect)(() => { 41930 if (debouncedSearch !== viewRef.current?.search) { 41931 onChangeViewRef.current({ 41932 ...viewRef.current, 41933 page: 1, 41934 search: debouncedSearch 41935 }); 41936 } 41937 }, [debouncedSearch]); 41938 const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)("Search"); 41939 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41940 external_wp_components_namespaceObject.SearchControl, 41941 { 41942 className: "dataviews-search", 41943 __nextHasNoMarginBottom: true, 41944 onChange: setSearch, 41945 value: search, 41946 label: searchLabel, 41947 placeholder: searchLabel, 41948 size: "compact" 41949 } 41950 ); 41951 }); 41952 var dataviews_search_default = DataViewsSearch; 41953 41954 41955 ;// ./node_modules/@wordpress/icons/build-module/library/lock.js 41956 41957 41958 var lock_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" }) }); 41959 41960 41961 ;// ./node_modules/@wordpress/icons/build-module/library/cog.js 41962 41963 41964 var cog_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41965 external_wp_primitives_namespaceObject.Path, 41966 { 41967 fillRule: "evenodd", 41968 d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", 41969 clipRule: "evenodd" 41970 } 41971 ) }); 41972 41973 41974 ;// external ["wp","warning"] 41975 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 41976 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 41977 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/infinite-scroll-toggle.js 41978 41979 41980 41981 41982 41983 function InfiniteScrollToggle() { 41984 const context = (0,external_wp_element_.useContext)(dataviews_context_default); 41985 const { view, onChangeView } = context; 41986 const infiniteScrollEnabled = view.infiniteScrollEnabled ?? false; 41987 if (!context.hasInfiniteScrollHandler) { 41988 return null; 41989 } 41990 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41991 external_wp_components_namespaceObject.ToggleControl, 41992 { 41993 __nextHasNoMarginBottom: true, 41994 label: (0,external_wp_i18n_namespaceObject.__)("Enable infinite scroll"), 41995 help: (0,external_wp_i18n_namespaceObject.__)( 41996 "Automatically load more content as you scroll, instead of showing pagination links." 41997 ), 41998 checked: infiniteScrollEnabled, 41999 onChange: (newValue) => { 42000 onChangeView({ 42001 ...view, 42002 infiniteScrollEnabled: newValue 42003 }); 42004 } 42005 } 42006 ); 42007 } 42008 42009 42010 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js 42011 42012 42013 42014 42015 42016 42017 42018 42019 42020 42021 42022 42023 42024 const { Menu: dataviews_view_config_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 42025 const DATAVIEWS_CONFIG_POPOVER_PROPS = { 42026 className: "dataviews-config__popover", 42027 placement: "bottom-end", 42028 offset: 9 42029 }; 42030 function ViewTypeMenu() { 42031 const { view, onChangeView, defaultLayouts } = (0,external_wp_element_.useContext)(dataviews_context_default); 42032 const availableLayouts = Object.keys(defaultLayouts); 42033 if (availableLayouts.length <= 1) { 42034 return null; 42035 } 42036 const activeView = VIEW_LAYOUTS.find((v) => view.type === v.type); 42037 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { children: [ 42038 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42039 dataviews_view_config_Menu.TriggerButton, 42040 { 42041 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42042 external_wp_components_namespaceObject.Button, 42043 { 42044 size: "compact", 42045 icon: activeView?.icon, 42046 label: (0,external_wp_i18n_namespaceObject.__)("Layout") 42047 } 42048 ) 42049 } 42050 ), 42051 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: availableLayouts.map((layout) => { 42052 const config = VIEW_LAYOUTS.find( 42053 (v) => v.type === layout 42054 ); 42055 if (!config) { 42056 return null; 42057 } 42058 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42059 dataviews_view_config_Menu.RadioItem, 42060 { 42061 value: layout, 42062 name: "view-actions-available-view", 42063 checked: layout === view.type, 42064 hideOnClick: true, 42065 onChange: (e) => { 42066 switch (e.target.value) { 42067 case "list": 42068 case "grid": 42069 case "table": 42070 case "pickerGrid": 42071 const viewWithoutLayout = { ...view }; 42072 if ("layout" in viewWithoutLayout) { 42073 delete viewWithoutLayout.layout; 42074 } 42075 return onChangeView({ 42076 ...viewWithoutLayout, 42077 type: e.target.value, 42078 ...defaultLayouts[e.target.value] 42079 }); 42080 } 42081 external_wp_warning_default()("Invalid dataview"); 42082 }, 42083 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: config.label }) 42084 }, 42085 layout 42086 ); 42087 }) }) 42088 ] }); 42089 } 42090 function SortFieldControl() { 42091 const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default); 42092 const orderOptions = (0,external_wp_element_.useMemo)(() => { 42093 const sortableFields = fields.filter( 42094 (field) => field.enableSorting !== false 42095 ); 42096 return sortableFields.map((field) => { 42097 return { 42098 label: field.label, 42099 value: field.id 42100 }; 42101 }); 42102 }, [fields]); 42103 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42104 external_wp_components_namespaceObject.SelectControl, 42105 { 42106 __nextHasNoMarginBottom: true, 42107 __next40pxDefaultSize: true, 42108 label: (0,external_wp_i18n_namespaceObject.__)("Sort by"), 42109 value: view.sort?.field, 42110 options: orderOptions, 42111 onChange: (value) => { 42112 onChangeView({ 42113 ...view, 42114 sort: { 42115 direction: view?.sort?.direction || "desc", 42116 field: value 42117 }, 42118 showLevels: false 42119 }); 42120 } 42121 } 42122 ); 42123 } 42124 function SortDirectionControl() { 42125 const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default); 42126 const sortableFields = fields.filter( 42127 (field) => field.enableSorting !== false 42128 ); 42129 if (sortableFields.length === 0) { 42130 return null; 42131 } 42132 let value = view.sort?.direction; 42133 if (!value && view.sort?.field) { 42134 value = "desc"; 42135 } 42136 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42137 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 42138 { 42139 className: "dataviews-view-config__sort-direction", 42140 __nextHasNoMarginBottom: true, 42141 __next40pxDefaultSize: true, 42142 isBlock: true, 42143 label: (0,external_wp_i18n_namespaceObject.__)("Order"), 42144 value, 42145 onChange: (newDirection) => { 42146 if (newDirection === "asc" || newDirection === "desc") { 42147 onChangeView({ 42148 ...view, 42149 sort: { 42150 direction: newDirection, 42151 field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field. 42152 fields.find( 42153 (field) => field.enableSorting !== false 42154 )?.id || "" 42155 }, 42156 showLevels: false 42157 }); 42158 return; 42159 } 42160 external_wp_warning_default()("Invalid direction"); 42161 }, 42162 children: SORTING_DIRECTIONS.map((direction) => { 42163 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42164 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 42165 { 42166 value: direction, 42167 icon: sortIcons[direction], 42168 label: sortLabels[direction] 42169 }, 42170 direction 42171 ); 42172 }) 42173 } 42174 ); 42175 } 42176 function ItemsPerPageControl() { 42177 const { view, config, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default); 42178 const { infiniteScrollEnabled } = view; 42179 if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) { 42180 return null; 42181 } 42182 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42183 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 42184 { 42185 __nextHasNoMarginBottom: true, 42186 __next40pxDefaultSize: true, 42187 isBlock: true, 42188 label: (0,external_wp_i18n_namespaceObject.__)("Items per page"), 42189 value: view.perPage || 10, 42190 disabled: !view?.sort?.field, 42191 onChange: (newItemsPerPage) => { 42192 const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10); 42193 onChangeView({ 42194 ...view, 42195 perPage: newItemsPerPageNumber, 42196 page: 1 42197 }); 42198 }, 42199 children: config.perPageSizes.map((value) => { 42200 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42201 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 42202 { 42203 value, 42204 label: value.toString() 42205 }, 42206 value 42207 ); 42208 }) 42209 } 42210 ); 42211 } 42212 function PreviewOptions({ 42213 previewOptions, 42214 onChangePreviewOption, 42215 onMenuOpenChange, 42216 activeOption 42217 }) { 42218 const focusPreviewOptionsField = (id) => { 42219 setTimeout(() => { 42220 const element = document.querySelector( 42221 `.dataviews-field-control__field-$id} .dataviews-field-control__field-preview-options-button` 42222 ); 42223 if (element instanceof HTMLElement) { 42224 element.focus(); 42225 } 42226 }, 50); 42227 }; 42228 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { onOpenChange: onMenuOpenChange, children: [ 42229 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42230 dataviews_view_config_Menu.TriggerButton, 42231 { 42232 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42233 external_wp_components_namespaceObject.Button, 42234 { 42235 className: "dataviews-field-control__field-preview-options-button", 42236 size: "compact", 42237 icon: more_vertical_default, 42238 label: (0,external_wp_i18n_namespaceObject.__)("Preview") 42239 } 42240 ) 42241 } 42242 ), 42243 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: previewOptions?.map(({ id, label }) => { 42244 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42245 dataviews_view_config_Menu.RadioItem, 42246 { 42247 value: id, 42248 checked: id === activeOption, 42249 onChange: () => { 42250 onChangePreviewOption?.(id); 42251 focusPreviewOptionsField(id); 42252 }, 42253 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: label }) 42254 }, 42255 id 42256 ); 42257 }) }) 42258 ] }); 42259 } 42260 function FieldItem({ 42261 field, 42262 label, 42263 description, 42264 isVisible, 42265 isFirst, 42266 isLast, 42267 canMove = true, 42268 onToggleVisibility, 42269 onMoveUp, 42270 onMoveDown, 42271 previewOptions, 42272 onChangePreviewOption 42273 }) { 42274 const [isChangingPreviewOption, setIsChangingPreviewOption] = (0,external_wp_element_.useState)(false); 42275 const focusVisibilityField = () => { 42276 setTimeout(() => { 42277 const element = document.querySelector( 42278 `.dataviews-field-control__field-$field.id} .dataviews-field-control__field-visibility-button` 42279 ); 42280 if (element instanceof HTMLElement) { 42281 element.focus(); 42282 } 42283 }, 50); 42284 }; 42285 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42286 external_wp_components_namespaceObject.__experimentalHStack, 42287 { 42288 expanded: true, 42289 className: dist_clsx( 42290 "dataviews-field-control__field", 42291 `dataviews-field-control__field-$field.id}`, 42292 // The actions are hidden when the mouse is not hovering the item, or focus 42293 // is outside the item. 42294 // For actions that require a popover, a menu etc, that would mean that when the interactive element 42295 // opens and the focus goes there the actions would be hidden. 42296 // To avoid that we add a class to the item, that makes sure actions are visible while there is some 42297 // interaction with the item. 42298 { "is-interacting": isChangingPreviewOption } 42299 ), 42300 justify: "flex-start", 42301 children: [ 42302 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__icon", children: !canMove && !field.enableHiding && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: lock_default }) }), 42303 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-field-control__label-sub-label-container", children: [ 42304 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__label", children: label || field.label }), 42305 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__sub-label", children: description }) 42306 ] }), 42307 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42308 external_wp_components_namespaceObject.__experimentalHStack, 42309 { 42310 justify: "flex-end", 42311 expanded: false, 42312 className: "dataviews-field-control__actions", 42313 children: [ 42314 isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 42315 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42316 external_wp_components_namespaceObject.Button, 42317 { 42318 disabled: isFirst || !canMove, 42319 accessibleWhenDisabled: true, 42320 size: "compact", 42321 onClick: onMoveUp, 42322 icon: chevron_up_default, 42323 label: isFirst || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved up") : (0,external_wp_i18n_namespaceObject.sprintf)( 42324 /* translators: %s: field label */ 42325 (0,external_wp_i18n_namespaceObject.__)("Move %s up"), 42326 field.label 42327 ) 42328 } 42329 ), 42330 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42331 external_wp_components_namespaceObject.Button, 42332 { 42333 disabled: isLast || !canMove, 42334 accessibleWhenDisabled: true, 42335 size: "compact", 42336 onClick: onMoveDown, 42337 icon: chevron_down_default, 42338 label: isLast || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved down") : (0,external_wp_i18n_namespaceObject.sprintf)( 42339 /* translators: %s: field label */ 42340 (0,external_wp_i18n_namespaceObject.__)("Move %s down"), 42341 field.label 42342 ) 42343 } 42344 ) 42345 ] }), 42346 onToggleVisibility && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42347 external_wp_components_namespaceObject.Button, 42348 { 42349 className: "dataviews-field-control__field-visibility-button", 42350 disabled: !field.enableHiding, 42351 accessibleWhenDisabled: true, 42352 size: "compact", 42353 onClick: () => { 42354 onToggleVisibility(); 42355 focusVisibilityField(); 42356 }, 42357 icon: isVisible ? unseen_default : seen_default, 42358 label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)( 42359 /* translators: %s: field label */ 42360 (0,external_wp_i18n_namespaceObject._x)("Hide %s", "field"), 42361 field.label 42362 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 42363 /* translators: %s: field label */ 42364 (0,external_wp_i18n_namespaceObject._x)("Show %s", "field"), 42365 field.label 42366 ) 42367 } 42368 ), 42369 previewOptions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42370 PreviewOptions, 42371 { 42372 previewOptions, 42373 onChangePreviewOption, 42374 onMenuOpenChange: setIsChangingPreviewOption, 42375 activeOption: field.id 42376 } 42377 ) 42378 ] 42379 } 42380 ) 42381 ] 42382 } 42383 ) }); 42384 } 42385 function RegularFieldItem({ 42386 index, 42387 field, 42388 view, 42389 onChangeView 42390 }) { 42391 const visibleFieldIds = view.fields ?? []; 42392 const isVisible = index !== void 0 && visibleFieldIds.includes(field.id); 42393 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42394 FieldItem, 42395 { 42396 field, 42397 isVisible, 42398 isFirst: index !== void 0 && index < 1, 42399 isLast: index !== void 0 && index === visibleFieldIds.length - 1, 42400 onToggleVisibility: () => { 42401 onChangeView({ 42402 ...view, 42403 fields: isVisible ? visibleFieldIds.filter( 42404 (fieldId) => fieldId !== field.id 42405 ) : [...visibleFieldIds, field.id] 42406 }); 42407 }, 42408 onMoveUp: index !== void 0 ? () => { 42409 onChangeView({ 42410 ...view, 42411 fields: [ 42412 ...visibleFieldIds.slice( 42413 0, 42414 index - 1 42415 ) ?? [], 42416 field.id, 42417 visibleFieldIds[index - 1], 42418 ...visibleFieldIds.slice(index + 1) 42419 ] 42420 }); 42421 } : void 0, 42422 onMoveDown: index !== void 0 ? () => { 42423 onChangeView({ 42424 ...view, 42425 fields: [ 42426 ...visibleFieldIds.slice(0, index) ?? [], 42427 visibleFieldIds[index + 1], 42428 field.id, 42429 ...visibleFieldIds.slice(index + 2) 42430 ] 42431 }); 42432 } : void 0 42433 } 42434 ); 42435 } 42436 function dataviews_view_config_isDefined(item) { 42437 return !!item; 42438 } 42439 function FieldControl() { 42440 const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default); 42441 const togglableFields = [ 42442 view?.titleField, 42443 view?.mediaField, 42444 view?.descriptionField 42445 ].filter(Boolean); 42446 const visibleFieldIds = view.fields ?? []; 42447 const hiddenFields = fields.filter( 42448 (f) => !visibleFieldIds.includes(f.id) && !togglableFields.includes(f.id) && f.type !== "media" && f.enableHiding !== false 42449 ); 42450 let visibleFields = visibleFieldIds.map((fieldId) => fields.find((f) => f.id === fieldId)).filter(dataviews_view_config_isDefined); 42451 if (!visibleFields?.length && !hiddenFields?.length) { 42452 return null; 42453 } 42454 const titleField = fields.find((f) => f.id === view.titleField); 42455 const previewField = fields.find((f) => f.id === view.mediaField); 42456 const descriptionField = fields.find( 42457 (f) => f.id === view.descriptionField 42458 ); 42459 const previewFields = fields.filter((f) => f.type === "media"); 42460 let previewFieldUI; 42461 if (previewFields.length > 1) { 42462 const isPreviewFieldVisible = dataviews_view_config_isDefined(previewField) && (view.showMedia ?? true); 42463 previewFieldUI = dataviews_view_config_isDefined(previewField) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42464 FieldItem, 42465 { 42466 field: previewField, 42467 label: (0,external_wp_i18n_namespaceObject.__)("Preview"), 42468 description: previewField.label, 42469 isVisible: isPreviewFieldVisible, 42470 onToggleVisibility: () => { 42471 onChangeView({ 42472 ...view, 42473 showMedia: !isPreviewFieldVisible 42474 }); 42475 }, 42476 canMove: false, 42477 previewOptions: previewFields.map((field) => ({ 42478 label: field.label, 42479 id: field.id 42480 })), 42481 onChangePreviewOption: (newPreviewId) => onChangeView({ ...view, mediaField: newPreviewId }) 42482 }, 42483 previewField.id 42484 ); 42485 } 42486 const lockedFields = [ 42487 { 42488 field: titleField, 42489 isVisibleFlag: "showTitle" 42490 }, 42491 { 42492 field: previewField, 42493 isVisibleFlag: "showMedia", 42494 ui: previewFieldUI 42495 }, 42496 { 42497 field: descriptionField, 42498 isVisibleFlag: "showDescription" 42499 } 42500 ].filter(({ field }) => dataviews_view_config_isDefined(field)); 42501 let visibleLockedFields = lockedFields.filter( 42502 ({ field, isVisibleFlag }) => ( 42503 // @ts-expect-error 42504 dataviews_view_config_isDefined(field) && (view[isVisibleFlag] ?? true) 42505 ) 42506 ); 42507 if (visibleLockedFields.length === 1) { 42508 visibleLockedFields = visibleLockedFields.map((locked) => ({ 42509 ...locked, 42510 field: { ...locked.field, enableHiding: false } 42511 })); 42512 } 42513 if (visibleLockedFields.length === 0 && visibleFields.length === 1) { 42514 visibleFields = [{ ...visibleFields[0], enableHiding: false }]; 42515 } 42516 const hiddenLockedFields = lockedFields.filter( 42517 ({ field, isVisibleFlag }) => ( 42518 // @ts-expect-error 42519 dataviews_view_config_isDefined(field) && !(view[isVisibleFlag] ?? true) 42520 ) 42521 ); 42522 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-field-control", spacing: 6, children: [ 42523 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config__properties", spacing: 0, children: (visibleLockedFields.length > 0 || !!visibleFields?.length) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [ 42524 visibleLockedFields.map( 42525 ({ field, isVisibleFlag, ui }) => { 42526 return ui ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42527 FieldItem, 42528 { 42529 field, 42530 isVisible: true, 42531 onToggleVisibility: () => { 42532 onChangeView({ 42533 ...view, 42534 [isVisibleFlag]: false 42535 }); 42536 }, 42537 canMove: false 42538 }, 42539 field.id 42540 ); 42541 } 42542 ), 42543 visibleFields.map((field, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42544 RegularFieldItem, 42545 { 42546 field, 42547 view, 42548 onChangeView, 42549 index 42550 }, 42551 field.id 42552 )) 42553 ] }) }), 42554 (!!hiddenFields?.length || !!hiddenLockedFields.length) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 42555 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { style: { margin: 0 }, children: (0,external_wp_i18n_namespaceObject.__)("Hidden") }), 42556 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42557 external_wp_components_namespaceObject.__experimentalVStack, 42558 { 42559 className: "dataviews-view-config__properties", 42560 spacing: 0, 42561 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [ 42562 hiddenLockedFields.length > 0 && hiddenLockedFields.map( 42563 ({ field, isVisibleFlag, ui }) => { 42564 return ui ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42565 FieldItem, 42566 { 42567 field, 42568 isVisible: false, 42569 onToggleVisibility: () => { 42570 onChangeView({ 42571 ...view, 42572 [isVisibleFlag]: true 42573 }); 42574 }, 42575 canMove: false 42576 }, 42577 field.id 42578 ); 42579 } 42580 ), 42581 hiddenFields.map((field) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42582 RegularFieldItem, 42583 { 42584 field, 42585 view, 42586 onChangeView 42587 }, 42588 field.id 42589 )) 42590 ] }) 42591 } 42592 ) 42593 ] }) 42594 ] }); 42595 } 42596 function SettingsSection({ 42597 title, 42598 description, 42599 children 42600 }) { 42601 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 12, className: "dataviews-settings-section", gap: 4, children: [ 42602 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-settings-section__sidebar", children: [ 42603 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42604 external_wp_components_namespaceObject.__experimentalHeading, 42605 { 42606 level: 2, 42607 className: "dataviews-settings-section__title", 42608 children: title 42609 } 42610 ), 42611 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42612 external_wp_components_namespaceObject.__experimentalText, 42613 { 42614 variant: "muted", 42615 className: "dataviews-settings-section__description", 42616 children: description 42617 } 42618 ) 42619 ] }), 42620 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42621 external_wp_components_namespaceObject.__experimentalGrid, 42622 { 42623 columns: 8, 42624 gap: 4, 42625 className: "dataviews-settings-section__content", 42626 children 42627 } 42628 ) 42629 ] }); 42630 } 42631 function DataviewsViewConfigDropdown() { 42632 const { view } = (0,external_wp_element_.useContext)(dataviews_context_default); 42633 const popoverId = (0,external_wp_compose_namespaceObject.useInstanceId)( 42634 _DataViewsViewConfig, 42635 "dataviews-view-config-dropdown" 42636 ); 42637 const activeLayout = VIEW_LAYOUTS.find( 42638 (layout) => layout.type === view.type 42639 ); 42640 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42641 external_wp_components_namespaceObject.Dropdown, 42642 { 42643 expandOnMobile: true, 42644 popoverProps: { 42645 ...DATAVIEWS_CONFIG_POPOVER_PROPS, 42646 id: popoverId 42647 }, 42648 renderToggle: ({ onToggle, isOpen }) => { 42649 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42650 external_wp_components_namespaceObject.Button, 42651 { 42652 size: "compact", 42653 icon: cog_default, 42654 label: (0,external_wp_i18n_namespaceObject._x)("View options", "View is used as a noun"), 42655 onClick: onToggle, 42656 "aria-expanded": isOpen ? "true" : "false", 42657 "aria-controls": popoverId 42658 } 42659 ); 42660 }, 42661 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42662 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, 42663 { 42664 paddingSize: "medium", 42665 className: "dataviews-config__popover-content-wrapper", 42666 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config", spacing: 6, children: [ 42667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)("Appearance"), children: [ 42668 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: true, className: "is-divided-in-two", children: [ 42669 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}), 42670 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {}) 42671 ] }), 42672 !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(activeLayout.viewConfigOptions, {}), 42673 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InfiniteScrollToggle, {}), 42674 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {}) 42675 ] }), 42676 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)("Properties"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) }) 42677 ] }) 42678 } 42679 ) 42680 } 42681 ); 42682 } 42683 function _DataViewsViewConfig() { 42684 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 42685 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, {}), 42686 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigDropdown, {}) 42687 ] }); 42688 } 42689 const DataViewsViewConfig = (0,external_wp_element_.memo)(_DataViewsViewConfig); 42690 var dataviews_view_config_default = DataViewsViewConfig; 42691 42692 42693 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js 42694 42695 42696 42697 42698 42699 42700 42701 42702 42703 42704 42705 42706 42707 42708 const defaultGetItemId = (item) => item.id; 42709 const defaultIsItemClickable = () => true; 42710 const dataviews_EMPTY_ARRAY = []; 42711 const dataViewsLayouts = VIEW_LAYOUTS.filter( 42712 (viewLayout) => !viewLayout.isPicker 42713 ); 42714 function DefaultUI({ 42715 header, 42716 search = true, 42717 searchLabel = void 0 42718 }) { 42719 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 42720 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42721 external_wp_components_namespaceObject.__experimentalHStack, 42722 { 42723 alignment: "top", 42724 justify: "space-between", 42725 className: "dataviews__view-actions", 42726 spacing: 1, 42727 children: [ 42728 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42729 external_wp_components_namespaceObject.__experimentalHStack, 42730 { 42731 justify: "start", 42732 expanded: false, 42733 className: "dataviews__search", 42734 children: [ 42735 search && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search_default, { label: searchLabel }), 42736 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_default, {}) 42737 ] 42738 } 42739 ), 42740 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42741 external_wp_components_namespaceObject.__experimentalHStack, 42742 { 42743 spacing: 1, 42744 expanded: false, 42745 style: { flexShrink: 0 }, 42746 children: [ 42747 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_default, {}), 42748 header 42749 ] 42750 } 42751 ) 42752 ] 42753 } 42754 ), 42755 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }), 42756 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}), 42757 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {}) 42758 ] }); 42759 } 42760 function DataViews({ 42761 view, 42762 onChangeView, 42763 fields, 42764 search = true, 42765 searchLabel = void 0, 42766 actions = dataviews_EMPTY_ARRAY, 42767 data, 42768 getItemId = defaultGetItemId, 42769 getItemLevel, 42770 isLoading = false, 42771 paginationInfo, 42772 defaultLayouts: defaultLayoutsProperty, 42773 selection: selectionProperty, 42774 onChangeSelection, 42775 onClickItem, 42776 renderItemLink, 42777 isItemClickable = defaultIsItemClickable, 42778 header, 42779 children, 42780 config = { perPageSizes: [10, 20, 50, 100] }, 42781 empty 42782 }) { 42783 const { infiniteScrollHandler } = paginationInfo; 42784 const containerRef = (0,external_wp_element_.useRef)(null); 42785 const [containerWidth, setContainerWidth] = (0,external_wp_element_.useState)(0); 42786 const resizeObserverRef = (0,external_wp_compose_namespaceObject.useResizeObserver)( 42787 (resizeObserverEntries) => { 42788 setContainerWidth( 42789 resizeObserverEntries[0].borderBoxSize[0].inlineSize 42790 ); 42791 }, 42792 { box: "border-box" } 42793 ); 42794 const [selectionState, setSelectionState] = (0,external_wp_element_.useState)([]); 42795 const isUncontrolled = selectionProperty === void 0 || onChangeSelection === void 0; 42796 const selection = isUncontrolled ? selectionState : selectionProperty; 42797 const [openedFilter, setOpenedFilter] = (0,external_wp_element_.useState)(null); 42798 function setSelectionWithChange(value) { 42799 const newValue = typeof value === "function" ? value(selection) : value; 42800 if (isUncontrolled) { 42801 setSelectionState(newValue); 42802 } 42803 if (onChangeSelection) { 42804 onChangeSelection(newValue); 42805 } 42806 } 42807 const _fields = (0,external_wp_element_.useMemo)(() => normalizeFields(fields), [fields]); 42808 const _selection = (0,external_wp_element_.useMemo)(() => { 42809 return selection.filter( 42810 (id) => data.some((item) => getItemId(item) === id) 42811 ); 42812 }, [selection, data, getItemId]); 42813 const filters = use_filters_default(_fields, view); 42814 const hasPrimaryOrLockedFilters = (0,external_wp_element_.useMemo)( 42815 () => (filters || []).some( 42816 (filter) => filter.isPrimary || filter.isLocked 42817 ), 42818 [filters] 42819 ); 42820 const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_.useState)( 42821 hasPrimaryOrLockedFilters 42822 ); 42823 (0,external_wp_element_.useEffect)(() => { 42824 if (hasPrimaryOrLockedFilters && !isShowingFilter) { 42825 setIsShowingFilter(true); 42826 } 42827 }, [hasPrimaryOrLockedFilters, isShowingFilter]); 42828 (0,external_wp_element_.useEffect)(() => { 42829 if (!view.infiniteScrollEnabled || !containerRef.current) { 42830 return; 42831 } 42832 const handleScroll = (0,external_wp_compose_namespaceObject.throttle)((event) => { 42833 const target = event.target; 42834 const scrollTop = target.scrollTop; 42835 const scrollHeight = target.scrollHeight; 42836 const clientHeight = target.clientHeight; 42837 if (scrollTop + clientHeight >= scrollHeight - 100) { 42838 infiniteScrollHandler?.(); 42839 } 42840 }, 100); 42841 const container = containerRef.current; 42842 container.addEventListener("scroll", handleScroll); 42843 return () => { 42844 container.removeEventListener("scroll", handleScroll); 42845 handleScroll.cancel(); 42846 }; 42847 }, [infiniteScrollHandler, view.infiniteScrollEnabled]); 42848 const defaultLayouts = (0,external_wp_element_.useMemo)( 42849 () => Object.fromEntries( 42850 Object.entries(defaultLayoutsProperty).filter( 42851 ([layoutType]) => { 42852 return dataViewsLayouts.some( 42853 (viewLayout) => viewLayout.type === layoutType 42854 ); 42855 } 42856 ) 42857 ), 42858 [defaultLayoutsProperty] 42859 ); 42860 if (!defaultLayouts[view.type]) { 42861 return null; 42862 } 42863 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42864 dataviews_context_default.Provider, 42865 { 42866 value: { 42867 view, 42868 onChangeView, 42869 fields: _fields, 42870 actions, 42871 data, 42872 isLoading, 42873 paginationInfo, 42874 selection: _selection, 42875 onChangeSelection: setSelectionWithChange, 42876 openedFilter, 42877 setOpenedFilter, 42878 getItemId, 42879 getItemLevel, 42880 isItemClickable, 42881 onClickItem, 42882 renderItemLink, 42883 containerWidth, 42884 containerRef, 42885 resizeObserverRef, 42886 defaultLayouts, 42887 filters, 42888 isShowingFilter, 42889 setIsShowingFilter, 42890 config, 42891 empty, 42892 hasInfiniteScrollHandler: !!infiniteScrollHandler 42893 }, 42894 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-wrapper", ref: containerRef, children: children ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42895 DefaultUI, 42896 { 42897 header, 42898 search, 42899 searchLabel 42900 } 42901 ) }) 42902 } 42903 ); 42904 } 42905 const DataViewsSubComponents = DataViews; 42906 DataViewsSubComponents.BulkActionToolbar = BulkActionsFooter; 42907 DataViewsSubComponents.Filters = filters_default; 42908 DataViewsSubComponents.FiltersToggled = filters_toggled_default; 42909 DataViewsSubComponents.FiltersToggle = toggle_default; 42910 DataViewsSubComponents.Layout = DataViewsLayout; 42911 DataViewsSubComponents.LayoutSwitcher = ViewTypeMenu; 42912 DataViewsSubComponents.Pagination = dataviews_pagination_DataViewsPagination; 42913 DataViewsSubComponents.Search = dataviews_search_default; 42914 DataViewsSubComponents.ViewConfig = DataviewsViewConfigDropdown; 42915 DataViewsSubComponents.Footer = DataViewsFooter; 42916 var dataviews_default = DataViewsSubComponents; 42917 42918 42919 // EXTERNAL MODULE: ./node_modules/@wordpress/views/build-module/index.js + 4 modules 42920 var build_module = __webpack_require__(7951); 42921 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js 42922 42923 42924 42925 42926 42927 42928 function usePatternSettings() { 42929 const storedSettings = (0,external_wp_data_.useSelect)((select) => { 42930 const { getSettings } = unlock(select(store)); 42931 return getSettings(); 42932 }, []); 42933 const settingsBlockPatterns = storedSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0 42934 storedSettings.__experimentalBlockPatterns; 42935 const restBlockPatterns = (0,external_wp_data_.useSelect)( 42936 (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), 42937 [] 42938 ); 42939 const blockPatterns = (0,external_wp_element_.useMemo)( 42940 () => [ 42941 ...settingsBlockPatterns || [], 42942 ...restBlockPatterns || [] 42943 ].filter(filterOutDuplicatesByName), 42944 [settingsBlockPatterns, restBlockPatterns] 42945 ); 42946 const settings = (0,external_wp_element_.useMemo)(() => { 42947 const { __experimentalAdditionalBlockPatterns, ...restStoredSettings } = storedSettings; 42948 return { 42949 ...restStoredSettings, 42950 __experimentalBlockPatterns: blockPatterns, 42951 isPreviewMode: true 42952 }; 42953 }, [storedSettings, blockPatterns]); 42954 return settings; 42955 } 42956 42957 42958 ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 42959 42960 42961 var symbol_filled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); 42962 42963 42964 ;// ./node_modules/@wordpress/icons/build-module/library/upload.js 42965 42966 42967 var upload_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) }); 42968 42969 42970 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js 42971 42972 42973 42974 42975 42976 42977 42978 42979 42980 42981 42982 42983 42984 const { useHistory: add_new_pattern_useHistory, useLocation: add_new_pattern_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 42985 const { CreatePatternModal, useAddPatternCategory } = unlock( 42986 external_wp_patterns_namespaceObject.privateApis 42987 ); 42988 const { CreateTemplatePartModal } = unlock(external_wp_editor_namespaceObject.privateApis); 42989 function AddNewPattern() { 42990 const history = add_new_pattern_useHistory(); 42991 const location = add_new_pattern_useLocation(); 42992 const [showPatternModal, setShowPatternModal] = (0,external_wp_element_.useState)(false); 42993 const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_.useState)(false); 42994 const { createPatternFromFile } = unlock((0,external_wp_data_.useDispatch)(external_wp_patterns_namespaceObject.store)); 42995 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 42996 const patternUploadInputRef = (0,external_wp_element_.useRef)(); 42997 const { 42998 isBlockBasedTheme, 42999 addNewPatternLabel, 43000 addNewTemplatePartLabel, 43001 canCreatePattern, 43002 canCreateTemplatePart 43003 } = (0,external_wp_data_.useSelect)((select) => { 43004 const { getCurrentTheme, getPostType, canUser } = select(external_wp_coreData_namespaceObject.store); 43005 return { 43006 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 43007 addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, 43008 addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, 43009 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 43010 canCreatePattern: canUser("create", { 43011 kind: "postType", 43012 name: PATTERN_TYPES.user 43013 }), 43014 canCreateTemplatePart: canUser("create", { 43015 kind: "postType", 43016 name: TEMPLATE_PART_POST_TYPE 43017 }) 43018 }; 43019 }, []); 43020 function handleCreatePattern({ pattern }) { 43021 setShowPatternModal(false); 43022 history.navigate( 43023 `/$PATTERN_TYPES.user}/$pattern.id}?canvas=edit` 43024 ); 43025 } 43026 function handleCreateTemplatePart(templatePart) { 43027 setShowTemplatePartModal(false); 43028 history.navigate( 43029 `/$TEMPLATE_PART_POST_TYPE}/$templatePart.id}?canvas=edit` 43030 ); 43031 } 43032 function handleError() { 43033 setShowPatternModal(false); 43034 setShowTemplatePartModal(false); 43035 } 43036 const controls = []; 43037 if (canCreatePattern) { 43038 controls.push({ 43039 icon: symbol_default, 43040 onClick: () => setShowPatternModal(true), 43041 title: addNewPatternLabel 43042 }); 43043 } 43044 if (isBlockBasedTheme && canCreateTemplatePart) { 43045 controls.push({ 43046 icon: symbol_filled_default, 43047 onClick: () => setShowTemplatePartModal(true), 43048 title: addNewTemplatePartLabel 43049 }); 43050 } 43051 if (canCreatePattern) { 43052 controls.push({ 43053 icon: upload_default, 43054 onClick: () => { 43055 patternUploadInputRef.current.click(); 43056 }, 43057 title: (0,external_wp_i18n_namespaceObject.__)("Import pattern from JSON") 43058 }); 43059 } 43060 const { categoryMap, findOrCreateTerm } = useAddPatternCategory(); 43061 if (controls.length === 0) { 43062 return null; 43063 } 43064 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43065 addNewPatternLabel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43066 external_wp_components_namespaceObject.DropdownMenu, 43067 { 43068 controls, 43069 icon: null, 43070 toggleProps: { 43071 variant: "primary", 43072 showTooltip: false, 43073 __next40pxDefaultSize: true 43074 }, 43075 text: addNewPatternLabel, 43076 label: addNewPatternLabel 43077 } 43078 ), 43079 showPatternModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43080 CreatePatternModal, 43081 { 43082 onClose: () => setShowPatternModal(false), 43083 onSuccess: handleCreatePattern, 43084 onError: handleError 43085 } 43086 ), 43087 showTemplatePartModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43088 CreateTemplatePartModal, 43089 { 43090 closeModal: () => setShowTemplatePartModal(false), 43091 blocks: [], 43092 onCreate: handleCreateTemplatePart, 43093 onError: handleError 43094 } 43095 ), 43096 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43097 "input", 43098 { 43099 type: "file", 43100 accept: ".json", 43101 hidden: true, 43102 ref: patternUploadInputRef, 43103 onChange: async (event) => { 43104 const file = event.target.files?.[0]; 43105 if (!file) { 43106 return; 43107 } 43108 try { 43109 let currentCategoryId; 43110 if (location.query.postType !== TEMPLATE_PART_POST_TYPE) { 43111 const currentCategory = Array.from( 43112 categoryMap.values() 43113 ).find( 43114 (term) => term.name === location.query.categoryId 43115 ); 43116 if (currentCategory) { 43117 currentCategoryId = currentCategory.id || await findOrCreateTerm( 43118 currentCategory.label 43119 ); 43120 } 43121 } 43122 const pattern = await createPatternFromFile( 43123 file, 43124 currentCategoryId ? [currentCategoryId] : void 0 43125 ); 43126 if (!currentCategoryId && location.query.categoryId !== "my-patterns") { 43127 history.navigate( 43128 `/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}` 43129 ); 43130 } 43131 createSuccessNotice( 43132 (0,external_wp_i18n_namespaceObject.sprintf)( 43133 // translators: %s: The imported pattern's title. 43134 (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), 43135 pattern.title.raw 43136 ), 43137 { 43138 type: "snackbar", 43139 id: "import-pattern-success" 43140 } 43141 ); 43142 } catch (err) { 43143 createErrorNotice(err.message, { 43144 type: "snackbar", 43145 id: "import-pattern-error" 43146 }); 43147 } finally { 43148 event.target.value = ""; 43149 } 43150 } 43151 } 43152 ) 43153 ] }); 43154 } 43155 43156 43157 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js 43158 43159 43160 43161 43162 43163 43164 43165 const { RenamePatternCategoryModal } = unlock(external_wp_patterns_namespaceObject.privateApis); 43166 function RenameCategoryMenuItem({ category, onClose }) { 43167 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false); 43168 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43169 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)("Rename") }), 43170 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43171 rename_category_menu_item_RenameModal, 43172 { 43173 category, 43174 onClose: () => { 43175 setIsModalOpen(false); 43176 onClose(); 43177 } 43178 } 43179 ) 43180 ] }); 43181 } 43182 function rename_category_menu_item_RenameModal({ category, onClose }) { 43183 const normalizedCategory = { 43184 id: category.id, 43185 slug: category.slug, 43186 name: category.label 43187 }; 43188 const existingCategories = usePatternCategories(); 43189 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43190 RenamePatternCategoryModal, 43191 { 43192 category: normalizedCategory, 43193 existingCategories, 43194 onClose, 43195 overlayClassName: "edit-site-list__rename-modal", 43196 focusOnMount: "firstContentElement", 43197 size: "small" 43198 } 43199 ); 43200 } 43201 43202 43203 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js 43204 43205 43206 43207 43208 43209 43210 43211 43212 43213 43214 43215 const { useHistory: delete_category_menu_item_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 43216 function DeleteCategoryMenuItem({ category, onClose }) { 43217 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false); 43218 const history = delete_category_menu_item_useHistory(); 43219 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 43220 const { deleteEntityRecord, invalidateResolution } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 43221 const onDelete = async () => { 43222 try { 43223 await deleteEntityRecord( 43224 "taxonomy", 43225 "wp_pattern_category", 43226 category.id, 43227 { force: true }, 43228 { throwOnError: true } 43229 ); 43230 invalidateResolution("getUserPatternCategories"); 43231 invalidateResolution("getEntityRecords", [ 43232 "postType", 43233 PATTERN_TYPES.user, 43234 { per_page: -1 } 43235 ]); 43236 createSuccessNotice( 43237 (0,external_wp_i18n_namespaceObject.sprintf)( 43238 /* translators: %s: The pattern category's name */ 43239 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', "pattern category"), 43240 category.label 43241 ), 43242 { type: "snackbar", id: "pattern-category-delete" } 43243 ); 43244 onClose?.(); 43245 history.navigate( 43246 `/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}` 43247 ); 43248 } catch (error) { 43249 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)( 43250 "An error occurred while deleting the pattern category." 43251 ); 43252 createErrorNotice(errorMessage, { 43253 type: "snackbar", 43254 id: "pattern-category-delete" 43255 }); 43256 } 43257 }; 43258 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43259 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { isDestructive: true, onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)("Delete") }), 43260 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43261 external_wp_components_namespaceObject.__experimentalConfirmDialog, 43262 { 43263 isOpen: isModalOpen, 43264 onConfirm: onDelete, 43265 onCancel: () => setIsModalOpen(false), 43266 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), 43267 className: "edit-site-patterns__delete-modal", 43268 title: (0,external_wp_i18n_namespaceObject.sprintf)( 43269 // translators: %s: The pattern category's name. 43270 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', "pattern category"), 43271 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label) 43272 ), 43273 size: "medium", 43274 __experimentalHideHeader: false, 43275 children: (0,external_wp_i18n_namespaceObject.sprintf)( 43276 // translators: %s: The pattern category's name. 43277 (0,external_wp_i18n_namespaceObject.__)( 43278 'Are you sure you want to delete the category "%s"? The patterns will not be deleted.' 43279 ), 43280 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label) 43281 ) 43282 } 43283 ) 43284 ] }); 43285 } 43286 43287 43288 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/actions.js 43289 43290 43291 43292 43293 43294 43295 43296 43297 43298 function PatternsActions({ categoryId, type }) { 43299 const { patternCategories } = usePatternCategories(); 43300 let patternCategory; 43301 if (type === PATTERN_TYPES.user && !!categoryId) { 43302 patternCategory = patternCategories.find( 43303 (category) => category.name === categoryId 43304 ); 43305 } 43306 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43307 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}), 43308 !!patternCategory?.id && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43309 external_wp_components_namespaceObject.DropdownMenu, 43310 { 43311 icon: more_vertical_default, 43312 label: (0,external_wp_i18n_namespaceObject.__)("Actions"), 43313 toggleProps: { 43314 className: "edit-site-patterns__button", 43315 size: "compact" 43316 }, 43317 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 43318 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43319 RenameCategoryMenuItem, 43320 { 43321 category: patternCategory, 43322 onClose 43323 } 43324 ), 43325 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43326 DeleteCategoryMenuItem, 43327 { 43328 category: patternCategory, 43329 onClose 43330 } 43331 ) 43332 ] }) 43333 } 43334 ) 43335 ] }); 43336 } 43337 43338 43339 ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js 43340 43341 43342 var pencil_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); 43343 43344 43345 ;// ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js 43346 43347 43348 43349 43350 43351 43352 43353 43354 const { useHistory: dataviews_actions_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 43355 const useSetActiveTemplateAction = () => { 43356 const activeTheme = (0,external_wp_data_.useSelect)( 43357 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme() 43358 ); 43359 const { getEntityRecord } = (0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store); 43360 const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 43361 return (0,external_wp_element_.useMemo)( 43362 () => ({ 43363 id: "set-active-template", 43364 label(items) { 43365 return items.some((item) => item._isActive) ? (0,external_wp_i18n_namespaceObject.__)("Deactivate") : (0,external_wp_i18n_namespaceObject.__)("Activate"); 43366 }, 43367 isPrimary: true, 43368 icon: pencil_default, 43369 isEligible(item) { 43370 return !item._isCustom && !(item.slug === "index" && item.source === "theme") && item.theme === activeTheme.stylesheet; 43371 }, 43372 async callback(items) { 43373 const deactivate = items.some((item) => item._isActive); 43374 const activeTemplates = { 43375 ...await getEntityRecord("root", "site").active_templates ?? {} 43376 }; 43377 for (const item of items) { 43378 if (deactivate) { 43379 if (item.source === "theme") { 43380 activeTemplates[item.slug] = false; 43381 } else { 43382 delete activeTemplates[item.slug]; 43383 } 43384 } else { 43385 activeTemplates[item.slug] = item.id; 43386 } 43387 } 43388 await editEntityRecord("root", "site", void 0, { 43389 active_templates: activeTemplates 43390 }); 43391 await saveEditedEntityRecord("root", "site"); 43392 } 43393 }), 43394 [ 43395 editEntityRecord, 43396 saveEditedEntityRecord, 43397 getEntityRecord, 43398 activeTheme 43399 ] 43400 ); 43401 }; 43402 const useEditPostAction = () => { 43403 const history = dataviews_actions_useHistory(); 43404 return (0,external_wp_element_.useMemo)( 43405 () => ({ 43406 id: "edit-post", 43407 label: (0,external_wp_i18n_namespaceObject.__)("Edit"), 43408 isPrimary: true, 43409 icon: pencil_default, 43410 isEligible(post) { 43411 if (post.status === "trash") { 43412 return false; 43413 } 43414 return post.type !== PATTERN_TYPES.theme; 43415 }, 43416 callback(items) { 43417 const post = items[0]; 43418 history.navigate(`/$post.type}/$post.id}?canvas=edit`); 43419 } 43420 }), 43421 [history] 43422 ); 43423 }; 43424 43425 43426 ;// ./node_modules/@wordpress/icons/build-module/library/plugins.js 43427 43428 43429 var plugins_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) }); 43430 43431 43432 ;// ./node_modules/@wordpress/icons/build-module/library/globe.js 43433 43434 43435 var globe_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm6.5 8c0 .6 0 1.2-.2 1.8h-2.7c0-.6.2-1.1.2-1.8s0-1.2-.2-1.8h2.7c.2.6.2 1.1.2 1.8Zm-.9-3.2h-2.4c-.3-.9-.7-1.8-1.1-2.4-.1-.2-.2-.4-.3-.5 1.6.5 3 1.6 3.8 3ZM12.8 17c-.3.5-.6 1-.8 1.3-.2-.3-.5-.8-.8-1.3-.3-.5-.6-1.1-.8-1.7h3.3c-.2.6-.5 1.2-.8 1.7Zm-2.9-3.2c-.1-.6-.2-1.1-.2-1.8s0-1.2.2-1.8H14c.1.6.2 1.1.2 1.8s0 1.2-.2 1.8H9.9ZM11.2 7c.3-.5.6-1 .8-1.3.2.3.5.8.8 1.3.3.5.6 1.1.8 1.7h-3.3c.2-.6.5-1.2.8-1.7Zm-1-1.2c-.1.2-.2.3-.3.5-.4.7-.8 1.5-1.1 2.4H6.4c.8-1.4 2.2-2.5 3.8-3Zm-1.8 8H5.7c-.2-.6-.2-1.1-.2-1.8s0-1.2.2-1.8h2.7c0 .6-.2 1.1-.2 1.8s0 1.2.2 1.8Zm-2 1.4h2.4c.3.9.7 1.8 1.1 2.4.1.2.2.4.3.5-1.6-.5-3-1.6-3.8-3Zm7.4 3c.1-.2.2-.3.3-.5.4-.7.8-1.5 1.1-2.4h2.4c-.8 1.4-2.2 2.5-3.8 3Z" }) }); 43436 43437 43438 ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 43439 43440 43441 var comment_author_avatar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43442 external_wp_primitives_namespaceObject.Path, 43443 { 43444 fillRule: "evenodd", 43445 d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", 43446 clipRule: "evenodd" 43447 } 43448 ) }); 43449 43450 43451 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js 43452 43453 43454 43455 43456 function useAddedBy(postType, postId) { 43457 return (0,external_wp_data_.useSelect)( 43458 (select) => { 43459 const { getEntityRecord, getUser, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 43460 const template = getEditedEntityRecord( 43461 "postType", 43462 postType, 43463 postId 43464 ); 43465 const originalSource = template?.original_source; 43466 const authorText = template?.author_text; 43467 switch (originalSource) { 43468 case "theme": { 43469 return { 43470 type: originalSource, 43471 icon: layout_default, 43472 text: authorText, 43473 isCustomized: template.source === TEMPLATE_ORIGINS.custom 43474 }; 43475 } 43476 case "plugin": { 43477 return { 43478 type: originalSource, 43479 icon: plugins_default, 43480 text: authorText, 43481 isCustomized: template.source === TEMPLATE_ORIGINS.custom 43482 }; 43483 } 43484 case "site": { 43485 const siteData = getEntityRecord( 43486 "root", 43487 "__unstableBase" 43488 ); 43489 return { 43490 type: originalSource, 43491 icon: globe_default, 43492 imageUrl: siteData?.site_logo ? getEntityRecord( 43493 "postType", 43494 "attachment", 43495 siteData.site_logo 43496 )?.source_url : void 0, 43497 text: authorText, 43498 isCustomized: false 43499 }; 43500 } 43501 default: { 43502 const user = getUser(template.author); 43503 return { 43504 type: "user", 43505 icon: comment_author_avatar_default, 43506 imageUrl: user?.avatar_urls?.[48], 43507 text: authorText ?? user?.name, 43508 isCustomized: false 43509 }; 43510 } 43511 } 43512 }, 43513 [postType, postId] 43514 ); 43515 } 43516 43517 43518 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js 43519 43520 43521 43522 43523 43524 43525 43526 43527 43528 43529 43530 const { useGlobalStyle: fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 43531 function PreviewField({ item }) { 43532 const descriptionId = (0,external_wp_element_.useId)(); 43533 const description = item.description || item?.excerpt?.raw; 43534 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; 43535 const [backgroundColor] = fields_useGlobalStyle("color.background"); 43536 const blocks = (0,external_wp_element_.useMemo)(() => { 43537 return item.blocks ?? (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, { 43538 __unstableSkipMigrationLogs: true 43539 }); 43540 }, [item?.content?.raw, item.blocks]); 43541 const isEmpty = !blocks?.length; 43542 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 43543 "div", 43544 { 43545 className: "page-patterns-preview-field", 43546 style: { backgroundColor }, 43547 "aria-describedby": !!description ? descriptionId : void 0, 43548 children: [ 43549 isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)("Empty template part"), 43550 isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)("Empty pattern"), 43551 !isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43552 external_wp_blockEditor_namespaceObject.BlockPreview, 43553 { 43554 blocks, 43555 viewportWidth: item.viewportWidth 43556 } 43557 ) }), 43558 !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: descriptionId, children: description }) 43559 ] 43560 } 43561 ); 43562 } 43563 const previewField = { 43564 label: (0,external_wp_i18n_namespaceObject.__)("Preview"), 43565 id: "preview", 43566 render: PreviewField, 43567 enableSorting: false 43568 }; 43569 const SYNC_FILTERS = [ 43570 { 43571 value: PATTERN_SYNC_TYPES.full, 43572 label: (0,external_wp_i18n_namespaceObject._x)("Synced", "pattern (singular)"), 43573 description: (0,external_wp_i18n_namespaceObject.__)("Patterns that are kept in sync across the site.") 43574 }, 43575 { 43576 value: PATTERN_SYNC_TYPES.unsynced, 43577 label: (0,external_wp_i18n_namespaceObject._x)("Not synced", "pattern (singular)"), 43578 description: (0,external_wp_i18n_namespaceObject.__)( 43579 "Patterns that can be changed freely without affecting the site." 43580 ) 43581 } 43582 ]; 43583 const patternStatusField = { 43584 label: (0,external_wp_i18n_namespaceObject.__)("Sync status"), 43585 id: "sync-status", 43586 render: ({ item }) => { 43587 const syncStatus = "wp_pattern_sync_status" in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced; 43588 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43589 "span", 43590 { 43591 className: `edit-site-patterns__field-sync-status-$syncStatus}`, 43592 children: SYNC_FILTERS.find(({ value }) => value === syncStatus).label 43593 } 43594 ); 43595 }, 43596 elements: SYNC_FILTERS, 43597 filterBy: { 43598 operators: [OPERATOR_IS], 43599 isPrimary: true 43600 }, 43601 enableSorting: false 43602 }; 43603 function AuthorField({ item }) { 43604 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_.useState)(false); 43605 const { text, icon, imageUrl } = useAddedBy(item.type, item.id); 43606 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 43607 imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43608 "div", 43609 { 43610 className: dist_clsx("page-templates-author-field__avatar", { 43611 "is-loaded": isImageLoaded 43612 }), 43613 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43614 "img", 43615 { 43616 onLoad: () => setIsImageLoaded(true), 43617 alt: "", 43618 src: imageUrl 43619 } 43620 ) 43621 } 43622 ), 43623 !imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon }) }), 43624 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text }) 43625 ] }); 43626 } 43627 const templatePartAuthorField = { 43628 label: (0,external_wp_i18n_namespaceObject.__)("Author"), 43629 id: "author", 43630 getValue: ({ item }) => item.author_text, 43631 render: AuthorField, 43632 filterBy: { 43633 isPrimary: true 43634 } 43635 }; 43636 43637 43638 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js 43639 43640 43641 43642 43643 43644 43645 43646 43647 43648 43649 43650 43651 43652 43653 43654 43655 43656 43657 43658 43659 43660 const { ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 43661 const { usePostActions, patternTitleField } = unlock(external_wp_editor_namespaceObject.privateApis); 43662 const { useLocation: page_patterns_useLocation, useHistory: page_patterns_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 43663 const page_patterns_EMPTY_ARRAY = []; 43664 const defaultLayouts = { 43665 [LAYOUT_TABLE]: { 43666 layout: { 43667 styles: { 43668 author: { 43669 width: "1%" 43670 } 43671 } 43672 } 43673 }, 43674 [LAYOUT_GRID]: { 43675 layout: { 43676 badgeFields: ["sync-status"] 43677 } 43678 } 43679 }; 43680 const DEFAULT_VIEW = { 43681 type: LAYOUT_GRID, 43682 perPage: 20, 43683 titleField: "title", 43684 mediaField: "preview", 43685 fields: ["sync-status"], 43686 filters: [], 43687 ...defaultLayouts[LAYOUT_GRID] 43688 }; 43689 function usePagePatternsHeader(type, categoryId) { 43690 const { patternCategories } = usePatternCategories(); 43691 const templatePartAreas = (0,external_wp_data_.useSelect)( 43692 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [], 43693 [] 43694 ); 43695 let title, description, patternCategory; 43696 if (type === TEMPLATE_PART_POST_TYPE) { 43697 const templatePartArea = templatePartAreas.find( 43698 (area) => area.area === categoryId 43699 ); 43700 title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)("All Template Parts"); 43701 description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)("Includes every template part defined for any area."); 43702 } else if (type === PATTERN_TYPES.user && !!categoryId) { 43703 patternCategory = patternCategories.find( 43704 (category) => category.name === categoryId 43705 ); 43706 title = patternCategory?.label; 43707 description = patternCategory?.description; 43708 } 43709 return { title, description }; 43710 } 43711 function DataviewsPatterns() { 43712 const { path, query } = page_patterns_useLocation(); 43713 const { postType = "wp_block", categoryId: categoryIdFromURL } = query; 43714 const history = page_patterns_useHistory(); 43715 const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY; 43716 const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({ 43717 kind: "postType", 43718 name: postType, 43719 slug: categoryId, 43720 defaultView: DEFAULT_VIEW, 43721 queryParams: { 43722 page: Number(query.pageNumber ?? 1), 43723 search: query.search 43724 }, 43725 onChangeQueryParams: (params) => { 43726 history.navigate( 43727 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 43728 ...query, 43729 pageNumber: params.page, 43730 search: params.search 43731 }) 43732 ); 43733 } 43734 }); 43735 const viewSyncStatus = view.filters?.find( 43736 ({ field }) => field === "sync-status" 43737 )?.value; 43738 const { patterns, isResolving } = use_patterns_default(postType, categoryId, { 43739 search: view.search, 43740 syncStatus: viewSyncStatus 43741 }); 43742 const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", TEMPLATE_PART_POST_TYPE, { 43743 per_page: -1 43744 }); 43745 const authors = (0,external_wp_element_.useMemo)(() => { 43746 if (!records) { 43747 return page_patterns_EMPTY_ARRAY; 43748 } 43749 const authorsSet = /* @__PURE__ */ new Set(); 43750 records.forEach((template) => { 43751 authorsSet.add(template.author_text); 43752 }); 43753 return Array.from(authorsSet).map((author) => ({ 43754 value: author, 43755 label: author 43756 })); 43757 }, [records]); 43758 const fields = (0,external_wp_element_.useMemo)(() => { 43759 const _fields = [previewField, patternTitleField]; 43760 if (postType === PATTERN_TYPES.user) { 43761 _fields.push(patternStatusField); 43762 } else if (postType === TEMPLATE_PART_POST_TYPE) { 43763 _fields.push({ 43764 ...templatePartAuthorField, 43765 elements: authors 43766 }); 43767 } 43768 return _fields; 43769 }, [postType, authors]); 43770 const { data, paginationInfo } = (0,external_wp_element_.useMemo)(() => { 43771 const viewWithoutFilters = { ...view }; 43772 delete viewWithoutFilters.search; 43773 if (postType !== TEMPLATE_PART_POST_TYPE) { 43774 viewWithoutFilters.filters = []; 43775 } 43776 return filterSortAndPaginate(patterns, viewWithoutFilters, fields); 43777 }, [patterns, view, fields, postType]); 43778 const dataWithPermissions = useAugmentPatternsWithPermissions(data); 43779 const templatePartActions = usePostActions({ 43780 postType: TEMPLATE_PART_POST_TYPE, 43781 context: "list" 43782 }); 43783 const patternActions = usePostActions({ 43784 postType: PATTERN_TYPES.user, 43785 context: "list" 43786 }); 43787 const editAction = useEditPostAction(); 43788 const actions = (0,external_wp_element_.useMemo)(() => { 43789 if (postType === TEMPLATE_PART_POST_TYPE) { 43790 return [editAction, ...templatePartActions].filter(Boolean); 43791 } 43792 return [editAction, ...patternActions].filter(Boolean); 43793 }, [editAction, postType, templatePartActions, patternActions]); 43794 const settings = usePatternSettings(); 43795 const { title, description } = usePagePatternsHeader( 43796 postType, 43797 categoryId 43798 ); 43799 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43800 page_page_default, 43801 { 43802 className: "edit-site-page-patterns-dataviews", 43803 title, 43804 subTitle: description, 43805 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43806 isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43807 external_wp_components_namespaceObject.Button, 43808 { 43809 __next40pxDefaultSize: true, 43810 onClick: resetToDefault, 43811 children: (0,external_wp_i18n_namespaceObject.__)("Reset view") 43812 } 43813 ), 43814 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsActions, {}) 43815 ] }), 43816 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43817 dataviews_default, 43818 { 43819 paginationInfo, 43820 fields, 43821 actions, 43822 data: dataWithPermissions || page_patterns_EMPTY_ARRAY, 43823 getItemId: (item) => item.name ?? item.id, 43824 isLoading: isResolving, 43825 isItemClickable: (item) => item.type !== PATTERN_TYPES.theme, 43826 onClickItem: (item) => { 43827 history.navigate( 43828 `/$item.type}/${[ 43829 PATTERN_TYPES.user, 43830 TEMPLATE_PART_POST_TYPE 43831 ].includes(item.type) ? item.id : item.name}?canvas=edit` 43832 ); 43833 }, 43834 view, 43835 onChangeView: updateView, 43836 defaultLayouts 43837 }, 43838 categoryId + postType 43839 ) 43840 } 43841 ) }); 43842 } 43843 43844 43845 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/patterns.js 43846 43847 43848 43849 43850 const patternsRoute = { 43851 name: "patterns", 43852 path: "/pattern", 43853 areas: { 43854 sidebar({ siteData }) { 43855 const isBlockTheme = siteData.currentTheme?.is_block_theme; 43856 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0; 43857 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath }); 43858 }, 43859 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), 43860 mobile({ siteData, query }) { 43861 const { categoryId } = query; 43862 const isBlockTheme = siteData.currentTheme?.is_block_theme; 43863 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0; 43864 return !!categoryId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath }); 43865 } 43866 } 43867 }; 43868 43869 43870 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pattern-item.js 43871 43872 43873 43874 43875 const patternItemRoute = { 43876 name: "pattern-item", 43877 path: "/wp_block/:postId", 43878 areas: { 43879 sidebar({ siteData }) { 43880 const isBlockTheme = siteData.currentTheme?.is_block_theme; 43881 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0; 43882 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath }); 43883 }, 43884 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 43885 preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 43886 } 43887 }; 43888 43889 43890 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-part-item.js 43891 43892 43893 43894 const templatePartItemRoute = { 43895 name: "template-part-item", 43896 path: "/wp_template_part/*postId", 43897 areas: { 43898 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath: "/" }), 43899 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 43900 preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 43901 } 43902 }; 43903 43904 43905 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js 43906 43907 43908 43909 43910 43911 43912 43913 43914 43915 43916 43917 const { useLocation: content_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 43918 const content_EMPTY_ARRAY = []; 43919 function TemplateDataviewItem({ template, isActive }) { 43920 const { text, icon } = useAddedBy(template.type, template.id); 43921 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43922 SidebarNavigationItem, 43923 { 43924 to: (0,external_wp_url_namespaceObject.addQueryArgs)("/template", { activeView: text }), 43925 icon, 43926 "aria-current": isActive, 43927 children: text 43928 } 43929 ); 43930 } 43931 function DataviewsTemplatesSidebarContent() { 43932 const { 43933 query: { activeView = "active" } 43934 } = content_useLocation(); 43935 const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( 43936 "postType", 43937 "wp_registered_template", 43938 { 43939 per_page: -1 43940 } 43941 ); 43942 const firstItemPerAuthorText = (0,external_wp_element_.useMemo)(() => { 43943 const firstItemPerAuthor = records?.reduce((acc, template) => { 43944 const author = template.author_text; 43945 if (author && !acc[author]) { 43946 acc[author] = template; 43947 } 43948 return acc; 43949 }, {}); 43950 return (firstItemPerAuthor && Object.values(firstItemPerAuthor)) ?? content_EMPTY_ARRAY; 43951 }, [records]); 43952 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [ 43953 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43954 SidebarNavigationItem, 43955 { 43956 to: "/template", 43957 icon: layout_default, 43958 "aria-current": activeView === "active", 43959 children: (0,external_wp_i18n_namespaceObject.__)("Active templates") 43960 } 43961 ), 43962 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43963 SidebarNavigationItem, 43964 { 43965 to: (0,external_wp_url_namespaceObject.addQueryArgs)("/template", { activeView: "user" }), 43966 icon: layout_default, 43967 "aria-current": activeView === "user", 43968 // Let's avoid calling them "custom templates" to avoid 43969 // confusion. "Created" is closest to meaning database 43970 // templates, created by users. 43971 // https://developer.wordpress.org/themes/classic-themes/templates/page-template-files/#creating-custom-page-templates-for-global-use 43972 children: (0,external_wp_i18n_namespaceObject.__)("Created templates") 43973 } 43974 ), 43975 firstItemPerAuthorText.map((template) => { 43976 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43977 TemplateDataviewItem, 43978 { 43979 template, 43980 isActive: activeView === template.author_text 43981 }, 43982 template.author_text 43983 ); 43984 }) 43985 ] }); 43986 } 43987 43988 43989 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js 43990 43991 43992 43993 43994 function SidebarNavigationScreenTemplatesBrowse({ backPath }) { 43995 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43996 SidebarNavigationScreen, 43997 { 43998 title: (0,external_wp_i18n_namespaceObject.__)("Templates"), 43999 description: (0,external_wp_i18n_namespaceObject.__)( 44000 "Create new templates, or reset any customizations made to the templates supplied by your theme." 44001 ), 44002 backPath, 44003 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, {}) 44004 } 44005 ); 44006 } 44007 44008 44009 ;// ./node_modules/@wordpress/icons/build-module/library/home.js 44010 44011 44012 var home_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); 44013 44014 44015 ;// ./node_modules/@wordpress/icons/build-module/library/verse.js 44016 44017 44018 var verse_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); 44019 44020 44021 ;// ./node_modules/@wordpress/icons/build-module/library/pin.js 44022 44023 44024 var pin_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" }) }); 44025 44026 44027 ;// ./node_modules/@wordpress/icons/build-module/library/archive.js 44028 44029 44030 var archive_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44031 external_wp_primitives_namespaceObject.Path, 44032 { 44033 fillRule: "evenodd", 44034 clipRule: "evenodd", 44035 d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z" 44036 } 44037 ) }); 44038 44039 44040 ;// ./node_modules/@wordpress/icons/build-module/library/not-found.js 44041 44042 44043 var not_found_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z" }) }); 44044 44045 44046 ;// ./node_modules/@wordpress/icons/build-module/library/list.js 44047 44048 44049 var list_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" }) }); 44050 44051 44052 ;// ./node_modules/@wordpress/icons/build-module/library/block-meta.js 44053 44054 44055 var block_meta_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44056 external_wp_primitives_namespaceObject.Path, 44057 { 44058 fillRule: "evenodd", 44059 d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z", 44060 clipRule: "evenodd" 44061 } 44062 ) }); 44063 44064 44065 ;// ./node_modules/@wordpress/icons/build-module/library/calendar.js 44066 44067 44068 var calendar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" }) }); 44069 44070 44071 ;// ./node_modules/@wordpress/icons/build-module/library/tag.js 44072 44073 44074 var tag_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) }); 44075 44076 44077 ;// ./node_modules/@wordpress/icons/build-module/library/media.js 44078 44079 44080 var media_media_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 44081 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }), 44082 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44083 external_wp_primitives_namespaceObject.Path, 44084 { 44085 fillRule: "evenodd", 44086 clipRule: "evenodd", 44087 d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" 44088 } 44089 ) 44090 ] }); 44091 44092 44093 ;// ./node_modules/@wordpress/icons/build-module/library/post.js 44094 44095 44096 var post_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) }); 44097 44098 44099 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js 44100 44101 44102 44103 44104 44105 44106 44107 44108 const EMPTY_OBJECT = {}; 44109 const utils_getValueFromObjectPath = (object, path) => { 44110 let value = object; 44111 path.split(".").forEach((fieldName) => { 44112 value = value?.[fieldName]; 44113 }); 44114 return value; 44115 }; 44116 function prefixSlug(prefix, slug) { 44117 return `$prefix}-${(0,external_wp_url_namespaceObject.safeDecodeURI)(slug)}`; 44118 } 44119 const mapToIHasNameAndId = (entities, path) => { 44120 return (entities || []).map((entity) => ({ 44121 ...entity, 44122 name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path)) 44123 })); 44124 }; 44125 const useExistingTemplates = () => { 44126 return (0,external_wp_data_.useSelect)( 44127 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords( 44128 "postType", 44129 TEMPLATE_POST_TYPE, 44130 { 44131 per_page: -1 44132 } 44133 ), 44134 [] 44135 ); 44136 }; 44137 const useDefaultTemplateTypes = () => { 44138 return (0,external_wp_data_.useSelect)( 44139 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types || [], 44140 [] 44141 ); 44142 }; 44143 const usePublicPostTypes = () => { 44144 const postTypes = (0,external_wp_data_.useSelect)( 44145 (select) => select(external_wp_coreData_namespaceObject.store).getPostTypes({ per_page: -1 }), 44146 [] 44147 ); 44148 return (0,external_wp_element_.useMemo)(() => { 44149 const excludedPostTypes = ["attachment"]; 44150 return postTypes?.filter( 44151 ({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug) 44152 ).sort((a, b) => { 44153 if (a.slug === "post" || b.slug === "post") { 44154 return 0; 44155 } 44156 return a.name.localeCompare(b.name); 44157 }); 44158 }, [postTypes]); 44159 }; 44160 const usePublicTaxonomies = () => { 44161 const taxonomies = (0,external_wp_data_.useSelect)( 44162 (select) => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ per_page: -1 }), 44163 [] 44164 ); 44165 return (0,external_wp_element_.useMemo)(() => { 44166 return taxonomies?.filter( 44167 ({ visibility }) => visibility?.publicly_queryable 44168 ); 44169 }, [taxonomies]); 44170 }; 44171 function usePostTypeArchiveMenuItems() { 44172 const publicPostTypes = usePublicPostTypes(); 44173 const postTypesWithArchives = (0,external_wp_element_.useMemo)( 44174 () => publicPostTypes?.filter((postType) => postType.has_archive), 44175 [publicPostTypes] 44176 ); 44177 const existingTemplates = useExistingTemplates(); 44178 const postTypeLabels = (0,external_wp_element_.useMemo)( 44179 () => publicPostTypes?.reduce((accumulator, { labels }) => { 44180 const singularName = labels.singular_name.toLowerCase(); 44181 accumulator[singularName] = (accumulator[singularName] || 0) + 1; 44182 return accumulator; 44183 }, {}), 44184 [publicPostTypes] 44185 ); 44186 const needsUniqueIdentifier = (0,external_wp_element_.useCallback)( 44187 ({ labels, slug }) => { 44188 const singularName = labels.singular_name.toLowerCase(); 44189 return postTypeLabels[singularName] > 1 && singularName !== slug; 44190 }, 44191 [postTypeLabels] 44192 ); 44193 return (0,external_wp_element_.useMemo)( 44194 () => postTypesWithArchives?.filter( 44195 (postType) => !(existingTemplates || []).some( 44196 (existingTemplate) => existingTemplate.slug === "archive-" + postType.slug 44197 ) 44198 ).map((postType) => { 44199 let title; 44200 if (needsUniqueIdentifier(postType)) { 44201 title = (0,external_wp_i18n_namespaceObject.sprintf)( 44202 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 44203 (0,external_wp_i18n_namespaceObject.__)("Archive: %1$s (%2$s)"), 44204 postType.labels.singular_name, 44205 postType.slug 44206 ); 44207 } else { 44208 title = (0,external_wp_i18n_namespaceObject.sprintf)( 44209 // translators: %s: Name of the post type e.g: "Post". 44210 (0,external_wp_i18n_namespaceObject.__)("Archive: %s"), 44211 postType.labels.singular_name 44212 ); 44213 } 44214 return { 44215 slug: "archive-" + postType.slug, 44216 description: (0,external_wp_i18n_namespaceObject.sprintf)( 44217 // translators: %s: Name of the post type e.g: "Post". 44218 (0,external_wp_i18n_namespaceObject.__)( 44219 "Displays an archive with the latest posts of type: %s." 44220 ), 44221 postType.labels.singular_name 44222 ), 44223 title, 44224 // `icon` is the `menu_icon` property of a post type. We 44225 // only handle `dashicons` for now, even if the `menu_icon` 44226 // also supports urls and svg as values. 44227 icon: typeof postType.icon === "string" && postType.icon.startsWith("dashicons-") ? postType.icon.slice(10) : archive_default, 44228 templatePrefix: "archive" 44229 }; 44230 }) || [], 44231 [postTypesWithArchives, existingTemplates, needsUniqueIdentifier] 44232 ); 44233 } 44234 const usePostTypeMenuItems = (onClickMenuItem) => { 44235 const publicPostTypes = usePublicPostTypes(); 44236 const defaultTemplateTypes = useDefaultTemplateTypes(); 44237 const templateLabels = (0,external_wp_element_.useMemo)( 44238 () => publicPostTypes?.reduce((accumulator, { labels }) => { 44239 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 44240 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 44241 return accumulator; 44242 }, {}), 44243 [publicPostTypes] 44244 ); 44245 const needsUniqueIdentifier = (0,external_wp_element_.useCallback)( 44246 ({ labels, slug }) => { 44247 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 44248 return templateLabels[templateName] > 1 && templateName !== slug; 44249 }, 44250 [templateLabels] 44251 ); 44252 const templatePrefixes = (0,external_wp_element_.useMemo)( 44253 () => publicPostTypes?.reduce((accumulator, { slug }) => { 44254 let suffix = slug; 44255 if (slug !== "page") { 44256 suffix = `single-$suffix}`; 44257 } 44258 accumulator[slug] = suffix; 44259 return accumulator; 44260 }, {}), 44261 [publicPostTypes] 44262 ); 44263 const postTypesInfo = useEntitiesInfo("postType", templatePrefixes); 44264 const menuItems = (publicPostTypes || []).reduce( 44265 (accumulator, postType) => { 44266 const { slug, labels, icon } = postType; 44267 const generalTemplateSlug = templatePrefixes[slug]; 44268 const defaultTemplateType = defaultTemplateTypes?.find( 44269 ({ slug: _slug }) => _slug === generalTemplateSlug 44270 ); 44271 const _needsUniqueIdentifier = needsUniqueIdentifier(postType); 44272 let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)( 44273 // translators: %s: Name of the post type e.g: "Post". 44274 (0,external_wp_i18n_namespaceObject.__)("Single item: %s"), 44275 labels.singular_name 44276 ); 44277 if (_needsUniqueIdentifier) { 44278 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 44279 // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book". 44280 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "post type menu label"), 44281 labels.template_name, 44282 slug 44283 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 44284 // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book". 44285 (0,external_wp_i18n_namespaceObject._x)( 44286 "Single item: %1$s (%2$s)", 44287 "post type menu label" 44288 ), 44289 labels.singular_name, 44290 slug 44291 ); 44292 } 44293 const menuItem = defaultTemplateType ? { 44294 ...defaultTemplateType, 44295 templatePrefix: templatePrefixes[slug] 44296 } : { 44297 slug: generalTemplateSlug, 44298 title: menuItemTitle, 44299 description: (0,external_wp_i18n_namespaceObject.sprintf)( 44300 // translators: %s: Name of the post type e.g: "Post". 44301 (0,external_wp_i18n_namespaceObject.__)("Displays a single item: %s."), 44302 labels.singular_name 44303 ), 44304 // `icon` is the `menu_icon` property of a post type. We 44305 // only handle `dashicons` for now, even if the `menu_icon` 44306 // also supports urls and svg as values. 44307 icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post_default, 44308 templatePrefix: templatePrefixes[slug] 44309 }; 44310 const hasEntities = postTypesInfo?.[slug]?.hasEntities; 44311 if (hasEntities) { 44312 menuItem.onClick = (template) => { 44313 onClickMenuItem({ 44314 type: "postType", 44315 slug, 44316 config: { 44317 recordNamePath: "title.rendered", 44318 queryArgs: ({ search }) => { 44319 return { 44320 _fields: "id,title,slug,link", 44321 orderBy: search ? "relevance" : "modified", 44322 exclude: postTypesInfo[slug].existingEntitiesIds 44323 }; 44324 }, 44325 getSpecificTemplate: (suggestion) => { 44326 const templateSlug = prefixSlug( 44327 templatePrefixes[slug], 44328 suggestion.slug 44329 ); 44330 return { 44331 title: templateSlug, 44332 slug: templateSlug, 44333 templatePrefix: templatePrefixes[slug] 44334 }; 44335 } 44336 }, 44337 labels, 44338 template 44339 }); 44340 }; 44341 } 44342 if (hasEntities) { 44343 accumulator.push(menuItem); 44344 } 44345 return accumulator; 44346 }, 44347 [] 44348 ); 44349 const postTypesMenuItems = (0,external_wp_element_.useMemo)( 44350 () => menuItems.reduce( 44351 (accumulator, postType) => { 44352 const { slug } = postType; 44353 let key = "postTypesMenuItems"; 44354 if (slug === "page") { 44355 key = "defaultPostTypesMenuItems"; 44356 } 44357 accumulator[key].push(postType); 44358 return accumulator; 44359 }, 44360 { defaultPostTypesMenuItems: [], postTypesMenuItems: [] } 44361 ), 44362 [menuItems] 44363 ); 44364 return postTypesMenuItems; 44365 }; 44366 const useTaxonomiesMenuItems = (onClickMenuItem) => { 44367 const publicTaxonomies = usePublicTaxonomies(); 44368 const existingTemplates = useExistingTemplates(); 44369 const defaultTemplateTypes = useDefaultTemplateTypes(); 44370 const templatePrefixes = (0,external_wp_element_.useMemo)( 44371 () => publicTaxonomies?.reduce((accumulator, { slug }) => { 44372 let suffix = slug; 44373 if (!["category", "post_tag"].includes(slug)) { 44374 suffix = `taxonomy-$suffix}`; 44375 } 44376 if (slug === "post_tag") { 44377 suffix = `tag`; 44378 } 44379 accumulator[slug] = suffix; 44380 return accumulator; 44381 }, {}), 44382 [publicTaxonomies] 44383 ); 44384 const taxonomyLabels = publicTaxonomies?.reduce( 44385 (accumulator, { labels }) => { 44386 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 44387 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 44388 return accumulator; 44389 }, 44390 {} 44391 ); 44392 const needsUniqueIdentifier = (labels, slug) => { 44393 if (["category", "post_tag"].includes(slug)) { 44394 return false; 44395 } 44396 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 44397 return taxonomyLabels[templateName] > 1 && templateName !== slug; 44398 }; 44399 const taxonomiesInfo = useEntitiesInfo("taxonomy", templatePrefixes); 44400 const existingTemplateSlugs = (existingTemplates || []).map( 44401 ({ slug }) => slug 44402 ); 44403 const menuItems = (publicTaxonomies || []).reduce( 44404 (accumulator, taxonomy) => { 44405 const { slug, labels } = taxonomy; 44406 const generalTemplateSlug = templatePrefixes[slug]; 44407 const defaultTemplateType = defaultTemplateTypes?.find( 44408 ({ slug: _slug }) => _slug === generalTemplateSlug 44409 ); 44410 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 44411 const _needsUniqueIdentifier = needsUniqueIdentifier( 44412 labels, 44413 slug 44414 ); 44415 let menuItemTitle = labels.template_name || labels.singular_name; 44416 if (_needsUniqueIdentifier) { 44417 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 44418 // translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat". 44419 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "taxonomy template menu label"), 44420 labels.template_name, 44421 slug 44422 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 44423 // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat". 44424 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "taxonomy menu label"), 44425 labels.singular_name, 44426 slug 44427 ); 44428 } 44429 const menuItem = defaultTemplateType ? { 44430 ...defaultTemplateType, 44431 templatePrefix: templatePrefixes[slug] 44432 } : { 44433 slug: generalTemplateSlug, 44434 title: menuItemTitle, 44435 description: (0,external_wp_i18n_namespaceObject.sprintf)( 44436 // translators: %s: Name of the taxonomy e.g: "Product Categories". 44437 (0,external_wp_i18n_namespaceObject.__)("Displays taxonomy: %s."), 44438 labels.singular_name 44439 ), 44440 icon: block_meta_default, 44441 templatePrefix: templatePrefixes[slug] 44442 }; 44443 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; 44444 if (hasEntities) { 44445 menuItem.onClick = (template) => { 44446 onClickMenuItem({ 44447 type: "taxonomy", 44448 slug, 44449 config: { 44450 queryArgs: ({ search }) => { 44451 return { 44452 _fields: "id,name,slug,link", 44453 orderBy: search ? "name" : "count", 44454 exclude: taxonomiesInfo[slug].existingEntitiesIds 44455 }; 44456 }, 44457 getSpecificTemplate: (suggestion) => { 44458 const templateSlug = prefixSlug( 44459 templatePrefixes[slug], 44460 suggestion.slug 44461 ); 44462 return { 44463 title: templateSlug, 44464 slug: templateSlug, 44465 templatePrefix: templatePrefixes[slug] 44466 }; 44467 } 44468 }, 44469 labels, 44470 hasGeneralTemplate, 44471 template 44472 }); 44473 }; 44474 } 44475 if (!hasGeneralTemplate || hasEntities) { 44476 accumulator.push(menuItem); 44477 } 44478 return accumulator; 44479 }, 44480 [] 44481 ); 44482 const taxonomiesMenuItems = (0,external_wp_element_.useMemo)( 44483 () => menuItems.reduce( 44484 (accumulator, taxonomy) => { 44485 const { slug } = taxonomy; 44486 let key = "taxonomiesMenuItems"; 44487 if (["category", "tag"].includes(slug)) { 44488 key = "defaultTaxonomiesMenuItems"; 44489 } 44490 accumulator[key].push(taxonomy); 44491 return accumulator; 44492 }, 44493 { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] } 44494 ), 44495 [menuItems] 44496 ); 44497 return taxonomiesMenuItems; 44498 }; 44499 const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: "author" }; 44500 const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: "authors" } }; 44501 function useAuthorMenuItem(onClickMenuItem) { 44502 const existingTemplates = useExistingTemplates(); 44503 const defaultTemplateTypes = useDefaultTemplateTypes(); 44504 const authorInfo = useEntitiesInfo( 44505 "root", 44506 USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, 44507 USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS 44508 ); 44509 let authorMenuItem = defaultTemplateTypes?.find( 44510 ({ slug }) => slug === "author" 44511 ); 44512 if (!authorMenuItem) { 44513 authorMenuItem = { 44514 description: (0,external_wp_i18n_namespaceObject.__)( 44515 "Displays latest posts written by a single author." 44516 ), 44517 slug: "author", 44518 title: "Author" 44519 }; 44520 } 44521 const hasGeneralTemplate = !!existingTemplates?.find( 44522 ({ slug }) => slug === "author" 44523 ); 44524 if (authorInfo.user?.hasEntities) { 44525 authorMenuItem = { ...authorMenuItem, templatePrefix: "author" }; 44526 authorMenuItem.onClick = (template) => { 44527 onClickMenuItem({ 44528 type: "root", 44529 slug: "user", 44530 config: { 44531 queryArgs: ({ search }) => { 44532 return { 44533 _fields: "id,name,slug,link", 44534 orderBy: search ? "name" : "registered_date", 44535 exclude: authorInfo.user.existingEntitiesIds, 44536 who: "authors" 44537 }; 44538 }, 44539 getSpecificTemplate: (suggestion) => { 44540 const templateSlug = prefixSlug( 44541 "author", 44542 suggestion.slug 44543 ); 44544 return { 44545 title: (0,external_wp_i18n_namespaceObject.sprintf)( 44546 // translators: %s: Name of the author e.g: "Admin". 44547 (0,external_wp_i18n_namespaceObject.__)("Author: %s"), 44548 suggestion.name 44549 ), 44550 slug: templateSlug, 44551 templatePrefix: "author" 44552 }; 44553 } 44554 }, 44555 labels: { 44556 singular_name: (0,external_wp_i18n_namespaceObject.__)("Author"), 44557 search_items: (0,external_wp_i18n_namespaceObject.__)("Search Authors"), 44558 not_found: (0,external_wp_i18n_namespaceObject.__)("No authors found."), 44559 all_items: (0,external_wp_i18n_namespaceObject.__)("All Authors") 44560 }, 44561 hasGeneralTemplate, 44562 template 44563 }); 44564 }; 44565 } 44566 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { 44567 return authorMenuItem; 44568 } 44569 } 44570 const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => { 44571 const entitiesHasRecords = (0,external_wp_data_.useSelect)( 44572 (select) => { 44573 return Object.keys(templatePrefixes || {}).reduce( 44574 (accumulator, slug) => { 44575 accumulator[slug] = !!select( 44576 external_wp_coreData_namespaceObject.store 44577 ).getEntityRecords(entityName, slug, { 44578 per_page: 1, 44579 _fields: "id", 44580 context: "view", 44581 ...additionalQueryParameters[slug] 44582 })?.length; 44583 return accumulator; 44584 }, 44585 {} 44586 ); 44587 }, 44588 [templatePrefixes, entityName, additionalQueryParameters] 44589 ); 44590 const entitiesInfo = (0,external_wp_element_.useMemo)(() => { 44591 return Object.keys(templatePrefixes || {}).reduce( 44592 (accumulator, slug) => { 44593 accumulator[slug] = { 44594 hasEntities: entitiesHasRecords[slug] 44595 }; 44596 return accumulator; 44597 }, 44598 {} 44599 ); 44600 }, [templatePrefixes, entitiesHasRecords]); 44601 return entitiesInfo; 44602 }; 44603 44604 44605 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js 44606 44607 44608 44609 44610 44611 44612 44613 44614 44615 44616 const add_custom_template_modal_content_EMPTY_ARRAY = []; 44617 function SuggestionListItem({ 44618 suggestion, 44619 search, 44620 onSelect, 44621 entityForSuggestions 44622 }) { 44623 const baseCssClass = "edit-site-custom-template-modal__suggestions_list__list-item"; 44624 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44625 external_wp_components_namespaceObject.Composite.Item, 44626 { 44627 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44628 external_wp_components_namespaceObject.Button, 44629 { 44630 __next40pxDefaultSize: true, 44631 role: "option", 44632 className: baseCssClass, 44633 onClick: () => onSelect( 44634 entityForSuggestions.config.getSpecificTemplate( 44635 suggestion 44636 ) 44637 ) 44638 } 44639 ), 44640 children: [ 44641 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44642 external_wp_components_namespaceObject.__experimentalText, 44643 { 44644 size: "body", 44645 lineHeight: 1.53846153846, 44646 weight: 500, 44647 className: `$baseCssClass}__title`, 44648 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44649 external_wp_components_namespaceObject.TextHighlight, 44650 { 44651 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name), 44652 highlight: search 44653 } 44654 ) 44655 } 44656 ), 44657 suggestion.link && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44658 external_wp_components_namespaceObject.__experimentalText, 44659 { 44660 size: "body", 44661 lineHeight: 1.53846153846, 44662 className: `$baseCssClass}__info`, 44663 children: (0,external_wp_url_namespaceObject.safeDecodeURI)(suggestion.link) 44664 } 44665 ) 44666 ] 44667 } 44668 ); 44669 } 44670 function useSearchSuggestions(entityForSuggestions, search) { 44671 const { config } = entityForSuggestions; 44672 const query = (0,external_wp_element_.useMemo)( 44673 () => ({ 44674 order: "asc", 44675 context: "view", 44676 search, 44677 per_page: search ? 20 : 10, 44678 ...config.queryArgs(search) 44679 }), 44680 [search, config] 44681 ); 44682 const { records: searchResults, hasResolved: searchHasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( 44683 entityForSuggestions.type, 44684 entityForSuggestions.slug, 44685 query 44686 ); 44687 const [suggestions, setSuggestions] = (0,external_wp_element_.useState)(add_custom_template_modal_content_EMPTY_ARRAY); 44688 (0,external_wp_element_.useEffect)(() => { 44689 if (!searchHasResolved) { 44690 return; 44691 } 44692 let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY; 44693 if (searchResults?.length) { 44694 newSuggestions = searchResults; 44695 if (config.recordNamePath) { 44696 newSuggestions = mapToIHasNameAndId( 44697 newSuggestions, 44698 config.recordNamePath 44699 ); 44700 } 44701 } 44702 setSuggestions(newSuggestions); 44703 }, [searchResults, searchHasResolved]); 44704 return suggestions; 44705 } 44706 function SuggestionList({ entityForSuggestions, onSelect }) { 44707 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); 44708 const suggestions = useSearchSuggestions( 44709 entityForSuggestions, 44710 debouncedSearch 44711 ); 44712 const { labels } = entityForSuggestions; 44713 const [showSearchControl, setShowSearchControl] = (0,external_wp_element_.useState)(false); 44714 if (!showSearchControl && suggestions?.length > 9) { 44715 setShowSearchControl(true); 44716 } 44717 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44718 showSearchControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44719 external_wp_components_namespaceObject.SearchControl, 44720 { 44721 __nextHasNoMarginBottom: true, 44722 onChange: setSearch, 44723 value: search, 44724 label: labels.search_items, 44725 placeholder: labels.search_items 44726 } 44727 ), 44728 !!suggestions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44729 external_wp_components_namespaceObject.Composite, 44730 { 44731 orientation: "vertical", 44732 role: "listbox", 44733 className: "edit-site-custom-template-modal__suggestions_list", 44734 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Suggestions list"), 44735 children: suggestions.map((suggestion) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44736 SuggestionListItem, 44737 { 44738 suggestion, 44739 search: debouncedSearch, 44740 onSelect, 44741 entityForSuggestions 44742 }, 44743 suggestion.slug 44744 )) 44745 } 44746 ), 44747 debouncedSearch && !suggestions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44748 external_wp_components_namespaceObject.__experimentalText, 44749 { 44750 as: "p", 44751 className: "edit-site-custom-template-modal__no-results", 44752 children: labels.not_found 44753 } 44754 ) 44755 ] }); 44756 } 44757 function AddCustomTemplateModalContent({ 44758 onSelect, 44759 entityForSuggestions, 44760 onBack, 44761 containerRef 44762 }) { 44763 const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_.useState)(); 44764 (0,external_wp_element_.useEffect)(() => { 44765 if (containerRef.current) { 44766 const [firstFocusable] = external_wp_dom_namespaceObject.focus.focusable.find( 44767 containerRef.current 44768 ); 44769 firstFocusable?.focus(); 44770 } 44771 }, [showSearchEntities]); 44772 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44773 external_wp_components_namespaceObject.__experimentalVStack, 44774 { 44775 spacing: 4, 44776 className: "edit-site-custom-template-modal__contents-wrapper", 44777 alignment: "left", 44778 children: [ 44779 !showSearchEntities && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44780 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)( 44781 "Select whether to create a single template for all items or a specific one." 44782 ) }), 44783 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44784 external_wp_components_namespaceObject.Flex, 44785 { 44786 className: "edit-site-custom-template-modal__contents", 44787 gap: "4", 44788 align: "initial", 44789 children: [ 44790 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44791 external_wp_components_namespaceObject.FlexItem, 44792 { 44793 isBlock: true, 44794 as: external_wp_components_namespaceObject.Button, 44795 onClick: () => { 44796 const { 44797 slug, 44798 title, 44799 description, 44800 templatePrefix 44801 } = entityForSuggestions.template; 44802 onSelect({ 44803 slug, 44804 title, 44805 description, 44806 templatePrefix 44807 }); 44808 }, 44809 children: [ 44810 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44811 external_wp_components_namespaceObject.__experimentalText, 44812 { 44813 as: "span", 44814 weight: 500, 44815 lineHeight: 1.53846153846, 44816 children: entityForSuggestions.labels.all_items 44817 } 44818 ), 44819 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44820 external_wp_components_namespaceObject.__experimentalText, 44821 { 44822 as: "span", 44823 lineHeight: 1.53846153846, 44824 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 44825 children: (0,external_wp_i18n_namespaceObject.__)("For all items") 44826 } 44827 ) 44828 ] 44829 } 44830 ), 44831 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44832 external_wp_components_namespaceObject.FlexItem, 44833 { 44834 isBlock: true, 44835 as: external_wp_components_namespaceObject.Button, 44836 onClick: () => { 44837 setShowSearchEntities(true); 44838 }, 44839 children: [ 44840 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44841 external_wp_components_namespaceObject.__experimentalText, 44842 { 44843 as: "span", 44844 weight: 500, 44845 lineHeight: 1.53846153846, 44846 children: entityForSuggestions.labels.singular_name 44847 } 44848 ), 44849 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44850 external_wp_components_namespaceObject.__experimentalText, 44851 { 44852 as: "span", 44853 lineHeight: 1.53846153846, 44854 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 44855 children: (0,external_wp_i18n_namespaceObject.__)("For a specific item") 44856 } 44857 ) 44858 ] 44859 } 44860 ) 44861 ] 44862 } 44863 ), 44864 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { justify: "right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44865 external_wp_components_namespaceObject.Button, 44866 { 44867 __next40pxDefaultSize: true, 44868 variant: "tertiary", 44869 onClick: onBack, 44870 children: (0,external_wp_i18n_namespaceObject.__)("Back") 44871 } 44872 ) }) 44873 ] }), 44874 showSearchEntities && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44875 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)( 44876 "This template will be used only for the specific item chosen." 44877 ) }), 44878 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44879 SuggestionList, 44880 { 44881 entityForSuggestions, 44882 onSelect 44883 } 44884 ), 44885 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { justify: "right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44886 external_wp_components_namespaceObject.Button, 44887 { 44888 __next40pxDefaultSize: true, 44889 variant: "tertiary", 44890 onClick: () => { 44891 if (entityForSuggestions.hasGeneralTemplate) { 44892 onBack(); 44893 } else { 44894 setShowSearchEntities(false); 44895 } 44896 }, 44897 children: (0,external_wp_i18n_namespaceObject.__)("Back") 44898 } 44899 ) }) 44900 ] }) 44901 ] 44902 } 44903 ); 44904 } 44905 var add_custom_template_modal_content_default = AddCustomTemplateModalContent; 44906 44907 44908 ;// ./node_modules/tslib/tslib.es6.mjs 44909 /****************************************************************************** 44910 Copyright (c) Microsoft Corporation. 44911 44912 Permission to use, copy, modify, and/or distribute this software for any 44913 purpose with or without fee is hereby granted. 44914 44915 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 44916 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 44917 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 44918 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 44919 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 44920 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 44921 PERFORMANCE OF THIS SOFTWARE. 44922 ***************************************************************************** */ 44923 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 44924 44925 var extendStatics = function(d, b) { 44926 extendStatics = Object.setPrototypeOf || 44927 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 44928 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 44929 return extendStatics(d, b); 44930 }; 44931 44932 function __extends(d, b) { 44933 if (typeof b !== "function" && b !== null) 44934 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 44935 extendStatics(d, b); 44936 function __() { this.constructor = d; } 44937 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 44938 } 44939 44940 var __assign = function() { 44941 __assign = Object.assign || function __assign(t) { 44942 for (var s, i = 1, n = arguments.length; i < n; i++) { 44943 s = arguments[i]; 44944 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 44945 } 44946 return t; 44947 } 44948 return __assign.apply(this, arguments); 44949 } 44950 44951 function __rest(s, e) { 44952 var t = {}; 44953 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 44954 t[p] = s[p]; 44955 if (s != null && typeof Object.getOwnPropertySymbols === "function") 44956 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 44957 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 44958 t[p[i]] = s[p[i]]; 44959 } 44960 return t; 44961 } 44962 44963 function __decorate(decorators, target, key, desc) { 44964 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 44965 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 44966 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 44967 return c > 3 && r && Object.defineProperty(target, key, r), r; 44968 } 44969 44970 function __param(paramIndex, decorator) { 44971 return function (target, key) { decorator(target, key, paramIndex); } 44972 } 44973 44974 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 44975 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 44976 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 44977 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 44978 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 44979 var _, done = false; 44980 for (var i = decorators.length - 1; i >= 0; i--) { 44981 var context = {}; 44982 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 44983 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 44984 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 44985 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 44986 if (kind === "accessor") { 44987 if (result === void 0) continue; 44988 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 44989 if (_ = accept(result.get)) descriptor.get = _; 44990 if (_ = accept(result.set)) descriptor.set = _; 44991 if (_ = accept(result.init)) initializers.unshift(_); 44992 } 44993 else if (_ = accept(result)) { 44994 if (kind === "field") initializers.unshift(_); 44995 else descriptor[key] = _; 44996 } 44997 } 44998 if (target) Object.defineProperty(target, contextIn.name, descriptor); 44999 done = true; 45000 }; 45001 45002 function __runInitializers(thisArg, initializers, value) { 45003 var useValue = arguments.length > 2; 45004 for (var i = 0; i < initializers.length; i++) { 45005 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 45006 } 45007 return useValue ? value : void 0; 45008 }; 45009 45010 function __propKey(x) { 45011 return typeof x === "symbol" ? x : "".concat(x); 45012 }; 45013 45014 function __setFunctionName(f, name, prefix) { 45015 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 45016 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 45017 }; 45018 45019 function __metadata(metadataKey, metadataValue) { 45020 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 45021 } 45022 45023 function __awaiter(thisArg, _arguments, P, generator) { 45024 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 45025 return new (P || (P = Promise))(function (resolve, reject) { 45026 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 45027 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 45028 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 45029 step((generator = generator.apply(thisArg, _arguments || [])).next()); 45030 }); 45031 } 45032 45033 function __generator(thisArg, body) { 45034 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 45035 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 45036 function verb(n) { return function (v) { return step([n, v]); }; } 45037 function step(op) { 45038 if (f) throw new TypeError("Generator is already executing."); 45039 while (g && (g = 0, op[0] && (_ = 0)), _) try { 45040 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 45041 if (y = 0, t) op = [op[0] & 2, t.value]; 45042 switch (op[0]) { 45043 case 0: case 1: t = op; break; 45044 case 4: _.label++; return { value: op[1], done: false }; 45045 case 5: _.label++; y = op[1]; op = [0]; continue; 45046 case 7: op = _.ops.pop(); _.trys.pop(); continue; 45047 default: 45048 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 45049 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 45050 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 45051 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 45052 if (t[2]) _.ops.pop(); 45053 _.trys.pop(); continue; 45054 } 45055 op = body.call(thisArg, _); 45056 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 45057 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 45058 } 45059 } 45060 45061 var __createBinding = Object.create ? (function(o, m, k, k2) { 45062 if (k2 === undefined) k2 = k; 45063 var desc = Object.getOwnPropertyDescriptor(m, k); 45064 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 45065 desc = { enumerable: true, get: function() { return m[k]; } }; 45066 } 45067 Object.defineProperty(o, k2, desc); 45068 }) : (function(o, m, k, k2) { 45069 if (k2 === undefined) k2 = k; 45070 o[k2] = m[k]; 45071 }); 45072 45073 function __exportStar(m, o) { 45074 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 45075 } 45076 45077 function __values(o) { 45078 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 45079 if (m) return m.call(o); 45080 if (o && typeof o.length === "number") return { 45081 next: function () { 45082 if (o && i >= o.length) o = void 0; 45083 return { value: o && o[i++], done: !o }; 45084 } 45085 }; 45086 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 45087 } 45088 45089 function __read(o, n) { 45090 var m = typeof Symbol === "function" && o[Symbol.iterator]; 45091 if (!m) return o; 45092 var i = m.call(o), r, ar = [], e; 45093 try { 45094 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 45095 } 45096 catch (error) { e = { error: error }; } 45097 finally { 45098 try { 45099 if (r && !r.done && (m = i["return"])) m.call(i); 45100 } 45101 finally { if (e) throw e.error; } 45102 } 45103 return ar; 45104 } 45105 45106 /** @deprecated */ 45107 function __spread() { 45108 for (var ar = [], i = 0; i < arguments.length; i++) 45109 ar = ar.concat(__read(arguments[i])); 45110 return ar; 45111 } 45112 45113 /** @deprecated */ 45114 function __spreadArrays() { 45115 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 45116 for (var r = Array(s), k = 0, i = 0; i < il; i++) 45117 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 45118 r[k] = a[j]; 45119 return r; 45120 } 45121 45122 function __spreadArray(to, from, pack) { 45123 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 45124 if (ar || !(i in from)) { 45125 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 45126 ar[i] = from[i]; 45127 } 45128 } 45129 return to.concat(ar || Array.prototype.slice.call(from)); 45130 } 45131 45132 function __await(v) { 45133 return this instanceof __await ? (this.v = v, this) : new __await(v); 45134 } 45135 45136 function __asyncGenerator(thisArg, _arguments, generator) { 45137 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 45138 var g = generator.apply(thisArg, _arguments || []), i, q = []; 45139 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 45140 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 45141 function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } 45142 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 45143 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 45144 function fulfill(value) { resume("next", value); } 45145 function reject(value) { resume("throw", value); } 45146 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 45147 } 45148 45149 function __asyncDelegator(o) { 45150 var i, p; 45151 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 45152 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } 45153 } 45154 45155 function __asyncValues(o) { 45156 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 45157 var m = o[Symbol.asyncIterator], i; 45158 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); 45159 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } 45160 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 45161 } 45162 45163 function __makeTemplateObject(cooked, raw) { 45164 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 45165 return cooked; 45166 }; 45167 45168 var __setModuleDefault = Object.create ? (function(o, v) { 45169 Object.defineProperty(o, "default", { enumerable: true, value: v }); 45170 }) : function(o, v) { 45171 o["default"] = v; 45172 }; 45173 45174 var ownKeys = function(o) { 45175 ownKeys = Object.getOwnPropertyNames || function (o) { 45176 var ar = []; 45177 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 45178 return ar; 45179 }; 45180 return ownKeys(o); 45181 }; 45182 45183 function __importStar(mod) { 45184 if (mod && mod.__esModule) return mod; 45185 var result = {}; 45186 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 45187 __setModuleDefault(result, mod); 45188 return result; 45189 } 45190 45191 function __importDefault(mod) { 45192 return (mod && mod.__esModule) ? mod : { default: mod }; 45193 } 45194 45195 function __classPrivateFieldGet(receiver, state, kind, f) { 45196 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 45197 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 45198 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 45199 } 45200 45201 function __classPrivateFieldSet(receiver, state, value, kind, f) { 45202 if (kind === "m") throw new TypeError("Private method is not writable"); 45203 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 45204 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 45205 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 45206 } 45207 45208 function __classPrivateFieldIn(state, receiver) { 45209 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 45210 return typeof state === "function" ? receiver === state : state.has(receiver); 45211 } 45212 45213 function __addDisposableResource(env, value, async) { 45214 if (value !== null && value !== void 0) { 45215 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 45216 var dispose, inner; 45217 if (async) { 45218 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 45219 dispose = value[Symbol.asyncDispose]; 45220 } 45221 if (dispose === void 0) { 45222 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 45223 dispose = value[Symbol.dispose]; 45224 if (async) inner = dispose; 45225 } 45226 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 45227 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 45228 env.stack.push({ value: value, dispose: dispose, async: async }); 45229 } 45230 else if (async) { 45231 env.stack.push({ async: true }); 45232 } 45233 return value; 45234 } 45235 45236 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 45237 var e = new Error(message); 45238 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 45239 }; 45240 45241 function __disposeResources(env) { 45242 function fail(e) { 45243 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 45244 env.hasError = true; 45245 } 45246 var r, s = 0; 45247 function next() { 45248 while (r = env.stack.pop()) { 45249 try { 45250 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 45251 if (r.dispose) { 45252 var result = r.dispose.call(r.value); 45253 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 45254 } 45255 else s |= 1; 45256 } 45257 catch (e) { 45258 fail(e); 45259 } 45260 } 45261 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 45262 if (env.hasError) throw env.error; 45263 } 45264 return next(); 45265 } 45266 45267 function __rewriteRelativeImportExtension(path, preserveJsx) { 45268 if (typeof path === "string" && /^\.\.?\//.test(path)) { 45269 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { 45270 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); 45271 }); 45272 } 45273 return path; 45274 } 45275 45276 /* harmony default export */ const tslib_es6 = ({ 45277 __extends, 45278 __assign, 45279 __rest, 45280 __decorate, 45281 __param, 45282 __esDecorate, 45283 __runInitializers, 45284 __propKey, 45285 __setFunctionName, 45286 __metadata, 45287 __awaiter, 45288 __generator, 45289 __createBinding, 45290 __exportStar, 45291 __values, 45292 __read, 45293 __spread, 45294 __spreadArrays, 45295 __spreadArray, 45296 __await, 45297 __asyncGenerator, 45298 __asyncDelegator, 45299 __asyncValues, 45300 __makeTemplateObject, 45301 __importStar, 45302 __importDefault, 45303 __classPrivateFieldGet, 45304 __classPrivateFieldSet, 45305 __classPrivateFieldIn, 45306 __addDisposableResource, 45307 __disposeResources, 45308 __rewriteRelativeImportExtension, 45309 }); 45310 45311 ;// ./node_modules/lower-case/dist.es2015/index.js 45312 /** 45313 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 45314 */ 45315 var SUPPORTED_LOCALE = { 45316 tr: { 45317 regexp: /\u0130|\u0049|\u0049\u0307/g, 45318 map: { 45319 İ: "\u0069", 45320 I: "\u0131", 45321 İ: "\u0069", 45322 }, 45323 }, 45324 az: { 45325 regexp: /\u0130/g, 45326 map: { 45327 İ: "\u0069", 45328 I: "\u0131", 45329 İ: "\u0069", 45330 }, 45331 }, 45332 lt: { 45333 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 45334 map: { 45335 I: "\u0069\u0307", 45336 J: "\u006A\u0307", 45337 Į: "\u012F\u0307", 45338 Ì: "\u0069\u0307\u0300", 45339 Í: "\u0069\u0307\u0301", 45340 Ĩ: "\u0069\u0307\u0303", 45341 }, 45342 }, 45343 }; 45344 /** 45345 * Localized lower case. 45346 */ 45347 function localeLowerCase(str, locale) { 45348 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 45349 if (lang) 45350 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 45351 return lowerCase(str); 45352 } 45353 /** 45354 * Lower case as a function. 45355 */ 45356 function lowerCase(str) { 45357 return str.toLowerCase(); 45358 } 45359 45360 ;// ./node_modules/no-case/dist.es2015/index.js 45361 45362 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 45363 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 45364 // Remove all non-word characters. 45365 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 45366 /** 45367 * Normalize the string into something other libraries can manipulate easier. 45368 */ 45369 function noCase(input, options) { 45370 if (options === void 0) { options = {}; } 45371 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 45372 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 45373 var start = 0; 45374 var end = result.length; 45375 // Trim the delimiter from around the output string. 45376 while (result.charAt(start) === "\0") 45377 start++; 45378 while (result.charAt(end - 1) === "\0") 45379 end--; 45380 // Transform each token independently. 45381 return result.slice(start, end).split("\0").map(transform).join(delimiter); 45382 } 45383 /** 45384 * Replace `re` in the input string with the replacement value. 45385 */ 45386 function replace(input, re, value) { 45387 if (re instanceof RegExp) 45388 return input.replace(re, value); 45389 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 45390 } 45391 45392 ;// ./node_modules/dot-case/dist.es2015/index.js 45393 45394 45395 function dotCase(input, options) { 45396 if (options === void 0) { options = {}; } 45397 return noCase(input, __assign({ delimiter: "." }, options)); 45398 } 45399 45400 ;// ./node_modules/param-case/dist.es2015/index.js 45401 45402 45403 function paramCase(input, options) { 45404 if (options === void 0) { options = {}; } 45405 return dotCase(input, __assign({ delimiter: "-" }, options)); 45406 } 45407 45408 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js 45409 45410 45411 45412 45413 45414 function AddCustomGenericTemplateModalContent({ createTemplate, onBack }) { 45415 const [title, setTitle] = (0,external_wp_element_.useState)(""); 45416 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)("Custom Template"); 45417 const [isBusy, setIsBusy] = (0,external_wp_element_.useState)(false); 45418 const inputRef = (0,external_wp_element_.useRef)(); 45419 (0,external_wp_element_.useEffect)(() => { 45420 if (inputRef.current) { 45421 inputRef.current.focus(); 45422 } 45423 }, []); 45424 async function onCreateTemplate(event) { 45425 event.preventDefault(); 45426 if (isBusy) { 45427 return; 45428 } 45429 setIsBusy(true); 45430 try { 45431 await createTemplate( 45432 { 45433 slug: paramCase(title || defaultTitle) || "wp-custom-template", 45434 title: title || defaultTitle 45435 }, 45436 false 45437 ); 45438 } finally { 45439 setIsBusy(false); 45440 } 45441 } 45442 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onCreateTemplate, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 6, children: [ 45443 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45444 external_wp_components_namespaceObject.TextControl, 45445 { 45446 __next40pxDefaultSize: true, 45447 __nextHasNoMarginBottom: true, 45448 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 45449 value: title, 45450 onChange: setTitle, 45451 placeholder: defaultTitle, 45452 disabled: isBusy, 45453 ref: inputRef, 45454 help: (0,external_wp_i18n_namespaceObject.__)( 45455 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 45456 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.' 45457 ) 45458 } 45459 ), 45460 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 45461 external_wp_components_namespaceObject.__experimentalHStack, 45462 { 45463 className: "edit-site-custom-generic-template__modal-actions", 45464 justify: "right", 45465 children: [ 45466 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45467 external_wp_components_namespaceObject.Button, 45468 { 45469 __next40pxDefaultSize: true, 45470 variant: "tertiary", 45471 onClick: onBack, 45472 children: (0,external_wp_i18n_namespaceObject.__)("Back") 45473 } 45474 ), 45475 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45476 external_wp_components_namespaceObject.Button, 45477 { 45478 __next40pxDefaultSize: true, 45479 variant: "primary", 45480 type: "submit", 45481 isBusy, 45482 "aria-disabled": isBusy, 45483 children: (0,external_wp_i18n_namespaceObject.__)("Create") 45484 } 45485 ) 45486 ] 45487 } 45488 ) 45489 ] }) }); 45490 } 45491 var add_custom_generic_template_modal_content_default = AddCustomGenericTemplateModalContent; 45492 45493 45494 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js 45495 45496 45497 45498 45499 45500 45501 45502 45503 45504 45505 45506 45507 45508 45509 45510 45511 45512 45513 const { useHistory: add_new_template_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 45514 const DEFAULT_TEMPLATE_SLUGS = [ 45515 "front-page", 45516 "home", 45517 "single", 45518 "page", 45519 "index", 45520 "archive", 45521 "author", 45522 "category", 45523 "date", 45524 "tag", 45525 "search", 45526 "404" 45527 ]; 45528 const TEMPLATE_ICONS = { 45529 "front-page": home_default, 45530 home: verse_default, 45531 single: pin_default, 45532 page: page_default, 45533 archive: archive_default, 45534 search: search_default, 45535 404: not_found_default, 45536 index: list_default, 45537 category: category_default, 45538 author: comment_author_avatar_default, 45539 taxonomy: block_meta_default, 45540 date: calendar_default, 45541 tag: tag_default, 45542 attachment: media_media_default 45543 }; 45544 function TemplateListItem({ 45545 title, 45546 direction, 45547 className, 45548 description, 45549 icon, 45550 onClick, 45551 children 45552 }) { 45553 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45554 external_wp_components_namespaceObject.Button, 45555 { 45556 __next40pxDefaultSize: true, 45557 className, 45558 onClick, 45559 label: description, 45560 showTooltip: !!description, 45561 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 45562 external_wp_components_namespaceObject.Flex, 45563 { 45564 as: "span", 45565 spacing: 2, 45566 align: "center", 45567 justify: "center", 45568 style: { width: "100%" }, 45569 direction, 45570 children: [ 45571 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }), 45572 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 45573 external_wp_components_namespaceObject.__experimentalVStack, 45574 { 45575 className: "edit-site-add-new-template__template-name", 45576 alignment: "center", 45577 spacing: 0, 45578 children: [ 45579 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45580 external_wp_components_namespaceObject.__experimentalText, 45581 { 45582 align: "center", 45583 weight: 500, 45584 lineHeight: 1.53846153846, 45585 children: title 45586 } 45587 ), 45588 children 45589 ] 45590 } 45591 ) 45592 ] 45593 } 45594 ) 45595 } 45596 ); 45597 } 45598 const modalContentMap = { 45599 templatesList: 1, 45600 customTemplate: 2, 45601 customGenericTemplate: 3 45602 }; 45603 function NewTemplateModal({ onClose }) { 45604 const [modalContent, setModalContent] = (0,external_wp_element_.useState)( 45605 modalContentMap.templatesList 45606 ); 45607 const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_.useState)({}); 45608 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_.useState)(false); 45609 const missingTemplates = useMissingTemplates( 45610 setEntityForSuggestions, 45611 () => setModalContent(modalContentMap.customTemplate) 45612 ); 45613 const history = add_new_template_useHistory(); 45614 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 45615 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 45616 const containerRef = (0,external_wp_element_.useRef)(null); 45617 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 45618 const homeUrl = (0,external_wp_data_.useSelect)((select) => { 45619 return select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home; 45620 }, []); 45621 const TEMPLATE_SHORT_DESCRIPTIONS = { 45622 "front-page": homeUrl, 45623 date: (0,external_wp_i18n_namespaceObject.sprintf)( 45624 // translators: %s: The homepage url. 45625 (0,external_wp_i18n_namespaceObject.__)("E.g. %s"), 45626 homeUrl + "/" + (/* @__PURE__ */ new Date()).getFullYear() 45627 ) 45628 }; 45629 (0,external_wp_element_.useEffect)(() => { 45630 if (containerRef.current && modalContent === modalContentMap.templatesList) { 45631 const [firstFocusable] = external_wp_dom_namespaceObject.focus.focusable.find( 45632 containerRef.current 45633 ); 45634 firstFocusable?.focus(); 45635 } 45636 }, [modalContent]); 45637 async function createTemplate(template, isWPSuggestion = true) { 45638 if (isSubmitting) { 45639 return; 45640 } 45641 setIsSubmitting(true); 45642 try { 45643 const { title, description, slug } = template; 45644 const newTemplate = await saveEntityRecord( 45645 "postType", 45646 TEMPLATE_POST_TYPE, 45647 { 45648 description, 45649 // Slugs need to be strings, so this is for template `404` 45650 slug: slug.toString(), 45651 status: "publish", 45652 title, 45653 // This adds a post meta field in template that is part of `is_custom` value calculation. 45654 meta: { 45655 is_wp_suggestion: isWPSuggestion 45656 } 45657 }, 45658 { throwOnError: true } 45659 ); 45660 history.navigate( 45661 `/$TEMPLATE_POST_TYPE}/$newTemplate.id}?canvas=edit` 45662 ); 45663 createSuccessNotice( 45664 (0,external_wp_i18n_namespaceObject.sprintf)( 45665 // translators: %s: Title of the created post or template, e.g: "Hello world". 45666 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), 45667 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title) || (0,external_wp_i18n_namespaceObject.__)("(no title)") 45668 ), 45669 { 45670 type: "snackbar" 45671 } 45672 ); 45673 } catch (error) { 45674 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the template."); 45675 createErrorNotice(errorMessage, { 45676 type: "snackbar" 45677 }); 45678 } finally { 45679 setIsSubmitting(false); 45680 } 45681 } 45682 const onModalClose = () => { 45683 onClose(); 45684 setModalContent(modalContentMap.templatesList); 45685 }; 45686 let modalTitle = (0,external_wp_i18n_namespaceObject.__)("Add template"); 45687 if (modalContent === modalContentMap.customTemplate) { 45688 modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 45689 // translators: %s: Name of the post type e.g: "Post". 45690 (0,external_wp_i18n_namespaceObject.__)("Add template: %s"), 45691 entityForSuggestions.labels.singular_name 45692 ); 45693 } else if (modalContent === modalContentMap.customGenericTemplate) { 45694 modalTitle = (0,external_wp_i18n_namespaceObject.__)("Create custom template"); 45695 } 45696 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 45697 external_wp_components_namespaceObject.Modal, 45698 { 45699 title: modalTitle, 45700 className: dist_clsx("edit-site-add-new-template__modal", { 45701 "edit-site-add-new-template__modal_template_list": modalContent === modalContentMap.templatesList, 45702 "edit-site-custom-template-modal": modalContent === modalContentMap.customTemplate 45703 }), 45704 onRequestClose: onModalClose, 45705 overlayClassName: modalContent === modalContentMap.customGenericTemplate ? "edit-site-custom-generic-template__modal" : void 0, 45706 ref: containerRef, 45707 children: [ 45708 modalContent === modalContentMap.templatesList && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 45709 external_wp_components_namespaceObject.__experimentalGrid, 45710 { 45711 columns: isMobile ? 2 : 3, 45712 gap: 4, 45713 align: "flex-start", 45714 justify: "center", 45715 className: "edit-site-add-new-template__template-list__contents", 45716 children: [ 45717 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0,external_wp_i18n_namespaceObject.__)( 45718 "Select what the new template should apply to:" 45719 ) }), 45720 missingTemplates.map((template) => { 45721 const { title, slug, onClick } = template; 45722 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45723 TemplateListItem, 45724 { 45725 title, 45726 direction: "column", 45727 className: "edit-site-add-new-template__template-button", 45728 description: TEMPLATE_SHORT_DESCRIPTIONS[slug], 45729 icon: TEMPLATE_ICONS[slug] || layout_default, 45730 onClick: () => onClick ? onClick(template) : createTemplate(template) 45731 }, 45732 slug 45733 ); 45734 }), 45735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45736 TemplateListItem, 45737 { 45738 title: (0,external_wp_i18n_namespaceObject.__)("Custom template"), 45739 direction: "row", 45740 className: "edit-site-add-new-template__custom-template-button", 45741 icon: pencil_default, 45742 onClick: () => setModalContent( 45743 modalContentMap.customGenericTemplate 45744 ), 45745 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45746 external_wp_components_namespaceObject.__experimentalText, 45747 { 45748 lineHeight: 1.53846153846, 45749 children: (0,external_wp_i18n_namespaceObject.__)( 45750 "A custom template can be manually applied to any post or page." 45751 ) 45752 } 45753 ) 45754 } 45755 ) 45756 ] 45757 } 45758 ), 45759 modalContent === modalContentMap.customTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45760 add_custom_template_modal_content_default, 45761 { 45762 onSelect: createTemplate, 45763 entityForSuggestions, 45764 onBack: () => setModalContent(modalContentMap.templatesList), 45765 containerRef 45766 } 45767 ), 45768 modalContent === modalContentMap.customGenericTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45769 add_custom_generic_template_modal_content_default, 45770 { 45771 createTemplate, 45772 onBack: () => setModalContent(modalContentMap.templatesList) 45773 } 45774 ) 45775 ] 45776 } 45777 ); 45778 } 45779 function NewTemplate() { 45780 const [showModal, setShowModal] = (0,external_wp_element_.useState)(false); 45781 const { postType } = (0,external_wp_data_.useSelect)((select) => { 45782 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 45783 return { 45784 postType: getPostType(TEMPLATE_POST_TYPE) 45785 }; 45786 }, []); 45787 if (!postType) { 45788 return null; 45789 } 45790 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 45791 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45792 external_wp_components_namespaceObject.Button, 45793 { 45794 variant: "primary", 45795 onClick: () => setShowModal(true), 45796 label: postType.labels.add_new_item, 45797 __next40pxDefaultSize: true, 45798 children: postType.labels.add_new_item 45799 } 45800 ), 45801 showModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { onClose: () => setShowModal(false) }) 45802 ] }); 45803 } 45804 function useMissingTemplates(setEntityForSuggestions, onClick) { 45805 const defaultTemplateTypes = useDefaultTemplateTypes(); 45806 const missingDefaultTemplates = (defaultTemplateTypes || []).filter( 45807 (template) => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) 45808 ); 45809 const onClickMenuItem = (_entityForSuggestions) => { 45810 onClick?.(); 45811 setEntityForSuggestions(_entityForSuggestions); 45812 }; 45813 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; 45814 const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems(onClickMenuItem); 45815 const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems(onClickMenuItem); 45816 const authorMenuItem = useAuthorMenuItem(onClickMenuItem); 45817 [ 45818 ...defaultTaxonomiesMenuItems, 45819 ...defaultPostTypesMenuItems, 45820 authorMenuItem 45821 ].forEach((menuItem) => { 45822 if (!menuItem) { 45823 return; 45824 } 45825 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex( 45826 (template) => template.slug === menuItem.slug 45827 ); 45828 if (matchIndex > -1) { 45829 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; 45830 } else { 45831 enhancedMissingDefaultTemplateTypes.push(menuItem); 45832 } 45833 }); 45834 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { 45835 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); 45836 }); 45837 const missingTemplates = [ 45838 ...enhancedMissingDefaultTemplateTypes, 45839 ...usePostTypeArchiveMenuItems(), 45840 ...postTypesMenuItems, 45841 ...taxonomiesMenuItems 45842 ]; 45843 return missingTemplates; 45844 } 45845 var add_new_template_default = (0,external_wp_element_.memo)(NewTemplate); 45846 45847 45848 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js 45849 45850 45851 45852 45853 45854 45855 45856 45857 45858 45859 45860 45861 45862 45863 45864 const { useGlobalStyle: page_templates_fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 45865 const { Badge: fields_Badge } = unlock(external_wp_components_namespaceObject.privateApis); 45866 const { useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis); 45867 function useAllDefaultTemplateTypes() { 45868 const defaultTemplateTypes = useDefaultTemplateTypes(); 45869 const { records: staticRecords } = useEntityRecordsWithPermissions( 45870 "postType", 45871 "wp_registered_template", 45872 { per_page: -1 } 45873 ); 45874 return [ 45875 ...defaultTemplateTypes, 45876 ...staticRecords?.filter((record) => !record.is_custom).map((record) => { 45877 return { 45878 slug: record.slug, 45879 title: record.title.rendered, 45880 description: record.description 45881 }; 45882 }) 45883 ]; 45884 } 45885 function fields_PreviewField({ item }) { 45886 const settings = usePatternSettings(); 45887 const [backgroundColor = "white"] = page_templates_fields_useGlobalStyle("color.background"); 45888 const blocks = (0,external_wp_element_.useMemo)(() => { 45889 return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw); 45890 }, [item.content.raw]); 45891 const isEmpty = !blocks?.length; 45892 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { post: item, settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 45893 "div", 45894 { 45895 className: "page-templates-preview-field", 45896 style: { backgroundColor }, 45897 children: [ 45898 isEmpty && (0,external_wp_i18n_namespaceObject.__)("Empty template"), 45899 !isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks }) }) 45900 ] 45901 } 45902 ) }); 45903 } 45904 const fields_previewField = { 45905 label: (0,external_wp_i18n_namespaceObject.__)("Preview"), 45906 id: "preview", 45907 render: fields_PreviewField, 45908 enableSorting: false 45909 }; 45910 const descriptionField = { 45911 label: (0,external_wp_i18n_namespaceObject.__)("Description"), 45912 id: "description", 45913 render: function RenderDescription({ item }) { 45914 const defaultTemplateTypes = useAllDefaultTemplateTypes(); 45915 const defaultTemplateType = defaultTemplateTypes.find( 45916 (type) => type.slug === item.slug 45917 ); 45918 return item.description ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description) : defaultTemplateType?.description; 45919 }, 45920 enableSorting: false, 45921 enableGlobalSearch: true 45922 }; 45923 function fields_AuthorField({ item }) { 45924 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_.useState)(false); 45925 const { text, icon, imageUrl } = useAddedBy(item.type, item.id); 45926 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 45927 imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45928 "div", 45929 { 45930 className: dist_clsx("page-templates-author-field__avatar", { 45931 "is-loaded": isImageLoaded 45932 }), 45933 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45934 "img", 45935 { 45936 onLoad: () => setIsImageLoaded(true), 45937 alt: "", 45938 src: imageUrl 45939 } 45940 ) 45941 } 45942 ), 45943 !imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }), 45944 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text }) 45945 ] }); 45946 } 45947 const authorField = { 45948 label: (0,external_wp_i18n_namespaceObject.__)("Author"), 45949 id: "author", 45950 getValue: ({ item }) => item.author_text ?? item.author, 45951 render: fields_AuthorField 45952 }; 45953 const activeField = { 45954 label: (0,external_wp_i18n_namespaceObject.__)("Status"), 45955 id: "active", 45956 getValue: ({ item }) => item._isActive, 45957 render: function Render({ item }) { 45958 if (item._isCustom) { 45959 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45960 fields_Badge, 45961 { 45962 intent: "info", 45963 title: (0,external_wp_i18n_namespaceObject.__)( 45964 "Custom templates cannot be active nor inactive." 45965 ), 45966 children: (0,external_wp_i18n_namespaceObject.__)("N/A") 45967 } 45968 ); 45969 } 45970 const isActive = item._isActive; 45971 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(fields_Badge, { intent: isActive ? "success" : "default", children: isActive ? (0,external_wp_i18n_namespaceObject.__)("Active") : (0,external_wp_i18n_namespaceObject.__)("Inactive") }); 45972 } 45973 }; 45974 const useThemeField = () => { 45975 const activeTheme = (0,external_wp_data_.useSelect)( 45976 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme() 45977 ); 45978 return { 45979 label: (0,external_wp_i18n_namespaceObject.__)("Compatible Theme"), 45980 id: "theme", 45981 getValue: ({ item }) => item.theme, 45982 render: function Render3({ item }) { 45983 if (item.theme === activeTheme.stylesheet) { 45984 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(fields_Badge, { intent: "success", children: item.theme }); 45985 } 45986 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(fields_Badge, { intent: "error", children: item.theme }); 45987 } 45988 }; 45989 }; 45990 const slugField = { 45991 label: (0,external_wp_i18n_namespaceObject.__)("Template Type"), 45992 id: "slug", 45993 getValue: ({ item }) => item.slug, 45994 render: function Render2({ item }) { 45995 const defaultTemplateTypes = useAllDefaultTemplateTypes(); 45996 const defaultTemplateType = defaultTemplateTypes.find( 45997 (type) => type.slug === item.slug 45998 ); 45999 return defaultTemplateType?.title || (0,external_wp_i18n_namespaceObject._x)("Custom", "template type"); 46000 } 46001 }; 46002 46003 46004 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/view-utils.js 46005 const view_utils_defaultLayouts = { 46006 table: { 46007 showMedia: false 46008 }, 46009 grid: { 46010 showMedia: true 46011 }, 46012 list: { 46013 showMedia: false 46014 } 46015 }; 46016 const view_utils_DEFAULT_VIEW = { 46017 type: "grid", 46018 perPage: 20, 46019 sort: { 46020 field: "title", 46021 direction: "asc" 46022 }, 46023 titleField: "title", 46024 descriptionField: "description", 46025 mediaField: "preview", 46026 fields: ["author", "active", "slug", "theme"], 46027 filters: [], 46028 ...view_utils_defaultLayouts.grid 46029 }; 46030 function getDefaultView(activeView) { 46031 return { 46032 ...view_utils_DEFAULT_VIEW, 46033 filters: !["active", "user"].includes(activeView) ? [ 46034 { 46035 field: "author", 46036 operator: "isAny", 46037 value: [activeView] 46038 } 46039 ] : [] 46040 }; 46041 } 46042 46043 46044 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js 46045 46046 46047 46048 46049 46050 46051 46052 46053 46054 46055 46056 46057 46058 46059 46060 46061 46062 46063 46064 46065 46066 const { usePostActions: page_templates_usePostActions, templateTitleField } = unlock(external_wp_editor_namespaceObject.privateApis); 46067 const { useHistory: page_templates_useHistory, useLocation: page_templates_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 46068 const { useEntityRecordsWithPermissions: page_templates_useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis); 46069 function PageTemplates() { 46070 const { path, query } = page_templates_useLocation(); 46071 const { activeView = "active", postId } = query; 46072 const [selection, setSelection] = (0,external_wp_element_.useState)([postId]); 46073 const [selectedRegisteredTemplate, setSelectedRegisteredTemplate] = (0,external_wp_element_.useState)(false); 46074 const defaultView = (0,external_wp_element_.useMemo)(() => { 46075 return getDefaultView(activeView); 46076 }, [activeView]); 46077 const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({ 46078 kind: "postType", 46079 name: TEMPLATE_POST_TYPE, 46080 slug: activeView, 46081 defaultView, 46082 queryParams: { 46083 page: query.pageNumber, 46084 search: query.search 46085 }, 46086 onChangeQueryParams: (newQueryParams) => { 46087 history.navigate( 46088 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 46089 ...query, 46090 pageNumber: newQueryParams.page, 46091 search: newQueryParams.search || void 0 46092 }) 46093 ); 46094 } 46095 }); 46096 const { activeTemplatesOption, activeTheme, defaultTemplateTypes } = (0,external_wp_data_.useSelect)((select) => { 46097 const { getEntityRecord, getCurrentTheme } = select(external_wp_coreData_namespaceObject.store); 46098 return { 46099 activeTemplatesOption: getEntityRecord("root", "site")?.active_templates, 46100 activeTheme: getCurrentTheme(), 46101 defaultTemplateTypes: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types 46102 }; 46103 }); 46104 const { records: userRecords, isResolving: isLoadingUserRecords } = page_templates_useEntityRecordsWithPermissions("postType", TEMPLATE_POST_TYPE, { 46105 per_page: -1, 46106 combinedTemplates: false 46107 }); 46108 const { records: staticRecords, isResolving: isLoadingStaticData } = page_templates_useEntityRecordsWithPermissions("postType", "wp_registered_template", { 46109 per_page: -1 46110 }); 46111 const activeTemplates = (0,external_wp_element_.useMemo)(() => { 46112 const _active = [...staticRecords].filter( 46113 (record) => !record.is_custom 46114 ); 46115 if (activeTemplatesOption) { 46116 for (const activeSlug in activeTemplatesOption) { 46117 const activeId = activeTemplatesOption[activeSlug]; 46118 if (activeId === false) { 46119 const index = _active.findIndex( 46120 (template) => template.slug === activeSlug 46121 ); 46122 if (index !== -1) { 46123 _active.splice(index, 1); 46124 } 46125 } else { 46126 const template = userRecords.find( 46127 (userRecord) => userRecord.id === activeId && userRecord.theme === activeTheme.stylesheet 46128 ); 46129 if (template) { 46130 const index = _active.findIndex( 46131 ({ slug }) => slug === template.slug 46132 ); 46133 if (index !== -1) { 46134 _active[index] = template; 46135 } else { 46136 _active.push(template); 46137 } 46138 } 46139 } 46140 } 46141 } 46142 return _active; 46143 }, [userRecords, staticRecords, activeTemplatesOption, activeTheme]); 46144 let _records; 46145 let isLoadingData; 46146 if (activeView === "active") { 46147 _records = activeTemplates; 46148 isLoadingData = isLoadingUserRecords || isLoadingStaticData; 46149 } else if (activeView === "user") { 46150 _records = userRecords; 46151 isLoadingData = isLoadingUserRecords; 46152 } else { 46153 _records = staticRecords; 46154 isLoadingData = isLoadingStaticData; 46155 } 46156 const records = (0,external_wp_element_.useMemo)(() => { 46157 return _records.map((record) => ({ 46158 ...record, 46159 _isActive: activeTemplates.find( 46160 (template) => template.id === record.id 46161 ), 46162 _isCustom: record.is_custom || !record.meta?.is_wp_suggestion && !defaultTemplateTypes.find( 46163 (type) => type.slug === record.slug 46164 ) 46165 })); 46166 }, [_records, activeTemplates, defaultTemplateTypes]); 46167 const users = (0,external_wp_data_.useSelect)( 46168 (select) => { 46169 const { getUser } = select(external_wp_coreData_namespaceObject.store); 46170 return records.reduce((acc, record) => { 46171 if (record.author_text) { 46172 if (!acc[record.author_text]) { 46173 acc[record.author_text] = record.author_text; 46174 } 46175 } else if (record.author) { 46176 if (!acc[record.author]) { 46177 acc[record.author] = getUser(record.author); 46178 } 46179 } 46180 return acc; 46181 }, {}); 46182 }, 46183 [records] 46184 ); 46185 const history = page_templates_useHistory(); 46186 const onChangeSelection = (0,external_wp_element_.useCallback)( 46187 (items) => { 46188 setSelection(items); 46189 if (view?.type === "list") { 46190 history.navigate( 46191 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 46192 postId: items.length === 1 ? items[0] : void 0 46193 }) 46194 ); 46195 } 46196 }, 46197 [history, path, view?.type] 46198 ); 46199 const themeField = useThemeField(); 46200 const fields = (0,external_wp_element_.useMemo)(() => { 46201 const _fields = [ 46202 fields_previewField, 46203 templateTitleField, 46204 descriptionField, 46205 activeField, 46206 slugField 46207 ]; 46208 if (activeView === "user") { 46209 _fields.push(themeField); 46210 } 46211 const elements = []; 46212 for (const author in users) { 46213 elements.push({ 46214 value: users[author]?.id ?? author, 46215 label: users[author]?.name ?? author 46216 }); 46217 } 46218 _fields.push({ 46219 ...authorField, 46220 elements 46221 }); 46222 return _fields; 46223 }, [users, activeView, themeField]); 46224 const { data, paginationInfo } = (0,external_wp_element_.useMemo)(() => { 46225 return filterSortAndPaginate(records, view, fields); 46226 }, [records, view, fields]); 46227 const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 46228 const onActionPerformed = (0,external_wp_element_.useCallback)( 46229 (actionId, items) => { 46230 switch (actionId) { 46231 case "duplicate-post": 46232 { 46233 const newItem = items[0]; 46234 const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered; 46235 createSuccessNotice( 46236 (0,external_wp_i18n_namespaceObject.sprintf)( 46237 // translators: %s: Title of the created post or template, e.g: "Hello world". 46238 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), 46239 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title) || (0,external_wp_i18n_namespaceObject.__)("(no title)") 46240 ), 46241 { 46242 type: "snackbar", 46243 id: "duplicate-post-action", 46244 actions: [ 46245 { 46246 label: (0,external_wp_i18n_namespaceObject.__)("Edit"), 46247 onClick: () => { 46248 history.navigate( 46249 `/$newItem.type}/$newItem.id}?canvas=edit` 46250 ); 46251 } 46252 } 46253 ] 46254 } 46255 ); 46256 } 46257 break; 46258 } 46259 }, 46260 [history, createSuccessNotice] 46261 ); 46262 const postTypeActions = page_templates_usePostActions({ 46263 postType: TEMPLATE_POST_TYPE, 46264 context: "list", 46265 onActionPerformed 46266 }); 46267 const editAction = useEditPostAction(); 46268 const setActiveTemplateAction = useSetActiveTemplateAction(); 46269 const actions = (0,external_wp_element_.useMemo)( 46270 () => activeView === "user" ? [setActiveTemplateAction, editAction, ...postTypeActions] : [setActiveTemplateAction, ...postTypeActions], 46271 [postTypeActions, setActiveTemplateAction, editAction, activeView] 46272 ); 46273 const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)((newView) => { 46274 if (newView.type !== view.type) { 46275 history.invalidate(); 46276 } 46277 updateView(newView); 46278 }); 46279 const duplicateAction = actions.find( 46280 (action) => action.id === "duplicate-post" 46281 ); 46282 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 46283 page_page_default, 46284 { 46285 className: "edit-site-page-templates", 46286 title: (0,external_wp_i18n_namespaceObject.__)("Templates"), 46287 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 46288 isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46289 external_wp_components_namespaceObject.Button, 46290 { 46291 __next40pxDefaultSize: true, 46292 onClick: () => { 46293 resetToDefault(); 46294 history.invalidate(); 46295 }, 46296 children: (0,external_wp_i18n_namespaceObject.__)("Reset view") 46297 } 46298 ), 46299 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template_default, {}) 46300 ] }), 46301 children: [ 46302 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46303 dataviews_default, 46304 { 46305 paginationInfo, 46306 fields, 46307 actions, 46308 data, 46309 isLoading: isLoadingData, 46310 view, 46311 onChangeView, 46312 onChangeSelection, 46313 isItemClickable: () => true, 46314 onClickItem: (item) => { 46315 if (item.type === "wp_registered_template") { 46316 setSelectedRegisteredTemplate(item); 46317 } else { 46318 history.navigate( 46319 `/$item.type}/$item.id}?canvas=edit` 46320 ); 46321 } 46322 }, 46323 selection, 46324 defaultLayouts: view_utils_defaultLayouts 46325 }, 46326 activeView 46327 ), 46328 selectedRegisteredTemplate && duplicateAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46329 external_wp_components_namespaceObject.Modal, 46330 { 46331 title: (0,external_wp_i18n_namespaceObject.__)("Duplicate"), 46332 onRequestClose: () => setSelectedRegisteredTemplate(), 46333 size: "small", 46334 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46335 duplicateAction.RenderModal, 46336 { 46337 items: [selectedRegisteredTemplate], 46338 closeModal: () => setSelectedRegisteredTemplate(), 46339 onActionPerformed: ([item]) => { 46340 history.navigate( 46341 `/$item.type}/$item.id}?canvas=edit` 46342 ); 46343 } 46344 } 46345 ) 46346 } 46347 ) 46348 ] 46349 } 46350 ); 46351 } 46352 46353 46354 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/templates.js 46355 46356 46357 46358 46359 46360 46361 46362 async function isTemplateListView(query) { 46363 const { activeView = "active" } = query; 46364 const view = await (0,build_module.loadView)({ 46365 kind: "postType", 46366 name: "wp_template", 46367 slug: activeView, 46368 defaultView: getDefaultView(activeView) 46369 }); 46370 return view.type === "list"; 46371 } 46372 const templatesRoute = { 46373 name: "templates", 46374 path: "/template", 46375 areas: { 46376 sidebar({ siteData }) { 46377 const isBlockTheme = siteData.currentTheme?.is_block_theme; 46378 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 46379 }, 46380 content({ siteData }) { 46381 const isBlockTheme = siteData.currentTheme?.is_block_theme; 46382 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : void 0; 46383 }, 46384 async preview({ query, siteData }) { 46385 const isBlockTheme = siteData.currentTheme?.is_block_theme; 46386 if (!isBlockTheme) { 46387 return void 0; 46388 } 46389 const isListView = await isTemplateListView(query); 46390 return isListView ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0; 46391 }, 46392 mobile({ siteData }) { 46393 const isBlockTheme = siteData.currentTheme?.is_block_theme; 46394 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 46395 } 46396 }, 46397 widths: { 46398 async content({ query }) { 46399 const isListView = await isTemplateListView(query); 46400 return isListView ? 380 : void 0; 46401 } 46402 } 46403 }; 46404 46405 46406 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-item.js 46407 46408 46409 46410 46411 const areas = { 46412 sidebar({ siteData }) { 46413 const isBlockTheme = siteData.currentTheme?.is_block_theme; 46414 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 46415 }, 46416 mobile({ siteData }) { 46417 const isBlockTheme = siteData.currentTheme?.is_block_theme; 46418 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 46419 }, 46420 preview({ siteData }) { 46421 const isBlockTheme = siteData.currentTheme?.is_block_theme; 46422 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 46423 } 46424 }; 46425 const templateItemRoute = { 46426 name: "template-item", 46427 path: "/wp_template/*postId", 46428 areas 46429 }; 46430 46431 46432 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js 46433 46434 46435 46436 46437 46438 46439 46440 46441 const { useLocation: dataview_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 46442 function DataViewItem({ 46443 title, 46444 slug, 46445 type, 46446 icon, 46447 isActive, 46448 suffix 46449 }) { 46450 const { path } = dataview_item_useLocation(); 46451 const iconToUse = icon || VIEW_LAYOUTS.find((v) => v.type === type).icon; 46452 if (slug === "all") { 46453 slug = void 0; 46454 } 46455 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 46456 external_wp_components_namespaceObject.__experimentalHStack, 46457 { 46458 justify: "flex-start", 46459 className: dist_clsx("edit-site-sidebar-dataviews-dataview-item", { 46460 "is-selected": isActive 46461 }), 46462 children: [ 46463 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46464 SidebarNavigationItem, 46465 { 46466 icon: iconToUse, 46467 to: (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 46468 activeView: slug 46469 }), 46470 "aria-current": isActive ? "true" : void 0, 46471 children: title 46472 } 46473 ), 46474 suffix 46475 ] 46476 } 46477 ); 46478 } 46479 46480 46481 ;// ./node_modules/@wordpress/icons/build-module/library/pages.js 46482 46483 46484 var pages_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 46485 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" }), 46486 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z" }), 46487 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" }) 46488 ] }); 46489 46490 46491 ;// ./node_modules/@wordpress/icons/build-module/library/published.js 46492 46493 46494 var published_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46495 external_wp_primitives_namespaceObject.Path, 46496 { 46497 fillRule: "evenodd", 46498 clipRule: "evenodd", 46499 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" 46500 } 46501 ) }); 46502 46503 46504 ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js 46505 46506 46507 var scheduled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46508 external_wp_primitives_namespaceObject.Path, 46509 { 46510 fillRule: "evenodd", 46511 clipRule: "evenodd", 46512 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" 46513 } 46514 ) }); 46515 46516 46517 ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js 46518 46519 46520 var drafts_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46521 external_wp_primitives_namespaceObject.Path, 46522 { 46523 fillRule: "evenodd", 46524 clipRule: "evenodd", 46525 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" 46526 } 46527 ) }); 46528 46529 46530 ;// ./node_modules/@wordpress/icons/build-module/library/pending.js 46531 46532 46533 var pending_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46534 external_wp_primitives_namespaceObject.Path, 46535 { 46536 fillRule: "evenodd", 46537 clipRule: "evenodd", 46538 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z" 46539 } 46540 ) }); 46541 46542 46543 ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 46544 46545 46546 var not_allowed_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46547 external_wp_primitives_namespaceObject.Path, 46548 { 46549 fillRule: "evenodd", 46550 clipRule: "evenodd", 46551 d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z" 46552 } 46553 ) }); 46554 46555 46556 ;// ./node_modules/@wordpress/icons/build-module/library/trash.js 46557 46558 46559 var trash_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46560 external_wp_primitives_namespaceObject.Path, 46561 { 46562 fillRule: "evenodd", 46563 clipRule: "evenodd", 46564 d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" 46565 } 46566 ) }); 46567 46568 46569 ;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/view-utils.js 46570 46571 46572 46573 const post_list_view_utils_defaultLayouts = { 46574 table: {}, 46575 grid: {}, 46576 list: {} 46577 }; 46578 const DEFAULT_POST_BASE = { 46579 type: "list", 46580 filters: [], 46581 perPage: 20, 46582 sort: { 46583 field: "title", 46584 direction: "asc" 46585 }, 46586 showLevels: true, 46587 titleField: "title", 46588 mediaField: "featured_media", 46589 fields: ["author", "status"], 46590 ...post_list_view_utils_defaultLayouts.list 46591 }; 46592 function getDefaultViews(postType) { 46593 return [ 46594 { 46595 title: postType?.labels?.all_items || (0,external_wp_i18n_namespaceObject.__)("All items"), 46596 slug: "all", 46597 icon: pages_default, 46598 view: DEFAULT_POST_BASE 46599 }, 46600 { 46601 title: (0,external_wp_i18n_namespaceObject.__)("Published"), 46602 slug: "published", 46603 icon: published_default, 46604 view: { 46605 ...DEFAULT_POST_BASE, 46606 filters: [ 46607 { 46608 field: "status", 46609 operator: OPERATOR_IS_ANY, 46610 value: "publish", 46611 isLocked: true 46612 } 46613 ] 46614 } 46615 }, 46616 { 46617 title: (0,external_wp_i18n_namespaceObject.__)("Scheduled"), 46618 slug: "future", 46619 icon: scheduled_default, 46620 view: { 46621 ...DEFAULT_POST_BASE, 46622 filters: [ 46623 { 46624 field: "status", 46625 operator: OPERATOR_IS_ANY, 46626 value: "future", 46627 isLocked: true 46628 } 46629 ] 46630 } 46631 }, 46632 { 46633 title: (0,external_wp_i18n_namespaceObject.__)("Drafts"), 46634 slug: "drafts", 46635 icon: drafts_default, 46636 view: { 46637 ...DEFAULT_POST_BASE, 46638 filters: [ 46639 { 46640 field: "status", 46641 operator: OPERATOR_IS_ANY, 46642 value: "draft", 46643 isLocked: true 46644 } 46645 ] 46646 } 46647 }, 46648 { 46649 title: (0,external_wp_i18n_namespaceObject.__)("Pending"), 46650 slug: "pending", 46651 icon: pending_default, 46652 view: { 46653 ...DEFAULT_POST_BASE, 46654 filters: [ 46655 { 46656 field: "status", 46657 operator: OPERATOR_IS_ANY, 46658 value: "pending", 46659 isLocked: true 46660 } 46661 ] 46662 } 46663 }, 46664 { 46665 title: (0,external_wp_i18n_namespaceObject.__)("Private"), 46666 slug: "private", 46667 icon: not_allowed_default, 46668 view: { 46669 ...DEFAULT_POST_BASE, 46670 filters: [ 46671 { 46672 field: "status", 46673 operator: OPERATOR_IS_ANY, 46674 value: "private", 46675 isLocked: true 46676 } 46677 ] 46678 } 46679 }, 46680 { 46681 title: (0,external_wp_i18n_namespaceObject.__)("Trash"), 46682 slug: "trash", 46683 icon: trash_default, 46684 view: { 46685 ...DEFAULT_POST_BASE, 46686 type: "table", 46687 layout: post_list_view_utils_defaultLayouts.table.layout, 46688 filters: [ 46689 { 46690 field: "status", 46691 operator: OPERATOR_IS_ANY, 46692 value: "trash", 46693 isLocked: true 46694 } 46695 ] 46696 } 46697 } 46698 ]; 46699 } 46700 const view_utils_getDefaultView = (postType, activeView) => { 46701 return getDefaultViews(postType).find( 46702 ({ slug }) => slug === activeView 46703 )?.view; 46704 }; 46705 46706 46707 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js 46708 46709 46710 46711 46712 46713 46714 46715 46716 46717 const { useLocation: sidebar_dataviews_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 46718 function DataViewsSidebarContent({ postType }) { 46719 const { 46720 query: { activeView = "all" } 46721 } = sidebar_dataviews_useLocation(); 46722 const postTypeObject = (0,external_wp_data_.useSelect)( 46723 (select) => { 46724 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 46725 return getPostType(postType); 46726 }, 46727 [postType] 46728 ); 46729 const defaultViews = (0,external_wp_element_.useMemo)( 46730 () => getDefaultViews(postTypeObject), 46731 [postTypeObject] 46732 ); 46733 if (!postType) { 46734 return null; 46735 } 46736 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-dataviews", children: defaultViews.map((dataview) => { 46737 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46738 DataViewItem, 46739 { 46740 slug: dataview.slug, 46741 title: dataview.title, 46742 icon: dataview.icon, 46743 type: dataview.view.type, 46744 isActive: dataview.slug === activeView 46745 }, 46746 dataview.slug 46747 ); 46748 }) }) }); 46749 } 46750 46751 46752 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 46753 46754 46755 var drawer_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46756 external_wp_primitives_namespaceObject.Path, 46757 { 46758 fillRule: "evenodd", 46759 clipRule: "evenodd", 46760 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" 46761 } 46762 ) }); 46763 46764 46765 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js 46766 46767 46768 46769 46770 46771 46772 46773 46774 46775 function AddNewPostModal({ postType, onSave, onClose }) { 46776 const labels = (0,external_wp_data_.useSelect)( 46777 (select) => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels, 46778 [postType] 46779 ); 46780 const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_.useState)(false); 46781 const [title, setTitle] = (0,external_wp_element_.useState)(""); 46782 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 46783 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); 46784 const { resolveSelect } = (0,external_wp_data_.useRegistry)(); 46785 async function createPost(event) { 46786 event.preventDefault(); 46787 if (isCreatingPost) { 46788 return; 46789 } 46790 setIsCreatingPost(true); 46791 try { 46792 const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 46793 const newPage = await saveEntityRecord( 46794 "postType", 46795 postType, 46796 { 46797 status: "draft", 46798 title, 46799 slug: title ?? void 0, 46800 content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)( 46801 (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)( 46802 [], 46803 postTypeObject.template 46804 ) 46805 ) : void 0 46806 }, 46807 { throwOnError: true } 46808 ); 46809 onSave(newPage); 46810 createSuccessNotice( 46811 (0,external_wp_i18n_namespaceObject.sprintf)( 46812 // translators: %s: Title of the created post or template, e.g: "Hello world". 46813 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), 46814 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title) || (0,external_wp_i18n_namespaceObject.__)("(no title)") 46815 ), 46816 { type: "snackbar" } 46817 ); 46818 } catch (error) { 46819 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the item."); 46820 createErrorNotice(errorMessage, { 46821 type: "snackbar" 46822 }); 46823 } finally { 46824 setIsCreatingPost(false); 46825 } 46826 } 46827 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46828 external_wp_components_namespaceObject.Modal, 46829 { 46830 title: ( 46831 // translators: %s: post type singular_name label e.g: "Page". 46832 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Draft new: %s"), labels?.singular_name) 46833 ), 46834 onRequestClose: onClose, 46835 focusOnMount: "firstContentElement", 46836 size: "small", 46837 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: createPost, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 46838 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46839 external_wp_components_namespaceObject.TextControl, 46840 { 46841 __next40pxDefaultSize: true, 46842 __nextHasNoMarginBottom: true, 46843 label: (0,external_wp_i18n_namespaceObject.__)("Title"), 46844 onChange: setTitle, 46845 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), 46846 value: title 46847 } 46848 ), 46849 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, justify: "end", children: [ 46850 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46851 external_wp_components_namespaceObject.Button, 46852 { 46853 __next40pxDefaultSize: true, 46854 variant: "tertiary", 46855 onClick: onClose, 46856 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 46857 } 46858 ), 46859 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46860 external_wp_components_namespaceObject.Button, 46861 { 46862 __next40pxDefaultSize: true, 46863 variant: "primary", 46864 type: "submit", 46865 isBusy: isCreatingPost, 46866 "aria-disabled": isCreatingPost, 46867 children: (0,external_wp_i18n_namespaceObject.__)("Create draft") 46868 } 46869 ) 46870 ] }) 46871 ] }) }) 46872 } 46873 ); 46874 } 46875 46876 46877 ;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js 46878 46879 46880 46881 46882 46883 46884 46885 46886 46887 46888 46889 46890 46891 46892 46893 46894 46895 46896 46897 const { usePostActions: post_list_usePostActions, usePostFields } = unlock(external_wp_editor_namespaceObject.privateApis); 46898 const { useLocation: post_list_useLocation, useHistory: post_list_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); 46899 const { useEntityRecordsWithPermissions: post_list_useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis); 46900 const post_list_EMPTY_ARRAY = []; 46901 const DEFAULT_STATUSES = "draft,future,pending,private,publish"; 46902 function getItemId(item) { 46903 return item.id.toString(); 46904 } 46905 function getItemLevel(item) { 46906 return item.level; 46907 } 46908 function PostList({ postType }) { 46909 const { path, query } = post_list_useLocation(); 46910 const { activeView = "all", postId, quickEdit = false } = query; 46911 const history = post_list_useHistory(); 46912 const postTypeObject = (0,external_wp_data_.useSelect)( 46913 (select) => { 46914 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 46915 return getPostType(postType); 46916 }, 46917 [postType] 46918 ); 46919 const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({ 46920 kind: "postType", 46921 name: postType, 46922 slug: activeView, 46923 queryParams: { 46924 page: query.pageNumber, 46925 search: query.search 46926 }, 46927 onChangeQueryParams: (newQueryParams) => { 46928 history.navigate( 46929 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 46930 ...query, 46931 pageNumber: newQueryParams.page, 46932 search: newQueryParams.search || void 0 46933 }) 46934 ); 46935 }, 46936 defaultView: view_utils_getDefaultView(postTypeObject, activeView) 46937 }); 46938 const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)((newView) => { 46939 if (newView.type !== view.type) { 46940 history.invalidate(); 46941 } 46942 updateView(newView); 46943 }); 46944 const [selection, setSelection] = (0,external_wp_element_.useState)(postId?.split(",") ?? []); 46945 const onChangeSelection = (0,external_wp_element_.useCallback)( 46946 (items) => { 46947 setSelection(items); 46948 history.navigate( 46949 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 46950 postId: items.join(",") 46951 }) 46952 ); 46953 }, 46954 [path, history] 46955 ); 46956 const fields = usePostFields({ 46957 postType 46958 }); 46959 const queryArgs = (0,external_wp_element_.useMemo)(() => { 46960 const filters = {}; 46961 view.filters?.forEach((filter) => { 46962 if (filter.field === "status" && filter.operator === OPERATOR_IS_ANY) { 46963 filters.status = filter.value; 46964 } 46965 if (filter.field === "author" && filter.operator === OPERATOR_IS_ANY) { 46966 filters.author = filter.value; 46967 } else if (filter.field === "author" && filter.operator === OPERATOR_IS_NONE) { 46968 filters.author_exclude = filter.value; 46969 } 46970 }); 46971 if (!filters.status || filters.status === "") { 46972 filters.status = DEFAULT_STATUSES; 46973 } 46974 return { 46975 per_page: view.perPage, 46976 page: view.page, 46977 _embed: "author,wp:featuredmedia", 46978 order: view.sort?.direction, 46979 orderby: view.sort?.field, 46980 orderby_hierarchy: !!view.showLevels, 46981 search: view.search, 46982 ...filters 46983 }; 46984 }, [view]); 46985 const { 46986 records, 46987 isResolving: isLoadingData, 46988 totalItems, 46989 totalPages 46990 } = post_list_useEntityRecordsWithPermissions("postType", postType, queryArgs); 46991 const data = (0,external_wp_element_.useMemo)(() => { 46992 if (view?.sort?.field === "author") { 46993 return filterSortAndPaginate( 46994 records, 46995 { sort: { ...view.sort } }, 46996 fields 46997 ).data; 46998 } 46999 return records; 47000 }, [records, fields, view?.sort]); 47001 const ids = data?.map((record) => getItemId(record)) ?? []; 47002 const prevIds = (0,external_wp_compose_namespaceObject.usePrevious)(ids) ?? []; 47003 const deletedIds = prevIds.filter((id) => !ids.includes(id)); 47004 const postIdWasDeleted = deletedIds.includes(postId); 47005 (0,external_wp_element_.useEffect)(() => { 47006 if (postIdWasDeleted) { 47007 history.navigate( 47008 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 47009 postId: void 0 47010 }) 47011 ); 47012 } 47013 }, [history, postIdWasDeleted, path]); 47014 const paginationInfo = (0,external_wp_element_.useMemo)( 47015 () => ({ 47016 totalItems, 47017 totalPages 47018 }), 47019 [totalItems, totalPages] 47020 ); 47021 const { labels, canCreateRecord } = (0,external_wp_data_.useSelect)( 47022 (select) => { 47023 const { getPostType, canUser } = select(external_wp_coreData_namespaceObject.store); 47024 return { 47025 labels: getPostType(postType)?.labels, 47026 canCreateRecord: canUser("create", { 47027 kind: "postType", 47028 name: postType 47029 }) 47030 }; 47031 }, 47032 [postType] 47033 ); 47034 const postTypeActions = post_list_usePostActions({ 47035 postType, 47036 context: "list" 47037 }); 47038 const editAction = useEditPostAction(); 47039 const actions = (0,external_wp_element_.useMemo)( 47040 () => [editAction, ...postTypeActions], 47041 [postTypeActions, editAction] 47042 ); 47043 const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_.useState)(false); 47044 const openModal = () => setShowAddPostModal(true); 47045 const closeModal = () => setShowAddPostModal(false); 47046 const handleNewPage = ({ type, id }) => { 47047 history.navigate(`/$type}/$id}?canvas=edit`); 47048 closeModal(); 47049 }; 47050 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47051 page_page_default, 47052 { 47053 title: labels?.name, 47054 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 47055 isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47056 external_wp_components_namespaceObject.Button, 47057 { 47058 __next40pxDefaultSize: true, 47059 onClick: () => { 47060 resetToDefault(); 47061 history.invalidate(); 47062 }, 47063 children: (0,external_wp_i18n_namespaceObject.__)("Reset view") 47064 } 47065 ), 47066 labels?.add_new_item && canCreateRecord && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 47067 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47068 external_wp_components_namespaceObject.Button, 47069 { 47070 variant: "primary", 47071 onClick: openModal, 47072 __next40pxDefaultSize: true, 47073 children: labels.add_new_item 47074 } 47075 ), 47076 showAddPostModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47077 AddNewPostModal, 47078 { 47079 postType, 47080 onSave: handleNewPage, 47081 onClose: closeModal 47082 } 47083 ) 47084 ] }) 47085 ] }), 47086 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47087 dataviews_default, 47088 { 47089 paginationInfo, 47090 fields, 47091 actions, 47092 data: data || post_list_EMPTY_ARRAY, 47093 isLoading: isLoadingData, 47094 view, 47095 onChangeView, 47096 selection, 47097 onChangeSelection, 47098 isItemClickable: (item) => item.status !== "trash", 47099 onClickItem: ({ id }) => { 47100 history.navigate(`/$postType}/$id}?canvas=edit`); 47101 }, 47102 getItemId, 47103 getItemLevel, 47104 defaultLayouts: post_list_view_utils_defaultLayouts, 47105 header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === "page" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47106 external_wp_components_namespaceObject.Button, 47107 { 47108 size: "compact", 47109 isPressed: quickEdit, 47110 icon: drawer_right_default, 47111 label: (0,external_wp_i18n_namespaceObject.__)("Details"), 47112 onClick: () => { 47113 history.navigate( 47114 (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 47115 quickEdit: quickEdit ? void 0 : true 47116 }) 47117 ); 47118 } 47119 } 47120 ) 47121 }, 47122 activeView 47123 ) 47124 } 47125 ); 47126 } 47127 47128 47129 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js 47130 47131 47132 const DataFormContext = (0,external_wp_element_.createContext)({ 47133 fields: [] 47134 }); 47135 DataFormContext.displayName = "DataFormContext"; 47136 function DataFormProvider({ 47137 fields, 47138 children 47139 }) { 47140 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { value: { fields }, children }); 47141 } 47142 var dataform_context_default = DataFormContext; 47143 47144 47145 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/is-combined-field.js 47146 function isCombinedField(field) { 47147 return field.children !== void 0; 47148 } 47149 47150 47151 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/normalize-form-fields.js 47152 const DEFAULT_LAYOUT = { 47153 type: "regular", 47154 labelPosition: "top" 47155 }; 47156 const normalizeCardSummaryField = (sum) => { 47157 if (typeof sum === "string") { 47158 return [{ id: sum, visibility: "when-collapsed" }]; 47159 } 47160 return sum.map((item) => { 47161 if (typeof item === "string") { 47162 return { id: item, visibility: "when-collapsed" }; 47163 } 47164 return { id: item.id, visibility: item.visibility }; 47165 }); 47166 }; 47167 function normalizeLayout(layout) { 47168 let normalizedLayout = DEFAULT_LAYOUT; 47169 if (layout?.type === "regular") { 47170 normalizedLayout = { 47171 type: "regular", 47172 labelPosition: layout?.labelPosition ?? "top" 47173 }; 47174 } else if (layout?.type === "panel") { 47175 const summary = layout.summary ?? []; 47176 const normalizedSummary = Array.isArray(summary) ? summary : [summary]; 47177 normalizedLayout = { 47178 type: "panel", 47179 labelPosition: layout?.labelPosition ?? "side", 47180 openAs: layout?.openAs ?? "dropdown", 47181 summary: normalizedSummary 47182 }; 47183 } else if (layout?.type === "card") { 47184 if (layout.withHeader === false) { 47185 normalizedLayout = { 47186 type: "card", 47187 withHeader: false, 47188 isOpened: true, 47189 summary: [] 47190 }; 47191 } else { 47192 const summary = layout.summary ?? []; 47193 normalizedLayout = { 47194 type: "card", 47195 withHeader: true, 47196 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true, 47197 summary: normalizeCardSummaryField(summary) 47198 }; 47199 } 47200 } else if (layout?.type === "row") { 47201 normalizedLayout = { 47202 type: "row", 47203 alignment: layout?.alignment ?? "center", 47204 styles: layout?.styles ?? {} 47205 }; 47206 } 47207 return normalizedLayout; 47208 } 47209 function normalizeFormFields(form) { 47210 const formLayout = normalizeLayout(form?.layout); 47211 return (form.fields ?? []).map((field) => { 47212 if (typeof field === "string") { 47213 return { 47214 id: field, 47215 layout: formLayout 47216 }; 47217 } 47218 const fieldLayout = field.layout ? normalizeLayout(field.layout) : formLayout; 47219 return { 47220 ...field, 47221 layout: fieldLayout 47222 }; 47223 }); 47224 } 47225 47226 47227 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/regular/index.js 47228 47229 47230 47231 47232 47233 47234 47235 47236 function regular_Header({ title }) { 47237 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-regular__header", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [ 47238 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }), 47239 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}) 47240 ] }) }); 47241 } 47242 function FormRegularField({ 47243 data, 47244 field, 47245 onChange, 47246 hideLabelFromVision, 47247 validity 47248 }) { 47249 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default); 47250 const form = (0,external_wp_element_.useMemo)( 47251 () => ({ 47252 layout: DEFAULT_LAYOUT, 47253 fields: isCombinedField(field) ? field.children : [] 47254 }), 47255 [field] 47256 ); 47257 if (isCombinedField(field)) { 47258 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 47259 !hideLabelFromVision && field.label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(regular_Header, { title: field.label }), 47260 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47261 DataFormLayout, 47262 { 47263 data, 47264 form, 47265 onChange, 47266 validity: validity?.children 47267 } 47268 ) 47269 ] }); 47270 } 47271 const layout = normalizeLayout({ 47272 ...field.layout, 47273 type: "regular" 47274 }); 47275 const labelPosition = layout.labelPosition; 47276 const fieldDefinition = fields.find( 47277 (fieldDef) => fieldDef.id === field.id 47278 ); 47279 if (!fieldDefinition || !fieldDefinition.Edit) { 47280 return null; 47281 } 47282 if (labelPosition === "side") { 47283 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataforms-layouts-regular__field", children: [ 47284 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47285 "div", 47286 { 47287 className: dist_clsx( 47288 "dataforms-layouts-regular__field-label", 47289 `dataforms-layouts-regular__field-label--label-position-$labelPosition}` 47290 ), 47291 children: fieldDefinition.label 47292 } 47293 ), 47294 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47295 fieldDefinition.render, 47296 { 47297 item: data, 47298 field: fieldDefinition 47299 } 47300 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47301 fieldDefinition.Edit, 47302 { 47303 data, 47304 field: fieldDefinition, 47305 onChange, 47306 hideLabelFromVision: true, 47307 validity 47308 }, 47309 fieldDefinition.id 47310 ) }) 47311 ] }); 47312 } 47313 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 47314 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: fieldDefinition.label }), 47315 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47316 fieldDefinition.render, 47317 { 47318 item: data, 47319 field: fieldDefinition 47320 } 47321 ) 47322 ] }) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47323 fieldDefinition.Edit, 47324 { 47325 data, 47326 field: fieldDefinition, 47327 onChange, 47328 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision, 47329 validity 47330 } 47331 ) }); 47332 } 47333 47334 47335 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/summary-button.js 47336 47337 47338 47339 function SummaryButton({ 47340 summaryFields, 47341 data, 47342 labelPosition, 47343 fieldLabel, 47344 disabled, 47345 onClick, 47346 "aria-expanded": ariaExpanded 47347 }) { 47348 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47349 external_wp_components_namespaceObject.Button, 47350 { 47351 className: "dataforms-layouts-panel__summary-button", 47352 size: "compact", 47353 variant: ["none", "top"].includes(labelPosition) ? "link" : "tertiary", 47354 "aria-expanded": ariaExpanded, 47355 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 47356 // translators: %s: Field name. 47357 (0,external_wp_i18n_namespaceObject._x)("Edit %s", "field"), 47358 fieldLabel || "" 47359 ), 47360 onClick, 47361 disabled, 47362 accessibleWhenDisabled: true, 47363 style: summaryFields.length > 1 ? { 47364 minHeight: "auto", 47365 height: "auto", 47366 alignItems: "flex-start" 47367 } : void 0, 47368 children: summaryFields.length > 1 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47369 "div", 47370 { 47371 style: { 47372 display: "flex", 47373 flexDirection: "column", 47374 alignItems: "flex-start", 47375 width: "100%", 47376 gap: "2px" 47377 }, 47378 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47379 "div", 47380 { 47381 style: { width: "100%" }, 47382 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47383 summaryField.render, 47384 { 47385 item: data, 47386 field: summaryField 47387 } 47388 ) 47389 }, 47390 summaryField.id 47391 )) 47392 } 47393 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47394 summaryField.render, 47395 { 47396 item: data, 47397 field: summaryField 47398 }, 47399 summaryField.id 47400 )) 47401 } 47402 ); 47403 } 47404 var summary_button_default = SummaryButton; 47405 47406 47407 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/dropdown.js 47408 47409 47410 47411 47412 47413 47414 47415 47416 47417 function DropdownHeader({ 47418 title, 47419 onClose 47420 }) { 47421 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47422 external_wp_components_namespaceObject.__experimentalVStack, 47423 { 47424 className: "dataforms-layouts-panel__dropdown-header", 47425 spacing: 4, 47426 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [ 47427 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }), 47428 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), 47429 onClose && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47430 external_wp_components_namespaceObject.Button, 47431 { 47432 label: (0,external_wp_i18n_namespaceObject.__)("Close"), 47433 icon: close_small_default, 47434 onClick: onClose, 47435 size: "small" 47436 } 47437 ) 47438 ] }) 47439 } 47440 ); 47441 } 47442 function PanelDropdown({ 47443 data, 47444 field, 47445 onChange, 47446 validity, 47447 labelPosition = "side", 47448 summaryFields, 47449 fieldDefinition, 47450 popoverAnchor 47451 }) { 47452 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 47453 const form = (0,external_wp_element_.useMemo)( 47454 () => ({ 47455 layout: DEFAULT_LAYOUT, 47456 fields: isCombinedField(field) ? field.children : ( 47457 // If not explicit children return the field id itself. 47458 [{ id: field.id }] 47459 ) 47460 }), 47461 [field] 47462 ); 47463 const formValidity = (0,external_wp_element_.useMemo)(() => { 47464 if (validity === void 0) { 47465 return void 0; 47466 } 47467 if (isCombinedField(field)) { 47468 return validity?.children; 47469 } 47470 return { [field.id]: validity }; 47471 }, [validity, field]); 47472 const popoverProps = (0,external_wp_element_.useMemo)( 47473 () => ({ 47474 // Anchor the popover to the middle of the entire row so that it doesn't 47475 // move around when the label changes. 47476 anchor: popoverAnchor, 47477 placement: "left-start", 47478 offset: 36, 47479 shift: true 47480 }), 47481 [popoverAnchor] 47482 ); 47483 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47484 external_wp_components_namespaceObject.Dropdown, 47485 { 47486 contentClassName: "dataforms-layouts-panel__field-dropdown", 47487 popoverProps, 47488 focusOnMount: true, 47489 toggleProps: { 47490 size: "compact", 47491 variant: "tertiary", 47492 tooltipPosition: "middle left" 47493 }, 47494 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47495 summary_button_default, 47496 { 47497 summaryFields, 47498 data, 47499 labelPosition, 47500 fieldLabel, 47501 disabled: fieldDefinition.readOnly === true, 47502 onClick: onToggle, 47503 "aria-expanded": isOpen 47504 } 47505 ), 47506 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 47507 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { title: fieldLabel, onClose }), 47508 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47509 DataFormLayout, 47510 { 47511 data, 47512 form, 47513 onChange, 47514 validity: formValidity, 47515 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47516 FieldLayout, 47517 { 47518 data, 47519 field: childField, 47520 onChange, 47521 hideLabelFromVision: (form?.fields ?? []).length < 2, 47522 validity: childFieldValidity 47523 }, 47524 childField.id 47525 ) 47526 } 47527 ) 47528 ] }) 47529 } 47530 ); 47531 } 47532 var dropdown_default = PanelDropdown; 47533 47534 47535 // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js 47536 var cjs = __webpack_require__(66); 47537 var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); 47538 ;// ./node_modules/@wordpress/dataviews/build-module/hooks/use-form-validity.js 47539 47540 47541 47542 47543 47544 const isEmptyNullOrUndefined = (value) => [void 0, "", null].includes(value); 47545 const isArrayOrElementsEmptyNullOrUndefined = (value) => { 47546 return !Array.isArray(value) || value.length === 0 || value.every((element) => isEmptyNullOrUndefined(element)); 47547 }; 47548 function isInvalidForRequired(fieldType, value) { 47549 if (fieldType === void 0 && isEmptyNullOrUndefined(value) || fieldType === "text" && isEmptyNullOrUndefined(value) || fieldType === "email" && isEmptyNullOrUndefined(value) || fieldType === "url" && isEmptyNullOrUndefined(value) || fieldType === "telephone" && isEmptyNullOrUndefined(value) || fieldType === "password" && isEmptyNullOrUndefined(value) || fieldType === "integer" && isEmptyNullOrUndefined(value) || fieldType === "number" && isEmptyNullOrUndefined(value) || fieldType === "array" && isArrayOrElementsEmptyNullOrUndefined(value) || fieldType === "boolean" && value !== true) { 47550 return true; 47551 } 47552 return false; 47553 } 47554 function isFormValid(formValidity) { 47555 if (!formValidity) { 47556 return true; 47557 } 47558 return Object.values(formValidity).every((fieldValidation) => { 47559 return Object.entries(fieldValidation).every( 47560 ([key, validation]) => { 47561 if (key === "children" && validation && typeof validation === "object") { 47562 return isFormValid(validation); 47563 } 47564 return validation.type === "valid"; 47565 } 47566 ); 47567 }); 47568 } 47569 function updateFieldValidity(setFormValidity, parentFieldId, fieldId, newValidity) { 47570 if (parentFieldId) { 47571 setFormValidity((prev) => ({ 47572 ...prev, 47573 [parentFieldId]: { 47574 ...prev?.[parentFieldId], 47575 children: { 47576 ...prev?.[parentFieldId]?.children, 47577 [fieldId]: { 47578 ...newValidity 47579 } 47580 } 47581 } 47582 })); 47583 } else { 47584 setFormValidity((prev) => ({ 47585 ...prev, 47586 [fieldId]: { 47587 ...newValidity 47588 } 47589 })); 47590 } 47591 } 47592 function getFieldsToValidate(fields, form) { 47593 const formFields = normalizeFormFields(form); 47594 if (formFields.length === 0) { 47595 return { fields: [], fieldToParent: /* @__PURE__ */ new Map() }; 47596 } 47597 const fieldToParent = /* @__PURE__ */ new Map(); 47598 const fieldIdsToValidate = []; 47599 formFields.forEach((formField) => { 47600 if (!!formField.children) { 47601 formField.children.forEach((child) => { 47602 const childId = typeof child === "string" ? child : child.id; 47603 fieldIdsToValidate.push(childId); 47604 fieldToParent.set(childId, formField.id); 47605 }); 47606 } else { 47607 fieldIdsToValidate.push(formField.id); 47608 } 47609 }); 47610 return { 47611 fields: normalizeFields( 47612 fields.filter( 47613 (field) => fieldIdsToValidate.includes(field.id) 47614 ) 47615 ), 47616 fieldToParent 47617 }; 47618 } 47619 function useFormValidity(item, fields, form) { 47620 const [formValidity, setFormValidity] = (0,external_wp_element_.useState)(); 47621 const previousValidatedValuesRef = (0,external_wp_element_.useRef)({}); 47622 const customValidationCounterRef = (0,external_wp_element_.useRef)({}); 47623 const elementsValidationCounterRef = (0,external_wp_element_.useRef)( 47624 {} 47625 ); 47626 const validate = (0,external_wp_element_.useCallback)(() => { 47627 const { fields: fieldsToValidate, fieldToParent } = getFieldsToValidate( 47628 fields, 47629 form 47630 ); 47631 if (fieldsToValidate.length === 0) { 47632 setFormValidity(void 0); 47633 return; 47634 } 47635 fieldsToValidate.forEach((field) => { 47636 const value = field.getValue({ item }); 47637 if (previousValidatedValuesRef.current.hasOwnProperty(field.id) && value === previousValidatedValuesRef.current[field.id]) { 47638 return; 47639 } 47640 previousValidatedValuesRef.current[field.id] = value; 47641 const parentFieldId = fieldToParent.get(field.id); 47642 if (field.isValid.required && isInvalidForRequired(field.type, value)) { 47643 updateFieldValidity(setFormValidity, parentFieldId, field.id, { 47644 required: { type: "invalid" } 47645 }); 47646 return; 47647 } 47648 if (field.isValid.elements && field.hasElements && !field.getElements && Array.isArray(field.elements)) { 47649 const validValues = field.elements.map((el) => el.value); 47650 if (field.type !== "array" && !validValues.includes(value)) { 47651 updateFieldValidity( 47652 setFormValidity, 47653 parentFieldId, 47654 field.id, 47655 { 47656 elements: { 47657 type: "invalid", 47658 message: "Value must be one of the elements." 47659 } 47660 } 47661 ); 47662 return; 47663 } 47664 if (field.type === "array" && !Array.isArray(value)) { 47665 updateFieldValidity( 47666 setFormValidity, 47667 parentFieldId, 47668 field.id, 47669 { 47670 elements: { 47671 type: "invalid", 47672 message: "Value must be an array." 47673 } 47674 } 47675 ); 47676 return; 47677 } 47678 if (field.type === "array" && value.some((v) => !validValues.includes(v))) { 47679 updateFieldValidity( 47680 setFormValidity, 47681 parentFieldId, 47682 field.id, 47683 { 47684 elements: { 47685 type: "invalid", 47686 message: "Value must be one of the elements." 47687 } 47688 } 47689 ); 47690 return; 47691 } 47692 } 47693 if (field.isValid.elements && field.hasElements && typeof field.getElements === "function") { 47694 const currentToken = (elementsValidationCounterRef.current[field.id] || 0) + 1; 47695 elementsValidationCounterRef.current[field.id] = currentToken; 47696 updateFieldValidity(setFormValidity, parentFieldId, field.id, { 47697 elements: { 47698 type: "validating", 47699 message: "Validating..." 47700 } 47701 }); 47702 field.getElements().then((result) => { 47703 if (elementsValidationCounterRef.current[field.id] !== currentToken) { 47704 return; 47705 } 47706 if (!Array.isArray(result)) { 47707 updateFieldValidity( 47708 setFormValidity, 47709 parentFieldId, 47710 field.id, 47711 { 47712 elements: { 47713 type: "invalid", 47714 message: "Could not validate elements." 47715 } 47716 } 47717 ); 47718 return; 47719 } 47720 const validValues = result.map((el) => el.value); 47721 if (field.type !== "array" && !validValues.includes(value)) { 47722 updateFieldValidity( 47723 setFormValidity, 47724 parentFieldId, 47725 field.id, 47726 { 47727 elements: { 47728 type: "invalid", 47729 message: "Value must be one of the elements." 47730 } 47731 } 47732 ); 47733 return; 47734 } 47735 if (field.type === "array" && !Array.isArray(value)) { 47736 updateFieldValidity( 47737 setFormValidity, 47738 parentFieldId, 47739 field.id, 47740 { 47741 elements: { 47742 type: "invalid", 47743 message: "Value must be an array." 47744 } 47745 } 47746 ); 47747 return; 47748 } 47749 if (field.type === "array" && value.some( 47750 (v) => !validValues.includes(v) 47751 )) { 47752 updateFieldValidity( 47753 setFormValidity, 47754 parentFieldId, 47755 field.id, 47756 { 47757 elements: { 47758 type: "invalid", 47759 message: "Value must be one of the elements." 47760 } 47761 } 47762 ); 47763 } 47764 }).catch((error) => { 47765 if (elementsValidationCounterRef.current[field.id] !== currentToken) { 47766 return; 47767 } 47768 updateFieldValidity( 47769 setFormValidity, 47770 parentFieldId, 47771 field.id, 47772 { 47773 elements: { 47774 type: "invalid", 47775 message: error.message 47776 } 47777 } 47778 ); 47779 }); 47780 } 47781 let customError; 47782 try { 47783 customError = field.isValid?.custom?.( 47784 cjs_default()( 47785 item, 47786 field.setValue({ 47787 item, 47788 value 47789 }) 47790 ), 47791 field 47792 ); 47793 } catch (error) { 47794 let errorMessage; 47795 if (error instanceof Error) { 47796 errorMessage = error.message; 47797 } else { 47798 errorMessage = String(error) || (0,external_wp_i18n_namespaceObject.__)("Unknown error when running custom validation."); 47799 } 47800 updateFieldValidity(setFormValidity, parentFieldId, field.id, { 47801 custom: { 47802 type: "invalid", 47803 message: errorMessage 47804 } 47805 }); 47806 } 47807 if (typeof customError === "string") { 47808 updateFieldValidity(setFormValidity, parentFieldId, field.id, { 47809 custom: { 47810 type: "invalid", 47811 message: customError 47812 } 47813 }); 47814 return; 47815 } 47816 if (customError instanceof Promise) { 47817 const currentToken = (customValidationCounterRef.current[field.id] || 0) + 1; 47818 customValidationCounterRef.current[field.id] = currentToken; 47819 updateFieldValidity(setFormValidity, parentFieldId, field.id, { 47820 custom: { 47821 type: "validating", 47822 message: "Validating..." 47823 } 47824 }); 47825 customError.then((result) => { 47826 if (customValidationCounterRef.current[field.id] !== currentToken) { 47827 return; 47828 } 47829 if (result === null) { 47830 updateFieldValidity( 47831 setFormValidity, 47832 parentFieldId, 47833 field.id, 47834 { 47835 custom: { 47836 type: "valid", 47837 message: "Valid" 47838 } 47839 } 47840 ); 47841 return; 47842 } 47843 if (typeof result === "string") { 47844 updateFieldValidity( 47845 setFormValidity, 47846 parentFieldId, 47847 field.id, 47848 { 47849 custom: { 47850 type: "invalid", 47851 message: result 47852 } 47853 } 47854 ); 47855 } 47856 }).catch((error) => { 47857 if (customValidationCounterRef.current[field.id] !== currentToken) { 47858 return; 47859 } 47860 updateFieldValidity( 47861 setFormValidity, 47862 parentFieldId, 47863 field.id, 47864 { 47865 custom: { 47866 type: "invalid", 47867 message: error.message 47868 } 47869 } 47870 ); 47871 }); 47872 return; 47873 } 47874 setFormValidity((prev) => { 47875 if (!prev) { 47876 return prev; 47877 } 47878 if (parentFieldId) { 47879 const parentField = prev[parentFieldId]; 47880 if (!parentField?.children) { 47881 return prev; 47882 } 47883 const { [field.id]: removed2, ...restChildren } = parentField.children; 47884 if (Object.keys(restChildren).length === 0) { 47885 const { children, ...restParent } = parentField; 47886 if (Object.keys(restParent).length === 0) { 47887 const { 47888 [parentFieldId]: removedParent, 47889 ...restFields 47890 } = prev; 47891 return Object.keys(restFields).length === 0 ? void 0 : restFields; 47892 } 47893 return { 47894 ...prev, 47895 [parentFieldId]: restParent 47896 }; 47897 } 47898 return { 47899 ...prev, 47900 [parentFieldId]: { 47901 ...parentField, 47902 children: restChildren 47903 } 47904 }; 47905 } 47906 if (!prev[field.id]) { 47907 return prev; 47908 } 47909 const { [field.id]: removed, ...rest } = prev; 47910 if (Object.keys(rest).length === 0) { 47911 return void 0; 47912 } 47913 return rest; 47914 }); 47915 }); 47916 }, [item, fields, form]); 47917 (0,external_wp_element_.useEffect)(() => { 47918 validate(); 47919 }, [validate]); 47920 return { 47921 validity: formValidity, 47922 isValid: isFormValid(formValidity) 47923 }; 47924 } 47925 var use_form_validity_default = useFormValidity; 47926 47927 47928 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/modal.js 47929 47930 47931 47932 47933 47934 47935 47936 47937 47938 47939 47940 function ModalContent({ 47941 data, 47942 field, 47943 onChange, 47944 fieldLabel, 47945 onClose 47946 }) { 47947 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default); 47948 const [changes, setChanges] = (0,external_wp_element_.useState)({}); 47949 const modalData = (0,external_wp_element_.useMemo)(() => { 47950 return cjs_default()(data, changes); 47951 }, [data, changes]); 47952 const form = (0,external_wp_element_.useMemo)( 47953 () => ({ 47954 layout: DEFAULT_LAYOUT, 47955 fields: isCombinedField(field) ? field.children : ( 47956 // If not explicit children return the field id itself. 47957 [{ id: field.id }] 47958 ) 47959 }), 47960 [field] 47961 ); 47962 const { validity } = use_form_validity_default( 47963 modalData, 47964 fields, 47965 form 47966 ); 47967 const onApply = () => { 47968 onChange(changes); 47969 onClose(); 47970 }; 47971 const handleOnChange = (newValue) => { 47972 setChanges((prev) => cjs_default()(prev, newValue)); 47973 }; 47974 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 47975 external_wp_components_namespaceObject.Modal, 47976 { 47977 className: "dataforms-layouts-panel__modal", 47978 onRequestClose: onClose, 47979 isFullScreen: false, 47980 title: fieldLabel, 47981 size: "medium", 47982 children: [ 47983 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47984 DataFormLayout, 47985 { 47986 data: modalData, 47987 form, 47988 onChange: handleOnChange, 47989 validity, 47990 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47991 FieldLayout, 47992 { 47993 data: modalData, 47994 field: childField, 47995 onChange: handleOnChange, 47996 hideLabelFromVision: (form?.fields ?? []).length < 2, 47997 validity: childFieldValidity 47998 }, 47999 childField.id 48000 ) 48001 } 48002 ), 48003 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 48004 external_wp_components_namespaceObject.__experimentalHStack, 48005 { 48006 className: "dataforms-layouts-panel__modal-footer", 48007 spacing: 3, 48008 children: [ 48009 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), 48010 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48011 external_wp_components_namespaceObject.Button, 48012 { 48013 variant: "tertiary", 48014 onClick: onClose, 48015 __next40pxDefaultSize: true, 48016 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 48017 } 48018 ), 48019 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48020 external_wp_components_namespaceObject.Button, 48021 { 48022 variant: "primary", 48023 onClick: onApply, 48024 __next40pxDefaultSize: true, 48025 children: (0,external_wp_i18n_namespaceObject.__)("Apply") 48026 } 48027 ) 48028 ] 48029 } 48030 ) 48031 ] 48032 } 48033 ); 48034 } 48035 function PanelModal({ 48036 data, 48037 field, 48038 onChange, 48039 labelPosition, 48040 summaryFields, 48041 fieldDefinition 48042 }) { 48043 const [isOpen, setIsOpen] = (0,external_wp_element_.useState)(false); 48044 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 48045 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 48046 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48047 summary_button_default, 48048 { 48049 summaryFields, 48050 data, 48051 labelPosition, 48052 fieldLabel, 48053 disabled: fieldDefinition.readOnly === true, 48054 onClick: () => setIsOpen(true), 48055 "aria-expanded": isOpen 48056 } 48057 ), 48058 isOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48059 ModalContent, 48060 { 48061 data, 48062 field, 48063 onChange, 48064 fieldLabel: fieldLabel ?? "", 48065 onClose: () => setIsOpen(false) 48066 } 48067 ) 48068 ] }); 48069 } 48070 var modal_default = PanelModal; 48071 48072 48073 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/get-summary-fields.js 48074 function extractSummaryIds(summary) { 48075 if (Array.isArray(summary)) { 48076 return summary.map( 48077 (item) => typeof item === "string" ? item : item.id 48078 ); 48079 } 48080 return []; 48081 } 48082 const getSummaryFields = (summaryField, fields) => { 48083 if (Array.isArray(summaryField) && summaryField.length > 0) { 48084 const summaryIds = extractSummaryIds(summaryField); 48085 return summaryIds.map( 48086 (summaryId) => fields.find((_field) => _field.id === summaryId) 48087 ).filter((_field) => _field !== void 0); 48088 } 48089 return []; 48090 }; 48091 48092 48093 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/index.js 48094 48095 48096 48097 48098 48099 48100 48101 48102 48103 48104 const getFieldDefinition = (field, fields) => { 48105 const fieldDefinition = fields.find((_field) => _field.id === field.id); 48106 if (!fieldDefinition) { 48107 return fields.find((_field) => { 48108 if (isCombinedField(field)) { 48109 const simpleChildren = field.children.filter( 48110 (child) => typeof child === "string" || !isCombinedField(child) 48111 ); 48112 if (simpleChildren.length === 0) { 48113 return false; 48114 } 48115 const firstChildFieldId = typeof simpleChildren[0] === "string" ? simpleChildren[0] : simpleChildren[0].id; 48116 return _field.id === firstChildFieldId; 48117 } 48118 return _field.id === field.id; 48119 }); 48120 } 48121 return fieldDefinition; 48122 }; 48123 const getFieldDefinitionAndSummaryFields = (layout, field, fields) => { 48124 const summaryFields = getSummaryFields(layout.summary, fields); 48125 const fieldDefinition = getFieldDefinition(field, fields); 48126 if (summaryFields.length === 0) { 48127 return { 48128 summaryFields: fieldDefinition ? [fieldDefinition] : [], 48129 fieldDefinition 48130 }; 48131 } 48132 return { 48133 summaryFields, 48134 fieldDefinition 48135 }; 48136 }; 48137 function FormPanelField({ 48138 data, 48139 field, 48140 onChange, 48141 validity 48142 }) { 48143 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default); 48144 const layout = normalizeLayout({ 48145 ...field.layout, 48146 type: "panel" 48147 }); 48148 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_.useState)( 48149 null 48150 ); 48151 const { fieldDefinition, summaryFields } = getFieldDefinitionAndSummaryFields(layout, field, fields); 48152 if (!fieldDefinition) { 48153 return null; 48154 } 48155 const labelPosition = layout.labelPosition; 48156 const labelClassName = dist_clsx( 48157 "dataforms-layouts-panel__field-label", 48158 `dataforms-layouts-panel__field-label--label-position-$labelPosition}` 48159 ); 48160 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 48161 const renderedControl = layout.openAs === "modal" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48162 modal_default, 48163 { 48164 data, 48165 field, 48166 onChange, 48167 labelPosition, 48168 summaryFields, 48169 fieldDefinition 48170 } 48171 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48172 dropdown_default, 48173 { 48174 data, 48175 field, 48176 onChange, 48177 validity, 48178 labelPosition, 48179 summaryFields, 48180 fieldDefinition, 48181 popoverAnchor 48182 } 48183 ); 48184 if (labelPosition === "top") { 48185 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-panel__field", spacing: 0, children: [ 48186 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48187 "div", 48188 { 48189 className: labelClassName, 48190 style: { paddingBottom: 0 }, 48191 children: fieldLabel 48192 } 48193 ), 48194 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl }) 48195 ] }); 48196 } 48197 if (labelPosition === "none") { 48198 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field", children: renderedControl }); 48199 } 48200 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 48201 external_wp_components_namespaceObject.__experimentalHStack, 48202 { 48203 ref: setPopoverAnchor, 48204 className: "dataforms-layouts-panel__field", 48205 children: [ 48206 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: labelClassName, children: fieldLabel }), 48207 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl }) 48208 ] 48209 } 48210 ); 48211 } 48212 48213 48214 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/card/index.js 48215 48216 48217 48218 48219 48220 48221 48222 48223 48224 48225 function useCollapsibleCard(initialIsOpen = true) { 48226 const [isOpen, setIsOpen] = (0,external_wp_element_.useState)(initialIsOpen); 48227 const toggle = (0,external_wp_element_.useCallback)(() => { 48228 setIsOpen((prev) => !prev); 48229 }, []); 48230 const CollapsibleCardHeader = (0,external_wp_element_.useCallback)( 48231 ({ 48232 children, 48233 ...props 48234 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 48235 external_wp_components_namespaceObject.CardHeader, 48236 { 48237 ...props, 48238 onClick: toggle, 48239 style: { 48240 cursor: "pointer", 48241 ...props.style 48242 }, 48243 children: [ 48244 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48245 "div", 48246 { 48247 style: { 48248 width: "100%", 48249 display: "flex", 48250 justifyContent: "space-between", 48251 alignItems: "center" 48252 }, 48253 children 48254 } 48255 ), 48256 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48257 external_wp_components_namespaceObject.Button, 48258 { 48259 __next40pxDefaultSize: true, 48260 variant: "tertiary", 48261 icon: isOpen ? chevron_up_default : chevron_down_default, 48262 "aria-expanded": isOpen, 48263 "aria-label": isOpen ? "Collapse" : "Expand" 48264 } 48265 ) 48266 ] 48267 } 48268 ), 48269 [toggle, isOpen] 48270 ); 48271 return { isOpen, CollapsibleCardHeader }; 48272 } 48273 function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) { 48274 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) { 48275 return false; 48276 } 48277 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig]; 48278 const fieldConfig = summaryConfigArray.find((config) => { 48279 if (typeof config === "string") { 48280 return config === summaryField.id; 48281 } 48282 if (typeof config === "object" && "id" in config) { 48283 return config.id === summaryField.id; 48284 } 48285 return false; 48286 }); 48287 if (!fieldConfig) { 48288 return false; 48289 } 48290 if (typeof fieldConfig === "string") { 48291 return true; 48292 } 48293 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) { 48294 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen; 48295 } 48296 return true; 48297 } 48298 function FormCardField({ 48299 data, 48300 field, 48301 onChange, 48302 hideLabelFromVision, 48303 validity 48304 }) { 48305 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default); 48306 const layout = normalizeLayout({ 48307 ...field.layout, 48308 type: "card" 48309 }); 48310 const form = (0,external_wp_element_.useMemo)( 48311 () => ({ 48312 layout: DEFAULT_LAYOUT, 48313 fields: isCombinedField(field) ? field.children : [] 48314 }), 48315 [field] 48316 ); 48317 const { isOpen, CollapsibleCardHeader } = useCollapsibleCard( 48318 layout.isOpened 48319 ); 48320 const summaryFields = getSummaryFields(layout.summary, fields); 48321 const visibleSummaryFields = summaryFields.filter( 48322 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen) 48323 ); 48324 if (isCombinedField(field)) { 48325 const withHeader2 = !!field.label && layout.withHeader; 48326 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { className: "dataforms-layouts-card__field", children: [ 48327 withHeader2 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-header", children: [ 48328 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: field.label }), 48329 visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map( 48330 (summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48331 summaryField.render, 48332 { 48333 item: data, 48334 field: summaryField 48335 }, 48336 summaryField.id 48337 ) 48338 ) }) 48339 ] }), 48340 (isOpen || !withHeader2) && // If it doesn't have a header, keep it open. 48341 // Otherwise, the card will not be visible. 48342 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { className: "dataforms-layouts-card__field-control", children: [ 48343 field.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }), 48344 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48345 DataFormLayout, 48346 { 48347 data, 48348 form, 48349 onChange, 48350 validity: validity?.children 48351 } 48352 ) 48353 ] }) 48354 ] }); 48355 } 48356 const fieldDefinition = fields.find( 48357 (fieldDef) => fieldDef.id === field.id 48358 ); 48359 if (!fieldDefinition || !fieldDefinition.Edit) { 48360 return null; 48361 } 48362 const RegularLayout = getFormFieldLayout("regular")?.component; 48363 if (!RegularLayout) { 48364 return null; 48365 } 48366 const withHeader = !!fieldDefinition.label && layout.withHeader; 48367 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { className: "dataforms-layouts-card__field", children: [ 48368 withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-header", children: [ 48369 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: fieldDefinition.label }), 48370 visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48371 summaryField.render, 48372 { 48373 item: data, 48374 field: summaryField 48375 }, 48376 summaryField.id 48377 )) }) 48378 ] }), 48379 (isOpen || !withHeader) && // If it doesn't have a header, keep it open. 48380 // Otherwise, the card will not be visible. 48381 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { className: "dataforms-layouts-card__field-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48382 RegularLayout, 48383 { 48384 data, 48385 field, 48386 onChange, 48387 hideLabelFromVision: hideLabelFromVision || withHeader, 48388 validity 48389 } 48390 ) }) 48391 ] }); 48392 } 48393 48394 48395 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/row/index.js 48396 48397 48398 48399 48400 48401 48402 48403 48404 function row_Header({ title }) { 48405 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-row__header", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [ 48406 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }), 48407 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}) 48408 ] }) }); 48409 } 48410 const EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children }); 48411 function FormRowField({ 48412 data, 48413 field, 48414 onChange, 48415 hideLabelFromVision, 48416 validity 48417 }) { 48418 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default); 48419 const layout = normalizeLayout({ 48420 ...field.layout, 48421 type: "row" 48422 }); 48423 if (isCombinedField(field)) { 48424 const form = { 48425 fields: field.children.map((child) => { 48426 if (typeof child === "string") { 48427 return { id: child }; 48428 } 48429 return child; 48430 }) 48431 }; 48432 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataforms-layouts-row__field", children: [ 48433 !hideLabelFromVision && field.label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(row_Header, { title: field.label }), 48434 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: layout.alignment, spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48435 DataFormLayout, 48436 { 48437 data, 48438 form, 48439 onChange, 48440 validity: validity?.children, 48441 as: EMPTY_WRAPPER, 48442 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48443 "div", 48444 { 48445 className: "dataforms-layouts-row__field-control", 48446 style: layout.styles[childField.id], 48447 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48448 FieldLayout, 48449 { 48450 data, 48451 field: childField, 48452 onChange, 48453 hideLabelFromVision, 48454 validity: childFieldValidity 48455 } 48456 ) 48457 }, 48458 childField.id 48459 ) 48460 } 48461 ) }) 48462 ] }); 48463 } 48464 const fieldDefinition = fields.find((f) => f.id === field.id); 48465 if (!fieldDefinition || !fieldDefinition.Edit) { 48466 return null; 48467 } 48468 const RegularLayout = getFormFieldLayout("regular")?.component; 48469 if (!RegularLayout) { 48470 return null; 48471 } 48472 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48473 RegularLayout, 48474 { 48475 data, 48476 field: fieldDefinition, 48477 onChange, 48478 validity 48479 } 48480 ) }) }); 48481 } 48482 48483 48484 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/index.js 48485 48486 48487 48488 48489 48490 48491 const FORM_FIELD_LAYOUTS = [ 48492 { 48493 type: "regular", 48494 component: FormRegularField, 48495 wrapper: ({ 48496 children, 48497 layout 48498 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48499 external_wp_components_namespaceObject.__experimentalVStack, 48500 { 48501 className: "dataforms-layouts__wrapper", 48502 spacing: layout?.spacing ?? 4, 48503 children 48504 } 48505 ) 48506 }, 48507 { 48508 type: "panel", 48509 component: FormPanelField, 48510 wrapper: ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 2, children }) 48511 }, 48512 { 48513 type: "card", 48514 component: FormCardField, 48515 wrapper: ({ 48516 children, 48517 layout 48518 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48519 external_wp_components_namespaceObject.__experimentalVStack, 48520 { 48521 className: "dataforms-layouts__wrapper", 48522 spacing: layout?.spacing ?? 6, 48523 children 48524 } 48525 ) 48526 }, 48527 { 48528 type: "row", 48529 component: FormRowField, 48530 wrapper: ({ 48531 children, 48532 layout 48533 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48534 external_wp_components_namespaceObject.__experimentalHStack, 48535 { 48536 spacing: 4, 48537 alignment: layout.alignment, 48538 children 48539 } 48540 ) }) }) 48541 } 48542 ]; 48543 function getFormFieldLayout(type) { 48544 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type); 48545 } 48546 48547 48548 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/data-form-layout.js 48549 48550 48551 48552 48553 48554 48555 48556 const DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children }); 48557 function DataFormLayout({ 48558 data, 48559 form, 48560 onChange, 48561 validity, 48562 children, 48563 as 48564 }) { 48565 const { fields: fieldDefinitions } = (0,external_wp_element_.useContext)(dataform_context_default); 48566 function getFieldDefinition(field) { 48567 const fieldId = typeof field === "string" ? field : field.id; 48568 return fieldDefinitions.find( 48569 (fieldDefinition) => fieldDefinition.id === fieldId 48570 ); 48571 } 48572 const normalizedFormFields = (0,external_wp_element_.useMemo)( 48573 () => normalizeFormFields(form), 48574 [form] 48575 ); 48576 const normalizedFormLayout = normalizeLayout(form.layout); 48577 const Wrapper = as ?? getFormFieldLayout(normalizedFormLayout.type)?.wrapper ?? DEFAULT_WRAPPER; 48578 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { layout: normalizedFormLayout, children: normalizedFormFields.map((formField) => { 48579 const FieldLayout = getFormFieldLayout(formField.layout.type)?.component; 48580 if (!FieldLayout) { 48581 return null; 48582 } 48583 const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : void 0; 48584 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { 48585 return null; 48586 } 48587 if (children) { 48588 return children( 48589 FieldLayout, 48590 formField, 48591 validity?.[formField.id] 48592 ); 48593 } 48594 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48595 FieldLayout, 48596 { 48597 data, 48598 field: formField, 48599 onChange, 48600 validity: validity?.[formField.id] 48601 }, 48602 formField.id 48603 ); 48604 }) }); 48605 } 48606 48607 48608 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js 48609 48610 48611 48612 48613 48614 function DataForm({ 48615 data, 48616 form, 48617 fields, 48618 onChange, 48619 validity 48620 }) { 48621 const normalizedFields = (0,external_wp_element_.useMemo)( 48622 () => normalizeFields(fields), 48623 [fields] 48624 ); 48625 if (!form.fields) { 48626 return null; 48627 } 48628 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48629 DataFormLayout, 48630 { 48631 data, 48632 form, 48633 onChange, 48634 validity 48635 } 48636 ) }); 48637 } 48638 48639 48640 ;// ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js 48641 48642 48643 48644 48645 48646 48647 48648 48649 48650 48651 48652 48653 48654 const { usePostFields: post_edit_usePostFields, PostCardPanel } = unlock(external_wp_editor_namespaceObject.privateApis); 48655 const fieldsWithBulkEditSupport = [ 48656 "title", 48657 "status", 48658 "date", 48659 "author", 48660 "discussion" 48661 ]; 48662 function PostEditForm({ postType, postId }) { 48663 const ids = (0,external_wp_element_.useMemo)(() => postId.split(","), [postId]); 48664 const { record, hasFinishedResolution } = (0,external_wp_data_.useSelect)( 48665 (select) => { 48666 const args = ["postType", postType, ids[0]]; 48667 const { 48668 getEditedEntityRecord, 48669 hasFinishedResolution: hasFinished 48670 } = select(external_wp_coreData_namespaceObject.store); 48671 return { 48672 record: ids.length === 1 ? getEditedEntityRecord(...args) : null, 48673 hasFinishedResolution: hasFinished( 48674 "getEditedEntityRecord", 48675 args 48676 ) 48677 }; 48678 }, 48679 [postType, ids] 48680 ); 48681 const [multiEdits, setMultiEdits] = (0,external_wp_element_.useState)({}); 48682 const { editEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); 48683 const _fields = post_edit_usePostFields({ postType }); 48684 const fields = (0,external_wp_element_.useMemo)( 48685 () => _fields?.map((field) => { 48686 if (field.id === "status") { 48687 return { 48688 ...field, 48689 elements: field.elements.filter( 48690 (element) => element.value !== "trash" 48691 ) 48692 }; 48693 } 48694 return field; 48695 }), 48696 [_fields] 48697 ); 48698 const form = (0,external_wp_element_.useMemo)( 48699 () => ({ 48700 layout: { 48701 type: "panel" 48702 }, 48703 fields: [ 48704 { 48705 id: "featured_media", 48706 layout: { 48707 type: "regular" 48708 } 48709 }, 48710 { 48711 id: "status", 48712 label: (0,external_wp_i18n_namespaceObject.__)("Status & Visibility"), 48713 children: ["status", "password"] 48714 }, 48715 "author", 48716 "date", 48717 "slug", 48718 "parent", 48719 { 48720 id: "discussion", 48721 label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), 48722 children: ["comment_status", "ping_status"] 48723 }, 48724 { 48725 label: (0,external_wp_i18n_namespaceObject.__)("Template"), 48726 id: "template", 48727 layout: { 48728 type: "regular", 48729 labelPosition: "side" 48730 } 48731 } 48732 ].filter( 48733 (field) => ids.length === 1 || fieldsWithBulkEditSupport.includes( 48734 typeof field === "string" ? field : field.id 48735 ) 48736 ) 48737 }), 48738 [ids] 48739 ); 48740 const onChange = (edits) => { 48741 for (const id of ids) { 48742 if (edits.status && edits.status !== "future" && record?.status === "future" && new Date(record.date) > /* @__PURE__ */ new Date()) { 48743 edits.date = null; 48744 } 48745 if (edits.status && edits.status === "private" && record.password) { 48746 edits.password = ""; 48747 } 48748 editEntityRecord("postType", postType, id, edits); 48749 if (ids.length > 1) { 48750 setMultiEdits((prev) => ({ 48751 ...prev, 48752 ...edits 48753 })); 48754 } 48755 } 48756 }; 48757 (0,external_wp_element_.useEffect)(() => { 48758 setMultiEdits({}); 48759 }, [ids]); 48760 const { ExperimentalBlockEditorProvider } = unlock( 48761 external_wp_blockEditor_namespaceObject.privateApis 48762 ); 48763 const settings = usePatternSettings(); 48764 const fieldsWithDependency = (0,external_wp_element_.useMemo)(() => { 48765 return fields.map((field) => { 48766 if (field.id === "template") { 48767 return { 48768 ...field, 48769 Edit: (data) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { ...data }) }) 48770 }; 48771 } 48772 return field; 48773 }); 48774 }, [fields, settings]); 48775 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 48776 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { postType, postId: ids }), 48777 hasFinishedResolution && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48778 DataForm, 48779 { 48780 data: ids.length === 1 ? record : multiEdits, 48781 fields: fieldsWithDependency, 48782 form, 48783 onChange 48784 } 48785 ) 48786 ] }); 48787 } 48788 function PostEdit({ postType, postId }) { 48789 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 48790 page_page_default, 48791 { 48792 className: dist_clsx("edit-site-post-edit", { 48793 "is-empty": !postId 48794 }), 48795 label: (0,external_wp_i18n_namespaceObject.__)("Post Edit"), 48796 children: [ 48797 postId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { postType, postId }), 48798 !postId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Select a page to edit") }) 48799 ] 48800 } 48801 ); 48802 } 48803 48804 48805 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pages.js 48806 48807 48808 48809 48810 48811 48812 48813 48814 48815 48816 48817 48818 48819 48820 const { useLocation: pages_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 48821 async function isListView(query) { 48822 const { activeView = "all" } = query; 48823 const postTypeObject = await (0,external_wp_data_.resolveSelect)(external_wp_coreData_namespaceObject.store).getPostType("page"); 48824 const view = await (0,build_module.loadView)({ 48825 kind: "postType", 48826 name: "page", 48827 slug: activeView, 48828 defaultView: view_utils_getDefaultView(postTypeObject, activeView) 48829 }); 48830 return view.type === "list"; 48831 } 48832 function MobilePagesView() { 48833 const { query = {} } = pages_useLocation(); 48834 const { canvas = "view" } = query; 48835 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" }); 48836 } 48837 const pagesRoute = { 48838 name: "pages", 48839 path: "/page", 48840 areas: { 48841 sidebar({ siteData }) { 48842 const isBlockTheme = siteData.currentTheme?.is_block_theme; 48843 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48844 SidebarNavigationScreen, 48845 { 48846 title: (0,external_wp_i18n_namespaceObject.__)("Pages"), 48847 backPath: "/", 48848 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" }) 48849 } 48850 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 48851 }, 48852 content({ siteData }) { 48853 const isBlockTheme = siteData.currentTheme?.is_block_theme; 48854 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" }) : void 0; 48855 }, 48856 async preview({ query, siteData }) { 48857 const isBlockTheme = siteData.currentTheme?.is_block_theme; 48858 if (!isBlockTheme) { 48859 return void 0; 48860 } 48861 const isList = await isListView(query); 48862 return isList ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0; 48863 }, 48864 mobile({ siteData }) { 48865 const isBlockTheme = siteData.currentTheme?.is_block_theme; 48866 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePagesView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 48867 }, 48868 async edit({ query }) { 48869 const isList = await isListView(query); 48870 const hasQuickEdit = !isList && !!query.quickEdit; 48871 return hasQuickEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "page", postId: query.postId }) : void 0; 48872 } 48873 }, 48874 widths: { 48875 async content({ query }) { 48876 const isList = await isListView(query); 48877 return isList ? 380 : void 0; 48878 }, 48879 async edit({ query }) { 48880 const isList = await isListView(query); 48881 const hasQuickEdit = !isList && !!query.quickEdit; 48882 return hasQuickEdit ? 380 : void 0; 48883 } 48884 } 48885 }; 48886 48887 48888 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/page-item.js 48889 48890 48891 48892 48893 48894 48895 const pageItemRoute = { 48896 name: "page-item", 48897 path: "/page/:postId", 48898 areas: { 48899 sidebar({ siteData }) { 48900 const isBlockTheme = siteData.currentTheme?.is_block_theme; 48901 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48902 SidebarNavigationScreen, 48903 { 48904 title: (0,external_wp_i18n_namespaceObject.__)("Pages"), 48905 backPath: "/", 48906 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" }) 48907 } 48908 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 48909 }, 48910 mobile({ siteData }) { 48911 const isBlockTheme = siteData.currentTheme?.is_block_theme; 48912 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 48913 }, 48914 preview({ siteData }) { 48915 const isBlockTheme = siteData.currentTheme?.is_block_theme; 48916 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 48917 } 48918 } 48919 }; 48920 48921 48922 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/stylebook.js 48923 48924 48925 48926 48927 48928 48929 const stylebookRoute = { 48930 name: "stylebook", 48931 path: "/stylebook", 48932 areas: { 48933 sidebar({ siteData }) { 48934 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48935 SidebarNavigationScreen, 48936 { 48937 title: (0,external_wp_i18n_namespaceObject.__)("Styles"), 48938 backPath: "/", 48939 description: (0,external_wp_i18n_namespaceObject.__)( 48940 `Preview your website's visual identity: colors, typography, and blocks.` 48941 ) 48942 } 48943 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 48944 }, 48945 preview({ siteData }) { 48946 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : void 0; 48947 }, 48948 mobile({ siteData }) { 48949 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : void 0; 48950 } 48951 } 48952 }; 48953 48954 48955 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/notfound.js 48956 48957 48958 48959 48960 function NotFoundError() { 48961 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)( 48962 "The requested page could not be found. Please check the URL." 48963 ) }); 48964 } 48965 const notFoundRoute = { 48966 name: "notfound", 48967 path: "*", 48968 areas: { 48969 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), 48970 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48971 SidebarNavigationScreenMain, 48972 { 48973 customDescription: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) 48974 } 48975 ), 48976 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) }) 48977 } 48978 }; 48979 48980 48981 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/index.js 48982 48983 48984 48985 48986 48987 48988 48989 48990 48991 48992 48993 48994 48995 48996 48997 48998 48999 const site_editor_routes_routes = [ 49000 pageItemRoute, 49001 pagesRoute, 49002 templateItemRoute, 49003 templatesRoute, 49004 templatePartItemRoute, 49005 patternItemRoute, 49006 patternsRoute, 49007 navigationItemRoute, 49008 navigationRoute, 49009 stylesRoute, 49010 homeRoute, 49011 stylebookRoute, 49012 notFoundRoute 49013 ]; 49014 function useRegisterSiteEditorRoutes() { 49015 const registry = (0,external_wp_data_.useRegistry)(); 49016 const { registerRoute } = unlock((0,external_wp_data_.useDispatch)(store)); 49017 (0,external_wp_element_.useEffect)(() => { 49018 registry.batch(() => { 49019 site_editor_routes_routes.forEach(registerRoute); 49020 }); 49021 }, [registry, registerRoute]); 49022 } 49023 49024 49025 ;// ./node_modules/@wordpress/edit-site/build-module/components/app/index.js 49026 49027 49028 49029 49030 49031 49032 49033 49034 49035 49036 49037 49038 const { RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis); 49039 function AppLayout() { 49040 useCommonCommands(); 49041 useSetCommandContext(); 49042 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}); 49043 } 49044 function App() { 49045 useRegisterSiteEditorRoutes(); 49046 const { routes, currentTheme, editorSettings } = (0,external_wp_data_.useSelect)((select) => { 49047 return { 49048 routes: unlock(select(store)).getRoutes(), 49049 currentTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), 49050 // This is a temp solution until the has_theme_json value is available for the current theme. 49051 editorSettings: select(store).getSettings() 49052 }; 49053 }, []); 49054 const beforeNavigate = (0,external_wp_element_.useCallback)(({ path, query }) => { 49055 if (!isPreviewingTheme()) { 49056 return { path, query }; 49057 } 49058 return { 49059 path, 49060 query: { 49061 ...query, 49062 wp_theme_preview: "wp_theme_preview" in query ? query.wp_theme_preview : currentlyPreviewingTheme() 49063 } 49064 }; 49065 }, []); 49066 const matchResolverArgsValue = (0,external_wp_element_.useMemo)( 49067 () => ({ 49068 siteData: { currentTheme, editorSettings } 49069 }), 49070 [currentTheme, editorSettings] 49071 ); 49072 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49073 RouterProvider, 49074 { 49075 routes, 49076 pathArg: "p", 49077 beforeNavigate, 49078 matchResolverArgs: matchResolverArgsValue, 49079 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {}) 49080 } 49081 ); 49082 } 49083 49084 49085 ;// ./node_modules/@wordpress/edit-site/build-module/deprecated.js 49086 49087 49088 49089 49090 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes( 49091 "site-editor.php" 49092 ); 49093 const deprecateSlot = (name) => { 49094 external_wp_deprecated_default()(`wp.editPost.$name}`, { 49095 since: "6.6", 49096 alternative: `wp.editor.$name}` 49097 }); 49098 }; 49099 function PluginMoreMenuItem(props) { 49100 if (!isSiteEditor) { 49101 return null; 49102 } 49103 deprecateSlot("PluginMoreMenuItem"); 49104 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { ...props }); 49105 } 49106 function PluginSidebar(props) { 49107 if (!isSiteEditor) { 49108 return null; 49109 } 49110 deprecateSlot("PluginSidebar"); 49111 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { ...props }); 49112 } 49113 function PluginSidebarMoreMenuItem(props) { 49114 if (!isSiteEditor) { 49115 return null; 49116 } 49117 deprecateSlot("PluginSidebarMoreMenuItem"); 49118 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { ...props }); 49119 } 49120 49121 49122 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/posts.js 49123 49124 49125 49126 49127 49128 49129 49130 49131 49132 49133 49134 49135 49136 const { useLocation: posts_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); 49137 async function posts_isListView(query) { 49138 const { activeView = "all" } = query; 49139 const postTypeObject = await (0,external_wp_data_.resolveSelect)(external_wp_coreData_namespaceObject.store).getPostType("post"); 49140 const view = await (0,build_module.loadView)({ 49141 kind: "postType", 49142 name: "post", 49143 slug: activeView, 49144 defaultView: view_utils_getDefaultView(postTypeObject, activeView) 49145 }); 49146 return view.type === "list"; 49147 } 49148 function MobilePostsView() { 49149 const { query = {} } = posts_useLocation(); 49150 const { canvas = "view" } = query; 49151 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" }); 49152 } 49153 const postsRoute = { 49154 name: "posts", 49155 path: "/", 49156 areas: { 49157 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49158 SidebarNavigationScreen, 49159 { 49160 title: (0,external_wp_i18n_namespaceObject.__)("Posts"), 49161 isRoot: true, 49162 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" }) 49163 } 49164 ), 49165 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" }), 49166 async preview({ query }) { 49167 const isList = await posts_isListView(query); 49168 return isList ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }) : void 0; 49169 }, 49170 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePostsView, {}), 49171 async edit({ query }) { 49172 const isList = await posts_isListView(query); 49173 const hasQuickEdit = !isList && !!query.quickEdit; 49174 return hasQuickEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "post", postId: query.postId }) : void 0; 49175 } 49176 }, 49177 widths: { 49178 async content({ query }) { 49179 const isList = await posts_isListView(query); 49180 return isList ? 380 : void 0; 49181 }, 49182 async edit({ query }) { 49183 const isList = await posts_isListView(query); 49184 const hasQuickEdit = !isList && !!query.quickEdit; 49185 return hasQuickEdit ? 380 : void 0; 49186 } 49187 } 49188 }; 49189 49190 49191 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/post-item.js 49192 49193 49194 49195 49196 49197 const postItemRoute = { 49198 name: "post-item", 49199 path: "/post/:postId", 49200 areas: { 49201 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49202 SidebarNavigationScreen, 49203 { 49204 title: (0,external_wp_i18n_namespaceObject.__)("Posts"), 49205 isRoot: true, 49206 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" }) 49207 } 49208 ), 49209 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }), 49210 preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }) 49211 } 49212 }; 49213 49214 49215 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/index.js 49216 49217 49218 49219 49220 49221 49222 const posts_app_routes_routes = [postItemRoute, postsRoute]; 49223 function useRegisterPostsAppRoutes() { 49224 const registry = (0,external_wp_data_.useRegistry)(); 49225 const { registerRoute } = unlock((0,external_wp_data_.useDispatch)(store)); 49226 (0,external_wp_element_.useEffect)(() => { 49227 registry.batch(() => { 49228 posts_app_routes_routes.forEach(registerRoute); 49229 }); 49230 }, [registry, registerRoute]); 49231 } 49232 49233 49234 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js 49235 49236 49237 49238 49239 49240 49241 49242 const { RouterProvider: posts_app_RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis); 49243 function PostsApp() { 49244 useRegisterPostsAppRoutes(); 49245 const routes = (0,external_wp_data_.useSelect)((select) => { 49246 return unlock(select(store)).getRoutes(); 49247 }, []); 49248 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { routes, pathArg: "p", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}) }); 49249 } 49250 49251 49252 ;// ./node_modules/@wordpress/edit-site/build-module/posts.js 49253 49254 49255 49256 49257 49258 49259 49260 49261 49262 49263 function initializePostsDashboard(id, settings) { 49264 if (true) { 49265 return; 49266 } 49267 const target = document.getElementById(id); 49268 const root = (0,external_wp_element_.createRoot)(target); 49269 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 49270 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter( 49271 ({ name }) => name !== "core/freeform" 49272 ); 49273 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 49274 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName("core/html"); 49275 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false }); 49276 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false }); 49277 if (false) {} 49278 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/edit-site", { 49279 welcomeGuide: true, 49280 welcomeGuideStyles: true, 49281 welcomeGuidePage: true, 49282 welcomeGuideTemplate: true 49283 }); 49284 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core", { 49285 allowRightClickOverrides: true, 49286 distractionFree: false, 49287 editorMode: "visual", 49288 editorTool: "edit", 49289 fixedToolbar: false, 49290 focusMode: false, 49291 inactivePanels: [], 49292 keepCaretInsideBlock: false, 49293 openPanels: ["post-status"], 49294 showBlockBreadcrumbs: true, 49295 showListViewByDefault: false, 49296 enableChoosePatternModal: true 49297 }); 49298 (0,external_wp_data_.dispatch)(store).updateSettings(settings); 49299 window.addEventListener("dragover", (e) => e.preventDefault(), false); 49300 window.addEventListener("drop", (e) => e.preventDefault(), false); 49301 root.render( 49302 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) }) 49303 ); 49304 return root; 49305 } 49306 49307 49308 ;// ./node_modules/@wordpress/edit-site/build-module/index.js 49309 49310 49311 49312 49313 49314 49315 49316 49317 49318 49319 49320 49321 49322 const { registerCoreBlockBindingsSources } = unlock(external_wp_editor_namespaceObject.privateApis); 49323 function initializeEditor(id, settings) { 49324 const target = document.getElementById(id); 49325 const root = (0,external_wp_element_.createRoot)(target); 49326 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 49327 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter( 49328 ({ name }) => name !== "core/freeform" 49329 ); 49330 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 49331 registerCoreBlockBindingsSources(); 49332 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName("core/html"); 49333 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false }); 49334 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false }); 49335 if (false) {} 49336 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/edit-site", { 49337 welcomeGuide: true, 49338 welcomeGuideStyles: true, 49339 welcomeGuidePage: true, 49340 welcomeGuideTemplate: true 49341 }); 49342 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core", { 49343 allowRightClickOverrides: true, 49344 distractionFree: false, 49345 editorMode: "visual", 49346 editorTool: "edit", 49347 fixedToolbar: false, 49348 focusMode: false, 49349 inactivePanels: [], 49350 keepCaretInsideBlock: false, 49351 openPanels: ["post-status"], 49352 showBlockBreadcrumbs: true, 49353 showListViewByDefault: false, 49354 enableChoosePatternModal: true 49355 }); 49356 if (window.__experimentalMediaProcessing) { 49357 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/media", { 49358 requireApproval: true, 49359 optimizeOnUpload: true 49360 }); 49361 } 49362 (0,external_wp_data_.dispatch)(store).updateSettings(settings); 49363 window.addEventListener("dragover", (e) => e.preventDefault(), false); 49364 window.addEventListener("drop", (e) => e.preventDefault(), false); 49365 root.render( 49366 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) }) 49367 ); 49368 return root; 49369 } 49370 function reinitializeEditor() { 49371 external_wp_deprecated_default()("wp.editSite.reinitializeEditor", { 49372 since: "6.2", 49373 version: "6.3" 49374 }); 49375 } 49376 49377 49378 49379 49380 49381 49382 })(); 49383 49384 (window.wp = window.wp || {}).editSite = __webpack_exports__; 49385 /******/ })() 49386 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Oct 23 08:20:05 2025 | Cross-referenced by PHPXref |