[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 4660: 5 /***/ ((module) => { 6 7 /** 8 * Credits: 9 * 10 * lib-font 11 * https://github.com/Pomax/lib-font 12 * https://github.com/Pomax/lib-font/blob/master/lib/inflate.js 13 * 14 * The MIT License (MIT) 15 * 16 * Copyright (c) 2020 pomax@nihongoresources.com 17 * 18 * Permission is hereby granted, free of charge, to any person obtaining a copy 19 * of this software and associated documentation files (the "Software"), to deal 20 * in the Software without restriction, including without limitation the rights 21 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 * copies of the Software, and to permit persons to whom the Software is 23 * furnished to do so, subject to the following conditions: 24 * 25 * The above copyright notice and this permission notice shall be included in all 26 * copies or substantial portions of the Software. 27 * 28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 * SOFTWARE. 35 */ 36 37 /* eslint eslint-comments/no-unlimited-disable: 0 */ 38 /* eslint-disable */ 39 /* 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){ 40 'use strict'; 41 42 43 var TYPED_OK = (typeof Uint8Array !== 'undefined') && 44 (typeof Uint16Array !== 'undefined') && 45 (typeof Int32Array !== 'undefined'); 46 47 function _has(obj, key) { 48 return Object.prototype.hasOwnProperty.call(obj, key); 49 } 50 51 exports.assign = function (obj /*from1, from2, from3, ...*/) { 52 var sources = Array.prototype.slice.call(arguments, 1); 53 while (sources.length) { 54 var source = sources.shift(); 55 if (!source) { continue; } 56 57 if (typeof source !== 'object') { 58 throw new TypeError(source + 'must be non-object'); 59 } 60 61 for (var p in source) { 62 if (_has(source, p)) { 63 obj[p] = source[p]; 64 } 65 } 66 } 67 68 return obj; 69 }; 70 71 72 // reduce buffer size, avoiding mem copy 73 exports.shrinkBuf = function (buf, size) { 74 if (buf.length === size) { return buf; } 75 if (buf.subarray) { return buf.subarray(0, size); } 76 buf.length = size; 77 return buf; 78 }; 79 80 81 var fnTyped = { 82 arraySet: function (dest, src, src_offs, len, dest_offs) { 83 if (src.subarray && dest.subarray) { 84 dest.set(src.subarray(src_offs, src_offs + len), dest_offs); 85 return; 86 } 87 // Fallback to ordinary array 88 for (var i = 0; i < len; i++) { 89 dest[dest_offs + i] = src[src_offs + i]; 90 } 91 }, 92 // Join array of chunks to single array. 93 flattenChunks: function (chunks) { 94 var i, l, len, pos, chunk, result; 95 96 // calculate data length 97 len = 0; 98 for (i = 0, l = chunks.length; i < l; i++) { 99 len += chunks[i].length; 100 } 101 102 // join chunks 103 result = new Uint8Array(len); 104 pos = 0; 105 for (i = 0, l = chunks.length; i < l; i++) { 106 chunk = chunks[i]; 107 result.set(chunk, pos); 108 pos += chunk.length; 109 } 110 111 return result; 112 } 113 }; 114 115 var fnUntyped = { 116 arraySet: function (dest, src, src_offs, len, dest_offs) { 117 for (var i = 0; i < len; i++) { 118 dest[dest_offs + i] = src[src_offs + i]; 119 } 120 }, 121 // Join array of chunks to single array. 122 flattenChunks: function (chunks) { 123 return [].concat.apply([], chunks); 124 } 125 }; 126 127 128 // Enable/Disable typed arrays use, for testing 129 // 130 exports.setTyped = function (on) { 131 if (on) { 132 exports.Buf8 = Uint8Array; 133 exports.Buf16 = Uint16Array; 134 exports.Buf32 = Int32Array; 135 exports.assign(exports, fnTyped); 136 } else { 137 exports.Buf8 = Array; 138 exports.Buf16 = Array; 139 exports.Buf32 = Array; 140 exports.assign(exports, fnUntyped); 141 } 142 }; 143 144 exports.setTyped(TYPED_OK); 145 146 },{}],2:[function(require,module,exports){ 147 // String encode/decode helpers 148 'use strict'; 149 150 151 var utils = require('./common'); 152 153 154 // Quick check if we can use fast array to bin string conversion 155 // 156 // - apply(Array) can fail on Android 2.2 157 // - apply(Uint8Array) can fail on iOS 5.1 Safari 158 // 159 var STR_APPLY_OK = true; 160 var STR_APPLY_UIA_OK = true; 161 162 try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } 163 try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } 164 165 166 // Table with utf8 lengths (calculated by first byte of sequence) 167 // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, 168 // because max possible codepoint is 0x10ffff 169 var _utf8len = new utils.Buf8(256); 170 for (var q = 0; q < 256; q++) { 171 _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); 172 } 173 _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start 174 175 176 // convert string to array (typed, when possible) 177 exports.string2buf = function (str) { 178 var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; 179 180 // count binary size 181 for (m_pos = 0; m_pos < str_len; m_pos++) { 182 c = str.charCodeAt(m_pos); 183 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 184 c2 = str.charCodeAt(m_pos + 1); 185 if ((c2 & 0xfc00) === 0xdc00) { 186 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 187 m_pos++; 188 } 189 } 190 buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; 191 } 192 193 // allocate buffer 194 buf = new utils.Buf8(buf_len); 195 196 // convert 197 for (i = 0, m_pos = 0; i < buf_len; m_pos++) { 198 c = str.charCodeAt(m_pos); 199 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 200 c2 = str.charCodeAt(m_pos + 1); 201 if ((c2 & 0xfc00) === 0xdc00) { 202 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 203 m_pos++; 204 } 205 } 206 if (c < 0x80) { 207 /* one byte */ 208 buf[i++] = c; 209 } else if (c < 0x800) { 210 /* two bytes */ 211 buf[i++] = 0xC0 | (c >>> 6); 212 buf[i++] = 0x80 | (c & 0x3f); 213 } else if (c < 0x10000) { 214 /* three bytes */ 215 buf[i++] = 0xE0 | (c >>> 12); 216 buf[i++] = 0x80 | (c >>> 6 & 0x3f); 217 buf[i++] = 0x80 | (c & 0x3f); 218 } else { 219 /* four bytes */ 220 buf[i++] = 0xf0 | (c >>> 18); 221 buf[i++] = 0x80 | (c >>> 12 & 0x3f); 222 buf[i++] = 0x80 | (c >>> 6 & 0x3f); 223 buf[i++] = 0x80 | (c & 0x3f); 224 } 225 } 226 227 return buf; 228 }; 229 230 // Helper (used in 2 places) 231 function buf2binstring(buf, len) { 232 // On Chrome, the arguments in a function call that are allowed is `65534`. 233 // If the length of the buffer is smaller than that, we can use this optimization, 234 // otherwise we will take a slower path. 235 if (len < 65534) { 236 if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { 237 return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); 238 } 239 } 240 241 var result = ''; 242 for (var i = 0; i < len; i++) { 243 result += String.fromCharCode(buf[i]); 244 } 245 return result; 246 } 247 248 249 // Convert byte array to binary string 250 exports.buf2binstring = function (buf) { 251 return buf2binstring(buf, buf.length); 252 }; 253 254 255 // Convert binary string (typed, when possible) 256 exports.binstring2buf = function (str) { 257 var buf = new utils.Buf8(str.length); 258 for (var i = 0, len = buf.length; i < len; i++) { 259 buf[i] = str.charCodeAt(i); 260 } 261 return buf; 262 }; 263 264 265 // convert array to string 266 exports.buf2string = function (buf, max) { 267 var i, out, c, c_len; 268 var len = max || buf.length; 269 270 // Reserve max possible length (2 words per char) 271 // NB: by unknown reasons, Array is significantly faster for 272 // String.fromCharCode.apply than Uint16Array. 273 var utf16buf = new Array(len * 2); 274 275 for (out = 0, i = 0; i < len;) { 276 c = buf[i++]; 277 // quick process ascii 278 if (c < 0x80) { utf16buf[out++] = c; continue; } 279 280 c_len = _utf8len[c]; 281 // skip 5 & 6 byte codes 282 if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } 283 284 // apply mask on first byte 285 c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; 286 // join the rest 287 while (c_len > 1 && i < len) { 288 c = (c << 6) | (buf[i++] & 0x3f); 289 c_len--; 290 } 291 292 // terminated by end of string? 293 if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } 294 295 if (c < 0x10000) { 296 utf16buf[out++] = c; 297 } else { 298 c -= 0x10000; 299 utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); 300 utf16buf[out++] = 0xdc00 | (c & 0x3ff); 301 } 302 } 303 304 return buf2binstring(utf16buf, out); 305 }; 306 307 308 // Calculate max possible position in utf8 buffer, 309 // that will not break sequence. If that's not possible 310 // - (very small limits) return max size as is. 311 // 312 // buf[] - utf8 bytes array 313 // max - length limit (mandatory); 314 exports.utf8border = function (buf, max) { 315 var pos; 316 317 max = max || buf.length; 318 if (max > buf.length) { max = buf.length; } 319 320 // go back from last position, until start of sequence found 321 pos = max - 1; 322 while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } 323 324 // Very small and broken sequence, 325 // return max, because we should return something anyway. 326 if (pos < 0) { return max; } 327 328 // If we came to start of buffer - that means buffer is too small, 329 // return max too. 330 if (pos === 0) { return max; } 331 332 return (pos + _utf8len[buf[pos]] > max) ? pos : max; 333 }; 334 335 },{"./common":1}],3:[function(require,module,exports){ 336 'use strict'; 337 338 // Note: adler32 takes 12% for level 0 and 2% for level 6. 339 // It isn't worth it to make additional optimizations as in original. 340 // Small size is preferable. 341 342 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 343 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 344 // 345 // This software is provided 'as-is', without any express or implied 346 // warranty. In no event will the authors be held liable for any damages 347 // arising from the use of this software. 348 // 349 // Permission is granted to anyone to use this software for any purpose, 350 // including commercial applications, and to alter it and redistribute it 351 // freely, subject to the following restrictions: 352 // 353 // 1. The origin of this software must not be misrepresented; you must not 354 // claim that you wrote the original software. If you use this software 355 // in a product, an acknowledgment in the product documentation would be 356 // appreciated but is not required. 357 // 2. Altered source versions must be plainly marked as such, and must not be 358 // misrepresented as being the original software. 359 // 3. This notice may not be removed or altered from any source distribution. 360 361 function adler32(adler, buf, len, pos) { 362 var s1 = (adler & 0xffff) |0, 363 s2 = ((adler >>> 16) & 0xffff) |0, 364 n = 0; 365 366 while (len !== 0) { 367 // Set limit ~ twice less than 5552, to keep 368 // s2 in 31-bits, because we force signed ints. 369 // in other case %= will fail. 370 n = len > 2000 ? 2000 : len; 371 len -= n; 372 373 do { 374 s1 = (s1 + buf[pos++]) |0; 375 s2 = (s2 + s1) |0; 376 } while (--n); 377 378 s1 %= 65521; 379 s2 %= 65521; 380 } 381 382 return (s1 | (s2 << 16)) |0; 383 } 384 385 386 module.exports = adler32; 387 388 },{}],4:[function(require,module,exports){ 389 'use strict'; 390 391 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 392 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 393 // 394 // This software is provided 'as-is', without any express or implied 395 // warranty. In no event will the authors be held liable for any damages 396 // arising from the use of this software. 397 // 398 // Permission is granted to anyone to use this software for any purpose, 399 // including commercial applications, and to alter it and redistribute it 400 // freely, subject to the following restrictions: 401 // 402 // 1. The origin of this software must not be misrepresented; you must not 403 // claim that you wrote the original software. If you use this software 404 // in a product, an acknowledgment in the product documentation would be 405 // appreciated but is not required. 406 // 2. Altered source versions must be plainly marked as such, and must not be 407 // misrepresented as being the original software. 408 // 3. This notice may not be removed or altered from any source distribution. 409 410 module.exports = { 411 412 /* Allowed flush values; see deflate() and inflate() below for details */ 413 Z_NO_FLUSH: 0, 414 Z_PARTIAL_FLUSH: 1, 415 Z_SYNC_FLUSH: 2, 416 Z_FULL_FLUSH: 3, 417 Z_FINISH: 4, 418 Z_BLOCK: 5, 419 Z_TREES: 6, 420 421 /* Return codes for the compression/decompression functions. Negative values 422 * are errors, positive values are used for special but normal events. 423 */ 424 Z_OK: 0, 425 Z_STREAM_END: 1, 426 Z_NEED_DICT: 2, 427 Z_ERRNO: -1, 428 Z_STREAM_ERROR: -2, 429 Z_DATA_ERROR: -3, 430 //Z_MEM_ERROR: -4, 431 Z_BUF_ERROR: -5, 432 //Z_VERSION_ERROR: -6, 433 434 /* compression levels */ 435 Z_NO_COMPRESSION: 0, 436 Z_BEST_SPEED: 1, 437 Z_BEST_COMPRESSION: 9, 438 Z_DEFAULT_COMPRESSION: -1, 439 440 441 Z_FILTERED: 1, 442 Z_HUFFMAN_ONLY: 2, 443 Z_RLE: 3, 444 Z_FIXED: 4, 445 Z_DEFAULT_STRATEGY: 0, 446 447 /* Possible values of the data_type field (though see inflate()) */ 448 Z_BINARY: 0, 449 Z_TEXT: 1, 450 //Z_ASCII: 1, // = Z_TEXT (deprecated) 451 Z_UNKNOWN: 2, 452 453 /* The deflate compression method */ 454 Z_DEFLATED: 8 455 //Z_NULL: null // Use -1 or null inline, depending on var type 456 }; 457 458 },{}],5:[function(require,module,exports){ 459 'use strict'; 460 461 // Note: we can't get significant speed boost here. 462 // So write code to minimize size - no pregenerated tables 463 // and array tools dependencies. 464 465 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 466 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 467 // 468 // This software is provided 'as-is', without any express or implied 469 // warranty. In no event will the authors be held liable for any damages 470 // arising from the use of this software. 471 // 472 // Permission is granted to anyone to use this software for any purpose, 473 // including commercial applications, and to alter it and redistribute it 474 // freely, subject to the following restrictions: 475 // 476 // 1. The origin of this software must not be misrepresented; you must not 477 // claim that you wrote the original software. If you use this software 478 // in a product, an acknowledgment in the product documentation would be 479 // appreciated but is not required. 480 // 2. Altered source versions must be plainly marked as such, and must not be 481 // misrepresented as being the original software. 482 // 3. This notice may not be removed or altered from any source distribution. 483 484 // Use ordinary array, since untyped makes no boost here 485 function makeTable() { 486 var c, table = []; 487 488 for (var n = 0; n < 256; n++) { 489 c = n; 490 for (var k = 0; k < 8; k++) { 491 c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); 492 } 493 table[n] = c; 494 } 495 496 return table; 497 } 498 499 // Create table on load. Just 255 signed longs. Not a problem. 500 var crcTable = makeTable(); 501 502 503 function crc32(crc, buf, len, pos) { 504 var t = crcTable, 505 end = pos + len; 506 507 crc ^= -1; 508 509 for (var i = pos; i < end; i++) { 510 crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; 511 } 512 513 return (crc ^ (-1)); // >>> 0; 514 } 515 516 517 module.exports = crc32; 518 519 },{}],6:[function(require,module,exports){ 520 'use strict'; 521 522 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 523 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 524 // 525 // This software is provided 'as-is', without any express or implied 526 // warranty. In no event will the authors be held liable for any damages 527 // arising from the use of this software. 528 // 529 // Permission is granted to anyone to use this software for any purpose, 530 // including commercial applications, and to alter it and redistribute it 531 // freely, subject to the following restrictions: 532 // 533 // 1. The origin of this software must not be misrepresented; you must not 534 // claim that you wrote the original software. If you use this software 535 // in a product, an acknowledgment in the product documentation would be 536 // appreciated but is not required. 537 // 2. Altered source versions must be plainly marked as such, and must not be 538 // misrepresented as being the original software. 539 // 3. This notice may not be removed or altered from any source distribution. 540 541 function GZheader() { 542 /* true if compressed data believed to be text */ 543 this.text = 0; 544 /* modification time */ 545 this.time = 0; 546 /* extra flags (not used when writing a gzip file) */ 547 this.xflags = 0; 548 /* operating system */ 549 this.os = 0; 550 /* pointer to extra field or Z_NULL if none */ 551 this.extra = null; 552 /* extra field length (valid if extra != Z_NULL) */ 553 this.extra_len = 0; // Actually, we don't need it in JS, 554 // but leave for few code modifications 555 556 // 557 // Setup limits is not necessary because in js we should not preallocate memory 558 // for inflate use constant limit in 65536 bytes 559 // 560 561 /* space at extra (only when reading header) */ 562 // this.extra_max = 0; 563 /* pointer to zero-terminated file name or Z_NULL */ 564 this.name = ''; 565 /* space at name (only when reading header) */ 566 // this.name_max = 0; 567 /* pointer to zero-terminated comment or Z_NULL */ 568 this.comment = ''; 569 /* space at comment (only when reading header) */ 570 // this.comm_max = 0; 571 /* true if there was or will be a header crc */ 572 this.hcrc = 0; 573 /* true when done reading gzip header (not used when writing a gzip file) */ 574 this.done = false; 575 } 576 577 module.exports = GZheader; 578 579 },{}],7:[function(require,module,exports){ 580 'use strict'; 581 582 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 583 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 584 // 585 // This software is provided 'as-is', without any express or implied 586 // warranty. In no event will the authors be held liable for any damages 587 // arising from the use of this software. 588 // 589 // Permission is granted to anyone to use this software for any purpose, 590 // including commercial applications, and to alter it and redistribute it 591 // freely, subject to the following restrictions: 592 // 593 // 1. The origin of this software must not be misrepresented; you must not 594 // claim that you wrote the original software. If you use this software 595 // in a product, an acknowledgment in the product documentation would be 596 // appreciated but is not required. 597 // 2. Altered source versions must be plainly marked as such, and must not be 598 // misrepresented as being the original software. 599 // 3. This notice may not be removed or altered from any source distribution. 600 601 // See state defs from inflate.js 602 var BAD = 30; /* got a data error -- remain here until reset */ 603 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ 604 605 /* 606 Decode literal, length, and distance codes and write out the resulting 607 literal and match bytes until either not enough input or output is 608 available, an end-of-block is encountered, or a data error is encountered. 609 When large enough input and output buffers are supplied to inflate(), for 610 example, a 16K input buffer and a 64K output buffer, more than 95% of the 611 inflate execution time is spent in this routine. 612 613 Entry assumptions: 614 615 state.mode === LEN 616 strm.avail_in >= 6 617 strm.avail_out >= 258 618 start >= strm.avail_out 619 state.bits < 8 620 621 On return, state.mode is one of: 622 623 LEN -- ran out of enough output space or enough available input 624 TYPE -- reached end of block code, inflate() to interpret next block 625 BAD -- error in block data 626 627 Notes: 628 629 - The maximum input bits used by a length/distance pair is 15 bits for the 630 length code, 5 bits for the length extra, 15 bits for the distance code, 631 and 13 bits for the distance extra. This totals 48 bits, or six bytes. 632 Therefore if strm.avail_in >= 6, then there is enough input to avoid 633 checking for available input while decoding. 634 635 - The maximum bytes that a single length/distance pair can output is 258 636 bytes, which is the maximum length that can be coded. inflate_fast() 637 requires strm.avail_out >= 258 for each loop to avoid checking for 638 output space. 639 */ 640 module.exports = function inflate_fast(strm, start) { 641 var state; 642 var _in; /* local strm.input */ 643 var last; /* have enough input while in < last */ 644 var _out; /* local strm.output */ 645 var beg; /* inflate()'s initial strm.output */ 646 var end; /* while out < end, enough space available */ 647 //#ifdef INFLATE_STRICT 648 var dmax; /* maximum distance from zlib header */ 649 //#endif 650 var wsize; /* window size or zero if not using window */ 651 var whave; /* valid bytes in the window */ 652 var wnext; /* window write index */ 653 // Use `s_window` instead `window`, avoid conflict with instrumentation tools 654 var s_window; /* allocated sliding window, if wsize != 0 */ 655 var hold; /* local strm.hold */ 656 var bits; /* local strm.bits */ 657 var lcode; /* local strm.lencode */ 658 var dcode; /* local strm.distcode */ 659 var lmask; /* mask for first level of length codes */ 660 var dmask; /* mask for first level of distance codes */ 661 var here; /* retrieved table entry */ 662 var op; /* code bits, operation, extra bits, or */ 663 /* window position, window bytes to copy */ 664 var len; /* match length, unused bytes */ 665 var dist; /* match distance */ 666 var from; /* where to copy match from */ 667 var from_source; 668 669 670 var input, output; // JS specific, because we have no pointers 671 672 /* copy state to local variables */ 673 state = strm.state; 674 //here = state.here; 675 _in = strm.next_in; 676 input = strm.input; 677 last = _in + (strm.avail_in - 5); 678 _out = strm.next_out; 679 output = strm.output; 680 beg = _out - (start - strm.avail_out); 681 end = _out + (strm.avail_out - 257); 682 //#ifdef INFLATE_STRICT 683 dmax = state.dmax; 684 //#endif 685 wsize = state.wsize; 686 whave = state.whave; 687 wnext = state.wnext; 688 s_window = state.window; 689 hold = state.hold; 690 bits = state.bits; 691 lcode = state.lencode; 692 dcode = state.distcode; 693 lmask = (1 << state.lenbits) - 1; 694 dmask = (1 << state.distbits) - 1; 695 696 697 /* decode literals and length/distances until end-of-block or not enough 698 input data or output space */ 699 700 top: 701 do { 702 if (bits < 15) { 703 hold += input[_in++] << bits; 704 bits += 8; 705 hold += input[_in++] << bits; 706 bits += 8; 707 } 708 709 here = lcode[hold & lmask]; 710 711 dolen: 712 for (;;) { // Goto emulation 713 op = here >>> 24/*here.bits*/; 714 hold >>>= op; 715 bits -= op; 716 op = (here >>> 16) & 0xff/*here.op*/; 717 if (op === 0) { /* literal */ 718 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? 719 // "inflate: literal '%c'\n" : 720 // "inflate: literal 0x%02x\n", here.val)); 721 output[_out++] = here & 0xffff/*here.val*/; 722 } 723 else if (op & 16) { /* length base */ 724 len = here & 0xffff/*here.val*/; 725 op &= 15; /* number of extra bits */ 726 if (op) { 727 if (bits < op) { 728 hold += input[_in++] << bits; 729 bits += 8; 730 } 731 len += hold & ((1 << op) - 1); 732 hold >>>= op; 733 bits -= op; 734 } 735 //Tracevv((stderr, "inflate: length %u\n", len)); 736 if (bits < 15) { 737 hold += input[_in++] << bits; 738 bits += 8; 739 hold += input[_in++] << bits; 740 bits += 8; 741 } 742 here = dcode[hold & dmask]; 743 744 dodist: 745 for (;;) { // goto emulation 746 op = here >>> 24/*here.bits*/; 747 hold >>>= op; 748 bits -= op; 749 op = (here >>> 16) & 0xff/*here.op*/; 750 751 if (op & 16) { /* distance base */ 752 dist = here & 0xffff/*here.val*/; 753 op &= 15; /* number of extra bits */ 754 if (bits < op) { 755 hold += input[_in++] << bits; 756 bits += 8; 757 if (bits < op) { 758 hold += input[_in++] << bits; 759 bits += 8; 760 } 761 } 762 dist += hold & ((1 << op) - 1); 763 //#ifdef INFLATE_STRICT 764 if (dist > dmax) { 765 strm.msg = 'invalid distance too far back'; 766 state.mode = BAD; 767 break top; 768 } 769 //#endif 770 hold >>>= op; 771 bits -= op; 772 //Tracevv((stderr, "inflate: distance %u\n", dist)); 773 op = _out - beg; /* max distance in output */ 774 if (dist > op) { /* see if copy from window */ 775 op = dist - op; /* distance back in window */ 776 if (op > whave) { 777 if (state.sane) { 778 strm.msg = 'invalid distance too far back'; 779 state.mode = BAD; 780 break top; 781 } 782 783 // (!) This block is disabled in zlib defaults, 784 // don't enable it for binary compatibility 785 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR 786 // if (len <= op - whave) { 787 // do { 788 // output[_out++] = 0; 789 // } while (--len); 790 // continue top; 791 // } 792 // len -= op - whave; 793 // do { 794 // output[_out++] = 0; 795 // } while (--op > whave); 796 // if (op === 0) { 797 // from = _out - dist; 798 // do { 799 // output[_out++] = output[from++]; 800 // } while (--len); 801 // continue top; 802 // } 803 //#endif 804 } 805 from = 0; // window index 806 from_source = s_window; 807 if (wnext === 0) { /* very common case */ 808 from += wsize - op; 809 if (op < len) { /* some from window */ 810 len -= op; 811 do { 812 output[_out++] = s_window[from++]; 813 } while (--op); 814 from = _out - dist; /* rest from output */ 815 from_source = output; 816 } 817 } 818 else if (wnext < op) { /* wrap around window */ 819 from += wsize + wnext - op; 820 op -= wnext; 821 if (op < len) { /* some from end of window */ 822 len -= op; 823 do { 824 output[_out++] = s_window[from++]; 825 } while (--op); 826 from = 0; 827 if (wnext < len) { /* some from start of window */ 828 op = wnext; 829 len -= op; 830 do { 831 output[_out++] = s_window[from++]; 832 } while (--op); 833 from = _out - dist; /* rest from output */ 834 from_source = output; 835 } 836 } 837 } 838 else { /* contiguous in window */ 839 from += wnext - op; 840 if (op < len) { /* some from window */ 841 len -= op; 842 do { 843 output[_out++] = s_window[from++]; 844 } while (--op); 845 from = _out - dist; /* rest from output */ 846 from_source = output; 847 } 848 } 849 while (len > 2) { 850 output[_out++] = from_source[from++]; 851 output[_out++] = from_source[from++]; 852 output[_out++] = from_source[from++]; 853 len -= 3; 854 } 855 if (len) { 856 output[_out++] = from_source[from++]; 857 if (len > 1) { 858 output[_out++] = from_source[from++]; 859 } 860 } 861 } 862 else { 863 from = _out - dist; /* copy direct from output */ 864 do { /* minimum length is three */ 865 output[_out++] = output[from++]; 866 output[_out++] = output[from++]; 867 output[_out++] = output[from++]; 868 len -= 3; 869 } while (len > 2); 870 if (len) { 871 output[_out++] = output[from++]; 872 if (len > 1) { 873 output[_out++] = output[from++]; 874 } 875 } 876 } 877 } 878 else if ((op & 64) === 0) { /* 2nd level distance code */ 879 here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 880 continue dodist; 881 } 882 else { 883 strm.msg = 'invalid distance code'; 884 state.mode = BAD; 885 break top; 886 } 887 888 break; // need to emulate goto via "continue" 889 } 890 } 891 else if ((op & 64) === 0) { /* 2nd level length code */ 892 here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 893 continue dolen; 894 } 895 else if (op & 32) { /* end-of-block */ 896 //Tracevv((stderr, "inflate: end of block\n")); 897 state.mode = TYPE; 898 break top; 899 } 900 else { 901 strm.msg = 'invalid literal/length code'; 902 state.mode = BAD; 903 break top; 904 } 905 906 break; // need to emulate goto via "continue" 907 } 908 } while (_in < last && _out < end); 909 910 /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ 911 len = bits >> 3; 912 _in -= len; 913 bits -= len << 3; 914 hold &= (1 << bits) - 1; 915 916 /* update state and return */ 917 strm.next_in = _in; 918 strm.next_out = _out; 919 strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); 920 strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); 921 state.hold = hold; 922 state.bits = bits; 923 return; 924 }; 925 926 },{}],8:[function(require,module,exports){ 927 'use strict'; 928 929 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 930 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 931 // 932 // This software is provided 'as-is', without any express or implied 933 // warranty. In no event will the authors be held liable for any damages 934 // arising from the use of this software. 935 // 936 // Permission is granted to anyone to use this software for any purpose, 937 // including commercial applications, and to alter it and redistribute it 938 // freely, subject to the following restrictions: 939 // 940 // 1. The origin of this software must not be misrepresented; you must not 941 // claim that you wrote the original software. If you use this software 942 // in a product, an acknowledgment in the product documentation would be 943 // appreciated but is not required. 944 // 2. Altered source versions must be plainly marked as such, and must not be 945 // misrepresented as being the original software. 946 // 3. This notice may not be removed or altered from any source distribution. 947 948 var utils = require('../utils/common'); 949 var adler32 = require('./adler32'); 950 var crc32 = require('./crc32'); 951 var inflate_fast = require('./inffast'); 952 var inflate_table = require('./inftrees'); 953 954 var CODES = 0; 955 var LENS = 1; 956 var DISTS = 2; 957 958 /* Public constants ==========================================================*/ 959 /* ===========================================================================*/ 960 961 962 /* Allowed flush values; see deflate() and inflate() below for details */ 963 //var Z_NO_FLUSH = 0; 964 //var Z_PARTIAL_FLUSH = 1; 965 //var Z_SYNC_FLUSH = 2; 966 //var Z_FULL_FLUSH = 3; 967 var Z_FINISH = 4; 968 var Z_BLOCK = 5; 969 var Z_TREES = 6; 970 971 972 /* Return codes for the compression/decompression functions. Negative values 973 * are errors, positive values are used for special but normal events. 974 */ 975 var Z_OK = 0; 976 var Z_STREAM_END = 1; 977 var Z_NEED_DICT = 2; 978 //var Z_ERRNO = -1; 979 var Z_STREAM_ERROR = -2; 980 var Z_DATA_ERROR = -3; 981 var Z_MEM_ERROR = -4; 982 var Z_BUF_ERROR = -5; 983 //var Z_VERSION_ERROR = -6; 984 985 /* The deflate compression method */ 986 var Z_DEFLATED = 8; 987 988 989 /* STATES ====================================================================*/ 990 /* ===========================================================================*/ 991 992 993 var HEAD = 1; /* i: waiting for magic header */ 994 var FLAGS = 2; /* i: waiting for method and flags (gzip) */ 995 var TIME = 3; /* i: waiting for modification time (gzip) */ 996 var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ 997 var EXLEN = 5; /* i: waiting for extra length (gzip) */ 998 var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ 999 var NAME = 7; /* i: waiting for end of file name (gzip) */ 1000 var COMMENT = 8; /* i: waiting for end of comment (gzip) */ 1001 var HCRC = 9; /* i: waiting for header crc (gzip) */ 1002 var DICTID = 10; /* i: waiting for dictionary check value */ 1003 var DICT = 11; /* waiting for inflateSetDictionary() call */ 1004 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ 1005 var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ 1006 var STORED = 14; /* i: waiting for stored size (length and complement) */ 1007 var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ 1008 var COPY = 16; /* i/o: waiting for input or output to copy stored block */ 1009 var TABLE = 17; /* i: waiting for dynamic block table lengths */ 1010 var LENLENS = 18; /* i: waiting for code length code lengths */ 1011 var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ 1012 var LEN_ = 20; /* i: same as LEN below, but only first time in */ 1013 var LEN = 21; /* i: waiting for length/lit/eob code */ 1014 var LENEXT = 22; /* i: waiting for length extra bits */ 1015 var DIST = 23; /* i: waiting for distance code */ 1016 var DISTEXT = 24; /* i: waiting for distance extra bits */ 1017 var MATCH = 25; /* o: waiting for output space to copy string */ 1018 var LIT = 26; /* o: waiting for output space to write literal */ 1019 var CHECK = 27; /* i: waiting for 32-bit check value */ 1020 var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ 1021 var DONE = 29; /* finished check, done -- remain here until reset */ 1022 var BAD = 30; /* got a data error -- remain here until reset */ 1023 var MEM = 31; /* got an inflate() memory error -- remain here until reset */ 1024 var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ 1025 1026 /* ===========================================================================*/ 1027 1028 1029 1030 var ENOUGH_LENS = 852; 1031 var ENOUGH_DISTS = 592; 1032 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); 1033 1034 var MAX_WBITS = 15; 1035 /* 32K LZ77 window */ 1036 var DEF_WBITS = MAX_WBITS; 1037 1038 1039 function zswap32(q) { 1040 return (((q >>> 24) & 0xff) + 1041 ((q >>> 8) & 0xff00) + 1042 ((q & 0xff00) << 8) + 1043 ((q & 0xff) << 24)); 1044 } 1045 1046 1047 function InflateState() { 1048 this.mode = 0; /* current inflate mode */ 1049 this.last = false; /* true if processing last block */ 1050 this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ 1051 this.havedict = false; /* true if dictionary provided */ 1052 this.flags = 0; /* gzip header method and flags (0 if zlib) */ 1053 this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ 1054 this.check = 0; /* protected copy of check value */ 1055 this.total = 0; /* protected copy of output count */ 1056 // TODO: may be {} 1057 this.head = null; /* where to save gzip header information */ 1058 1059 /* sliding window */ 1060 this.wbits = 0; /* log base 2 of requested window size */ 1061 this.wsize = 0; /* window size or zero if not using window */ 1062 this.whave = 0; /* valid bytes in the window */ 1063 this.wnext = 0; /* window write index */ 1064 this.window = null; /* allocated sliding window, if needed */ 1065 1066 /* bit accumulator */ 1067 this.hold = 0; /* input bit accumulator */ 1068 this.bits = 0; /* number of bits in "in" */ 1069 1070 /* for string and stored block copying */ 1071 this.length = 0; /* literal or length of data to copy */ 1072 this.offset = 0; /* distance back to copy string from */ 1073 1074 /* for table and code decoding */ 1075 this.extra = 0; /* extra bits needed */ 1076 1077 /* fixed and dynamic code tables */ 1078 this.lencode = null; /* starting table for length/literal codes */ 1079 this.distcode = null; /* starting table for distance codes */ 1080 this.lenbits = 0; /* index bits for lencode */ 1081 this.distbits = 0; /* index bits for distcode */ 1082 1083 /* dynamic table building */ 1084 this.ncode = 0; /* number of code length code lengths */ 1085 this.nlen = 0; /* number of length code lengths */ 1086 this.ndist = 0; /* number of distance code lengths */ 1087 this.have = 0; /* number of code lengths in lens[] */ 1088 this.next = null; /* next available space in codes[] */ 1089 1090 this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ 1091 this.work = new utils.Buf16(288); /* work area for code table building */ 1092 1093 /* 1094 because we don't have pointers in js, we use lencode and distcode directly 1095 as buffers so we don't need codes 1096 */ 1097 //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ 1098 this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ 1099 this.distdyn = null; /* dynamic table for distance codes (JS specific) */ 1100 this.sane = 0; /* if false, allow invalid distance too far */ 1101 this.back = 0; /* bits back of last unprocessed length/lit */ 1102 this.was = 0; /* initial length of match */ 1103 } 1104 1105 function inflateResetKeep(strm) { 1106 var state; 1107 1108 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1109 state = strm.state; 1110 strm.total_in = strm.total_out = state.total = 0; 1111 strm.msg = ''; /*Z_NULL*/ 1112 if (state.wrap) { /* to support ill-conceived Java test suite */ 1113 strm.adler = state.wrap & 1; 1114 } 1115 state.mode = HEAD; 1116 state.last = 0; 1117 state.havedict = 0; 1118 state.dmax = 32768; 1119 state.head = null/*Z_NULL*/; 1120 state.hold = 0; 1121 state.bits = 0; 1122 //state.lencode = state.distcode = state.next = state.codes; 1123 state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); 1124 state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); 1125 1126 state.sane = 1; 1127 state.back = -1; 1128 //Tracev((stderr, "inflate: reset\n")); 1129 return Z_OK; 1130 } 1131 1132 function inflateReset(strm) { 1133 var state; 1134 1135 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1136 state = strm.state; 1137 state.wsize = 0; 1138 state.whave = 0; 1139 state.wnext = 0; 1140 return inflateResetKeep(strm); 1141 1142 } 1143 1144 function inflateReset2(strm, windowBits) { 1145 var wrap; 1146 var state; 1147 1148 /* get the state */ 1149 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1150 state = strm.state; 1151 1152 /* extract wrap request from windowBits parameter */ 1153 if (windowBits < 0) { 1154 wrap = 0; 1155 windowBits = -windowBits; 1156 } 1157 else { 1158 wrap = (windowBits >> 4) + 1; 1159 if (windowBits < 48) { 1160 windowBits &= 15; 1161 } 1162 } 1163 1164 /* set number of window bits, free window if different */ 1165 if (windowBits && (windowBits < 8 || windowBits > 15)) { 1166 return Z_STREAM_ERROR; 1167 } 1168 if (state.window !== null && state.wbits !== windowBits) { 1169 state.window = null; 1170 } 1171 1172 /* update state and reset the rest of it */ 1173 state.wrap = wrap; 1174 state.wbits = windowBits; 1175 return inflateReset(strm); 1176 } 1177 1178 function inflateInit2(strm, windowBits) { 1179 var ret; 1180 var state; 1181 1182 if (!strm) { return Z_STREAM_ERROR; } 1183 //strm.msg = Z_NULL; /* in case we return an error */ 1184 1185 state = new InflateState(); 1186 1187 //if (state === Z_NULL) return Z_MEM_ERROR; 1188 //Tracev((stderr, "inflate: allocated\n")); 1189 strm.state = state; 1190 state.window = null/*Z_NULL*/; 1191 ret = inflateReset2(strm, windowBits); 1192 if (ret !== Z_OK) { 1193 strm.state = null/*Z_NULL*/; 1194 } 1195 return ret; 1196 } 1197 1198 function inflateInit(strm) { 1199 return inflateInit2(strm, DEF_WBITS); 1200 } 1201 1202 1203 /* 1204 Return state with length and distance decoding tables and index sizes set to 1205 fixed code decoding. Normally this returns fixed tables from inffixed.h. 1206 If BUILDFIXED is defined, then instead this routine builds the tables the 1207 first time it's called, and returns those tables the first time and 1208 thereafter. This reduces the size of the code by about 2K bytes, in 1209 exchange for a little execution time. However, BUILDFIXED should not be 1210 used for threaded applications, since the rewriting of the tables and virgin 1211 may not be thread-safe. 1212 */ 1213 var virgin = true; 1214 1215 var lenfix, distfix; // We have no pointers in JS, so keep tables separate 1216 1217 function fixedtables(state) { 1218 /* build fixed huffman tables if first call (may not be thread safe) */ 1219 if (virgin) { 1220 var sym; 1221 1222 lenfix = new utils.Buf32(512); 1223 distfix = new utils.Buf32(32); 1224 1225 /* literal/length table */ 1226 sym = 0; 1227 while (sym < 144) { state.lens[sym++] = 8; } 1228 while (sym < 256) { state.lens[sym++] = 9; } 1229 while (sym < 280) { state.lens[sym++] = 7; } 1230 while (sym < 288) { state.lens[sym++] = 8; } 1231 1232 inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); 1233 1234 /* distance table */ 1235 sym = 0; 1236 while (sym < 32) { state.lens[sym++] = 5; } 1237 1238 inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); 1239 1240 /* do this just once */ 1241 virgin = false; 1242 } 1243 1244 state.lencode = lenfix; 1245 state.lenbits = 9; 1246 state.distcode = distfix; 1247 state.distbits = 5; 1248 } 1249 1250 1251 /* 1252 Update the window with the last wsize (normally 32K) bytes written before 1253 returning. If window does not exist yet, create it. This is only called 1254 when a window is already in use, or when output has been written during this 1255 inflate call, but the end of the deflate stream has not been reached yet. 1256 It is also called to create a window for dictionary data when a dictionary 1257 is loaded. 1258 1259 Providing output buffers larger than 32K to inflate() should provide a speed 1260 advantage, since only the last 32K of output is copied to the sliding window 1261 upon return from inflate(), and since all distances after the first 32K of 1262 output will fall in the output data, making match copies simpler and faster. 1263 The advantage may be dependent on the size of the processor's data caches. 1264 */ 1265 function updatewindow(strm, src, end, copy) { 1266 var dist; 1267 var state = strm.state; 1268 1269 /* if it hasn't been done already, allocate space for the window */ 1270 if (state.window === null) { 1271 state.wsize = 1 << state.wbits; 1272 state.wnext = 0; 1273 state.whave = 0; 1274 1275 state.window = new utils.Buf8(state.wsize); 1276 } 1277 1278 /* copy state->wsize or less output bytes into the circular window */ 1279 if (copy >= state.wsize) { 1280 utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); 1281 state.wnext = 0; 1282 state.whave = state.wsize; 1283 } 1284 else { 1285 dist = state.wsize - state.wnext; 1286 if (dist > copy) { 1287 dist = copy; 1288 } 1289 //zmemcpy(state->window + state->wnext, end - copy, dist); 1290 utils.arraySet(state.window, src, end - copy, dist, state.wnext); 1291 copy -= dist; 1292 if (copy) { 1293 //zmemcpy(state->window, end - copy, copy); 1294 utils.arraySet(state.window, src, end - copy, copy, 0); 1295 state.wnext = copy; 1296 state.whave = state.wsize; 1297 } 1298 else { 1299 state.wnext += dist; 1300 if (state.wnext === state.wsize) { state.wnext = 0; } 1301 if (state.whave < state.wsize) { state.whave += dist; } 1302 } 1303 } 1304 return 0; 1305 } 1306 1307 function inflate(strm, flush) { 1308 var state; 1309 var input, output; // input/output buffers 1310 var next; /* next input INDEX */ 1311 var put; /* next output INDEX */ 1312 var have, left; /* available input and output */ 1313 var hold; /* bit buffer */ 1314 var bits; /* bits in bit buffer */ 1315 var _in, _out; /* save starting available input and output */ 1316 var copy; /* number of stored or match bytes to copy */ 1317 var from; /* where to copy match bytes from */ 1318 var from_source; 1319 var here = 0; /* current decoding table entry */ 1320 var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) 1321 //var last; /* parent table entry */ 1322 var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) 1323 var len; /* length to copy for repeats, bits to drop */ 1324 var ret; /* return code */ 1325 var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ 1326 var opts; 1327 1328 var n; // temporary var for NEED_BITS 1329 1330 var order = /* permutation of code lengths */ 1331 [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; 1332 1333 1334 if (!strm || !strm.state || !strm.output || 1335 (!strm.input && strm.avail_in !== 0)) { 1336 return Z_STREAM_ERROR; 1337 } 1338 1339 state = strm.state; 1340 if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ 1341 1342 1343 //--- LOAD() --- 1344 put = strm.next_out; 1345 output = strm.output; 1346 left = strm.avail_out; 1347 next = strm.next_in; 1348 input = strm.input; 1349 have = strm.avail_in; 1350 hold = state.hold; 1351 bits = state.bits; 1352 //--- 1353 1354 _in = have; 1355 _out = left; 1356 ret = Z_OK; 1357 1358 inf_leave: // goto emulation 1359 for (;;) { 1360 switch (state.mode) { 1361 case HEAD: 1362 if (state.wrap === 0) { 1363 state.mode = TYPEDO; 1364 break; 1365 } 1366 //=== NEEDBITS(16); 1367 while (bits < 16) { 1368 if (have === 0) { break inf_leave; } 1369 have--; 1370 hold += input[next++] << bits; 1371 bits += 8; 1372 } 1373 //===// 1374 if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ 1375 state.check = 0/*crc32(0L, Z_NULL, 0)*/; 1376 //=== CRC2(state.check, hold); 1377 hbuf[0] = hold & 0xff; 1378 hbuf[1] = (hold >>> 8) & 0xff; 1379 state.check = crc32(state.check, hbuf, 2, 0); 1380 //===// 1381 1382 //=== INITBITS(); 1383 hold = 0; 1384 bits = 0; 1385 //===// 1386 state.mode = FLAGS; 1387 break; 1388 } 1389 state.flags = 0; /* expect zlib header */ 1390 if (state.head) { 1391 state.head.done = false; 1392 } 1393 if (!(state.wrap & 1) || /* check if zlib header allowed */ 1394 (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { 1395 strm.msg = 'incorrect header check'; 1396 state.mode = BAD; 1397 break; 1398 } 1399 if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { 1400 strm.msg = 'unknown compression method'; 1401 state.mode = BAD; 1402 break; 1403 } 1404 //--- DROPBITS(4) ---// 1405 hold >>>= 4; 1406 bits -= 4; 1407 //---// 1408 len = (hold & 0x0f)/*BITS(4)*/ + 8; 1409 if (state.wbits === 0) { 1410 state.wbits = len; 1411 } 1412 else if (len > state.wbits) { 1413 strm.msg = 'invalid window size'; 1414 state.mode = BAD; 1415 break; 1416 } 1417 state.dmax = 1 << len; 1418 //Tracev((stderr, "inflate: zlib header ok\n")); 1419 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; 1420 state.mode = hold & 0x200 ? DICTID : TYPE; 1421 //=== INITBITS(); 1422 hold = 0; 1423 bits = 0; 1424 //===// 1425 break; 1426 case FLAGS: 1427 //=== NEEDBITS(16); */ 1428 while (bits < 16) { 1429 if (have === 0) { break inf_leave; } 1430 have--; 1431 hold += input[next++] << bits; 1432 bits += 8; 1433 } 1434 //===// 1435 state.flags = hold; 1436 if ((state.flags & 0xff) !== Z_DEFLATED) { 1437 strm.msg = 'unknown compression method'; 1438 state.mode = BAD; 1439 break; 1440 } 1441 if (state.flags & 0xe000) { 1442 strm.msg = 'unknown header flags set'; 1443 state.mode = BAD; 1444 break; 1445 } 1446 if (state.head) { 1447 state.head.text = ((hold >> 8) & 1); 1448 } 1449 if (state.flags & 0x0200) { 1450 //=== CRC2(state.check, hold); 1451 hbuf[0] = hold & 0xff; 1452 hbuf[1] = (hold >>> 8) & 0xff; 1453 state.check = crc32(state.check, hbuf, 2, 0); 1454 //===// 1455 } 1456 //=== INITBITS(); 1457 hold = 0; 1458 bits = 0; 1459 //===// 1460 state.mode = TIME; 1461 /* falls through */ 1462 case TIME: 1463 //=== NEEDBITS(32); */ 1464 while (bits < 32) { 1465 if (have === 0) { break inf_leave; } 1466 have--; 1467 hold += input[next++] << bits; 1468 bits += 8; 1469 } 1470 //===// 1471 if (state.head) { 1472 state.head.time = hold; 1473 } 1474 if (state.flags & 0x0200) { 1475 //=== CRC4(state.check, hold) 1476 hbuf[0] = hold & 0xff; 1477 hbuf[1] = (hold >>> 8) & 0xff; 1478 hbuf[2] = (hold >>> 16) & 0xff; 1479 hbuf[3] = (hold >>> 24) & 0xff; 1480 state.check = crc32(state.check, hbuf, 4, 0); 1481 //=== 1482 } 1483 //=== INITBITS(); 1484 hold = 0; 1485 bits = 0; 1486 //===// 1487 state.mode = OS; 1488 /* falls through */ 1489 case OS: 1490 //=== NEEDBITS(16); */ 1491 while (bits < 16) { 1492 if (have === 0) { break inf_leave; } 1493 have--; 1494 hold += input[next++] << bits; 1495 bits += 8; 1496 } 1497 //===// 1498 if (state.head) { 1499 state.head.xflags = (hold & 0xff); 1500 state.head.os = (hold >> 8); 1501 } 1502 if (state.flags & 0x0200) { 1503 //=== CRC2(state.check, hold); 1504 hbuf[0] = hold & 0xff; 1505 hbuf[1] = (hold >>> 8) & 0xff; 1506 state.check = crc32(state.check, hbuf, 2, 0); 1507 //===// 1508 } 1509 //=== INITBITS(); 1510 hold = 0; 1511 bits = 0; 1512 //===// 1513 state.mode = EXLEN; 1514 /* falls through */ 1515 case EXLEN: 1516 if (state.flags & 0x0400) { 1517 //=== NEEDBITS(16); */ 1518 while (bits < 16) { 1519 if (have === 0) { break inf_leave; } 1520 have--; 1521 hold += input[next++] << bits; 1522 bits += 8; 1523 } 1524 //===// 1525 state.length = hold; 1526 if (state.head) { 1527 state.head.extra_len = hold; 1528 } 1529 if (state.flags & 0x0200) { 1530 //=== CRC2(state.check, hold); 1531 hbuf[0] = hold & 0xff; 1532 hbuf[1] = (hold >>> 8) & 0xff; 1533 state.check = crc32(state.check, hbuf, 2, 0); 1534 //===// 1535 } 1536 //=== INITBITS(); 1537 hold = 0; 1538 bits = 0; 1539 //===// 1540 } 1541 else if (state.head) { 1542 state.head.extra = null/*Z_NULL*/; 1543 } 1544 state.mode = EXTRA; 1545 /* falls through */ 1546 case EXTRA: 1547 if (state.flags & 0x0400) { 1548 copy = state.length; 1549 if (copy > have) { copy = have; } 1550 if (copy) { 1551 if (state.head) { 1552 len = state.head.extra_len - state.length; 1553 if (!state.head.extra) { 1554 // Use untyped array for more convenient processing later 1555 state.head.extra = new Array(state.head.extra_len); 1556 } 1557 utils.arraySet( 1558 state.head.extra, 1559 input, 1560 next, 1561 // extra field is limited to 65536 bytes 1562 // - no need for additional size check 1563 copy, 1564 /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ 1565 len 1566 ); 1567 //zmemcpy(state.head.extra + len, next, 1568 // len + copy > state.head.extra_max ? 1569 // state.head.extra_max - len : copy); 1570 } 1571 if (state.flags & 0x0200) { 1572 state.check = crc32(state.check, input, copy, next); 1573 } 1574 have -= copy; 1575 next += copy; 1576 state.length -= copy; 1577 } 1578 if (state.length) { break inf_leave; } 1579 } 1580 state.length = 0; 1581 state.mode = NAME; 1582 /* falls through */ 1583 case NAME: 1584 if (state.flags & 0x0800) { 1585 if (have === 0) { break inf_leave; } 1586 copy = 0; 1587 do { 1588 // TODO: 2 or 1 bytes? 1589 len = input[next + copy++]; 1590 /* use constant limit because in js we should not preallocate memory */ 1591 if (state.head && len && 1592 (state.length < 65536 /*state.head.name_max*/)) { 1593 state.head.name += String.fromCharCode(len); 1594 } 1595 } while (len && copy < have); 1596 1597 if (state.flags & 0x0200) { 1598 state.check = crc32(state.check, input, copy, next); 1599 } 1600 have -= copy; 1601 next += copy; 1602 if (len) { break inf_leave; } 1603 } 1604 else if (state.head) { 1605 state.head.name = null; 1606 } 1607 state.length = 0; 1608 state.mode = COMMENT; 1609 /* falls through */ 1610 case COMMENT: 1611 if (state.flags & 0x1000) { 1612 if (have === 0) { break inf_leave; } 1613 copy = 0; 1614 do { 1615 len = input[next + copy++]; 1616 /* use constant limit because in js we should not preallocate memory */ 1617 if (state.head && len && 1618 (state.length < 65536 /*state.head.comm_max*/)) { 1619 state.head.comment += String.fromCharCode(len); 1620 } 1621 } while (len && copy < have); 1622 if (state.flags & 0x0200) { 1623 state.check = crc32(state.check, input, copy, next); 1624 } 1625 have -= copy; 1626 next += copy; 1627 if (len) { break inf_leave; } 1628 } 1629 else if (state.head) { 1630 state.head.comment = null; 1631 } 1632 state.mode = HCRC; 1633 /* falls through */ 1634 case HCRC: 1635 if (state.flags & 0x0200) { 1636 //=== NEEDBITS(16); */ 1637 while (bits < 16) { 1638 if (have === 0) { break inf_leave; } 1639 have--; 1640 hold += input[next++] << bits; 1641 bits += 8; 1642 } 1643 //===// 1644 if (hold !== (state.check & 0xffff)) { 1645 strm.msg = 'header crc mismatch'; 1646 state.mode = BAD; 1647 break; 1648 } 1649 //=== INITBITS(); 1650 hold = 0; 1651 bits = 0; 1652 //===// 1653 } 1654 if (state.head) { 1655 state.head.hcrc = ((state.flags >> 9) & 1); 1656 state.head.done = true; 1657 } 1658 strm.adler = state.check = 0; 1659 state.mode = TYPE; 1660 break; 1661 case DICTID: 1662 //=== NEEDBITS(32); */ 1663 while (bits < 32) { 1664 if (have === 0) { break inf_leave; } 1665 have--; 1666 hold += input[next++] << bits; 1667 bits += 8; 1668 } 1669 //===// 1670 strm.adler = state.check = zswap32(hold); 1671 //=== INITBITS(); 1672 hold = 0; 1673 bits = 0; 1674 //===// 1675 state.mode = DICT; 1676 /* falls through */ 1677 case DICT: 1678 if (state.havedict === 0) { 1679 //--- RESTORE() --- 1680 strm.next_out = put; 1681 strm.avail_out = left; 1682 strm.next_in = next; 1683 strm.avail_in = have; 1684 state.hold = hold; 1685 state.bits = bits; 1686 //--- 1687 return Z_NEED_DICT; 1688 } 1689 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; 1690 state.mode = TYPE; 1691 /* falls through */ 1692 case TYPE: 1693 if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } 1694 /* falls through */ 1695 case TYPEDO: 1696 if (state.last) { 1697 //--- BYTEBITS() ---// 1698 hold >>>= bits & 7; 1699 bits -= bits & 7; 1700 //---// 1701 state.mode = CHECK; 1702 break; 1703 } 1704 //=== NEEDBITS(3); */ 1705 while (bits < 3) { 1706 if (have === 0) { break inf_leave; } 1707 have--; 1708 hold += input[next++] << bits; 1709 bits += 8; 1710 } 1711 //===// 1712 state.last = (hold & 0x01)/*BITS(1)*/; 1713 //--- DROPBITS(1) ---// 1714 hold >>>= 1; 1715 bits -= 1; 1716 //---// 1717 1718 switch ((hold & 0x03)/*BITS(2)*/) { 1719 case 0: /* stored block */ 1720 //Tracev((stderr, "inflate: stored block%s\n", 1721 // state.last ? " (last)" : "")); 1722 state.mode = STORED; 1723 break; 1724 case 1: /* fixed block */ 1725 fixedtables(state); 1726 //Tracev((stderr, "inflate: fixed codes block%s\n", 1727 // state.last ? " (last)" : "")); 1728 state.mode = LEN_; /* decode codes */ 1729 if (flush === Z_TREES) { 1730 //--- DROPBITS(2) ---// 1731 hold >>>= 2; 1732 bits -= 2; 1733 //---// 1734 break inf_leave; 1735 } 1736 break; 1737 case 2: /* dynamic block */ 1738 //Tracev((stderr, "inflate: dynamic codes block%s\n", 1739 // state.last ? " (last)" : "")); 1740 state.mode = TABLE; 1741 break; 1742 case 3: 1743 strm.msg = 'invalid block type'; 1744 state.mode = BAD; 1745 } 1746 //--- DROPBITS(2) ---// 1747 hold >>>= 2; 1748 bits -= 2; 1749 //---// 1750 break; 1751 case STORED: 1752 //--- BYTEBITS() ---// /* go to byte boundary */ 1753 hold >>>= bits & 7; 1754 bits -= bits & 7; 1755 //---// 1756 //=== NEEDBITS(32); */ 1757 while (bits < 32) { 1758 if (have === 0) { break inf_leave; } 1759 have--; 1760 hold += input[next++] << bits; 1761 bits += 8; 1762 } 1763 //===// 1764 if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { 1765 strm.msg = 'invalid stored block lengths'; 1766 state.mode = BAD; 1767 break; 1768 } 1769 state.length = hold & 0xffff; 1770 //Tracev((stderr, "inflate: stored length %u\n", 1771 // state.length)); 1772 //=== INITBITS(); 1773 hold = 0; 1774 bits = 0; 1775 //===// 1776 state.mode = COPY_; 1777 if (flush === Z_TREES) { break inf_leave; } 1778 /* falls through */ 1779 case COPY_: 1780 state.mode = COPY; 1781 /* falls through */ 1782 case COPY: 1783 copy = state.length; 1784 if (copy) { 1785 if (copy > have) { copy = have; } 1786 if (copy > left) { copy = left; } 1787 if (copy === 0) { break inf_leave; } 1788 //--- zmemcpy(put, next, copy); --- 1789 utils.arraySet(output, input, next, copy, put); 1790 //---// 1791 have -= copy; 1792 next += copy; 1793 left -= copy; 1794 put += copy; 1795 state.length -= copy; 1796 break; 1797 } 1798 //Tracev((stderr, "inflate: stored end\n")); 1799 state.mode = TYPE; 1800 break; 1801 case TABLE: 1802 //=== NEEDBITS(14); */ 1803 while (bits < 14) { 1804 if (have === 0) { break inf_leave; } 1805 have--; 1806 hold += input[next++] << bits; 1807 bits += 8; 1808 } 1809 //===// 1810 state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; 1811 //--- DROPBITS(5) ---// 1812 hold >>>= 5; 1813 bits -= 5; 1814 //---// 1815 state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; 1816 //--- DROPBITS(5) ---// 1817 hold >>>= 5; 1818 bits -= 5; 1819 //---// 1820 state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; 1821 //--- DROPBITS(4) ---// 1822 hold >>>= 4; 1823 bits -= 4; 1824 //---// 1825 //#ifndef PKZIP_BUG_WORKAROUND 1826 if (state.nlen > 286 || state.ndist > 30) { 1827 strm.msg = 'too many length or distance symbols'; 1828 state.mode = BAD; 1829 break; 1830 } 1831 //#endif 1832 //Tracev((stderr, "inflate: table sizes ok\n")); 1833 state.have = 0; 1834 state.mode = LENLENS; 1835 /* falls through */ 1836 case LENLENS: 1837 while (state.have < state.ncode) { 1838 //=== NEEDBITS(3); 1839 while (bits < 3) { 1840 if (have === 0) { break inf_leave; } 1841 have--; 1842 hold += input[next++] << bits; 1843 bits += 8; 1844 } 1845 //===// 1846 state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); 1847 //--- DROPBITS(3) ---// 1848 hold >>>= 3; 1849 bits -= 3; 1850 //---// 1851 } 1852 while (state.have < 19) { 1853 state.lens[order[state.have++]] = 0; 1854 } 1855 // We have separate tables & no pointers. 2 commented lines below not needed. 1856 //state.next = state.codes; 1857 //state.lencode = state.next; 1858 // Switch to use dynamic table 1859 state.lencode = state.lendyn; 1860 state.lenbits = 7; 1861 1862 opts = { bits: state.lenbits }; 1863 ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); 1864 state.lenbits = opts.bits; 1865 1866 if (ret) { 1867 strm.msg = 'invalid code lengths set'; 1868 state.mode = BAD; 1869 break; 1870 } 1871 //Tracev((stderr, "inflate: code lengths ok\n")); 1872 state.have = 0; 1873 state.mode = CODELENS; 1874 /* falls through */ 1875 case CODELENS: 1876 while (state.have < state.nlen + state.ndist) { 1877 for (;;) { 1878 here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ 1879 here_bits = here >>> 24; 1880 here_op = (here >>> 16) & 0xff; 1881 here_val = here & 0xffff; 1882 1883 if ((here_bits) <= bits) { break; } 1884 //--- PULLBYTE() ---// 1885 if (have === 0) { break inf_leave; } 1886 have--; 1887 hold += input[next++] << bits; 1888 bits += 8; 1889 //---// 1890 } 1891 if (here_val < 16) { 1892 //--- DROPBITS(here.bits) ---// 1893 hold >>>= here_bits; 1894 bits -= here_bits; 1895 //---// 1896 state.lens[state.have++] = here_val; 1897 } 1898 else { 1899 if (here_val === 16) { 1900 //=== NEEDBITS(here.bits + 2); 1901 n = here_bits + 2; 1902 while (bits < n) { 1903 if (have === 0) { break inf_leave; } 1904 have--; 1905 hold += input[next++] << bits; 1906 bits += 8; 1907 } 1908 //===// 1909 //--- DROPBITS(here.bits) ---// 1910 hold >>>= here_bits; 1911 bits -= here_bits; 1912 //---// 1913 if (state.have === 0) { 1914 strm.msg = 'invalid bit length repeat'; 1915 state.mode = BAD; 1916 break; 1917 } 1918 len = state.lens[state.have - 1]; 1919 copy = 3 + (hold & 0x03);//BITS(2); 1920 //--- DROPBITS(2) ---// 1921 hold >>>= 2; 1922 bits -= 2; 1923 //---// 1924 } 1925 else if (here_val === 17) { 1926 //=== NEEDBITS(here.bits + 3); 1927 n = here_bits + 3; 1928 while (bits < n) { 1929 if (have === 0) { break inf_leave; } 1930 have--; 1931 hold += input[next++] << bits; 1932 bits += 8; 1933 } 1934 //===// 1935 //--- DROPBITS(here.bits) ---// 1936 hold >>>= here_bits; 1937 bits -= here_bits; 1938 //---// 1939 len = 0; 1940 copy = 3 + (hold & 0x07);//BITS(3); 1941 //--- DROPBITS(3) ---// 1942 hold >>>= 3; 1943 bits -= 3; 1944 //---// 1945 } 1946 else { 1947 //=== NEEDBITS(here.bits + 7); 1948 n = here_bits + 7; 1949 while (bits < n) { 1950 if (have === 0) { break inf_leave; } 1951 have--; 1952 hold += input[next++] << bits; 1953 bits += 8; 1954 } 1955 //===// 1956 //--- DROPBITS(here.bits) ---// 1957 hold >>>= here_bits; 1958 bits -= here_bits; 1959 //---// 1960 len = 0; 1961 copy = 11 + (hold & 0x7f);//BITS(7); 1962 //--- DROPBITS(7) ---// 1963 hold >>>= 7; 1964 bits -= 7; 1965 //---// 1966 } 1967 if (state.have + copy > state.nlen + state.ndist) { 1968 strm.msg = 'invalid bit length repeat'; 1969 state.mode = BAD; 1970 break; 1971 } 1972 while (copy--) { 1973 state.lens[state.have++] = len; 1974 } 1975 } 1976 } 1977 1978 /* handle error breaks in while */ 1979 if (state.mode === BAD) { break; } 1980 1981 /* check for end-of-block code (better have one) */ 1982 if (state.lens[256] === 0) { 1983 strm.msg = 'invalid code -- missing end-of-block'; 1984 state.mode = BAD; 1985 break; 1986 } 1987 1988 /* build code tables -- note: do not change the lenbits or distbits 1989 values here (9 and 6) without reading the comments in inftrees.h 1990 concerning the ENOUGH constants, which depend on those values */ 1991 state.lenbits = 9; 1992 1993 opts = { bits: state.lenbits }; 1994 ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); 1995 // We have separate tables & no pointers. 2 commented lines below not needed. 1996 // state.next_index = opts.table_index; 1997 state.lenbits = opts.bits; 1998 // state.lencode = state.next; 1999 2000 if (ret) { 2001 strm.msg = 'invalid literal/lengths set'; 2002 state.mode = BAD; 2003 break; 2004 } 2005 2006 state.distbits = 6; 2007 //state.distcode.copy(state.codes); 2008 // Switch to use dynamic table 2009 state.distcode = state.distdyn; 2010 opts = { bits: state.distbits }; 2011 ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); 2012 // We have separate tables & no pointers. 2 commented lines below not needed. 2013 // state.next_index = opts.table_index; 2014 state.distbits = opts.bits; 2015 // state.distcode = state.next; 2016 2017 if (ret) { 2018 strm.msg = 'invalid distances set'; 2019 state.mode = BAD; 2020 break; 2021 } 2022 //Tracev((stderr, 'inflate: codes ok\n')); 2023 state.mode = LEN_; 2024 if (flush === Z_TREES) { break inf_leave; } 2025 /* falls through */ 2026 case LEN_: 2027 state.mode = LEN; 2028 /* falls through */ 2029 case LEN: 2030 if (have >= 6 && left >= 258) { 2031 //--- RESTORE() --- 2032 strm.next_out = put; 2033 strm.avail_out = left; 2034 strm.next_in = next; 2035 strm.avail_in = have; 2036 state.hold = hold; 2037 state.bits = bits; 2038 //--- 2039 inflate_fast(strm, _out); 2040 //--- LOAD() --- 2041 put = strm.next_out; 2042 output = strm.output; 2043 left = strm.avail_out; 2044 next = strm.next_in; 2045 input = strm.input; 2046 have = strm.avail_in; 2047 hold = state.hold; 2048 bits = state.bits; 2049 //--- 2050 2051 if (state.mode === TYPE) { 2052 state.back = -1; 2053 } 2054 break; 2055 } 2056 state.back = 0; 2057 for (;;) { 2058 here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ 2059 here_bits = here >>> 24; 2060 here_op = (here >>> 16) & 0xff; 2061 here_val = here & 0xffff; 2062 2063 if (here_bits <= bits) { break; } 2064 //--- PULLBYTE() ---// 2065 if (have === 0) { break inf_leave; } 2066 have--; 2067 hold += input[next++] << bits; 2068 bits += 8; 2069 //---// 2070 } 2071 if (here_op && (here_op & 0xf0) === 0) { 2072 last_bits = here_bits; 2073 last_op = here_op; 2074 last_val = here_val; 2075 for (;;) { 2076 here = state.lencode[last_val + 2077 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; 2078 here_bits = here >>> 24; 2079 here_op = (here >>> 16) & 0xff; 2080 here_val = here & 0xffff; 2081 2082 if ((last_bits + here_bits) <= bits) { break; } 2083 //--- PULLBYTE() ---// 2084 if (have === 0) { break inf_leave; } 2085 have--; 2086 hold += input[next++] << bits; 2087 bits += 8; 2088 //---// 2089 } 2090 //--- DROPBITS(last.bits) ---// 2091 hold >>>= last_bits; 2092 bits -= last_bits; 2093 //---// 2094 state.back += last_bits; 2095 } 2096 //--- DROPBITS(here.bits) ---// 2097 hold >>>= here_bits; 2098 bits -= here_bits; 2099 //---// 2100 state.back += here_bits; 2101 state.length = here_val; 2102 if (here_op === 0) { 2103 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? 2104 // "inflate: literal '%c'\n" : 2105 // "inflate: literal 0x%02x\n", here.val)); 2106 state.mode = LIT; 2107 break; 2108 } 2109 if (here_op & 32) { 2110 //Tracevv((stderr, "inflate: end of block\n")); 2111 state.back = -1; 2112 state.mode = TYPE; 2113 break; 2114 } 2115 if (here_op & 64) { 2116 strm.msg = 'invalid literal/length code'; 2117 state.mode = BAD; 2118 break; 2119 } 2120 state.extra = here_op & 15; 2121 state.mode = LENEXT; 2122 /* falls through */ 2123 case LENEXT: 2124 if (state.extra) { 2125 //=== NEEDBITS(state.extra); 2126 n = state.extra; 2127 while (bits < n) { 2128 if (have === 0) { break inf_leave; } 2129 have--; 2130 hold += input[next++] << bits; 2131 bits += 8; 2132 } 2133 //===// 2134 state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; 2135 //--- DROPBITS(state.extra) ---// 2136 hold >>>= state.extra; 2137 bits -= state.extra; 2138 //---// 2139 state.back += state.extra; 2140 } 2141 //Tracevv((stderr, "inflate: length %u\n", state.length)); 2142 state.was = state.length; 2143 state.mode = DIST; 2144 /* falls through */ 2145 case DIST: 2146 for (;;) { 2147 here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ 2148 here_bits = here >>> 24; 2149 here_op = (here >>> 16) & 0xff; 2150 here_val = here & 0xffff; 2151 2152 if ((here_bits) <= bits) { break; } 2153 //--- PULLBYTE() ---// 2154 if (have === 0) { break inf_leave; } 2155 have--; 2156 hold += input[next++] << bits; 2157 bits += 8; 2158 //---// 2159 } 2160 if ((here_op & 0xf0) === 0) { 2161 last_bits = here_bits; 2162 last_op = here_op; 2163 last_val = here_val; 2164 for (;;) { 2165 here = state.distcode[last_val + 2166 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; 2167 here_bits = here >>> 24; 2168 here_op = (here >>> 16) & 0xff; 2169 here_val = here & 0xffff; 2170 2171 if ((last_bits + here_bits) <= bits) { break; } 2172 //--- PULLBYTE() ---// 2173 if (have === 0) { break inf_leave; } 2174 have--; 2175 hold += input[next++] << bits; 2176 bits += 8; 2177 //---// 2178 } 2179 //--- DROPBITS(last.bits) ---// 2180 hold >>>= last_bits; 2181 bits -= last_bits; 2182 //---// 2183 state.back += last_bits; 2184 } 2185 //--- DROPBITS(here.bits) ---// 2186 hold >>>= here_bits; 2187 bits -= here_bits; 2188 //---// 2189 state.back += here_bits; 2190 if (here_op & 64) { 2191 strm.msg = 'invalid distance code'; 2192 state.mode = BAD; 2193 break; 2194 } 2195 state.offset = here_val; 2196 state.extra = (here_op) & 15; 2197 state.mode = DISTEXT; 2198 /* falls through */ 2199 case DISTEXT: 2200 if (state.extra) { 2201 //=== NEEDBITS(state.extra); 2202 n = state.extra; 2203 while (bits < n) { 2204 if (have === 0) { break inf_leave; } 2205 have--; 2206 hold += input[next++] << bits; 2207 bits += 8; 2208 } 2209 //===// 2210 state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; 2211 //--- DROPBITS(state.extra) ---// 2212 hold >>>= state.extra; 2213 bits -= state.extra; 2214 //---// 2215 state.back += state.extra; 2216 } 2217 //#ifdef INFLATE_STRICT 2218 if (state.offset > state.dmax) { 2219 strm.msg = 'invalid distance too far back'; 2220 state.mode = BAD; 2221 break; 2222 } 2223 //#endif 2224 //Tracevv((stderr, "inflate: distance %u\n", state.offset)); 2225 state.mode = MATCH; 2226 /* falls through */ 2227 case MATCH: 2228 if (left === 0) { break inf_leave; } 2229 copy = _out - left; 2230 if (state.offset > copy) { /* copy from window */ 2231 copy = state.offset - copy; 2232 if (copy > state.whave) { 2233 if (state.sane) { 2234 strm.msg = 'invalid distance too far back'; 2235 state.mode = BAD; 2236 break; 2237 } 2238 // (!) This block is disabled in zlib defaults, 2239 // don't enable it for binary compatibility 2240 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR 2241 // Trace((stderr, "inflate.c too far\n")); 2242 // copy -= state.whave; 2243 // if (copy > state.length) { copy = state.length; } 2244 // if (copy > left) { copy = left; } 2245 // left -= copy; 2246 // state.length -= copy; 2247 // do { 2248 // output[put++] = 0; 2249 // } while (--copy); 2250 // if (state.length === 0) { state.mode = LEN; } 2251 // break; 2252 //#endif 2253 } 2254 if (copy > state.wnext) { 2255 copy -= state.wnext; 2256 from = state.wsize - copy; 2257 } 2258 else { 2259 from = state.wnext - copy; 2260 } 2261 if (copy > state.length) { copy = state.length; } 2262 from_source = state.window; 2263 } 2264 else { /* copy from output */ 2265 from_source = output; 2266 from = put - state.offset; 2267 copy = state.length; 2268 } 2269 if (copy > left) { copy = left; } 2270 left -= copy; 2271 state.length -= copy; 2272 do { 2273 output[put++] = from_source[from++]; 2274 } while (--copy); 2275 if (state.length === 0) { state.mode = LEN; } 2276 break; 2277 case LIT: 2278 if (left === 0) { break inf_leave; } 2279 output[put++] = state.length; 2280 left--; 2281 state.mode = LEN; 2282 break; 2283 case CHECK: 2284 if (state.wrap) { 2285 //=== NEEDBITS(32); 2286 while (bits < 32) { 2287 if (have === 0) { break inf_leave; } 2288 have--; 2289 // Use '|' instead of '+' to make sure that result is signed 2290 hold |= input[next++] << bits; 2291 bits += 8; 2292 } 2293 //===// 2294 _out -= left; 2295 strm.total_out += _out; 2296 state.total += _out; 2297 if (_out) { 2298 strm.adler = state.check = 2299 /*UPDATE(state.check, put - _out, _out);*/ 2300 (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); 2301 2302 } 2303 _out = left; 2304 // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too 2305 if ((state.flags ? hold : zswap32(hold)) !== state.check) { 2306 strm.msg = 'incorrect data check'; 2307 state.mode = BAD; 2308 break; 2309 } 2310 //=== INITBITS(); 2311 hold = 0; 2312 bits = 0; 2313 //===// 2314 //Tracev((stderr, "inflate: check matches trailer\n")); 2315 } 2316 state.mode = LENGTH; 2317 /* falls through */ 2318 case LENGTH: 2319 if (state.wrap && state.flags) { 2320 //=== NEEDBITS(32); 2321 while (bits < 32) { 2322 if (have === 0) { break inf_leave; } 2323 have--; 2324 hold += input[next++] << bits; 2325 bits += 8; 2326 } 2327 //===// 2328 if (hold !== (state.total & 0xffffffff)) { 2329 strm.msg = 'incorrect length check'; 2330 state.mode = BAD; 2331 break; 2332 } 2333 //=== INITBITS(); 2334 hold = 0; 2335 bits = 0; 2336 //===// 2337 //Tracev((stderr, "inflate: length matches trailer\n")); 2338 } 2339 state.mode = DONE; 2340 /* falls through */ 2341 case DONE: 2342 ret = Z_STREAM_END; 2343 break inf_leave; 2344 case BAD: 2345 ret = Z_DATA_ERROR; 2346 break inf_leave; 2347 case MEM: 2348 return Z_MEM_ERROR; 2349 case SYNC: 2350 /* falls through */ 2351 default: 2352 return Z_STREAM_ERROR; 2353 } 2354 } 2355 2356 // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" 2357 2358 /* 2359 Return from inflate(), updating the total counts and the check value. 2360 If there was no progress during the inflate() call, return a buffer 2361 error. Call updatewindow() to create and/or update the window state. 2362 Note: a memory error from inflate() is non-recoverable. 2363 */ 2364 2365 //--- RESTORE() --- 2366 strm.next_out = put; 2367 strm.avail_out = left; 2368 strm.next_in = next; 2369 strm.avail_in = have; 2370 state.hold = hold; 2371 state.bits = bits; 2372 //--- 2373 2374 if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && 2375 (state.mode < CHECK || flush !== Z_FINISH))) { 2376 if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { 2377 state.mode = MEM; 2378 return Z_MEM_ERROR; 2379 } 2380 } 2381 _in -= strm.avail_in; 2382 _out -= strm.avail_out; 2383 strm.total_in += _in; 2384 strm.total_out += _out; 2385 state.total += _out; 2386 if (state.wrap && _out) { 2387 strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ 2388 (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); 2389 } 2390 strm.data_type = state.bits + (state.last ? 64 : 0) + 2391 (state.mode === TYPE ? 128 : 0) + 2392 (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); 2393 if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { 2394 ret = Z_BUF_ERROR; 2395 } 2396 return ret; 2397 } 2398 2399 function inflateEnd(strm) { 2400 2401 if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { 2402 return Z_STREAM_ERROR; 2403 } 2404 2405 var state = strm.state; 2406 if (state.window) { 2407 state.window = null; 2408 } 2409 strm.state = null; 2410 return Z_OK; 2411 } 2412 2413 function inflateGetHeader(strm, head) { 2414 var state; 2415 2416 /* check state */ 2417 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 2418 state = strm.state; 2419 if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } 2420 2421 /* save header structure */ 2422 state.head = head; 2423 head.done = false; 2424 return Z_OK; 2425 } 2426 2427 function inflateSetDictionary(strm, dictionary) { 2428 var dictLength = dictionary.length; 2429 2430 var state; 2431 var dictid; 2432 var ret; 2433 2434 /* check state */ 2435 if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } 2436 state = strm.state; 2437 2438 if (state.wrap !== 0 && state.mode !== DICT) { 2439 return Z_STREAM_ERROR; 2440 } 2441 2442 /* check for correct dictionary identifier */ 2443 if (state.mode === DICT) { 2444 dictid = 1; /* adler32(0, null, 0)*/ 2445 /* dictid = adler32(dictid, dictionary, dictLength); */ 2446 dictid = adler32(dictid, dictionary, dictLength, 0); 2447 if (dictid !== state.check) { 2448 return Z_DATA_ERROR; 2449 } 2450 } 2451 /* copy dictionary to window using updatewindow(), which will amend the 2452 existing dictionary if appropriate */ 2453 ret = updatewindow(strm, dictionary, dictLength, dictLength); 2454 if (ret) { 2455 state.mode = MEM; 2456 return Z_MEM_ERROR; 2457 } 2458 state.havedict = 1; 2459 // Tracev((stderr, "inflate: dictionary set\n")); 2460 return Z_OK; 2461 } 2462 2463 exports.inflateReset = inflateReset; 2464 exports.inflateReset2 = inflateReset2; 2465 exports.inflateResetKeep = inflateResetKeep; 2466 exports.inflateInit = inflateInit; 2467 exports.inflateInit2 = inflateInit2; 2468 exports.inflate = inflate; 2469 exports.inflateEnd = inflateEnd; 2470 exports.inflateGetHeader = inflateGetHeader; 2471 exports.inflateSetDictionary = inflateSetDictionary; 2472 exports.inflateInfo = 'pako inflate (from Nodeca project)'; 2473 2474 /* Not implemented 2475 exports.inflateCopy = inflateCopy; 2476 exports.inflateGetDictionary = inflateGetDictionary; 2477 exports.inflateMark = inflateMark; 2478 exports.inflatePrime = inflatePrime; 2479 exports.inflateSync = inflateSync; 2480 exports.inflateSyncPoint = inflateSyncPoint; 2481 exports.inflateUndermine = inflateUndermine; 2482 */ 2483 2484 },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){ 2485 'use strict'; 2486 2487 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 2488 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 2489 // 2490 // This software is provided 'as-is', without any express or implied 2491 // warranty. In no event will the authors be held liable for any damages 2492 // arising from the use of this software. 2493 // 2494 // Permission is granted to anyone to use this software for any purpose, 2495 // including commercial applications, and to alter it and redistribute it 2496 // freely, subject to the following restrictions: 2497 // 2498 // 1. The origin of this software must not be misrepresented; you must not 2499 // claim that you wrote the original software. If you use this software 2500 // in a product, an acknowledgment in the product documentation would be 2501 // appreciated but is not required. 2502 // 2. Altered source versions must be plainly marked as such, and must not be 2503 // misrepresented as being the original software. 2504 // 3. This notice may not be removed or altered from any source distribution. 2505 2506 var utils = require('../utils/common'); 2507 2508 var MAXBITS = 15; 2509 var ENOUGH_LENS = 852; 2510 var ENOUGH_DISTS = 592; 2511 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); 2512 2513 var CODES = 0; 2514 var LENS = 1; 2515 var DISTS = 2; 2516 2517 var lbase = [ /* Length codes 257..285 base */ 2518 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 2519 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 2520 ]; 2521 2522 var lext = [ /* Length codes 257..285 extra */ 2523 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 2524 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 2525 ]; 2526 2527 var dbase = [ /* Distance codes 0..29 base */ 2528 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 2529 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 2530 8193, 12289, 16385, 24577, 0, 0 2531 ]; 2532 2533 var dext = [ /* Distance codes 0..29 extra */ 2534 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 2535 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 2536 28, 28, 29, 29, 64, 64 2537 ]; 2538 2539 module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) 2540 { 2541 var bits = opts.bits; 2542 //here = opts.here; /* table entry for duplication */ 2543 2544 var len = 0; /* a code's length in bits */ 2545 var sym = 0; /* index of code symbols */ 2546 var min = 0, max = 0; /* minimum and maximum code lengths */ 2547 var root = 0; /* number of index bits for root table */ 2548 var curr = 0; /* number of index bits for current table */ 2549 var drop = 0; /* code bits to drop for sub-table */ 2550 var left = 0; /* number of prefix codes available */ 2551 var used = 0; /* code entries in table used */ 2552 var huff = 0; /* Huffman code */ 2553 var incr; /* for incrementing code, index */ 2554 var fill; /* index for replicating entries */ 2555 var low; /* low bits for current root entry */ 2556 var mask; /* mask for low root bits */ 2557 var next; /* next available space in table */ 2558 var base = null; /* base value table to use */ 2559 var base_index = 0; 2560 // var shoextra; /* extra bits table to use */ 2561 var end; /* use base and extra for symbol > end */ 2562 var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ 2563 var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ 2564 var extra = null; 2565 var extra_index = 0; 2566 2567 var here_bits, here_op, here_val; 2568 2569 /* 2570 Process a set of code lengths to create a canonical Huffman code. The 2571 code lengths are lens[0..codes-1]. Each length corresponds to the 2572 symbols 0..codes-1. The Huffman code is generated by first sorting the 2573 symbols by length from short to long, and retaining the symbol order 2574 for codes with equal lengths. Then the code starts with all zero bits 2575 for the first code of the shortest length, and the codes are integer 2576 increments for the same length, and zeros are appended as the length 2577 increases. For the deflate format, these bits are stored backwards 2578 from their more natural integer increment ordering, and so when the 2579 decoding tables are built in the large loop below, the integer codes 2580 are incremented backwards. 2581 2582 This routine assumes, but does not check, that all of the entries in 2583 lens[] are in the range 0..MAXBITS. The caller must assure this. 2584 1..MAXBITS is interpreted as that code length. zero means that that 2585 symbol does not occur in this code. 2586 2587 The codes are sorted by computing a count of codes for each length, 2588 creating from that a table of starting indices for each length in the 2589 sorted table, and then entering the symbols in order in the sorted 2590 table. The sorted table is work[], with that space being provided by 2591 the caller. 2592 2593 The length counts are used for other purposes as well, i.e. finding 2594 the minimum and maximum length codes, determining if there are any 2595 codes at all, checking for a valid set of lengths, and looking ahead 2596 at length counts to determine sub-table sizes when building the 2597 decoding tables. 2598 */ 2599 2600 /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ 2601 for (len = 0; len <= MAXBITS; len++) { 2602 count[len] = 0; 2603 } 2604 for (sym = 0; sym < codes; sym++) { 2605 count[lens[lens_index + sym]]++; 2606 } 2607 2608 /* bound code lengths, force root to be within code lengths */ 2609 root = bits; 2610 for (max = MAXBITS; max >= 1; max--) { 2611 if (count[max] !== 0) { break; } 2612 } 2613 if (root > max) { 2614 root = max; 2615 } 2616 if (max === 0) { /* no symbols to code at all */ 2617 //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ 2618 //table.bits[opts.table_index] = 1; //here.bits = (var char)1; 2619 //table.val[opts.table_index++] = 0; //here.val = (var short)0; 2620 table[table_index++] = (1 << 24) | (64 << 16) | 0; 2621 2622 2623 //table.op[opts.table_index] = 64; 2624 //table.bits[opts.table_index] = 1; 2625 //table.val[opts.table_index++] = 0; 2626 table[table_index++] = (1 << 24) | (64 << 16) | 0; 2627 2628 opts.bits = 1; 2629 return 0; /* no symbols, but wait for decoding to report error */ 2630 } 2631 for (min = 1; min < max; min++) { 2632 if (count[min] !== 0) { break; } 2633 } 2634 if (root < min) { 2635 root = min; 2636 } 2637 2638 /* check for an over-subscribed or incomplete set of lengths */ 2639 left = 1; 2640 for (len = 1; len <= MAXBITS; len++) { 2641 left <<= 1; 2642 left -= count[len]; 2643 if (left < 0) { 2644 return -1; 2645 } /* over-subscribed */ 2646 } 2647 if (left > 0 && (type === CODES || max !== 1)) { 2648 return -1; /* incomplete set */ 2649 } 2650 2651 /* generate offsets into symbol table for each length for sorting */ 2652 offs[1] = 0; 2653 for (len = 1; len < MAXBITS; len++) { 2654 offs[len + 1] = offs[len] + count[len]; 2655 } 2656 2657 /* sort symbols by length, by symbol order within each length */ 2658 for (sym = 0; sym < codes; sym++) { 2659 if (lens[lens_index + sym] !== 0) { 2660 work[offs[lens[lens_index + sym]]++] = sym; 2661 } 2662 } 2663 2664 /* 2665 Create and fill in decoding tables. In this loop, the table being 2666 filled is at next and has curr index bits. The code being used is huff 2667 with length len. That code is converted to an index by dropping drop 2668 bits off of the bottom. For codes where len is less than drop + curr, 2669 those top drop + curr - len bits are incremented through all values to 2670 fill the table with replicated entries. 2671 2672 root is the number of index bits for the root table. When len exceeds 2673 root, sub-tables are created pointed to by the root entry with an index 2674 of the low root bits of huff. This is saved in low to check for when a 2675 new sub-table should be started. drop is zero when the root table is 2676 being filled, and drop is root when sub-tables are being filled. 2677 2678 When a new sub-table is needed, it is necessary to look ahead in the 2679 code lengths to determine what size sub-table is needed. The length 2680 counts are used for this, and so count[] is decremented as codes are 2681 entered in the tables. 2682 2683 used keeps track of how many table entries have been allocated from the 2684 provided *table space. It is checked for LENS and DIST tables against 2685 the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in 2686 the initial root table size constants. See the comments in inftrees.h 2687 for more information. 2688 2689 sym increments through all symbols, and the loop terminates when 2690 all codes of length max, i.e. all codes, have been processed. This 2691 routine permits incomplete codes, so another loop after this one fills 2692 in the rest of the decoding tables with invalid code markers. 2693 */ 2694 2695 /* set up for code type */ 2696 // poor man optimization - use if-else instead of switch, 2697 // to avoid deopts in old v8 2698 if (type === CODES) { 2699 base = extra = work; /* dummy value--not used */ 2700 end = 19; 2701 2702 } else if (type === LENS) { 2703 base = lbase; 2704 base_index -= 257; 2705 extra = lext; 2706 extra_index -= 257; 2707 end = 256; 2708 2709 } else { /* DISTS */ 2710 base = dbase; 2711 extra = dext; 2712 end = -1; 2713 } 2714 2715 /* initialize opts for loop */ 2716 huff = 0; /* starting code */ 2717 sym = 0; /* starting code symbol */ 2718 len = min; /* starting code length */ 2719 next = table_index; /* current table to fill in */ 2720 curr = root; /* current table index bits */ 2721 drop = 0; /* current bits to drop from code for index */ 2722 low = -1; /* trigger new sub-table when len > root */ 2723 used = 1 << root; /* use root table entries */ 2724 mask = used - 1; /* mask for comparing low */ 2725 2726 /* check available table space */ 2727 if ((type === LENS && used > ENOUGH_LENS) || 2728 (type === DISTS && used > ENOUGH_DISTS)) { 2729 return 1; 2730 } 2731 2732 /* process all codes and make table entries */ 2733 for (;;) { 2734 /* create table entry */ 2735 here_bits = len - drop; 2736 if (work[sym] < end) { 2737 here_op = 0; 2738 here_val = work[sym]; 2739 } 2740 else if (work[sym] > end) { 2741 here_op = extra[extra_index + work[sym]]; 2742 here_val = base[base_index + work[sym]]; 2743 } 2744 else { 2745 here_op = 32 + 64; /* end of block */ 2746 here_val = 0; 2747 } 2748 2749 /* replicate for those indices with low len bits equal to huff */ 2750 incr = 1 << (len - drop); 2751 fill = 1 << curr; 2752 min = fill; /* save offset to next table */ 2753 do { 2754 fill -= incr; 2755 table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; 2756 } while (fill !== 0); 2757 2758 /* backwards increment the len-bit code huff */ 2759 incr = 1 << (len - 1); 2760 while (huff & incr) { 2761 incr >>= 1; 2762 } 2763 if (incr !== 0) { 2764 huff &= incr - 1; 2765 huff += incr; 2766 } else { 2767 huff = 0; 2768 } 2769 2770 /* go to next symbol, update count, len */ 2771 sym++; 2772 if (--count[len] === 0) { 2773 if (len === max) { break; } 2774 len = lens[lens_index + work[sym]]; 2775 } 2776 2777 /* create new sub-table if needed */ 2778 if (len > root && (huff & mask) !== low) { 2779 /* if first time, transition to sub-tables */ 2780 if (drop === 0) { 2781 drop = root; 2782 } 2783 2784 /* increment past last table */ 2785 next += min; /* here min is 1 << curr */ 2786 2787 /* determine length of next table */ 2788 curr = len - drop; 2789 left = 1 << curr; 2790 while (curr + drop < max) { 2791 left -= count[curr + drop]; 2792 if (left <= 0) { break; } 2793 curr++; 2794 left <<= 1; 2795 } 2796 2797 /* check for enough space */ 2798 used += 1 << curr; 2799 if ((type === LENS && used > ENOUGH_LENS) || 2800 (type === DISTS && used > ENOUGH_DISTS)) { 2801 return 1; 2802 } 2803 2804 /* point entry in root table to sub-table */ 2805 low = huff & mask; 2806 /*table.op[low] = curr; 2807 table.bits[low] = root; 2808 table.val[low] = next - opts.table_index;*/ 2809 table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; 2810 } 2811 } 2812 2813 /* fill in remaining table entry if code is incomplete (guaranteed to have 2814 at most one remaining entry, since if the code is incomplete, the 2815 maximum code length that was allowed to get this far is one bit) */ 2816 if (huff !== 0) { 2817 //table.op[next + huff] = 64; /* invalid code marker */ 2818 //table.bits[next + huff] = len - drop; 2819 //table.val[next + huff] = 0; 2820 table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; 2821 } 2822 2823 /* set return parameters */ 2824 //opts.table_index += used; 2825 opts.bits = root; 2826 return 0; 2827 }; 2828 2829 },{"../utils/common":1}],10:[function(require,module,exports){ 2830 'use strict'; 2831 2832 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 2833 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 2834 // 2835 // This software is provided 'as-is', without any express or implied 2836 // warranty. In no event will the authors be held liable for any damages 2837 // arising from the use of this software. 2838 // 2839 // Permission is granted to anyone to use this software for any purpose, 2840 // including commercial applications, and to alter it and redistribute it 2841 // freely, subject to the following restrictions: 2842 // 2843 // 1. The origin of this software must not be misrepresented; you must not 2844 // claim that you wrote the original software. If you use this software 2845 // in a product, an acknowledgment in the product documentation would be 2846 // appreciated but is not required. 2847 // 2. Altered source versions must be plainly marked as such, and must not be 2848 // misrepresented as being the original software. 2849 // 3. This notice may not be removed or altered from any source distribution. 2850 2851 module.exports = { 2852 2: 'need dictionary', /* Z_NEED_DICT 2 */ 2853 1: 'stream end', /* Z_STREAM_END 1 */ 2854 0: '', /* Z_OK 0 */ 2855 '-1': 'file error', /* Z_ERRNO (-1) */ 2856 '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ 2857 '-3': 'data error', /* Z_DATA_ERROR (-3) */ 2858 '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ 2859 '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ 2860 '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ 2861 }; 2862 2863 },{}],11:[function(require,module,exports){ 2864 'use strict'; 2865 2866 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 2867 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 2868 // 2869 // This software is provided 'as-is', without any express or implied 2870 // warranty. In no event will the authors be held liable for any damages 2871 // arising from the use of this software. 2872 // 2873 // Permission is granted to anyone to use this software for any purpose, 2874 // including commercial applications, and to alter it and redistribute it 2875 // freely, subject to the following restrictions: 2876 // 2877 // 1. The origin of this software must not be misrepresented; you must not 2878 // claim that you wrote the original software. If you use this software 2879 // in a product, an acknowledgment in the product documentation would be 2880 // appreciated but is not required. 2881 // 2. Altered source versions must be plainly marked as such, and must not be 2882 // misrepresented as being the original software. 2883 // 3. This notice may not be removed or altered from any source distribution. 2884 2885 function ZStream() { 2886 /* next input byte */ 2887 this.input = null; // JS specific, because we have no pointers 2888 this.next_in = 0; 2889 /* number of bytes available at input */ 2890 this.avail_in = 0; 2891 /* total number of input bytes read so far */ 2892 this.total_in = 0; 2893 /* next output byte should be put there */ 2894 this.output = null; // JS specific, because we have no pointers 2895 this.next_out = 0; 2896 /* remaining free space at output */ 2897 this.avail_out = 0; 2898 /* total number of bytes output so far */ 2899 this.total_out = 0; 2900 /* last error message, NULL if no error */ 2901 this.msg = ''/*Z_NULL*/; 2902 /* not visible by applications */ 2903 this.state = null; 2904 /* best guess about the data type: binary or text */ 2905 this.data_type = 2/*Z_UNKNOWN*/; 2906 /* adler32 value of the uncompressed data */ 2907 this.adler = 0; 2908 } 2909 2910 module.exports = ZStream; 2911 2912 },{}],"/lib/inflate.js":[function(require,module,exports){ 2913 'use strict'; 2914 2915 2916 var zlib_inflate = require('./zlib/inflate'); 2917 var utils = require('./utils/common'); 2918 var strings = require('./utils/strings'); 2919 var c = require('./zlib/constants'); 2920 var msg = require('./zlib/messages'); 2921 var ZStream = require('./zlib/zstream'); 2922 var GZheader = require('./zlib/gzheader'); 2923 2924 var toString = Object.prototype.toString; 2925 2926 /** 2927 * class Inflate 2928 * 2929 * Generic JS-style wrapper for zlib calls. If you don't need 2930 * streaming behaviour - use more simple functions: [[inflate]] 2931 * and [[inflateRaw]]. 2932 **/ 2933 2934 /* internal 2935 * inflate.chunks -> Array 2936 * 2937 * Chunks of output data, if [[Inflate#onData]] not overridden. 2938 **/ 2939 2940 /** 2941 * Inflate.result -> Uint8Array|Array|String 2942 * 2943 * Uncompressed result, generated by default [[Inflate#onData]] 2944 * and [[Inflate#onEnd]] handlers. Filled after you push last chunk 2945 * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you 2946 * push a chunk with explicit flush (call [[Inflate#push]] with 2947 * `Z_SYNC_FLUSH` param). 2948 **/ 2949 2950 /** 2951 * Inflate.err -> Number 2952 * 2953 * Error code after inflate finished. 0 (Z_OK) on success. 2954 * Should be checked if broken data possible. 2955 **/ 2956 2957 /** 2958 * Inflate.msg -> String 2959 * 2960 * Error message, if [[Inflate.err]] != 0 2961 **/ 2962 2963 2964 /** 2965 * new Inflate(options) 2966 * - options (Object): zlib inflate options. 2967 * 2968 * Creates new inflator instance with specified params. Throws exception 2969 * on bad params. Supported options: 2970 * 2971 * - `windowBits` 2972 * - `dictionary` 2973 * 2974 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 2975 * for more information on these. 2976 * 2977 * Additional options, for internal needs: 2978 * 2979 * - `chunkSize` - size of generated data chunks (16K by default) 2980 * - `raw` (Boolean) - do raw inflate 2981 * - `to` (String) - if equal to 'string', then result will be converted 2982 * from utf8 to utf16 (javascript) string. When string output requested, 2983 * chunk length can differ from `chunkSize`, depending on content. 2984 * 2985 * By default, when no options set, autodetect deflate/gzip data format via 2986 * wrapper header. 2987 * 2988 * ##### Example: 2989 * 2990 * ```javascript 2991 * var pako = require('pako') 2992 * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) 2993 * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); 2994 * 2995 * var inflate = new pako.Inflate({ level: 3}); 2996 * 2997 * inflate.push(chunk1, false); 2998 * inflate.push(chunk2, true); // true -> last chunk 2999 * 3000 * if (inflate.err) { throw new Error(inflate.err); } 3001 * 3002 * console.log(inflate.result); 3003 * ``` 3004 **/ 3005 function Inflate(options) { 3006 if (!(this instanceof Inflate)) return new Inflate(options); 3007 3008 this.options = utils.assign({ 3009 chunkSize: 16384, 3010 windowBits: 0, 3011 to: '' 3012 }, options || {}); 3013 3014 var opt = this.options; 3015 3016 // Force window size for `raw` data, if not set directly, 3017 // because we have no header for autodetect. 3018 if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { 3019 opt.windowBits = -opt.windowBits; 3020 if (opt.windowBits === 0) { opt.windowBits = -15; } 3021 } 3022 3023 // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate 3024 if ((opt.windowBits >= 0) && (opt.windowBits < 16) && 3025 !(options && options.windowBits)) { 3026 opt.windowBits += 32; 3027 } 3028 3029 // Gzip header has no info about windows size, we can do autodetect only 3030 // for deflate. So, if window size not set, force it to max when gzip possible 3031 if ((opt.windowBits > 15) && (opt.windowBits < 48)) { 3032 // bit 3 (16) -> gzipped data 3033 // bit 4 (32) -> autodetect gzip/deflate 3034 if ((opt.windowBits & 15) === 0) { 3035 opt.windowBits |= 15; 3036 } 3037 } 3038 3039 this.err = 0; // error code, if happens (0 = Z_OK) 3040 this.msg = ''; // error message 3041 this.ended = false; // used to avoid multiple onEnd() calls 3042 this.chunks = []; // chunks of compressed data 3043 3044 this.strm = new ZStream(); 3045 this.strm.avail_out = 0; 3046 3047 var status = zlib_inflate.inflateInit2( 3048 this.strm, 3049 opt.windowBits 3050 ); 3051 3052 if (status !== c.Z_OK) { 3053 throw new Error(msg[status]); 3054 } 3055 3056 this.header = new GZheader(); 3057 3058 zlib_inflate.inflateGetHeader(this.strm, this.header); 3059 3060 // Setup dictionary 3061 if (opt.dictionary) { 3062 // Convert data if needed 3063 if (typeof opt.dictionary === 'string') { 3064 opt.dictionary = strings.string2buf(opt.dictionary); 3065 } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { 3066 opt.dictionary = new Uint8Array(opt.dictionary); 3067 } 3068 if (opt.raw) { //In raw mode we need to set the dictionary early 3069 status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); 3070 if (status !== c.Z_OK) { 3071 throw new Error(msg[status]); 3072 } 3073 } 3074 } 3075 } 3076 3077 /** 3078 * Inflate#push(data[, mode]) -> Boolean 3079 * - data (Uint8Array|Array|ArrayBuffer|String): input data 3080 * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. 3081 * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. 3082 * 3083 * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with 3084 * new output chunks. Returns `true` on success. The last data block must have 3085 * mode Z_FINISH (or `true`). That will flush internal pending buffers and call 3086 * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you 3087 * can use mode Z_SYNC_FLUSH, keeping the decompression context. 3088 * 3089 * On fail call [[Inflate#onEnd]] with error code and return false. 3090 * 3091 * We strongly recommend to use `Uint8Array` on input for best speed (output 3092 * format is detected automatically). Also, don't skip last param and always 3093 * use the same type in your code (boolean or number). That will improve JS speed. 3094 * 3095 * For regular `Array`-s make sure all elements are [0..255]. 3096 * 3097 * ##### Example 3098 * 3099 * ```javascript 3100 * push(chunk, false); // push one of data chunks 3101 * ... 3102 * push(chunk, true); // push last chunk 3103 * ``` 3104 **/ 3105 Inflate.prototype.push = function (data, mode) { 3106 var strm = this.strm; 3107 var chunkSize = this.options.chunkSize; 3108 var dictionary = this.options.dictionary; 3109 var status, _mode; 3110 var next_out_utf8, tail, utf8str; 3111 3112 // Flag to properly process Z_BUF_ERROR on testing inflate call 3113 // when we check that all output data was flushed. 3114 var allowBufError = false; 3115 3116 if (this.ended) { return false; } 3117 _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); 3118 3119 // Convert data if needed 3120 if (typeof data === 'string') { 3121 // Only binary strings can be decompressed on practice 3122 strm.input = strings.binstring2buf(data); 3123 } else if (toString.call(data) === '[object ArrayBuffer]') { 3124 strm.input = new Uint8Array(data); 3125 } else { 3126 strm.input = data; 3127 } 3128 3129 strm.next_in = 0; 3130 strm.avail_in = strm.input.length; 3131 3132 do { 3133 if (strm.avail_out === 0) { 3134 strm.output = new utils.Buf8(chunkSize); 3135 strm.next_out = 0; 3136 strm.avail_out = chunkSize; 3137 } 3138 3139 status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ 3140 3141 if (status === c.Z_NEED_DICT && dictionary) { 3142 status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); 3143 } 3144 3145 if (status === c.Z_BUF_ERROR && allowBufError === true) { 3146 status = c.Z_OK; 3147 allowBufError = false; 3148 } 3149 3150 if (status !== c.Z_STREAM_END && status !== c.Z_OK) { 3151 this.onEnd(status); 3152 this.ended = true; 3153 return false; 3154 } 3155 3156 if (strm.next_out) { 3157 if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { 3158 3159 if (this.options.to === 'string') { 3160 3161 next_out_utf8 = strings.utf8border(strm.output, strm.next_out); 3162 3163 tail = strm.next_out - next_out_utf8; 3164 utf8str = strings.buf2string(strm.output, next_out_utf8); 3165 3166 // move tail 3167 strm.next_out = tail; 3168 strm.avail_out = chunkSize - tail; 3169 if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } 3170 3171 this.onData(utf8str); 3172 3173 } else { 3174 this.onData(utils.shrinkBuf(strm.output, strm.next_out)); 3175 } 3176 } 3177 } 3178 3179 // When no more input data, we should check that internal inflate buffers 3180 // are flushed. The only way to do it when avail_out = 0 - run one more 3181 // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. 3182 // Here we set flag to process this error properly. 3183 // 3184 // NOTE. Deflate does not return error in this case and does not needs such 3185 // logic. 3186 if (strm.avail_in === 0 && strm.avail_out === 0) { 3187 allowBufError = true; 3188 } 3189 3190 } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); 3191 3192 if (status === c.Z_STREAM_END) { 3193 _mode = c.Z_FINISH; 3194 } 3195 3196 // Finalize on the last chunk. 3197 if (_mode === c.Z_FINISH) { 3198 status = zlib_inflate.inflateEnd(this.strm); 3199 this.onEnd(status); 3200 this.ended = true; 3201 return status === c.Z_OK; 3202 } 3203 3204 // callback interim results if Z_SYNC_FLUSH. 3205 if (_mode === c.Z_SYNC_FLUSH) { 3206 this.onEnd(c.Z_OK); 3207 strm.avail_out = 0; 3208 return true; 3209 } 3210 3211 return true; 3212 }; 3213 3214 3215 /** 3216 * Inflate#onData(chunk) -> Void 3217 * - chunk (Uint8Array|Array|String): output data. Type of array depends 3218 * on js engine support. When string output requested, each chunk 3219 * will be string. 3220 * 3221 * By default, stores data blocks in `chunks[]` property and glue 3222 * those in `onEnd`. Override this handler, if you need another behaviour. 3223 **/ 3224 Inflate.prototype.onData = function (chunk) { 3225 this.chunks.push(chunk); 3226 }; 3227 3228 3229 /** 3230 * Inflate#onEnd(status) -> Void 3231 * - status (Number): inflate status. 0 (Z_OK) on success, 3232 * other if not. 3233 * 3234 * Called either after you tell inflate that the input stream is 3235 * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) 3236 * or if an error happened. By default - join collected chunks, 3237 * free memory and fill `results` / `err` properties. 3238 **/ 3239 Inflate.prototype.onEnd = function (status) { 3240 // On success - join 3241 if (status === c.Z_OK) { 3242 if (this.options.to === 'string') { 3243 // Glue & convert here, until we teach pako to send 3244 // utf8 aligned strings to onData 3245 this.result = this.chunks.join(''); 3246 } else { 3247 this.result = utils.flattenChunks(this.chunks); 3248 } 3249 } 3250 this.chunks = []; 3251 this.err = status; 3252 this.msg = this.strm.msg; 3253 }; 3254 3255 3256 /** 3257 * inflate(data[, options]) -> Uint8Array|Array|String 3258 * - data (Uint8Array|Array|String): input data to decompress. 3259 * - options (Object): zlib inflate options. 3260 * 3261 * Decompress `data` with inflate/ungzip and `options`. Autodetect 3262 * format via wrapper header by default. That's why we don't provide 3263 * separate `ungzip` method. 3264 * 3265 * Supported options are: 3266 * 3267 * - windowBits 3268 * 3269 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 3270 * for more information. 3271 * 3272 * Sugar (options): 3273 * 3274 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify 3275 * negative windowBits implicitly. 3276 * - `to` (String) - if equal to 'string', then result will be converted 3277 * from utf8 to utf16 (javascript) string. When string output requested, 3278 * chunk length can differ from `chunkSize`, depending on content. 3279 * 3280 * 3281 * ##### Example: 3282 * 3283 * ```javascript 3284 * var pako = require('pako') 3285 * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) 3286 * , output; 3287 * 3288 * try { 3289 * output = pako.inflate(input); 3290 * } catch (err) 3291 * console.log(err); 3292 * } 3293 * ``` 3294 **/ 3295 function inflate(input, options) { 3296 var inflator = new Inflate(options); 3297 3298 inflator.push(input, true); 3299 3300 // That will never happens, if you don't cheat with options :) 3301 if (inflator.err) { throw inflator.msg || msg[inflator.err]; } 3302 3303 return inflator.result; 3304 } 3305 3306 3307 /** 3308 * inflateRaw(data[, options]) -> Uint8Array|Array|String 3309 * - data (Uint8Array|Array|String): input data to decompress. 3310 * - options (Object): zlib inflate options. 3311 * 3312 * The same as [[inflate]], but creates raw data, without wrapper 3313 * (header and adler32 crc). 3314 **/ 3315 function inflateRaw(input, options) { 3316 options = options || {}; 3317 options.raw = true; 3318 return inflate(input, options); 3319 } 3320 3321 3322 /** 3323 * ungzip(data[, options]) -> Uint8Array|Array|String 3324 * - data (Uint8Array|Array|String): input data to decompress. 3325 * - options (Object): zlib inflate options. 3326 * 3327 * Just shortcut to [[inflate]], because it autodetects format 3328 * by header.content. Done for convenience. 3329 **/ 3330 3331 3332 exports.Inflate = Inflate; 3333 exports.inflate = inflate; 3334 exports.inflateRaw = inflateRaw; 3335 exports.ungzip = inflate; 3336 3337 },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js") 3338 }); 3339 /* eslint-enable */ 3340 3341 3342 /***/ }), 3343 3344 /***/ 8572: 3345 /***/ ((module) => { 3346 3347 /** 3348 * Credits: 3349 * 3350 * lib-font 3351 * https://github.com/Pomax/lib-font 3352 * https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js 3353 * 3354 * The MIT License (MIT) 3355 * 3356 * Copyright (c) 2020 pomax@nihongoresources.com 3357 * 3358 * Permission is hereby granted, free of charge, to any person obtaining a copy 3359 * of this software and associated documentation files (the "Software"), to deal 3360 * in the Software without restriction, including without limitation the rights 3361 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3362 * copies of the Software, and to permit persons to whom the Software is 3363 * furnished to do so, subject to the following conditions: 3364 * 3365 * The above copyright notice and this permission notice shall be included in all 3366 * copies or substantial portions of the Software. 3367 * 3368 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3369 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3370 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3371 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3372 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3373 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 3374 * SOFTWARE. 3375 */ 3376 3377 /* eslint eslint-comments/no-unlimited-disable: 0 */ 3378 /* eslint-disable */ 3379 (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){ 3380 /* Copyright 2013 Google Inc. All Rights Reserved. 3381 3382 Licensed under the Apache License, Version 2.0 (the "License"); 3383 you may not use this file except in compliance with the License. 3384 You may obtain a copy of the License at 3385 3386 http://www.apache.org/licenses/LICENSE-2.0 3387 3388 Unless required by applicable law or agreed to in writing, software 3389 distributed under the License is distributed on an "AS IS" BASIS, 3390 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3391 See the License for the specific language governing permissions and 3392 limitations under the License. 3393 3394 Bit reading helpers 3395 */ 3396 3397 var BROTLI_READ_SIZE = 4096; 3398 var BROTLI_IBUF_SIZE = (2 * BROTLI_READ_SIZE + 32); 3399 var BROTLI_IBUF_MASK = (2 * BROTLI_READ_SIZE - 1); 3400 3401 var kBitMask = new Uint32Array([ 3402 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 3403 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215 3404 ]); 3405 3406 /* Input byte buffer, consist of a ringbuffer and a "slack" region where */ 3407 /* bytes from the start of the ringbuffer are copied. */ 3408 function BrotliBitReader(input) { 3409 this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE); 3410 this.input_ = input; /* input callback */ 3411 3412 this.reset(); 3413 } 3414 3415 BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE; 3416 BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK; 3417 3418 BrotliBitReader.prototype.reset = function() { 3419 this.buf_ptr_ = 0; /* next input will write here */ 3420 this.val_ = 0; /* pre-fetched bits */ 3421 this.pos_ = 0; /* byte position in stream */ 3422 this.bit_pos_ = 0; /* current bit-reading position in val_ */ 3423 this.bit_end_pos_ = 0; /* bit-reading end position from LSB of val_ */ 3424 this.eos_ = 0; /* input stream is finished */ 3425 3426 this.readMoreInput(); 3427 for (var i = 0; i < 4; i++) { 3428 this.val_ |= this.buf_[this.pos_] << (8 * i); 3429 ++this.pos_; 3430 } 3431 3432 return this.bit_end_pos_ > 0; 3433 }; 3434 3435 /* Fills up the input ringbuffer by calling the input callback. 3436 3437 Does nothing if there are at least 32 bytes present after current position. 3438 3439 Returns 0 if either: 3440 - the input callback returned an error, or 3441 - there is no more input and the position is past the end of the stream. 3442 3443 After encountering the end of the input stream, 32 additional zero bytes are 3444 copied to the ringbuffer, therefore it is safe to call this function after 3445 every 32 bytes of input is read. 3446 */ 3447 BrotliBitReader.prototype.readMoreInput = function() { 3448 if (this.bit_end_pos_ > 256) { 3449 return; 3450 } else if (this.eos_) { 3451 if (this.bit_pos_ > this.bit_end_pos_) 3452 throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_); 3453 } else { 3454 var dst = this.buf_ptr_; 3455 var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE); 3456 if (bytes_read < 0) { 3457 throw new Error('Unexpected end of input'); 3458 } 3459 3460 if (bytes_read < BROTLI_READ_SIZE) { 3461 this.eos_ = 1; 3462 /* Store 32 bytes of zero after the stream end. */ 3463 for (var p = 0; p < 32; p++) 3464 this.buf_[dst + bytes_read + p] = 0; 3465 } 3466 3467 if (dst === 0) { 3468 /* Copy the head of the ringbuffer to the slack region. */ 3469 for (var p = 0; p < 32; p++) 3470 this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p]; 3471 3472 this.buf_ptr_ = BROTLI_READ_SIZE; 3473 } else { 3474 this.buf_ptr_ = 0; 3475 } 3476 3477 this.bit_end_pos_ += bytes_read << 3; 3478 } 3479 }; 3480 3481 /* Guarantees that there are at least 24 bits in the buffer. */ 3482 BrotliBitReader.prototype.fillBitWindow = function() { 3483 while (this.bit_pos_ >= 8) { 3484 this.val_ >>>= 8; 3485 this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24; 3486 ++this.pos_; 3487 this.bit_pos_ = this.bit_pos_ - 8 >>> 0; 3488 this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0; 3489 } 3490 }; 3491 3492 /* Reads the specified number of bits from Read Buffer. */ 3493 BrotliBitReader.prototype.readBits = function(n_bits) { 3494 if (32 - this.bit_pos_ < n_bits) { 3495 this.fillBitWindow(); 3496 } 3497 3498 var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]); 3499 this.bit_pos_ += n_bits; 3500 return val; 3501 }; 3502 3503 module.exports = BrotliBitReader; 3504 3505 },{}],2:[function(require,module,exports){ 3506 /* Copyright 2013 Google Inc. All Rights Reserved. 3507 3508 Licensed under the Apache License, Version 2.0 (the "License"); 3509 you may not use this file except in compliance with the License. 3510 You may obtain a copy of the License at 3511 3512 http://www.apache.org/licenses/LICENSE-2.0 3513 3514 Unless required by applicable law or agreed to in writing, software 3515 distributed under the License is distributed on an "AS IS" BASIS, 3516 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3517 See the License for the specific language governing permissions and 3518 limitations under the License. 3519 3520 Lookup table to map the previous two bytes to a context id. 3521 3522 There are four different context modeling modes defined here: 3523 CONTEXT_LSB6: context id is the least significant 6 bits of the last byte, 3524 CONTEXT_MSB6: context id is the most significant 6 bits of the last byte, 3525 CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text, 3526 CONTEXT_SIGNED: second-order context model tuned for signed integers. 3527 3528 The context id for the UTF8 context model is calculated as follows. If p1 3529 and p2 are the previous two bytes, we calcualte the context as 3530 3531 context = kContextLookup[p1] | kContextLookup[p2 + 256]. 3532 3533 If the previous two bytes are ASCII characters (i.e. < 128), this will be 3534 equivalent to 3535 3536 context = 4 * context1(p1) + context2(p2), 3537 3538 where context1 is based on the previous byte in the following way: 3539 3540 0 : non-ASCII control 3541 1 : \t, \n, \r 3542 2 : space 3543 3 : other punctuation 3544 4 : " ' 3545 5 : % 3546 6 : ( < [ { 3547 7 : ) > ] } 3548 8 : , ; : 3549 9 : . 3550 10 : = 3551 11 : number 3552 12 : upper-case vowel 3553 13 : upper-case consonant 3554 14 : lower-case vowel 3555 15 : lower-case consonant 3556 3557 and context2 is based on the second last byte: 3558 3559 0 : control, space 3560 1 : punctuation 3561 2 : upper-case letter, number 3562 3 : lower-case letter 3563 3564 If the last byte is ASCII, and the second last byte is not (in a valid UTF8 3565 stream it will be a continuation byte, value between 128 and 191), the 3566 context is the same as if the second last byte was an ASCII control or space. 3567 3568 If the last byte is a UTF8 lead byte (value >= 192), then the next byte will 3569 be a continuation byte and the context id is 2 or 3 depending on the LSB of 3570 the last byte and to a lesser extent on the second last byte if it is ASCII. 3571 3572 If the last byte is a UTF8 continuation byte, the second last byte can be: 3573 - continuation byte: the next byte is probably ASCII or lead byte (assuming 3574 4-byte UTF8 characters are rare) and the context id is 0 or 1. 3575 - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1 3576 - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3 3577 3578 The possible value combinations of the previous two bytes, the range of 3579 context ids and the type of the next byte is summarized in the table below: 3580 3581 |--------\-----------------------------------------------------------------| 3582 | \ Last byte | 3583 | Second \---------------------------------------------------------------| 3584 | last byte \ ASCII | cont. byte | lead byte | 3585 | \ (0-127) | (128-191) | (192-) | 3586 |=============|===================|=====================|==================| 3587 | ASCII | next: ASCII/lead | not valid | next: cont. | 3588 | (0-127) | context: 4 - 63 | | context: 2 - 3 | 3589 |-------------|-------------------|---------------------|------------------| 3590 | cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. | 3591 | (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 | 3592 |-------------|-------------------|---------------------|------------------| 3593 | lead byte | not valid | next: ASCII/lead | not valid | 3594 | (192-207) | | context: 0 - 1 | | 3595 |-------------|-------------------|---------------------|------------------| 3596 | lead byte | not valid | next: cont. | not valid | 3597 | (208-) | | context: 2 - 3 | | 3598 |-------------|-------------------|---------------------|------------------| 3599 3600 The context id for the signed context mode is calculated as: 3601 3602 context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2]. 3603 3604 For any context modeling modes, the context ids can be calculated by |-ing 3605 together two lookups from one table using context model dependent offsets: 3606 3607 context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2]. 3608 3609 where offset1 and offset2 are dependent on the context mode. 3610 */ 3611 3612 var CONTEXT_LSB6 = 0; 3613 var CONTEXT_MSB6 = 1; 3614 var CONTEXT_UTF8 = 2; 3615 var CONTEXT_SIGNED = 3; 3616 3617 /* Common context lookup table for all context modes. */ 3618 exports.lookup = new Uint8Array([ 3619 /* CONTEXT_UTF8, last byte. */ 3620 /* ASCII range. */ 3621 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 3622 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3623 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12, 3624 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12, 3625 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 3626 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12, 3627 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 3628 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0, 3629 /* UTF8 continuation byte range. */ 3630 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3631 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3632 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3633 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3634 /* UTF8 lead byte range. */ 3635 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3636 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3637 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3638 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3639 /* CONTEXT_UTF8 second last byte. */ 3640 /* ASCII range. */ 3641 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3642 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3643 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 3645 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3647 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3648 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, 3649 /* UTF8 continuation byte range. */ 3650 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3651 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3652 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3653 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3654 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3655 /* UTF8 lead byte range. */ 3656 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3659 /* CONTEXT_SIGNED, second last byte. */ 3660 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3663 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3664 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3665 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3666 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3667 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3668 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3669 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3670 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3671 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3672 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3673 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3674 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3675 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 3676 /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */ 3677 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3678 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 3679 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 3680 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 3681 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3682 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3683 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3684 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3685 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3686 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3687 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3688 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3689 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 3690 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 3691 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 3692 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56, 3693 /* CONTEXT_LSB6, last byte. */ 3694 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3695 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3696 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3697 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3698 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3699 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3700 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3701 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3702 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3703 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3704 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3705 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3706 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3707 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3708 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3709 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3710 /* CONTEXT_MSB6, last byte. */ 3711 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3712 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 3713 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 3714 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 3715 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 3716 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 3717 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 3718 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 3719 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 3720 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 3721 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 3722 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 3723 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 3724 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 3725 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 3726 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 3727 /* CONTEXT_{M,L}SB6, second last byte, */ 3728 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3729 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3730 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3731 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3732 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3733 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3734 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3735 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3736 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3737 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3741 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3742 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3743 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3744 ]); 3745 3746 exports.lookupOffsets = new Uint16Array([ 3747 /* CONTEXT_LSB6 */ 3748 1024, 1536, 3749 /* CONTEXT_MSB6 */ 3750 1280, 1536, 3751 /* CONTEXT_UTF8 */ 3752 0, 256, 3753 /* CONTEXT_SIGNED */ 3754 768, 512, 3755 ]); 3756 3757 },{}],3:[function(require,module,exports){ 3758 /* Copyright 2013 Google Inc. All Rights Reserved. 3759 3760 Licensed under the Apache License, Version 2.0 (the "License"); 3761 you may not use this file except in compliance with the License. 3762 You may obtain a copy of the License at 3763 3764 http://www.apache.org/licenses/LICENSE-2.0 3765 3766 Unless required by applicable law or agreed to in writing, software 3767 distributed under the License is distributed on an "AS IS" BASIS, 3768 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3769 See the License for the specific language governing permissions and 3770 limitations under the License. 3771 */ 3772 3773 var BrotliInput = require('./streams').BrotliInput; 3774 var BrotliOutput = require('./streams').BrotliOutput; 3775 var BrotliBitReader = require('./bit_reader'); 3776 var BrotliDictionary = require('./dictionary'); 3777 var HuffmanCode = require('./huffman').HuffmanCode; 3778 var BrotliBuildHuffmanTable = require('./huffman').BrotliBuildHuffmanTable; 3779 var Context = require('./context'); 3780 var Prefix = require('./prefix'); 3781 var Transform = require('./transform'); 3782 3783 var kDefaultCodeLength = 8; 3784 var kCodeLengthRepeatCode = 16; 3785 var kNumLiteralCodes = 256; 3786 var kNumInsertAndCopyCodes = 704; 3787 var kNumBlockLengthCodes = 26; 3788 var kLiteralContextBits = 6; 3789 var kDistanceContextBits = 2; 3790 3791 var HUFFMAN_TABLE_BITS = 8; 3792 var HUFFMAN_TABLE_MASK = 0xff; 3793 /* Maximum possible Huffman table size for an alphabet size of 704, max code 3794 * length 15 and root table bits 8. */ 3795 var HUFFMAN_MAX_TABLE_SIZE = 1080; 3796 3797 var CODE_LENGTH_CODES = 18; 3798 var kCodeLengthCodeOrder = new Uint8Array([ 3799 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3800 ]); 3801 3802 var NUM_DISTANCE_SHORT_CODES = 16; 3803 var kDistanceShortCodeIndexOffset = new Uint8Array([ 3804 3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 3805 ]); 3806 3807 var kDistanceShortCodeValueOffset = new Int8Array([ 3808 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 3809 ]); 3810 3811 var kMaxHuffmanTableSize = new Uint16Array([ 3812 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 3813 854, 886, 920, 952, 984, 1016, 1048, 1080 3814 ]); 3815 3816 function DecodeWindowBits(br) { 3817 var n; 3818 if (br.readBits(1) === 0) { 3819 return 16; 3820 } 3821 3822 n = br.readBits(3); 3823 if (n > 0) { 3824 return 17 + n; 3825 } 3826 3827 n = br.readBits(3); 3828 if (n > 0) { 3829 return 8 + n; 3830 } 3831 3832 return 17; 3833 } 3834 3835 /* Decodes a number in the range [0..255], by reading 1 - 11 bits. */ 3836 function DecodeVarLenUint8(br) { 3837 if (br.readBits(1)) { 3838 var nbits = br.readBits(3); 3839 if (nbits === 0) { 3840 return 1; 3841 } else { 3842 return br.readBits(nbits) + (1 << nbits); 3843 } 3844 } 3845 return 0; 3846 } 3847 3848 function MetaBlockLength() { 3849 this.meta_block_length = 0; 3850 this.input_end = 0; 3851 this.is_uncompressed = 0; 3852 this.is_metadata = false; 3853 } 3854 3855 function DecodeMetaBlockLength(br) { 3856 var out = new MetaBlockLength; 3857 var size_nibbles; 3858 var size_bytes; 3859 var i; 3860 3861 out.input_end = br.readBits(1); 3862 if (out.input_end && br.readBits(1)) { 3863 return out; 3864 } 3865 3866 size_nibbles = br.readBits(2) + 4; 3867 if (size_nibbles === 7) { 3868 out.is_metadata = true; 3869 3870 if (br.readBits(1) !== 0) 3871 throw new Error('Invalid reserved bit'); 3872 3873 size_bytes = br.readBits(2); 3874 if (size_bytes === 0) 3875 return out; 3876 3877 for (i = 0; i < size_bytes; i++) { 3878 var next_byte = br.readBits(8); 3879 if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0) 3880 throw new Error('Invalid size byte'); 3881 3882 out.meta_block_length |= next_byte << (i * 8); 3883 } 3884 } else { 3885 for (i = 0; i < size_nibbles; ++i) { 3886 var next_nibble = br.readBits(4); 3887 if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0) 3888 throw new Error('Invalid size nibble'); 3889 3890 out.meta_block_length |= next_nibble << (i * 4); 3891 } 3892 } 3893 3894 ++out.meta_block_length; 3895 3896 if (!out.input_end && !out.is_metadata) { 3897 out.is_uncompressed = br.readBits(1); 3898 } 3899 3900 return out; 3901 } 3902 3903 /* Decodes the next Huffman code from bit-stream. */ 3904 function ReadSymbol(table, index, br) { 3905 var start_index = index; 3906 3907 var nbits; 3908 br.fillBitWindow(); 3909 index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK; 3910 nbits = table[index].bits - HUFFMAN_TABLE_BITS; 3911 if (nbits > 0) { 3912 br.bit_pos_ += HUFFMAN_TABLE_BITS; 3913 index += table[index].value; 3914 index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1); 3915 } 3916 br.bit_pos_ += table[index].bits; 3917 return table[index].value; 3918 } 3919 3920 function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) { 3921 var symbol = 0; 3922 var prev_code_len = kDefaultCodeLength; 3923 var repeat = 0; 3924 var repeat_code_len = 0; 3925 var space = 32768; 3926 3927 var table = []; 3928 for (var i = 0; i < 32; i++) 3929 table.push(new HuffmanCode(0, 0)); 3930 3931 BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES); 3932 3933 while (symbol < num_symbols && space > 0) { 3934 var p = 0; 3935 var code_len; 3936 3937 br.readMoreInput(); 3938 br.fillBitWindow(); 3939 p += (br.val_ >>> br.bit_pos_) & 31; 3940 br.bit_pos_ += table[p].bits; 3941 code_len = table[p].value & 0xff; 3942 if (code_len < kCodeLengthRepeatCode) { 3943 repeat = 0; 3944 code_lengths[symbol++] = code_len; 3945 if (code_len !== 0) { 3946 prev_code_len = code_len; 3947 space -= 32768 >> code_len; 3948 } 3949 } else { 3950 var extra_bits = code_len - 14; 3951 var old_repeat; 3952 var repeat_delta; 3953 var new_len = 0; 3954 if (code_len === kCodeLengthRepeatCode) { 3955 new_len = prev_code_len; 3956 } 3957 if (repeat_code_len !== new_len) { 3958 repeat = 0; 3959 repeat_code_len = new_len; 3960 } 3961 old_repeat = repeat; 3962 if (repeat > 0) { 3963 repeat -= 2; 3964 repeat <<= extra_bits; 3965 } 3966 repeat += br.readBits(extra_bits) + 3; 3967 repeat_delta = repeat - old_repeat; 3968 if (symbol + repeat_delta > num_symbols) { 3969 throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols'); 3970 } 3971 3972 for (var x = 0; x < repeat_delta; x++) 3973 code_lengths[symbol + x] = repeat_code_len; 3974 3975 symbol += repeat_delta; 3976 3977 if (repeat_code_len !== 0) { 3978 space -= repeat_delta << (15 - repeat_code_len); 3979 } 3980 } 3981 } 3982 if (space !== 0) { 3983 throw new Error("[ReadHuffmanCodeLengths] space = " + space); 3984 } 3985 3986 for (; symbol < num_symbols; symbol++) 3987 code_lengths[symbol] = 0; 3988 } 3989 3990 function ReadHuffmanCode(alphabet_size, tables, table, br) { 3991 var table_size = 0; 3992 var simple_code_or_skip; 3993 var code_lengths = new Uint8Array(alphabet_size); 3994 3995 br.readMoreInput(); 3996 3997 /* simple_code_or_skip is used as follows: 3998 1 for simple code; 3999 0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */ 4000 simple_code_or_skip = br.readBits(2); 4001 if (simple_code_or_skip === 1) { 4002 /* Read symbols, codes & code lengths directly. */ 4003 var i; 4004 var max_bits_counter = alphabet_size - 1; 4005 var max_bits = 0; 4006 var symbols = new Int32Array(4); 4007 var num_symbols = br.readBits(2) + 1; 4008 while (max_bits_counter) { 4009 max_bits_counter >>= 1; 4010 ++max_bits; 4011 } 4012 4013 for (i = 0; i < num_symbols; ++i) { 4014 symbols[i] = br.readBits(max_bits) % alphabet_size; 4015 code_lengths[symbols[i]] = 2; 4016 } 4017 code_lengths[symbols[0]] = 1; 4018 switch (num_symbols) { 4019 case 1: 4020 break; 4021 case 3: 4022 if ((symbols[0] === symbols[1]) || 4023 (symbols[0] === symbols[2]) || 4024 (symbols[1] === symbols[2])) { 4025 throw new Error('[ReadHuffmanCode] invalid symbols'); 4026 } 4027 break; 4028 case 2: 4029 if (symbols[0] === symbols[1]) { 4030 throw new Error('[ReadHuffmanCode] invalid symbols'); 4031 } 4032 4033 code_lengths[symbols[1]] = 1; 4034 break; 4035 case 4: 4036 if ((symbols[0] === symbols[1]) || 4037 (symbols[0] === symbols[2]) || 4038 (symbols[0] === symbols[3]) || 4039 (symbols[1] === symbols[2]) || 4040 (symbols[1] === symbols[3]) || 4041 (symbols[2] === symbols[3])) { 4042 throw new Error('[ReadHuffmanCode] invalid symbols'); 4043 } 4044 4045 if (br.readBits(1)) { 4046 code_lengths[symbols[2]] = 3; 4047 code_lengths[symbols[3]] = 3; 4048 } else { 4049 code_lengths[symbols[0]] = 2; 4050 } 4051 break; 4052 } 4053 } else { /* Decode Huffman-coded code lengths. */ 4054 var i; 4055 var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES); 4056 var space = 32; 4057 var num_codes = 0; 4058 /* Static Huffman code for the code length code lengths */ 4059 var huff = [ 4060 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 4061 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1), 4062 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 4063 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5) 4064 ]; 4065 for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) { 4066 var code_len_idx = kCodeLengthCodeOrder[i]; 4067 var p = 0; 4068 var v; 4069 br.fillBitWindow(); 4070 p += (br.val_ >>> br.bit_pos_) & 15; 4071 br.bit_pos_ += huff[p].bits; 4072 v = huff[p].value; 4073 code_length_code_lengths[code_len_idx] = v; 4074 if (v !== 0) { 4075 space -= (32 >> v); 4076 ++num_codes; 4077 } 4078 } 4079 4080 if (!(num_codes === 1 || space === 0)) 4081 throw new Error('[ReadHuffmanCode] invalid num_codes or space'); 4082 4083 ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br); 4084 } 4085 4086 table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size); 4087 4088 if (table_size === 0) { 4089 throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: "); 4090 } 4091 4092 return table_size; 4093 } 4094 4095 function ReadBlockLength(table, index, br) { 4096 var code; 4097 var nbits; 4098 code = ReadSymbol(table, index, br); 4099 nbits = Prefix.kBlockLengthPrefixCode[code].nbits; 4100 return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits); 4101 } 4102 4103 function TranslateShortCodes(code, ringbuffer, index) { 4104 var val; 4105 if (code < NUM_DISTANCE_SHORT_CODES) { 4106 index += kDistanceShortCodeIndexOffset[code]; 4107 index &= 3; 4108 val = ringbuffer[index] + kDistanceShortCodeValueOffset[code]; 4109 } else { 4110 val = code - NUM_DISTANCE_SHORT_CODES + 1; 4111 } 4112 return val; 4113 } 4114 4115 function MoveToFront(v, index) { 4116 var value = v[index]; 4117 var i = index; 4118 for (; i; --i) v[i] = v[i - 1]; 4119 v[0] = value; 4120 } 4121 4122 function InverseMoveToFrontTransform(v, v_len) { 4123 var mtf = new Uint8Array(256); 4124 var i; 4125 for (i = 0; i < 256; ++i) { 4126 mtf[i] = i; 4127 } 4128 for (i = 0; i < v_len; ++i) { 4129 var index = v[i]; 4130 v[i] = mtf[index]; 4131 if (index) MoveToFront(mtf, index); 4132 } 4133 } 4134 4135 /* Contains a collection of huffman trees with the same alphabet size. */ 4136 function HuffmanTreeGroup(alphabet_size, num_htrees) { 4137 this.alphabet_size = alphabet_size; 4138 this.num_htrees = num_htrees; 4139 this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]); 4140 this.htrees = new Uint32Array(num_htrees); 4141 } 4142 4143 HuffmanTreeGroup.prototype.decode = function(br) { 4144 var i; 4145 var table_size; 4146 var next = 0; 4147 for (i = 0; i < this.num_htrees; ++i) { 4148 this.htrees[i] = next; 4149 table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br); 4150 next += table_size; 4151 } 4152 }; 4153 4154 function DecodeContextMap(context_map_size, br) { 4155 var out = { num_htrees: null, context_map: null }; 4156 var use_rle_for_zeros; 4157 var max_run_length_prefix = 0; 4158 var table; 4159 var i; 4160 4161 br.readMoreInput(); 4162 var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1; 4163 4164 var context_map = out.context_map = new Uint8Array(context_map_size); 4165 if (num_htrees <= 1) { 4166 return out; 4167 } 4168 4169 use_rle_for_zeros = br.readBits(1); 4170 if (use_rle_for_zeros) { 4171 max_run_length_prefix = br.readBits(4) + 1; 4172 } 4173 4174 table = []; 4175 for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) { 4176 table[i] = new HuffmanCode(0, 0); 4177 } 4178 4179 ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br); 4180 4181 for (i = 0; i < context_map_size;) { 4182 var code; 4183 4184 br.readMoreInput(); 4185 code = ReadSymbol(table, 0, br); 4186 if (code === 0) { 4187 context_map[i] = 0; 4188 ++i; 4189 } else if (code <= max_run_length_prefix) { 4190 var reps = 1 + (1 << code) + br.readBits(code); 4191 while (--reps) { 4192 if (i >= context_map_size) { 4193 throw new Error("[DecodeContextMap] i >= context_map_size"); 4194 } 4195 context_map[i] = 0; 4196 ++i; 4197 } 4198 } else { 4199 context_map[i] = code - max_run_length_prefix; 4200 ++i; 4201 } 4202 } 4203 if (br.readBits(1)) { 4204 InverseMoveToFrontTransform(context_map, context_map_size); 4205 } 4206 4207 return out; 4208 } 4209 4210 function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) { 4211 var ringbuffer = tree_type * 2; 4212 var index = tree_type; 4213 var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br); 4214 var block_type; 4215 if (type_code === 0) { 4216 block_type = ringbuffers[ringbuffer + (indexes[index] & 1)]; 4217 } else if (type_code === 1) { 4218 block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1; 4219 } else { 4220 block_type = type_code - 2; 4221 } 4222 if (block_type >= max_block_type) { 4223 block_type -= max_block_type; 4224 } 4225 block_types[tree_type] = block_type; 4226 ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type; 4227 ++indexes[index]; 4228 } 4229 4230 function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) { 4231 var rb_size = ringbuffer_mask + 1; 4232 var rb_pos = pos & ringbuffer_mask; 4233 var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK; 4234 var nbytes; 4235 4236 /* For short lengths copy byte-by-byte */ 4237 if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) { 4238 while (len-- > 0) { 4239 br.readMoreInput(); 4240 ringbuffer[rb_pos++] = br.readBits(8); 4241 if (rb_pos === rb_size) { 4242 output.write(ringbuffer, rb_size); 4243 rb_pos = 0; 4244 } 4245 } 4246 return; 4247 } 4248 4249 if (br.bit_end_pos_ < 32) { 4250 throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32'); 4251 } 4252 4253 /* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */ 4254 while (br.bit_pos_ < 32) { 4255 ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_); 4256 br.bit_pos_ += 8; 4257 ++rb_pos; 4258 --len; 4259 } 4260 4261 /* Copy remaining bytes from br.buf_ to ringbuffer. */ 4262 nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3; 4263 if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) { 4264 var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos; 4265 for (var x = 0; x < tail; x++) 4266 ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; 4267 4268 nbytes -= tail; 4269 rb_pos += tail; 4270 len -= tail; 4271 br_pos = 0; 4272 } 4273 4274 for (var x = 0; x < nbytes; x++) 4275 ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; 4276 4277 rb_pos += nbytes; 4278 len -= nbytes; 4279 4280 /* If we wrote past the logical end of the ringbuffer, copy the tail of the 4281 ringbuffer to its beginning and flush the ringbuffer to the output. */ 4282 if (rb_pos >= rb_size) { 4283 output.write(ringbuffer, rb_size); 4284 rb_pos -= rb_size; 4285 for (var x = 0; x < rb_pos; x++) 4286 ringbuffer[x] = ringbuffer[rb_size + x]; 4287 } 4288 4289 /* If we have more to copy than the remaining size of the ringbuffer, then we 4290 first fill the ringbuffer from the input and then flush the ringbuffer to 4291 the output */ 4292 while (rb_pos + len >= rb_size) { 4293 nbytes = rb_size - rb_pos; 4294 if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) { 4295 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); 4296 } 4297 output.write(ringbuffer, rb_size); 4298 len -= nbytes; 4299 rb_pos = 0; 4300 } 4301 4302 /* Copy straight from the input onto the ringbuffer. The ringbuffer will be 4303 flushed to the output at a later time. */ 4304 if (br.input_.read(ringbuffer, rb_pos, len) < len) { 4305 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); 4306 } 4307 4308 /* Restore the state of the bit reader. */ 4309 br.reset(); 4310 } 4311 4312 /* Advances the bit reader position to the next byte boundary and verifies 4313 that any skipped bits are set to zero. */ 4314 function JumpToByteBoundary(br) { 4315 var new_bit_pos = (br.bit_pos_ + 7) & ~7; 4316 var pad_bits = br.readBits(new_bit_pos - br.bit_pos_); 4317 return pad_bits == 0; 4318 } 4319 4320 function BrotliDecompressedSize(buffer) { 4321 var input = new BrotliInput(buffer); 4322 var br = new BrotliBitReader(input); 4323 DecodeWindowBits(br); 4324 var out = DecodeMetaBlockLength(br); 4325 return out.meta_block_length; 4326 } 4327 4328 exports.BrotliDecompressedSize = BrotliDecompressedSize; 4329 4330 function BrotliDecompressBuffer(buffer, output_size) { 4331 var input = new BrotliInput(buffer); 4332 4333 if (output_size == null) { 4334 output_size = BrotliDecompressedSize(buffer); 4335 } 4336 4337 var output_buffer = new Uint8Array(output_size); 4338 var output = new BrotliOutput(output_buffer); 4339 4340 BrotliDecompress(input, output); 4341 4342 if (output.pos < output.buffer.length) { 4343 output.buffer = output.buffer.subarray(0, output.pos); 4344 } 4345 4346 return output.buffer; 4347 } 4348 4349 exports.BrotliDecompressBuffer = BrotliDecompressBuffer; 4350 4351 function BrotliDecompress(input, output) { 4352 var i; 4353 var pos = 0; 4354 var input_end = 0; 4355 var window_bits = 0; 4356 var max_backward_distance; 4357 var max_distance = 0; 4358 var ringbuffer_size; 4359 var ringbuffer_mask; 4360 var ringbuffer; 4361 var ringbuffer_end; 4362 /* This ring buffer holds a few past copy distances that will be used by */ 4363 /* some special distance codes. */ 4364 var dist_rb = [ 16, 15, 11, 4 ]; 4365 var dist_rb_idx = 0; 4366 /* The previous 2 bytes used for context. */ 4367 var prev_byte1 = 0; 4368 var prev_byte2 = 0; 4369 var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)]; 4370 var block_type_trees; 4371 var block_len_trees; 4372 var br; 4373 4374 /* We need the slack region for the following reasons: 4375 - always doing two 8-byte copies for fast backward copying 4376 - transforms 4377 - flushing the input ringbuffer when decoding uncompressed blocks */ 4378 var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE; 4379 4380 br = new BrotliBitReader(input); 4381 4382 /* Decode window size. */ 4383 window_bits = DecodeWindowBits(br); 4384 max_backward_distance = (1 << window_bits) - 16; 4385 4386 ringbuffer_size = 1 << window_bits; 4387 ringbuffer_mask = ringbuffer_size - 1; 4388 ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength); 4389 ringbuffer_end = ringbuffer_size; 4390 4391 block_type_trees = []; 4392 block_len_trees = []; 4393 for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) { 4394 block_type_trees[x] = new HuffmanCode(0, 0); 4395 block_len_trees[x] = new HuffmanCode(0, 0); 4396 } 4397 4398 while (!input_end) { 4399 var meta_block_remaining_len = 0; 4400 var is_uncompressed; 4401 var block_length = [ 1 << 28, 1 << 28, 1 << 28 ]; 4402 var block_type = [ 0 ]; 4403 var num_block_types = [ 1, 1, 1 ]; 4404 var block_type_rb = [ 0, 1, 0, 1, 0, 1 ]; 4405 var block_type_rb_index = [ 0 ]; 4406 var distance_postfix_bits; 4407 var num_direct_distance_codes; 4408 var distance_postfix_mask; 4409 var num_distance_codes; 4410 var context_map = null; 4411 var context_modes = null; 4412 var num_literal_htrees; 4413 var dist_context_map = null; 4414 var num_dist_htrees; 4415 var context_offset = 0; 4416 var context_map_slice = null; 4417 var literal_htree_index = 0; 4418 var dist_context_offset = 0; 4419 var dist_context_map_slice = null; 4420 var dist_htree_index = 0; 4421 var context_lookup_offset1 = 0; 4422 var context_lookup_offset2 = 0; 4423 var context_mode; 4424 var htree_command; 4425 4426 for (i = 0; i < 3; ++i) { 4427 hgroup[i].codes = null; 4428 hgroup[i].htrees = null; 4429 } 4430 4431 br.readMoreInput(); 4432 4433 var _out = DecodeMetaBlockLength(br); 4434 meta_block_remaining_len = _out.meta_block_length; 4435 if (pos + meta_block_remaining_len > output.buffer.length) { 4436 /* We need to grow the output buffer to fit the additional data. */ 4437 var tmp = new Uint8Array( pos + meta_block_remaining_len ); 4438 tmp.set( output.buffer ); 4439 output.buffer = tmp; 4440 } 4441 input_end = _out.input_end; 4442 is_uncompressed = _out.is_uncompressed; 4443 4444 if (_out.is_metadata) { 4445 JumpToByteBoundary(br); 4446 4447 for (; meta_block_remaining_len > 0; --meta_block_remaining_len) { 4448 br.readMoreInput(); 4449 /* Read one byte and ignore it. */ 4450 br.readBits(8); 4451 } 4452 4453 continue; 4454 } 4455 4456 if (meta_block_remaining_len === 0) { 4457 continue; 4458 } 4459 4460 if (is_uncompressed) { 4461 br.bit_pos_ = (br.bit_pos_ + 7) & ~7; 4462 CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos, 4463 ringbuffer, ringbuffer_mask, br); 4464 pos += meta_block_remaining_len; 4465 continue; 4466 } 4467 4468 for (i = 0; i < 3; ++i) { 4469 num_block_types[i] = DecodeVarLenUint8(br) + 1; 4470 if (num_block_types[i] >= 2) { 4471 ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 4472 ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 4473 block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 4474 block_type_rb_index[i] = 1; 4475 } 4476 } 4477 4478 br.readMoreInput(); 4479 4480 distance_postfix_bits = br.readBits(2); 4481 num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits); 4482 distance_postfix_mask = (1 << distance_postfix_bits) - 1; 4483 num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits)); 4484 context_modes = new Uint8Array(num_block_types[0]); 4485 4486 for (i = 0; i < num_block_types[0]; ++i) { 4487 br.readMoreInput(); 4488 context_modes[i] = (br.readBits(2) << 1); 4489 } 4490 4491 var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br); 4492 num_literal_htrees = _o1.num_htrees; 4493 context_map = _o1.context_map; 4494 4495 var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br); 4496 num_dist_htrees = _o2.num_htrees; 4497 dist_context_map = _o2.context_map; 4498 4499 hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees); 4500 hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]); 4501 hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees); 4502 4503 for (i = 0; i < 3; ++i) { 4504 hgroup[i].decode(br); 4505 } 4506 4507 context_map_slice = 0; 4508 dist_context_map_slice = 0; 4509 context_mode = context_modes[block_type[0]]; 4510 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 4511 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 4512 htree_command = hgroup[1].htrees[0]; 4513 4514 while (meta_block_remaining_len > 0) { 4515 var cmd_code; 4516 var range_idx; 4517 var insert_code; 4518 var copy_code; 4519 var insert_length; 4520 var copy_length; 4521 var distance_code; 4522 var distance; 4523 var context; 4524 var j; 4525 var copy_dst; 4526 4527 br.readMoreInput(); 4528 4529 if (block_length[1] === 0) { 4530 DecodeBlockType(num_block_types[1], 4531 block_type_trees, 1, block_type, block_type_rb, 4532 block_type_rb_index, br); 4533 block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br); 4534 htree_command = hgroup[1].htrees[block_type[1]]; 4535 } 4536 --block_length[1]; 4537 cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br); 4538 range_idx = cmd_code >> 6; 4539 if (range_idx >= 2) { 4540 range_idx -= 2; 4541 distance_code = -1; 4542 } else { 4543 distance_code = 0; 4544 } 4545 insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7); 4546 copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7); 4547 insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + 4548 br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits); 4549 copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + 4550 br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits); 4551 prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask]; 4552 prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask]; 4553 for (j = 0; j < insert_length; ++j) { 4554 br.readMoreInput(); 4555 4556 if (block_length[0] === 0) { 4557 DecodeBlockType(num_block_types[0], 4558 block_type_trees, 0, block_type, block_type_rb, 4559 block_type_rb_index, br); 4560 block_length[0] = ReadBlockLength(block_len_trees, 0, br); 4561 context_offset = block_type[0] << kLiteralContextBits; 4562 context_map_slice = context_offset; 4563 context_mode = context_modes[block_type[0]]; 4564 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 4565 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 4566 } 4567 context = (Context.lookup[context_lookup_offset1 + prev_byte1] | 4568 Context.lookup[context_lookup_offset2 + prev_byte2]); 4569 literal_htree_index = context_map[context_map_slice + context]; 4570 --block_length[0]; 4571 prev_byte2 = prev_byte1; 4572 prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br); 4573 ringbuffer[pos & ringbuffer_mask] = prev_byte1; 4574 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 4575 output.write(ringbuffer, ringbuffer_size); 4576 } 4577 ++pos; 4578 } 4579 meta_block_remaining_len -= insert_length; 4580 if (meta_block_remaining_len <= 0) break; 4581 4582 if (distance_code < 0) { 4583 var context; 4584 4585 br.readMoreInput(); 4586 if (block_length[2] === 0) { 4587 DecodeBlockType(num_block_types[2], 4588 block_type_trees, 2, block_type, block_type_rb, 4589 block_type_rb_index, br); 4590 block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br); 4591 dist_context_offset = block_type[2] << kDistanceContextBits; 4592 dist_context_map_slice = dist_context_offset; 4593 } 4594 --block_length[2]; 4595 context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff; 4596 dist_htree_index = dist_context_map[dist_context_map_slice + context]; 4597 distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br); 4598 if (distance_code >= num_direct_distance_codes) { 4599 var nbits; 4600 var postfix; 4601 var offset; 4602 distance_code -= num_direct_distance_codes; 4603 postfix = distance_code & distance_postfix_mask; 4604 distance_code >>= distance_postfix_bits; 4605 nbits = (distance_code >> 1) + 1; 4606 offset = ((2 + (distance_code & 1)) << nbits) - 4; 4607 distance_code = num_direct_distance_codes + 4608 ((offset + br.readBits(nbits)) << 4609 distance_postfix_bits) + postfix; 4610 } 4611 } 4612 4613 /* Convert the distance code to the actual distance by possibly looking */ 4614 /* up past distnaces from the ringbuffer. */ 4615 distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx); 4616 if (distance < 0) { 4617 throw new Error('[BrotliDecompress] invalid distance'); 4618 } 4619 4620 if (pos < max_backward_distance && 4621 max_distance !== max_backward_distance) { 4622 max_distance = pos; 4623 } else { 4624 max_distance = max_backward_distance; 4625 } 4626 4627 copy_dst = pos & ringbuffer_mask; 4628 4629 if (distance > max_distance) { 4630 if (copy_length >= BrotliDictionary.minDictionaryWordLength && 4631 copy_length <= BrotliDictionary.maxDictionaryWordLength) { 4632 var offset = BrotliDictionary.offsetsByLength[copy_length]; 4633 var word_id = distance - max_distance - 1; 4634 var shift = BrotliDictionary.sizeBitsByLength[copy_length]; 4635 var mask = (1 << shift) - 1; 4636 var word_idx = word_id & mask; 4637 var transform_idx = word_id >> shift; 4638 offset += word_idx * copy_length; 4639 if (transform_idx < Transform.kNumTransforms) { 4640 var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx); 4641 copy_dst += len; 4642 pos += len; 4643 meta_block_remaining_len -= len; 4644 if (copy_dst >= ringbuffer_end) { 4645 output.write(ringbuffer, ringbuffer_size); 4646 4647 for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++) 4648 ringbuffer[_x] = ringbuffer[ringbuffer_end + _x]; 4649 } 4650 } else { 4651 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 4652 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 4653 } 4654 } else { 4655 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 4656 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 4657 } 4658 } else { 4659 if (distance_code > 0) { 4660 dist_rb[dist_rb_idx & 3] = distance; 4661 ++dist_rb_idx; 4662 } 4663 4664 if (copy_length > meta_block_remaining_len) { 4665 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 4666 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 4667 } 4668 4669 for (j = 0; j < copy_length; ++j) { 4670 ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask]; 4671 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 4672 output.write(ringbuffer, ringbuffer_size); 4673 } 4674 ++pos; 4675 --meta_block_remaining_len; 4676 } 4677 } 4678 4679 /* When we get here, we must have inserted at least one literal and */ 4680 /* made a copy of at least length two, therefore accessing the last 2 */ 4681 /* bytes is valid. */ 4682 prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask]; 4683 prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask]; 4684 } 4685 4686 /* Protect pos from overflow, wrap it around at every GB of input data */ 4687 pos &= 0x3fffffff; 4688 } 4689 4690 output.write(ringbuffer, pos & ringbuffer_mask); 4691 } 4692 4693 exports.BrotliDecompress = BrotliDecompress; 4694 4695 BrotliDictionary.init(); 4696 4697 },{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(require,module,exports){ 4698 var base64 = require('base64-js'); 4699 //var fs = require('fs'); 4700 4701 /** 4702 * The normal dictionary-data.js is quite large, which makes it 4703 * unsuitable for browser usage. In order to make it smaller, 4704 * we read dictionary.bin, which is a compressed version of 4705 * the dictionary, and on initial load, Brotli decompresses 4706 * it's own dictionary. 😜 4707 */ 4708 exports.init = function() { 4709 var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer; 4710 var compressed = base64.toByteArray(require('./dictionary.bin.js')); 4711 return BrotliDecompressBuffer(compressed); 4712 }; 4713 4714 },{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(require,module,exports){ 4715 module.exports="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"; 4716 4717 },{}],6:[function(require,module,exports){ 4718 /* Copyright 2013 Google Inc. All Rights Reserved. 4719 4720 Licensed under the Apache License, Version 2.0 (the "License"); 4721 you may not use this file except in compliance with the License. 4722 You may obtain a copy of the License at 4723 4724 http://www.apache.org/licenses/LICENSE-2.0 4725 4726 Unless required by applicable law or agreed to in writing, software 4727 distributed under the License is distributed on an "AS IS" BASIS, 4728 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4729 See the License for the specific language governing permissions and 4730 limitations under the License. 4731 4732 Collection of static dictionary words. 4733 */ 4734 4735 var data = require('./dictionary-browser'); 4736 exports.init = function() { 4737 exports.dictionary = data.init(); 4738 }; 4739 4740 exports.offsetsByLength = new Uint32Array([ 4741 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 4742 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536, 4743 115968, 118528, 119872, 121280, 122016, 4744 ]); 4745 4746 exports.sizeBitsByLength = new Uint8Array([ 4747 0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 4748 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 4749 7, 6, 6, 5, 5, 4750 ]); 4751 4752 exports.minDictionaryWordLength = 4; 4753 exports.maxDictionaryWordLength = 24; 4754 4755 },{"./dictionary-browser":4}],7:[function(require,module,exports){ 4756 function HuffmanCode(bits, value) { 4757 this.bits = bits; /* number of bits used for this symbol */ 4758 this.value = value; /* symbol value or table offset */ 4759 } 4760 4761 exports.HuffmanCode = HuffmanCode; 4762 4763 var MAX_LENGTH = 15; 4764 4765 /* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the 4766 bit-wise reversal of the len least significant bits of key. */ 4767 function GetNextKey(key, len) { 4768 var step = 1 << (len - 1); 4769 while (key & step) { 4770 step >>= 1; 4771 } 4772 return (key & (step - 1)) + step; 4773 } 4774 4775 /* Stores code in table[0], table[step], table[2*step], ..., table[end] */ 4776 /* Assumes that end is an integer multiple of step */ 4777 function ReplicateValue(table, i, step, end, code) { 4778 do { 4779 end -= step; 4780 table[i + end] = new HuffmanCode(code.bits, code.value); 4781 } while (end > 0); 4782 } 4783 4784 /* Returns the table width of the next 2nd level table. count is the histogram 4785 of bit lengths for the remaining symbols, len is the code length of the next 4786 processed symbol */ 4787 function NextTableBitSize(count, len, root_bits) { 4788 var left = 1 << (len - root_bits); 4789 while (len < MAX_LENGTH) { 4790 left -= count[len]; 4791 if (left <= 0) break; 4792 ++len; 4793 left <<= 1; 4794 } 4795 return len - root_bits; 4796 } 4797 4798 exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) { 4799 var start_table = table; 4800 var code; /* current table entry */ 4801 var len; /* current code length */ 4802 var symbol; /* symbol index in original or sorted table */ 4803 var key; /* reversed prefix code */ 4804 var step; /* step size to replicate values in current table */ 4805 var low; /* low bits for current root entry */ 4806 var mask; /* mask for low bits */ 4807 var table_bits; /* key length of current table */ 4808 var table_size; /* size of current table */ 4809 var total_size; /* sum of root table size and 2nd level table sizes */ 4810 var sorted; /* symbols sorted by code length */ 4811 var count = new Int32Array(MAX_LENGTH + 1); /* number of codes of each length */ 4812 var offset = new Int32Array(MAX_LENGTH + 1); /* offsets in sorted table for each length */ 4813 4814 sorted = new Int32Array(code_lengths_size); 4815 4816 /* build histogram of code lengths */ 4817 for (symbol = 0; symbol < code_lengths_size; symbol++) { 4818 count[code_lengths[symbol]]++; 4819 } 4820 4821 /* generate offsets into sorted symbol table by code length */ 4822 offset[1] = 0; 4823 for (len = 1; len < MAX_LENGTH; len++) { 4824 offset[len + 1] = offset[len] + count[len]; 4825 } 4826 4827 /* sort symbols by length, by symbol order within each length */ 4828 for (symbol = 0; symbol < code_lengths_size; symbol++) { 4829 if (code_lengths[symbol] !== 0) { 4830 sorted[offset[code_lengths[symbol]]++] = symbol; 4831 } 4832 } 4833 4834 table_bits = root_bits; 4835 table_size = 1 << table_bits; 4836 total_size = table_size; 4837 4838 /* special case code with only one value */ 4839 if (offset[MAX_LENGTH] === 1) { 4840 for (key = 0; key < total_size; ++key) { 4841 root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff); 4842 } 4843 4844 return total_size; 4845 } 4846 4847 /* fill in root table */ 4848 key = 0; 4849 symbol = 0; 4850 for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) { 4851 for (; count[len] > 0; --count[len]) { 4852 code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff); 4853 ReplicateValue(root_table, table + key, step, table_size, code); 4854 key = GetNextKey(key, len); 4855 } 4856 } 4857 4858 /* fill in 2nd level tables and add pointers to root table */ 4859 mask = total_size - 1; 4860 low = -1; 4861 for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) { 4862 for (; count[len] > 0; --count[len]) { 4863 if ((key & mask) !== low) { 4864 table += table_size; 4865 table_bits = NextTableBitSize(count, len, root_bits); 4866 table_size = 1 << table_bits; 4867 total_size += table_size; 4868 low = key & mask; 4869 root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff); 4870 } 4871 code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff); 4872 ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code); 4873 key = GetNextKey(key, len); 4874 } 4875 } 4876 4877 return total_size; 4878 } 4879 4880 },{}],8:[function(require,module,exports){ 4881 'use strict' 4882 4883 exports.byteLength = byteLength 4884 exports.toByteArray = toByteArray 4885 exports.fromByteArray = fromByteArray 4886 4887 var lookup = [] 4888 var revLookup = [] 4889 var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array 4890 4891 var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 4892 for (var i = 0, len = code.length; i < len; ++i) { 4893 lookup[i] = code[i] 4894 revLookup[code.charCodeAt(i)] = i 4895 } 4896 4897 // Support decoding URL-safe base64 strings, as Node.js does. 4898 // See: https://en.wikipedia.org/wiki/Base64#URL_applications 4899 revLookup['-'.charCodeAt(0)] = 62 4900 revLookup['_'.charCodeAt(0)] = 63 4901 4902 function getLens (b64) { 4903 var len = b64.length 4904 4905 if (len % 4 > 0) { 4906 throw new Error('Invalid string. Length must be a multiple of 4') 4907 } 4908 4909 // Trim off extra bytes after placeholder bytes are found 4910 // See: https://github.com/beatgammit/base64-js/issues/42 4911 var validLen = b64.indexOf('=') 4912 if (validLen === -1) validLen = len 4913 4914 var placeHoldersLen = validLen === len 4915 ? 0 4916 : 4 - (validLen % 4) 4917 4918 return [validLen, placeHoldersLen] 4919 } 4920 4921 // base64 is 4/3 + up to two characters of the original data 4922 function byteLength (b64) { 4923 var lens = getLens(b64) 4924 var validLen = lens[0] 4925 var placeHoldersLen = lens[1] 4926 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 4927 } 4928 4929 function _byteLength (b64, validLen, placeHoldersLen) { 4930 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 4931 } 4932 4933 function toByteArray (b64) { 4934 var tmp 4935 var lens = getLens(b64) 4936 var validLen = lens[0] 4937 var placeHoldersLen = lens[1] 4938 4939 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) 4940 4941 var curByte = 0 4942 4943 // if there are placeholders, only get up to the last complete 4 chars 4944 var len = placeHoldersLen > 0 4945 ? validLen - 4 4946 : validLen 4947 4948 for (var i = 0; i < len; i += 4) { 4949 tmp = 4950 (revLookup[b64.charCodeAt(i)] << 18) | 4951 (revLookup[b64.charCodeAt(i + 1)] << 12) | 4952 (revLookup[b64.charCodeAt(i + 2)] << 6) | 4953 revLookup[b64.charCodeAt(i + 3)] 4954 arr[curByte++] = (tmp >> 16) & 0xFF 4955 arr[curByte++] = (tmp >> 8) & 0xFF 4956 arr[curByte++] = tmp & 0xFF 4957 } 4958 4959 if (placeHoldersLen === 2) { 4960 tmp = 4961 (revLookup[b64.charCodeAt(i)] << 2) | 4962 (revLookup[b64.charCodeAt(i + 1)] >> 4) 4963 arr[curByte++] = tmp & 0xFF 4964 } 4965 4966 if (placeHoldersLen === 1) { 4967 tmp = 4968 (revLookup[b64.charCodeAt(i)] << 10) | 4969 (revLookup[b64.charCodeAt(i + 1)] << 4) | 4970 (revLookup[b64.charCodeAt(i + 2)] >> 2) 4971 arr[curByte++] = (tmp >> 8) & 0xFF 4972 arr[curByte++] = tmp & 0xFF 4973 } 4974 4975 return arr 4976 } 4977 4978 function tripletToBase64 (num) { 4979 return lookup[num >> 18 & 0x3F] + 4980 lookup[num >> 12 & 0x3F] + 4981 lookup[num >> 6 & 0x3F] + 4982 lookup[num & 0x3F] 4983 } 4984 4985 function encodeChunk (uint8, start, end) { 4986 var tmp 4987 var output = [] 4988 for (var i = start; i < end; i += 3) { 4989 tmp = 4990 ((uint8[i] << 16) & 0xFF0000) + 4991 ((uint8[i + 1] << 8) & 0xFF00) + 4992 (uint8[i + 2] & 0xFF) 4993 output.push(tripletToBase64(tmp)) 4994 } 4995 return output.join('') 4996 } 4997 4998 function fromByteArray (uint8) { 4999 var tmp 5000 var len = uint8.length 5001 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes 5002 var parts = [] 5003 var maxChunkLength = 16383 // must be multiple of 3 5004 5005 // go through the array every three bytes, we'll deal with trailing stuff later 5006 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { 5007 parts.push(encodeChunk( 5008 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) 5009 )) 5010 } 5011 5012 // pad the end with zeros, but make sure to not forget the extra bytes 5013 if (extraBytes === 1) { 5014 tmp = uint8[len - 1] 5015 parts.push( 5016 lookup[tmp >> 2] + 5017 lookup[(tmp << 4) & 0x3F] + 5018 '==' 5019 ) 5020 } else if (extraBytes === 2) { 5021 tmp = (uint8[len - 2] << 8) + uint8[len - 1] 5022 parts.push( 5023 lookup[tmp >> 10] + 5024 lookup[(tmp >> 4) & 0x3F] + 5025 lookup[(tmp << 2) & 0x3F] + 5026 '=' 5027 ) 5028 } 5029 5030 return parts.join('') 5031 } 5032 5033 },{}],9:[function(require,module,exports){ 5034 /* Copyright 2013 Google Inc. All Rights Reserved. 5035 5036 Licensed under the Apache License, Version 2.0 (the "License"); 5037 you may not use this file except in compliance with the License. 5038 You may obtain a copy of the License at 5039 5040 http://www.apache.org/licenses/LICENSE-2.0 5041 5042 Unless required by applicable law or agreed to in writing, software 5043 distributed under the License is distributed on an "AS IS" BASIS, 5044 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5045 See the License for the specific language governing permissions and 5046 limitations under the License. 5047 5048 Lookup tables to map prefix codes to value ranges. This is used during 5049 decoding of the block lengths, literal insertion lengths and copy lengths. 5050 */ 5051 5052 /* Represents the range of values belonging to a prefix code: */ 5053 /* [offset, offset + 2^nbits) */ 5054 function PrefixCodeRange(offset, nbits) { 5055 this.offset = offset; 5056 this.nbits = nbits; 5057 } 5058 5059 exports.kBlockLengthPrefixCode = [ 5060 new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2), 5061 new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3), 5062 new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4), 5063 new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5), 5064 new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8), 5065 new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12), 5066 new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24) 5067 ]; 5068 5069 exports.kInsertLengthPrefixCode = [ 5070 new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), 5071 new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1), 5072 new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3), 5073 new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5), 5074 new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9), 5075 new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24), 5076 ]; 5077 5078 exports.kCopyLengthPrefixCode = [ 5079 new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), 5080 new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0), 5081 new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2), 5082 new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4), 5083 new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7), 5084 new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24), 5085 ]; 5086 5087 exports.kInsertRangeLut = [ 5088 0, 0, 8, 8, 0, 16, 8, 16, 16, 5089 ]; 5090 5091 exports.kCopyRangeLut = [ 5092 0, 8, 0, 8, 16, 0, 16, 8, 16, 5093 ]; 5094 5095 },{}],10:[function(require,module,exports){ 5096 function BrotliInput(buffer) { 5097 this.buffer = buffer; 5098 this.pos = 0; 5099 } 5100 5101 BrotliInput.prototype.read = function(buf, i, count) { 5102 if (this.pos + count > this.buffer.length) { 5103 count = this.buffer.length - this.pos; 5104 } 5105 5106 for (var p = 0; p < count; p++) 5107 buf[i + p] = this.buffer[this.pos + p]; 5108 5109 this.pos += count; 5110 return count; 5111 } 5112 5113 exports.BrotliInput = BrotliInput; 5114 5115 function BrotliOutput(buf) { 5116 this.buffer = buf; 5117 this.pos = 0; 5118 } 5119 5120 BrotliOutput.prototype.write = function(buf, count) { 5121 if (this.pos + count > this.buffer.length) 5122 throw new Error('Output buffer is not large enough'); 5123 5124 this.buffer.set(buf.subarray(0, count), this.pos); 5125 this.pos += count; 5126 return count; 5127 }; 5128 5129 exports.BrotliOutput = BrotliOutput; 5130 5131 },{}],11:[function(require,module,exports){ 5132 /* Copyright 2013 Google Inc. All Rights Reserved. 5133 5134 Licensed under the Apache License, Version 2.0 (the "License"); 5135 you may not use this file except in compliance with the License. 5136 You may obtain a copy of the License at 5137 5138 http://www.apache.org/licenses/LICENSE-2.0 5139 5140 Unless required by applicable law or agreed to in writing, software 5141 distributed under the License is distributed on an "AS IS" BASIS, 5142 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5143 See the License for the specific language governing permissions and 5144 limitations under the License. 5145 5146 Transformations on dictionary words. 5147 */ 5148 5149 var BrotliDictionary = require('./dictionary'); 5150 5151 var kIdentity = 0; 5152 var kOmitLast1 = 1; 5153 var kOmitLast2 = 2; 5154 var kOmitLast3 = 3; 5155 var kOmitLast4 = 4; 5156 var kOmitLast5 = 5; 5157 var kOmitLast6 = 6; 5158 var kOmitLast7 = 7; 5159 var kOmitLast8 = 8; 5160 var kOmitLast9 = 9; 5161 var kUppercaseFirst = 10; 5162 var kUppercaseAll = 11; 5163 var kOmitFirst1 = 12; 5164 var kOmitFirst2 = 13; 5165 var kOmitFirst3 = 14; 5166 var kOmitFirst4 = 15; 5167 var kOmitFirst5 = 16; 5168 var kOmitFirst6 = 17; 5169 var kOmitFirst7 = 18; 5170 var kOmitFirst8 = 19; 5171 var kOmitFirst9 = 20; 5172 5173 function Transform(prefix, transform, suffix) { 5174 this.prefix = new Uint8Array(prefix.length); 5175 this.transform = transform; 5176 this.suffix = new Uint8Array(suffix.length); 5177 5178 for (var i = 0; i < prefix.length; i++) 5179 this.prefix[i] = prefix.charCodeAt(i); 5180 5181 for (var i = 0; i < suffix.length; i++) 5182 this.suffix[i] = suffix.charCodeAt(i); 5183 } 5184 5185 var kTransforms = [ 5186 new Transform( "", kIdentity, "" ), 5187 new Transform( "", kIdentity, " " ), 5188 new Transform( " ", kIdentity, " " ), 5189 new Transform( "", kOmitFirst1, "" ), 5190 new Transform( "", kUppercaseFirst, " " ), 5191 new Transform( "", kIdentity, " the " ), 5192 new Transform( " ", kIdentity, "" ), 5193 new Transform( "s ", kIdentity, " " ), 5194 new Transform( "", kIdentity, " of " ), 5195 new Transform( "", kUppercaseFirst, "" ), 5196 new Transform( "", kIdentity, " and " ), 5197 new Transform( "", kOmitFirst2, "" ), 5198 new Transform( "", kOmitLast1, "" ), 5199 new Transform( ", ", kIdentity, " " ), 5200 new Transform( "", kIdentity, ", " ), 5201 new Transform( " ", kUppercaseFirst, " " ), 5202 new Transform( "", kIdentity, " in " ), 5203 new Transform( "", kIdentity, " to " ), 5204 new Transform( "e ", kIdentity, " " ), 5205 new Transform( "", kIdentity, "\"" ), 5206 new Transform( "", kIdentity, "." ), 5207 new Transform( "", kIdentity, "\">" ), 5208 new Transform( "", kIdentity, "\n" ), 5209 new Transform( "", kOmitLast3, "" ), 5210 new Transform( "", kIdentity, "]" ), 5211 new Transform( "", kIdentity, " for " ), 5212 new Transform( "", kOmitFirst3, "" ), 5213 new Transform( "", kOmitLast2, "" ), 5214 new Transform( "", kIdentity, " a " ), 5215 new Transform( "", kIdentity, " that " ), 5216 new Transform( " ", kUppercaseFirst, "" ), 5217 new Transform( "", kIdentity, ". " ), 5218 new Transform( ".", kIdentity, "" ), 5219 new Transform( " ", kIdentity, ", " ), 5220 new Transform( "", kOmitFirst4, "" ), 5221 new Transform( "", kIdentity, " with " ), 5222 new Transform( "", kIdentity, "'" ), 5223 new Transform( "", kIdentity, " from " ), 5224 new Transform( "", kIdentity, " by " ), 5225 new Transform( "", kOmitFirst5, "" ), 5226 new Transform( "", kOmitFirst6, "" ), 5227 new Transform( " the ", kIdentity, "" ), 5228 new Transform( "", kOmitLast4, "" ), 5229 new Transform( "", kIdentity, ". The " ), 5230 new Transform( "", kUppercaseAll, "" ), 5231 new Transform( "", kIdentity, " on " ), 5232 new Transform( "", kIdentity, " as " ), 5233 new Transform( "", kIdentity, " is " ), 5234 new Transform( "", kOmitLast7, "" ), 5235 new Transform( "", kOmitLast1, "ing " ), 5236 new Transform( "", kIdentity, "\n\t" ), 5237 new Transform( "", kIdentity, ":" ), 5238 new Transform( " ", kIdentity, ". " ), 5239 new Transform( "", kIdentity, "ed " ), 5240 new Transform( "", kOmitFirst9, "" ), 5241 new Transform( "", kOmitFirst7, "" ), 5242 new Transform( "", kOmitLast6, "" ), 5243 new Transform( "", kIdentity, "(" ), 5244 new Transform( "", kUppercaseFirst, ", " ), 5245 new Transform( "", kOmitLast8, "" ), 5246 new Transform( "", kIdentity, " at " ), 5247 new Transform( "", kIdentity, "ly " ), 5248 new Transform( " the ", kIdentity, " of " ), 5249 new Transform( "", kOmitLast5, "" ), 5250 new Transform( "", kOmitLast9, "" ), 5251 new Transform( " ", kUppercaseFirst, ", " ), 5252 new Transform( "", kUppercaseFirst, "\"" ), 5253 new Transform( ".", kIdentity, "(" ), 5254 new Transform( "", kUppercaseAll, " " ), 5255 new Transform( "", kUppercaseFirst, "\">" ), 5256 new Transform( "", kIdentity, "=\"" ), 5257 new Transform( " ", kIdentity, "." ), 5258 new Transform( ".com/", kIdentity, "" ), 5259 new Transform( " the ", kIdentity, " of the " ), 5260 new Transform( "", kUppercaseFirst, "'" ), 5261 new Transform( "", kIdentity, ". This " ), 5262 new Transform( "", kIdentity, "," ), 5263 new Transform( ".", kIdentity, " " ), 5264 new Transform( "", kUppercaseFirst, "(" ), 5265 new Transform( "", kUppercaseFirst, "." ), 5266 new Transform( "", kIdentity, " not " ), 5267 new Transform( " ", kIdentity, "=\"" ), 5268 new Transform( "", kIdentity, "er " ), 5269 new Transform( " ", kUppercaseAll, " " ), 5270 new Transform( "", kIdentity, "al " ), 5271 new Transform( " ", kUppercaseAll, "" ), 5272 new Transform( "", kIdentity, "='" ), 5273 new Transform( "", kUppercaseAll, "\"" ), 5274 new Transform( "", kUppercaseFirst, ". " ), 5275 new Transform( " ", kIdentity, "(" ), 5276 new Transform( "", kIdentity, "ful " ), 5277 new Transform( " ", kUppercaseFirst, ". " ), 5278 new Transform( "", kIdentity, "ive " ), 5279 new Transform( "", kIdentity, "less " ), 5280 new Transform( "", kUppercaseAll, "'" ), 5281 new Transform( "", kIdentity, "est " ), 5282 new Transform( " ", kUppercaseFirst, "." ), 5283 new Transform( "", kUppercaseAll, "\">" ), 5284 new Transform( " ", kIdentity, "='" ), 5285 new Transform( "", kUppercaseFirst, "," ), 5286 new Transform( "", kIdentity, "ize " ), 5287 new Transform( "", kUppercaseAll, "." ), 5288 new Transform( "\xc2\xa0", kIdentity, "" ), 5289 new Transform( " ", kIdentity, "," ), 5290 new Transform( "", kUppercaseFirst, "=\"" ), 5291 new Transform( "", kUppercaseAll, "=\"" ), 5292 new Transform( "", kIdentity, "ous " ), 5293 new Transform( "", kUppercaseAll, ", " ), 5294 new Transform( "", kUppercaseFirst, "='" ), 5295 new Transform( " ", kUppercaseFirst, "," ), 5296 new Transform( " ", kUppercaseAll, "=\"" ), 5297 new Transform( " ", kUppercaseAll, ", " ), 5298 new Transform( "", kUppercaseAll, "," ), 5299 new Transform( "", kUppercaseAll, "(" ), 5300 new Transform( "", kUppercaseAll, ". " ), 5301 new Transform( " ", kUppercaseAll, "." ), 5302 new Transform( "", kUppercaseAll, "='" ), 5303 new Transform( " ", kUppercaseAll, ". " ), 5304 new Transform( " ", kUppercaseFirst, "=\"" ), 5305 new Transform( " ", kUppercaseAll, "='" ), 5306 new Transform( " ", kUppercaseFirst, "='" ) 5307 ]; 5308 5309 exports.kTransforms = kTransforms; 5310 exports.kNumTransforms = kTransforms.length; 5311 5312 function ToUpperCase(p, i) { 5313 if (p[i] < 0xc0) { 5314 if (p[i] >= 97 && p[i] <= 122) { 5315 p[i] ^= 32; 5316 } 5317 return 1; 5318 } 5319 5320 /* An overly simplified uppercasing model for utf-8. */ 5321 if (p[i] < 0xe0) { 5322 p[i + 1] ^= 32; 5323 return 2; 5324 } 5325 5326 /* An arbitrary transform for three byte characters. */ 5327 p[i + 2] ^= 5; 5328 return 3; 5329 } 5330 5331 exports.transformDictionaryWord = function(dst, idx, word, len, transform) { 5332 var prefix = kTransforms[transform].prefix; 5333 var suffix = kTransforms[transform].suffix; 5334 var t = kTransforms[transform].transform; 5335 var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1); 5336 var i = 0; 5337 var start_idx = idx; 5338 var uppercase; 5339 5340 if (skip > len) { 5341 skip = len; 5342 } 5343 5344 var prefix_pos = 0; 5345 while (prefix_pos < prefix.length) { 5346 dst[idx++] = prefix[prefix_pos++]; 5347 } 5348 5349 word += skip; 5350 len -= skip; 5351 5352 if (t <= kOmitLast9) { 5353 len -= t; 5354 } 5355 5356 for (i = 0; i < len; i++) { 5357 dst[idx++] = BrotliDictionary.dictionary[word + i]; 5358 } 5359 5360 uppercase = idx - len; 5361 5362 if (t === kUppercaseFirst) { 5363 ToUpperCase(dst, uppercase); 5364 } else if (t === kUppercaseAll) { 5365 while (len > 0) { 5366 var step = ToUpperCase(dst, uppercase); 5367 uppercase += step; 5368 len -= step; 5369 } 5370 } 5371 5372 var suffix_pos = 0; 5373 while (suffix_pos < suffix.length) { 5374 dst[idx++] = suffix[suffix_pos++]; 5375 } 5376 5377 return idx - start_idx; 5378 } 5379 5380 },{"./dictionary":6}],12:[function(require,module,exports){ 5381 module.exports = require('./dec/decode').BrotliDecompressBuffer; 5382 5383 },{"./dec/decode":3}]},{},[12])(12) 5384 }); 5385 /* eslint-enable */ 5386 5387 5388 /***/ }), 5389 5390 /***/ 9681: 5391 /***/ ((module) => { 5392 5393 var characterMap = { 5394 "À": "A", 5395 "Á": "A", 5396 "Â": "A", 5397 "Ã": "A", 5398 "Ä": "A", 5399 "Å": "A", 5400 "Ấ": "A", 5401 "Ắ": "A", 5402 "Ẳ": "A", 5403 "Ẵ": "A", 5404 "Ặ": "A", 5405 "Æ": "AE", 5406 "Ầ": "A", 5407 "Ằ": "A", 5408 "Ȃ": "A", 5409 "Ả": "A", 5410 "Ạ": "A", 5411 "Ẩ": "A", 5412 "Ẫ": "A", 5413 "Ậ": "A", 5414 "Ç": "C", 5415 "Ḉ": "C", 5416 "È": "E", 5417 "É": "E", 5418 "Ê": "E", 5419 "Ë": "E", 5420 "Ế": "E", 5421 "Ḗ": "E", 5422 "Ề": "E", 5423 "Ḕ": "E", 5424 "Ḝ": "E", 5425 "Ȇ": "E", 5426 "Ẻ": "E", 5427 "Ẽ": "E", 5428 "Ẹ": "E", 5429 "Ể": "E", 5430 "Ễ": "E", 5431 "Ệ": "E", 5432 "Ì": "I", 5433 "Í": "I", 5434 "Î": "I", 5435 "Ï": "I", 5436 "Ḯ": "I", 5437 "Ȋ": "I", 5438 "Ỉ": "I", 5439 "Ị": "I", 5440 "Ð": "D", 5441 "Ñ": "N", 5442 "Ò": "O", 5443 "Ó": "O", 5444 "Ô": "O", 5445 "Õ": "O", 5446 "Ö": "O", 5447 "Ø": "O", 5448 "Ố": "O", 5449 "Ṍ": "O", 5450 "Ṓ": "O", 5451 "Ȏ": "O", 5452 "Ỏ": "O", 5453 "Ọ": "O", 5454 "Ổ": "O", 5455 "Ỗ": "O", 5456 "Ộ": "O", 5457 "Ờ": "O", 5458 "Ở": "O", 5459 "Ỡ": "O", 5460 "Ớ": "O", 5461 "Ợ": "O", 5462 "Ù": "U", 5463 "Ú": "U", 5464 "Û": "U", 5465 "Ü": "U", 5466 "Ủ": "U", 5467 "Ụ": "U", 5468 "Ử": "U", 5469 "Ữ": "U", 5470 "Ự": "U", 5471 "Ý": "Y", 5472 "à": "a", 5473 "á": "a", 5474 "â": "a", 5475 "ã": "a", 5476 "ä": "a", 5477 "å": "a", 5478 "ấ": "a", 5479 "ắ": "a", 5480 "ẳ": "a", 5481 "ẵ": "a", 5482 "ặ": "a", 5483 "æ": "ae", 5484 "ầ": "a", 5485 "ằ": "a", 5486 "ȃ": "a", 5487 "ả": "a", 5488 "ạ": "a", 5489 "ẩ": "a", 5490 "ẫ": "a", 5491 "ậ": "a", 5492 "ç": "c", 5493 "ḉ": "c", 5494 "è": "e", 5495 "é": "e", 5496 "ê": "e", 5497 "ë": "e", 5498 "ế": "e", 5499 "ḗ": "e", 5500 "ề": "e", 5501 "ḕ": "e", 5502 "ḝ": "e", 5503 "ȇ": "e", 5504 "ẻ": "e", 5505 "ẽ": "e", 5506 "ẹ": "e", 5507 "ể": "e", 5508 "ễ": "e", 5509 "ệ": "e", 5510 "ì": "i", 5511 "í": "i", 5512 "î": "i", 5513 "ï": "i", 5514 "ḯ": "i", 5515 "ȋ": "i", 5516 "ỉ": "i", 5517 "ị": "i", 5518 "ð": "d", 5519 "ñ": "n", 5520 "ò": "o", 5521 "ó": "o", 5522 "ô": "o", 5523 "õ": "o", 5524 "ö": "o", 5525 "ø": "o", 5526 "ố": "o", 5527 "ṍ": "o", 5528 "ṓ": "o", 5529 "ȏ": "o", 5530 "ỏ": "o", 5531 "ọ": "o", 5532 "ổ": "o", 5533 "ỗ": "o", 5534 "ộ": "o", 5535 "ờ": "o", 5536 "ở": "o", 5537 "ỡ": "o", 5538 "ớ": "o", 5539 "ợ": "o", 5540 "ù": "u", 5541 "ú": "u", 5542 "û": "u", 5543 "ü": "u", 5544 "ủ": "u", 5545 "ụ": "u", 5546 "ử": "u", 5547 "ữ": "u", 5548 "ự": "u", 5549 "ý": "y", 5550 "ÿ": "y", 5551 "Ā": "A", 5552 "ā": "a", 5553 "Ă": "A", 5554 "ă": "a", 5555 "Ą": "A", 5556 "ą": "a", 5557 "Ć": "C", 5558 "ć": "c", 5559 "Ĉ": "C", 5560 "ĉ": "c", 5561 "Ċ": "C", 5562 "ċ": "c", 5563 "Č": "C", 5564 "č": "c", 5565 "C̆": "C", 5566 "c̆": "c", 5567 "Ď": "D", 5568 "ď": "d", 5569 "Đ": "D", 5570 "đ": "d", 5571 "Ē": "E", 5572 "ē": "e", 5573 "Ĕ": "E", 5574 "ĕ": "e", 5575 "Ė": "E", 5576 "ė": "e", 5577 "Ę": "E", 5578 "ę": "e", 5579 "Ě": "E", 5580 "ě": "e", 5581 "Ĝ": "G", 5582 "Ǵ": "G", 5583 "ĝ": "g", 5584 "ǵ": "g", 5585 "Ğ": "G", 5586 "ğ": "g", 5587 "Ġ": "G", 5588 "ġ": "g", 5589 "Ģ": "G", 5590 "ģ": "g", 5591 "Ĥ": "H", 5592 "ĥ": "h", 5593 "Ħ": "H", 5594 "ħ": "h", 5595 "Ḫ": "H", 5596 "ḫ": "h", 5597 "Ĩ": "I", 5598 "ĩ": "i", 5599 "Ī": "I", 5600 "ī": "i", 5601 "Ĭ": "I", 5602 "ĭ": "i", 5603 "Į": "I", 5604 "į": "i", 5605 "İ": "I", 5606 "ı": "i", 5607 "IJ": "IJ", 5608 "ij": "ij", 5609 "Ĵ": "J", 5610 "ĵ": "j", 5611 "Ķ": "K", 5612 "ķ": "k", 5613 "Ḱ": "K", 5614 "ḱ": "k", 5615 "K̆": "K", 5616 "k̆": "k", 5617 "Ĺ": "L", 5618 "ĺ": "l", 5619 "Ļ": "L", 5620 "ļ": "l", 5621 "Ľ": "L", 5622 "ľ": "l", 5623 "Ŀ": "L", 5624 "ŀ": "l", 5625 "Ł": "l", 5626 "ł": "l", 5627 "Ḿ": "M", 5628 "ḿ": "m", 5629 "M̆": "M", 5630 "m̆": "m", 5631 "Ń": "N", 5632 "ń": "n", 5633 "Ņ": "N", 5634 "ņ": "n", 5635 "Ň": "N", 5636 "ň": "n", 5637 "ʼn": "n", 5638 "N̆": "N", 5639 "n̆": "n", 5640 "Ō": "O", 5641 "ō": "o", 5642 "Ŏ": "O", 5643 "ŏ": "o", 5644 "Ő": "O", 5645 "ő": "o", 5646 "Œ": "OE", 5647 "œ": "oe", 5648 "P̆": "P", 5649 "p̆": "p", 5650 "Ŕ": "R", 5651 "ŕ": "r", 5652 "Ŗ": "R", 5653 "ŗ": "r", 5654 "Ř": "R", 5655 "ř": "r", 5656 "R̆": "R", 5657 "r̆": "r", 5658 "Ȓ": "R", 5659 "ȓ": "r", 5660 "Ś": "S", 5661 "ś": "s", 5662 "Ŝ": "S", 5663 "ŝ": "s", 5664 "Ş": "S", 5665 "Ș": "S", 5666 "ș": "s", 5667 "ş": "s", 5668 "Š": "S", 5669 "š": "s", 5670 "Ţ": "T", 5671 "ţ": "t", 5672 "ț": "t", 5673 "Ț": "T", 5674 "Ť": "T", 5675 "ť": "t", 5676 "Ŧ": "T", 5677 "ŧ": "t", 5678 "T̆": "T", 5679 "t̆": "t", 5680 "Ũ": "U", 5681 "ũ": "u", 5682 "Ū": "U", 5683 "ū": "u", 5684 "Ŭ": "U", 5685 "ŭ": "u", 5686 "Ů": "U", 5687 "ů": "u", 5688 "Ű": "U", 5689 "ű": "u", 5690 "Ų": "U", 5691 "ų": "u", 5692 "Ȗ": "U", 5693 "ȗ": "u", 5694 "V̆": "V", 5695 "v̆": "v", 5696 "Ŵ": "W", 5697 "ŵ": "w", 5698 "Ẃ": "W", 5699 "ẃ": "w", 5700 "X̆": "X", 5701 "x̆": "x", 5702 "Ŷ": "Y", 5703 "ŷ": "y", 5704 "Ÿ": "Y", 5705 "Y̆": "Y", 5706 "y̆": "y", 5707 "Ź": "Z", 5708 "ź": "z", 5709 "Ż": "Z", 5710 "ż": "z", 5711 "Ž": "Z", 5712 "ž": "z", 5713 "ſ": "s", 5714 "ƒ": "f", 5715 "Ơ": "O", 5716 "ơ": "o", 5717 "Ư": "U", 5718 "ư": "u", 5719 "Ǎ": "A", 5720 "ǎ": "a", 5721 "Ǐ": "I", 5722 "ǐ": "i", 5723 "Ǒ": "O", 5724 "ǒ": "o", 5725 "Ǔ": "U", 5726 "ǔ": "u", 5727 "Ǖ": "U", 5728 "ǖ": "u", 5729 "Ǘ": "U", 5730 "ǘ": "u", 5731 "Ǚ": "U", 5732 "ǚ": "u", 5733 "Ǜ": "U", 5734 "ǜ": "u", 5735 "Ứ": "U", 5736 "ứ": "u", 5737 "Ṹ": "U", 5738 "ṹ": "u", 5739 "Ǻ": "A", 5740 "ǻ": "a", 5741 "Ǽ": "AE", 5742 "ǽ": "ae", 5743 "Ǿ": "O", 5744 "ǿ": "o", 5745 "Þ": "TH", 5746 "þ": "th", 5747 "Ṕ": "P", 5748 "ṕ": "p", 5749 "Ṥ": "S", 5750 "ṥ": "s", 5751 "X́": "X", 5752 "x́": "x", 5753 "Ѓ": "Г", 5754 "ѓ": "г", 5755 "Ќ": "К", 5756 "ќ": "к", 5757 "A̋": "A", 5758 "a̋": "a", 5759 "E̋": "E", 5760 "e̋": "e", 5761 "I̋": "I", 5762 "i̋": "i", 5763 "Ǹ": "N", 5764 "ǹ": "n", 5765 "Ồ": "O", 5766 "ồ": "o", 5767 "Ṑ": "O", 5768 "ṑ": "o", 5769 "Ừ": "U", 5770 "ừ": "u", 5771 "Ẁ": "W", 5772 "ẁ": "w", 5773 "Ỳ": "Y", 5774 "ỳ": "y", 5775 "Ȁ": "A", 5776 "ȁ": "a", 5777 "Ȅ": "E", 5778 "ȅ": "e", 5779 "Ȉ": "I", 5780 "ȉ": "i", 5781 "Ȍ": "O", 5782 "ȍ": "o", 5783 "Ȑ": "R", 5784 "ȑ": "r", 5785 "Ȕ": "U", 5786 "ȕ": "u", 5787 "B̌": "B", 5788 "b̌": "b", 5789 "Č̣": "C", 5790 "č̣": "c", 5791 "Ê̌": "E", 5792 "ê̌": "e", 5793 "F̌": "F", 5794 "f̌": "f", 5795 "Ǧ": "G", 5796 "ǧ": "g", 5797 "Ȟ": "H", 5798 "ȟ": "h", 5799 "J̌": "J", 5800 "ǰ": "j", 5801 "Ǩ": "K", 5802 "ǩ": "k", 5803 "M̌": "M", 5804 "m̌": "m", 5805 "P̌": "P", 5806 "p̌": "p", 5807 "Q̌": "Q", 5808 "q̌": "q", 5809 "Ř̩": "R", 5810 "ř̩": "r", 5811 "Ṧ": "S", 5812 "ṧ": "s", 5813 "V̌": "V", 5814 "v̌": "v", 5815 "W̌": "W", 5816 "w̌": "w", 5817 "X̌": "X", 5818 "x̌": "x", 5819 "Y̌": "Y", 5820 "y̌": "y", 5821 "A̧": "A", 5822 "a̧": "a", 5823 "B̧": "B", 5824 "b̧": "b", 5825 "Ḑ": "D", 5826 "ḑ": "d", 5827 "Ȩ": "E", 5828 "ȩ": "e", 5829 "Ɛ̧": "E", 5830 "ɛ̧": "e", 5831 "Ḩ": "H", 5832 "ḩ": "h", 5833 "I̧": "I", 5834 "i̧": "i", 5835 "Ɨ̧": "I", 5836 "ɨ̧": "i", 5837 "M̧": "M", 5838 "m̧": "m", 5839 "O̧": "O", 5840 "o̧": "o", 5841 "Q̧": "Q", 5842 "q̧": "q", 5843 "U̧": "U", 5844 "u̧": "u", 5845 "X̧": "X", 5846 "x̧": "x", 5847 "Z̧": "Z", 5848 "z̧": "z", 5849 "й":"и", 5850 "Й":"И", 5851 "ё":"е", 5852 "Ё":"Е", 5853 }; 5854 5855 var chars = Object.keys(characterMap).join('|'); 5856 var allAccents = new RegExp(chars, 'g'); 5857 var firstAccent = new RegExp(chars, ''); 5858 5859 function matcher(match) { 5860 return characterMap[match]; 5861 } 5862 5863 var removeAccents = function(string) { 5864 return string.replace(allAccents, matcher); 5865 }; 5866 5867 var hasAccents = function(string) { 5868 return !!string.match(firstAccent); 5869 }; 5870 5871 module.exports = removeAccents; 5872 module.exports.has = hasAccents; 5873 module.exports.remove = removeAccents; 5874 5875 5876 /***/ }), 5877 5878 /***/ 83: 5879 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 5880 5881 "use strict"; 5882 /** 5883 * @license React 5884 * use-sync-external-store-shim.production.js 5885 * 5886 * Copyright (c) Meta Platforms, Inc. and affiliates. 5887 * 5888 * This source code is licensed under the MIT license found in the 5889 * LICENSE file in the root directory of this source tree. 5890 */ 5891 5892 5893 var React = __webpack_require__(1609); 5894 function is(x, y) { 5895 return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); 5896 } 5897 var objectIs = "function" === typeof Object.is ? Object.is : is, 5898 useState = React.useState, 5899 useEffect = React.useEffect, 5900 useLayoutEffect = React.useLayoutEffect, 5901 useDebugValue = React.useDebugValue; 5902 function useSyncExternalStore$2(subscribe, getSnapshot) { 5903 var value = getSnapshot(), 5904 _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }), 5905 inst = _useState[0].inst, 5906 forceUpdate = _useState[1]; 5907 useLayoutEffect( 5908 function () { 5909 inst.value = value; 5910 inst.getSnapshot = getSnapshot; 5911 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 5912 }, 5913 [subscribe, value, getSnapshot] 5914 ); 5915 useEffect( 5916 function () { 5917 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 5918 return subscribe(function () { 5919 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 5920 }); 5921 }, 5922 [subscribe] 5923 ); 5924 useDebugValue(value); 5925 return value; 5926 } 5927 function checkIfSnapshotChanged(inst) { 5928 var latestGetSnapshot = inst.getSnapshot; 5929 inst = inst.value; 5930 try { 5931 var nextValue = latestGetSnapshot(); 5932 return !objectIs(inst, nextValue); 5933 } catch (error) { 5934 return !0; 5935 } 5936 } 5937 function useSyncExternalStore$1(subscribe, getSnapshot) { 5938 return getSnapshot(); 5939 } 5940 var shim = 5941 "undefined" === typeof window || 5942 "undefined" === typeof window.document || 5943 "undefined" === typeof window.document.createElement 5944 ? useSyncExternalStore$1 5945 : useSyncExternalStore$2; 5946 exports.useSyncExternalStore = 5947 void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim; 5948 5949 5950 /***/ }), 5951 5952 /***/ 422: 5953 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5954 5955 "use strict"; 5956 5957 5958 if (true) { 5959 module.exports = __webpack_require__(83); 5960 } else {} 5961 5962 5963 /***/ }), 5964 5965 /***/ 1609: 5966 /***/ ((module) => { 5967 5968 "use strict"; 5969 module.exports = window["React"]; 5970 5971 /***/ }) 5972 5973 /******/ }); 5974 /************************************************************************/ 5975 /******/ // The module cache 5976 /******/ var __webpack_module_cache__ = {}; 5977 /******/ 5978 /******/ // The require function 5979 /******/ function __webpack_require__(moduleId) { 5980 /******/ // Check if module is in cache 5981 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 5982 /******/ if (cachedModule !== undefined) { 5983 /******/ return cachedModule.exports; 5984 /******/ } 5985 /******/ // Create a new module (and put it into the cache) 5986 /******/ var module = __webpack_module_cache__[moduleId] = { 5987 /******/ // no module.id needed 5988 /******/ // no module.loaded needed 5989 /******/ exports: {} 5990 /******/ }; 5991 /******/ 5992 /******/ // Execute the module function 5993 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 5994 /******/ 5995 /******/ // Return the exports of the module 5996 /******/ return module.exports; 5997 /******/ } 5998 /******/ 5999 /************************************************************************/ 6000 /******/ /* webpack/runtime/compat get default export */ 6001 /******/ (() => { 6002 /******/ // getDefaultExport function for compatibility with non-harmony modules 6003 /******/ __webpack_require__.n = (module) => { 6004 /******/ var getter = module && module.__esModule ? 6005 /******/ () => (module['default']) : 6006 /******/ () => (module); 6007 /******/ __webpack_require__.d(getter, { a: getter }); 6008 /******/ return getter; 6009 /******/ }; 6010 /******/ })(); 6011 /******/ 6012 /******/ /* webpack/runtime/create fake namespace object */ 6013 /******/ (() => { 6014 /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); 6015 /******/ var leafPrototypes; 6016 /******/ // create a fake namespace object 6017 /******/ // mode & 1: value is a module id, require it 6018 /******/ // mode & 2: merge all properties of value into the ns 6019 /******/ // mode & 4: return value when already ns object 6020 /******/ // mode & 16: return value when it's Promise-like 6021 /******/ // mode & 8|1: behave like require 6022 /******/ __webpack_require__.t = function(value, mode) { 6023 /******/ if(mode & 1) value = this(value); 6024 /******/ if(mode & 8) return value; 6025 /******/ if(typeof value === 'object' && value) { 6026 /******/ if((mode & 4) && value.__esModule) return value; 6027 /******/ if((mode & 16) && typeof value.then === 'function') return value; 6028 /******/ } 6029 /******/ var ns = Object.create(null); 6030 /******/ __webpack_require__.r(ns); 6031 /******/ var def = {}; 6032 /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; 6033 /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { 6034 /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); 6035 /******/ } 6036 /******/ def['default'] = () => (value); 6037 /******/ __webpack_require__.d(ns, def); 6038 /******/ return ns; 6039 /******/ }; 6040 /******/ })(); 6041 /******/ 6042 /******/ /* webpack/runtime/define property getters */ 6043 /******/ (() => { 6044 /******/ // define getter functions for harmony exports 6045 /******/ __webpack_require__.d = (exports, definition) => { 6046 /******/ for(var key in definition) { 6047 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 6048 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 6049 /******/ } 6050 /******/ } 6051 /******/ }; 6052 /******/ })(); 6053 /******/ 6054 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 6055 /******/ (() => { 6056 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 6057 /******/ })(); 6058 /******/ 6059 /******/ /* webpack/runtime/make namespace object */ 6060 /******/ (() => { 6061 /******/ // define __esModule on exports 6062 /******/ __webpack_require__.r = (exports) => { 6063 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 6064 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 6065 /******/ } 6066 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 6067 /******/ }; 6068 /******/ })(); 6069 /******/ 6070 /************************************************************************/ 6071 var __webpack_exports__ = {}; 6072 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 6073 (() => { 6074 "use strict"; 6075 // ESM COMPAT FLAG 6076 __webpack_require__.r(__webpack_exports__); 6077 6078 // EXPORTS 6079 __webpack_require__.d(__webpack_exports__, { 6080 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), 6081 PluginSidebar: () => (/* reexport */ PluginSidebar), 6082 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 6083 PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel), 6084 initializeEditor: () => (/* binding */ initializeEditor), 6085 initializePostsDashboard: () => (/* reexport */ initializePostsDashboard), 6086 reinitializeEditor: () => (/* binding */ reinitializeEditor), 6087 store: () => (/* reexport */ store) 6088 }); 6089 6090 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js 6091 var actions_namespaceObject = {}; 6092 __webpack_require__.r(actions_namespaceObject); 6093 __webpack_require__.d(actions_namespaceObject, { 6094 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), 6095 addTemplate: () => (addTemplate), 6096 closeGeneralSidebar: () => (closeGeneralSidebar), 6097 openGeneralSidebar: () => (openGeneralSidebar), 6098 openNavigationPanelToMenu: () => (openNavigationPanelToMenu), 6099 removeTemplate: () => (removeTemplate), 6100 revertTemplate: () => (revertTemplate), 6101 setEditedEntity: () => (setEditedEntity), 6102 setEditedPostContext: () => (setEditedPostContext), 6103 setHasPageContentFocus: () => (setHasPageContentFocus), 6104 setHomeTemplateId: () => (setHomeTemplateId), 6105 setIsInserterOpened: () => (setIsInserterOpened), 6106 setIsListViewOpened: () => (setIsListViewOpened), 6107 setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened), 6108 setIsSaveViewOpened: () => (setIsSaveViewOpened), 6109 setNavigationMenu: () => (setNavigationMenu), 6110 setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu), 6111 setPage: () => (setPage), 6112 setTemplate: () => (setTemplate), 6113 setTemplatePart: () => (setTemplatePart), 6114 switchEditorMode: () => (switchEditorMode), 6115 toggleDistractionFree: () => (toggleDistractionFree), 6116 toggleFeature: () => (toggleFeature), 6117 updateSettings: () => (updateSettings) 6118 }); 6119 6120 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 6121 var private_actions_namespaceObject = {}; 6122 __webpack_require__.r(private_actions_namespaceObject); 6123 __webpack_require__.d(private_actions_namespaceObject, { 6124 registerRoute: () => (registerRoute), 6125 setEditorCanvasContainerView: () => (setEditorCanvasContainerView), 6126 unregisterRoute: () => (unregisterRoute) 6127 }); 6128 6129 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 6130 var selectors_namespaceObject = {}; 6131 __webpack_require__.r(selectors_namespaceObject); 6132 __webpack_require__.d(selectors_namespaceObject, { 6133 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), 6134 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), 6135 getCanUserCreateMedia: () => (getCanUserCreateMedia), 6136 getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu), 6137 getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts), 6138 getEditedPostContext: () => (getEditedPostContext), 6139 getEditedPostId: () => (getEditedPostId), 6140 getEditedPostType: () => (getEditedPostType), 6141 getEditorMode: () => (getEditorMode), 6142 getHomeTemplateId: () => (getHomeTemplateId), 6143 getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu), 6144 getPage: () => (getPage), 6145 getReusableBlocks: () => (getReusableBlocks), 6146 getSettings: () => (getSettings), 6147 hasPageContentFocus: () => (hasPageContentFocus), 6148 isFeatureActive: () => (isFeatureActive), 6149 isInserterOpened: () => (isInserterOpened), 6150 isListViewOpened: () => (isListViewOpened), 6151 isNavigationOpened: () => (isNavigationOpened), 6152 isPage: () => (isPage), 6153 isSaveViewOpened: () => (isSaveViewOpened) 6154 }); 6155 6156 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 6157 var private_selectors_namespaceObject = {}; 6158 __webpack_require__.r(private_selectors_namespaceObject); 6159 __webpack_require__.d(private_selectors_namespaceObject, { 6160 getEditorCanvasContainerView: () => (getEditorCanvasContainerView), 6161 getRoutes: () => (getRoutes) 6162 }); 6163 6164 ;// external ["wp","blocks"] 6165 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 6166 ;// external ["wp","blockLibrary"] 6167 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 6168 ;// external ["wp","data"] 6169 const external_wp_data_namespaceObject = window["wp"]["data"]; 6170 ;// external ["wp","deprecated"] 6171 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 6172 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 6173 ;// external ["wp","element"] 6174 const external_wp_element_namespaceObject = window["wp"]["element"]; 6175 ;// external ["wp","editor"] 6176 const external_wp_editor_namespaceObject = window["wp"]["editor"]; 6177 ;// external ["wp","preferences"] 6178 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 6179 ;// external ["wp","widgets"] 6180 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; 6181 ;// external ["wp","hooks"] 6182 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 6183 ;// external ["wp","compose"] 6184 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 6185 ;// external ["wp","blockEditor"] 6186 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 6187 ;// external ["wp","components"] 6188 const external_wp_components_namespaceObject = window["wp"]["components"]; 6189 ;// external ["wp","i18n"] 6190 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 6191 ;// external ["wp","notices"] 6192 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 6193 ;// external ["wp","coreData"] 6194 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 6195 ;// ./node_modules/colord/index.mjs 6196 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()})}; 6197 6198 ;// ./node_modules/colord/plugins/a11y.mjs 6199 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}} 6200 6201 ;// external ["wp","privateApis"] 6202 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 6203 ;// ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js 6204 /** 6205 * WordPress dependencies 6206 */ 6207 6208 const { 6209 lock, 6210 unlock 6211 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-site'); 6212 6213 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js 6214 /* wp:polyfill */ 6215 /** 6216 * External dependencies 6217 */ 6218 6219 6220 6221 /** 6222 * WordPress dependencies 6223 */ 6224 6225 6226 6227 /** 6228 * Internal dependencies 6229 */ 6230 6231 6232 const { 6233 useGlobalSetting, 6234 useGlobalStyle 6235 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6236 6237 // Enable colord's a11y plugin. 6238 k([a11y]); 6239 function useColorRandomizer(name) { 6240 const [themeColors, setThemeColors] = useGlobalSetting('color.palette.theme', name); 6241 function randomizeColors() { 6242 /* eslint-disable no-restricted-syntax */ 6243 const randomRotationValue = Math.floor(Math.random() * 225); 6244 /* eslint-enable no-restricted-syntax */ 6245 6246 const newColors = themeColors.map(colorObject => { 6247 const { 6248 color 6249 } = colorObject; 6250 const newColor = w(color).rotate(randomRotationValue).toHex(); 6251 return { 6252 ...colorObject, 6253 color: newColor 6254 }; 6255 }); 6256 setThemeColors(newColors); 6257 } 6258 return window.__experimentalEnableColorRandomizer ? [randomizeColors] : []; 6259 } 6260 function useStylesPreviewColors() { 6261 const [textColor = 'black'] = useGlobalStyle('color.text'); 6262 const [backgroundColor = 'white'] = useGlobalStyle('color.background'); 6263 const [headingColor = textColor] = useGlobalStyle('elements.h1.color.text'); 6264 const [linkColor = headingColor] = useGlobalStyle('elements.link.color.text'); 6265 const [buttonBackgroundColor = linkColor] = useGlobalStyle('elements.button.color.background'); 6266 const [coreColors] = useGlobalSetting('color.palette.core'); 6267 const [themeColors] = useGlobalSetting('color.palette.theme'); 6268 const [customColors] = useGlobalSetting('color.palette.custom'); 6269 const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []); 6270 const textColorObject = paletteColors.filter(({ 6271 color 6272 }) => color === textColor); 6273 const buttonBackgroundColorObject = paletteColors.filter(({ 6274 color 6275 }) => color === buttonBackgroundColor); 6276 const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( 6277 // we exclude these background color because it is already visible in the preview. 6278 ({ 6279 color 6280 }) => color !== backgroundColor).slice(0, 2); 6281 return { 6282 paletteColors, 6283 highlightedColors 6284 }; 6285 } 6286 function useSupportedStyles(name, element) { 6287 const { 6288 supportedPanels 6289 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6290 return { 6291 supportedPanels: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(name, element) 6292 }; 6293 }, [name, element]); 6294 return supportedPanels; 6295 } 6296 6297 ;// ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js 6298 /* wp:polyfill */ 6299 /** 6300 * Sets the value at path of object. 6301 * If a portion of path doesn’t exist, it’s created. 6302 * Arrays are created for missing index properties while objects are created 6303 * for all other missing properties. 6304 * 6305 * This function intentionally mutates the input object. 6306 * 6307 * Inspired by _.set(). 6308 * 6309 * @see https://lodash.com/docs/4.17.15#set 6310 * 6311 * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`. 6312 * 6313 * @param {Object} object Object to modify 6314 * @param {Array} path Path of the property to set. 6315 * @param {*} value Value to set. 6316 */ 6317 function setNestedValue(object, path, value) { 6318 if (!object || typeof object !== 'object') { 6319 return object; 6320 } 6321 path.reduce((acc, key, idx) => { 6322 if (acc[key] === undefined) { 6323 if (Number.isInteger(path[idx + 1])) { 6324 acc[key] = []; 6325 } else { 6326 acc[key] = {}; 6327 } 6328 } 6329 if (idx === path.length - 1) { 6330 acc[key] = value; 6331 } 6332 return acc[key]; 6333 }, object); 6334 return object; 6335 } 6336 6337 ;// external "ReactJSXRuntime" 6338 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 6339 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js 6340 /* wp:polyfill */ 6341 /** 6342 * WordPress dependencies 6343 */ 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 /** 6356 * Internal dependencies 6357 */ 6358 6359 6360 6361 6362 const { 6363 cleanEmptyObject, 6364 GlobalStylesContext 6365 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6366 6367 // Block Gap is a special case and isn't defined within the blocks 6368 // style properties config. We'll add it here to allow it to be pushed 6369 // to global styles as well. 6370 const STYLE_PROPERTY = { 6371 ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, 6372 blockGap: { 6373 value: ['spacing', 'blockGap'] 6374 } 6375 }; 6376 6377 // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be 6378 // removed by moving PushChangesToGlobalStylesControl to 6379 // @wordpress/block-editor. 6380 const STYLE_PATH_TO_CSS_VAR_INFIX = { 6381 'border.color': 'color', 6382 'color.background': 'color', 6383 'color.text': 'color', 6384 'elements.link.color.text': 'color', 6385 'elements.link.:hover.color.text': 'color', 6386 'elements.link.typography.fontFamily': 'font-family', 6387 'elements.link.typography.fontSize': 'font-size', 6388 'elements.button.color.text': 'color', 6389 'elements.button.color.background': 'color', 6390 'elements.button.typography.fontFamily': 'font-family', 6391 'elements.button.typography.fontSize': 'font-size', 6392 'elements.caption.color.text': 'color', 6393 'elements.heading.color': 'color', 6394 'elements.heading.color.background': 'color', 6395 'elements.heading.typography.fontFamily': 'font-family', 6396 'elements.heading.gradient': 'gradient', 6397 'elements.heading.color.gradient': 'gradient', 6398 'elements.h1.color': 'color', 6399 'elements.h1.color.background': 'color', 6400 'elements.h1.typography.fontFamily': 'font-family', 6401 'elements.h1.color.gradient': 'gradient', 6402 'elements.h2.color': 'color', 6403 'elements.h2.color.background': 'color', 6404 'elements.h2.typography.fontFamily': 'font-family', 6405 'elements.h2.color.gradient': 'gradient', 6406 'elements.h3.color': 'color', 6407 'elements.h3.color.background': 'color', 6408 'elements.h3.typography.fontFamily': 'font-family', 6409 'elements.h3.color.gradient': 'gradient', 6410 'elements.h4.color': 'color', 6411 'elements.h4.color.background': 'color', 6412 'elements.h4.typography.fontFamily': 'font-family', 6413 'elements.h4.color.gradient': 'gradient', 6414 'elements.h5.color': 'color', 6415 'elements.h5.color.background': 'color', 6416 'elements.h5.typography.fontFamily': 'font-family', 6417 'elements.h5.color.gradient': 'gradient', 6418 'elements.h6.color': 'color', 6419 'elements.h6.color.background': 'color', 6420 'elements.h6.typography.fontFamily': 'font-family', 6421 'elements.h6.color.gradient': 'gradient', 6422 'color.gradient': 'gradient', 6423 blockGap: 'spacing', 6424 'typography.fontSize': 'font-size', 6425 'typography.fontFamily': 'font-family' 6426 }; 6427 6428 // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be 6429 // removed by moving PushChangesToGlobalStylesControl to 6430 // @wordpress/block-editor. 6431 const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 6432 'border.color': 'borderColor', 6433 'color.background': 'backgroundColor', 6434 'color.text': 'textColor', 6435 'color.gradient': 'gradient', 6436 'typography.fontSize': 'fontSize', 6437 'typography.fontFamily': 'fontFamily' 6438 }; 6439 const SUPPORTED_STYLES = ['border', 'color', 'spacing', 'typography']; 6440 const getValueFromObjectPath = (object, path) => { 6441 let value = object; 6442 path.forEach(fieldName => { 6443 value = value?.[fieldName]; 6444 }); 6445 return value; 6446 }; 6447 const flatBorderProperties = ['borderColor', 'borderWidth', 'borderStyle']; 6448 const sides = ['top', 'right', 'bottom', 'left']; 6449 function getBorderStyleChanges(border, presetColor, userStyle) { 6450 if (!border && !presetColor) { 6451 return []; 6452 } 6453 const changes = [...getFallbackBorderStyleChange('top', border, userStyle), ...getFallbackBorderStyleChange('right', border, userStyle), ...getFallbackBorderStyleChange('bottom', border, userStyle), ...getFallbackBorderStyleChange('left', border, userStyle)]; 6454 6455 // Handle a flat border i.e. all sides the same, CSS shorthand. 6456 const { 6457 color: customColor, 6458 style, 6459 width 6460 } = border || {}; 6461 const hasColorOrWidth = presetColor || customColor || width; 6462 if (hasColorOrWidth && !style) { 6463 // Global Styles need individual side configurations to overcome 6464 // theme.json configurations which are per side as well. 6465 sides.forEach(side => { 6466 // Only add fallback border-style if global styles don't already 6467 // have something set. 6468 if (!userStyle?.[side]?.style) { 6469 changes.push({ 6470 path: ['border', side, 'style'], 6471 value: 'solid' 6472 }); 6473 } 6474 }); 6475 } 6476 return changes; 6477 } 6478 function getFallbackBorderStyleChange(side, border, globalBorderStyle) { 6479 if (!border?.[side] || globalBorderStyle?.[side]?.style) { 6480 return []; 6481 } 6482 const { 6483 color, 6484 style, 6485 width 6486 } = border[side]; 6487 const hasColorOrWidth = color || width; 6488 if (!hasColorOrWidth || style) { 6489 return []; 6490 } 6491 return [{ 6492 path: ['border', side, 'style'], 6493 value: 'solid' 6494 }]; 6495 } 6496 function useChangesToPush(name, attributes, userConfig) { 6497 const supports = useSupportedStyles(name); 6498 const blockUserConfig = userConfig?.styles?.blocks?.[name]; 6499 return (0,external_wp_element_namespaceObject.useMemo)(() => { 6500 const changes = supports.flatMap(key => { 6501 if (!STYLE_PROPERTY[key]) { 6502 return []; 6503 } 6504 const { 6505 value: path 6506 } = STYLE_PROPERTY[key]; 6507 const presetAttributeKey = path.join('.'); 6508 const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]]; 6509 const value = presetAttributeValue ? `var:preset|$STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|$presetAttributeValue}` : getValueFromObjectPath(attributes.style, path); 6510 6511 // Links only have a single support entry but have two element 6512 // style properties, color and hover color. The following check 6513 // will add the hover color to the changes if required. 6514 if (key === 'linkColor') { 6515 const linkChanges = value ? [{ 6516 path, 6517 value 6518 }] : []; 6519 const hoverPath = ['elements', 'link', ':hover', 'color', 'text']; 6520 const hoverValue = getValueFromObjectPath(attributes.style, hoverPath); 6521 if (hoverValue) { 6522 linkChanges.push({ 6523 path: hoverPath, 6524 value: hoverValue 6525 }); 6526 } 6527 return linkChanges; 6528 } 6529 6530 // The shorthand border styles can't be mapped directly as global 6531 // styles requires longhand config. 6532 if (flatBorderProperties.includes(key) && value) { 6533 // The shorthand config path is included to clear the block attribute. 6534 const borderChanges = [{ 6535 path, 6536 value 6537 }]; 6538 sides.forEach(side => { 6539 const currentPath = [...path]; 6540 currentPath.splice(-1, 0, side); 6541 borderChanges.push({ 6542 path: currentPath, 6543 value 6544 }); 6545 }); 6546 return borderChanges; 6547 } 6548 return value ? [{ 6549 path, 6550 value 6551 }] : []; 6552 }); 6553 6554 // To ensure display of a visible border, global styles require a 6555 // default border style if a border color or width is present. 6556 getBorderStyleChanges(attributes.style?.border, attributes.borderColor, blockUserConfig?.border).forEach(change => changes.push(change)); 6557 return changes; 6558 }, [supports, attributes, blockUserConfig]); 6559 } 6560 function PushChangesToGlobalStylesControl({ 6561 name, 6562 attributes, 6563 setAttributes 6564 }) { 6565 const { 6566 user: userConfig, 6567 setUserConfig 6568 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 6569 const changes = useChangesToPush(name, attributes, userConfig); 6570 const { 6571 __unstableMarkNextChangeAsNotPersistent 6572 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 6573 const { 6574 createSuccessNotice 6575 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6576 const pushChanges = (0,external_wp_element_namespaceObject.useCallback)(() => { 6577 if (changes.length === 0) { 6578 return; 6579 } 6580 if (changes.length > 0) { 6581 const { 6582 style: blockStyles 6583 } = attributes; 6584 const newBlockStyles = structuredClone(blockStyles); 6585 const newUserConfig = structuredClone(userConfig); 6586 for (const { 6587 path, 6588 value 6589 } of changes) { 6590 setNestedValue(newBlockStyles, path, undefined); 6591 setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value); 6592 } 6593 const newBlockAttributes = { 6594 borderColor: undefined, 6595 backgroundColor: undefined, 6596 textColor: undefined, 6597 gradient: undefined, 6598 fontSize: undefined, 6599 fontFamily: undefined, 6600 style: cleanEmptyObject(newBlockStyles) 6601 }; 6602 6603 // @wordpress/core-data doesn't support editing multiple entity types in 6604 // a single undo level. So for now, we disable @wordpress/core-data undo 6605 // tracking and implement our own Undo button in the snackbar 6606 // notification. 6607 __unstableMarkNextChangeAsNotPersistent(); 6608 setAttributes(newBlockAttributes); 6609 setUserConfig(newUserConfig, { 6610 undoIgnore: true 6611 }); 6612 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 6613 // translators: %s: Title of the block e.g. 'Heading'. 6614 (0,external_wp_i18n_namespaceObject.__)('%s styles applied.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title), { 6615 type: 'snackbar', 6616 actions: [{ 6617 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 6618 onClick() { 6619 __unstableMarkNextChangeAsNotPersistent(); 6620 setAttributes(attributes); 6621 setUserConfig(userConfig, { 6622 undoIgnore: true 6623 }); 6624 } 6625 }] 6626 }); 6627 } 6628 }, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, name, setAttributes, setUserConfig, userConfig]); 6629 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { 6630 __nextHasNoMarginBottom: true, 6631 className: "edit-site-push-changes-to-global-styles-control", 6632 help: (0,external_wp_i18n_namespaceObject.sprintf)( 6633 // translators: %s: Title of the block e.g. 'Heading'. 6634 (0,external_wp_i18n_namespaceObject.__)('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title), 6635 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 6636 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 6637 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6638 __next40pxDefaultSize: true, 6639 variant: "secondary", 6640 accessibleWhenDisabled: true, 6641 disabled: changes.length === 0, 6642 onClick: pushChanges, 6643 children: (0,external_wp_i18n_namespaceObject.__)('Apply globally') 6644 })] 6645 }); 6646 } 6647 function PushChangesToGlobalStyles(props) { 6648 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 6649 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); 6650 const supportsStyles = SUPPORTED_STYLES.some(feature => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature)); 6651 const isDisplayed = blockEditingMode === 'default' && supportsStyles && isBlockBasedTheme; 6652 if (!isDisplayed) { 6653 return null; 6654 } 6655 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { 6656 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { 6657 ...props 6658 }) 6659 }); 6660 } 6661 const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 6662 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 6663 ...props 6664 }, "edit"), props.isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { 6665 ...props 6666 })] 6667 })); 6668 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles); 6669 6670 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/index.js 6671 /** 6672 * Internal dependencies 6673 */ 6674 6675 6676 ;// ./node_modules/@wordpress/edit-site/build-module/store/reducer.js 6677 /* wp:polyfill */ 6678 /** 6679 * WordPress dependencies 6680 */ 6681 6682 6683 /** 6684 * Reducer returning the settings. 6685 * 6686 * @param {Object} state Current state. 6687 * @param {Object} action Dispatched action. 6688 * 6689 * @return {Object} Updated state. 6690 */ 6691 function settings(state = {}, action) { 6692 switch (action.type) { 6693 case 'UPDATE_SETTINGS': 6694 return { 6695 ...state, 6696 ...action.settings 6697 }; 6698 } 6699 return state; 6700 } 6701 6702 /** 6703 * Reducer keeping track of the currently edited Post Type, 6704 * Post Id and the context provided to fill the content of the block editor. 6705 * 6706 * @param {Object} state Current edited post. 6707 * @param {Object} action Dispatched action. 6708 * 6709 * @return {Object} Updated state. 6710 */ 6711 function editedPost(state = {}, action) { 6712 switch (action.type) { 6713 case 'SET_EDITED_POST': 6714 return { 6715 postType: action.postType, 6716 id: action.id, 6717 context: action.context 6718 }; 6719 case 'SET_EDITED_POST_CONTEXT': 6720 return { 6721 ...state, 6722 context: action.context 6723 }; 6724 } 6725 return state; 6726 } 6727 6728 /** 6729 * Reducer to set the save view panel open or closed. 6730 * 6731 * @param {Object} state Current state. 6732 * @param {Object} action Dispatched action. 6733 */ 6734 function saveViewPanel(state = false, action) { 6735 switch (action.type) { 6736 case 'SET_IS_SAVE_VIEW_OPENED': 6737 return action.isOpen; 6738 } 6739 return state; 6740 } 6741 6742 /** 6743 * Reducer used to track the site editor canvas container view. 6744 * Default is `undefined`, denoting the default, visual block editor. 6745 * This could be, for example, `'style-book'` (the style book). 6746 * 6747 * @param {string|undefined} state Current state. 6748 * @param {Object} action Dispatched action. 6749 */ 6750 function editorCanvasContainerView(state = undefined, action) { 6751 switch (action.type) { 6752 case 'SET_EDITOR_CANVAS_CONTAINER_VIEW': 6753 return action.view; 6754 } 6755 return state; 6756 } 6757 function routes(state = [], action) { 6758 switch (action.type) { 6759 case 'REGISTER_ROUTE': 6760 return [...state, action.route]; 6761 case 'UNREGISTER_ROUTE': 6762 return state.filter(route => route.name !== action.name); 6763 } 6764 return state; 6765 } 6766 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 6767 settings, 6768 editedPost, 6769 saveViewPanel, 6770 editorCanvasContainerView, 6771 routes 6772 })); 6773 6774 ;// external ["wp","patterns"] 6775 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 6776 ;// ./node_modules/@wordpress/edit-site/build-module/utils/constants.js 6777 /** 6778 * WordPress dependencies 6779 */ 6780 6781 6782 6783 /** 6784 * Internal dependencies 6785 */ 6786 6787 6788 // Navigation 6789 const NAVIGATION_POST_TYPE = 'wp_navigation'; 6790 6791 // Templates. 6792 const TEMPLATE_POST_TYPE = 'wp_template'; 6793 const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 6794 const TEMPLATE_ORIGINS = { 6795 custom: 'custom', 6796 theme: 'theme', 6797 plugin: 'plugin' 6798 }; 6799 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; 6800 const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts'; 6801 6802 // Patterns. 6803 const { 6804 PATTERN_TYPES, 6805 PATTERN_DEFAULT_CATEGORY, 6806 PATTERN_USER_CATEGORY, 6807 EXCLUDED_PATTERN_SOURCES, 6808 PATTERN_SYNC_TYPES 6809 } = unlock(external_wp_patterns_namespaceObject.privateApis); 6810 6811 // Entities that are editable in focus mode. 6812 const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; 6813 const POST_TYPE_LABELS = { 6814 [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template'), 6815 [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template part'), 6816 [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)('Pattern'), 6817 [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Navigation') 6818 }; 6819 6820 // DataViews constants 6821 const LAYOUT_GRID = 'grid'; 6822 const LAYOUT_TABLE = 'table'; 6823 const LAYOUT_LIST = 'list'; 6824 const OPERATOR_IS = 'is'; 6825 const OPERATOR_IS_NOT = 'isNot'; 6826 const OPERATOR_IS_ANY = 'isAny'; 6827 const OPERATOR_IS_NONE = 'isNone'; 6828 6829 ;// ./node_modules/@wordpress/edit-site/build-module/store/actions.js 6830 /** 6831 * WordPress dependencies 6832 */ 6833 6834 6835 6836 6837 6838 6839 6840 /** 6841 * Internal dependencies 6842 */ 6843 6844 6845 const { 6846 interfaceStore 6847 } = unlock(external_wp_editor_namespaceObject.privateApis); 6848 6849 /** 6850 * Dispatches an action that toggles a feature flag. 6851 * 6852 * @param {string} featureName Feature name. 6853 */ 6854 function toggleFeature(featureName) { 6855 return function ({ 6856 registry 6857 }) { 6858 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleFeature( featureName )", { 6859 since: '6.0', 6860 alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )" 6861 }); 6862 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName); 6863 }; 6864 } 6865 6866 /** 6867 * Action that changes the width of the editing canvas. 6868 * 6869 * @deprecated 6870 * 6871 * @param {string} deviceType 6872 * 6873 * @return {Object} Action object. 6874 */ 6875 const __experimentalSetPreviewDeviceType = deviceType => ({ 6876 registry 6877 }) => { 6878 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType", { 6879 since: '6.5', 6880 version: '6.7', 6881 hint: 'registry.dispatch( editorStore ).setDeviceType' 6882 }); 6883 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); 6884 }; 6885 6886 /** 6887 * Action that sets a template, optionally fetching it from REST API. 6888 * 6889 * @return {Object} Action object. 6890 */ 6891 function setTemplate() { 6892 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", { 6893 since: '6.5', 6894 version: '6.8', 6895 hint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.' 6896 }); 6897 return { 6898 type: 'NOTHING' 6899 }; 6900 } 6901 6902 /** 6903 * Action that adds a new template and sets it as the current template. 6904 * 6905 * @param {Object} template The template. 6906 * 6907 * @deprecated 6908 * 6909 * @return {Object} Action object used to set the current template. 6910 */ 6911 const addTemplate = template => async ({ 6912 dispatch, 6913 registry 6914 }) => { 6915 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", { 6916 since: '6.5', 6917 version: '6.8', 6918 hint: 'use saveEntityRecord directly' 6919 }); 6920 const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', TEMPLATE_POST_TYPE, template); 6921 if (template.content) { 6922 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', TEMPLATE_POST_TYPE, newTemplate.id, { 6923 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) 6924 }, { 6925 undoIgnore: true 6926 }); 6927 } 6928 dispatch({ 6929 type: 'SET_EDITED_POST', 6930 postType: TEMPLATE_POST_TYPE, 6931 id: newTemplate.id 6932 }); 6933 }; 6934 6935 /** 6936 * Action that removes a template. 6937 * 6938 * @param {Object} template The template object. 6939 */ 6940 const removeTemplate = template => ({ 6941 registry 6942 }) => { 6943 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([template]); 6944 }; 6945 6946 /** 6947 * Action that sets a template part. 6948 * 6949 * @deprecated 6950 * @param {string} templatePartId The template part ID. 6951 * 6952 * @return {Object} Action object. 6953 */ 6954 function setTemplatePart(templatePartId) { 6955 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplatePart", { 6956 since: '6.8' 6957 }); 6958 return { 6959 type: 'SET_EDITED_POST', 6960 postType: TEMPLATE_PART_POST_TYPE, 6961 id: templatePartId 6962 }; 6963 } 6964 6965 /** 6966 * Action that sets a navigation menu. 6967 * 6968 * @deprecated 6969 * @param {string} navigationMenuId The Navigation Menu Post ID. 6970 * 6971 * @return {Object} Action object. 6972 */ 6973 function setNavigationMenu(navigationMenuId) { 6974 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationMenu", { 6975 since: '6.8' 6976 }); 6977 return { 6978 type: 'SET_EDITED_POST', 6979 postType: NAVIGATION_POST_TYPE, 6980 id: navigationMenuId 6981 }; 6982 } 6983 6984 /** 6985 * Action that sets an edited entity. 6986 * 6987 * @deprecated 6988 * @param {string} postType The entity's post type. 6989 * @param {string} postId The entity's ID. 6990 * @param {Object} context The entity's context. 6991 * 6992 * @return {Object} Action object. 6993 */ 6994 function setEditedEntity(postType, postId, context) { 6995 return { 6996 type: 'SET_EDITED_POST', 6997 postType, 6998 id: postId, 6999 context 7000 }; 7001 } 7002 7003 /** 7004 * @deprecated 7005 */ 7006 function setHomeTemplateId() { 7007 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", { 7008 since: '6.2', 7009 version: '6.4' 7010 }); 7011 return { 7012 type: 'NOTHING' 7013 }; 7014 } 7015 7016 /** 7017 * Set's the current block editor context. 7018 * 7019 * @deprecated 7020 * @param {Object} context The context object. 7021 * 7022 * @return {Object} Action object. 7023 */ 7024 function setEditedPostContext(context) { 7025 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setEditedPostContext", { 7026 since: '6.8' 7027 }); 7028 return { 7029 type: 'SET_EDITED_POST_CONTEXT', 7030 context 7031 }; 7032 } 7033 7034 /** 7035 * Resolves the template for a page and displays both. If no path is given, attempts 7036 * to use the postId to generate a path like `?p=${ postId }`. 7037 * 7038 * @deprecated 7039 * 7040 * @return {Object} Action object. 7041 */ 7042 function setPage() { 7043 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", { 7044 since: '6.5', 7045 version: '6.8', 7046 hint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.' 7047 }); 7048 return { 7049 type: 'NOTHING' 7050 }; 7051 } 7052 7053 /** 7054 * Action that sets the active navigation panel menu. 7055 * 7056 * @deprecated 7057 * 7058 * @return {Object} Action object. 7059 */ 7060 function setNavigationPanelActiveMenu() { 7061 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", { 7062 since: '6.2', 7063 version: '6.4' 7064 }); 7065 return { 7066 type: 'NOTHING' 7067 }; 7068 } 7069 7070 /** 7071 * Opens the navigation panel and sets its active menu at the same time. 7072 * 7073 * @deprecated 7074 */ 7075 function openNavigationPanelToMenu() { 7076 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", { 7077 since: '6.2', 7078 version: '6.4' 7079 }); 7080 return { 7081 type: 'NOTHING' 7082 }; 7083 } 7084 7085 /** 7086 * Sets whether the navigation panel should be open. 7087 * 7088 * @deprecated 7089 */ 7090 function setIsNavigationPanelOpened() { 7091 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", { 7092 since: '6.2', 7093 version: '6.4' 7094 }); 7095 return { 7096 type: 'NOTHING' 7097 }; 7098 } 7099 7100 /** 7101 * Returns an action object used to open/close the inserter. 7102 * 7103 * @deprecated 7104 * 7105 * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). 7106 */ 7107 const setIsInserterOpened = value => ({ 7108 registry 7109 }) => { 7110 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", { 7111 since: '6.5', 7112 alternative: "dispatch( 'core/editor').setIsInserterOpened" 7113 }); 7114 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); 7115 }; 7116 7117 /** 7118 * Returns an action object used to open/close the list view. 7119 * 7120 * @deprecated 7121 * 7122 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 7123 */ 7124 const setIsListViewOpened = isOpen => ({ 7125 registry 7126 }) => { 7127 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", { 7128 since: '6.5', 7129 alternative: "dispatch( 'core/editor').setIsListViewOpened" 7130 }); 7131 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); 7132 }; 7133 7134 /** 7135 * Returns an action object used to update the settings. 7136 * 7137 * @param {Object} settings New settings. 7138 * 7139 * @return {Object} Action object. 7140 */ 7141 function updateSettings(settings) { 7142 return { 7143 type: 'UPDATE_SETTINGS', 7144 settings 7145 }; 7146 } 7147 7148 /** 7149 * Sets whether the save view panel should be open. 7150 * 7151 * @param {boolean} isOpen If true, opens the save view. If false, closes it. 7152 * It does not toggle the state, but sets it directly. 7153 */ 7154 function setIsSaveViewOpened(isOpen) { 7155 return { 7156 type: 'SET_IS_SAVE_VIEW_OPENED', 7157 isOpen 7158 }; 7159 } 7160 7161 /** 7162 * Reverts a template to its original theme-provided file. 7163 * 7164 * @param {Object} template The template to revert. 7165 * @param {Object} [options] 7166 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 7167 * reverting the template. Default true. 7168 */ 7169 const revertTemplate = (template, options) => ({ 7170 registry 7171 }) => { 7172 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate(template, options); 7173 }; 7174 7175 /** 7176 * Action that opens an editor sidebar. 7177 * 7178 * @param {?string} name Sidebar name to be opened. 7179 */ 7180 const openGeneralSidebar = name => ({ 7181 registry 7182 }) => { 7183 registry.dispatch(interfaceStore).enableComplementaryArea('core', name); 7184 }; 7185 7186 /** 7187 * Action that closes the sidebar. 7188 */ 7189 const closeGeneralSidebar = () => ({ 7190 registry 7191 }) => { 7192 registry.dispatch(interfaceStore).disableComplementaryArea('core'); 7193 }; 7194 7195 /** 7196 * Triggers an action used to switch editor mode. 7197 * 7198 * @deprecated 7199 * 7200 * @param {string} mode The editor mode. 7201 */ 7202 const switchEditorMode = mode => ({ 7203 registry 7204 }) => { 7205 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", { 7206 since: '6.6', 7207 alternative: "dispatch( 'core/editor').switchEditorMode" 7208 }); 7209 registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); 7210 }; 7211 7212 /** 7213 * Sets whether or not the editor allows only page content to be edited. 7214 * 7215 * @param {boolean} hasPageContentFocus True to allow only page content to be 7216 * edited, false to allow template to be 7217 * edited. 7218 */ 7219 const setHasPageContentFocus = hasPageContentFocus => ({ 7220 dispatch, 7221 registry 7222 }) => { 7223 external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, { 7224 since: '6.5' 7225 }); 7226 if (hasPageContentFocus) { 7227 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 7228 } 7229 dispatch({ 7230 type: 'SET_HAS_PAGE_CONTENT_FOCUS', 7231 hasPageContentFocus 7232 }); 7233 }; 7234 7235 /** 7236 * Action that toggles Distraction free mode. 7237 * Distraction free mode expects there are no sidebars, as due to the 7238 * z-index values set, you can't close sidebars. 7239 * 7240 * @deprecated 7241 */ 7242 const toggleDistractionFree = () => ({ 7243 registry 7244 }) => { 7245 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", { 7246 since: '6.6', 7247 alternative: "dispatch( 'core/editor').toggleDistractionFree" 7248 }); 7249 registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); 7250 }; 7251 7252 ;// ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 7253 /** 7254 * Action that switches the editor canvas container view. 7255 * 7256 * @param {?string} view Editor canvas container view. 7257 */ 7258 const setEditorCanvasContainerView = view => ({ 7259 dispatch 7260 }) => { 7261 dispatch({ 7262 type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW', 7263 view 7264 }); 7265 }; 7266 function registerRoute(route) { 7267 return { 7268 type: 'REGISTER_ROUTE', 7269 route 7270 }; 7271 } 7272 function unregisterRoute(name) { 7273 return { 7274 type: 'UNREGISTER_ROUTE', 7275 name 7276 }; 7277 } 7278 7279 ;// ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js 7280 /* wp:polyfill */ 7281 /** 7282 * WordPress dependencies 7283 */ 7284 7285 const EMPTY_ARRAY = []; 7286 7287 /** 7288 * Get a flattened and filtered list of template parts and the matching block for that template part. 7289 * 7290 * Takes a list of blocks defined within a template, and a list of template parts, and returns a 7291 * flattened list of template parts and the matching block for that template part. 7292 * 7293 * @param {Array} blocks Blocks to flatten. 7294 * @param {?Array} templateParts Available template parts. 7295 * @return {Array} An array of template parts and their blocks. 7296 */ 7297 function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { 7298 const templatePartsById = templateParts ? 7299 // Key template parts by their ID. 7300 templateParts.reduce((newTemplateParts, part) => ({ 7301 ...newTemplateParts, 7302 [part.id]: part 7303 }), {}) : {}; 7304 const result = []; 7305 7306 // Iterate over all blocks, recursing into inner blocks. 7307 // Output will be based on a depth-first traversal. 7308 const stack = [...blocks]; 7309 while (stack.length) { 7310 const { 7311 innerBlocks, 7312 ...block 7313 } = stack.shift(); 7314 // Place inner blocks at the beginning of the stack to preserve order. 7315 stack.unshift(...innerBlocks); 7316 if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { 7317 const { 7318 attributes: { 7319 theme, 7320 slug 7321 } 7322 } = block; 7323 const templatePartId = `$theme}//${slug}`; 7324 const templatePart = templatePartsById[templatePartId]; 7325 7326 // Only add to output if the found template part block is in the list of available template parts. 7327 if (templatePart) { 7328 result.push({ 7329 templatePart, 7330 block 7331 }); 7332 } 7333 } 7334 } 7335 return result; 7336 } 7337 7338 ;// ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 7339 /** 7340 * WordPress dependencies 7341 */ 7342 7343 7344 7345 7346 7347 7348 7349 7350 /** 7351 * Internal dependencies 7352 */ 7353 7354 7355 7356 7357 /** 7358 * @typedef {'template'|'template_type'} TemplateType Template type. 7359 */ 7360 7361 /** 7362 * Returns whether the given feature is enabled or not. 7363 * 7364 * @deprecated 7365 * @param {Object} state Global application state. 7366 * @param {string} featureName Feature slug. 7367 * 7368 * @return {boolean} Is active. 7369 */ 7370 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (_, featureName) => { 7371 external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, { 7372 since: '6.0', 7373 alternative: `select( 'core/preferences' ).get` 7374 }); 7375 return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName); 7376 }); 7377 7378 /** 7379 * Returns the current editing canvas device type. 7380 * 7381 * @deprecated 7382 * 7383 * @param {Object} state Global application state. 7384 * 7385 * @return {string} Device type. 7386 */ 7387 const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7388 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { 7389 since: '6.5', 7390 version: '6.7', 7391 alternative: `select( 'core/editor' ).getDeviceType` 7392 }); 7393 return select(external_wp_editor_namespaceObject.store).getDeviceType(); 7394 }); 7395 7396 /** 7397 * Returns whether the current user can create media or not. 7398 * 7399 * @param {Object} state Global application state. 7400 * 7401 * @return {Object} Whether the current user can create media or not. 7402 */ 7403 const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7404 external_wp_deprecated_default()(`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, { 7405 since: '6.7', 7406 alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )` 7407 }); 7408 return select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'); 7409 }); 7410 7411 /** 7412 * Returns any available Reusable blocks. 7413 * 7414 * @param {Object} state Global application state. 7415 * 7416 * @return {Array} The available reusable blocks. 7417 */ 7418 const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7419 external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, { 7420 since: '6.5', 7421 version: '6.8', 7422 alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )` 7423 }); 7424 const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; 7425 return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { 7426 per_page: -1 7427 }) : []; 7428 }); 7429 7430 /** 7431 * Returns the site editor settings. 7432 * 7433 * @param {Object} state Global application state. 7434 * 7435 * @return {Object} Settings. 7436 */ 7437 function getSettings(state) { 7438 // It is important that we don't inject anything into these settings locally. 7439 // The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings. 7440 // If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected. 7441 return state.settings; 7442 } 7443 7444 /** 7445 * @deprecated 7446 */ 7447 function getHomeTemplateId() { 7448 external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", { 7449 since: '6.2', 7450 version: '6.4' 7451 }); 7452 } 7453 7454 /** 7455 * Returns the current edited post type (wp_template or wp_template_part). 7456 * 7457 * @deprecated 7458 * @param {Object} state Global application state. 7459 * 7460 * @return {?TemplateType} Template type. 7461 */ 7462 function getEditedPostType(state) { 7463 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostType", { 7464 since: '6.8', 7465 alternative: "select( 'core/editor' ).getCurrentPostType" 7466 }); 7467 return state.editedPost.postType; 7468 } 7469 7470 /** 7471 * Returns the ID of the currently edited template or template part. 7472 * 7473 * @deprecated 7474 * @param {Object} state Global application state. 7475 * 7476 * @return {?string} Post ID. 7477 */ 7478 function getEditedPostId(state) { 7479 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostId", { 7480 since: '6.8', 7481 alternative: "select( 'core/editor' ).getCurrentPostId" 7482 }); 7483 return state.editedPost.id; 7484 } 7485 7486 /** 7487 * Returns the edited post's context object. 7488 * 7489 * @deprecated 7490 * @param {Object} state Global application state. 7491 * 7492 * @return {Object} Page. 7493 */ 7494 function getEditedPostContext(state) { 7495 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostContext", { 7496 since: '6.8' 7497 }); 7498 return state.editedPost.context; 7499 } 7500 7501 /** 7502 * Returns the current page object. 7503 * 7504 * @deprecated 7505 * @param {Object} state Global application state. 7506 * 7507 * @return {Object} Page. 7508 */ 7509 function getPage(state) { 7510 external_wp_deprecated_default()("select( 'core/edit-site' ).getPage", { 7511 since: '6.8' 7512 }); 7513 return { 7514 context: state.editedPost.context 7515 }; 7516 } 7517 7518 /** 7519 * Returns true if the inserter is opened. 7520 * 7521 * @deprecated 7522 * 7523 * @param {Object} state Global application state. 7524 * 7525 * @return {boolean} Whether the inserter is opened. 7526 */ 7527 const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7528 external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, { 7529 since: '6.5', 7530 alternative: `select( 'core/editor' ).isInserterOpened` 7531 }); 7532 return select(external_wp_editor_namespaceObject.store).isInserterOpened(); 7533 }); 7534 7535 /** 7536 * Get the insertion point for the inserter. 7537 * 7538 * @deprecated 7539 * 7540 * @param {Object} state Global application state. 7541 * 7542 * @return {Object} The root client ID, index to insert at and starting filter value. 7543 */ 7544 const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7545 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetInsertionPoint`, { 7546 since: '6.5', 7547 version: '6.7' 7548 }); 7549 return unlock(select(external_wp_editor_namespaceObject.store)).getInserter(); 7550 }); 7551 7552 /** 7553 * Returns true if the list view is opened. 7554 * 7555 * @param {Object} state Global application state. 7556 * 7557 * @return {boolean} Whether the list view is opened. 7558 */ 7559 const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7560 external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, { 7561 since: '6.5', 7562 alternative: `select( 'core/editor' ).isListViewOpened` 7563 }); 7564 return select(external_wp_editor_namespaceObject.store).isListViewOpened(); 7565 }); 7566 7567 /** 7568 * Returns the current opened/closed state of the save panel. 7569 * 7570 * @param {Object} state Global application state. 7571 * 7572 * @return {boolean} True if the save panel should be open; false if closed. 7573 */ 7574 function isSaveViewOpened(state) { 7575 return state.saveViewPanel; 7576 } 7577 function getBlocksAndTemplateParts(select) { 7578 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 7579 per_page: -1 7580 }); 7581 const { 7582 getBlocksByName, 7583 getBlocksByClientId 7584 } = select(external_wp_blockEditor_namespaceObject.store); 7585 const clientIds = getBlocksByName('core/template-part'); 7586 const blocks = getBlocksByClientId(clientIds); 7587 return [blocks, templateParts]; 7588 } 7589 7590 /** 7591 * Returns the template parts and their blocks for the current edited template. 7592 * 7593 * @deprecated 7594 * @param {Object} state Global application state. 7595 * @return {Array} Template parts and their blocks in an array. 7596 */ 7597 const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { 7598 external_wp_deprecated_default()(`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, { 7599 since: '6.7', 7600 version: '6.9', 7601 alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )` 7602 }); 7603 return getFilteredTemplatePartBlocks(...getBlocksAndTemplateParts(select)); 7604 }, () => getBlocksAndTemplateParts(select))); 7605 7606 /** 7607 * Returns the current editing mode. 7608 * 7609 * @param {Object} state Global application state. 7610 * 7611 * @return {string} Editing mode. 7612 */ 7613 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7614 return select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode'); 7615 }); 7616 7617 /** 7618 * @deprecated 7619 */ 7620 function getCurrentTemplateNavigationPanelSubMenu() { 7621 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", { 7622 since: '6.2', 7623 version: '6.4' 7624 }); 7625 } 7626 7627 /** 7628 * @deprecated 7629 */ 7630 function getNavigationPanelActiveMenu() { 7631 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", { 7632 since: '6.2', 7633 version: '6.4' 7634 }); 7635 } 7636 7637 /** 7638 * @deprecated 7639 */ 7640 function isNavigationOpened() { 7641 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", { 7642 since: '6.2', 7643 version: '6.4' 7644 }); 7645 } 7646 7647 /** 7648 * Whether or not the editor has a page loaded into it. 7649 * 7650 * @see setPage 7651 * @deprecated 7652 * @param {Object} state Global application state. 7653 * 7654 * @return {boolean} Whether or not the editor has a page loaded into it. 7655 */ 7656 function isPage(state) { 7657 external_wp_deprecated_default()("select( 'core/edit-site' ).isPage", { 7658 since: '6.8', 7659 alternative: "select( 'core/editor' ).getCurrentPostType" 7660 }); 7661 return !!state.editedPost.context?.postId; 7662 } 7663 7664 /** 7665 * Whether or not the editor allows only page content to be edited. 7666 * 7667 * @deprecated 7668 * 7669 * @return {boolean} Whether or not focus is on editing page content. 7670 */ 7671 function hasPageContentFocus() { 7672 external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, { 7673 since: '6.5' 7674 }); 7675 return false; 7676 } 7677 7678 ;// ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 7679 /** 7680 * Returns the editor canvas container view. 7681 * 7682 * @param {Object} state Global application state. 7683 * 7684 * @return {string} Editor canvas container view. 7685 */ 7686 function getEditorCanvasContainerView(state) { 7687 return state.editorCanvasContainerView; 7688 } 7689 function getRoutes(state) { 7690 return state.routes; 7691 } 7692 7693 ;// ./node_modules/@wordpress/edit-site/build-module/store/constants.js 7694 /** 7695 * The identifier for the data store. 7696 * 7697 * @type {string} 7698 */ 7699 const STORE_NAME = 'core/edit-site'; 7700 7701 ;// ./node_modules/@wordpress/edit-site/build-module/store/index.js 7702 /** 7703 * WordPress dependencies 7704 */ 7705 7706 7707 /** 7708 * Internal dependencies 7709 */ 7710 7711 7712 7713 7714 7715 7716 7717 const storeConfig = { 7718 reducer: reducer, 7719 actions: actions_namespaceObject, 7720 selectors: selectors_namespaceObject 7721 }; 7722 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); 7723 (0,external_wp_data_namespaceObject.register)(store); 7724 unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); 7725 unlock(store).registerPrivateActions(private_actions_namespaceObject); 7726 7727 ;// external ["wp","router"] 7728 const external_wp_router_namespaceObject = window["wp"]["router"]; 7729 ;// ./node_modules/clsx/dist/clsx.mjs 7730 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); 7731 ;// external ["wp","commands"] 7732 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 7733 ;// external ["wp","coreCommands"] 7734 const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; 7735 ;// external ["wp","plugins"] 7736 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 7737 ;// external ["wp","htmlEntities"] 7738 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 7739 ;// external ["wp","primitives"] 7740 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 7741 ;// ./node_modules/@wordpress/icons/build-module/library/search.js 7742 /** 7743 * WordPress dependencies 7744 */ 7745 7746 7747 const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7748 xmlns: "http://www.w3.org/2000/svg", 7749 viewBox: "0 0 24 24", 7750 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7751 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" 7752 }) 7753 }); 7754 /* harmony default export */ const library_search = (search); 7755 7756 ;// external ["wp","keycodes"] 7757 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 7758 ;// external ["wp","url"] 7759 const external_wp_url_namespaceObject = window["wp"]["url"]; 7760 ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js 7761 /** 7762 * WordPress dependencies 7763 */ 7764 7765 7766 const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7767 xmlns: "http://www.w3.org/2000/svg", 7768 viewBox: "-2 -2 24 24", 7769 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7770 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" 7771 }) 7772 }); 7773 /* harmony default export */ const library_wordpress = (wordpress); 7774 7775 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js 7776 /** 7777 * External dependencies 7778 */ 7779 7780 7781 /** 7782 * WordPress dependencies 7783 */ 7784 7785 7786 7787 7788 7789 7790 function SiteIcon({ 7791 className 7792 }) { 7793 const { 7794 isRequestingSite, 7795 siteIconUrl 7796 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7797 const { 7798 getEntityRecord 7799 } = select(external_wp_coreData_namespaceObject.store); 7800 const siteData = getEntityRecord('root', '__unstableBase', undefined); 7801 return { 7802 isRequestingSite: !siteData, 7803 siteIconUrl: siteData?.site_icon_url 7804 }; 7805 }, []); 7806 if (isRequestingSite && !siteIconUrl) { 7807 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7808 className: "edit-site-site-icon__image" 7809 }); 7810 } 7811 const icon = siteIconUrl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 7812 className: "edit-site-site-icon__image", 7813 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 7814 src: siteIconUrl 7815 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 7816 className: "edit-site-site-icon__icon", 7817 icon: library_wordpress, 7818 size: 48 7819 }); 7820 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7821 className: dist_clsx(className, 'edit-site-site-icon'), 7822 children: icon 7823 }); 7824 } 7825 /* harmony default export */ const site_icon = (SiteIcon); 7826 7827 ;// external ["wp","dom"] 7828 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 7829 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js 7830 /* wp:polyfill */ 7831 /** 7832 * External dependencies 7833 */ 7834 7835 7836 /** 7837 * WordPress dependencies 7838 */ 7839 7840 7841 7842 const SidebarNavigationContext = (0,external_wp_element_namespaceObject.createContext)(() => {}); 7843 // Focus a sidebar element after a navigation. The element to focus is either 7844 // specified by `focusSelector` (when navigating back) or it is the first 7845 // tabbable element (usually the "Back" button). 7846 function focusSidebarElement(el, direction, focusSelector) { 7847 let elementToFocus; 7848 if (direction === 'back' && focusSelector) { 7849 elementToFocus = el.querySelector(focusSelector); 7850 } 7851 if (direction !== null && !elementToFocus) { 7852 const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el); 7853 elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : el; 7854 } 7855 elementToFocus?.focus(); 7856 } 7857 7858 // Navigation state that is updated when navigating back or forward. Helps us 7859 // manage the animations and also focus. 7860 function createNavState() { 7861 let state = { 7862 direction: null, 7863 focusSelector: null 7864 }; 7865 return { 7866 get() { 7867 return state; 7868 }, 7869 navigate(direction, focusSelector = null) { 7870 state = { 7871 direction, 7872 focusSelector: direction === 'forward' && focusSelector ? focusSelector : state.focusSelector 7873 }; 7874 } 7875 }; 7876 } 7877 function SidebarContentWrapper({ 7878 children, 7879 shouldAnimate 7880 }) { 7881 const navState = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 7882 const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(); 7883 const [navAnimation, setNavAnimation] = (0,external_wp_element_namespaceObject.useState)(null); 7884 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 7885 const { 7886 direction, 7887 focusSelector 7888 } = navState.get(); 7889 focusSidebarElement(wrapperRef.current, direction, focusSelector); 7890 setNavAnimation(direction); 7891 }, [navState]); 7892 const wrapperCls = dist_clsx('edit-site-sidebar__screen-wrapper', 7893 /* 7894 * Some panes do not have sub-panes and therefore 7895 * should not animate when clicked on. 7896 */ 7897 shouldAnimate ? { 7898 'slide-from-left': navAnimation === 'back', 7899 'slide-from-right': navAnimation === 'forward' 7900 } : {}); 7901 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7902 ref: wrapperRef, 7903 className: wrapperCls, 7904 children: children 7905 }); 7906 } 7907 function SidebarContent({ 7908 routeKey, 7909 shouldAnimate, 7910 children 7911 }) { 7912 const [navState] = (0,external_wp_element_namespaceObject.useState)(createNavState); 7913 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { 7914 value: navState, 7915 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7916 className: "edit-site-sidebar__content", 7917 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContentWrapper, { 7918 shouldAnimate: shouldAnimate, 7919 children: children 7920 }, routeKey) 7921 }) 7922 }); 7923 } 7924 7925 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js 7926 /** 7927 * External dependencies 7928 */ 7929 7930 7931 /** 7932 * WordPress dependencies 7933 */ 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 /** 7947 * Internal dependencies 7948 */ 7949 7950 7951 7952 const { 7953 useHistory 7954 } = unlock(external_wp_router_namespaceObject.privateApis); 7955 7956 7957 const SiteHub = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ 7958 isTransparent 7959 }, ref) => { 7960 const { 7961 dashboardLink, 7962 homeUrl, 7963 siteTitle 7964 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7965 const { 7966 getSettings 7967 } = unlock(select(store)); 7968 const { 7969 getEntityRecord 7970 } = select(external_wp_coreData_namespaceObject.store); 7971 const _site = getEntityRecord('root', 'site'); 7972 return { 7973 dashboardLink: getSettings().__experimentalDashboardLink, 7974 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 7975 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title 7976 }; 7977 }, []); 7978 const { 7979 open: openCommandCenter 7980 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 7981 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7982 className: "edit-site-site-hub", 7983 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7984 justify: "flex-start", 7985 spacing: "0", 7986 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7987 className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 7988 'has-transparent-background': isTransparent 7989 }), 7990 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7991 __next40pxDefaultSize: true, 7992 ref: ref, 7993 href: dashboardLink, 7994 label: (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 7995 className: "edit-site-layout__view-mode-toggle", 7996 style: { 7997 transform: 'scale(0.5333) translateX(-4px)', 7998 // Offset to position the icon 12px from viewport edge 7999 borderRadius: 4 8000 }, 8001 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 8002 className: "edit-site-layout__view-mode-toggle-icon" 8003 }) 8004 }) 8005 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8006 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8007 className: "edit-site-site-hub__title", 8008 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 8009 __next40pxDefaultSize: true, 8010 variant: "link", 8011 href: homeUrl, 8012 target: "_blank", 8013 children: [(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 8014 as: "span", 8015 children: /* translators: accessibility text */ 8016 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 8017 })] 8018 }) 8019 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8020 spacing: 0, 8021 expanded: false, 8022 className: "edit-site-site-hub__actions", 8023 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8024 size: "compact", 8025 className: "edit-site-site-hub_toggle-command-center", 8026 icon: library_search, 8027 onClick: () => openCommandCenter(), 8028 label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), 8029 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 8030 }) 8031 })] 8032 })] 8033 }) 8034 }); 8035 })); 8036 /* harmony default export */ const site_hub = (SiteHub); 8037 const SiteHubMobile = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ 8038 isTransparent 8039 }, ref) => { 8040 const history = useHistory(); 8041 const { 8042 navigate 8043 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 8044 const { 8045 dashboardLink, 8046 isBlockTheme, 8047 homeUrl, 8048 siteTitle 8049 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8050 const { 8051 getSettings 8052 } = unlock(select(store)); 8053 const { 8054 getEntityRecord, 8055 getCurrentTheme 8056 } = select(external_wp_coreData_namespaceObject.store); 8057 const _site = getEntityRecord('root', 'site'); 8058 return { 8059 dashboardLink: getSettings().__experimentalDashboardLink, 8060 isBlockTheme: getCurrentTheme()?.is_block_theme, 8061 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 8062 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title 8063 }; 8064 }, []); 8065 const { 8066 open: openCommandCenter 8067 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 8068 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8069 className: "edit-site-site-hub", 8070 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8071 justify: "flex-start", 8072 spacing: "0", 8073 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8074 className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 8075 'has-transparent-background': isTransparent 8076 }), 8077 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8078 __next40pxDefaultSize: true, 8079 ref: ref, 8080 className: "edit-site-layout__view-mode-toggle", 8081 style: { 8082 transform: 'scale(0.5)', 8083 borderRadius: 4 8084 }, 8085 ...(!isBlockTheme ? { 8086 href: dashboardLink, 8087 label: (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard') 8088 } : { 8089 onClick: () => { 8090 history.navigate('/'); 8091 navigate('back'); 8092 }, 8093 label: (0,external_wp_i18n_namespaceObject.__)('Go to Site Editor') 8094 }), 8095 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 8096 className: "edit-site-layout__view-mode-toggle-icon" 8097 }) 8098 }) 8099 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8100 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8101 className: "edit-site-site-hub__title", 8102 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8103 __next40pxDefaultSize: true, 8104 variant: "link", 8105 href: homeUrl, 8106 target: "_blank", 8107 label: (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'), 8108 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) 8109 }) 8110 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8111 spacing: 0, 8112 expanded: false, 8113 className: "edit-site-site-hub__actions", 8114 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8115 __next40pxDefaultSize: true, 8116 className: "edit-site-site-hub_toggle-command-center", 8117 icon: library_search, 8118 onClick: () => openCommandCenter(), 8119 label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), 8120 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 8121 }) 8122 })] 8123 })] 8124 }) 8125 }); 8126 })); 8127 8128 ;// ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js 8129 /** 8130 * External dependencies 8131 */ 8132 8133 8134 /** 8135 * WordPress dependencies 8136 */ 8137 8138 8139 8140 8141 8142 8143 8144 8145 /** 8146 * Internal dependencies 8147 */ 8148 8149 8150 8151 const { 8152 useLocation, 8153 useHistory: resizable_frame_useHistory 8154 } = unlock(external_wp_router_namespaceObject.privateApis); 8155 8156 // Removes the inline styles in the drag handles. 8157 const HANDLE_STYLES_OVERRIDE = { 8158 position: undefined, 8159 userSelect: undefined, 8160 cursor: undefined, 8161 width: undefined, 8162 height: undefined, 8163 top: undefined, 8164 right: undefined, 8165 bottom: undefined, 8166 left: undefined 8167 }; 8168 8169 // The minimum width of the frame (in px) while resizing. 8170 const FRAME_MIN_WIDTH = 320; 8171 // The reference width of the frame (in px) used to calculate the aspect ratio. 8172 const FRAME_REFERENCE_WIDTH = 1300; 8173 // 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing. 8174 const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; 8175 // The minimum distance (in px) between the frame resize handle and the 8176 // viewport's edge. If the frame is resized to be closer to the viewport's edge 8177 // than this distance, then "canvas mode" will be enabled. 8178 const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; 8179 // Default size for the `frameSize` state. 8180 const INITIAL_FRAME_SIZE = { 8181 width: '100%', 8182 height: '100%' 8183 }; 8184 function calculateNewHeight(width, initialAspectRatio) { 8185 const lerp = (a, b, amount) => { 8186 return a + (b - a) * amount; 8187 }; 8188 8189 // Calculate the intermediate aspect ratio based on the current width. 8190 const lerpFactor = 1 - Math.max(0, Math.min(1, (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH))); 8191 8192 // Calculate the height based on the intermediate aspect ratio 8193 // ensuring the frame arrives at the target aspect ratio. 8194 const intermediateAspectRatio = lerp(initialAspectRatio, FRAME_TARGET_ASPECT_RATIO, lerpFactor); 8195 return width / intermediateAspectRatio; 8196 } 8197 function ResizableFrame({ 8198 isFullWidth, 8199 isOversized, 8200 setIsOversized, 8201 isReady, 8202 children, 8203 /** The default (unresized) width/height of the frame, based on the space available in the viewport. */ 8204 defaultSize, 8205 innerContentStyle 8206 }) { 8207 const history = resizable_frame_useHistory(); 8208 const { 8209 path, 8210 query 8211 } = useLocation(); 8212 const { 8213 canvas = 'view' 8214 } = query; 8215 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 8216 const [frameSize, setFrameSize] = (0,external_wp_element_namespaceObject.useState)(INITIAL_FRAME_SIZE); 8217 // The width of the resizable frame when a new resize gesture starts. 8218 const [startingWidth, setStartingWidth] = (0,external_wp_element_namespaceObject.useState)(); 8219 const [isResizing, setIsResizing] = (0,external_wp_element_namespaceObject.useState)(false); 8220 const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_namespaceObject.useState)(false); 8221 const [resizeRatio, setResizeRatio] = (0,external_wp_element_namespaceObject.useState)(1); 8222 const FRAME_TRANSITION = { 8223 type: 'tween', 8224 duration: isResizing ? 0 : 0.5 8225 }; 8226 const frameRef = (0,external_wp_element_namespaceObject.useRef)(null); 8227 const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResizableFrame, 'edit-site-resizable-frame-handle-help'); 8228 const defaultAspectRatio = defaultSize.width / defaultSize.height; 8229 const isBlockTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 8230 const { 8231 getCurrentTheme 8232 } = select(external_wp_coreData_namespaceObject.store); 8233 return getCurrentTheme()?.is_block_theme; 8234 }, []); 8235 const handleResizeStart = (_event, _direction, ref) => { 8236 // Remember the starting width so we don't have to get `ref.offsetWidth` on 8237 // every resize event thereafter, which will cause layout thrashing. 8238 setStartingWidth(ref.offsetWidth); 8239 setIsResizing(true); 8240 }; 8241 8242 // Calculate the frame size based on the window width as its resized. 8243 const handleResize = (_event, _direction, _ref, delta) => { 8244 const normalizedDelta = delta.width / resizeRatio; 8245 const deltaAbs = Math.abs(normalizedDelta); 8246 const maxDoubledDelta = delta.width < 0 // is shrinking 8247 ? deltaAbs : (defaultSize.width - startingWidth) / 2; 8248 const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta); 8249 const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs; 8250 const singleSegment = 1 - doubleSegment; 8251 setResizeRatio(singleSegment + doubleSegment * 2); 8252 const updatedWidth = startingWidth + delta.width; 8253 setIsOversized(updatedWidth > defaultSize.width); 8254 8255 // Width will be controlled by the library (via `resizeRatio`), 8256 // so we only need to update the height. 8257 setFrameSize({ 8258 height: isOversized ? '100%' : calculateNewHeight(updatedWidth, defaultAspectRatio) 8259 }); 8260 }; 8261 const handleResizeStop = (_event, _direction, ref) => { 8262 setIsResizing(false); 8263 if (!isOversized) { 8264 return; 8265 } 8266 setIsOversized(false); 8267 const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth; 8268 if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) { 8269 // Reset the initial aspect ratio if the frame is resized slightly 8270 // above the sidebar but not far enough to trigger full screen. 8271 setFrameSize(INITIAL_FRAME_SIZE); 8272 } else { 8273 // Trigger full screen if the frame is resized far enough to the left. 8274 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 8275 canvas: 'edit' 8276 }), { 8277 transition: 'canvas-mode-edit-transition' 8278 }); 8279 } 8280 }; 8281 8282 // Handle resize by arrow keys 8283 const handleResizableHandleKeyDown = event => { 8284 if (!['ArrowLeft', 'ArrowRight'].includes(event.key)) { 8285 return; 8286 } 8287 event.preventDefault(); 8288 const step = 20 * (event.shiftKey ? 5 : 1); 8289 const delta = step * (event.key === 'ArrowLeft' ? 1 : -1) * ((0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1); 8290 const newWidth = Math.min(Math.max(FRAME_MIN_WIDTH, frameRef.current.resizable.offsetWidth + delta), defaultSize.width); 8291 setFrameSize({ 8292 width: newWidth, 8293 height: calculateNewHeight(newWidth, defaultAspectRatio) 8294 }); 8295 }; 8296 const frameAnimationVariants = { 8297 default: { 8298 flexGrow: 0, 8299 height: frameSize.height 8300 }, 8301 fullWidth: { 8302 flexGrow: 1, 8303 height: frameSize.height 8304 } 8305 }; 8306 const resizeHandleVariants = { 8307 hidden: { 8308 opacity: 0, 8309 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8310 right: 0 8311 } : { 8312 left: 0 8313 }) 8314 }, 8315 visible: { 8316 opacity: 1, 8317 // Account for the handle's width. 8318 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8319 right: -14 8320 } : { 8321 left: -14 8322 }) 8323 }, 8324 active: { 8325 opacity: 1, 8326 // Account for the handle's width. 8327 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8328 right: -14 8329 } : { 8330 left: -14 8331 }), 8332 scaleY: 1.3 8333 } 8334 }; 8335 const currentResizeHandleVariant = (() => { 8336 if (isResizing) { 8337 return 'active'; 8338 } 8339 return shouldShowHandle ? 'visible' : 'hidden'; 8340 })(); 8341 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { 8342 as: external_wp_components_namespaceObject.__unstableMotion.div, 8343 ref: frameRef, 8344 initial: false, 8345 variants: frameAnimationVariants, 8346 animate: isFullWidth ? 'fullWidth' : 'default', 8347 onAnimationComplete: definition => { 8348 if (definition === 'fullWidth') { 8349 setFrameSize({ 8350 width: '100%', 8351 height: '100%' 8352 }); 8353 } 8354 }, 8355 whileHover: canvas === 'view' ? { 8356 scale: 1.005, 8357 transition: { 8358 duration: disableMotion ? 0 : 0.5, 8359 ease: 'easeOut' 8360 } 8361 } : {}, 8362 transition: FRAME_TRANSITION, 8363 size: frameSize, 8364 enable: { 8365 top: false, 8366 bottom: false, 8367 // Resizing will be disabled until the editor content is loaded. 8368 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8369 right: isReady, 8370 left: false 8371 } : { 8372 left: isReady, 8373 right: false 8374 }), 8375 topRight: false, 8376 bottomRight: false, 8377 bottomLeft: false, 8378 topLeft: false 8379 }, 8380 resizeRatio: resizeRatio, 8381 handleClasses: undefined, 8382 handleStyles: { 8383 left: HANDLE_STYLES_OVERRIDE, 8384 right: HANDLE_STYLES_OVERRIDE 8385 }, 8386 minWidth: FRAME_MIN_WIDTH, 8387 maxWidth: isFullWidth ? '100%' : '150%', 8388 maxHeight: "100%", 8389 onFocus: () => setShouldShowHandle(true), 8390 onBlur: () => setShouldShowHandle(false), 8391 onMouseOver: () => setShouldShowHandle(true), 8392 onMouseOut: () => setShouldShowHandle(false), 8393 handleComponent: { 8394 [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8395 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 8396 text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 8397 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, { 8398 role: "separator", 8399 "aria-orientation": "vertical", 8400 className: dist_clsx('edit-site-resizable-frame__handle', { 8401 'is-resizing': isResizing 8402 }), 8403 variants: resizeHandleVariants, 8404 animate: currentResizeHandleVariant, 8405 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 8406 "aria-describedby": resizableHandleHelpId, 8407 "aria-valuenow": frameRef.current?.resizable?.offsetWidth || undefined, 8408 "aria-valuemin": FRAME_MIN_WIDTH, 8409 "aria-valuemax": defaultSize.width, 8410 onKeyDown: handleResizableHandleKeyDown, 8411 initial: "hidden", 8412 exit: "hidden", 8413 whileFocus: "active", 8414 whileHover: "active" 8415 }, "handle") 8416 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8417 hidden: true, 8418 id: resizableHandleHelpId, 8419 children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.') 8420 })] 8421 }) 8422 }, 8423 onResizeStart: handleResizeStart, 8424 onResize: handleResize, 8425 onResizeStop: handleResizeStop, 8426 className: dist_clsx('edit-site-resizable-frame__inner', { 8427 'is-resizing': isResizing 8428 }), 8429 showHandle: false // Do not show the default handle, as we're using a custom one. 8430 , 8431 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8432 className: "edit-site-resizable-frame__inner-content", 8433 style: innerContentStyle, 8434 children: children 8435 }) 8436 }); 8437 } 8438 /* harmony default export */ const resizable_frame = (ResizableFrame); 8439 8440 ;// external ["wp","keyboardShortcuts"] 8441 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 8442 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-keyboard-shortcut/index.js 8443 /* wp:polyfill */ 8444 /** 8445 * WordPress dependencies 8446 */ 8447 8448 8449 8450 8451 8452 8453 8454 /** 8455 * Internal dependencies 8456 */ 8457 8458 const shortcutName = 'core/edit-site/save'; 8459 8460 /** 8461 * Register the save keyboard shortcut in view mode. 8462 * 8463 * @return {null} Returns null. 8464 */ 8465 function SaveKeyboardShortcut() { 8466 const { 8467 __experimentalGetDirtyEntityRecords, 8468 isSavingEntityRecord 8469 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 8470 const { 8471 hasNonPostEntityChanges, 8472 isPostSavingLocked 8473 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); 8474 const { 8475 savePost 8476 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 8477 const { 8478 setIsSaveViewOpened 8479 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 8480 const { 8481 registerShortcut, 8482 unregisterShortcut 8483 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 8484 (0,external_wp_element_namespaceObject.useEffect)(() => { 8485 registerShortcut({ 8486 name: shortcutName, 8487 category: 'global', 8488 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 8489 keyCombination: { 8490 modifier: 'primary', 8491 character: 's' 8492 } 8493 }); 8494 return () => { 8495 unregisterShortcut(shortcutName); 8496 }; 8497 }, [registerShortcut, unregisterShortcut]); 8498 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => { 8499 event.preventDefault(); 8500 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8501 const hasDirtyEntities = !!dirtyEntityRecords.length; 8502 const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); 8503 if (!hasDirtyEntities || isSaving) { 8504 return; 8505 } 8506 if (hasNonPostEntityChanges()) { 8507 setIsSaveViewOpened(true); 8508 } else if (!isPostSavingLocked()) { 8509 savePost(); 8510 } 8511 }); 8512 return null; 8513 } 8514 8515 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js 8516 /** 8517 * WordPress dependencies 8518 */ 8519 8520 8521 8522 const MAX_LOADING_TIME = 10000; // 10 seconds 8523 8524 function useIsSiteEditorLoading() { 8525 const [loaded, setLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 8526 const inLoadingPause = (0,external_wp_data_namespaceObject.useSelect)(select => { 8527 const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors(); 8528 return !loaded && !hasResolvingSelectors; 8529 }, [loaded]); 8530 8531 /* 8532 * If the maximum expected loading time has passed, we're marking the 8533 * editor as loaded, in order to prevent any failed requests from blocking 8534 * the editor canvas from appearing. 8535 */ 8536 (0,external_wp_element_namespaceObject.useEffect)(() => { 8537 let timeout; 8538 if (!loaded) { 8539 timeout = setTimeout(() => { 8540 setLoaded(true); 8541 }, MAX_LOADING_TIME); 8542 } 8543 return () => { 8544 clearTimeout(timeout); 8545 }; 8546 }, [loaded]); 8547 (0,external_wp_element_namespaceObject.useEffect)(() => { 8548 if (inLoadingPause) { 8549 /* 8550 * We're using an arbitrary 100ms timeout here to catch brief 8551 * moments without any resolving selectors that would result in 8552 * displaying brief flickers of loading state and loaded state. 8553 * 8554 * It's worth experimenting with different values, since this also 8555 * adds 100ms of artificial delay after loading has finished. 8556 */ 8557 const ARTIFICIAL_DELAY = 100; 8558 const timeout = setTimeout(() => { 8559 setLoaded(true); 8560 }, ARTIFICIAL_DELAY); 8561 return () => { 8562 clearTimeout(timeout); 8563 }; 8564 } 8565 }, [inLoadingPause]); 8566 return !loaded; 8567 } 8568 8569 ;// ./node_modules/@react-spring/rafz/dist/esm/index.js 8570 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}}; 8571 8572 // EXTERNAL MODULE: external "React" 8573 var external_React_ = __webpack_require__(1609); 8574 var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2); 8575 ;// ./node_modules/@react-spring/shared/dist/esm/index.js 8576 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}; 8577 8578 ;// ./node_modules/@react-spring/animated/dist/esm/index.js 8579 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; 8580 8581 ;// ./node_modules/@react-spring/core/dist/esm/index.js 8582 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(_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 _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; 8583 8584 ;// external "ReactDOM" 8585 const external_ReactDOM_namespaceObject = window["ReactDOM"]; 8586 ;// ./node_modules/@react-spring/web/dist/esm/index.js 8587 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; 8588 8589 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js 8590 /** 8591 * External dependencies 8592 */ 8593 8594 8595 /** 8596 * WordPress dependencies 8597 */ 8598 8599 function getAbsolutePosition(element) { 8600 return { 8601 top: element.offsetTop, 8602 left: element.offsetLeft 8603 }; 8604 } 8605 const ANIMATION_DURATION = 400; 8606 8607 /** 8608 * Hook used to compute the styles required to move a div into a new position. 8609 * 8610 * The way this animation works is the following: 8611 * - It first renders the element as if there was no animation. 8612 * - It takes a snapshot of the position of the block to use it 8613 * as a destination point for the animation. 8614 * - It restores the element to the previous position using a CSS transform 8615 * - It uses the "resetAnimation" flag to reset the animation 8616 * from the beginning in order to animate to the new destination point. 8617 * 8618 * @param {Object} $1 Options 8619 * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes. 8620 */ 8621 function useMovingAnimation({ 8622 triggerAnimationOnChange 8623 }) { 8624 const ref = (0,external_wp_element_namespaceObject.useRef)(); 8625 8626 // Whenever the trigger changes, we need to take a snapshot of the current 8627 // position of the block to use it as a destination point for the animation. 8628 const { 8629 previous, 8630 prevRect 8631 } = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 8632 previous: ref.current && getAbsolutePosition(ref.current), 8633 prevRect: ref.current && ref.current.getBoundingClientRect() 8634 }), [triggerAnimationOnChange]); 8635 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 8636 if (!previous || !ref.current) { 8637 return; 8638 } 8639 8640 // We disable the animation if the user has a preference for reduced 8641 // motion. 8642 const disableAnimation = window.matchMedia('(prefers-reduced-motion: reduce)').matches; 8643 if (disableAnimation) { 8644 return; 8645 } 8646 const controller = new esm_le({ 8647 x: 0, 8648 y: 0, 8649 width: prevRect.width, 8650 height: prevRect.height, 8651 config: { 8652 duration: ANIMATION_DURATION, 8653 easing: Lt.easeInOutQuint 8654 }, 8655 onChange({ 8656 value 8657 }) { 8658 if (!ref.current) { 8659 return; 8660 } 8661 let { 8662 x, 8663 y, 8664 width, 8665 height 8666 } = value; 8667 x = Math.round(x); 8668 y = Math.round(y); 8669 width = Math.round(width); 8670 height = Math.round(height); 8671 const finishedMoving = x === 0 && y === 0; 8672 ref.current.style.transformOrigin = 'center center'; 8673 ref.current.style.transform = finishedMoving ? null // Set to `null` to explicitly remove the transform. 8674 : `translate3d($x}px,$y}px,0)`; 8675 ref.current.style.width = finishedMoving ? null : `$width}px`; 8676 ref.current.style.height = finishedMoving ? null : `$height}px`; 8677 } 8678 }); 8679 ref.current.style.transform = undefined; 8680 const destination = ref.current.getBoundingClientRect(); 8681 const x = Math.round(prevRect.left - destination.left); 8682 const y = Math.round(prevRect.top - destination.top); 8683 const width = destination.width; 8684 const height = destination.height; 8685 controller.start({ 8686 x: 0, 8687 y: 0, 8688 width, 8689 height, 8690 from: { 8691 x, 8692 y, 8693 width: prevRect.width, 8694 height: prevRect.height 8695 } 8696 }); 8697 return () => { 8698 controller.stop(); 8699 controller.set({ 8700 x: 0, 8701 y: 0, 8702 width: prevRect.width, 8703 height: prevRect.height 8704 }); 8705 }; 8706 }, [previous, prevRect]); 8707 return ref; 8708 } 8709 /* harmony default export */ const animation = (useMovingAnimation); 8710 8711 ;// ./node_modules/@wordpress/icons/build-module/library/check.js 8712 /** 8713 * WordPress dependencies 8714 */ 8715 8716 8717 const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8718 xmlns: "http://www.w3.org/2000/svg", 8719 viewBox: "0 0 24 24", 8720 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8721 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 8722 }) 8723 }); 8724 /* harmony default export */ const library_check = (check); 8725 8726 ;// ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js 8727 /** 8728 * WordPress dependencies 8729 */ 8730 8731 function isPreviewingTheme() { 8732 return !!(0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview'); 8733 } 8734 function currentlyPreviewingTheme() { 8735 if (isPreviewingTheme()) { 8736 return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview'); 8737 } 8738 return null; 8739 } 8740 8741 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js 8742 /* wp:polyfill */ 8743 /** 8744 * WordPress dependencies 8745 */ 8746 8747 8748 8749 8750 8751 8752 8753 8754 /** 8755 * Internal dependencies 8756 */ 8757 8758 8759 8760 8761 const { 8762 useLocation: save_button_useLocation 8763 } = unlock(external_wp_router_namespaceObject.privateApis); 8764 function SaveButton({ 8765 className = 'edit-site-save-button__button', 8766 variant = 'primary', 8767 showTooltip = true, 8768 showReviewMessage, 8769 icon, 8770 size, 8771 __next40pxDefaultSize = false 8772 }) { 8773 const { 8774 params 8775 } = save_button_useLocation(); 8776 const { 8777 setIsSaveViewOpened 8778 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 8779 const { 8780 saveDirtyEntities 8781 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store)); 8782 const { 8783 dirtyEntityRecords 8784 } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 8785 const { 8786 isSaving, 8787 isSaveViewOpen, 8788 previewingThemeName 8789 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8790 const { 8791 isSavingEntityRecord, 8792 isResolving 8793 } = select(external_wp_coreData_namespaceObject.store); 8794 const { 8795 isSaveViewOpened 8796 } = select(store); 8797 const isActivatingTheme = isResolving('activateTheme'); 8798 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 8799 return { 8800 isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme, 8801 isSaveViewOpen: isSaveViewOpened(), 8802 // Do not call `getTheme` with null, it will cause a request to 8803 // the server. 8804 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined 8805 }; 8806 }, [dirtyEntityRecords]); 8807 const hasDirtyEntities = !!dirtyEntityRecords.length; 8808 let isOnlyCurrentEntityDirty; 8809 // Check if the current entity is the only entity with changes. 8810 // We have some extra logic for `wp_global_styles` for now, that 8811 // is used in navigation sidebar. 8812 if (dirtyEntityRecords.length === 1) { 8813 if (params.postId) { 8814 isOnlyCurrentEntityDirty = `$dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType; 8815 } else if (params.path?.includes('wp_global_styles')) { 8816 isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === 'globalStyles'; 8817 } 8818 } 8819 const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme(); 8820 const getLabel = () => { 8821 if (isPreviewingTheme()) { 8822 if (isSaving) { 8823 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ 8824 (0,external_wp_i18n_namespaceObject.__)('Activating %s'), previewingThemeName); 8825 } else if (disabled) { 8826 return (0,external_wp_i18n_namespaceObject.__)('Saved'); 8827 } else if (hasDirtyEntities) { 8828 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ 8829 (0,external_wp_i18n_namespaceObject.__)('Activate %s & Save'), previewingThemeName); 8830 } 8831 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ 8832 (0,external_wp_i18n_namespaceObject.__)('Activate %s'), previewingThemeName); 8833 } 8834 if (isSaving) { 8835 return (0,external_wp_i18n_namespaceObject.__)('Saving'); 8836 } 8837 if (disabled) { 8838 return (0,external_wp_i18n_namespaceObject.__)('Saved'); 8839 } 8840 if (!isOnlyCurrentEntityDirty && showReviewMessage) { 8841 return (0,external_wp_i18n_namespaceObject.sprintf)( 8842 // translators: %d: number of unsaved changes (number). 8843 (0,external_wp_i18n_namespaceObject._n)('Review %d change…', 'Review %d changes…', dirtyEntityRecords.length), dirtyEntityRecords.length); 8844 } 8845 return (0,external_wp_i18n_namespaceObject.__)('Save'); 8846 }; 8847 const label = getLabel(); 8848 const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ 8849 dirtyEntityRecords 8850 }) : () => setIsSaveViewOpened(true); 8851 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8852 variant: variant, 8853 className: className, 8854 "aria-disabled": disabled, 8855 "aria-expanded": isSaveViewOpen, 8856 isBusy: isSaving, 8857 onClick: disabled ? undefined : onClick, 8858 label: label 8859 /* 8860 * We want the tooltip to show the keyboard shortcut only when the 8861 * button does something, i.e. when it's not disabled. 8862 */, 8863 shortcut: disabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s') 8864 /* 8865 * Displaying the keyboard shortcut conditionally makes the tooltip 8866 * itself show conditionally. This would trigger a full-rerendering 8867 * of the button that we want to avoid. By setting `showTooltip`, 8868 * the tooltip is always rendered even when there's no keyboard shortcut. 8869 */, 8870 showTooltip: showTooltip, 8871 icon: icon, 8872 __next40pxDefaultSize: __next40pxDefaultSize, 8873 size: size, 8874 children: label 8875 }); 8876 } 8877 8878 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js 8879 /* wp:polyfill */ 8880 /** 8881 * WordPress dependencies 8882 */ 8883 8884 8885 8886 8887 8888 /** 8889 * Internal dependencies 8890 */ 8891 8892 8893 8894 function SaveHub() { 8895 const { 8896 isDisabled, 8897 isSaving 8898 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8899 const { 8900 __experimentalGetDirtyEntityRecords, 8901 isSavingEntityRecord 8902 } = select(external_wp_coreData_namespaceObject.store); 8903 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8904 const _isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); 8905 return { 8906 isSaving: _isSaving, 8907 isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme() 8908 }; 8909 }, []); 8910 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8911 className: "edit-site-save-hub", 8912 alignment: "right", 8913 spacing: 4, 8914 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { 8915 className: "edit-site-save-hub__button", 8916 variant: isDisabled ? null : 'primary', 8917 showTooltip: false, 8918 icon: isDisabled && !isSaving ? library_check : null, 8919 showReviewMessage: true, 8920 __next40pxDefaultSize: true 8921 }) 8922 }); 8923 } 8924 8925 ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js 8926 /** 8927 * WordPress dependencies 8928 */ 8929 8930 8931 8932 8933 8934 /** 8935 * Internal dependencies 8936 */ 8937 8938 8939 const { 8940 useHistory: use_activate_theme_useHistory, 8941 useLocation: use_activate_theme_useLocation 8942 } = unlock(external_wp_router_namespaceObject.privateApis); 8943 8944 /** 8945 * This should be refactored to use the REST API, once the REST API can activate themes. 8946 * 8947 * @return {Function} A function that activates the theme. 8948 */ 8949 function useActivateTheme() { 8950 const history = use_activate_theme_useHistory(); 8951 const { 8952 path 8953 } = use_activate_theme_useLocation(); 8954 const { 8955 startResolution, 8956 finishResolution 8957 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 8958 return async () => { 8959 if (isPreviewingTheme()) { 8960 const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE; 8961 startResolution('activateTheme'); 8962 await window.fetch(activationURL); 8963 finishResolution('activateTheme'); 8964 // Remove the wp_theme_preview query param: we've finished activating 8965 // the queue and are switching to normal Site Editor. 8966 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 8967 wp_theme_preview: '' 8968 })); 8969 } 8970 }; 8971 } 8972 8973 ;// external ["wp","apiFetch"] 8974 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 8975 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 8976 ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js 8977 /** 8978 * WordPress dependencies 8979 */ 8980 8981 8982 8983 const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active'; 8984 function useActualCurrentTheme() { 8985 const [currentTheme, setCurrentTheme] = (0,external_wp_element_namespaceObject.useState)(); 8986 (0,external_wp_element_namespaceObject.useEffect)(() => { 8987 // Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware. 8988 const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, { 8989 context: 'edit', 8990 wp_theme_preview: '' 8991 }); 8992 external_wp_apiFetch_default()({ 8993 path 8994 }).then(activeThemes => setCurrentTheme(activeThemes[0])) 8995 // Do nothing 8996 .catch(() => {}); 8997 }, []); 8998 return currentTheme; 8999 } 9000 9001 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js 9002 /* wp:polyfill */ 9003 /** 9004 * External dependencies 9005 */ 9006 9007 9008 /** 9009 * WordPress dependencies 9010 */ 9011 9012 9013 9014 9015 9016 9017 9018 9019 /** 9020 * Internal dependencies 9021 */ 9022 9023 9024 9025 9026 9027 9028 const { 9029 EntitiesSavedStatesExtensible, 9030 NavigableRegion 9031 } = unlock(external_wp_editor_namespaceObject.privateApis); 9032 const { 9033 useLocation: save_panel_useLocation 9034 } = unlock(external_wp_router_namespaceObject.privateApis); 9035 const EntitiesSavedStatesForPreview = ({ 9036 onClose, 9037 renderDialog 9038 }) => { 9039 var _currentTheme$name$re, _previewingTheme$name; 9040 const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 9041 let activateSaveLabel; 9042 if (isDirtyProps.isDirty) { 9043 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate & Save'); 9044 } else { 9045 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate'); 9046 } 9047 const currentTheme = useActualCurrentTheme(); 9048 const previewingTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), []); 9049 const additionalPrompt = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 9050 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: The name of active theme, 2: The name of theme to be activated. */ 9051 (0,external_wp_i18n_namespaceObject.__)('Saving your changes will change your active theme from %1$s to %2$s.'), (_currentTheme$name$re = currentTheme?.name?.rendered) !== null && _currentTheme$name$re !== void 0 ? _currentTheme$name$re : '...', (_previewingTheme$name = previewingTheme?.name?.rendered) !== null && _previewingTheme$name !== void 0 ? _previewingTheme$name : '...') 9052 }); 9053 const activateTheme = useActivateTheme(); 9054 const onSave = async values => { 9055 await activateTheme(); 9056 return values; 9057 }; 9058 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, { 9059 ...isDirtyProps, 9060 additionalPrompt, 9061 close: onClose, 9062 onSave, 9063 saveEnabled: true, 9064 saveLabel: activateSaveLabel, 9065 renderDialog 9066 }); 9067 }; 9068 const _EntitiesSavedStates = ({ 9069 onClose, 9070 renderDialog 9071 }) => { 9072 if (isPreviewingTheme()) { 9073 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesForPreview, { 9074 onClose: onClose, 9075 renderDialog: renderDialog 9076 }); 9077 } 9078 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EntitiesSavedStates, { 9079 close: onClose, 9080 renderDialog: renderDialog 9081 }); 9082 }; 9083 function SavePanel() { 9084 const { 9085 query 9086 } = save_panel_useLocation(); 9087 const { 9088 canvas = 'view' 9089 } = query; 9090 const { 9091 isSaveViewOpen, 9092 isDirty, 9093 isSaving 9094 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9095 const { 9096 __experimentalGetDirtyEntityRecords, 9097 isSavingEntityRecord, 9098 isResolving 9099 } = select(external_wp_coreData_namespaceObject.store); 9100 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 9101 const isActivatingTheme = isResolving('activateTheme'); 9102 const { 9103 isSaveViewOpened 9104 } = unlock(select(store)); 9105 9106 // The currently selected entity to display. 9107 // Typically template or template part in the site editor. 9108 return { 9109 isSaveViewOpen: isSaveViewOpened(), 9110 isDirty: dirtyEntityRecords.length > 0, 9111 isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme 9112 }; 9113 }, []); 9114 const { 9115 setIsSaveViewOpened 9116 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9117 const onClose = () => setIsSaveViewOpened(false); 9118 (0,external_wp_element_namespaceObject.useEffect)(() => { 9119 setIsSaveViewOpened(false); 9120 }, [canvas, setIsSaveViewOpened]); 9121 if (canvas === 'view') { 9122 return isSaveViewOpen ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 9123 className: "edit-site-save-panel__modal", 9124 onRequestClose: onClose, 9125 __experimentalHideHeader: true, 9126 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Save site, content, and template changes'), 9127 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { 9128 onClose: onClose 9129 }) 9130 }) : null; 9131 } 9132 const activateSaveEnabled = isPreviewingTheme() || isDirty; 9133 const disabled = isSaving || !activateSaveEnabled; 9134 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(NavigableRegion, { 9135 className: dist_clsx('edit-site-layout__actions', { 9136 'is-entity-save-view-open': isSaveViewOpen 9137 }), 9138 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Save panel'), 9139 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9140 className: dist_clsx('edit-site-editor__toggle-save-panel', { 9141 'screen-reader-text': isSaveViewOpen 9142 }), 9143 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9144 __next40pxDefaultSize: true, 9145 variant: "secondary", 9146 className: "edit-site-editor__toggle-save-panel-button", 9147 onClick: () => setIsSaveViewOpened(true), 9148 "aria-haspopup": "dialog", 9149 disabled: disabled, 9150 accessibleWhenDisabled: true, 9151 children: (0,external_wp_i18n_namespaceObject.__)('Open save panel') 9152 }) 9153 }), isSaveViewOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { 9154 onClose: onClose, 9155 renderDialog: true 9156 })] 9157 }); 9158 } 9159 9160 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js 9161 /** 9162 * External dependencies 9163 */ 9164 9165 9166 /** 9167 * WordPress dependencies 9168 */ 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 /** 9184 * Internal dependencies 9185 */ 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 const { 9197 useCommands 9198 } = unlock(external_wp_coreCommands_namespaceObject.privateApis); 9199 const { 9200 useGlobalStyle: layout_useGlobalStyle 9201 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9202 const { 9203 NavigableRegion: layout_NavigableRegion, 9204 GlobalStylesProvider 9205 } = unlock(external_wp_editor_namespaceObject.privateApis); 9206 const { 9207 useLocation: layout_useLocation 9208 } = unlock(external_wp_router_namespaceObject.privateApis); 9209 const layout_ANIMATION_DURATION = 0.3; 9210 function Layout() { 9211 const { 9212 query, 9213 name: routeKey, 9214 areas, 9215 widths 9216 } = layout_useLocation(); 9217 const { 9218 canvas = 'view' 9219 } = query; 9220 useCommands(); 9221 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 9222 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(); 9223 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); 9224 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 9225 const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 9226 const isEditorLoading = useIsSiteEditorLoading(); 9227 const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_namespaceObject.useState)(false); 9228 const animationRef = animation({ 9229 triggerAnimationOnChange: routeKey + '-' + canvas 9230 }); 9231 const { 9232 showIconLabels 9233 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9234 return { 9235 showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels') 9236 }; 9237 }); 9238 const [backgroundColor] = layout_useGlobalStyle('color.background'); 9239 const [gradientValue] = layout_useGlobalStyle('color.gradient'); 9240 const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvas); 9241 (0,external_wp_element_namespaceObject.useEffect)(() => { 9242 if (previousCanvaMode === 'edit') { 9243 toggleRef.current?.focus(); 9244 } 9245 // Should not depend on the previous canvas mode value but the next. 9246 }, [canvas]); 9247 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9248 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}), canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveKeyboardShortcut, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9249 ...navigateRegionsProps, 9250 ref: navigateRegionsProps.ref, 9251 className: dist_clsx('edit-site-layout', navigateRegionsProps.className, { 9252 'is-full-canvas': canvas === 'edit', 9253 'show-icon-labels': showIconLabels 9254 }), 9255 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9256 className: "edit-site-layout__content", 9257 children: [(!isMobileViewport || !areas.mobile) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout_NavigableRegion, { 9258 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'), 9259 className: "edit-site-layout__sidebar-region", 9260 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 9261 children: canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 9262 initial: { 9263 opacity: 0 9264 }, 9265 animate: { 9266 opacity: 1 9267 }, 9268 exit: { 9269 opacity: 0 9270 }, 9271 transition: { 9272 type: 'tween', 9273 duration: 9274 // Disable transition in mobile to emulate a full page transition. 9275 disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION, 9276 ease: 'easeOut' 9277 }, 9278 className: "edit-site-layout__sidebar", 9279 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_hub, { 9280 ref: toggleRef, 9281 isTransparent: isResizableFrameOversized 9282 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 9283 shouldAnimate: routeKey !== 'styles', 9284 routeKey: routeKey, 9285 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9286 children: areas.sidebar 9287 }) 9288 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})] 9289 }) 9290 }) 9291 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), isMobileViewport && areas.mobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9292 className: "edit-site-layout__mobile", 9293 children: [canvas !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 9294 routeKey: routeKey, 9295 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteHubMobile, { 9296 ref: toggleRef, 9297 isTransparent: isResizableFrameOversized 9298 }) 9299 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9300 children: areas.mobile 9301 })] 9302 }), !isMobileViewport && areas.content && canvas !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9303 className: "edit-site-layout__area", 9304 style: { 9305 maxWidth: widths?.content 9306 }, 9307 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9308 children: areas.content 9309 }) 9310 }), !isMobileViewport && areas.edit && canvas !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9311 className: "edit-site-layout__area", 9312 style: { 9313 maxWidth: widths?.edit 9314 }, 9315 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9316 children: areas.edit 9317 }) 9318 }), !isMobileViewport && areas.preview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9319 className: "edit-site-layout__canvas-container", 9320 children: [canvasResizer, !!canvasSize.width && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9321 className: dist_clsx('edit-site-layout__canvas', { 9322 'is-right-aligned': isResizableFrameOversized 9323 }), 9324 ref: animationRef, 9325 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9326 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_frame, { 9327 isReady: !isEditorLoading, 9328 isFullWidth: canvas === 'edit', 9329 defaultSize: { 9330 width: canvasSize.width - 24 /* $canvas-padding */, 9331 height: canvasSize.height 9332 }, 9333 isOversized: isResizableFrameOversized, 9334 setIsOversized: setIsResizableFrameOversized, 9335 innerContentStyle: { 9336 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor 9337 }, 9338 children: areas.preview 9339 }) 9340 }) 9341 })] 9342 })] 9343 }) 9344 })] 9345 }); 9346 } 9347 function LayoutWithGlobalStylesProvider(props) { 9348 const { 9349 createErrorNotice 9350 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 9351 function onPluginAreaError(name) { 9352 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: plugin name */ 9353 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); 9354 } 9355 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { 9356 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { 9357 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { 9358 onError: onPluginAreaError 9359 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { 9360 ...props 9361 })] 9362 }) 9363 }); 9364 } 9365 9366 ;// ./node_modules/@wordpress/icons/build-module/library/styles.js 9367 /** 9368 * WordPress dependencies 9369 */ 9370 9371 9372 const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9373 viewBox: "0 0 24 24", 9374 xmlns: "http://www.w3.org/2000/svg", 9375 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9376 fillRule: "evenodd", 9377 clipRule: "evenodd", 9378 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" 9379 }) 9380 }); 9381 /* harmony default export */ const library_styles = (styles); 9382 9383 ;// ./node_modules/@wordpress/icons/build-module/library/help.js 9384 /** 9385 * WordPress dependencies 9386 */ 9387 9388 9389 const help = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9390 xmlns: "http://www.w3.org/2000/svg", 9391 viewBox: "0 0 24 24", 9392 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9393 d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z" 9394 }) 9395 }); 9396 /* harmony default export */ const library_help = (help); 9397 9398 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js 9399 /** 9400 * WordPress dependencies 9401 */ 9402 9403 9404 const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9405 xmlns: "http://www.w3.org/2000/svg", 9406 viewBox: "0 0 24 24", 9407 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9408 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" 9409 }) 9410 }); 9411 /* harmony default export */ const rotate_right = (rotateRight); 9412 9413 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js 9414 /** 9415 * WordPress dependencies 9416 */ 9417 9418 9419 const rotateLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9420 xmlns: "http://www.w3.org/2000/svg", 9421 viewBox: "0 0 24 24", 9422 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9423 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" 9424 }) 9425 }); 9426 /* harmony default export */ const rotate_left = (rotateLeft); 9427 9428 ;// ./node_modules/@wordpress/icons/build-module/library/brush.js 9429 /** 9430 * WordPress dependencies 9431 */ 9432 9433 9434 const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9435 xmlns: "http://www.w3.org/2000/svg", 9436 viewBox: "0 0 24 24", 9437 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9438 d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" 9439 }) 9440 }); 9441 /* harmony default export */ const library_brush = (brush); 9442 9443 ;// ./node_modules/@wordpress/icons/build-module/library/backup.js 9444 /** 9445 * WordPress dependencies 9446 */ 9447 9448 9449 const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9450 xmlns: "http://www.w3.org/2000/svg", 9451 viewBox: "0 0 24 24", 9452 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9453 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" 9454 }) 9455 }); 9456 /* harmony default export */ const library_backup = (backup); 9457 9458 ;// ./node_modules/@wordpress/icons/build-module/library/external.js 9459 /** 9460 * WordPress dependencies 9461 */ 9462 9463 9464 const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9465 xmlns: "http://www.w3.org/2000/svg", 9466 viewBox: "0 0 24 24", 9467 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9468 d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" 9469 }) 9470 }); 9471 /* harmony default export */ const library_external = (external); 9472 9473 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js 9474 /** 9475 * WordPress dependencies 9476 */ 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 /** 9488 * Internal dependencies 9489 */ 9490 9491 9492 const { 9493 useGlobalStylesReset 9494 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9495 const { 9496 useHistory: use_common_commands_useHistory, 9497 useLocation: use_common_commands_useLocation 9498 } = unlock(external_wp_router_namespaceObject.privateApis); 9499 const getGlobalStylesOpenStylesCommands = () => function useGlobalStylesOpenStylesCommands() { 9500 const { 9501 openGeneralSidebar 9502 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9503 const { 9504 params 9505 } = use_common_commands_useLocation(); 9506 const { 9507 canvas = 'view' 9508 } = params; 9509 const history = use_common_commands_useHistory(); 9510 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 9511 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 9512 }, []); 9513 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9514 if (!isBlockBasedTheme) { 9515 return []; 9516 } 9517 return [{ 9518 name: 'core/edit-site/open-styles', 9519 label: (0,external_wp_i18n_namespaceObject.__)('Open styles'), 9520 callback: ({ 9521 close 9522 }) => { 9523 close(); 9524 if (canvas !== 'edit') { 9525 history.navigate('/styles?canvas=edit', { 9526 transition: 'canvas-mode-edit-transition' 9527 }); 9528 } 9529 openGeneralSidebar('edit-site/global-styles'); 9530 }, 9531 icon: library_styles 9532 }]; 9533 }, [history, openGeneralSidebar, canvas, isBlockBasedTheme]); 9534 return { 9535 isLoading: false, 9536 commands 9537 }; 9538 }; 9539 const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() { 9540 const { 9541 openGeneralSidebar 9542 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9543 const { 9544 params 9545 } = use_common_commands_useLocation(); 9546 const { 9547 canvas = 'view' 9548 } = params; 9549 const { 9550 set 9551 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 9552 const history = use_common_commands_useHistory(); 9553 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 9554 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 9555 }, []); 9556 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9557 if (!isBlockBasedTheme) { 9558 return []; 9559 } 9560 return [{ 9561 name: 'core/edit-site/toggle-styles-welcome-guide', 9562 label: (0,external_wp_i18n_namespaceObject.__)('Learn about styles'), 9563 callback: ({ 9564 close 9565 }) => { 9566 close(); 9567 if (canvas !== 'edit') { 9568 history.navigate('/styles?canvas=edit', { 9569 transition: 'canvas-mode-edit-transition' 9570 }); 9571 } 9572 openGeneralSidebar('edit-site/global-styles'); 9573 set('core/edit-site', 'welcomeGuideStyles', true); 9574 // sometimes there's a focus loss that happens after some time 9575 // that closes the modal, we need to force reopening it. 9576 setTimeout(() => { 9577 set('core/edit-site', 'welcomeGuideStyles', true); 9578 }, 500); 9579 }, 9580 icon: library_help 9581 }]; 9582 }, [history, openGeneralSidebar, canvas, isBlockBasedTheme, set]); 9583 return { 9584 isLoading: false, 9585 commands 9586 }; 9587 }; 9588 const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() { 9589 const [canReset, onReset] = useGlobalStylesReset(); 9590 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9591 if (!canReset) { 9592 return []; 9593 } 9594 return [{ 9595 name: 'core/edit-site/reset-global-styles', 9596 label: (0,external_wp_i18n_namespaceObject.__)('Reset styles'), 9597 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right : rotate_left, 9598 callback: ({ 9599 close 9600 }) => { 9601 close(); 9602 onReset(); 9603 } 9604 }]; 9605 }, [canReset, onReset]); 9606 return { 9607 isLoading: false, 9608 commands 9609 }; 9610 }; 9611 const getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() { 9612 const { 9613 openGeneralSidebar, 9614 setEditorCanvasContainerView 9615 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9616 const { 9617 params 9618 } = use_common_commands_useLocation(); 9619 const { 9620 canvas = 'view' 9621 } = params; 9622 const history = use_common_commands_useHistory(); 9623 const { 9624 canEditCSS 9625 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9626 const { 9627 getEntityRecord, 9628 __experimentalGetCurrentGlobalStylesId 9629 } = select(external_wp_coreData_namespaceObject.store); 9630 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9631 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 9632 return { 9633 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 9634 }; 9635 }, []); 9636 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9637 if (!canEditCSS) { 9638 return []; 9639 } 9640 return [{ 9641 name: 'core/edit-site/open-styles-css', 9642 label: (0,external_wp_i18n_namespaceObject.__)('Customize CSS'), 9643 icon: library_brush, 9644 callback: ({ 9645 close 9646 }) => { 9647 close(); 9648 if (canvas !== 'edit') { 9649 history.navigate('/styles?canvas=edit', { 9650 transition: 'canvas-mode-edit-transition' 9651 }); 9652 } 9653 openGeneralSidebar('edit-site/global-styles'); 9654 setEditorCanvasContainerView('global-styles-css'); 9655 } 9656 }]; 9657 }, [history, openGeneralSidebar, setEditorCanvasContainerView, canEditCSS, canvas]); 9658 return { 9659 isLoading: false, 9660 commands 9661 }; 9662 }; 9663 const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() { 9664 const { 9665 openGeneralSidebar, 9666 setEditorCanvasContainerView 9667 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9668 const { 9669 params 9670 } = use_common_commands_useLocation(); 9671 const { 9672 canvas = 'view' 9673 } = params; 9674 const history = use_common_commands_useHistory(); 9675 const hasRevisions = (0,external_wp_data_namespaceObject.useSelect)(select => { 9676 const { 9677 getEntityRecord, 9678 __experimentalGetCurrentGlobalStylesId 9679 } = select(external_wp_coreData_namespaceObject.store); 9680 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9681 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 9682 return !!globalStyles?._links?.['version-history']?.[0]?.count; 9683 }, []); 9684 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9685 if (!hasRevisions) { 9686 return []; 9687 } 9688 return [{ 9689 name: 'core/edit-site/open-global-styles-revisions', 9690 label: (0,external_wp_i18n_namespaceObject.__)('Style revisions'), 9691 icon: library_backup, 9692 callback: ({ 9693 close 9694 }) => { 9695 close(); 9696 if (canvas !== 'edit') { 9697 history.navigate('/styles?canvas=edit', { 9698 transition: 'canvas-mode-edit-transition' 9699 }); 9700 } 9701 openGeneralSidebar('edit-site/global-styles'); 9702 setEditorCanvasContainerView('global-styles-revisions'); 9703 } 9704 }]; 9705 }, [hasRevisions, history, openGeneralSidebar, setEditorCanvasContainerView, canvas]); 9706 return { 9707 isLoading: false, 9708 commands 9709 }; 9710 }; 9711 function useCommonCommands() { 9712 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 9713 // Site index. 9714 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 9715 }, []); 9716 (0,external_wp_commands_namespaceObject.useCommand)({ 9717 name: 'core/edit-site/view-site', 9718 label: (0,external_wp_i18n_namespaceObject.__)('View site'), 9719 callback: ({ 9720 close 9721 }) => { 9722 close(); 9723 window.open(homeUrl, '_blank'); 9724 }, 9725 icon: library_external 9726 }); 9727 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9728 name: 'core/edit-site/open-styles', 9729 hook: getGlobalStylesOpenStylesCommands() 9730 }); 9731 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9732 name: 'core/edit-site/toggle-styles-welcome-guide', 9733 hook: getGlobalStylesToggleWelcomeGuideCommands() 9734 }); 9735 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9736 name: 'core/edit-site/reset-global-styles', 9737 hook: getGlobalStylesResetCommands() 9738 }); 9739 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9740 name: 'core/edit-site/open-styles-css', 9741 hook: getGlobalStylesOpenCssCommands() 9742 }); 9743 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9744 name: 'core/edit-site/open-styles-revisions', 9745 hook: getGlobalStylesOpenRevisionsCommands() 9746 }); 9747 } 9748 9749 ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js 9750 /** 9751 * WordPress dependencies 9752 */ 9753 9754 9755 const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9756 xmlns: "http://www.w3.org/2000/svg", 9757 viewBox: "0 0 24 24", 9758 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9759 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" 9760 }) 9761 }); 9762 /* harmony default export */ const close_small = (closeSmall); 9763 9764 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js 9765 /* wp:polyfill */ 9766 /** 9767 * WordPress dependencies 9768 */ 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 /** 9780 * Internal dependencies 9781 */ 9782 9783 9784 9785 const { 9786 EditorContentSlotFill, 9787 ResizableEditor 9788 } = unlock(external_wp_editor_namespaceObject.privateApis); 9789 9790 /** 9791 * Returns a translated string for the title of the editor canvas container. 9792 * 9793 * @param {string} view Editor canvas container view. 9794 * 9795 * @return {Object} Translated string for the view title and associated icon, both defaulting to ''. 9796 */ 9797 function getEditorCanvasContainerTitle(view) { 9798 switch (view) { 9799 case 'style-book': 9800 return (0,external_wp_i18n_namespaceObject.__)('Style Book'); 9801 case 'global-styles-revisions': 9802 case 'global-styles-revisions:style-book': 9803 return (0,external_wp_i18n_namespaceObject.__)('Style Revisions'); 9804 default: 9805 return ''; 9806 } 9807 } 9808 function EditorCanvasContainer({ 9809 children, 9810 closeButtonLabel, 9811 onClose, 9812 enableResizing = false 9813 }) { 9814 const { 9815 editorCanvasContainerView, 9816 showListViewByDefault 9817 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9818 const _editorCanvasContainerView = unlock(select(store)).getEditorCanvasContainerView(); 9819 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 9820 return { 9821 editorCanvasContainerView: _editorCanvasContainerView, 9822 showListViewByDefault: _showListViewByDefault 9823 }; 9824 }, []); 9825 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 9826 const { 9827 setEditorCanvasContainerView 9828 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9829 const { 9830 setIsListViewOpened 9831 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 9832 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); 9833 const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); 9834 function onCloseContainer() { 9835 setIsListViewOpened(showListViewByDefault); 9836 setEditorCanvasContainerView(undefined); 9837 setIsClosed(true); 9838 if (typeof onClose === 'function') { 9839 onClose(); 9840 } 9841 } 9842 function closeOnEscape(event) { 9843 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 9844 event.preventDefault(); 9845 onCloseContainer(); 9846 } 9847 } 9848 const childrenWithProps = Array.isArray(children) ? external_wp_element_namespaceObject.Children.map(children, (child, index) => index === 0 ? (0,external_wp_element_namespaceObject.cloneElement)(child, { 9849 ref: sectionFocusReturnRef 9850 }) : child) : (0,external_wp_element_namespaceObject.cloneElement)(children, { 9851 ref: sectionFocusReturnRef 9852 }); 9853 if (isClosed) { 9854 return null; 9855 } 9856 const title = getEditorCanvasContainerTitle(editorCanvasContainerView); 9857 const shouldShowCloseButton = onClose || closeButtonLabel; 9858 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { 9859 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9860 className: "edit-site-editor-canvas-container", 9861 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { 9862 enableResizing: enableResizing, 9863 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { 9864 className: "edit-site-editor-canvas-container__section", 9865 ref: shouldShowCloseButton ? focusOnMountRef : null, 9866 onKeyDown: closeOnEscape, 9867 "aria-label": title, 9868 children: [shouldShowCloseButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9869 size: "compact", 9870 className: "edit-site-editor-canvas-container__close-button", 9871 icon: close_small, 9872 label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close'), 9873 onClick: onCloseContainer 9874 }), childrenWithProps] 9875 }) 9876 }) 9877 }) 9878 }); 9879 } 9880 function useHasEditorCanvasContainer() { 9881 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.name); 9882 return !!fills?.length; 9883 } 9884 /* harmony default export */ const editor_canvas_container = (EditorCanvasContainer); 9885 9886 9887 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js 9888 /** 9889 * WordPress dependencies 9890 */ 9891 9892 9893 9894 9895 9896 /** 9897 * Internal dependencies 9898 */ 9899 9900 9901 const { 9902 useCommandContext 9903 } = unlock(external_wp_commands_namespaceObject.privateApis); 9904 const { 9905 useLocation: use_set_command_context_useLocation 9906 } = unlock(external_wp_router_namespaceObject.privateApis); 9907 9908 /** 9909 * React hook used to set the correct command context based on the current state. 9910 */ 9911 function useSetCommandContext() { 9912 const { 9913 query = {} 9914 } = use_set_command_context_useLocation(); 9915 const { 9916 canvas = 'view' 9917 } = query; 9918 const hasBlockSelected = (0,external_wp_data_namespaceObject.useSelect)(select => { 9919 return select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(); 9920 }, []); 9921 const hasEditorCanvasContainer = useHasEditorCanvasContainer(); 9922 9923 // Sets the right context for the command palette 9924 let commandContext = 'site-editor'; 9925 if (canvas === 'edit') { 9926 commandContext = 'entity-edit'; 9927 } 9928 if (hasBlockSelected) { 9929 commandContext = 'block-selection-edit'; 9930 } 9931 if (hasEditorCanvasContainer) { 9932 /* 9933 * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context 9934 * to remove the suggested commands that may not make sense with Style Book or Style Revisions open. 9935 * See https://github.com/WordPress/gutenberg/issues/62216. 9936 */ 9937 commandContext = ''; 9938 } 9939 useCommandContext(commandContext); 9940 } 9941 9942 ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js 9943 /** 9944 * WordPress dependencies 9945 */ 9946 9947 9948 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9949 viewBox: "0 0 24 24", 9950 xmlns: "http://www.w3.org/2000/svg", 9951 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9952 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" 9953 }) 9954 }); 9955 /* harmony default export */ const library_navigation = (navigation); 9956 9957 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 9958 /** 9959 * WordPress dependencies 9960 */ 9961 9962 9963 const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 9964 xmlns: "http://www.w3.org/2000/svg", 9965 viewBox: "0 0 24 24", 9966 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9967 d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" 9968 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9969 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" 9970 })] 9971 }); 9972 /* harmony default export */ const library_page = (page); 9973 9974 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 9975 /** 9976 * WordPress dependencies 9977 */ 9978 9979 9980 const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9981 xmlns: "http://www.w3.org/2000/svg", 9982 viewBox: "0 0 24 24", 9983 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9984 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" 9985 }) 9986 }); 9987 /* harmony default export */ const library_layout = (layout); 9988 9989 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 9990 /** 9991 * WordPress dependencies 9992 */ 9993 9994 9995 const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9996 xmlns: "http://www.w3.org/2000/svg", 9997 viewBox: "0 0 24 24", 9998 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9999 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" 10000 }) 10001 }); 10002 /* harmony default export */ const library_symbol = (symbol); 10003 10004 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js 10005 /** 10006 * WordPress dependencies 10007 */ 10008 10009 10010 const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10011 xmlns: "http://www.w3.org/2000/svg", 10012 viewBox: "0 0 24 24", 10013 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10014 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" 10015 }) 10016 }); 10017 /* harmony default export */ const chevron_right = (chevronRight); 10018 10019 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js 10020 /** 10021 * WordPress dependencies 10022 */ 10023 10024 10025 const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10026 xmlns: "http://www.w3.org/2000/svg", 10027 viewBox: "0 0 24 24", 10028 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10029 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" 10030 }) 10031 }); 10032 /* harmony default export */ const chevron_left = (chevronLeft); 10033 10034 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js 10035 /** 10036 * External dependencies 10037 */ 10038 10039 10040 /** 10041 * WordPress dependencies 10042 */ 10043 10044 10045 function SidebarButton(props) { 10046 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 10047 size: "compact", 10048 ...props, 10049 className: dist_clsx('edit-site-sidebar-button', props.className) 10050 }); 10051 } 10052 10053 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js 10054 /** 10055 * External dependencies 10056 */ 10057 10058 10059 /** 10060 * WordPress dependencies 10061 */ 10062 10063 10064 10065 10066 10067 10068 10069 10070 /** 10071 * Internal dependencies 10072 */ 10073 10074 10075 10076 10077 10078 10079 const { 10080 useHistory: sidebar_navigation_screen_useHistory, 10081 useLocation: sidebar_navigation_screen_useLocation 10082 } = unlock(external_wp_router_namespaceObject.privateApis); 10083 function SidebarNavigationScreen({ 10084 isRoot, 10085 title, 10086 actions, 10087 meta, 10088 content, 10089 footer, 10090 description, 10091 backPath: backPathProp 10092 }) { 10093 const { 10094 dashboardLink, 10095 dashboardLinkText, 10096 previewingThemeName 10097 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10098 const { 10099 getSettings 10100 } = unlock(select(store)); 10101 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 10102 return { 10103 dashboardLink: getSettings().__experimentalDashboardLink, 10104 dashboardLinkText: getSettings().__experimentalDashboardLinkText, 10105 // Do not call `getTheme` with null, it will cause a request to 10106 // the server. 10107 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined 10108 }; 10109 }, []); 10110 const location = sidebar_navigation_screen_useLocation(); 10111 const history = sidebar_navigation_screen_useHistory(); 10112 const { 10113 navigate 10114 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 10115 const backPath = backPathProp !== null && backPathProp !== void 0 ? backPathProp : location.state?.backPath; 10116 const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; 10117 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10118 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 10119 className: dist_clsx('edit-site-sidebar-navigation-screen__main', { 10120 'has-footer': !!footer 10121 }), 10122 spacing: 0, 10123 justify: "flex-start", 10124 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 10125 spacing: 3, 10126 alignment: "flex-start", 10127 className: "edit-site-sidebar-navigation-screen__title-icon", 10128 children: [!isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 10129 onClick: () => { 10130 history.navigate(backPath); 10131 navigate('back'); 10132 }, 10133 icon: icon, 10134 label: (0,external_wp_i18n_namespaceObject.__)('Back'), 10135 showTooltip: false 10136 }), isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 10137 icon: icon, 10138 label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 10139 href: dashboardLink 10140 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 10141 className: "edit-site-sidebar-navigation-screen__title", 10142 color: '#e0e0e0' /* $gray-200 */, 10143 level: 1, 10144 size: 20, 10145 children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: theme name. 2: title */ 10146 (0,external_wp_i18n_namespaceObject.__)('Previewing %1$s: %2$s'), previewingThemeName, title) 10147 }), actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10148 className: "edit-site-sidebar-navigation-screen__actions", 10149 children: actions 10150 })] 10151 }), meta && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10152 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10153 className: "edit-site-sidebar-navigation-screen__meta", 10154 children: meta 10155 }) 10156 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 10157 className: "edit-site-sidebar-navigation-screen__content", 10158 children: [description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10159 className: "edit-site-sidebar-navigation-screen__description", 10160 children: description 10161 }), content] 10162 })] 10163 }), footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { 10164 className: "edit-site-sidebar-navigation-screen__footer", 10165 children: footer 10166 })] 10167 }); 10168 } 10169 10170 ;// ./node_modules/@wordpress/icons/build-module/icon/index.js 10171 /** 10172 * WordPress dependencies 10173 */ 10174 10175 10176 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 10177 10178 /** 10179 * Return an SVG icon. 10180 * 10181 * @param {IconProps} props icon is the SVG component to render 10182 * size is a number specifying the icon size in pixels 10183 * Other props will be passed to wrapped SVG component 10184 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. 10185 * 10186 * @return {JSX.Element} Icon component 10187 */ 10188 function Icon({ 10189 icon, 10190 size = 24, 10191 ...props 10192 }, ref) { 10193 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 10194 width: size, 10195 height: size, 10196 ...props, 10197 ref 10198 }); 10199 } 10200 /* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); 10201 10202 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 10203 /** 10204 * WordPress dependencies 10205 */ 10206 10207 10208 const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10209 xmlns: "http://www.w3.org/2000/svg", 10210 viewBox: "0 0 24 24", 10211 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10212 d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" 10213 }) 10214 }); 10215 /* harmony default export */ const chevron_left_small = (chevronLeftSmall); 10216 10217 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 10218 /** 10219 * WordPress dependencies 10220 */ 10221 10222 10223 const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10224 xmlns: "http://www.w3.org/2000/svg", 10225 viewBox: "0 0 24 24", 10226 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10227 d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" 10228 }) 10229 }); 10230 /* harmony default export */ const chevron_right_small = (chevronRightSmall); 10231 10232 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js 10233 /** 10234 * External dependencies 10235 */ 10236 10237 10238 /** 10239 * WordPress dependencies 10240 */ 10241 10242 10243 10244 10245 10246 10247 /** 10248 * Internal dependencies 10249 */ 10250 10251 10252 10253 const { 10254 useHistory: sidebar_navigation_item_useHistory, 10255 useLink 10256 } = unlock(external_wp_router_namespaceObject.privateApis); 10257 function SidebarNavigationItem({ 10258 className, 10259 icon, 10260 withChevron = false, 10261 suffix, 10262 uid, 10263 to, 10264 onClick, 10265 children, 10266 ...props 10267 }) { 10268 const history = sidebar_navigation_item_useHistory(); 10269 const { 10270 navigate 10271 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 10272 // If there is no custom click handler, create one that navigates to `params`. 10273 function handleClick(e) { 10274 if (onClick) { 10275 onClick(e); 10276 navigate('forward'); 10277 } else if (to) { 10278 e.preventDefault(); 10279 history.navigate(to); 10280 navigate('forward', `[id="$uid}"]`); 10281 } 10282 } 10283 const linkProps = useLink(to); 10284 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 10285 className: dist_clsx('edit-site-sidebar-navigation-item', { 10286 'with-suffix': !withChevron && suffix 10287 }, className), 10288 id: uid, 10289 onClick: handleClick, 10290 href: to ? linkProps.href : undefined, 10291 ...props, 10292 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 10293 justify: "flex-start", 10294 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 10295 style: { 10296 fill: 'currentcolor' 10297 }, 10298 icon: icon, 10299 size: 24 10300 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 10301 children: children 10302 }), withChevron && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 10303 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, 10304 className: "edit-site-sidebar-navigation-item__drilldown-indicator", 10305 size: 24 10306 }), !withChevron && suffix] 10307 }) 10308 }); 10309 } 10310 10311 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js 10312 /* wp:polyfill */ 10313 /** 10314 * WordPress dependencies 10315 */ 10316 10317 10318 10319 10320 10321 /** 10322 * Internal dependencies 10323 */ 10324 10325 const SITE_EDITOR_AUTHORS_QUERY = { 10326 per_page: -1, 10327 _fields: 'id,name,avatar_urls', 10328 context: 'view', 10329 capabilities: ['edit_theme_options'] 10330 }; 10331 const DEFAULT_QUERY = { 10332 per_page: 100, 10333 page: 1 10334 }; 10335 const use_global_styles_revisions_EMPTY_ARRAY = []; 10336 const { 10337 GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext 10338 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10339 function useGlobalStylesRevisions({ 10340 query 10341 } = {}) { 10342 const { 10343 user: userConfig 10344 } = (0,external_wp_element_namespaceObject.useContext)(use_global_styles_revisions_GlobalStylesContext); 10345 const _query = { 10346 ...DEFAULT_QUERY, 10347 ...query 10348 }; 10349 const { 10350 authors, 10351 currentUser, 10352 isDirty, 10353 revisions, 10354 isLoadingGlobalStylesRevisions, 10355 revisionsCount 10356 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10357 var _globalStyles$_links$; 10358 const { 10359 __experimentalGetDirtyEntityRecords, 10360 getCurrentUser, 10361 getUsers, 10362 getRevisions, 10363 __experimentalGetCurrentGlobalStylesId, 10364 getEntityRecord, 10365 isResolving 10366 } = select(external_wp_coreData_namespaceObject.store); 10367 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 10368 const _currentUser = getCurrentUser(); 10369 const _isDirty = dirtyEntityRecords.length > 0; 10370 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 10371 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 10372 const _revisionsCount = (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0; 10373 const globalStylesRevisions = getRevisions('root', 'globalStyles', globalStylesId, _query) || use_global_styles_revisions_EMPTY_ARRAY; 10374 const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY; 10375 const _isResolving = isResolving('getRevisions', ['root', 'globalStyles', globalStylesId, _query]); 10376 return { 10377 authors: _authors, 10378 currentUser: _currentUser, 10379 isDirty: _isDirty, 10380 revisions: globalStylesRevisions, 10381 isLoadingGlobalStylesRevisions: _isResolving, 10382 revisionsCount: _revisionsCount 10383 }; 10384 }, [query]); 10385 return (0,external_wp_element_namespaceObject.useMemo)(() => { 10386 if (!authors.length || isLoadingGlobalStylesRevisions) { 10387 return { 10388 revisions: use_global_styles_revisions_EMPTY_ARRAY, 10389 hasUnsavedChanges: isDirty, 10390 isLoading: true, 10391 revisionsCount 10392 }; 10393 } 10394 10395 // Adds author details to each revision. 10396 const _modifiedRevisions = revisions.map(revision => { 10397 return { 10398 ...revision, 10399 author: authors.find(author => author.id === revision.author) 10400 }; 10401 }); 10402 const fetchedRevisionsCount = revisions.length; 10403 if (fetchedRevisionsCount) { 10404 // Flags the most current saved revision. 10405 if (_modifiedRevisions[0].id !== 'unsaved' && _query.page === 1) { 10406 _modifiedRevisions[0].isLatest = true; 10407 } 10408 10409 // Adds an item for unsaved changes. 10410 if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { 10411 const unsavedRevision = { 10412 id: 'unsaved', 10413 styles: userConfig?.styles, 10414 settings: userConfig?.settings, 10415 _links: userConfig?._links, 10416 author: { 10417 name: currentUser?.name, 10418 avatar_urls: currentUser?.avatar_urls 10419 }, 10420 modified: new Date() 10421 }; 10422 _modifiedRevisions.unshift(unsavedRevision); 10423 } 10424 if (_query.page === Math.ceil(revisionsCount / _query.per_page)) { 10425 // Adds an item for the default theme styles. 10426 _modifiedRevisions.push({ 10427 id: 'parent', 10428 styles: {}, 10429 settings: {} 10430 }); 10431 } 10432 } 10433 return { 10434 revisions: _modifiedRevisions, 10435 hasUnsavedChanges: isDirty, 10436 isLoading: false, 10437 revisionsCount 10438 }; 10439 }, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]); 10440 } 10441 10442 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js 10443 /** 10444 * WordPress dependencies 10445 */ 10446 10447 10448 10449 10450 10451 /** 10452 * Internal dependencies 10453 */ 10454 10455 10456 function SidebarNavigationScreenDetailsFooter({ 10457 record, 10458 revisionsCount, 10459 ...otherProps 10460 }) { 10461 var _record$_links$predec; 10462 /* 10463 * There might be other items in the future, 10464 * but for now it's just modified date. 10465 * Later we might render a list of items and isolate 10466 * the following logic. 10467 */ 10468 const hrefProps = {}; 10469 const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null; 10470 10471 // Use incoming prop first, then the record's version history, if available. 10472 revisionsCount = revisionsCount || record?._links?.['version-history']?.[0]?.count || 0; 10473 10474 /* 10475 * Enable the revisions link if there is a last revision and there is more than one revision. 10476 * This link is used for theme assets, e.g., templates, which have no database record until they're edited. 10477 * For these files there's only a "revision" after they're edited twice, 10478 * which means the revision.php page won't display a proper diff. 10479 * See: https://github.com/WordPress/gutenberg/issues/49164. 10480 */ 10481 if (lastRevisionId && revisionsCount > 1) { 10482 hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 10483 revision: record?._links['predecessor-version'][0].id 10484 }); 10485 hrefProps.as = 'a'; 10486 } 10487 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 10488 size: "large", 10489 className: "edit-site-sidebar-navigation-screen-details-footer", 10490 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10491 icon: library_backup, 10492 ...hrefProps, 10493 ...otherProps, 10494 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of Styles revisions. */ 10495 (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount) 10496 }) 10497 }); 10498 } 10499 10500 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js 10501 /** 10502 * WordPress dependencies 10503 */ 10504 10505 10506 10507 10508 10509 10510 10511 /** 10512 * Internal dependencies 10513 */ 10514 10515 10516 10517 10518 10519 10520 10521 10522 const { 10523 useLocation: sidebar_navigation_screen_global_styles_useLocation, 10524 useHistory: sidebar_navigation_screen_global_styles_useHistory 10525 } = unlock(external_wp_router_namespaceObject.privateApis); 10526 function SidebarNavigationItemGlobalStyles(props) { 10527 const { 10528 name 10529 } = sidebar_navigation_screen_global_styles_useLocation(); 10530 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10531 ...props, 10532 "aria-current": name === 'styles' 10533 }); 10534 } 10535 function SidebarNavigationScreenGlobalStyles() { 10536 const history = sidebar_navigation_screen_global_styles_useHistory(); 10537 const { 10538 path 10539 } = sidebar_navigation_screen_global_styles_useLocation(); 10540 const { 10541 revisions, 10542 isLoading: isLoadingRevisions, 10543 revisionsCount 10544 } = useGlobalStylesRevisions(); 10545 const { 10546 openGeneralSidebar 10547 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10548 const { 10549 setEditorCanvasContainerView 10550 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 10551 const { 10552 set: setPreference 10553 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10554 const openGlobalStyles = (0,external_wp_element_namespaceObject.useCallback)(async () => { 10555 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 10556 canvas: 'edit' 10557 }), { 10558 transition: 'canvas-mode-edit-transition' 10559 }); 10560 return Promise.all([setPreference('core', 'distractionFree', false), openGeneralSidebar('edit-site/global-styles')]); 10561 }, [path, history, openGeneralSidebar, setPreference]); 10562 const openRevisions = (0,external_wp_element_namespaceObject.useCallback)(async () => { 10563 await openGlobalStyles(); 10564 // Open the global styles revisions once the canvas mode is set to edit, 10565 // and the global styles sidebar is open. The global styles UI is responsible 10566 // for redirecting to the revisions screen once the editor canvas container 10567 // has been set to 'global-styles-revisions'. 10568 setEditorCanvasContainerView('global-styles-revisions'); 10569 }, [openGlobalStyles, setEditorCanvasContainerView]); 10570 10571 // If there are no revisions, do not render a footer. 10572 const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions; 10573 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10574 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 10575 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 10576 isRoot: true, 10577 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'), 10578 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { 10579 activeItem: "styles-navigation-item" 10580 }), 10581 footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsFooter, { 10582 record: revisions?.[0], 10583 revisionsCount: revisionsCount, 10584 onClick: openRevisions 10585 }) 10586 }) 10587 }); 10588 } 10589 10590 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js 10591 /** 10592 * WordPress dependencies 10593 */ 10594 10595 10596 10597 10598 10599 10600 10601 /** 10602 * Internal dependencies 10603 */ 10604 10605 10606 10607 10608 10609 10610 function MainSidebarNavigationContent({ 10611 isBlockBasedTheme = true 10612 }) { 10613 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 10614 className: "edit-site-sidebar-navigation-screen-main", 10615 children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10616 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10617 uid: "navigation-navigation-item", 10618 to: "/navigation", 10619 withChevron: true, 10620 icon: library_navigation, 10621 children: (0,external_wp_i18n_namespaceObject.__)('Navigation') 10622 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItemGlobalStyles, { 10623 to: "/styles", 10624 uid: "global-styles-navigation-item", 10625 icon: library_styles, 10626 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 10627 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10628 uid: "page-navigation-item", 10629 to: "/page", 10630 withChevron: true, 10631 icon: library_page, 10632 children: (0,external_wp_i18n_namespaceObject.__)('Pages') 10633 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10634 uid: "template-navigation-item", 10635 to: "/template", 10636 withChevron: true, 10637 icon: library_layout, 10638 children: (0,external_wp_i18n_namespaceObject.__)('Templates') 10639 })] 10640 }), !isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10641 uid: "stylebook-navigation-item", 10642 to: "/stylebook", 10643 withChevron: true, 10644 icon: library_styles, 10645 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 10646 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10647 uid: "patterns-navigation-item", 10648 to: "/pattern", 10649 withChevron: true, 10650 icon: library_symbol, 10651 children: (0,external_wp_i18n_namespaceObject.__)('Patterns') 10652 })] 10653 }); 10654 } 10655 function SidebarNavigationScreenMain() { 10656 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); 10657 const { 10658 setEditorCanvasContainerView 10659 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 10660 10661 // Clear the editor canvas container view when accessing the main navigation screen. 10662 (0,external_wp_element_namespaceObject.useEffect)(() => { 10663 setEditorCanvasContainerView(undefined); 10664 }, [setEditorCanvasContainerView]); 10665 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 10666 isRoot: true, 10667 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 10668 description: isBlockBasedTheme ? (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.') : (0,external_wp_i18n_namespaceObject.__)('Explore block styles and patterns to refine your site'), 10669 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { 10670 isBlockBasedTheme: isBlockBasedTheme 10671 }) 10672 }); 10673 } 10674 10675 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js 10676 /** 10677 * WordPress dependencies 10678 */ 10679 10680 10681 const arrowUpLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10682 width: "24", 10683 height: "24", 10684 fill: "none", 10685 xmlns: "http://www.w3.org/2000/svg", 10686 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10687 d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" 10688 }) 10689 }); 10690 /* harmony default export */ const arrow_up_left = (arrowUpLeft); 10691 10692 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js 10693 10694 function WelcomeGuideImage({ 10695 nonAnimatedSrc, 10696 animatedSrc 10697 }) { 10698 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { 10699 className: "edit-site-welcome-guide__image", 10700 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10701 srcSet: nonAnimatedSrc, 10702 media: "(prefers-reduced-motion: reduce)" 10703 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 10704 src: animatedSrc, 10705 width: "312", 10706 height: "240", 10707 alt: "" 10708 })] 10709 }); 10710 } 10711 10712 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js 10713 /** 10714 * WordPress dependencies 10715 */ 10716 10717 10718 10719 10720 10721 10722 10723 /** 10724 * Internal dependencies 10725 */ 10726 10727 10728 function WelcomeGuideEditor() { 10729 const { 10730 toggle 10731 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10732 const { 10733 isActive, 10734 isBlockBasedTheme 10735 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10736 return { 10737 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), 10738 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme 10739 }; 10740 }, []); 10741 if (!isActive || !isBlockBasedTheme) { 10742 return null; 10743 } 10744 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10745 className: "edit-site-welcome-guide guide-editor", 10746 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'), 10747 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 10748 onFinish: () => toggle('core/edit-site', 'welcomeGuide'), 10749 pages: [{ 10750 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10751 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", 10752 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" 10753 }), 10754 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10755 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10756 className: "edit-site-welcome-guide__heading", 10757 children: (0,external_wp_i18n_namespaceObject.__)('Edit your site') 10758 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10759 className: "edit-site-welcome-guide__text", 10760 children: (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.') 10761 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10762 className: "edit-site-welcome-guide__text", 10763 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'), { 10764 StylesIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 10765 alt: (0,external_wp_i18n_namespaceObject.__)('styles'), 10766 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" 10767 }) 10768 }) 10769 })] 10770 }) 10771 }] 10772 }); 10773 } 10774 10775 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js 10776 /** 10777 * WordPress dependencies 10778 */ 10779 10780 10781 10782 10783 10784 10785 /** 10786 * Internal dependencies 10787 */ 10788 10789 10790 10791 const { 10792 interfaceStore: styles_interfaceStore 10793 } = unlock(external_wp_editor_namespaceObject.privateApis); 10794 function WelcomeGuideStyles() { 10795 const { 10796 toggle 10797 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10798 const { 10799 isActive, 10800 isStylesOpen 10801 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10802 const sidebar = select(styles_interfaceStore).getActiveComplementaryArea('core'); 10803 return { 10804 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'), 10805 isStylesOpen: sidebar === 'edit-site/global-styles' 10806 }; 10807 }, []); 10808 if (!isActive || !isStylesOpen) { 10809 return null; 10810 } 10811 const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles'); 10812 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10813 className: "edit-site-welcome-guide guide-styles", 10814 contentLabel: welcomeLabel, 10815 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 10816 onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'), 10817 pages: [{ 10818 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10819 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", 10820 animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" 10821 }), 10822 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10823 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10824 className: "edit-site-welcome-guide__heading", 10825 children: welcomeLabel 10826 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10827 className: "edit-site-welcome-guide__text", 10828 children: (0,external_wp_i18n_namespaceObject.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.') 10829 })] 10830 }) 10831 }, { 10832 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10833 nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", 10834 animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" 10835 }), 10836 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10837 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10838 className: "edit-site-welcome-guide__heading", 10839 children: (0,external_wp_i18n_namespaceObject.__)('Set the design') 10840 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10841 className: "edit-site-welcome-guide__text", 10842 children: (0,external_wp_i18n_namespaceObject.__)('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!') 10843 })] 10844 }) 10845 }, { 10846 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10847 nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", 10848 animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" 10849 }), 10850 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10851 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10852 className: "edit-site-welcome-guide__heading", 10853 children: (0,external_wp_i18n_namespaceObject.__)('Personalize blocks') 10854 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10855 className: "edit-site-welcome-guide__text", 10856 children: (0,external_wp_i18n_namespaceObject.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.') 10857 })] 10858 }) 10859 }, { 10860 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10861 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 10862 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 10863 }), 10864 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10865 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10866 className: "edit-site-welcome-guide__heading", 10867 children: (0,external_wp_i18n_namespaceObject.__)('Learn more') 10868 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { 10869 className: "edit-site-welcome-guide__text", 10870 children: [(0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site?'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 10871 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/styles-overview/'), 10872 children: (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.') 10873 })] 10874 })] 10875 }) 10876 }] 10877 }); 10878 } 10879 10880 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js 10881 /** 10882 * WordPress dependencies 10883 */ 10884 10885 10886 10887 10888 10889 function WelcomeGuidePage() { 10890 const { 10891 toggle 10892 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10893 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { 10894 const isPageActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuidePage'); 10895 const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'); 10896 return isPageActive && !isEditorActive; 10897 }, []); 10898 if (!isVisible) { 10899 return null; 10900 } 10901 const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a page'); 10902 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10903 className: "edit-site-welcome-guide guide-page", 10904 contentLabel: heading, 10905 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), 10906 onFinish: () => toggle('core/edit-site', 'welcomeGuidePage'), 10907 pages: [{ 10908 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { 10909 className: "edit-site-welcome-guide__video", 10910 autoPlay: true, 10911 loop: true, 10912 muted: true, 10913 width: "312", 10914 height: "240", 10915 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10916 src: "https://s.w.org/images/block-editor/editing-your-page.mp4", 10917 type: "video/mp4" 10918 }) 10919 }), 10920 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10921 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10922 className: "edit-site-welcome-guide__heading", 10923 children: heading 10924 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10925 className: "edit-site-welcome-guide__text", 10926 children: (0,external_wp_i18n_namespaceObject.__)('It’s 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.') 10927 })] 10928 }) 10929 }] 10930 }); 10931 } 10932 10933 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js 10934 /** 10935 * WordPress dependencies 10936 */ 10937 10938 10939 10940 10941 10942 10943 function WelcomeGuideTemplate() { 10944 const { 10945 toggle 10946 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10947 const { 10948 isActive, 10949 hasPreviousEntity 10950 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10951 const { 10952 getEditorSettings 10953 } = select(external_wp_editor_namespaceObject.store); 10954 const { 10955 get 10956 } = select(external_wp_preferences_namespaceObject.store); 10957 return { 10958 isActive: get('core/edit-site', 'welcomeGuideTemplate'), 10959 hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord 10960 }; 10961 }, []); 10962 const isVisible = isActive && hasPreviousEntity; 10963 if (!isVisible) { 10964 return null; 10965 } 10966 const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a template'); 10967 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10968 className: "edit-site-welcome-guide guide-template", 10969 contentLabel: heading, 10970 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), 10971 onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'), 10972 pages: [{ 10973 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { 10974 className: "edit-site-welcome-guide__video", 10975 autoPlay: true, 10976 loop: true, 10977 muted: true, 10978 width: "312", 10979 height: "240", 10980 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10981 src: "https://s.w.org/images/block-editor/editing-your-template.mp4", 10982 type: "video/mp4" 10983 }) 10984 }), 10985 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10986 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10987 className: "edit-site-welcome-guide__heading", 10988 children: heading 10989 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10990 className: "edit-site-welcome-guide__text", 10991 children: (0,external_wp_i18n_namespaceObject.__)('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 ‘Back’ button in the toolbar.') 10992 })] 10993 }) 10994 }] 10995 }); 10996 } 10997 10998 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js 10999 /** 11000 * Internal dependencies 11001 */ 11002 11003 11004 11005 11006 11007 function WelcomeGuide({ 11008 postType 11009 }) { 11010 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11011 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}), postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}), postType === 'wp_template' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {})] 11012 }); 11013 } 11014 11015 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js 11016 /* wp:polyfill */ 11017 /** 11018 * WordPress dependencies 11019 */ 11020 11021 11022 11023 11024 /** 11025 * Internal dependencies 11026 */ 11027 11028 11029 const { 11030 useGlobalStylesOutput 11031 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11032 function useGlobalStylesRenderer(disableRootPadding) { 11033 const [styles, settings] = useGlobalStylesOutput(disableRootPadding); 11034 const { 11035 getSettings 11036 } = (0,external_wp_data_namespaceObject.useSelect)(store); 11037 const { 11038 updateSettings 11039 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 11040 (0,external_wp_element_namespaceObject.useEffect)(() => { 11041 var _currentStoreSettings; 11042 if (!styles || !settings) { 11043 return; 11044 } 11045 const currentStoreSettings = getSettings(); 11046 const nonGlobalStyles = Object.values((_currentStoreSettings = currentStoreSettings.styles) !== null && _currentStoreSettings !== void 0 ? _currentStoreSettings : []).filter(style => !style.isGlobalStyles); 11047 updateSettings({ 11048 ...currentStoreSettings, 11049 styles: [...nonGlobalStyles, ...styles], 11050 __experimentalFeatures: settings 11051 }); 11052 }, [styles, settings, updateSettings, getSettings]); 11053 } 11054 function GlobalStylesRenderer({ 11055 disableRootPadding 11056 }) { 11057 useGlobalStylesRenderer(disableRootPadding); 11058 return null; 11059 } 11060 11061 ;// ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js 11062 /** 11063 * WordPress dependencies 11064 */ 11065 11066 11067 11068 11069 11070 /** 11071 * Internal dependencies 11072 */ 11073 11074 11075 11076 const { 11077 Theme 11078 } = unlock(external_wp_components_namespaceObject.privateApis); 11079 const { 11080 useGlobalStyle: canvas_loader_useGlobalStyle 11081 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11082 function CanvasLoader({ 11083 id 11084 }) { 11085 var _highlightedColors$0$; 11086 const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle('color.text'); 11087 const [backgroundColor] = canvas_loader_useGlobalStyle('color.background'); 11088 const { 11089 highlightedColors 11090 } = useStylesPreviewColors(); 11091 const indicatorColor = (_highlightedColors$0$ = highlightedColors[0]?.color) !== null && _highlightedColors$0$ !== void 0 ? _highlightedColors$0$ : fallbackIndicatorColor; 11092 const { 11093 elapsed, 11094 total 11095 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11096 var _selectorsByStatus$re, _selectorsByStatus$fi; 11097 const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus(); 11098 const resolving = (_selectorsByStatus$re = selectorsByStatus.resolving) !== null && _selectorsByStatus$re !== void 0 ? _selectorsByStatus$re : 0; 11099 const finished = (_selectorsByStatus$fi = selectorsByStatus.finished) !== null && _selectorsByStatus$fi !== void 0 ? _selectorsByStatus$fi : 0; 11100 return { 11101 elapsed: finished, 11102 total: finished + resolving 11103 }; 11104 }, []); 11105 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11106 className: "edit-site-canvas-loader", 11107 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, { 11108 accent: indicatorColor, 11109 background: backgroundColor, 11110 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, { 11111 id: id, 11112 max: total, 11113 value: elapsed 11114 }) 11115 }) 11116 }); 11117 } 11118 11119 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js 11120 /** 11121 * WordPress dependencies 11122 */ 11123 11124 11125 11126 /** 11127 * Internal dependencies 11128 */ 11129 11130 const { 11131 useHistory: use_navigate_to_entity_record_useHistory 11132 } = unlock(external_wp_router_namespaceObject.privateApis); 11133 function useNavigateToEntityRecord() { 11134 const history = use_navigate_to_entity_record_useHistory(); 11135 const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { 11136 history.navigate(`/$params.postType}/$params.postId}?canvas=edit&focusMode=true`); 11137 }, [history]); 11138 return onNavigateToEntityRecord; 11139 } 11140 11141 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js 11142 /** 11143 * WordPress dependencies 11144 */ 11145 11146 11147 11148 11149 11150 /** 11151 * Internal dependencies 11152 */ 11153 11154 11155 11156 11157 const { 11158 useLocation: use_site_editor_settings_useLocation, 11159 useHistory: use_site_editor_settings_useHistory 11160 } = unlock(external_wp_router_namespaceObject.privateApis); 11161 function useNavigateToPreviousEntityRecord() { 11162 const location = use_site_editor_settings_useLocation(); 11163 const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location); 11164 const history = use_site_editor_settings_useHistory(); 11165 const goBack = (0,external_wp_element_namespaceObject.useMemo)(() => { 11166 const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType); 11167 const didComeFromEditorCanvas = previousLocation?.query.canvas === 'edit'; 11168 const showBackButton = isFocusMode && didComeFromEditorCanvas; 11169 return showBackButton ? () => history.back() : undefined; 11170 // `previousLocation` changes when the component updates for any reason, not 11171 // just when location changes. Until this is fixed we can't add it to deps. See 11172 // https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465. 11173 }, [location, history]); 11174 return goBack; 11175 } 11176 function useSpecificEditorSettings() { 11177 const { 11178 query 11179 } = use_site_editor_settings_useLocation(); 11180 const { 11181 canvas = 'view' 11182 } = query; 11183 const onNavigateToEntityRecord = useNavigateToEntityRecord(); 11184 const { 11185 settings 11186 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11187 const { 11188 getSettings 11189 } = select(store); 11190 return { 11191 settings: getSettings() 11192 }; 11193 }, []); 11194 const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); 11195 const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { 11196 return { 11197 ...settings, 11198 richEditingEnabled: true, 11199 supportsTemplateMode: true, 11200 focusMode: canvas !== 'view', 11201 onNavigateToEntityRecord, 11202 onNavigateToPreviousEntityRecord, 11203 isPreviewMode: canvas === 'view' 11204 }; 11205 }, [settings, canvas, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); 11206 return defaultEditorSettings; 11207 } 11208 11209 ;// ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js 11210 /** 11211 * Defines an extensibility slot for the Template sidebar. 11212 */ 11213 11214 /** 11215 * WordPress dependencies 11216 */ 11217 11218 11219 11220 11221 11222 const { 11223 Fill, 11224 Slot 11225 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginTemplateSettingPanel'); 11226 const PluginTemplateSettingPanel = ({ 11227 children 11228 }) => { 11229 external_wp_deprecated_default()('wp.editSite.PluginTemplateSettingPanel', { 11230 since: '6.6', 11231 version: '6.8', 11232 alternative: 'wp.editor.PluginDocumentSettingPanel' 11233 }); 11234 const isCurrentEntityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); 11235 if (!isCurrentEntityTemplate) { 11236 return null; 11237 } 11238 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { 11239 children: children 11240 }); 11241 }; 11242 PluginTemplateSettingPanel.Slot = Slot; 11243 11244 /** 11245 * Renders items in the Template Sidebar below the main information 11246 * like the Template Card. 11247 * 11248 * @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead. 11249 * 11250 * @example 11251 * ```jsx 11252 * // Using ESNext syntax 11253 * import { PluginTemplateSettingPanel } from '@wordpress/edit-site'; 11254 * 11255 * const MyTemplateSettingTest = () => ( 11256 * <PluginTemplateSettingPanel> 11257 * <p>Hello, World!</p> 11258 * </PluginTemplateSettingPanel> 11259 * ); 11260 * ``` 11261 * 11262 * @return {Component} The component to be rendered. 11263 */ 11264 /* harmony default export */ const plugin_template_setting_panel = (PluginTemplateSettingPanel); 11265 11266 ;// ./node_modules/@wordpress/icons/build-module/library/seen.js 11267 /** 11268 * WordPress dependencies 11269 */ 11270 11271 11272 const seen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11273 viewBox: "0 0 24 24", 11274 xmlns: "http://www.w3.org/2000/svg", 11275 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11276 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" 11277 }) 11278 }); 11279 /* harmony default export */ const library_seen = (seen); 11280 11281 ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 11282 /** 11283 * WordPress dependencies 11284 */ 11285 11286 11287 const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11288 xmlns: "http://www.w3.org/2000/svg", 11289 viewBox: "0 0 24 24", 11290 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11291 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 11292 }) 11293 }); 11294 /* harmony default export */ const more_vertical = (moreVertical); 11295 11296 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js 11297 /** 11298 * External dependencies 11299 */ 11300 11301 11302 /** 11303 * WordPress dependencies 11304 */ 11305 11306 11307 function IconWithCurrentColor({ 11308 className, 11309 ...props 11310 }) { 11311 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 11312 className: dist_clsx(className, 'edit-site-global-styles-icon-with-current-color'), 11313 ...props 11314 }); 11315 } 11316 11317 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js 11318 /** 11319 * WordPress dependencies 11320 */ 11321 11322 11323 /** 11324 * Internal dependencies 11325 */ 11326 11327 11328 function GenericNavigationButton({ 11329 icon, 11330 children, 11331 ...props 11332 }) { 11333 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { 11334 ...props, 11335 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 11336 justify: "flex-start", 11337 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 11338 icon: icon, 11339 size: 24 11340 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 11341 children: children 11342 })] 11343 }), !icon && children] 11344 }); 11345 } 11346 function NavigationButtonAsItem(props) { 11347 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { 11348 as: GenericNavigationButton, 11349 ...props 11350 }); 11351 } 11352 function NavigationBackButtonAsItem(props) { 11353 return /*#__PURE__*/_jsx(Navigator.BackButton, { 11354 as: GenericNavigationButton, 11355 ...props 11356 }); 11357 } 11358 11359 11360 ;// ./node_modules/@wordpress/icons/build-module/library/typography.js 11361 /** 11362 * WordPress dependencies 11363 */ 11364 11365 11366 const typography = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11367 xmlns: "http://www.w3.org/2000/svg", 11368 viewBox: "0 0 24 24", 11369 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11370 d: "M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z" 11371 }) 11372 }); 11373 /* harmony default export */ const library_typography = (typography); 11374 11375 ;// ./node_modules/@wordpress/icons/build-module/library/color.js 11376 /** 11377 * WordPress dependencies 11378 */ 11379 11380 11381 const color = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11382 viewBox: "0 0 24 24", 11383 xmlns: "http://www.w3.org/2000/svg", 11384 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11385 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" 11386 }) 11387 }); 11388 /* harmony default export */ const library_color = (color); 11389 11390 ;// ./node_modules/@wordpress/icons/build-module/library/background.js 11391 /** 11392 * WordPress dependencies 11393 */ 11394 11395 11396 const background = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11397 width: "24", 11398 height: "24", 11399 fill: "none", 11400 xmlns: "http://www.w3.org/2000/svg", 11401 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11402 fillRule: "evenodd", 11403 clipRule: "evenodd", 11404 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" 11405 }) 11406 }); 11407 /* harmony default export */ const library_background = (background); 11408 11409 ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js 11410 /** 11411 * WordPress dependencies 11412 */ 11413 11414 11415 const shadow = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11416 viewBox: "0 0 24 24", 11417 xmlns: "http://www.w3.org/2000/svg", 11418 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11419 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" 11420 }) 11421 }); 11422 /* harmony default export */ const library_shadow = (shadow); 11423 11424 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js 11425 /** 11426 * WordPress dependencies 11427 */ 11428 11429 11430 11431 11432 11433 /** 11434 * Internal dependencies 11435 */ 11436 11437 11438 11439 const { 11440 useHasDimensionsPanel, 11441 useHasTypographyPanel, 11442 useHasColorPanel, 11443 useGlobalSetting: root_menu_useGlobalSetting, 11444 useSettingsForBlockElement, 11445 useHasBackgroundPanel 11446 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11447 function RootMenu() { 11448 const [rawSettings] = root_menu_useGlobalSetting(''); 11449 const settings = useSettingsForBlockElement(rawSettings); 11450 /* 11451 * Use the raw settings to determine if the background panel should be displayed, 11452 * as the background panel is not dependent on the block element settings. 11453 */ 11454 const hasBackgroundPanel = useHasBackgroundPanel(rawSettings); 11455 const hasTypographyPanel = useHasTypographyPanel(settings); 11456 const hasColorPanel = useHasColorPanel(settings); 11457 const hasShadowPanel = true; // useHasShadowPanel( settings ); 11458 const hasDimensionsPanel = useHasDimensionsPanel(settings); 11459 const hasLayoutPanel = hasDimensionsPanel; 11460 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11461 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 11462 children: [hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11463 icon: library_typography, 11464 path: "/typography", 11465 children: (0,external_wp_i18n_namespaceObject.__)('Typography') 11466 }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11467 icon: library_color, 11468 path: "/colors", 11469 children: (0,external_wp_i18n_namespaceObject.__)('Colors') 11470 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11471 icon: library_background, 11472 path: "/background", 11473 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Background styles'), 11474 children: (0,external_wp_i18n_namespaceObject.__)('Background') 11475 }), hasShadowPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11476 icon: library_shadow, 11477 path: "/shadows", 11478 children: (0,external_wp_i18n_namespaceObject.__)('Shadows') 11479 }), hasLayoutPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11480 icon: library_layout, 11481 path: "/layout", 11482 children: (0,external_wp_i18n_namespaceObject.__)('Layout') 11483 })] 11484 }) 11485 }); 11486 } 11487 /* harmony default export */ const root_menu = (RootMenu); 11488 11489 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js 11490 /* wp:polyfill */ 11491 function findNearest(input, numbers) { 11492 // If the numbers array is empty, return null 11493 if (numbers.length === 0) { 11494 return null; 11495 } 11496 // Sort the array based on the absolute difference with the input 11497 numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b)); 11498 // Return the first element (which will be the nearest) from the sorted array 11499 return numbers[0]; 11500 } 11501 function extractFontWeights(fontFaces) { 11502 const result = []; 11503 fontFaces.forEach(face => { 11504 const weights = String(face.fontWeight).split(' '); 11505 if (weights.length === 2) { 11506 const start = parseInt(weights[0]); 11507 const end = parseInt(weights[1]); 11508 for (let i = start; i <= end; i += 100) { 11509 result.push(i); 11510 } 11511 } else if (weights.length === 1) { 11512 result.push(parseInt(weights[0])); 11513 } 11514 }); 11515 return result; 11516 } 11517 11518 /* 11519 * Format the font family to use in the CSS font-family property of a CSS rule. 11520 * 11521 * The input can be a string with the font family name or a string with multiple font family names separated by commas. 11522 * It follows the recommendations from the CSS Fonts Module Level 4. 11523 * https://www.w3.org/TR/css-fonts-4/#font-family-prop 11524 * 11525 * @param {string} input - The font family. 11526 * @return {string} The formatted font family. 11527 * 11528 * Example: 11529 * formatFontFamily( "Open Sans, Font+Name, sans-serif" ) => '"Open Sans", "Font+Name", sans-serif' 11530 * formatFontFamily( "'Open Sans', generic(kai), sans-serif" ) => '"Open Sans", sans-serif' 11531 * formatFontFamily( "DotGothic16, Slabo 27px, serif" ) => '"DotGothic16","Slabo 27px",serif' 11532 * formatFontFamily( "Mine's, Moe's Typography" ) => `"mine's","Moe's Typography"` 11533 */ 11534 function formatFontFamily(input) { 11535 // Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens). 11536 const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; 11537 const output = input.trim(); 11538 const formatItem = item => { 11539 item = item.trim(); 11540 if (item.match(regex)) { 11541 // removes leading and trailing quotes. 11542 item = item.replace(/^["']|["']$/g, ''); 11543 return `"$item}"`; 11544 } 11545 return item; 11546 }; 11547 if (output.includes(',')) { 11548 return output.split(',').map(formatItem).filter(item => item !== '').join(', '); 11549 } 11550 return formatItem(output); 11551 } 11552 11553 /* 11554 * Format the font face name to use in the font-family property of a font face. 11555 * 11556 * The input can be a string with the font face name or a string with multiple font face names separated by commas. 11557 * It removes the leading and trailing quotes from the font face name. 11558 * 11559 * @param {string} input - The font face name. 11560 * @return {string} The formatted font face name. 11561 * 11562 * Example: 11563 * formatFontFaceName("Open Sans") => "Open Sans" 11564 * formatFontFaceName("'Open Sans', sans-serif") => "Open Sans" 11565 * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans" 11566 */ 11567 function formatFontFaceName(input) { 11568 if (!input) { 11569 return ''; 11570 } 11571 let output = input.trim(); 11572 if (output.includes(',')) { 11573 output = output.split(',') 11574 // finds the first item that is not an empty string. 11575 .find(item => item.trim() !== '').trim(); 11576 } 11577 // removes leading and trailing quotes. 11578 output = output.replace(/^["']|["']$/g, ''); 11579 11580 // Firefox needs the font name to be wrapped in double quotes meanwhile other browsers don't. 11581 if (window.navigator.userAgent.toLowerCase().includes('firefox')) { 11582 output = `"$output}"`; 11583 } 11584 return output; 11585 } 11586 function getFamilyPreviewStyle(family) { 11587 const style = { 11588 fontFamily: formatFontFamily(family.fontFamily) 11589 }; 11590 if (!Array.isArray(family.fontFace)) { 11591 style.fontWeight = '400'; 11592 style.fontStyle = 'normal'; 11593 return style; 11594 } 11595 if (family.fontFace) { 11596 //get all the font faces with normal style 11597 const normalFaces = family.fontFace.filter(face => face?.fontStyle && face.fontStyle.toLowerCase() === 'normal'); 11598 if (normalFaces.length > 0) { 11599 style.fontStyle = 'normal'; 11600 const normalWeights = extractFontWeights(normalFaces); 11601 const nearestWeight = findNearest(400, normalWeights); 11602 style.fontWeight = String(nearestWeight) || '400'; 11603 } else { 11604 style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || 'normal'; 11605 style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || '400'; 11606 } 11607 } 11608 return style; 11609 } 11610 function getFacePreviewStyle(face) { 11611 return { 11612 fontFamily: formatFontFamily(face.fontFamily), 11613 fontStyle: face.fontStyle || 'normal', 11614 fontWeight: face.fontWeight || '400' 11615 }; 11616 } 11617 11618 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js 11619 /* wp:polyfill */ 11620 /** 11621 * 11622 * @param {string} variation The variation name. 11623 * 11624 * @return {string} The variation class name. 11625 */ 11626 function getVariationClassName(variation) { 11627 if (!variation) { 11628 return ''; 11629 } 11630 return `is-style-$variation}`; 11631 } 11632 11633 /** 11634 * Iterates through the presets array and searches for slugs that start with the specified 11635 * slugPrefix followed by a numerical suffix. It identifies the highest numerical suffix found 11636 * and returns one greater than the highest found suffix, ensuring that the new index is unique. 11637 * 11638 * @param {Array} presets The array of preset objects, each potentially containing a slug property. 11639 * @param {string} slugPrefix The prefix to look for in the preset slugs. 11640 * 11641 * @return {number} The next available index for a preset with the specified slug prefix, or 1 if no matching slugs are found. 11642 */ 11643 function getNewIndexFromPresets(presets, slugPrefix) { 11644 const nameRegex = new RegExp(`^$slugPrefix}([\\d]+)$`); 11645 const highestPresetValue = presets.reduce((currentHighest, preset) => { 11646 if (typeof preset?.slug === 'string') { 11647 const matches = preset?.slug.match(nameRegex); 11648 if (matches) { 11649 const id = parseInt(matches[1], 10); 11650 if (id > currentHighest) { 11651 return id; 11652 } 11653 } 11654 } 11655 return currentHighest; 11656 }, 0); 11657 return highestPresetValue + 1; 11658 } 11659 function getFontFamilyFromSetting(fontFamilies, setting) { 11660 if (!Array.isArray(fontFamilies) || !setting) { 11661 return null; 11662 } 11663 const fontFamilyVariable = setting.replace('var(', '').replace(')', ''); 11664 const fontFamilySlug = fontFamilyVariable?.split('--').slice(-1)[0]; 11665 return fontFamilies.find(fontFamily => fontFamily.slug === fontFamilySlug); 11666 } 11667 function getFontFamilies(themeJson) { 11668 const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; 11669 const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; 11670 let fontFamilies = []; 11671 if (themeFontFamilies && customFontFamilies) { 11672 fontFamilies = [...themeFontFamilies, ...customFontFamilies]; 11673 } else if (themeFontFamilies) { 11674 fontFamilies = themeFontFamilies; 11675 } else if (customFontFamilies) { 11676 fontFamilies = customFontFamilies; 11677 } 11678 const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; 11679 const bodyFontFamily = getFontFamilyFromSetting(fontFamilies, bodyFontFamilySetting); 11680 const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; 11681 let headingFontFamily; 11682 if (!headingFontFamilySetting) { 11683 headingFontFamily = bodyFontFamily; 11684 } else { 11685 headingFontFamily = getFontFamilyFromSetting(fontFamilies, themeJson?.styles?.elements?.heading?.typography?.fontFamily); 11686 } 11687 return [bodyFontFamily, headingFontFamily]; 11688 } 11689 11690 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js 11691 /** 11692 * WordPress dependencies 11693 */ 11694 11695 11696 11697 11698 11699 11700 /** 11701 * Internal dependencies 11702 */ 11703 11704 11705 11706 11707 const { 11708 useGlobalStyle: typography_example_useGlobalStyle, 11709 GlobalStylesContext: typography_example_GlobalStylesContext 11710 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11711 const { 11712 mergeBaseAndUserConfigs 11713 } = unlock(external_wp_editor_namespaceObject.privateApis); 11714 function PreviewTypography({ 11715 fontSize, 11716 variation 11717 }) { 11718 const { 11719 base 11720 } = (0,external_wp_element_namespaceObject.useContext)(typography_example_GlobalStylesContext); 11721 let config = base; 11722 if (variation) { 11723 config = mergeBaseAndUserConfigs(base, variation); 11724 } 11725 const [textColor] = typography_example_useGlobalStyle('color.text'); 11726 const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config); 11727 const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; 11728 const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; 11729 if (textColor) { 11730 bodyPreviewStyle.color = textColor; 11731 headingPreviewStyle.color = textColor; 11732 } 11733 if (fontSize) { 11734 bodyPreviewStyle.fontSize = fontSize; 11735 headingPreviewStyle.fontSize = fontSize; 11736 } 11737 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 11738 animate: { 11739 scale: 1, 11740 opacity: 1 11741 }, 11742 initial: { 11743 scale: 0.1, 11744 opacity: 0 11745 }, 11746 transition: { 11747 delay: 0.3, 11748 type: 'tween' 11749 }, 11750 style: { 11751 textAlign: 'center', 11752 lineHeight: 1 11753 }, 11754 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 11755 style: headingPreviewStyle, 11756 children: (0,external_wp_i18n_namespaceObject._x)('A', 'Uppercase letter A') 11757 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 11758 style: bodyPreviewStyle, 11759 children: (0,external_wp_i18n_namespaceObject._x)('a', 'Lowercase letter A') 11760 })] 11761 }); 11762 } 11763 11764 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js 11765 /* wp:polyfill */ 11766 /** 11767 * WordPress dependencies 11768 */ 11769 11770 11771 /** 11772 * Internal dependencies 11773 */ 11774 11775 11776 function HighlightedColors({ 11777 normalizedColorSwatchSize, 11778 ratio 11779 }) { 11780 const { 11781 highlightedColors 11782 } = useStylesPreviewColors(); 11783 const scaledSwatchSize = normalizedColorSwatchSize * ratio; 11784 return highlightedColors.map(({ 11785 slug, 11786 color 11787 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11788 style: { 11789 height: scaledSwatchSize, 11790 width: scaledSwatchSize, 11791 background: color, 11792 borderRadius: scaledSwatchSize / 2 11793 }, 11794 animate: { 11795 scale: 1, 11796 opacity: 1 11797 }, 11798 initial: { 11799 scale: 0.1, 11800 opacity: 0 11801 }, 11802 transition: { 11803 delay: index === 1 ? 0.2 : 0.1 11804 } 11805 }, `$slug}-$index}`)); 11806 } 11807 11808 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-wrapper.js 11809 /* wp:polyfill */ 11810 /** 11811 * WordPress dependencies 11812 */ 11813 11814 11815 11816 11817 11818 /** 11819 * Internal dependencies 11820 */ 11821 11822 11823 const { 11824 useGlobalStyle: preview_wrapper_useGlobalStyle 11825 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11826 const normalizedWidth = 248; 11827 const normalizedHeight = 152; 11828 11829 // Throttle options for useThrottle. Must be defined outside of the component, 11830 // so that the object reference is the same on each render. 11831 const THROTTLE_OPTIONS = { 11832 leading: true, 11833 trailing: true 11834 }; 11835 function PreviewWrapper({ 11836 children, 11837 label, 11838 isFocused, 11839 withHoverView 11840 }) { 11841 const [backgroundColor = 'white'] = preview_wrapper_useGlobalStyle('color.background'); 11842 const [gradientValue] = preview_wrapper_useGlobalStyle('color.gradient'); 11843 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 11844 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 11845 const [containerResizeListener, { 11846 width 11847 }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 11848 const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_namespaceObject.useState)(width); 11849 const [ratioState, setRatioState] = (0,external_wp_element_namespaceObject.useState)(); 11850 const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(setThrottledWidthState, 250, THROTTLE_OPTIONS); 11851 11852 // Must use useLayoutEffect to avoid a flash of the container at the wrong 11853 // size before the width is set. 11854 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11855 if (width) { 11856 setThrottledWidth(width); 11857 } 11858 }, [width, setThrottledWidth]); 11859 11860 // Must use useLayoutEffect to avoid a flash of the container at the wrong 11861 // size before the width is set. 11862 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11863 const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; 11864 const ratioDiff = newRatio - (ratioState || 0); 11865 11866 // Only update the ratio state if the difference is big enough 11867 // or if the ratio state is not yet set. This is to avoid an 11868 // endless loop of updates at particular viewport heights when the 11869 // presence of a scrollbar causes the width to change slightly. 11870 const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; 11871 if (isRatioDiffBigEnough || !ratioState) { 11872 setRatioState(newRatio); 11873 } 11874 }, [throttledWidth, ratioState]); 11875 11876 // Set a fallbackRatio to use before the throttled ratio has been set. 11877 const fallbackRatio = width ? width / normalizedWidth : 1; 11878 /* 11879 * Use the throttled ratio if it has been calculated, otherwise 11880 * use the fallback ratio. The throttled ratio is used to avoid 11881 * an endless loop of updates at particular viewport heights. 11882 * See: https://github.com/WordPress/gutenberg/issues/55112 11883 */ 11884 const ratio = ratioState ? ratioState : fallbackRatio; 11885 const isReady = !!width; 11886 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11887 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11888 style: { 11889 position: 'relative' 11890 }, 11891 children: containerResizeListener 11892 }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11893 className: "edit-site-global-styles-preview__wrapper", 11894 style: { 11895 height: normalizedHeight * ratio 11896 }, 11897 onMouseEnter: () => setIsHovered(true), 11898 onMouseLeave: () => setIsHovered(false), 11899 tabIndex: -1, 11900 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11901 style: { 11902 height: normalizedHeight * ratio, 11903 width: '100%', 11904 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, 11905 cursor: withHoverView ? 'pointer' : undefined 11906 }, 11907 initial: "start", 11908 animate: (isHovered || isFocused) && !disableMotion && label ? 'hover' : 'start', 11909 children: [].concat(children) // This makes sure children is always an array. 11910 .map((child, key) => child({ 11911 ratio, 11912 key 11913 })) 11914 }) 11915 })] 11916 }); 11917 } 11918 11919 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js 11920 /* wp:polyfill */ 11921 /** 11922 * WordPress dependencies 11923 */ 11924 11925 11926 11927 /** 11928 * Internal dependencies 11929 */ 11930 11931 11932 11933 11934 11935 11936 const { 11937 useGlobalStyle: preview_styles_useGlobalStyle 11938 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11939 const firstFrameVariants = { 11940 start: { 11941 scale: 1, 11942 opacity: 1 11943 }, 11944 hover: { 11945 scale: 0, 11946 opacity: 0 11947 } 11948 }; 11949 const midFrameVariants = { 11950 hover: { 11951 opacity: 1 11952 }, 11953 start: { 11954 opacity: 0.5 11955 } 11956 }; 11957 const secondFrameVariants = { 11958 hover: { 11959 scale: 1, 11960 opacity: 1 11961 }, 11962 start: { 11963 scale: 0, 11964 opacity: 0 11965 } 11966 }; 11967 const PreviewStyles = ({ 11968 label, 11969 isFocused, 11970 withHoverView, 11971 variation 11972 }) => { 11973 const [fontWeight] = preview_styles_useGlobalStyle('typography.fontWeight'); 11974 const [fontFamily = 'serif'] = preview_styles_useGlobalStyle('typography.fontFamily'); 11975 const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle('elements.h1.typography.fontFamily'); 11976 const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle('elements.h1.typography.fontWeight'); 11977 const [textColor = 'black'] = preview_styles_useGlobalStyle('color.text'); 11978 const [headingColor = textColor] = preview_styles_useGlobalStyle('elements.h1.color.text'); 11979 const { 11980 paletteColors 11981 } = useStylesPreviewColors(); 11982 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewWrapper, { 11983 label: label, 11984 isFocused: isFocused, 11985 withHoverView: withHoverView, 11986 children: [({ 11987 ratio, 11988 key 11989 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11990 variants: firstFrameVariants, 11991 style: { 11992 height: '100%', 11993 overflow: 'hidden' 11994 }, 11995 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 11996 spacing: 10 * ratio, 11997 justify: "center", 11998 style: { 11999 height: '100%', 12000 overflow: 'hidden' 12001 }, 12002 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { 12003 fontSize: 65 * ratio, 12004 variation: variation 12005 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 12006 spacing: 4 * ratio, 12007 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HighlightedColors, { 12008 normalizedColorSwatchSize: 32, 12009 ratio: ratio 12010 }) 12011 })] 12012 }) 12013 }, key), ({ 12014 key 12015 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 12016 variants: withHoverView && midFrameVariants, 12017 style: { 12018 height: '100%', 12019 width: '100%', 12020 position: 'absolute', 12021 top: 0, 12022 overflow: 'hidden', 12023 filter: 'blur(60px)', 12024 opacity: 0.1 12025 }, 12026 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 12027 spacing: 0, 12028 justify: "flex-start", 12029 style: { 12030 height: '100%', 12031 overflow: 'hidden' 12032 }, 12033 children: paletteColors.slice(0, 4).map(({ 12034 color 12035 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12036 style: { 12037 height: '100%', 12038 background: color, 12039 flexGrow: 1 12040 } 12041 }, index)) 12042 }) 12043 }, key), ({ 12044 ratio, 12045 key 12046 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 12047 variants: secondFrameVariants, 12048 style: { 12049 height: '100%', 12050 width: '100%', 12051 overflow: 'hidden', 12052 position: 'absolute', 12053 top: 0 12054 }, 12055 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 12056 spacing: 3 * ratio, 12057 justify: "center", 12058 style: { 12059 height: '100%', 12060 overflow: 'hidden', 12061 padding: 10 * ratio, 12062 boxSizing: 'border-box' 12063 }, 12064 children: label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12065 style: { 12066 fontSize: 40 * ratio, 12067 fontFamily: headingFontFamily, 12068 color: headingColor, 12069 fontWeight: headingFontWeight, 12070 lineHeight: '1em', 12071 textAlign: 'center' 12072 }, 12073 children: label 12074 }) 12075 }) 12076 }, key)] 12077 }); 12078 }; 12079 /* harmony default export */ const preview_styles = (PreviewStyles); 12080 12081 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js 12082 /** 12083 * WordPress dependencies 12084 */ 12085 12086 12087 12088 12089 12090 12091 12092 /** 12093 * Internal dependencies 12094 */ 12095 12096 12097 12098 12099 12100 12101 const { 12102 useGlobalStyle: screen_root_useGlobalStyle 12103 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12104 function ScreenRoot() { 12105 const [customCSS] = screen_root_useGlobalStyle('css'); 12106 const { 12107 hasVariations, 12108 canEditCSS 12109 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12110 const { 12111 getEntityRecord, 12112 __experimentalGetCurrentGlobalStylesId, 12113 __experimentalGetCurrentThemeGlobalStylesVariations 12114 } = select(external_wp_coreData_namespaceObject.store); 12115 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 12116 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 12117 return { 12118 hasVariations: !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length, 12119 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 12120 }; 12121 }, []); 12122 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { 12123 size: "small", 12124 className: "edit-site-global-styles-screen-root", 12125 isRounded: false, 12126 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { 12127 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12128 spacing: 4, 12129 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 12130 className: "edit-site-global-styles-screen-root__active-style-tile", 12131 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, { 12132 className: "edit-site-global-styles-screen-root__active-style-tile-preview", 12133 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, {}) 12134 }) 12135 }), hasVariations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12136 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12137 path: "/variations", 12138 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12139 justify: "space-between", 12140 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12141 children: (0,external_wp_i18n_namespaceObject.__)('Browse styles') 12142 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 12143 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 12144 })] 12145 }) 12146 }) 12147 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu, {})] 12148 }) 12149 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 12150 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12151 as: "p", 12152 paddingTop: 2 12153 /* 12154 * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border). 12155 * This is an ad hoc override for this instance and the Additional CSS option below. Other options for matching the 12156 * the nav button inset should be looked at before reusing further. 12157 */, 12158 paddingX: "13px", 12159 marginBottom: 4, 12160 children: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.') 12161 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12162 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12163 path: "/blocks", 12164 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12165 justify: "space-between", 12166 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12167 children: (0,external_wp_i18n_namespaceObject.__)('Blocks') 12168 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 12169 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 12170 })] 12171 }) 12172 }) 12173 })] 12174 }), canEditCSS && !!customCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12175 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 12176 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12177 as: "p", 12178 paddingTop: 2, 12179 paddingX: "13px", 12180 marginBottom: 4, 12181 children: (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.') 12182 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12183 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12184 path: "/css", 12185 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12186 justify: "space-between", 12187 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12188 children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') 12189 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 12190 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 12191 })] 12192 }) 12193 }) 12194 })] 12195 })] 12196 })] 12197 }); 12198 } 12199 /* harmony default export */ const screen_root = (ScreenRoot); 12200 12201 ;// external ["wp","a11y"] 12202 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 12203 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js 12204 /* wp:polyfill */ 12205 /** 12206 * WordPress dependencies 12207 */ 12208 12209 12210 12211 12212 12213 /** 12214 * Internal dependencies 12215 */ 12216 12217 12218 12219 const { 12220 useGlobalStyle: variations_panel_useGlobalStyle 12221 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12222 12223 // Only core block styles (source === block) or block styles with a matching 12224 // theme.json style variation will be configurable via Global Styles. 12225 function getFilteredBlockStyles(blockStyles, variations) { 12226 return blockStyles?.filter(style => style.source === 'block' || variations.includes(style.name)); 12227 } 12228 function useBlockVariations(name) { 12229 const blockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { 12230 const { 12231 getBlockStyles 12232 } = select(external_wp_blocks_namespaceObject.store); 12233 return getBlockStyles(name); 12234 }, [name]); 12235 const [variations] = variations_panel_useGlobalStyle('variations', name); 12236 const variationNames = Object.keys(variations !== null && variations !== void 0 ? variations : {}); 12237 return getFilteredBlockStyles(blockStyles, variationNames); 12238 } 12239 function VariationsPanel({ 12240 name 12241 }) { 12242 const coreBlockStyles = useBlockVariations(name); 12243 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12244 isBordered: true, 12245 isSeparated: true, 12246 children: coreBlockStyles.map((style, index) => { 12247 if (style?.isDefault) { 12248 return null; 12249 } 12250 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12251 path: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(style.name), 12252 children: style.label 12253 }, index); 12254 }) 12255 }); 12256 } 12257 12258 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js 12259 /** 12260 * WordPress dependencies 12261 */ 12262 12263 12264 12265 12266 function ScreenHeader({ 12267 title, 12268 description, 12269 onBack 12270 }) { 12271 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12272 spacing: 0, 12273 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 12274 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12275 marginBottom: 0, 12276 paddingX: 4, 12277 paddingY: 3, 12278 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12279 spacing: 2, 12280 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { 12281 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 12282 size: "small", 12283 label: (0,external_wp_i18n_namespaceObject.__)('Back'), 12284 onClick: onBack 12285 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12286 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 12287 className: "edit-site-global-styles-header", 12288 level: 2, 12289 size: 13, 12290 children: title 12291 }) 12292 })] 12293 }) 12294 }) 12295 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12296 className: "edit-site-global-styles-header__description", 12297 children: description 12298 })] 12299 }); 12300 } 12301 /* harmony default export */ const header = (ScreenHeader); 12302 12303 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js 12304 /* wp:polyfill */ 12305 /** 12306 * WordPress dependencies 12307 */ 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 /** 12318 * Internal dependencies 12319 */ 12320 12321 12322 12323 12324 12325 const { 12326 useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel, 12327 useHasTypographyPanel: screen_block_list_useHasTypographyPanel, 12328 useHasBorderPanel, 12329 useGlobalSetting: screen_block_list_useGlobalSetting, 12330 useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement, 12331 useHasColorPanel: screen_block_list_useHasColorPanel 12332 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12333 function useSortedBlockTypes() { 12334 const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); 12335 // Ensure core blocks are prioritized in the returned results, 12336 // because third party blocks can be registered earlier than 12337 // the core blocks (usually by using the `init` action), 12338 // thus affecting the display order. 12339 // We don't sort reusable blocks as they are handled differently. 12340 const groupByType = (blocks, block) => { 12341 const { 12342 core, 12343 noncore 12344 } = blocks; 12345 const type = block.name.startsWith('core/') ? core : noncore; 12346 type.push(block); 12347 return blocks; 12348 }; 12349 const { 12350 core: coreItems, 12351 noncore: nonCoreItems 12352 } = blockItems.reduce(groupByType, { 12353 core: [], 12354 noncore: [] 12355 }); 12356 return [...coreItems, ...nonCoreItems]; 12357 } 12358 function useBlockHasGlobalStyles(blockName) { 12359 const [rawSettings] = screen_block_list_useGlobalSetting('', blockName); 12360 const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName); 12361 const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings); 12362 const hasColorPanel = screen_block_list_useHasColorPanel(settings); 12363 const hasBorderPanel = useHasBorderPanel(settings); 12364 const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings); 12365 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 12366 const hasVariationsPanel = !!useBlockVariations(blockName)?.length; 12367 const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel; 12368 return hasGlobalStyles; 12369 } 12370 function BlockMenuItem({ 12371 block 12372 }) { 12373 const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); 12374 if (!hasBlockMenuItem) { 12375 return null; 12376 } 12377 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12378 path: '/blocks/' + encodeURIComponent(block.name), 12379 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12380 justify: "flex-start", 12381 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 12382 icon: block.icon 12383 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12384 children: block.title 12385 })] 12386 }) 12387 }); 12388 } 12389 function BlockList({ 12390 filterValue 12391 }) { 12392 const sortedBlockTypes = useSortedBlockTypes(); 12393 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 12394 const { 12395 isMatchingSearchTerm 12396 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 12397 const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue)); 12398 const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); 12399 12400 // Announce search results on change 12401 (0,external_wp_element_namespaceObject.useEffect)(() => { 12402 if (!filterValue) { 12403 return; 12404 } 12405 // We extract the results from the wrapper div's `ref` because 12406 // filtered items can contain items that will eventually not 12407 // render and there is no reliable way to detect when a child 12408 // will return `null`. 12409 // TODO: We should find a better way of handling this as it's 12410 // fragile and depends on the number of rendered elements of `BlockMenuItem`, 12411 // which is now one. 12412 // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116 12413 const count = blockTypesListRef.current.childElementCount; 12414 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ 12415 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); 12416 debouncedSpeak(resultsFoundMessage, count); 12417 }, [filterValue, debouncedSpeak]); 12418 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12419 ref: blockTypesListRef, 12420 className: "edit-site-block-types-item-list", 12421 children: filteredBlockTypes.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMenuItem, { 12422 block: block 12423 }, 'menu-itemblock-' + block.name)) 12424 }); 12425 } 12426 const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList); 12427 function ScreenBlockList() { 12428 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); 12429 const deferredFilterValue = (0,external_wp_element_namespaceObject.useDeferredValue)(filterValue); 12430 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12431 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 12432 title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), 12433 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.') 12434 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 12435 __nextHasNoMarginBottom: true, 12436 className: "edit-site-block-types-search", 12437 onChange: setFilterValue, 12438 value: filterValue, 12439 label: (0,external_wp_i18n_namespaceObject.__)('Search'), 12440 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') 12441 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { 12442 filterValue: deferredFilterValue 12443 })] 12444 }); 12445 } 12446 /* harmony default export */ const screen_block_list = (ScreenBlockList); 12447 12448 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js 12449 /** 12450 * WordPress dependencies 12451 */ 12452 12453 12454 12455 12456 12457 /** 12458 * Internal dependencies 12459 */ 12460 12461 12462 const BlockPreviewPanel = ({ 12463 name, 12464 variation = '' 12465 }) => { 12466 var _blockExample$viewpor; 12467 const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example; 12468 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 12469 if (!blockExample) { 12470 return null; 12471 } 12472 const example = { 12473 ...blockExample, 12474 attributes: { 12475 ...blockExample.attributes, 12476 style: undefined, 12477 className: variation ? getVariationClassName(variation) : blockExample.attributes?.className 12478 } 12479 }; 12480 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example); 12481 }, [name, blockExample, variation]); 12482 const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : 500; 12483 // Same as height of InserterPreviewPanel. 12484 const previewHeight = 144; 12485 const sidebarWidth = 235; 12486 const scale = sidebarWidth / viewportWidth; 12487 const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; 12488 if (!blockExample) { 12489 return null; 12490 } 12491 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12492 marginX: 4, 12493 marginBottom: 4, 12494 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12495 className: "edit-site-global-styles__block-preview-panel", 12496 style: { 12497 maxHeight: previewHeight, 12498 boxSizing: 'initial' 12499 }, 12500 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 12501 blocks: blocks, 12502 viewportWidth: viewportWidth, 12503 minHeight: previewHeight, 12504 additionalStyles: 12505 //We want this CSS to be in sync with the one in InserterPreviewPanel. 12506 [{ 12507 css: ` 12508 body{ 12509 padding: 24px; 12510 min-height:$Math.round(minHeight)}px; 12511 display:flex; 12512 align-items:center; 12513 } 12514 .is-root-container { width: 100%; } 12515 ` 12516 }] 12517 }) 12518 }) 12519 }); 12520 }; 12521 /* harmony default export */ const block_preview_panel = (BlockPreviewPanel); 12522 12523 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js 12524 /** 12525 * WordPress dependencies 12526 */ 12527 12528 12529 function Subtitle({ 12530 children, 12531 level 12532 }) { 12533 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 12534 className: "edit-site-global-styles-subtitle", 12535 level: level !== null && level !== void 0 ? level : 2, 12536 children: children 12537 }); 12538 } 12539 /* harmony default export */ const subtitle = (Subtitle); 12540 12541 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js 12542 /* wp:polyfill */ 12543 /** 12544 * WordPress dependencies 12545 */ 12546 12547 12548 12549 12550 12551 12552 12553 12554 /** 12555 * Internal dependencies 12556 */ 12557 12558 12559 12560 12561 12562 12563 // Initial control values. 12564 12565 const BACKGROUND_BLOCK_DEFAULT_VALUES = { 12566 backgroundSize: 'cover', 12567 backgroundPosition: '50% 50%' // used only when backgroundSize is 'contain'. 12568 }; 12569 function applyFallbackStyle(border) { 12570 if (!border) { 12571 return border; 12572 } 12573 const hasColorOrWidth = border.color || border.width; 12574 if (!border.style && hasColorOrWidth) { 12575 return { 12576 ...border, 12577 style: 'solid' 12578 }; 12579 } 12580 if (border.style && !hasColorOrWidth) { 12581 return undefined; 12582 } 12583 return border; 12584 } 12585 function applyAllFallbackStyles(border) { 12586 if (!border) { 12587 return border; 12588 } 12589 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) { 12590 return { 12591 top: applyFallbackStyle(border.top), 12592 right: applyFallbackStyle(border.right), 12593 bottom: applyFallbackStyle(border.bottom), 12594 left: applyFallbackStyle(border.left) 12595 }; 12596 } 12597 return applyFallbackStyle(border); 12598 } 12599 const { 12600 useHasDimensionsPanel: screen_block_useHasDimensionsPanel, 12601 useHasTypographyPanel: screen_block_useHasTypographyPanel, 12602 useHasBorderPanel: screen_block_useHasBorderPanel, 12603 useGlobalSetting: screen_block_useGlobalSetting, 12604 useSettingsForBlockElement: screen_block_useSettingsForBlockElement, 12605 useHasColorPanel: screen_block_useHasColorPanel, 12606 useHasFiltersPanel, 12607 useHasImageSettingsPanel, 12608 useGlobalStyle: screen_block_useGlobalStyle, 12609 useHasBackgroundPanel: screen_block_useHasBackgroundPanel, 12610 BackgroundPanel: StylesBackgroundPanel, 12611 BorderPanel: StylesBorderPanel, 12612 ColorPanel: StylesColorPanel, 12613 TypographyPanel: StylesTypographyPanel, 12614 DimensionsPanel: StylesDimensionsPanel, 12615 FiltersPanel: StylesFiltersPanel, 12616 ImageSettingsPanel, 12617 AdvancedPanel: StylesAdvancedPanel 12618 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12619 function ScreenBlock({ 12620 name, 12621 variation 12622 }) { 12623 let prefixParts = []; 12624 if (variation) { 12625 prefixParts = ['variations', variation].concat(prefixParts); 12626 } 12627 const prefix = prefixParts.join('.'); 12628 const [style] = screen_block_useGlobalStyle(prefix, name, 'user', { 12629 shouldDecodeEncode: false 12630 }); 12631 const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, 'all', { 12632 shouldDecodeEncode: false 12633 }); 12634 const [userSettings] = screen_block_useGlobalSetting('', name, 'user'); 12635 const [rawSettings, setSettings] = screen_block_useGlobalSetting('', name); 12636 const settingsForBlockElement = screen_block_useSettingsForBlockElement(rawSettings, name); 12637 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 12638 12639 // Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied. 12640 let disableBlockGap = false; 12641 if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) { 12642 disableBlockGap = true; 12643 } 12644 12645 // Only allow `aspectRatio` support if the block is not the grouping block. 12646 // The grouping block allows the user to use Group, Row and Stack variations, 12647 // and it is highly likely that the user will not want to set an aspect ratio 12648 // for all three at once. Until there is the ability to set a different aspect 12649 // ratio for each variation, we disable the aspect ratio controls for the 12650 // grouping block in global styles. 12651 let disableAspectRatio = false; 12652 if (settingsForBlockElement?.dimensions?.aspectRatio && name === 'core/group') { 12653 disableAspectRatio = true; 12654 } 12655 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { 12656 const updatedSettings = structuredClone(settingsForBlockElement); 12657 if (disableBlockGap) { 12658 updatedSettings.spacing.blockGap = false; 12659 } 12660 if (disableAspectRatio) { 12661 updatedSettings.dimensions.aspectRatio = false; 12662 } 12663 return updatedSettings; 12664 }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]); 12665 const blockVariations = useBlockVariations(name); 12666 const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings); 12667 const hasTypographyPanel = screen_block_useHasTypographyPanel(settings); 12668 const hasColorPanel = screen_block_useHasColorPanel(settings); 12669 const hasBorderPanel = screen_block_useHasBorderPanel(settings); 12670 const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings); 12671 const hasFiltersPanel = useHasFiltersPanel(settings); 12672 const hasImageSettingsPanel = useHasImageSettingsPanel(name, userSettings, settings); 12673 const hasVariationsPanel = !!blockVariations?.length && !variation; 12674 const { 12675 canEditCSS 12676 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12677 const { 12678 getEntityRecord, 12679 __experimentalGetCurrentGlobalStylesId 12680 } = select(external_wp_coreData_namespaceObject.store); 12681 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 12682 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 12683 return { 12684 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 12685 }; 12686 }, []); 12687 const currentBlockStyle = variation ? blockVariations.find(s => s.name === variation) : null; 12688 12689 // These intermediary objects are needed because the "layout" property is stored 12690 // in settings rather than styles. 12691 const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 12692 return { 12693 ...inheritedStyle, 12694 layout: settings.layout 12695 }; 12696 }, [inheritedStyle, settings.layout]); 12697 const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 12698 return { 12699 ...style, 12700 layout: userSettings.layout 12701 }; 12702 }, [style, userSettings.layout]); 12703 const onChangeDimensions = newStyle => { 12704 const updatedStyle = { 12705 ...newStyle 12706 }; 12707 delete updatedStyle.layout; 12708 setStyle(updatedStyle); 12709 if (newStyle.layout !== userSettings.layout) { 12710 setSettings({ 12711 ...userSettings, 12712 layout: newStyle.layout 12713 }); 12714 } 12715 }; 12716 const onChangeLightbox = newSetting => { 12717 // If the newSetting is undefined, this means that the user has deselected 12718 // (reset) the lightbox setting. 12719 if (newSetting === undefined) { 12720 setSettings({ 12721 ...rawSettings, 12722 lightbox: undefined 12723 }); 12724 12725 // Otherwise, we simply set the lightbox setting to the new value but 12726 // taking care of not overriding the other lightbox settings. 12727 } else { 12728 setSettings({ 12729 ...rawSettings, 12730 lightbox: { 12731 ...rawSettings.lightbox, 12732 ...newSetting 12733 } 12734 }); 12735 } 12736 }; 12737 const onChangeBorders = newStyle => { 12738 if (!newStyle?.border) { 12739 setStyle(newStyle); 12740 return; 12741 } 12742 12743 // As Global Styles can't conditionally generate styles based on if 12744 // other style properties have been set, we need to force split 12745 // border definitions for user set global border styles. Border 12746 // radius is derived from the same property i.e. `border.radius` if 12747 // it is a string that is used. The longhand border radii styles are 12748 // only generated if that property is an object. 12749 // 12750 // For borders (color, style, and width) those are all properties on 12751 // the `border` style property. This means if the theme.json defined 12752 // split borders and the user condenses them into a flat border or 12753 // vice-versa we'd get both sets of styles which would conflict. 12754 const { 12755 radius, 12756 ...newBorder 12757 } = newStyle.border; 12758 const border = applyAllFallbackStyles(newBorder); 12759 const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? { 12760 top: border, 12761 right: border, 12762 bottom: border, 12763 left: border 12764 } : { 12765 color: null, 12766 style: null, 12767 width: null, 12768 ...border 12769 }; 12770 setStyle({ 12771 ...newStyle, 12772 border: { 12773 ...updatedBorder, 12774 radius 12775 } 12776 }); 12777 }; 12778 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12779 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 12780 title: variation ? currentBlockStyle?.label : blockType.title 12781 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel, { 12782 name: name, 12783 variation: variation 12784 }), hasVariationsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12785 className: "edit-site-global-styles-screen-variations", 12786 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12787 spacing: 3, 12788 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 12789 children: (0,external_wp_i18n_namespaceObject.__)('Style Variations') 12790 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { 12791 name: name 12792 })] 12793 }) 12794 }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesColorPanel, { 12795 inheritedValue: inheritedStyle, 12796 value: style, 12797 onChange: setStyle, 12798 settings: settings 12799 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBackgroundPanel, { 12800 inheritedValue: inheritedStyle, 12801 value: style, 12802 onChange: setStyle, 12803 settings: settings, 12804 defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES 12805 }), hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesTypographyPanel, { 12806 inheritedValue: inheritedStyle, 12807 value: style, 12808 onChange: setStyle, 12809 settings: settings 12810 }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesDimensionsPanel, { 12811 inheritedValue: inheritedStyleWithLayout, 12812 value: styleWithLayout, 12813 onChange: onChangeDimensions, 12814 settings: settings, 12815 includeLayoutControls: true 12816 }), hasBorderPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBorderPanel, { 12817 inheritedValue: inheritedStyle, 12818 value: style, 12819 onChange: onChangeBorders, 12820 settings: settings 12821 }), hasFiltersPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesFiltersPanel, { 12822 inheritedValue: inheritedStyleWithLayout, 12823 value: styleWithLayout, 12824 onChange: setStyle, 12825 settings: settings, 12826 includeLayoutControls: true 12827 }), hasImageSettingsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageSettingsPanel, { 12828 onChange: onChangeLightbox, 12829 value: userSettings, 12830 inheritedValue: settings 12831 }), canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 12832 title: (0,external_wp_i18n_namespaceObject.__)('Advanced'), 12833 initialOpen: false, 12834 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12835 children: (0,external_wp_i18n_namespaceObject.sprintf)( 12836 // translators: %s: is the name of a block e.g., 'Image' or 'Table'. 12837 (0,external_wp_i18n_namespaceObject.__)('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.'), blockType?.title) 12838 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesAdvancedPanel, { 12839 value: style, 12840 onChange: setStyle, 12841 inheritedValue: inheritedStyle 12842 })] 12843 })] 12844 }); 12845 } 12846 /* harmony default export */ const screen_block = (ScreenBlock); 12847 12848 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js 12849 /** 12850 * WordPress dependencies 12851 */ 12852 12853 12854 12855 12856 /** 12857 * Internal dependencies 12858 */ 12859 12860 12861 12862 12863 const { 12864 useGlobalStyle: typography_elements_useGlobalStyle 12865 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12866 function ElementItem({ 12867 parentMenu, 12868 element, 12869 label 12870 }) { 12871 var _ref; 12872 const prefix = element === 'text' || !element ? '' : `elements.$element}.`; 12873 const extraStyles = element === 'link' ? { 12874 textDecoration: 'underline' 12875 } : {}; 12876 const [fontFamily] = typography_elements_useGlobalStyle(prefix + 'typography.fontFamily'); 12877 const [fontStyle] = typography_elements_useGlobalStyle(prefix + 'typography.fontStyle'); 12878 const [fontWeight] = typography_elements_useGlobalStyle(prefix + 'typography.fontWeight'); 12879 const [backgroundColor] = typography_elements_useGlobalStyle(prefix + 'color.background'); 12880 const [fallbackBackgroundColor] = typography_elements_useGlobalStyle('color.background'); 12881 const [gradientValue] = typography_elements_useGlobalStyle(prefix + 'color.gradient'); 12882 const [color] = typography_elements_useGlobalStyle(prefix + 'color.text'); 12883 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12884 path: parentMenu + '/typography/' + element, 12885 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12886 justify: "flex-start", 12887 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12888 className: "edit-site-global-styles-screen-typography__indicator", 12889 style: { 12890 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 12891 background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, 12892 color, 12893 fontStyle, 12894 fontWeight, 12895 ...extraStyles 12896 }, 12897 "aria-hidden": "true", 12898 children: (0,external_wp_i18n_namespaceObject.__)('Aa') 12899 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12900 children: label 12901 })] 12902 }) 12903 }); 12904 } 12905 function TypographyElements() { 12906 const parentMenu = ''; 12907 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12908 spacing: 3, 12909 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 12910 level: 3, 12911 children: (0,external_wp_i18n_namespaceObject.__)('Elements') 12912 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12913 isBordered: true, 12914 isSeparated: true, 12915 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12916 parentMenu: parentMenu, 12917 element: "text", 12918 label: (0,external_wp_i18n_namespaceObject.__)('Text') 12919 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12920 parentMenu: parentMenu, 12921 element: "link", 12922 label: (0,external_wp_i18n_namespaceObject.__)('Links') 12923 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12924 parentMenu: parentMenu, 12925 element: "heading", 12926 label: (0,external_wp_i18n_namespaceObject.__)('Headings') 12927 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12928 parentMenu: parentMenu, 12929 element: "caption", 12930 label: (0,external_wp_i18n_namespaceObject.__)('Captions') 12931 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12932 parentMenu: parentMenu, 12933 element: "button", 12934 label: (0,external_wp_i18n_namespaceObject.__)('Buttons') 12935 })] 12936 })] 12937 }); 12938 } 12939 /* harmony default export */ const typography_elements = (TypographyElements); 12940 12941 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js 12942 /** 12943 * WordPress dependencies 12944 */ 12945 12946 12947 /** 12948 * Internal dependencies 12949 */ 12950 12951 12952 12953 const StylesPreviewTypography = ({ 12954 variation, 12955 isFocused, 12956 withHoverView 12957 }) => { 12958 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewWrapper, { 12959 label: variation.title, 12960 isFocused: isFocused, 12961 withHoverView: withHoverView, 12962 children: ({ 12963 ratio, 12964 key 12965 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 12966 spacing: 10 * ratio, 12967 justify: "center", 12968 style: { 12969 height: '100%', 12970 overflow: 'hidden' 12971 }, 12972 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { 12973 variation: variation, 12974 fontSize: 85 * ratio 12975 }) 12976 }, key) 12977 }); 12978 }; 12979 /* harmony default export */ const preview_typography = (StylesPreviewTypography); 12980 12981 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js 12982 /* wp:polyfill */ 12983 /** 12984 * WordPress dependencies 12985 */ 12986 12987 12988 12989 12990 12991 12992 12993 /** 12994 * Internal dependencies 12995 */ 12996 12997 const use_theme_style_variations_by_property_EMPTY_ARRAY = []; 12998 const { 12999 GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, 13000 areGlobalStyleConfigsEqual 13001 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13002 const { 13003 mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs 13004 } = unlock(external_wp_editor_namespaceObject.privateApis); 13005 13006 /** 13007 * Removes all instances of properties from an object. 13008 * 13009 * @param {Object} object The object to remove the properties from. 13010 * @param {string[]} properties The properties to remove. 13011 * @return {Object} The modified object. 13012 */ 13013 function removePropertiesFromObject(object, properties) { 13014 if (!properties?.length) { 13015 return object; 13016 } 13017 if (typeof object !== 'object' || !object || !Object.keys(object).length) { 13018 return object; 13019 } 13020 for (const key in object) { 13021 if (properties.includes(key)) { 13022 delete object[key]; 13023 } else if (typeof object[key] === 'object') { 13024 removePropertiesFromObject(object[key], properties); 13025 } 13026 } 13027 return object; 13028 } 13029 13030 /** 13031 * Checks whether a style variation is empty. 13032 * 13033 * @param {Object} variation A style variation object. 13034 * @param {string} variation.title The title of the variation. 13035 * @param {Object} variation.settings The settings of the variation. 13036 * @param {Object} variation.styles The styles of the variation. 13037 * @return {boolean} Whether the variation is empty. 13038 */ 13039 function hasThemeVariation({ 13040 title, 13041 settings, 13042 styles 13043 }) { 13044 return title === (0,external_wp_i18n_namespaceObject.__)('Default') || 13045 // Always preserve the default variation. 13046 Object.keys(settings).length > 0 || Object.keys(styles).length > 0; 13047 } 13048 13049 /** 13050 * Fetches the current theme style variations that contain only the specified properties 13051 * and merges them with the user config. 13052 * 13053 * @param {string[]} properties The properties to filter by. 13054 * @return {Object[]|*} The merged object. 13055 */ 13056 function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { 13057 const { 13058 variationsFromTheme 13059 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13060 const _variationsFromTheme = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); 13061 return { 13062 variationsFromTheme: _variationsFromTheme || use_theme_style_variations_by_property_EMPTY_ARRAY 13063 }; 13064 }, []); 13065 const { 13066 user: userVariation 13067 } = (0,external_wp_element_namespaceObject.useContext)(use_theme_style_variations_by_property_GlobalStylesContext); 13068 const propertiesAsString = properties.toString(); 13069 return (0,external_wp_element_namespaceObject.useMemo)(() => { 13070 const clonedUserVariation = structuredClone(userVariation); 13071 13072 // Get user variation and remove the settings for the given property. 13073 const userVariationWithoutProperties = removePropertiesFromObject(clonedUserVariation, properties); 13074 userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)('Default'); 13075 const variationsWithPropertiesAndBase = variationsFromTheme.filter(variation => { 13076 return isVariationWithProperties(variation, properties); 13077 }).map(variation => { 13078 return use_theme_style_variations_by_property_mergeBaseAndUserConfigs(userVariationWithoutProperties, variation); 13079 }); 13080 const variationsByProperties = [userVariationWithoutProperties, ...variationsWithPropertiesAndBase]; 13081 13082 /* 13083 * Filter out variations with no settings or styles. 13084 */ 13085 return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; 13086 }, [propertiesAsString, userVariation, variationsFromTheme]); 13087 } 13088 13089 /** 13090 * Returns a new object, with properties specified in `properties` array., 13091 * maintain the original object tree structure. 13092 * The function is recursive, so it will perform a deep search for the given properties. 13093 * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`. 13094 * 13095 * @param {Object} object The object to filter 13096 * @param {string[]} properties The properties to filter by 13097 * @return {Object} The merged object. 13098 */ 13099 const filterObjectByProperties = (object, properties) => { 13100 if (!object || !properties?.length) { 13101 return {}; 13102 } 13103 const newObject = {}; 13104 Object.keys(object).forEach(key => { 13105 if (properties.includes(key)) { 13106 newObject[key] = object[key]; 13107 } else if (typeof object[key] === 'object') { 13108 const newFilter = filterObjectByProperties(object[key], properties); 13109 if (Object.keys(newFilter).length) { 13110 newObject[key] = newFilter; 13111 } 13112 } 13113 }); 13114 return newObject; 13115 }; 13116 13117 /** 13118 * Compares a style variation to the same variation filtered by the specified properties. 13119 * Returns true if the variation contains only the properties specified. 13120 * 13121 * @param {Object} variation The variation to compare. 13122 * @param {string[]} properties The properties to compare. 13123 * @return {boolean} Whether the variation contains only the specified properties. 13124 */ 13125 function isVariationWithProperties(variation, properties) { 13126 const variationWithProperties = filterObjectByProperties(structuredClone(variation), properties); 13127 return areGlobalStyleConfigsEqual(variationWithProperties, variation); 13128 } 13129 13130 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js 13131 /** 13132 * External dependencies 13133 */ 13134 13135 13136 /** 13137 * WordPress dependencies 13138 */ 13139 13140 13141 13142 13143 13144 13145 13146 /** 13147 * Internal dependencies 13148 */ 13149 13150 13151 13152 const { 13153 mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs 13154 } = unlock(external_wp_editor_namespaceObject.privateApis); 13155 const { 13156 GlobalStylesContext: variation_GlobalStylesContext, 13157 areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual 13158 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13159 function Variation({ 13160 variation, 13161 children, 13162 isPill, 13163 properties, 13164 showTooltip 13165 }) { 13166 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 13167 const { 13168 base, 13169 user, 13170 setUserConfig 13171 } = (0,external_wp_element_namespaceObject.useContext)(variation_GlobalStylesContext); 13172 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 13173 let merged = variation_mergeBaseAndUserConfigs(base, variation); 13174 if (properties) { 13175 merged = filterObjectByProperties(merged, properties); 13176 } 13177 return { 13178 user: variation, 13179 base, 13180 merged, 13181 setUserConfig: () => {} 13182 }; 13183 }, [variation, base, properties]); 13184 const selectVariation = () => setUserConfig(variation); 13185 const selectOnEnter = event => { 13186 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 13187 event.preventDefault(); 13188 selectVariation(); 13189 } 13190 }; 13191 const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => variation_areGlobalStyleConfigsEqual(user, variation), [user, variation]); 13192 let label = variation?.title; 13193 if (variation?.description) { 13194 label = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: variation title. 2: variation description. */ 13195 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'variation label'), variation?.title, variation?.description); 13196 } 13197 const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13198 className: dist_clsx('edit-site-global-styles-variations_item', { 13199 'is-active': isActive 13200 }), 13201 role: "button", 13202 onClick: selectVariation, 13203 onKeyDown: selectOnEnter, 13204 tabIndex: "0", 13205 "aria-label": label, 13206 "aria-current": isActive, 13207 onFocus: () => setIsFocused(true), 13208 onBlur: () => setIsFocused(false), 13209 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13210 className: dist_clsx('edit-site-global-styles-variations_item-preview', { 13211 'is-pill': isPill 13212 }), 13213 children: children(isFocused) 13214 }) 13215 }); 13216 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, { 13217 value: context, 13218 children: showTooltip ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 13219 text: variation?.title, 13220 children: content 13221 }) : content 13222 }); 13223 } 13224 13225 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js 13226 /* wp:polyfill */ 13227 /** 13228 * WordPress dependencies 13229 */ 13230 13231 13232 /** 13233 * Internal dependencies 13234 */ 13235 13236 13237 13238 13239 13240 function TypographyVariations({ 13241 title, 13242 gap = 2 13243 }) { 13244 const propertiesToFilter = ['typography']; 13245 const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 13246 13247 // Return null if there is only one variation (the default). 13248 if (typographyVariations?.length <= 1) { 13249 return null; 13250 } 13251 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 13252 spacing: 3, 13253 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 13254 level: 3, 13255 children: title 13256 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 13257 columns: 3, 13258 gap: gap, 13259 className: "edit-site-global-styles-style-variations-container", 13260 children: typographyVariations.map((variation, index) => { 13261 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 13262 variation: variation, 13263 properties: propertiesToFilter, 13264 showTooltip: true, 13265 children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_typography, { 13266 variation: variation 13267 }) 13268 }, index); 13269 }) 13270 })] 13271 }); 13272 } 13273 13274 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js 13275 /** 13276 * WordPress dependencies 13277 */ 13278 13279 13280 13281 13282 /** 13283 * Internal dependencies 13284 */ 13285 13286 13287 13288 function FontSizes() { 13289 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 13290 spacing: 2, 13291 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 13292 justify: "space-between", 13293 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 13294 level: 3, 13295 children: (0,external_wp_i18n_namespaceObject.__)('Font Sizes') 13296 }) 13297 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 13298 isBordered: true, 13299 isSeparated: true, 13300 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 13301 path: "/typography/font-sizes", 13302 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 13303 direction: "row", 13304 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 13305 children: (0,external_wp_i18n_namespaceObject.__)('Font size presets') 13306 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 13307 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 13308 })] 13309 }) 13310 }) 13311 })] 13312 }); 13313 } 13314 /* harmony default export */ const font_sizes_count = (FontSizes); 13315 13316 ;// ./node_modules/@wordpress/icons/build-module/library/settings.js 13317 /** 13318 * WordPress dependencies 13319 */ 13320 13321 13322 const settings_settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 13323 xmlns: "http://www.w3.org/2000/svg", 13324 viewBox: "0 0 24 24", 13325 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 13326 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" 13327 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 13328 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" 13329 })] 13330 }); 13331 /* harmony default export */ const library_settings = (settings_settings); 13332 13333 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js 13334 /** 13335 * WordPress dependencies 13336 */ 13337 13338 const FONT_FAMILIES_URL = '/wp/v2/font-families'; 13339 const FONT_COLLECTIONS_URL = '/wp/v2/font-collections'; 13340 async function fetchInstallFontFamily(data) { 13341 const config = { 13342 path: FONT_FAMILIES_URL, 13343 method: 'POST', 13344 body: data 13345 }; 13346 const response = await external_wp_apiFetch_default()(config); 13347 return { 13348 id: response.id, 13349 ...response.font_family_settings, 13350 fontFace: [] 13351 }; 13352 } 13353 async function fetchInstallFontFace(fontFamilyId, data) { 13354 const config = { 13355 path: `$FONT_FAMILIES_URL}/$fontFamilyId}/font-faces`, 13356 method: 'POST', 13357 body: data 13358 }; 13359 const response = await external_wp_apiFetch_default()(config); 13360 return { 13361 id: response.id, 13362 ...response.font_face_settings 13363 }; 13364 } 13365 async function fetchGetFontFamilyBySlug(slug) { 13366 const config = { 13367 path: `$FONT_FAMILIES_URL}?slug=$slug}&_embed=true`, 13368 method: 'GET' 13369 }; 13370 const response = await external_wp_apiFetch_default()(config); 13371 if (!response || response.length === 0) { 13372 return null; 13373 } 13374 const fontFamilyPost = response[0]; 13375 return { 13376 id: fontFamilyPost.id, 13377 ...fontFamilyPost.font_family_settings, 13378 fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] 13379 }; 13380 } 13381 async function fetchUninstallFontFamily(fontFamilyId) { 13382 const config = { 13383 path: `$FONT_FAMILIES_URL}/$fontFamilyId}?force=true`, 13384 method: 'DELETE' 13385 }; 13386 return await external_wp_apiFetch_default()(config); 13387 } 13388 async function fetchFontCollections() { 13389 const config = { 13390 path: `$FONT_COLLECTIONS_URL}?_fields=slug,name,description`, 13391 method: 'GET' 13392 }; 13393 return await external_wp_apiFetch_default()(config); 13394 } 13395 async function fetchFontCollection(id) { 13396 const config = { 13397 path: `$FONT_COLLECTIONS_URL}/$id}`, 13398 method: 'GET' 13399 }; 13400 return await external_wp_apiFetch_default()(config); 13401 } 13402 13403 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js 13404 /** 13405 * WordPress dependencies 13406 */ 13407 13408 const ALLOWED_FILE_EXTENSIONS = ['otf', 'ttf', 'woff', 'woff2']; 13409 const FONT_WEIGHTS = { 13410 100: (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'), 13411 200: (0,external_wp_i18n_namespaceObject._x)('Extra-light', 'font weight'), 13412 300: (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'), 13413 400: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font weight'), 13414 500: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'), 13415 600: (0,external_wp_i18n_namespaceObject._x)('Semi-bold', 'font weight'), 13416 700: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'), 13417 800: (0,external_wp_i18n_namespaceObject._x)('Extra-bold', 'font weight'), 13418 900: (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight') 13419 }; 13420 const FONT_STYLES = { 13421 normal: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font style'), 13422 italic: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style') 13423 }; 13424 13425 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js 13426 /* wp:polyfill */ 13427 /** 13428 * WordPress dependencies 13429 */ 13430 13431 13432 /** 13433 * Internal dependencies 13434 */ 13435 13436 13437 13438 13439 13440 /** 13441 * Browser dependencies 13442 */ 13443 const { 13444 File 13445 } = window; 13446 const { 13447 kebabCase 13448 } = unlock(external_wp_components_namespaceObject.privateApis); 13449 function setUIValuesNeeded(font, extraValues = {}) { 13450 if (!font.name && (font.fontFamily || font.slug)) { 13451 font.name = font.fontFamily || font.slug; 13452 } 13453 return { 13454 ...font, 13455 ...extraValues 13456 }; 13457 } 13458 function isUrlEncoded(url) { 13459 if (typeof url !== 'string') { 13460 return false; 13461 } 13462 return url !== decodeURIComponent(url); 13463 } 13464 function getFontFaceVariantName(face) { 13465 const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight; 13466 const styleName = face.fontStyle === 'normal' ? '' : FONT_STYLES[face.fontStyle] || face.fontStyle; 13467 return `$weightName} $styleName}`; 13468 } 13469 function mergeFontFaces(existing = [], incoming = []) { 13470 const map = new Map(); 13471 for (const face of existing) { 13472 map.set(`$face.fontWeight}$face.fontStyle}`, face); 13473 } 13474 for (const face of incoming) { 13475 // This will overwrite if the src already exists, keeping it unique. 13476 map.set(`$face.fontWeight}$face.fontStyle}`, face); 13477 } 13478 return Array.from(map.values()); 13479 } 13480 function mergeFontFamilies(existing = [], incoming = []) { 13481 const map = new Map(); 13482 // Add the existing array to the map. 13483 for (const font of existing) { 13484 map.set(font.slug, { 13485 ...font 13486 }); 13487 } 13488 // Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged. 13489 for (const font of incoming) { 13490 if (map.has(font.slug)) { 13491 const { 13492 fontFace: incomingFontFaces, 13493 ...restIncoming 13494 } = font; 13495 const existingFont = map.get(font.slug); 13496 // Merge the fontFaces existing with the incoming fontFaces. 13497 const mergedFontFaces = mergeFontFaces(existingFont.fontFace, incomingFontFaces); 13498 // Except for the fontFace key all the other keys are overwritten with the incoming values. 13499 map.set(font.slug, { 13500 ...restIncoming, 13501 fontFace: mergedFontFaces 13502 }); 13503 } else { 13504 map.set(font.slug, { 13505 ...font 13506 }); 13507 } 13508 } 13509 return Array.from(map.values()); 13510 } 13511 13512 /* 13513 * Loads the font face from a URL and adds it to the browser. 13514 * It also adds it to the iframe document. 13515 */ 13516 async function loadFontFaceInBrowser(fontFace, source, addTo = 'all') { 13517 let dataSource; 13518 if (typeof source === 'string') { 13519 dataSource = `url($source})`; 13520 // eslint-disable-next-line no-undef 13521 } else if (source instanceof File) { 13522 dataSource = await source.arrayBuffer(); 13523 } else { 13524 return; 13525 } 13526 const newFont = new window.FontFace(formatFontFaceName(fontFace.fontFamily), dataSource, { 13527 style: fontFace.fontStyle, 13528 weight: fontFace.fontWeight 13529 }); 13530 const loadedFace = await newFont.load(); 13531 if (addTo === 'document' || addTo === 'all') { 13532 document.fonts.add(loadedFace); 13533 } 13534 if (addTo === 'iframe' || addTo === 'all') { 13535 const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; 13536 iframeDocument.fonts.add(loadedFace); 13537 } 13538 } 13539 13540 /* 13541 * Unloads the font face and remove it from the browser. 13542 * It also removes it from the iframe document. 13543 * 13544 * Note that Font faces that were added to the set using the CSS @font-face rule 13545 * remain connected to the corresponding CSS, and cannot be deleted. 13546 * 13547 * @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete. 13548 */ 13549 function unloadFontFaceInBrowser(fontFace, removeFrom = 'all') { 13550 const unloadFontFace = fonts => { 13551 fonts.forEach(f => { 13552 if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) { 13553 fonts.delete(f); 13554 } 13555 }); 13556 }; 13557 if (removeFrom === 'document' || removeFrom === 'all') { 13558 unloadFontFace(document.fonts); 13559 } 13560 if (removeFrom === 'iframe' || removeFrom === 'all') { 13561 const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; 13562 unloadFontFace(iframeDocument.fonts); 13563 } 13564 } 13565 13566 /** 13567 * Retrieves the display source from a font face src. 13568 * 13569 * @param {string|string[]} input - The font face src. 13570 * @return {string|undefined} The display source or undefined if the input is invalid. 13571 */ 13572 function getDisplaySrcFromFontFace(input) { 13573 if (!input) { 13574 return; 13575 } 13576 let src; 13577 if (Array.isArray(input)) { 13578 src = input[0]; 13579 } else { 13580 src = input; 13581 } 13582 // It's expected theme fonts will already be loaded in the browser. 13583 if (src.startsWith('file:.')) { 13584 return; 13585 } 13586 if (!isUrlEncoded(src)) { 13587 src = encodeURI(src); 13588 } 13589 return src; 13590 } 13591 function makeFontFamilyFormData(fontFamily) { 13592 const formData = new FormData(); 13593 const { 13594 fontFace, 13595 category, 13596 ...familyWithValidParameters 13597 } = fontFamily; 13598 const fontFamilySettings = { 13599 ...familyWithValidParameters, 13600 slug: kebabCase(fontFamily.slug) 13601 }; 13602 formData.append('font_family_settings', JSON.stringify(fontFamilySettings)); 13603 return formData; 13604 } 13605 function makeFontFacesFormData(font) { 13606 if (font?.fontFace) { 13607 const fontFacesFormData = font.fontFace.map((item, faceIndex) => { 13608 const face = { 13609 ...item 13610 }; 13611 const formData = new FormData(); 13612 if (face.file) { 13613 // Normalize to an array, since face.file may be a single file or an array of files. 13614 const files = Array.isArray(face.file) ? face.file : [face.file]; 13615 const src = []; 13616 files.forEach((file, key) => { 13617 // Slugified file name because the it might contain spaces or characters treated differently on the server. 13618 const fileId = `file-$faceIndex}-$key}`; 13619 // Add the files to the formData 13620 formData.append(fileId, file, file.name); 13621 src.push(fileId); 13622 }); 13623 face.src = src.length === 1 ? src[0] : src; 13624 delete face.file; 13625 formData.append('font_face_settings', JSON.stringify(face)); 13626 } else { 13627 formData.append('font_face_settings', JSON.stringify(face)); 13628 } 13629 return formData; 13630 }); 13631 return fontFacesFormData; 13632 } 13633 } 13634 async function batchInstallFontFaces(fontFamilyId, fontFacesData) { 13635 const responses = []; 13636 13637 /* 13638 * Uses the same response format as Promise.allSettled, but executes requests in sequence to work 13639 * around a race condition that can cause an error when the fonts directory doesn't exist yet. 13640 */ 13641 for (const faceData of fontFacesData) { 13642 try { 13643 const response = await fetchInstallFontFace(fontFamilyId, faceData); 13644 responses.push({ 13645 status: 'fulfilled', 13646 value: response 13647 }); 13648 } catch (error) { 13649 responses.push({ 13650 status: 'rejected', 13651 reason: error 13652 }); 13653 } 13654 } 13655 const results = { 13656 errors: [], 13657 successes: [] 13658 }; 13659 responses.forEach((result, index) => { 13660 if (result.status === 'fulfilled') { 13661 const response = result.value; 13662 if (response.id) { 13663 results.successes.push(response); 13664 } else { 13665 results.errors.push({ 13666 data: fontFacesData[index], 13667 message: `Error: $response.message}` 13668 }); 13669 } 13670 } else { 13671 // Handle network errors or other fetch-related errors 13672 results.errors.push({ 13673 data: fontFacesData[index], 13674 message: result.reason.message 13675 }); 13676 } 13677 }); 13678 return results; 13679 } 13680 13681 /* 13682 * Downloads a font face asset from a URL to the client and returns a File object. 13683 */ 13684 async function downloadFontFaceAssets(src) { 13685 // Normalize to an array, since `src` could be a string or array. 13686 src = Array.isArray(src) ? src : [src]; 13687 const files = await Promise.all(src.map(async url => { 13688 return fetch(new Request(url)).then(response => { 13689 if (!response.ok) { 13690 throw new Error(`Error downloading font face asset from $url}. Server responded with status: $response.status}`); 13691 } 13692 return response.blob(); 13693 }).then(blob => { 13694 const filename = url.split('/').pop(); 13695 const file = new File([blob], filename, { 13696 type: blob.type 13697 }); 13698 return file; 13699 }); 13700 })); 13701 13702 // If we only have one file return it (not the array). Otherwise return all of them in the array. 13703 return files.length === 1 ? files[0] : files; 13704 } 13705 13706 /* 13707 * Determine if a given Font Face is present in a given collection. 13708 * We determine that a font face has been installed by comparing the fontWeight and fontStyle 13709 * 13710 * @param {Object} fontFace The Font Face to seek 13711 * @param {Array} collection The Collection to seek in 13712 * @returns True if the font face is found in the collection. Otherwise False. 13713 */ 13714 function checkFontFaceInstalled(fontFace, collection) { 13715 return -1 !== collection.findIndex(collectionFontFace => { 13716 return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle; 13717 }); 13718 } 13719 13720 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js 13721 /* wp:polyfill */ 13722 /** 13723 * Toggles the activation of a given font or font variant within a list of custom fonts. 13724 * 13725 * - If only the font is provided (without face), the entire font family's activation is toggled. 13726 * - If both font and face are provided, the activation of the specific font variant is toggled. 13727 * 13728 * @param {Object} font - The font to be toggled. 13729 * @param {string} font.slug - The unique identifier for the font. 13730 * @param {Array} [font.fontFace] - The list of font variants (faces) associated with the font. 13731 * 13732 * @param {Object} [face] - The specific font variant to be toggled. 13733 * @param {string} face.fontWeight - The weight of the font variant. 13734 * @param {string} face.fontStyle - The style of the font variant. 13735 * 13736 * @param {Array} initialfonts - The initial list of custom fonts. 13737 * 13738 * @return {Array} - The updated list of custom fonts with the font/font variant toggled. 13739 * 13740 * @example 13741 * const customFonts = [ 13742 * { slug: 'roboto', fontFace: [{ fontWeight: '400', fontStyle: 'normal' }] } 13743 * ]; 13744 * 13745 * toggleFont({ slug: 'roboto' }, null, customFonts); 13746 * // This will remove 'roboto' from customFonts 13747 * 13748 * toggleFont({ slug: 'roboto' }, { fontWeight: '400', fontStyle: 'normal' }, customFonts); 13749 * // This will remove the specified face from 'roboto' in customFonts 13750 * 13751 * toggleFont({ slug: 'roboto' }, { fontWeight: '500', fontStyle: 'normal' }, customFonts); 13752 * // This will add the specified face to 'roboto' in customFonts 13753 */ 13754 function toggleFont(font, face, initialfonts) { 13755 // Helper to check if a font is activated based on its slug 13756 const isFontActivated = f => f.slug === font.slug; 13757 13758 // Helper to get the activated font from a list of fonts 13759 const getActivatedFont = fonts => fonts.find(isFontActivated); 13760 13761 // Toggle the activation status of an entire font family 13762 const toggleEntireFontFamily = activatedFont => { 13763 if (!activatedFont) { 13764 // If the font is not active, activate the entire font family 13765 return [...initialfonts, font]; 13766 } 13767 // If the font is already active, deactivate the entire font family 13768 return initialfonts.filter(f => !isFontActivated(f)); 13769 }; 13770 13771 // Toggle the activation status of a specific font variant 13772 const toggleFontVariant = activatedFont => { 13773 const isFaceActivated = f => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle; 13774 if (!activatedFont) { 13775 // If the font family is not active, activate the font family with the font variant 13776 return [...initialfonts, { 13777 ...font, 13778 fontFace: [face] 13779 }]; 13780 } 13781 let newFontFaces = activatedFont.fontFace || []; 13782 if (newFontFaces.find(isFaceActivated)) { 13783 // If the font variant is active, deactivate it 13784 newFontFaces = newFontFaces.filter(f => !isFaceActivated(f)); 13785 } else { 13786 // If the font variant is not active, activate it 13787 newFontFaces = [...newFontFaces, face]; 13788 } 13789 13790 // If there are no more font faces, deactivate the font family 13791 if (newFontFaces.length === 0) { 13792 return initialfonts.filter(f => !isFontActivated(f)); 13793 } 13794 13795 // Return updated fonts list with toggled font variant 13796 return initialfonts.map(f => isFontActivated(f) ? { 13797 ...f, 13798 fontFace: newFontFaces 13799 } : f); 13800 }; 13801 const activatedFont = getActivatedFont(initialfonts); 13802 if (!face) { 13803 return toggleEntireFontFamily(activatedFont); 13804 } 13805 return toggleFontVariant(activatedFont); 13806 } 13807 13808 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js 13809 /* wp:polyfill */ 13810 /** 13811 * WordPress dependencies 13812 */ 13813 13814 13815 13816 13817 13818 13819 /** 13820 * Internal dependencies 13821 */ 13822 13823 13824 const { 13825 useGlobalSetting: context_useGlobalSetting 13826 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13827 13828 13829 13830 13831 const FontLibraryContext = (0,external_wp_element_namespaceObject.createContext)({}); 13832 function FontLibraryProvider({ 13833 children 13834 }) { 13835 const { 13836 saveEntityRecord 13837 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 13838 const { 13839 globalStylesId 13840 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13841 const { 13842 __experimentalGetCurrentGlobalStylesId 13843 } = select(external_wp_coreData_namespaceObject.store); 13844 return { 13845 globalStylesId: __experimentalGetCurrentGlobalStylesId() 13846 }; 13847 }); 13848 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); 13849 const [isInstalling, setIsInstalling] = (0,external_wp_element_namespaceObject.useState)(false); 13850 const [refreshKey, setRefreshKey] = (0,external_wp_element_namespaceObject.useState)(0); 13851 const refreshLibrary = () => { 13852 setRefreshKey(Date.now()); 13853 }; 13854 const { 13855 records: libraryPosts = [], 13856 isResolving: isResolvingLibrary 13857 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'wp_font_family', { 13858 refreshKey, 13859 _embed: true 13860 }); 13861 const libraryFonts = (libraryPosts || []).map(fontFamilyPost => { 13862 return { 13863 id: fontFamilyPost.id, 13864 ...fontFamilyPost.font_family_settings, 13865 fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] 13866 }; 13867 }) || []; 13868 13869 // Global Styles (settings) font families 13870 const [fontFamilies, setFontFamilies] = context_useGlobalSetting('typography.fontFamilies'); 13871 13872 /* 13873 * Save the font families to the database. 13874 * This function is called when the user activates or deactivates a font family. 13875 * It only updates the global styles post content in the database for new font families. 13876 * This avoids saving other styles/settings changed by the user using other parts of the editor. 13877 * 13878 * It uses the font families from the param to avoid using the font families from an outdated state. 13879 * 13880 * @param {Array} fonts - The font families that will be saved to the database. 13881 */ 13882 const saveFontFamilies = async fonts => { 13883 // Gets the global styles database post content. 13884 const updatedGlobalStyles = globalStyles.record; 13885 13886 // Updates the database version of global styles with the edited font families in the client. 13887 setNestedValue(updatedGlobalStyles, ['settings', 'typography', 'fontFamilies'], fonts); 13888 13889 // Saves a new version of the global styles in the database. 13890 await saveEntityRecord('root', 'globalStyles', updatedGlobalStyles); 13891 }; 13892 13893 // Library Fonts 13894 const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_namespaceObject.useState)(false); 13895 const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_namespaceObject.useState)(null); 13896 13897 // Themes Fonts are the fonts defined in the global styles (database persisted theme.json data). 13898 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { 13899 source: 'theme' 13900 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13901 const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => setUIValuesNeeded(f, { 13902 source: 'custom' 13903 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13904 const baseCustomFonts = libraryFonts ? libraryFonts.map(f => setUIValuesNeeded(f, { 13905 source: 'custom' 13906 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13907 (0,external_wp_element_namespaceObject.useEffect)(() => { 13908 if (!modalTabOpen) { 13909 setLibraryFontSelected(null); 13910 } 13911 }, [modalTabOpen]); 13912 const handleSetLibraryFontSelected = font => { 13913 // If font is null, reset the selected font 13914 if (!font) { 13915 setLibraryFontSelected(null); 13916 return; 13917 } 13918 const fonts = font.source === 'theme' ? themeFonts : baseCustomFonts; 13919 13920 // Tries to find the font in the installed fonts 13921 const fontSelected = fonts.find(f => f.slug === font.slug); 13922 // If the font is not found (it is only defined in custom styles), use the font from custom styles 13923 setLibraryFontSelected({ 13924 ...(fontSelected || font), 13925 source: font.source 13926 }); 13927 }; 13928 13929 // Demo 13930 const [loadedFontUrls] = (0,external_wp_element_namespaceObject.useState)(new Set()); 13931 const getAvailableFontsOutline = availableFontFamilies => { 13932 const outline = availableFontFamilies.reduce((acc, font) => { 13933 const availableFontFaces = font?.fontFace && font.fontFace?.length > 0 ? font?.fontFace.map(face => `$face.fontStyle + face.fontWeight}`) : ['normal400']; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400 13934 13935 acc[font.slug] = availableFontFaces; 13936 return acc; 13937 }, {}); 13938 return outline; 13939 }; 13940 const getActivatedFontsOutline = source => { 13941 switch (source) { 13942 case 'theme': 13943 return getAvailableFontsOutline(themeFonts); 13944 case 'custom': 13945 default: 13946 return getAvailableFontsOutline(customFonts); 13947 } 13948 }; 13949 const isFontActivated = (slug, style, weight, source) => { 13950 if (!style && !weight) { 13951 return !!getActivatedFontsOutline(source)[slug]; 13952 } 13953 return !!getActivatedFontsOutline(source)[slug]?.includes(style + weight); 13954 }; 13955 const getFontFacesActivated = (slug, source) => { 13956 return getActivatedFontsOutline(source)[slug] || []; 13957 }; 13958 async function installFonts(fontFamiliesToInstall) { 13959 setIsInstalling(true); 13960 try { 13961 const fontFamiliesToActivate = []; 13962 let installationErrors = []; 13963 for (const fontFamilyToInstall of fontFamiliesToInstall) { 13964 let isANewFontFamily = false; 13965 13966 // Get the font family if it already exists. 13967 let installedFontFamily = await fetchGetFontFamilyBySlug(fontFamilyToInstall.slug); 13968 13969 // Otherwise create it. 13970 if (!installedFontFamily) { 13971 isANewFontFamily = true; 13972 // Prepare font family form data to install. 13973 installedFontFamily = await fetchInstallFontFamily(makeFontFamilyFormData(fontFamilyToInstall)); 13974 } 13975 13976 // Collect font faces that have already been installed (to be activated later) 13977 const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter(fontFaceToInstall => checkFontFaceInstalled(fontFaceToInstall, fontFamilyToInstall.fontFace)) : []; 13978 13979 // Filter out Font Faces that have already been installed (so that they are not re-installed) 13980 if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) { 13981 fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter(fontFaceToInstall => !checkFontFaceInstalled(fontFaceToInstall, installedFontFamily.fontFace)); 13982 } 13983 13984 // Install the fonts (upload the font files to the server and create the post in the database). 13985 let successfullyInstalledFontFaces = []; 13986 let unsuccessfullyInstalledFontFaces = []; 13987 if (fontFamilyToInstall?.fontFace?.length > 0) { 13988 const response = await batchInstallFontFaces(installedFontFamily.id, makeFontFacesFormData(fontFamilyToInstall)); 13989 successfullyInstalledFontFaces = response?.successes; 13990 unsuccessfullyInstalledFontFaces = response?.errors; 13991 } 13992 13993 // Use the successfully installed font faces 13994 // As well as any font faces that were already installed (those will be activated) 13995 if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) { 13996 // Use font data from REST API not from client to ensure 13997 // correct font information is used. 13998 installedFontFamily.fontFace = [...successfullyInstalledFontFaces]; 13999 fontFamiliesToActivate.push(installedFontFamily); 14000 } 14001 14002 // If it's a system font but was installed successfully, activate it. 14003 if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) { 14004 fontFamiliesToActivate.push(installedFontFamily); 14005 } 14006 14007 // If the font family is new and is not a system font, delete it to avoid having font families without font faces. 14008 if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) { 14009 await fetchUninstallFontFamily(installedFontFamily.id); 14010 } 14011 installationErrors = installationErrors.concat(unsuccessfullyInstalledFontFaces); 14012 } 14013 installationErrors = installationErrors.reduce((unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], []); 14014 if (fontFamiliesToActivate.length > 0) { 14015 // Activate the font family (add the font family to the global styles). 14016 const activeFonts = activateCustomFontFamilies(fontFamiliesToActivate); 14017 // Save the global styles to the database. 14018 await saveFontFamilies(activeFonts); 14019 refreshLibrary(); 14020 } 14021 if (installationErrors.length > 0) { 14022 const installError = new Error((0,external_wp_i18n_namespaceObject.__)('There was an error installing fonts.')); 14023 installError.installationErrors = installationErrors; 14024 throw installError; 14025 } 14026 } finally { 14027 setIsInstalling(false); 14028 } 14029 } 14030 async function uninstallFontFamily(fontFamilyToUninstall) { 14031 try { 14032 // Uninstall the font family. 14033 // (Removes the font files from the server and the posts from the database). 14034 const uninstalledFontFamily = await fetchUninstallFontFamily(fontFamilyToUninstall.id); 14035 14036 // Deactivate the font family if delete request is successful 14037 // (Removes the font family from the global styles). 14038 if (uninstalledFontFamily.deleted) { 14039 const activeFonts = deactivateFontFamily(fontFamilyToUninstall); 14040 // Save the global styles to the database. 14041 await saveFontFamilies(activeFonts); 14042 } 14043 14044 // Refresh the library (the library font families from database). 14045 refreshLibrary(); 14046 return uninstalledFontFamily; 14047 } catch (error) { 14048 // eslint-disable-next-line no-console 14049 console.error(`There was an error uninstalling the font family:`, error); 14050 throw error; 14051 } 14052 } 14053 const deactivateFontFamily = font => { 14054 var _fontFamilies$font$so; 14055 // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts 14056 // We want to save as active all the theme fonts at the beginning 14057 const initialCustomFonts = (_fontFamilies$font$so = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so !== void 0 ? _fontFamilies$font$so : []; 14058 const newCustomFonts = initialCustomFonts.filter(f => f.slug !== font.slug); 14059 const activeFonts = { 14060 ...fontFamilies, 14061 [font.source]: newCustomFonts 14062 }; 14063 setFontFamilies(activeFonts); 14064 if (font.fontFace) { 14065 font.fontFace.forEach(face => { 14066 unloadFontFaceInBrowser(face, 'all'); 14067 }); 14068 } 14069 return activeFonts; 14070 }; 14071 const activateCustomFontFamilies = fontsToAdd => { 14072 const fontsToActivate = cleanFontsForSave(fontsToAdd); 14073 const activeFonts = { 14074 ...fontFamilies, 14075 // Merge the existing custom fonts with the new fonts. 14076 custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate) 14077 }; 14078 14079 // Activate the fonts by set the new custom fonts array. 14080 setFontFamilies(activeFonts); 14081 loadFontsInBrowser(fontsToActivate); 14082 return activeFonts; 14083 }; 14084 14085 // Removes the id from the families and faces to avoid saving that to global styles post content. 14086 const cleanFontsForSave = fonts => { 14087 return fonts.map(({ 14088 id: _familyDbId, 14089 fontFace, 14090 ...font 14091 }) => ({ 14092 ...font, 14093 ...(fontFace && fontFace.length > 0 ? { 14094 fontFace: fontFace.map(({ 14095 id: _faceDbId, 14096 ...face 14097 }) => face) 14098 } : {}) 14099 })); 14100 }; 14101 const loadFontsInBrowser = fonts => { 14102 // Add custom fonts to the browser. 14103 fonts.forEach(font => { 14104 if (font.fontFace) { 14105 font.fontFace.forEach(face => { 14106 // Load font faces just in the iframe because they already are in the document. 14107 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face.src), 'all'); 14108 }); 14109 } 14110 }); 14111 }; 14112 const toggleActivateFont = (font, face) => { 14113 var _fontFamilies$font$so2; 14114 // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts 14115 // We want to save as active all the theme fonts at the beginning 14116 const initialFonts = (_fontFamilies$font$so2 = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so2 !== void 0 ? _fontFamilies$font$so2 : []; 14117 // Toggles the received font family or font face 14118 const newFonts = toggleFont(font, face, initialFonts); 14119 // Updates the font families activated in global settings: 14120 setFontFamilies({ 14121 ...fontFamilies, 14122 [font.source]: newFonts 14123 }); 14124 const isFaceActivated = isFontActivated(font.slug, face?.fontStyle, face?.fontWeight, font.source); 14125 if (isFaceActivated) { 14126 unloadFontFaceInBrowser(face, 'all'); 14127 } else { 14128 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); 14129 } 14130 }; 14131 const loadFontFaceAsset = async fontFace => { 14132 // If the font doesn't have a src, don't load it. 14133 if (!fontFace.src) { 14134 return; 14135 } 14136 // Get the src of the font. 14137 const src = getDisplaySrcFromFontFace(fontFace.src); 14138 // If the font is already loaded, don't load it again. 14139 if (!src || loadedFontUrls.has(src)) { 14140 return; 14141 } 14142 // Load the font in the browser. 14143 loadFontFaceInBrowser(fontFace, src, 'document'); 14144 // Add the font to the loaded fonts list. 14145 loadedFontUrls.add(src); 14146 }; 14147 14148 // Font Collections 14149 const [collections, setFontCollections] = (0,external_wp_element_namespaceObject.useState)([]); 14150 const getFontCollections = async () => { 14151 const response = await fetchFontCollections(); 14152 setFontCollections(response); 14153 }; 14154 const getFontCollection = async slug => { 14155 try { 14156 const hasData = !!collections.find(collection => collection.slug === slug)?.font_families; 14157 if (hasData) { 14158 return; 14159 } 14160 const response = await fetchFontCollection(slug); 14161 const updatedCollections = collections.map(collection => collection.slug === slug ? { 14162 ...collection, 14163 ...response 14164 } : collection); 14165 setFontCollections(updatedCollections); 14166 } catch (e) { 14167 // eslint-disable-next-line no-console 14168 console.error(e); 14169 throw e; 14170 } 14171 }; 14172 (0,external_wp_element_namespaceObject.useEffect)(() => { 14173 getFontCollections(); 14174 }, []); 14175 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontLibraryContext.Provider, { 14176 value: { 14177 libraryFontSelected, 14178 handleSetLibraryFontSelected, 14179 fontFamilies, 14180 baseCustomFonts, 14181 isFontActivated, 14182 getFontFacesActivated, 14183 loadFontFaceAsset, 14184 installFonts, 14185 uninstallFontFamily, 14186 toggleActivateFont, 14187 getAvailableFontsOutline, 14188 modalTabOpen, 14189 setModalTabOpen, 14190 refreshLibrary, 14191 saveFontFamilies, 14192 isResolvingLibrary, 14193 isInstalling, 14194 collections, 14195 getFontCollection 14196 }, 14197 children: children 14198 }); 14199 } 14200 /* harmony default export */ const context = (FontLibraryProvider); 14201 14202 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js 14203 /* wp:polyfill */ 14204 /** 14205 * WordPress dependencies 14206 */ 14207 14208 14209 14210 /** 14211 * Internal dependencies 14212 */ 14213 14214 14215 14216 function getPreviewUrl(fontFace) { 14217 if (fontFace.preview) { 14218 return fontFace.preview; 14219 } 14220 if (fontFace.src) { 14221 return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src; 14222 } 14223 } 14224 function getDisplayFontFace(font) { 14225 // if this IS a font face return it 14226 if (font.fontStyle || font.fontWeight) { 14227 return font; 14228 } 14229 // if this is a font family with a collection of font faces 14230 // return the first one that is normal and 400 OR just the first one 14231 if (font.fontFace && font.fontFace.length) { 14232 return font.fontFace.find(face => face.fontStyle === 'normal' && face.fontWeight === '400') || font.fontFace[0]; 14233 } 14234 // This must be a font family with no font faces 14235 // return a fake font face 14236 return { 14237 fontStyle: 'normal', 14238 fontWeight: '400', 14239 fontFamily: font.fontFamily, 14240 fake: true 14241 }; 14242 } 14243 function FontDemo({ 14244 font, 14245 text 14246 }) { 14247 const ref = (0,external_wp_element_namespaceObject.useRef)(null); 14248 const fontFace = getDisplayFontFace(font); 14249 const style = getFamilyPreviewStyle(font); 14250 text = text || font.name; 14251 const customPreviewUrl = font.preview; 14252 const [isIntersecting, setIsIntersecting] = (0,external_wp_element_namespaceObject.useState)(false); 14253 const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 14254 const { 14255 loadFontFaceAsset 14256 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14257 const previewUrl = customPreviewUrl !== null && customPreviewUrl !== void 0 ? customPreviewUrl : getPreviewUrl(fontFace); 14258 const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i); 14259 const faceStyles = getFacePreviewStyle(fontFace); 14260 const textDemoStyle = { 14261 fontSize: '18px', 14262 lineHeight: 1, 14263 opacity: isAssetLoaded ? '1' : '0', 14264 ...style, 14265 ...faceStyles 14266 }; 14267 (0,external_wp_element_namespaceObject.useEffect)(() => { 14268 const observer = new window.IntersectionObserver(([entry]) => { 14269 setIsIntersecting(entry.isIntersecting); 14270 }, {}); 14271 observer.observe(ref.current); 14272 return () => observer.disconnect(); 14273 }, [ref]); 14274 (0,external_wp_element_namespaceObject.useEffect)(() => { 14275 const loadAsset = async () => { 14276 if (isIntersecting) { 14277 if (!isPreviewImage && fontFace.src) { 14278 await loadFontFaceAsset(fontFace); 14279 } 14280 setIsAssetLoaded(true); 14281 } 14282 }; 14283 loadAsset(); 14284 }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]); 14285 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14286 ref: ref, 14287 children: isPreviewImage ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 14288 src: previewUrl, 14289 loading: "lazy", 14290 alt: text, 14291 className: "font-library-modal__font-variant_demo-image" 14292 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14293 style: textDemoStyle, 14294 className: "font-library-modal__font-variant_demo-text", 14295 children: text 14296 }) 14297 }); 14298 } 14299 /* harmony default export */ const font_demo = (FontDemo); 14300 14301 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js 14302 /** 14303 * WordPress dependencies 14304 */ 14305 14306 14307 14308 /** 14309 * Internal dependencies 14310 */ 14311 14312 14313 14314 function FontCard({ 14315 font, 14316 onClick, 14317 variantsText, 14318 navigatorPath 14319 }) { 14320 const variantsCount = font.fontFace?.length || 1; 14321 const style = { 14322 cursor: !!onClick ? 'pointer' : 'default' 14323 }; 14324 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 14325 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14326 __next40pxDefaultSize: true, 14327 onClick: () => { 14328 onClick(); 14329 if (navigatorPath) { 14330 navigator.goTo(navigatorPath); 14331 } 14332 }, 14333 style: style, 14334 className: "font-library-modal__font-card", 14335 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14336 justify: "space-between", 14337 wrap: false, 14338 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14339 font: font 14340 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14341 justify: "flex-end", 14342 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 14343 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14344 className: "font-library-modal__font-card__count", 14345 children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of font variants. */ 14346 (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) 14347 }) 14348 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 14349 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 14350 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 14351 }) 14352 })] 14353 })] 14354 }) 14355 }); 14356 } 14357 /* harmony default export */ const font_card = (FontCard); 14358 14359 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js 14360 /** 14361 * WordPress dependencies 14362 */ 14363 14364 14365 14366 /** 14367 * Internal dependencies 14368 */ 14369 14370 14371 14372 14373 14374 const { 14375 kebabCase: library_font_variant_kebabCase 14376 } = unlock(external_wp_components_namespaceObject.privateApis); 14377 function LibraryFontVariant({ 14378 face, 14379 font 14380 }) { 14381 const { 14382 isFontActivated, 14383 toggleActivateFont 14384 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14385 const isInstalled = font?.fontFace?.length > 0 ? isFontActivated(font.slug, face.fontStyle, face.fontWeight, font.source) : isFontActivated(font.slug, null, null, font.source); 14386 const handleToggleActivation = () => { 14387 if (font?.fontFace?.length > 0) { 14388 toggleActivateFont(font, face); 14389 return; 14390 } 14391 toggleActivateFont(font); 14392 }; 14393 const displayName = font.name + ' ' + getFontFaceVariantName(face); 14394 const checkboxId = library_font_variant_kebabCase(`$font.slug}-$getFontFaceVariantName(face)}`); 14395 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14396 className: "font-library-modal__font-card", 14397 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14398 justify: "flex-start", 14399 align: "center", 14400 gap: "1rem", 14401 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14402 checked: isInstalled, 14403 onChange: handleToggleActivation, 14404 __nextHasNoMarginBottom: true, 14405 id: checkboxId 14406 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 14407 htmlFor: checkboxId, 14408 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14409 font: face, 14410 text: displayName, 14411 onClick: handleToggleActivation 14412 }) 14413 })] 14414 }) 14415 }); 14416 } 14417 /* harmony default export */ const library_font_variant = (LibraryFontVariant); 14418 14419 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js 14420 function getNumericFontWeight(value) { 14421 switch (value) { 14422 case 'normal': 14423 return 400; 14424 case 'bold': 14425 return 700; 14426 case 'bolder': 14427 return 500; 14428 case 'lighter': 14429 return 300; 14430 default: 14431 return parseInt(value, 10); 14432 } 14433 } 14434 function sortFontFaces(faces) { 14435 return faces.sort((a, b) => { 14436 // Ensure 'normal' fontStyle is always first 14437 if (a.fontStyle === 'normal' && b.fontStyle !== 'normal') { 14438 return -1; 14439 } 14440 if (b.fontStyle === 'normal' && a.fontStyle !== 'normal') { 14441 return 1; 14442 } 14443 14444 // If both fontStyles are the same, sort by fontWeight 14445 if (a.fontStyle === b.fontStyle) { 14446 return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight); 14447 } 14448 14449 // Sort other fontStyles alphabetically 14450 return a.fontStyle.localeCompare(b.fontStyle); 14451 }); 14452 } 14453 14454 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js 14455 /* wp:polyfill */ 14456 /** 14457 * WordPress dependencies 14458 */ 14459 14460 14461 14462 14463 14464 14465 14466 14467 /** 14468 * Internal dependencies 14469 */ 14470 14471 14472 14473 14474 14475 14476 14477 const { 14478 useGlobalSetting: installed_fonts_useGlobalSetting 14479 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 14480 function InstalledFonts() { 14481 var _libraryFontSelected$; 14482 const { 14483 baseCustomFonts, 14484 libraryFontSelected, 14485 handleSetLibraryFontSelected, 14486 refreshLibrary, 14487 uninstallFontFamily, 14488 isResolvingLibrary, 14489 isInstalling, 14490 saveFontFamilies, 14491 getFontFacesActivated 14492 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14493 const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies'); 14494 const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_namespaceObject.useState)(false); 14495 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 14496 const [baseFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies', undefined, 'base'); 14497 const globalStylesId = (0,external_wp_data_namespaceObject.useSelect)(select => { 14498 const { 14499 __experimentalGetCurrentGlobalStylesId 14500 } = select(external_wp_coreData_namespaceObject.store); 14501 return __experimentalGetCurrentGlobalStylesId(); 14502 }); 14503 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); 14504 const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies; 14505 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { 14506 source: 'theme' 14507 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 14508 const themeFontsSlugs = new Set(themeFonts.map(f => f.slug)); 14509 const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => setUIValuesNeeded(f, { 14510 source: 'theme' 14511 })).sort((a, b) => a.name.localeCompare(b.name))) : []; 14512 const customFontFamilyId = libraryFontSelected?.source === 'custom' && libraryFontSelected?.id; 14513 const canUserDelete = (0,external_wp_data_namespaceObject.useSelect)(select => { 14514 const { 14515 canUser 14516 } = select(external_wp_coreData_namespaceObject.store); 14517 return customFontFamilyId && canUser('delete', { 14518 kind: 'postType', 14519 name: 'wp_font_family', 14520 id: customFontFamilyId 14521 }); 14522 }, [customFontFamilyId]); 14523 const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== 'theme' && canUserDelete; 14524 const handleUninstallClick = () => { 14525 setIsConfirmDeleteOpen(true); 14526 }; 14527 const handleUpdate = async () => { 14528 setNotice(null); 14529 try { 14530 await saveFontFamilies(fontFamilies); 14531 setNotice({ 14532 type: 'success', 14533 message: (0,external_wp_i18n_namespaceObject.__)('Font family updated successfully.') 14534 }); 14535 } catch (error) { 14536 setNotice({ 14537 type: 'error', 14538 message: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message */ 14539 (0,external_wp_i18n_namespaceObject.__)('There was an error updating the font family. %s'), error.message) 14540 }); 14541 } 14542 }; 14543 const getFontFacesToDisplay = font => { 14544 if (!font) { 14545 return []; 14546 } 14547 if (!font.fontFace || !font.fontFace.length) { 14548 return [{ 14549 fontFamily: font.fontFamily, 14550 fontStyle: 'normal', 14551 fontWeight: '400' 14552 }]; 14553 } 14554 return sortFontFaces(font.fontFace); 14555 }; 14556 const getFontCardVariantsText = font => { 14557 const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1; 14558 const variantsActive = getFontFacesActivated(font.slug, font.source).length; 14559 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Active font variants, 2: Total font variants. */ 14560 (0,external_wp_i18n_namespaceObject.__)('%1$s/%2$s variants active'), variantsActive, variantsInstalled); 14561 }; 14562 (0,external_wp_element_namespaceObject.useEffect)(() => { 14563 handleSetLibraryFontSelected(libraryFontSelected); 14564 refreshLibrary(); 14565 }, []); 14566 14567 // Get activated fonts count. 14568 const activeFontsCount = libraryFontSelected ? getFontFacesActivated(libraryFontSelected.slug, libraryFontSelected.source).length : 0; 14569 const selectedFontsCount = (_libraryFontSelected$ = libraryFontSelected?.fontFace?.length) !== null && _libraryFontSelected$ !== void 0 ? _libraryFontSelected$ : libraryFontSelected?.fontFamily ? 1 : 0; 14570 14571 // Check if any fonts are selected. 14572 const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount; 14573 14574 // Check if all fonts are selected. 14575 const isSelectAllChecked = activeFontsCount === selectedFontsCount; 14576 14577 // Toggle select all fonts. 14578 const toggleSelectAll = () => { 14579 var _fontFamilies$library; 14580 const initialFonts = (_fontFamilies$library = fontFamilies?.[libraryFontSelected.source]?.filter(f => f.slug !== libraryFontSelected.slug)) !== null && _fontFamilies$library !== void 0 ? _fontFamilies$library : []; 14581 const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected]; 14582 setFontFamilies({ 14583 ...fontFamilies, 14584 [libraryFontSelected.source]: newFonts 14585 }); 14586 if (libraryFontSelected.fontFace) { 14587 libraryFontSelected.fontFace.forEach(face => { 14588 if (isSelectAllChecked) { 14589 unloadFontFaceInBrowser(face, 'all'); 14590 } else { 14591 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); 14592 } 14593 }); 14594 } 14595 }; 14596 const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; 14597 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 14598 className: "font-library-modal__tabpanel-layout", 14599 children: [isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14600 className: "font-library-modal__loading", 14601 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 14602 }), !isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14603 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { 14604 initialPath: libraryFontSelected ? '/fontFamily' : '/', 14605 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { 14606 path: "/", 14607 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14608 spacing: "8", 14609 children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 14610 status: notice.type, 14611 onRemove: () => setNotice(null), 14612 children: notice.message 14613 }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14614 as: "p", 14615 children: (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') 14616 }), baseThemeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14617 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 14618 className: "font-library-modal__fonts-title", 14619 children: /* translators: Heading for a list of fonts provided by the theme. */ 14620 (0,external_wp_i18n_namespaceObject._x)('Theme', 'font source') 14621 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14622 role: "list", 14623 className: "font-library-modal__fonts-list", 14624 children: baseThemeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14625 className: "font-library-modal__fonts-list-item", 14626 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 14627 font: font, 14628 navigatorPath: "/fontFamily", 14629 variantsText: getFontCardVariantsText(font), 14630 onClick: () => { 14631 setNotice(null); 14632 handleSetLibraryFontSelected(font); 14633 } 14634 }) 14635 }, font.slug)) 14636 })] 14637 }), baseCustomFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14638 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 14639 className: "font-library-modal__fonts-title", 14640 children: /* translators: Heading for a list of fonts installed by the user. */ 14641 (0,external_wp_i18n_namespaceObject._x)('Custom', 'font source') 14642 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14643 role: "list", 14644 className: "font-library-modal__fonts-list", 14645 children: baseCustomFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14646 className: "font-library-modal__fonts-list-item", 14647 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 14648 font: font, 14649 navigatorPath: "/fontFamily", 14650 variantsText: getFontCardVariantsText(font), 14651 onClick: () => { 14652 setNotice(null); 14653 handleSetLibraryFontSelected(font); 14654 } 14655 }) 14656 }, font.slug)) 14657 })] 14658 })] 14659 }) 14660 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { 14661 path: "/fontFamily", 14662 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConfirmDeleteDialog, { 14663 font: libraryFontSelected, 14664 isOpen: isConfirmDeleteOpen, 14665 setIsOpen: setIsConfirmDeleteOpen, 14666 setNotice: setNotice, 14667 uninstallFontFamily: uninstallFontFamily, 14668 handleSetLibraryFontSelected: handleSetLibraryFontSelected 14669 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14670 justify: "flex-start", 14671 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { 14672 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 14673 size: "small", 14674 onClick: () => { 14675 handleSetLibraryFontSelected(null); 14676 setNotice(null); 14677 }, 14678 label: (0,external_wp_i18n_namespaceObject.__)('Back') 14679 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 14680 level: 2, 14681 size: 13, 14682 className: "edit-site-global-styles-header", 14683 children: libraryFontSelected?.name 14684 })] 14685 }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14686 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14687 margin: 1 14688 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 14689 status: notice.type, 14690 onRemove: () => setNotice(null), 14691 children: notice.message 14692 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14693 margin: 1 14694 })] 14695 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14696 margin: 4 14697 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14698 children: (0,external_wp_i18n_namespaceObject.__)('Choose font variants. Keep in mind that too many variants could make your site slower.') 14699 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14700 margin: 4 14701 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14702 spacing: 0, 14703 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14704 className: "font-library-modal__select-all", 14705 label: (0,external_wp_i18n_namespaceObject.__)('Select all'), 14706 checked: isSelectAllChecked, 14707 onChange: toggleSelectAll, 14708 indeterminate: isIndeterminate, 14709 __nextHasNoMarginBottom: true 14710 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14711 margin: 8 14712 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14713 role: "list", 14714 className: "font-library-modal__fonts-list", 14715 children: getFontFacesToDisplay(libraryFontSelected).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14716 className: "font-library-modal__fonts-list-item", 14717 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(library_font_variant, { 14718 font: libraryFontSelected, 14719 face: face 14720 }, `face$i}`) 14721 }, `face$i}`)) 14722 })] 14723 })] 14724 })] 14725 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 14726 justify: "flex-end", 14727 className: "font-library-modal__footer", 14728 children: [isInstalling && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}), shouldDisplayDeleteButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14729 __next40pxDefaultSize: true, 14730 isDestructive: true, 14731 variant: "tertiary", 14732 onClick: handleUninstallClick, 14733 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 14734 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14735 __next40pxDefaultSize: true, 14736 variant: "primary", 14737 onClick: handleUpdate, 14738 disabled: !fontFamiliesHasChanges, 14739 accessibleWhenDisabled: true, 14740 children: (0,external_wp_i18n_namespaceObject.__)('Update') 14741 })] 14742 })] 14743 })] 14744 }); 14745 } 14746 function ConfirmDeleteDialog({ 14747 font, 14748 isOpen, 14749 setIsOpen, 14750 setNotice, 14751 uninstallFontFamily, 14752 handleSetLibraryFontSelected 14753 }) { 14754 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 14755 const handleConfirmUninstall = async () => { 14756 setNotice(null); 14757 setIsOpen(false); 14758 try { 14759 await uninstallFontFamily(font); 14760 navigator.goBack(); 14761 handleSetLibraryFontSelected(null); 14762 setNotice({ 14763 type: 'success', 14764 message: (0,external_wp_i18n_namespaceObject.__)('Font family uninstalled successfully.') 14765 }); 14766 } catch (error) { 14767 setNotice({ 14768 type: 'error', 14769 message: (0,external_wp_i18n_namespaceObject.__)('There was an error uninstalling the font family.') + error.message 14770 }); 14771 } 14772 }; 14773 const handleCancelUninstall = () => { 14774 setIsOpen(false); 14775 }; 14776 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 14777 isOpen: isOpen, 14778 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 14779 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 14780 onCancel: handleCancelUninstall, 14781 onConfirm: handleConfirmUninstall, 14782 size: "medium", 14783 children: font && (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the font. */ 14784 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name) 14785 }); 14786 } 14787 /* harmony default export */ const installed_fonts = (InstalledFonts); 14788 14789 ;// ./node_modules/@wordpress/icons/build-module/library/next.js 14790 /** 14791 * WordPress dependencies 14792 */ 14793 14794 14795 const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 14796 xmlns: "http://www.w3.org/2000/svg", 14797 viewBox: "0 0 24 24", 14798 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 14799 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" 14800 }) 14801 }); 14802 /* harmony default export */ const library_next = (next); 14803 14804 ;// ./node_modules/@wordpress/icons/build-module/library/previous.js 14805 /** 14806 * WordPress dependencies 14807 */ 14808 14809 14810 const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 14811 xmlns: "http://www.w3.org/2000/svg", 14812 viewBox: "0 0 24 24", 14813 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 14814 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" 14815 }) 14816 }); 14817 /* harmony default export */ const library_previous = (previous); 14818 14819 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js 14820 /* wp:polyfill */ 14821 /** 14822 * Filters a list of fonts based on the specified filters. 14823 * 14824 * This function filters a given array of fonts based on the criteria provided in the filters object. 14825 * It supports filtering by category and a search term. If the category is provided and not equal to 'all', 14826 * the function filters the fonts array to include only those fonts that belong to the specified category. 14827 * Additionally, if a search term is provided, it filters the fonts array to include only those fonts 14828 * whose name includes the search term, case-insensitively. 14829 * 14830 * @param {Array} fonts Array of font objects in font-collection schema fashion to be filtered. Each font object should have a 'categories' property and a 'font_family_settings' property with a 'name' key. 14831 * @param {Object} filters Object containing the filter criteria. It should have a 'category' key and/or a 'search' key. 14832 * The 'category' key is a string representing the category to filter by. 14833 * The 'search' key is a string representing the search term to filter by. 14834 * @return {Array} Array of filtered font objects based on the provided criteria. 14835 */ 14836 function filterFonts(fonts, filters) { 14837 const { 14838 category, 14839 search 14840 } = filters; 14841 let filteredFonts = fonts || []; 14842 if (category && category !== 'all') { 14843 filteredFonts = filteredFonts.filter(font => font.categories.indexOf(category) !== -1); 14844 } 14845 if (search) { 14846 filteredFonts = filteredFonts.filter(font => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase())); 14847 } 14848 return filteredFonts; 14849 } 14850 14851 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js 14852 /* wp:polyfill */ 14853 function getFontsOutline(fonts) { 14854 return fonts.reduce((acc, font) => ({ 14855 ...acc, 14856 [font.slug]: (font?.fontFace || []).reduce((faces, face) => ({ 14857 ...faces, 14858 [`$face.fontStyle}-$face.fontWeight}`]: true 14859 }), {}) 14860 }), {}); 14861 } 14862 function isFontFontFaceInOutline(slug, face, outline) { 14863 if (!face) { 14864 return !!outline[slug]; 14865 } 14866 return !!outline[slug]?.[`$face.fontStyle}-$face.fontWeight}`]; 14867 } 14868 14869 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js 14870 /** 14871 * WordPress dependencies 14872 */ 14873 14874 14875 14876 function GoogleFontsConfirmDialog() { 14877 const handleConfirm = () => { 14878 // eslint-disable-next-line no-undef 14879 window.localStorage.setItem('wp-font-library-google-fonts-permission', 'true'); 14880 window.dispatchEvent(new Event('storage')); 14881 }; 14882 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14883 className: "font-library__google-fonts-confirm", 14884 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 14885 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 14886 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 14887 level: 2, 14888 children: (0,external_wp_i18n_namespaceObject.__)('Connect to Google Fonts') 14889 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14890 margin: 6 14891 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14892 as: "p", 14893 children: (0,external_wp_i18n_namespaceObject.__)('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.') 14894 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14895 margin: 3 14896 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14897 as: "p", 14898 children: (0,external_wp_i18n_namespaceObject.__)('You can alternatively upload files directly on the Upload tab.') 14899 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14900 margin: 6 14901 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14902 __next40pxDefaultSize: true, 14903 variant: "primary", 14904 onClick: handleConfirm, 14905 children: (0,external_wp_i18n_namespaceObject.__)('Allow access to Google Fonts') 14906 })] 14907 }) 14908 }) 14909 }); 14910 } 14911 /* harmony default export */ const google_fonts_confirm_dialog = (GoogleFontsConfirmDialog); 14912 14913 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js 14914 /** 14915 * WordPress dependencies 14916 */ 14917 14918 14919 /** 14920 * Internal dependencies 14921 */ 14922 14923 14924 14925 14926 const { 14927 kebabCase: collection_font_variant_kebabCase 14928 } = unlock(external_wp_components_namespaceObject.privateApis); 14929 function CollectionFontVariant({ 14930 face, 14931 font, 14932 handleToggleVariant, 14933 selected 14934 }) { 14935 const handleToggleActivation = () => { 14936 if (font?.fontFace) { 14937 handleToggleVariant(font, face); 14938 return; 14939 } 14940 handleToggleVariant(font); 14941 }; 14942 const displayName = font.name + ' ' + getFontFaceVariantName(face); 14943 const checkboxId = collection_font_variant_kebabCase(`$font.slug}-$getFontFaceVariantName(face)}`); 14944 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14945 className: "font-library-modal__font-card", 14946 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14947 justify: "flex-start", 14948 align: "center", 14949 gap: "1rem", 14950 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14951 checked: selected, 14952 onChange: handleToggleActivation, 14953 __nextHasNoMarginBottom: true, 14954 id: checkboxId 14955 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 14956 htmlFor: checkboxId, 14957 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14958 font: face, 14959 text: displayName, 14960 onClick: handleToggleActivation 14961 }) 14962 })] 14963 }) 14964 }); 14965 } 14966 /* harmony default export */ const collection_font_variant = (CollectionFontVariant); 14967 14968 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js 14969 /* wp:polyfill */ 14970 /** 14971 * WordPress dependencies 14972 */ 14973 14974 14975 14976 14977 14978 14979 /** 14980 * Internal dependencies 14981 */ 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 const DEFAULT_CATEGORY = { 14993 slug: 'all', 14994 name: (0,external_wp_i18n_namespaceObject._x)('All', 'font categories') 14995 }; 14996 const LOCAL_STORAGE_ITEM = 'wp-font-library-google-fonts-permission'; 14997 const MIN_WINDOW_HEIGHT = 500; 14998 function FontCollection({ 14999 slug 15000 }) { 15001 var _selectedCollection$c; 15002 const requiresPermission = slug === 'google-fonts'; 15003 const getGoogleFontsPermissionFromStorage = () => { 15004 return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === 'true'; 15005 }; 15006 const [selectedFont, setSelectedFont] = (0,external_wp_element_namespaceObject.useState)(null); 15007 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 15008 const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_namespaceObject.useState)([]); 15009 const [page, setPage] = (0,external_wp_element_namespaceObject.useState)(1); 15010 const [filters, setFilters] = (0,external_wp_element_namespaceObject.useState)({}); 15011 const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(requiresPermission && !getGoogleFontsPermissionFromStorage()); 15012 const { 15013 collections, 15014 getFontCollection, 15015 installFonts, 15016 isInstalling 15017 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 15018 const selectedCollection = collections.find(collection => collection.slug === slug); 15019 (0,external_wp_element_namespaceObject.useEffect)(() => { 15020 const handleStorage = () => { 15021 setRenderConfirmDialog(requiresPermission && !getGoogleFontsPermissionFromStorage()); 15022 }; 15023 handleStorage(); 15024 window.addEventListener('storage', handleStorage); 15025 return () => window.removeEventListener('storage', handleStorage); 15026 }, [slug, requiresPermission]); 15027 const revokeAccess = () => { 15028 window.localStorage.setItem(LOCAL_STORAGE_ITEM, 'false'); 15029 window.dispatchEvent(new Event('storage')); 15030 }; 15031 (0,external_wp_element_namespaceObject.useEffect)(() => { 15032 const fetchFontCollection = async () => { 15033 try { 15034 await getFontCollection(slug); 15035 resetFilters(); 15036 } catch (e) { 15037 if (!notice) { 15038 setNotice({ 15039 type: 'error', 15040 message: e?.message 15041 }); 15042 } 15043 } 15044 }; 15045 fetchFontCollection(); 15046 }, [slug, getFontCollection, setNotice, notice]); 15047 (0,external_wp_element_namespaceObject.useEffect)(() => { 15048 setSelectedFont(null); 15049 }, [slug]); 15050 (0,external_wp_element_namespaceObject.useEffect)(() => { 15051 // If the selected fonts change, reset the selected fonts to install 15052 setFontsToInstall([]); 15053 }, [selectedFont]); 15054 const collectionFonts = (0,external_wp_element_namespaceObject.useMemo)(() => { 15055 var _selectedCollection$f; 15056 return (_selectedCollection$f = selectedCollection?.font_families) !== null && _selectedCollection$f !== void 0 ? _selectedCollection$f : []; 15057 }, [selectedCollection]); 15058 const collectionCategories = (_selectedCollection$c = selectedCollection?.categories) !== null && _selectedCollection$c !== void 0 ? _selectedCollection$c : []; 15059 const categories = [DEFAULT_CATEGORY, ...collectionCategories]; 15060 const fonts = (0,external_wp_element_namespaceObject.useMemo)(() => filterFonts(collectionFonts, filters), [collectionFonts, filters]); 15061 const isLoading = !selectedCollection?.font_families && !notice; 15062 15063 // NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px 15064 // The height of each font family item is 61px. 15065 const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT); 15066 const pageSize = Math.floor((windowHeight - 417) / 61); 15067 const totalPages = Math.ceil(fonts.length / pageSize); 15068 const itemsStart = (page - 1) * pageSize; 15069 const itemsLimit = page * pageSize; 15070 const items = fonts.slice(itemsStart, itemsLimit); 15071 const handleCategoryFilter = category => { 15072 setFilters({ 15073 ...filters, 15074 category 15075 }); 15076 setPage(1); 15077 }; 15078 const handleUpdateSearchInput = value => { 15079 setFilters({ 15080 ...filters, 15081 search: value 15082 }); 15083 setPage(1); 15084 }; 15085 const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300); 15086 const resetFilters = () => { 15087 setFilters({}); 15088 setPage(1); 15089 }; 15090 const handleToggleVariant = (font, face) => { 15091 const newFontsToInstall = toggleFont(font, face, fontsToInstall); 15092 setFontsToInstall(newFontsToInstall); 15093 }; 15094 const fontToInstallOutline = getFontsOutline(fontsToInstall); 15095 const resetFontsToInstall = () => { 15096 setFontsToInstall([]); 15097 }; 15098 const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0; 15099 15100 // Check if any fonts are selected. 15101 const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length; 15102 15103 // Check if all fonts are selected. 15104 const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length; 15105 15106 // Toggle select all fonts. 15107 const toggleSelectAll = () => { 15108 const newFonts = isSelectAllChecked ? [] : [selectedFont]; 15109 setFontsToInstall(newFonts); 15110 }; 15111 const handleInstall = async () => { 15112 setNotice(null); 15113 const fontFamily = fontsToInstall[0]; 15114 try { 15115 if (fontFamily?.fontFace) { 15116 await Promise.all(fontFamily.fontFace.map(async fontFace => { 15117 if (fontFace.src) { 15118 fontFace.file = await downloadFontFaceAssets(fontFace.src); 15119 } 15120 })); 15121 } 15122 } catch (error) { 15123 // If any of the fonts fail to download, 15124 // show an error notice and stop the request from being sent. 15125 setNotice({ 15126 type: 'error', 15127 message: (0,external_wp_i18n_namespaceObject.__)('Error installing the fonts, could not be downloaded.') 15128 }); 15129 return; 15130 } 15131 try { 15132 await installFonts([fontFamily]); 15133 setNotice({ 15134 type: 'success', 15135 message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') 15136 }); 15137 } catch (error) { 15138 setNotice({ 15139 type: 'error', 15140 message: error.message 15141 }); 15142 } 15143 resetFontsToInstall(); 15144 }; 15145 const getSortedFontFaces = fontFamily => { 15146 if (!fontFamily) { 15147 return []; 15148 } 15149 if (!fontFamily.fontFace || !fontFamily.fontFace.length) { 15150 return [{ 15151 fontFamily: fontFamily.fontFamily, 15152 fontStyle: 'normal', 15153 fontWeight: '400' 15154 }]; 15155 } 15156 return sortFontFaces(fontFamily.fontFace); 15157 }; 15158 if (renderConfirmDialog) { 15159 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog, {}); 15160 } 15161 const ActionsComponent = () => { 15162 if (slug !== 'google-fonts' || renderConfirmDialog || selectedFont) { 15163 return null; 15164 } 15165 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 15166 icon: more_vertical, 15167 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 15168 popoverProps: { 15169 position: 'bottom left' 15170 }, 15171 controls: [{ 15172 title: (0,external_wp_i18n_namespaceObject.__)('Revoke access to Google Fonts'), 15173 onClick: revokeAccess 15174 }] 15175 }); 15176 }; 15177 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 15178 className: "font-library-modal__tabpanel-layout", 15179 children: [isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 15180 className: "font-library-modal__loading", 15181 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 15182 }), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15183 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { 15184 initialPath: "/", 15185 className: "font-library-modal__tabpanel-layout", 15186 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { 15187 path: "/", 15188 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15189 justify: "space-between", 15190 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 15191 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 15192 level: 2, 15193 size: 13, 15194 children: selectedCollection.name 15195 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15196 children: selectedCollection.description 15197 })] 15198 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {})] 15199 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15200 margin: 4 15201 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 15202 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 15203 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 15204 className: "font-library-modal__search", 15205 value: filters.search, 15206 placeholder: (0,external_wp_i18n_namespaceObject.__)('Font name…'), 15207 label: (0,external_wp_i18n_namespaceObject.__)('Search'), 15208 onChange: debouncedUpdateSearchInput, 15209 __nextHasNoMarginBottom: true, 15210 hideLabelFromVision: false 15211 }) 15212 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 15213 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 15214 __nextHasNoMarginBottom: true, 15215 __next40pxDefaultSize: true, 15216 label: (0,external_wp_i18n_namespaceObject.__)('Category'), 15217 value: filters.category, 15218 onChange: handleCategoryFilter, 15219 children: categories && categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { 15220 value: category.slug, 15221 children: category.name 15222 }, category.slug)) 15223 }) 15224 })] 15225 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15226 margin: 4 15227 }), !!selectedCollection?.font_families?.length && !fonts.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15228 children: (0,external_wp_i18n_namespaceObject.__)('No fonts found. Try with a different search term') 15229 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 15230 className: "font-library-modal__fonts-grid__main", 15231 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 15232 role: "list", 15233 className: "font-library-modal__fonts-list", 15234 children: items.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 15235 className: "font-library-modal__fonts-list-item", 15236 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 15237 font: font.font_family_settings, 15238 navigatorPath: "/fontFamily", 15239 onClick: () => { 15240 setSelectedFont(font.font_family_settings); 15241 } 15242 }) 15243 }, font.font_family_settings.slug)) 15244 }) 15245 })] 15246 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { 15247 path: "/fontFamily", 15248 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 15249 justify: "flex-start", 15250 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { 15251 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 15252 size: "small", 15253 onClick: () => { 15254 setSelectedFont(null); 15255 setNotice(null); 15256 }, 15257 label: (0,external_wp_i18n_namespaceObject.__)('Back') 15258 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 15259 level: 2, 15260 size: 13, 15261 className: "edit-site-global-styles-header", 15262 children: selectedFont?.name 15263 })] 15264 }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15265 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15266 margin: 1 15267 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 15268 status: notice.type, 15269 onRemove: () => setNotice(null), 15270 children: notice.message 15271 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15272 margin: 1 15273 })] 15274 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15275 margin: 4 15276 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15277 children: (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.') 15278 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15279 margin: 4 15280 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 15281 className: "font-library-modal__select-all", 15282 label: (0,external_wp_i18n_namespaceObject.__)('Select all'), 15283 checked: isSelectAllChecked, 15284 onChange: toggleSelectAll, 15285 indeterminate: isIndeterminate, 15286 __nextHasNoMarginBottom: true 15287 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 15288 spacing: 0, 15289 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 15290 role: "list", 15291 className: "font-library-modal__fonts-list", 15292 children: getSortedFontFaces(selectedFont).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 15293 className: "font-library-modal__fonts-list-item", 15294 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(collection_font_variant, { 15295 font: selectedFont, 15296 face: face, 15297 handleToggleVariant: handleToggleVariant, 15298 selected: isFontFontFaceInOutline(selectedFont.slug, selectedFont.fontFace ? face : null, 15299 // If the font has no fontFace, we want to check if the font is in the outline 15300 fontToInstallOutline) 15301 }) 15302 }, `face$i}`)) 15303 }) 15304 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15305 margin: 16 15306 })] 15307 })] 15308 }), selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 15309 justify: "flex-end", 15310 className: "font-library-modal__footer", 15311 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15312 __next40pxDefaultSize: true, 15313 variant: "primary", 15314 onClick: handleInstall, 15315 isBusy: isInstalling, 15316 disabled: fontsToInstall.length === 0 || isInstalling, 15317 accessibleWhenDisabled: true, 15318 children: (0,external_wp_i18n_namespaceObject.__)('Install') 15319 }) 15320 }), !selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15321 expanded: false, 15322 className: "font-library-modal__footer", 15323 justify: "end", 15324 spacing: 6, 15325 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 15326 justify: "flex-start", 15327 expanded: false, 15328 spacing: 1, 15329 className: "font-library-modal__page-selection", 15330 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( 15331 // translators: 1: Current page number, 2: Total number of pages. 15332 (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { 15333 div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 15334 "aria-hidden": true 15335 }), 15336 CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 15337 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), 15338 value: page, 15339 options: [...Array(totalPages)].map((e, i) => { 15340 return { 15341 label: i + 1, 15342 value: i + 1 15343 }; 15344 }), 15345 onChange: newPage => setPage(parseInt(newPage)), 15346 size: "small", 15347 __nextHasNoMarginBottom: true, 15348 variant: "minimal" 15349 }) 15350 }) 15351 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15352 expanded: false, 15353 spacing: 1, 15354 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15355 onClick: () => setPage(page - 1), 15356 disabled: page === 1, 15357 accessibleWhenDisabled: true, 15358 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 15359 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 15360 showTooltip: true, 15361 size: "compact", 15362 tooltipPosition: "top" 15363 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15364 onClick: () => setPage(page + 1), 15365 disabled: page === totalPages, 15366 accessibleWhenDisabled: true, 15367 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 15368 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 15369 showTooltip: true, 15370 size: "compact", 15371 tooltipPosition: "top" 15372 })] 15373 })] 15374 })] 15375 })] 15376 }); 15377 } 15378 /* harmony default export */ const font_collection = (FontCollection); 15379 15380 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js 15381 var unbrotli = __webpack_require__(8572); 15382 var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli); 15383 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js 15384 var inflate = __webpack_require__(4660); 15385 var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate); 15386 ;// ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js 15387 /** 15388 * Credits: 15389 * 15390 * lib-font 15391 * https://github.com/Pomax/lib-font 15392 * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js 15393 * 15394 * The MIT License (MIT) 15395 * 15396 * Copyright (c) 2020 pomax@nihongoresources.com 15397 * 15398 * Permission is hereby granted, free of charge, to any person obtaining a copy 15399 * of this software and associated documentation files (the "Software"), to deal 15400 * in the Software without restriction, including without limitation the rights 15401 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15402 * copies of the Software, and to permit persons to whom the Software is 15403 * furnished to do so, subject to the following conditions: 15404 * 15405 * The above copyright notice and this permission notice shall be included in all 15406 * copies or substantial portions of the Software. 15407 * 15408 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15409 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15410 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15411 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15412 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15413 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 15414 * SOFTWARE. 15415 */ 15416 15417 /* eslint eslint-comments/no-unlimited-disable: 0 */ 15418 /* eslint-disable */ 15419 // import pako from 'pako'; 15420 15421 15422 15423 let fetchFunction = globalThis.fetch; 15424 // if ( ! fetchFunction ) { 15425 // let backlog = []; 15426 // fetchFunction = globalThis.fetch = ( ...args ) => 15427 // new Promise( ( resolve, reject ) => { 15428 // backlog.push( { args: args, resolve: resolve, reject: reject } ); 15429 // } ); 15430 // import( 'fs' ) 15431 // .then( ( fs ) => { 15432 // fetchFunction = globalThis.fetch = async function ( path ) { 15433 // return new Promise( ( resolve, reject ) => { 15434 // fs.readFile( path, ( err, data ) => { 15435 // if ( err ) return reject( err ); 15436 // resolve( { ok: true, arrayBuffer: () => data.buffer } ); 15437 // } ); 15438 // } ); 15439 // }; 15440 // while ( backlog.length ) { 15441 // let instruction = backlog.shift(); 15442 // fetchFunction( ...instruction.args ) 15443 // .then( ( data ) => instruction.resolve( data ) ) 15444 // .catch( ( err ) => instruction.reject( err ) ); 15445 // } 15446 // } ) 15447 // .catch( ( err ) => { 15448 // console.error( err ); 15449 // throw new Error( 15450 // `lib-font cannot run unless either the Fetch API or Node's filesystem module is available.` 15451 // ); 15452 // } ); 15453 // } 15454 class lib_font_browser_Event { 15455 constructor( type, detail = {}, msg ) { 15456 this.type = type; 15457 this.detail = detail; 15458 this.msg = msg; 15459 Object.defineProperty( this, `__mayPropagate`, { 15460 enumerable: false, 15461 writable: true, 15462 } ); 15463 this.__mayPropagate = true; 15464 } 15465 preventDefault() {} 15466 stopPropagation() { 15467 this.__mayPropagate = false; 15468 } 15469 valueOf() { 15470 return this; 15471 } 15472 toString() { 15473 return this.msg 15474 ? `[${ this.type } event]: ${ this.msg }` 15475 : `[${ this.type } event]`; 15476 } 15477 } 15478 class EventManager { 15479 constructor() { 15480 this.listeners = {}; 15481 } 15482 addEventListener( type, listener, useCapture ) { 15483 let bin = this.listeners[ type ] || []; 15484 if ( useCapture ) bin.unshift( listener ); 15485 else bin.push( listener ); 15486 this.listeners[ type ] = bin; 15487 } 15488 removeEventListener( type, listener ) { 15489 let bin = this.listeners[ type ] || []; 15490 let pos = bin.findIndex( ( e ) => e === listener ); 15491 if ( pos > -1 ) { 15492 bin.splice( pos, 1 ); 15493 this.listeners[ type ] = bin; 15494 } 15495 } 15496 dispatch( event ) { 15497 let bin = this.listeners[ event.type ]; 15498 if ( bin ) { 15499 for ( let l = 0, e = bin.length; l < e; l++ ) { 15500 if ( ! event.__mayPropagate ) break; 15501 bin[ l ]( event ); 15502 } 15503 } 15504 } 15505 } 15506 const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime(); 15507 function asText( data ) { 15508 return Array.from( data ) 15509 .map( ( v ) => String.fromCharCode( v ) ) 15510 .join( `` ); 15511 } 15512 class Parser { 15513 constructor( dict, dataview, name ) { 15514 this.name = ( name || dict.tag || `` ).trim(); 15515 this.length = dict.length; 15516 this.start = dict.offset; 15517 this.offset = 0; 15518 this.data = dataview; 15519 [ 15520 `getInt8`, 15521 `getUint8`, 15522 `getInt16`, 15523 `getUint16`, 15524 `getInt32`, 15525 `getUint32`, 15526 `getBigInt64`, 15527 `getBigUint64`, 15528 ].forEach( ( name ) => { 15529 let fn = name.replace( /get(Big)?/, '' ).toLowerCase(); 15530 let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8; 15531 Object.defineProperty( this, fn, { 15532 get: () => this.getValue( name, increment ), 15533 } ); 15534 } ); 15535 } 15536 get currentPosition() { 15537 return this.start + this.offset; 15538 } 15539 set currentPosition( position ) { 15540 this.start = position; 15541 this.offset = 0; 15542 } 15543 skip( n = 0, bits = 8 ) { 15544 this.offset += ( n * bits ) / 8; 15545 } 15546 getValue( type, increment ) { 15547 let pos = this.start + this.offset; 15548 this.offset += increment; 15549 try { 15550 return this.data[ type ]( pos ); 15551 } catch ( e ) { 15552 console.error( `parser`, type, increment, this ); 15553 console.error( `parser`, this.start, this.offset ); 15554 throw e; 15555 } 15556 } 15557 flags( n ) { 15558 if ( n === 8 || n === 16 || n === 32 || n === 64 ) { 15559 return this[ `uint${ n }` ] 15560 .toString( 2 ) 15561 .padStart( n, 0 ) 15562 .split( `` ) 15563 .map( ( v ) => v === '1' ); 15564 } 15565 console.error( 15566 `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` 15567 ); 15568 console.trace(); 15569 } 15570 get tag() { 15571 const t = this.uint32; 15572 return asText( [ 15573 ( t >> 24 ) & 255, 15574 ( t >> 16 ) & 255, 15575 ( t >> 8 ) & 255, 15576 t & 255, 15577 ] ); 15578 } 15579 get fixed() { 15580 let major = this.int16; 15581 let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 ); 15582 return major + minor / 1e3; 15583 } 15584 get legacyFixed() { 15585 let major = this.uint16; 15586 let minor = this.uint16.toString( 16 ).padStart( 4, 0 ); 15587 return parseFloat( `${ major }.${ minor }` ); 15588 } 15589 get uint24() { 15590 return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8; 15591 } 15592 get uint128() { 15593 let value = 0; 15594 for ( let i = 0; i < 5; i++ ) { 15595 let byte = this.uint8; 15596 value = value * 128 + ( byte & 127 ); 15597 if ( byte < 128 ) break; 15598 } 15599 return value; 15600 } 15601 get longdatetime() { 15602 return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) ); 15603 } 15604 get fword() { 15605 return this.int16; 15606 } 15607 get ufword() { 15608 return this.uint16; 15609 } 15610 get Offset16() { 15611 return this.uint16; 15612 } 15613 get Offset32() { 15614 return this.uint32; 15615 } 15616 get F2DOT14() { 15617 const bits = p.uint16; 15618 const integer = [ 0, 1, -2, -1 ][ bits >> 14 ]; 15619 const fraction = bits & 16383; 15620 return integer + fraction / 16384; 15621 } 15622 verifyLength() { 15623 if ( this.offset != this.length ) { 15624 console.error( 15625 `unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })` 15626 ); 15627 } 15628 } 15629 readBytes( n = 0, position = 0, bits = 8, signed = false ) { 15630 n = n || this.length; 15631 if ( n === 0 ) return []; 15632 if ( position ) this.currentPosition = position; 15633 const fn = `${ signed ? `` : `u` }int${ bits }`, 15634 slice = []; 15635 while ( n-- ) slice.push( this[ fn ] ); 15636 return slice; 15637 } 15638 } 15639 class ParsedData { 15640 constructor( parser ) { 15641 const pGetter = { enumerable: false, get: () => parser }; 15642 Object.defineProperty( this, `parser`, pGetter ); 15643 const start = parser.currentPosition; 15644 const startGetter = { enumerable: false, get: () => start }; 15645 Object.defineProperty( this, `start`, startGetter ); 15646 } 15647 load( struct ) { 15648 Object.keys( struct ).forEach( ( p ) => { 15649 let props = Object.getOwnPropertyDescriptor( struct, p ); 15650 if ( props.get ) { 15651 this[ p ] = props.get.bind( this ); 15652 } else if ( props.value !== undefined ) { 15653 this[ p ] = props.value; 15654 } 15655 } ); 15656 if ( this.parser.length ) { 15657 this.parser.verifyLength(); 15658 } 15659 } 15660 } 15661 class SimpleTable extends ParsedData { 15662 constructor( dict, dataview, name ) { 15663 const { parser: parser, start: start } = super( 15664 new Parser( dict, dataview, name ) 15665 ); 15666 const pGetter = { enumerable: false, get: () => parser }; 15667 Object.defineProperty( this, `p`, pGetter ); 15668 const startGetter = { enumerable: false, get: () => start }; 15669 Object.defineProperty( this, `tableStart`, startGetter ); 15670 } 15671 } 15672 function lazy$1( object, property, getter ) { 15673 let val; 15674 Object.defineProperty( object, property, { 15675 get: () => { 15676 if ( val ) return val; 15677 val = getter(); 15678 return val; 15679 }, 15680 enumerable: true, 15681 } ); 15682 } 15683 class SFNT extends SimpleTable { 15684 constructor( font, dataview, createTable ) { 15685 const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` ); 15686 this.version = p.uint32; 15687 this.numTables = p.uint16; 15688 this.searchRange = p.uint16; 15689 this.entrySelector = p.uint16; 15690 this.rangeShift = p.uint16; 15691 p.verifyLength(); 15692 this.directory = [ ...new Array( this.numTables ) ].map( 15693 ( _ ) => new TableRecord( p ) 15694 ); 15695 this.tables = {}; 15696 this.directory.forEach( ( entry ) => { 15697 const getter = () => 15698 createTable( 15699 this.tables, 15700 { 15701 tag: entry.tag, 15702 offset: entry.offset, 15703 length: entry.length, 15704 }, 15705 dataview 15706 ); 15707 lazy$1( this.tables, entry.tag.trim(), getter ); 15708 } ); 15709 } 15710 } 15711 class TableRecord { 15712 constructor( p ) { 15713 this.tag = p.tag; 15714 this.checksum = p.uint32; 15715 this.offset = p.uint32; 15716 this.length = p.uint32; 15717 } 15718 } 15719 const gzipDecode = (inflate_default()).inflate || undefined; 15720 let nativeGzipDecode = undefined; 15721 // if ( ! gzipDecode ) { 15722 // import( 'zlib' ).then( ( zlib ) => { 15723 // nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer ); 15724 // } ); 15725 // } 15726 class WOFF$1 extends SimpleTable { 15727 constructor( font, dataview, createTable ) { 15728 const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` ); 15729 this.signature = p.tag; 15730 this.flavor = p.uint32; 15731 this.length = p.uint32; 15732 this.numTables = p.uint16; 15733 p.uint16; 15734 this.totalSfntSize = p.uint32; 15735 this.majorVersion = p.uint16; 15736 this.minorVersion = p.uint16; 15737 this.metaOffset = p.uint32; 15738 this.metaLength = p.uint32; 15739 this.metaOrigLength = p.uint32; 15740 this.privOffset = p.uint32; 15741 this.privLength = p.uint32; 15742 p.verifyLength(); 15743 this.directory = [ ...new Array( this.numTables ) ].map( 15744 ( _ ) => new WoffTableDirectoryEntry( p ) 15745 ); 15746 buildWoffLazyLookups( this, dataview, createTable ); 15747 } 15748 } 15749 class WoffTableDirectoryEntry { 15750 constructor( p ) { 15751 this.tag = p.tag; 15752 this.offset = p.uint32; 15753 this.compLength = p.uint32; 15754 this.origLength = p.uint32; 15755 this.origChecksum = p.uint32; 15756 } 15757 } 15758 function buildWoffLazyLookups( woff, dataview, createTable ) { 15759 woff.tables = {}; 15760 woff.directory.forEach( ( entry ) => { 15761 lazy$1( woff.tables, entry.tag.trim(), () => { 15762 let offset = 0; 15763 let view = dataview; 15764 if ( entry.compLength !== entry.origLength ) { 15765 const data = dataview.buffer.slice( 15766 entry.offset, 15767 entry.offset + entry.compLength 15768 ); 15769 let unpacked; 15770 if ( gzipDecode ) { 15771 unpacked = gzipDecode( new Uint8Array( data ) ); 15772 } else if ( nativeGzipDecode ) { 15773 unpacked = nativeGzipDecode( new Uint8Array( data ) ); 15774 } else { 15775 const msg = `no brotli decoder available to decode WOFF2 font`; 15776 if ( font.onerror ) font.onerror( msg ); 15777 throw new Error( msg ); 15778 } 15779 view = new DataView( unpacked.buffer ); 15780 } else { 15781 offset = entry.offset; 15782 } 15783 return createTable( 15784 woff.tables, 15785 { tag: entry.tag, offset: offset, length: entry.origLength }, 15786 view 15787 ); 15788 } ); 15789 } ); 15790 } 15791 const brotliDecode = (unbrotli_default()); 15792 let nativeBrotliDecode = undefined; 15793 // if ( ! brotliDecode ) { 15794 // import( 'zlib' ).then( ( zlib ) => { 15795 // nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer ); 15796 // } ); 15797 // } 15798 class WOFF2$1 extends SimpleTable { 15799 constructor( font, dataview, createTable ) { 15800 const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` ); 15801 this.signature = p.tag; 15802 this.flavor = p.uint32; 15803 this.length = p.uint32; 15804 this.numTables = p.uint16; 15805 p.uint16; 15806 this.totalSfntSize = p.uint32; 15807 this.totalCompressedSize = p.uint32; 15808 this.majorVersion = p.uint16; 15809 this.minorVersion = p.uint16; 15810 this.metaOffset = p.uint32; 15811 this.metaLength = p.uint32; 15812 this.metaOrigLength = p.uint32; 15813 this.privOffset = p.uint32; 15814 this.privLength = p.uint32; 15815 p.verifyLength(); 15816 this.directory = [ ...new Array( this.numTables ) ].map( 15817 ( _ ) => new Woff2TableDirectoryEntry( p ) 15818 ); 15819 let dictOffset = p.currentPosition; 15820 this.directory[ 0 ].offset = 0; 15821 this.directory.forEach( ( e, i ) => { 15822 let next = this.directory[ i + 1 ]; 15823 if ( next ) { 15824 next.offset = 15825 e.offset + 15826 ( e.transformLength !== undefined 15827 ? e.transformLength 15828 : e.origLength ); 15829 } 15830 } ); 15831 let decoded; 15832 let buffer = dataview.buffer.slice( dictOffset ); 15833 if ( brotliDecode ) { 15834 decoded = brotliDecode( new Uint8Array( buffer ) ); 15835 } else if ( nativeBrotliDecode ) { 15836 decoded = new Uint8Array( nativeBrotliDecode( buffer ) ); 15837 } else { 15838 const msg = `no brotli decoder available to decode WOFF2 font`; 15839 if ( font.onerror ) font.onerror( msg ); 15840 throw new Error( msg ); 15841 } 15842 buildWoff2LazyLookups( this, decoded, createTable ); 15843 } 15844 } 15845 class Woff2TableDirectoryEntry { 15846 constructor( p ) { 15847 this.flags = p.uint8; 15848 const tagNumber = ( this.tagNumber = this.flags & 63 ); 15849 if ( tagNumber === 63 ) { 15850 this.tag = p.tag; 15851 } else { 15852 this.tag = getWOFF2Tag( tagNumber ); 15853 } 15854 const transformVersion = ( this.transformVersion = 15855 ( this.flags & 192 ) >> 6 ); 15856 let hasTransforms = transformVersion !== 0; 15857 if ( this.tag === `glyf` || this.tag === `loca` ) { 15858 hasTransforms = this.transformVersion !== 3; 15859 } 15860 this.origLength = p.uint128; 15861 if ( hasTransforms ) { 15862 this.transformLength = p.uint128; 15863 } 15864 } 15865 } 15866 function buildWoff2LazyLookups( woff2, decoded, createTable ) { 15867 woff2.tables = {}; 15868 woff2.directory.forEach( ( entry ) => { 15869 lazy$1( woff2.tables, entry.tag.trim(), () => { 15870 const start = entry.offset; 15871 const end = 15872 start + 15873 ( entry.transformLength 15874 ? entry.transformLength 15875 : entry.origLength ); 15876 const data = new DataView( decoded.slice( start, end ).buffer ); 15877 try { 15878 return createTable( 15879 woff2.tables, 15880 { tag: entry.tag, offset: 0, length: entry.origLength }, 15881 data 15882 ); 15883 } catch ( e ) { 15884 console.error( e ); 15885 } 15886 } ); 15887 } ); 15888 } 15889 function getWOFF2Tag( flag ) { 15890 return [ 15891 `cmap`, 15892 `head`, 15893 `hhea`, 15894 `hmtx`, 15895 `maxp`, 15896 `name`, 15897 `OS/2`, 15898 `post`, 15899 `cvt `, 15900 `fpgm`, 15901 `glyf`, 15902 `loca`, 15903 `prep`, 15904 `CFF `, 15905 `VORG`, 15906 `EBDT`, 15907 `EBLC`, 15908 `gasp`, 15909 `hdmx`, 15910 `kern`, 15911 `LTSH`, 15912 `PCLT`, 15913 `VDMX`, 15914 `vhea`, 15915 `vmtx`, 15916 `BASE`, 15917 `GDEF`, 15918 `GPOS`, 15919 `GSUB`, 15920 `EBSC`, 15921 `JSTF`, 15922 `MATH`, 15923 `CBDT`, 15924 `CBLC`, 15925 `COLR`, 15926 `CPAL`, 15927 `SVG `, 15928 `sbix`, 15929 `acnt`, 15930 `avar`, 15931 `bdat`, 15932 `bloc`, 15933 `bsln`, 15934 `cvar`, 15935 `fdsc`, 15936 `feat`, 15937 `fmtx`, 15938 `fvar`, 15939 `gvar`, 15940 `hsty`, 15941 `just`, 15942 `lcar`, 15943 `mort`, 15944 `morx`, 15945 `opbd`, 15946 `prop`, 15947 `trak`, 15948 `Zapf`, 15949 `Silf`, 15950 `Glat`, 15951 `Gloc`, 15952 `Feat`, 15953 `Sill`, 15954 ][ flag & 63 ]; 15955 } 15956 const tableClasses = {}; 15957 let tableClassesLoaded = false; 15958 Promise.all( [ 15959 Promise.resolve().then( function () { 15960 return cmap$1; 15961 } ), 15962 Promise.resolve().then( function () { 15963 return head$1; 15964 } ), 15965 Promise.resolve().then( function () { 15966 return hhea$1; 15967 } ), 15968 Promise.resolve().then( function () { 15969 return hmtx$1; 15970 } ), 15971 Promise.resolve().then( function () { 15972 return maxp$1; 15973 } ), 15974 Promise.resolve().then( function () { 15975 return name$1; 15976 } ), 15977 Promise.resolve().then( function () { 15978 return OS2$1; 15979 } ), 15980 Promise.resolve().then( function () { 15981 return post$1; 15982 } ), 15983 Promise.resolve().then( function () { 15984 return BASE$1; 15985 } ), 15986 Promise.resolve().then( function () { 15987 return GDEF$1; 15988 } ), 15989 Promise.resolve().then( function () { 15990 return GSUB$1; 15991 } ), 15992 Promise.resolve().then( function () { 15993 return GPOS$1; 15994 } ), 15995 Promise.resolve().then( function () { 15996 return SVG$1; 15997 } ), 15998 Promise.resolve().then( function () { 15999 return fvar$1; 16000 } ), 16001 Promise.resolve().then( function () { 16002 return cvt$1; 16003 } ), 16004 Promise.resolve().then( function () { 16005 return fpgm$1; 16006 } ), 16007 Promise.resolve().then( function () { 16008 return gasp$1; 16009 } ), 16010 Promise.resolve().then( function () { 16011 return glyf$1; 16012 } ), 16013 Promise.resolve().then( function () { 16014 return loca$1; 16015 } ), 16016 Promise.resolve().then( function () { 16017 return prep$1; 16018 } ), 16019 Promise.resolve().then( function () { 16020 return CFF$1; 16021 } ), 16022 Promise.resolve().then( function () { 16023 return CFF2$1; 16024 } ), 16025 Promise.resolve().then( function () { 16026 return VORG$1; 16027 } ), 16028 Promise.resolve().then( function () { 16029 return EBLC$1; 16030 } ), 16031 Promise.resolve().then( function () { 16032 return EBDT$1; 16033 } ), 16034 Promise.resolve().then( function () { 16035 return EBSC$1; 16036 } ), 16037 Promise.resolve().then( function () { 16038 return CBLC$1; 16039 } ), 16040 Promise.resolve().then( function () { 16041 return CBDT$1; 16042 } ), 16043 Promise.resolve().then( function () { 16044 return sbix$1; 16045 } ), 16046 Promise.resolve().then( function () { 16047 return COLR$1; 16048 } ), 16049 Promise.resolve().then( function () { 16050 return CPAL$1; 16051 } ), 16052 Promise.resolve().then( function () { 16053 return DSIG$1; 16054 } ), 16055 Promise.resolve().then( function () { 16056 return hdmx$1; 16057 } ), 16058 Promise.resolve().then( function () { 16059 return kern$1; 16060 } ), 16061 Promise.resolve().then( function () { 16062 return LTSH$1; 16063 } ), 16064 Promise.resolve().then( function () { 16065 return MERG$1; 16066 } ), 16067 Promise.resolve().then( function () { 16068 return meta$1; 16069 } ), 16070 Promise.resolve().then( function () { 16071 return PCLT$1; 16072 } ), 16073 Promise.resolve().then( function () { 16074 return VDMX$1; 16075 } ), 16076 Promise.resolve().then( function () { 16077 return vhea$1; 16078 } ), 16079 Promise.resolve().then( function () { 16080 return vmtx$1; 16081 } ), 16082 ] ).then( ( data ) => { 16083 data.forEach( ( e ) => { 16084 let name = Object.keys( e )[ 0 ]; 16085 tableClasses[ name ] = e[ name ]; 16086 } ); 16087 tableClassesLoaded = true; 16088 } ); 16089 function createTable( tables, dict, dataview ) { 16090 let name = dict.tag.replace( /[^\w\d]/g, `` ); 16091 let Type = tableClasses[ name ]; 16092 if ( Type ) return new Type( dict, dataview, tables ); 16093 console.warn( 16094 `lib-font has no definition for ${ name }. The table was skipped.` 16095 ); 16096 return {}; 16097 } 16098 function loadTableClasses() { 16099 let count = 0; 16100 function checkLoaded( resolve, reject ) { 16101 if ( ! tableClassesLoaded ) { 16102 if ( count > 10 ) { 16103 return reject( new Error( `loading took too long` ) ); 16104 } 16105 count++; 16106 return setTimeout( () => checkLoaded( resolve ), 250 ); 16107 } 16108 resolve( createTable ); 16109 } 16110 return new Promise( ( resolve, reject ) => checkLoaded( resolve ) ); 16111 } 16112 function getFontCSSFormat( path, errorOnStyle ) { 16113 let pos = path.lastIndexOf( `.` ); 16114 let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase(); 16115 let format = { 16116 ttf: `truetype`, 16117 otf: `opentype`, 16118 woff: `woff`, 16119 woff2: `woff2`, 16120 }[ ext ]; 16121 if ( format ) return format; 16122 let msg = { 16123 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.`, 16124 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.`, 16125 fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, 16126 ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`, 16127 }[ ext ]; 16128 if ( ! msg ) msg = `${ path } is not a known webfont format.`; 16129 if ( errorOnStyle ) { 16130 throw new Error( msg ); 16131 } else { 16132 console.warn( `Could not load font: ${ msg }` ); 16133 } 16134 } 16135 async function setupFontFace( name, url, options = {} ) { 16136 if ( ! globalThis.document ) return; 16137 let format = getFontCSSFormat( url, options.errorOnStyle ); 16138 if ( ! format ) return; 16139 let style = document.createElement( `style` ); 16140 style.className = `injected-by-Font-js`; 16141 let rules = []; 16142 if ( options.styleRules ) { 16143 rules = Object.entries( options.styleRules ).map( 16144 ( [ key, value ] ) => `${ key }: ${ value };` 16145 ); 16146 } 16147 style.textContent = `\n@font-face {\n font-family: "${ name }";\n ${ rules.join( 16148 `\n\t` 16149 ) }\n src: url("${ url }") format("${ format }");\n}`; 16150 globalThis.document.head.appendChild( style ); 16151 return style; 16152 } 16153 const TTF = [ 0, 1, 0, 0 ]; 16154 const OTF = [ 79, 84, 84, 79 ]; 16155 const WOFF = [ 119, 79, 70, 70 ]; 16156 const WOFF2 = [ 119, 79, 70, 50 ]; 16157 function match( ar1, ar2 ) { 16158 if ( ar1.length !== ar2.length ) return; 16159 for ( let i = 0; i < ar1.length; i++ ) { 16160 if ( ar1[ i ] !== ar2[ i ] ) return; 16161 } 16162 return true; 16163 } 16164 function validFontFormat( dataview ) { 16165 const LEAD_BYTES = [ 16166 dataview.getUint8( 0 ), 16167 dataview.getUint8( 1 ), 16168 dataview.getUint8( 2 ), 16169 dataview.getUint8( 3 ), 16170 ]; 16171 if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`; 16172 if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`; 16173 if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`; 16174 } 16175 function checkFetchResponseStatus( response ) { 16176 if ( ! response.ok ) { 16177 throw new Error( 16178 `HTTP ${ response.status } - ${ response.statusText }` 16179 ); 16180 } 16181 return response; 16182 } 16183 class Font extends EventManager { 16184 constructor( name, options = {} ) { 16185 super(); 16186 this.name = name; 16187 this.options = options; 16188 this.metrics = false; 16189 } 16190 get src() { 16191 return this.__src; 16192 } 16193 set src( src ) { 16194 this.__src = src; 16195 ( async () => { 16196 if ( globalThis.document && ! this.options.skipStyleSheet ) { 16197 await setupFontFace( this.name, src, this.options ); 16198 } 16199 this.loadFont( src ); 16200 } )(); 16201 } 16202 async loadFont( url, filename ) { 16203 fetch( url ) 16204 .then( 16205 ( response ) => 16206 checkFetchResponseStatus( response ) && 16207 response.arrayBuffer() 16208 ) 16209 .then( ( buffer ) => 16210 this.fromDataBuffer( buffer, filename || url ) 16211 ) 16212 .catch( ( err ) => { 16213 const evt = new lib_font_browser_Event( 16214 `error`, 16215 err, 16216 `Failed to load font at ${ filename || url }` 16217 ); 16218 this.dispatch( evt ); 16219 if ( this.onerror ) this.onerror( evt ); 16220 } ); 16221 } 16222 async fromDataBuffer( buffer, filenameOrUrL ) { 16223 this.fontData = new DataView( buffer ); 16224 let type = validFontFormat( this.fontData ); 16225 if ( ! type ) { 16226 throw new Error( 16227 `${ filenameOrUrL } is either an unsupported font format, or not a font at all.` 16228 ); 16229 } 16230 await this.parseBasicData( type ); 16231 const evt = new lib_font_browser_Event( 'load', { font: this } ); 16232 this.dispatch( evt ); 16233 if ( this.onload ) this.onload( evt ); 16234 } 16235 async parseBasicData( type ) { 16236 return loadTableClasses().then( ( createTable ) => { 16237 if ( type === `SFNT` ) { 16238 this.opentype = new SFNT( this, this.fontData, createTable ); 16239 } 16240 if ( type === `WOFF` ) { 16241 this.opentype = new WOFF$1( this, this.fontData, createTable ); 16242 } 16243 if ( type === `WOFF2` ) { 16244 this.opentype = new WOFF2$1( this, this.fontData, createTable ); 16245 } 16246 return this.opentype; 16247 } ); 16248 } 16249 getGlyphId( char ) { 16250 return this.opentype.tables.cmap.getGlyphId( char ); 16251 } 16252 reverse( glyphid ) { 16253 return this.opentype.tables.cmap.reverse( glyphid ); 16254 } 16255 supports( char ) { 16256 return this.getGlyphId( char ) !== 0; 16257 } 16258 supportsVariation( variation ) { 16259 return ( 16260 this.opentype.tables.cmap.supportsVariation( variation ) !== false 16261 ); 16262 } 16263 measureText( text, size = 16 ) { 16264 if ( this.__unloaded ) 16265 throw new Error( 16266 'Cannot measure text: font was unloaded. Please reload before calling measureText()' 16267 ); 16268 let d = document.createElement( 'div' ); 16269 d.textContent = text; 16270 d.style.fontFamily = this.name; 16271 d.style.fontSize = `${ size }px`; 16272 d.style.color = `transparent`; 16273 d.style.background = `transparent`; 16274 d.style.top = `0`; 16275 d.style.left = `0`; 16276 d.style.position = `absolute`; 16277 document.body.appendChild( d ); 16278 let bbox = d.getBoundingClientRect(); 16279 document.body.removeChild( d ); 16280 const OS2 = this.opentype.tables[ 'OS/2' ]; 16281 bbox.fontSize = size; 16282 bbox.ascender = OS2.sTypoAscender; 16283 bbox.descender = OS2.sTypoDescender; 16284 return bbox; 16285 } 16286 unload() { 16287 if ( this.styleElement.parentNode ) { 16288 this.styleElement.parentNode.removeElement( this.styleElement ); 16289 const evt = new lib_font_browser_Event( 'unload', { font: this } ); 16290 this.dispatch( evt ); 16291 if ( this.onunload ) this.onunload( evt ); 16292 } 16293 this._unloaded = true; 16294 } 16295 load() { 16296 if ( this.__unloaded ) { 16297 delete this.__unloaded; 16298 document.head.appendChild( this.styleElement ); 16299 const evt = new lib_font_browser_Event( 'load', { font: this } ); 16300 this.dispatch( evt ); 16301 if ( this.onload ) this.onload( evt ); 16302 } 16303 } 16304 } 16305 globalThis.Font = Font; 16306 class Subtable extends ParsedData { 16307 constructor( p, plaformID, encodingID ) { 16308 super( p ); 16309 this.plaformID = plaformID; 16310 this.encodingID = encodingID; 16311 } 16312 } 16313 class Format0 extends Subtable { 16314 constructor( p, platformID, encodingID ) { 16315 super( p, platformID, encodingID ); 16316 this.format = 0; 16317 this.length = p.uint16; 16318 this.language = p.uint16; 16319 this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 ); 16320 } 16321 supports( charCode ) { 16322 if ( charCode.charCodeAt ) { 16323 charCode = -1; 16324 console.warn( 16325 `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` 16326 ); 16327 } 16328 return 0 <= charCode && charCode <= 255; 16329 } 16330 reverse( glyphID ) { 16331 console.warn( `reverse not implemented for cmap subtable format 0` ); 16332 return {}; 16333 } 16334 getSupportedCharCodes() { 16335 return [ { start: 1, end: 256 } ]; 16336 } 16337 } 16338 class Format2 extends Subtable { 16339 constructor( p, platformID, encodingID ) { 16340 super( p, platformID, encodingID ); 16341 this.format = 2; 16342 this.length = p.uint16; 16343 this.language = p.uint16; 16344 this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 ); 16345 const subHeaderCount = Math.max( ...this.subHeaderKeys ); 16346 const subHeaderOffset = p.currentPosition; 16347 lazy$1( this, `subHeaders`, () => { 16348 p.currentPosition = subHeaderOffset; 16349 return [ ...new Array( subHeaderCount ) ].map( 16350 ( _ ) => new SubHeader( p ) 16351 ); 16352 } ); 16353 const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; 16354 lazy$1( this, `glyphIndexArray`, () => { 16355 p.currentPosition = glyphIndexOffset; 16356 return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 ); 16357 } ); 16358 } 16359 supports( charCode ) { 16360 if ( charCode.charCodeAt ) { 16361 charCode = -1; 16362 console.warn( 16363 `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` 16364 ); 16365 } 16366 const low = charCode && 255; 16367 const high = charCode && 65280; 16368 const subHeaderKey = this.subHeaders[ high ]; 16369 const subheader = this.subHeaders[ subHeaderKey ]; 16370 const first = subheader.firstCode; 16371 const last = first + subheader.entryCount; 16372 return first <= low && low <= last; 16373 } 16374 reverse( glyphID ) { 16375 console.warn( `reverse not implemented for cmap subtable format 2` ); 16376 return {}; 16377 } 16378 getSupportedCharCodes( preservePropNames = false ) { 16379 if ( preservePropNames ) { 16380 return this.subHeaders.map( ( h ) => ( { 16381 firstCode: h.firstCode, 16382 lastCode: h.lastCode, 16383 } ) ); 16384 } 16385 return this.subHeaders.map( ( h ) => ( { 16386 start: h.firstCode, 16387 end: h.lastCode, 16388 } ) ); 16389 } 16390 } 16391 class SubHeader { 16392 constructor( p ) { 16393 this.firstCode = p.uint16; 16394 this.entryCount = p.uint16; 16395 this.lastCode = this.first + this.entryCount; 16396 this.idDelta = p.int16; 16397 this.idRangeOffset = p.uint16; 16398 } 16399 } 16400 class Format4 extends Subtable { 16401 constructor( p, platformID, encodingID ) { 16402 super( p, platformID, encodingID ); 16403 this.format = 4; 16404 this.length = p.uint16; 16405 this.language = p.uint16; 16406 this.segCountX2 = p.uint16; 16407 this.segCount = this.segCountX2 / 2; 16408 this.searchRange = p.uint16; 16409 this.entrySelector = p.uint16; 16410 this.rangeShift = p.uint16; 16411 const endCodePosition = p.currentPosition; 16412 lazy$1( this, `endCode`, () => 16413 p.readBytes( this.segCount, endCodePosition, 16 ) 16414 ); 16415 const startCodePosition = endCodePosition + 2 + this.segCountX2; 16416 lazy$1( this, `startCode`, () => 16417 p.readBytes( this.segCount, startCodePosition, 16 ) 16418 ); 16419 const idDeltaPosition = startCodePosition + this.segCountX2; 16420 lazy$1( this, `idDelta`, () => 16421 p.readBytes( this.segCount, idDeltaPosition, 16, true ) 16422 ); 16423 const idRangePosition = idDeltaPosition + this.segCountX2; 16424 lazy$1( this, `idRangeOffset`, () => 16425 p.readBytes( this.segCount, idRangePosition, 16 ) 16426 ); 16427 const glyphIdArrayPosition = idRangePosition + this.segCountX2; 16428 const glyphIdArrayLength = 16429 this.length - ( glyphIdArrayPosition - this.tableStart ); 16430 lazy$1( this, `glyphIdArray`, () => 16431 p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 ) 16432 ); 16433 lazy$1( this, `segments`, () => 16434 this.buildSegments( idRangePosition, glyphIdArrayPosition, p ) 16435 ); 16436 } 16437 buildSegments( idRangePosition, glyphIdArrayPosition, p ) { 16438 const build = ( _, i ) => { 16439 let startCode = this.startCode[ i ], 16440 endCode = this.endCode[ i ], 16441 idDelta = this.idDelta[ i ], 16442 idRangeOffset = this.idRangeOffset[ i ], 16443 idRangeOffsetPointer = idRangePosition + 2 * i, 16444 glyphIDs = []; 16445 if ( idRangeOffset === 0 ) { 16446 for ( 16447 let i = startCode + idDelta, e = endCode + idDelta; 16448 i <= e; 16449 i++ 16450 ) { 16451 glyphIDs.push( i ); 16452 } 16453 } else { 16454 for ( let i = 0, e = endCode - startCode; i <= e; i++ ) { 16455 p.currentPosition = 16456 idRangeOffsetPointer + idRangeOffset + i * 2; 16457 glyphIDs.push( p.uint16 ); 16458 } 16459 } 16460 return { 16461 startCode: startCode, 16462 endCode: endCode, 16463 idDelta: idDelta, 16464 idRangeOffset: idRangeOffset, 16465 glyphIDs: glyphIDs, 16466 }; 16467 }; 16468 return [ ...new Array( this.segCount ) ].map( build ); 16469 } 16470 reverse( glyphID ) { 16471 let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) ); 16472 if ( ! s ) return {}; 16473 const code = s.startCode + s.glyphIDs.indexOf( glyphID ); 16474 return { code: code, unicode: String.fromCodePoint( code ) }; 16475 } 16476 getGlyphId( charCode ) { 16477 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16478 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 16479 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 16480 return 0; 16481 let segment = this.segments.find( 16482 ( s ) => s.startCode <= charCode && charCode <= s.endCode 16483 ); 16484 if ( ! segment ) return 0; 16485 return segment.glyphIDs[ charCode - segment.startCode ]; 16486 } 16487 supports( charCode ) { 16488 return this.getGlyphId( charCode ) !== 0; 16489 } 16490 getSupportedCharCodes( preservePropNames = false ) { 16491 if ( preservePropNames ) return this.segments; 16492 return this.segments.map( ( v ) => ( { 16493 start: v.startCode, 16494 end: v.endCode, 16495 } ) ); 16496 } 16497 } 16498 class Format6 extends Subtable { 16499 constructor( p, platformID, encodingID ) { 16500 super( p, platformID, encodingID ); 16501 this.format = 6; 16502 this.length = p.uint16; 16503 this.language = p.uint16; 16504 this.firstCode = p.uint16; 16505 this.entryCount = p.uint16; 16506 this.lastCode = this.firstCode + this.entryCount - 1; 16507 const getter = () => 16508 [ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 ); 16509 lazy$1( this, `glyphIdArray`, getter ); 16510 } 16511 supports( charCode ) { 16512 if ( charCode.charCodeAt ) { 16513 charCode = -1; 16514 console.warn( 16515 `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` 16516 ); 16517 } 16518 if ( charCode < this.firstCode ) return {}; 16519 if ( charCode > this.firstCode + this.entryCount ) return {}; 16520 const code = charCode - this.firstCode; 16521 return { code: code, unicode: String.fromCodePoint( code ) }; 16522 } 16523 reverse( glyphID ) { 16524 let pos = this.glyphIdArray.indexOf( glyphID ); 16525 if ( pos > -1 ) return this.firstCode + pos; 16526 } 16527 getSupportedCharCodes( preservePropNames = false ) { 16528 if ( preservePropNames ) { 16529 return [ { firstCode: this.firstCode, lastCode: this.lastCode } ]; 16530 } 16531 return [ { start: this.firstCode, end: this.lastCode } ]; 16532 } 16533 } 16534 class Format8 extends Subtable { 16535 constructor( p, platformID, encodingID ) { 16536 super( p, platformID, encodingID ); 16537 this.format = 8; 16538 p.uint16; 16539 this.length = p.uint32; 16540 this.language = p.uint32; 16541 this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 ); 16542 this.numGroups = p.uint32; 16543 const getter = () => 16544 [ ...new Array( this.numGroups ) ].map( 16545 ( _ ) => new SequentialMapGroup$1( p ) 16546 ); 16547 lazy$1( this, `groups`, getter ); 16548 } 16549 supports( charCode ) { 16550 if ( charCode.charCodeAt ) { 16551 charCode = -1; 16552 console.warn( 16553 `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` 16554 ); 16555 } 16556 return ( 16557 this.groups.findIndex( 16558 ( s ) => 16559 s.startcharCode <= charCode && charCode <= s.endcharCode 16560 ) !== -1 16561 ); 16562 } 16563 reverse( glyphID ) { 16564 console.warn( `reverse not implemented for cmap subtable format 8` ); 16565 return {}; 16566 } 16567 getSupportedCharCodes( preservePropNames = false ) { 16568 if ( preservePropNames ) return this.groups; 16569 return this.groups.map( ( v ) => ( { 16570 start: v.startcharCode, 16571 end: v.endcharCode, 16572 } ) ); 16573 } 16574 } 16575 class SequentialMapGroup$1 { 16576 constructor( p ) { 16577 this.startcharCode = p.uint32; 16578 this.endcharCode = p.uint32; 16579 this.startGlyphID = p.uint32; 16580 } 16581 } 16582 class Format10 extends Subtable { 16583 constructor( p, platformID, encodingID ) { 16584 super( p, platformID, encodingID ); 16585 this.format = 10; 16586 p.uint16; 16587 this.length = p.uint32; 16588 this.language = p.uint32; 16589 this.startCharCode = p.uint32; 16590 this.numChars = p.uint32; 16591 this.endCharCode = this.startCharCode + this.numChars; 16592 const getter = () => 16593 [ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 ); 16594 lazy$1( this, `glyphs`, getter ); 16595 } 16596 supports( charCode ) { 16597 if ( charCode.charCodeAt ) { 16598 charCode = -1; 16599 console.warn( 16600 `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` 16601 ); 16602 } 16603 if ( charCode < this.startCharCode ) return false; 16604 if ( charCode > this.startCharCode + this.numChars ) return false; 16605 return charCode - this.startCharCode; 16606 } 16607 reverse( glyphID ) { 16608 console.warn( `reverse not implemented for cmap subtable format 10` ); 16609 return {}; 16610 } 16611 getSupportedCharCodes( preservePropNames = false ) { 16612 if ( preservePropNames ) { 16613 return [ 16614 { 16615 startCharCode: this.startCharCode, 16616 endCharCode: this.endCharCode, 16617 }, 16618 ]; 16619 } 16620 return [ { start: this.startCharCode, end: this.endCharCode } ]; 16621 } 16622 } 16623 class Format12 extends Subtable { 16624 constructor( p, platformID, encodingID ) { 16625 super( p, platformID, encodingID ); 16626 this.format = 12; 16627 p.uint16; 16628 this.length = p.uint32; 16629 this.language = p.uint32; 16630 this.numGroups = p.uint32; 16631 const getter = () => 16632 [ ...new Array( this.numGroups ) ].map( 16633 ( _ ) => new SequentialMapGroup( p ) 16634 ); 16635 lazy$1( this, `groups`, getter ); 16636 } 16637 supports( charCode ) { 16638 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16639 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 16640 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 16641 return 0; 16642 return ( 16643 this.groups.findIndex( 16644 ( s ) => 16645 s.startCharCode <= charCode && charCode <= s.endCharCode 16646 ) !== -1 16647 ); 16648 } 16649 reverse( glyphID ) { 16650 for ( let group of this.groups ) { 16651 let start = group.startGlyphID; 16652 if ( start > glyphID ) continue; 16653 if ( start === glyphID ) return group.startCharCode; 16654 let end = start + ( group.endCharCode - group.startCharCode ); 16655 if ( end < glyphID ) continue; 16656 const code = group.startCharCode + ( glyphID - start ); 16657 return { code: code, unicode: String.fromCodePoint( code ) }; 16658 } 16659 return {}; 16660 } 16661 getSupportedCharCodes( preservePropNames = false ) { 16662 if ( preservePropNames ) return this.groups; 16663 return this.groups.map( ( v ) => ( { 16664 start: v.startCharCode, 16665 end: v.endCharCode, 16666 } ) ); 16667 } 16668 } 16669 class SequentialMapGroup { 16670 constructor( p ) { 16671 this.startCharCode = p.uint32; 16672 this.endCharCode = p.uint32; 16673 this.startGlyphID = p.uint32; 16674 } 16675 } 16676 class Format13 extends Subtable { 16677 constructor( p, platformID, encodingID ) { 16678 super( p, platformID, encodingID ); 16679 this.format = 13; 16680 p.uint16; 16681 this.length = p.uint32; 16682 this.language = p.uint32; 16683 this.numGroups = p.uint32; 16684 const getter = [ ...new Array( this.numGroups ) ].map( 16685 ( _ ) => new ConstantMapGroup( p ) 16686 ); 16687 lazy$1( this, `groups`, getter ); 16688 } 16689 supports( charCode ) { 16690 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16691 return ( 16692 this.groups.findIndex( 16693 ( s ) => 16694 s.startCharCode <= charCode && charCode <= s.endCharCode 16695 ) !== -1 16696 ); 16697 } 16698 reverse( glyphID ) { 16699 console.warn( `reverse not implemented for cmap subtable format 13` ); 16700 return {}; 16701 } 16702 getSupportedCharCodes( preservePropNames = false ) { 16703 if ( preservePropNames ) return this.groups; 16704 return this.groups.map( ( v ) => ( { 16705 start: v.startCharCode, 16706 end: v.endCharCode, 16707 } ) ); 16708 } 16709 } 16710 class ConstantMapGroup { 16711 constructor( p ) { 16712 this.startCharCode = p.uint32; 16713 this.endCharCode = p.uint32; 16714 this.glyphID = p.uint32; 16715 } 16716 } 16717 class Format14 extends Subtable { 16718 constructor( p, platformID, encodingID ) { 16719 super( p, platformID, encodingID ); 16720 this.subTableStart = p.currentPosition; 16721 this.format = 14; 16722 this.length = p.uint32; 16723 this.numVarSelectorRecords = p.uint32; 16724 lazy$1( this, `varSelectors`, () => 16725 [ ...new Array( this.numVarSelectorRecords ) ].map( 16726 ( _ ) => new VariationSelector( p ) 16727 ) 16728 ); 16729 } 16730 supports() { 16731 console.warn( `supports not implemented for cmap subtable format 14` ); 16732 return 0; 16733 } 16734 getSupportedCharCodes() { 16735 console.warn( 16736 `getSupportedCharCodes not implemented for cmap subtable format 14` 16737 ); 16738 return []; 16739 } 16740 reverse( glyphID ) { 16741 console.warn( `reverse not implemented for cmap subtable format 14` ); 16742 return {}; 16743 } 16744 supportsVariation( variation ) { 16745 let v = this.varSelector.find( 16746 ( uvs ) => uvs.varSelector === variation 16747 ); 16748 return v ? v : false; 16749 } 16750 getSupportedVariations() { 16751 return this.varSelectors.map( ( v ) => v.varSelector ); 16752 } 16753 } 16754 class VariationSelector { 16755 constructor( p ) { 16756 this.varSelector = p.uint24; 16757 this.defaultUVSOffset = p.Offset32; 16758 this.nonDefaultUVSOffset = p.Offset32; 16759 } 16760 } 16761 function createSubTable( parser, platformID, encodingID ) { 16762 const format = parser.uint16; 16763 if ( format === 0 ) return new Format0( parser, platformID, encodingID ); 16764 if ( format === 2 ) return new Format2( parser, platformID, encodingID ); 16765 if ( format === 4 ) return new Format4( parser, platformID, encodingID ); 16766 if ( format === 6 ) return new Format6( parser, platformID, encodingID ); 16767 if ( format === 8 ) return new Format8( parser, platformID, encodingID ); 16768 if ( format === 10 ) return new Format10( parser, platformID, encodingID ); 16769 if ( format === 12 ) return new Format12( parser, platformID, encodingID ); 16770 if ( format === 13 ) return new Format13( parser, platformID, encodingID ); 16771 if ( format === 14 ) return new Format14( parser, platformID, encodingID ); 16772 return {}; 16773 } 16774 class cmap extends SimpleTable { 16775 constructor( dict, dataview ) { 16776 const { p: p } = super( dict, dataview ); 16777 this.version = p.uint16; 16778 this.numTables = p.uint16; 16779 this.encodingRecords = [ ...new Array( this.numTables ) ].map( 16780 ( _ ) => new EncodingRecord( p, this.tableStart ) 16781 ); 16782 } 16783 getSubTable( tableID ) { 16784 return this.encodingRecords[ tableID ].table; 16785 } 16786 getSupportedEncodings() { 16787 return this.encodingRecords.map( ( r ) => ( { 16788 platformID: r.platformID, 16789 encodingId: r.encodingID, 16790 } ) ); 16791 } 16792 getSupportedCharCodes( platformID, encodingID ) { 16793 const recordID = this.encodingRecords.findIndex( 16794 ( r ) => r.platformID === platformID && r.encodingID === encodingID 16795 ); 16796 if ( recordID === -1 ) return false; 16797 const subtable = this.getSubTable( recordID ); 16798 return subtable.getSupportedCharCodes(); 16799 } 16800 reverse( glyphid ) { 16801 for ( let i = 0; i < this.numTables; i++ ) { 16802 let code = this.getSubTable( i ).reverse( glyphid ); 16803 if ( code ) return code; 16804 } 16805 } 16806 getGlyphId( char ) { 16807 let last = 0; 16808 this.encodingRecords.some( ( _, tableID ) => { 16809 let t = this.getSubTable( tableID ); 16810 if ( ! t.getGlyphId ) return false; 16811 last = t.getGlyphId( char ); 16812 return last !== 0; 16813 } ); 16814 return last; 16815 } 16816 supports( char ) { 16817 return this.encodingRecords.some( ( _, tableID ) => { 16818 const t = this.getSubTable( tableID ); 16819 return t.supports && t.supports( char ) !== false; 16820 } ); 16821 } 16822 supportsVariation( variation ) { 16823 return this.encodingRecords.some( ( _, tableID ) => { 16824 const t = this.getSubTable( tableID ); 16825 return ( 16826 t.supportsVariation && 16827 t.supportsVariation( variation ) !== false 16828 ); 16829 } ); 16830 } 16831 } 16832 class EncodingRecord { 16833 constructor( p, tableStart ) { 16834 const platformID = ( this.platformID = p.uint16 ); 16835 const encodingID = ( this.encodingID = p.uint16 ); 16836 const offset = ( this.offset = p.Offset32 ); 16837 lazy$1( this, `table`, () => { 16838 p.currentPosition = tableStart + offset; 16839 return createSubTable( p, platformID, encodingID ); 16840 } ); 16841 } 16842 } 16843 var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } ); 16844 class head extends SimpleTable { 16845 constructor( dict, dataview ) { 16846 const { p: p } = super( dict, dataview ); 16847 this.load( { 16848 majorVersion: p.uint16, 16849 minorVersion: p.uint16, 16850 fontRevision: p.fixed, 16851 checkSumAdjustment: p.uint32, 16852 magicNumber: p.uint32, 16853 flags: p.flags( 16 ), 16854 unitsPerEm: p.uint16, 16855 created: p.longdatetime, 16856 modified: p.longdatetime, 16857 xMin: p.int16, 16858 yMin: p.int16, 16859 xMax: p.int16, 16860 yMax: p.int16, 16861 macStyle: p.flags( 16 ), 16862 lowestRecPPEM: p.uint16, 16863 fontDirectionHint: p.uint16, 16864 indexToLocFormat: p.uint16, 16865 glyphDataFormat: p.uint16, 16866 } ); 16867 } 16868 } 16869 var head$1 = Object.freeze( { __proto__: null, head: head } ); 16870 class hhea extends SimpleTable { 16871 constructor( dict, dataview ) { 16872 const { p: p } = super( dict, dataview ); 16873 this.majorVersion = p.uint16; 16874 this.minorVersion = p.uint16; 16875 this.ascender = p.fword; 16876 this.descender = p.fword; 16877 this.lineGap = p.fword; 16878 this.advanceWidthMax = p.ufword; 16879 this.minLeftSideBearing = p.fword; 16880 this.minRightSideBearing = p.fword; 16881 this.xMaxExtent = p.fword; 16882 this.caretSlopeRise = p.int16; 16883 this.caretSlopeRun = p.int16; 16884 this.caretOffset = p.int16; 16885 p.int16; 16886 p.int16; 16887 p.int16; 16888 p.int16; 16889 this.metricDataFormat = p.int16; 16890 this.numberOfHMetrics = p.uint16; 16891 p.verifyLength(); 16892 } 16893 } 16894 var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } ); 16895 class hmtx extends SimpleTable { 16896 constructor( dict, dataview, tables ) { 16897 const { p: p } = super( dict, dataview ); 16898 const numberOfHMetrics = tables.hhea.numberOfHMetrics; 16899 const numGlyphs = tables.maxp.numGlyphs; 16900 const metricsStart = p.currentPosition; 16901 lazy$1( this, `hMetrics`, () => { 16902 p.currentPosition = metricsStart; 16903 return [ ...new Array( numberOfHMetrics ) ].map( 16904 ( _ ) => new LongHorMetric( p.uint16, p.int16 ) 16905 ); 16906 } ); 16907 if ( numberOfHMetrics < numGlyphs ) { 16908 const lsbStart = metricsStart + numberOfHMetrics * 4; 16909 lazy$1( this, `leftSideBearings`, () => { 16910 p.currentPosition = lsbStart; 16911 return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map( 16912 ( _ ) => p.int16 16913 ); 16914 } ); 16915 } 16916 } 16917 } 16918 class LongHorMetric { 16919 constructor( w, b ) { 16920 this.advanceWidth = w; 16921 this.lsb = b; 16922 } 16923 } 16924 var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } ); 16925 class maxp extends SimpleTable { 16926 constructor( dict, dataview ) { 16927 const { p: p } = super( dict, dataview ); 16928 this.version = p.legacyFixed; 16929 this.numGlyphs = p.uint16; 16930 if ( this.version === 1 ) { 16931 this.maxPoints = p.uint16; 16932 this.maxContours = p.uint16; 16933 this.maxCompositePoints = p.uint16; 16934 this.maxCompositeContours = p.uint16; 16935 this.maxZones = p.uint16; 16936 this.maxTwilightPoints = p.uint16; 16937 this.maxStorage = p.uint16; 16938 this.maxFunctionDefs = p.uint16; 16939 this.maxInstructionDefs = p.uint16; 16940 this.maxStackElements = p.uint16; 16941 this.maxSizeOfInstructions = p.uint16; 16942 this.maxComponentElements = p.uint16; 16943 this.maxComponentDepth = p.uint16; 16944 } 16945 p.verifyLength(); 16946 } 16947 } 16948 var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } ); 16949 class lib_font_browser_name extends SimpleTable { 16950 constructor( dict, dataview ) { 16951 const { p: p } = super( dict, dataview ); 16952 this.format = p.uint16; 16953 this.count = p.uint16; 16954 this.stringOffset = p.Offset16; 16955 this.nameRecords = [ ...new Array( this.count ) ].map( 16956 ( _ ) => new NameRecord( p, this ) 16957 ); 16958 if ( this.format === 1 ) { 16959 this.langTagCount = p.uint16; 16960 this.langTagRecords = [ ...new Array( this.langTagCount ) ].map( 16961 ( _ ) => new LangTagRecord( p.uint16, p.Offset16 ) 16962 ); 16963 } 16964 this.stringStart = this.tableStart + this.stringOffset; 16965 } 16966 get( nameID ) { 16967 let record = this.nameRecords.find( 16968 ( record ) => record.nameID === nameID 16969 ); 16970 if ( record ) return record.string; 16971 } 16972 } 16973 class LangTagRecord { 16974 constructor( length, offset ) { 16975 this.length = length; 16976 this.offset = offset; 16977 } 16978 } 16979 class NameRecord { 16980 constructor( p, nameTable ) { 16981 this.platformID = p.uint16; 16982 this.encodingID = p.uint16; 16983 this.languageID = p.uint16; 16984 this.nameID = p.uint16; 16985 this.length = p.uint16; 16986 this.offset = p.Offset16; 16987 lazy$1( this, `string`, () => { 16988 p.currentPosition = nameTable.stringStart + this.offset; 16989 return decodeString( p, this ); 16990 } ); 16991 } 16992 } 16993 function decodeString( p, record ) { 16994 const { platformID: platformID, length: length } = record; 16995 if ( length === 0 ) return ``; 16996 if ( platformID === 0 || platformID === 3 ) { 16997 const str = []; 16998 for ( let i = 0, e = length / 2; i < e; i++ ) 16999 str[ i ] = String.fromCharCode( p.uint16 ); 17000 return str.join( `` ); 17001 } 17002 const bytes = p.readBytes( length ); 17003 const str = []; 17004 bytes.forEach( function ( b, i ) { 17005 str[ i ] = String.fromCharCode( b ); 17006 } ); 17007 return str.join( `` ); 17008 } 17009 var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } ); 17010 class OS2 extends SimpleTable { 17011 constructor( dict, dataview ) { 17012 const { p: p } = super( dict, dataview ); 17013 this.version = p.uint16; 17014 this.xAvgCharWidth = p.int16; 17015 this.usWeightClass = p.uint16; 17016 this.usWidthClass = p.uint16; 17017 this.fsType = p.uint16; 17018 this.ySubscriptXSize = p.int16; 17019 this.ySubscriptYSize = p.int16; 17020 this.ySubscriptXOffset = p.int16; 17021 this.ySubscriptYOffset = p.int16; 17022 this.ySuperscriptXSize = p.int16; 17023 this.ySuperscriptYSize = p.int16; 17024 this.ySuperscriptXOffset = p.int16; 17025 this.ySuperscriptYOffset = p.int16; 17026 this.yStrikeoutSize = p.int16; 17027 this.yStrikeoutPosition = p.int16; 17028 this.sFamilyClass = p.int16; 17029 this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 ); 17030 this.ulUnicodeRange1 = p.flags( 32 ); 17031 this.ulUnicodeRange2 = p.flags( 32 ); 17032 this.ulUnicodeRange3 = p.flags( 32 ); 17033 this.ulUnicodeRange4 = p.flags( 32 ); 17034 this.achVendID = p.tag; 17035 this.fsSelection = p.uint16; 17036 this.usFirstCharIndex = p.uint16; 17037 this.usLastCharIndex = p.uint16; 17038 this.sTypoAscender = p.int16; 17039 this.sTypoDescender = p.int16; 17040 this.sTypoLineGap = p.int16; 17041 this.usWinAscent = p.uint16; 17042 this.usWinDescent = p.uint16; 17043 if ( this.version === 0 ) return p.verifyLength(); 17044 this.ulCodePageRange1 = p.flags( 32 ); 17045 this.ulCodePageRange2 = p.flags( 32 ); 17046 if ( this.version === 1 ) return p.verifyLength(); 17047 this.sxHeight = p.int16; 17048 this.sCapHeight = p.int16; 17049 this.usDefaultChar = p.uint16; 17050 this.usBreakChar = p.uint16; 17051 this.usMaxContext = p.uint16; 17052 if ( this.version <= 4 ) return p.verifyLength(); 17053 this.usLowerOpticalPointSize = p.uint16; 17054 this.usUpperOpticalPointSize = p.uint16; 17055 if ( this.version === 5 ) return p.verifyLength(); 17056 } 17057 } 17058 var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } ); 17059 class post extends SimpleTable { 17060 constructor( dict, dataview ) { 17061 const { p: p } = super( dict, dataview ); 17062 this.version = p.legacyFixed; 17063 this.italicAngle = p.fixed; 17064 this.underlinePosition = p.fword; 17065 this.underlineThickness = p.fword; 17066 this.isFixedPitch = p.uint32; 17067 this.minMemType42 = p.uint32; 17068 this.maxMemType42 = p.uint32; 17069 this.minMemType1 = p.uint32; 17070 this.maxMemType1 = p.uint32; 17071 if ( this.version === 1 || this.version === 3 ) return p.verifyLength(); 17072 this.numGlyphs = p.uint16; 17073 if ( this.version === 2 ) { 17074 this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map( 17075 ( _ ) => p.uint16 17076 ); 17077 this.namesOffset = p.currentPosition; 17078 this.glyphNameOffsets = [ 1 ]; 17079 for ( let i = 0; i < this.numGlyphs; i++ ) { 17080 let index = this.glyphNameIndex[ i ]; 17081 if ( index < macStrings.length ) { 17082 this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] ); 17083 continue; 17084 } 17085 let bytelength = p.int8; 17086 p.skip( bytelength ); 17087 this.glyphNameOffsets.push( 17088 this.glyphNameOffsets[ i ] + bytelength + 1 17089 ); 17090 } 17091 } 17092 if ( this.version === 2.5 ) { 17093 this.offset = [ ...new Array( this.numGlyphs ) ].map( 17094 ( _ ) => p.int8 17095 ); 17096 } 17097 } 17098 getGlyphName( glyphid ) { 17099 if ( this.version !== 2 ) { 17100 console.warn( 17101 `post table version ${ this.version } does not support glyph name lookups` 17102 ); 17103 return ``; 17104 } 17105 let index = this.glyphNameIndex[ glyphid ]; 17106 if ( index < 258 ) return macStrings[ index ]; 17107 let offset = this.glyphNameOffsets[ glyphid ]; 17108 let next = this.glyphNameOffsets[ glyphid + 1 ]; 17109 let len = next - offset - 1; 17110 if ( len === 0 ) return `.notdef.`; 17111 this.parser.currentPosition = this.namesOffset + offset; 17112 const data = this.parser.readBytes( 17113 len, 17114 this.namesOffset + offset, 17115 8, 17116 true 17117 ); 17118 return data.map( ( b ) => String.fromCharCode( b ) ).join( `` ); 17119 } 17120 } 17121 const macStrings = [ 17122 `.notdef`, 17123 `.null`, 17124 `nonmarkingreturn`, 17125 `space`, 17126 `exclam`, 17127 `quotedbl`, 17128 `numbersign`, 17129 `dollar`, 17130 `percent`, 17131 `ampersand`, 17132 `quotesingle`, 17133 `parenleft`, 17134 `parenright`, 17135 `asterisk`, 17136 `plus`, 17137 `comma`, 17138 `hyphen`, 17139 `period`, 17140 `slash`, 17141 `zero`, 17142 `one`, 17143 `two`, 17144 `three`, 17145 `four`, 17146 `five`, 17147 `six`, 17148 `seven`, 17149 `eight`, 17150 `nine`, 17151 `colon`, 17152 `semicolon`, 17153 `less`, 17154 `equal`, 17155 `greater`, 17156 `question`, 17157 `at`, 17158 `A`, 17159 `B`, 17160 `C`, 17161 `D`, 17162 `E`, 17163 `F`, 17164 `G`, 17165 `H`, 17166 `I`, 17167 `J`, 17168 `K`, 17169 `L`, 17170 `M`, 17171 `N`, 17172 `O`, 17173 `P`, 17174 `Q`, 17175 `R`, 17176 `S`, 17177 `T`, 17178 `U`, 17179 `V`, 17180 `W`, 17181 `X`, 17182 `Y`, 17183 `Z`, 17184 `bracketleft`, 17185 `backslash`, 17186 `bracketright`, 17187 `asciicircum`, 17188 `underscore`, 17189 `grave`, 17190 `a`, 17191 `b`, 17192 `c`, 17193 `d`, 17194 `e`, 17195 `f`, 17196 `g`, 17197 `h`, 17198 `i`, 17199 `j`, 17200 `k`, 17201 `l`, 17202 `m`, 17203 `n`, 17204 `o`, 17205 `p`, 17206 `q`, 17207 `r`, 17208 `s`, 17209 `t`, 17210 `u`, 17211 `v`, 17212 `w`, 17213 `x`, 17214 `y`, 17215 `z`, 17216 `braceleft`, 17217 `bar`, 17218 `braceright`, 17219 `asciitilde`, 17220 `Adieresis`, 17221 `Aring`, 17222 `Ccedilla`, 17223 `Eacute`, 17224 `Ntilde`, 17225 `Odieresis`, 17226 `Udieresis`, 17227 `aacute`, 17228 `agrave`, 17229 `acircumflex`, 17230 `adieresis`, 17231 `atilde`, 17232 `aring`, 17233 `ccedilla`, 17234 `eacute`, 17235 `egrave`, 17236 `ecircumflex`, 17237 `edieresis`, 17238 `iacute`, 17239 `igrave`, 17240 `icircumflex`, 17241 `idieresis`, 17242 `ntilde`, 17243 `oacute`, 17244 `ograve`, 17245 `ocircumflex`, 17246 `odieresis`, 17247 `otilde`, 17248 `uacute`, 17249 `ugrave`, 17250 `ucircumflex`, 17251 `udieresis`, 17252 `dagger`, 17253 `degree`, 17254 `cent`, 17255 `sterling`, 17256 `section`, 17257 `bullet`, 17258 `paragraph`, 17259 `germandbls`, 17260 `registered`, 17261 `copyright`, 17262 `trademark`, 17263 `acute`, 17264 `dieresis`, 17265 `notequal`, 17266 `AE`, 17267 `Oslash`, 17268 `infinity`, 17269 `plusminus`, 17270 `lessequal`, 17271 `greaterequal`, 17272 `yen`, 17273 `mu`, 17274 `partialdiff`, 17275 `summation`, 17276 `product`, 17277 `pi`, 17278 `integral`, 17279 `ordfeminine`, 17280 `ordmasculine`, 17281 `Omega`, 17282 `ae`, 17283 `oslash`, 17284 `questiondown`, 17285 `exclamdown`, 17286 `logicalnot`, 17287 `radical`, 17288 `florin`, 17289 `approxequal`, 17290 `Delta`, 17291 `guillemotleft`, 17292 `guillemotright`, 17293 `ellipsis`, 17294 `nonbreakingspace`, 17295 `Agrave`, 17296 `Atilde`, 17297 `Otilde`, 17298 `OE`, 17299 `oe`, 17300 `endash`, 17301 `emdash`, 17302 `quotedblleft`, 17303 `quotedblright`, 17304 `quoteleft`, 17305 `quoteright`, 17306 `divide`, 17307 `lozenge`, 17308 `ydieresis`, 17309 `Ydieresis`, 17310 `fraction`, 17311 `currency`, 17312 `guilsinglleft`, 17313 `guilsinglright`, 17314 `fi`, 17315 `fl`, 17316 `daggerdbl`, 17317 `periodcentered`, 17318 `quotesinglbase`, 17319 `quotedblbase`, 17320 `perthousand`, 17321 `Acircumflex`, 17322 `Ecircumflex`, 17323 `Aacute`, 17324 `Edieresis`, 17325 `Egrave`, 17326 `Iacute`, 17327 `Icircumflex`, 17328 `Idieresis`, 17329 `Igrave`, 17330 `Oacute`, 17331 `Ocircumflex`, 17332 `apple`, 17333 `Ograve`, 17334 `Uacute`, 17335 `Ucircumflex`, 17336 `Ugrave`, 17337 `dotlessi`, 17338 `circumflex`, 17339 `tilde`, 17340 `macron`, 17341 `breve`, 17342 `dotaccent`, 17343 `ring`, 17344 `cedilla`, 17345 `hungarumlaut`, 17346 `ogonek`, 17347 `caron`, 17348 `Lslash`, 17349 `lslash`, 17350 `Scaron`, 17351 `scaron`, 17352 `Zcaron`, 17353 `zcaron`, 17354 `brokenbar`, 17355 `Eth`, 17356 `eth`, 17357 `Yacute`, 17358 `yacute`, 17359 `Thorn`, 17360 `thorn`, 17361 `minus`, 17362 `multiply`, 17363 `onesuperior`, 17364 `twosuperior`, 17365 `threesuperior`, 17366 `onehalf`, 17367 `onequarter`, 17368 `threequarters`, 17369 `franc`, 17370 `Gbreve`, 17371 `gbreve`, 17372 `Idotaccent`, 17373 `Scedilla`, 17374 `scedilla`, 17375 `Cacute`, 17376 `cacute`, 17377 `Ccaron`, 17378 `ccaron`, 17379 `dcroat`, 17380 ]; 17381 var post$1 = Object.freeze( { __proto__: null, post: post } ); 17382 class BASE extends SimpleTable { 17383 constructor( dict, dataview ) { 17384 const { p: p } = super( dict, dataview ); 17385 this.majorVersion = p.uint16; 17386 this.minorVersion = p.uint16; 17387 this.horizAxisOffset = p.Offset16; 17388 this.vertAxisOffset = p.Offset16; 17389 lazy$1( 17390 this, 17391 `horizAxis`, 17392 () => 17393 new AxisTable( 17394 { offset: dict.offset + this.horizAxisOffset }, 17395 dataview 17396 ) 17397 ); 17398 lazy$1( 17399 this, 17400 `vertAxis`, 17401 () => 17402 new AxisTable( 17403 { offset: dict.offset + this.vertAxisOffset }, 17404 dataview 17405 ) 17406 ); 17407 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 17408 this.itemVarStoreOffset = p.Offset32; 17409 lazy$1( 17410 this, 17411 `itemVarStore`, 17412 () => 17413 new AxisTable( 17414 { offset: dict.offset + this.itemVarStoreOffset }, 17415 dataview 17416 ) 17417 ); 17418 } 17419 } 17420 } 17421 class AxisTable extends SimpleTable { 17422 constructor( dict, dataview ) { 17423 const { p: p } = super( dict, dataview, `AxisTable` ); 17424 this.baseTagListOffset = p.Offset16; 17425 this.baseScriptListOffset = p.Offset16; 17426 lazy$1( 17427 this, 17428 `baseTagList`, 17429 () => 17430 new BaseTagListTable( 17431 { offset: dict.offset + this.baseTagListOffset }, 17432 dataview 17433 ) 17434 ); 17435 lazy$1( 17436 this, 17437 `baseScriptList`, 17438 () => 17439 new BaseScriptListTable( 17440 { offset: dict.offset + this.baseScriptListOffset }, 17441 dataview 17442 ) 17443 ); 17444 } 17445 } 17446 class BaseTagListTable extends SimpleTable { 17447 constructor( dict, dataview ) { 17448 const { p: p } = super( dict, dataview, `BaseTagListTable` ); 17449 this.baseTagCount = p.uint16; 17450 this.baselineTags = [ ...new Array( this.baseTagCount ) ].map( 17451 ( _ ) => p.tag 17452 ); 17453 } 17454 } 17455 class BaseScriptListTable extends SimpleTable { 17456 constructor( dict, dataview ) { 17457 const { p: p } = super( dict, dataview, `BaseScriptListTable` ); 17458 this.baseScriptCount = p.uint16; 17459 const recordStart = p.currentPosition; 17460 lazy$1( this, `baseScriptRecords`, () => { 17461 p.currentPosition = recordStart; 17462 return [ ...new Array( this.baseScriptCount ) ].map( 17463 ( _ ) => new BaseScriptRecord( this.start, p ) 17464 ); 17465 } ); 17466 } 17467 } 17468 class BaseScriptRecord { 17469 constructor( baseScriptListTableStart, p ) { 17470 this.baseScriptTag = p.tag; 17471 this.baseScriptOffset = p.Offset16; 17472 lazy$1( this, `baseScriptTable`, () => { 17473 p.currentPosition = 17474 baseScriptListTableStart + this.baseScriptOffset; 17475 return new BaseScriptTable( p ); 17476 } ); 17477 } 17478 } 17479 class BaseScriptTable { 17480 constructor( p ) { 17481 this.start = p.currentPosition; 17482 this.baseValuesOffset = p.Offset16; 17483 this.defaultMinMaxOffset = p.Offset16; 17484 this.baseLangSysCount = p.uint16; 17485 this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map( 17486 ( _ ) => new BaseLangSysRecord( this.start, p ) 17487 ); 17488 lazy$1( this, `baseValues`, () => { 17489 p.currentPosition = this.start + this.baseValuesOffset; 17490 return new BaseValuesTable( p ); 17491 } ); 17492 lazy$1( this, `defaultMinMax`, () => { 17493 p.currentPosition = this.start + this.defaultMinMaxOffset; 17494 return new MinMaxTable( p ); 17495 } ); 17496 } 17497 } 17498 class BaseLangSysRecord { 17499 constructor( baseScriptTableStart, p ) { 17500 this.baseLangSysTag = p.tag; 17501 this.minMaxOffset = p.Offset16; 17502 lazy$1( this, `minMax`, () => { 17503 p.currentPosition = baseScriptTableStart + this.minMaxOffset; 17504 return new MinMaxTable( p ); 17505 } ); 17506 } 17507 } 17508 class BaseValuesTable { 17509 constructor( p ) { 17510 this.parser = p; 17511 this.start = p.currentPosition; 17512 this.defaultBaselineIndex = p.uint16; 17513 this.baseCoordCount = p.uint16; 17514 this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map( 17515 ( _ ) => p.Offset16 17516 ); 17517 } 17518 getTable( id ) { 17519 this.parser.currentPosition = this.start + this.baseCoords[ id ]; 17520 return new BaseCoordTable( this.parser ); 17521 } 17522 } 17523 class MinMaxTable { 17524 constructor( p ) { 17525 this.minCoord = p.Offset16; 17526 this.maxCoord = p.Offset16; 17527 this.featMinMaxCount = p.uint16; 17528 const recordStart = p.currentPosition; 17529 lazy$1( this, `featMinMaxRecords`, () => { 17530 p.currentPosition = recordStart; 17531 return [ ...new Array( this.featMinMaxCount ) ].map( 17532 ( _ ) => new FeatMinMaxRecord( p ) 17533 ); 17534 } ); 17535 } 17536 } 17537 class FeatMinMaxRecord { 17538 constructor( p ) { 17539 this.featureTableTag = p.tag; 17540 this.minCoord = p.Offset16; 17541 this.maxCoord = p.Offset16; 17542 } 17543 } 17544 class BaseCoordTable { 17545 constructor( p ) { 17546 this.baseCoordFormat = p.uint16; 17547 this.coordinate = p.int16; 17548 if ( this.baseCoordFormat === 2 ) { 17549 this.referenceGlyph = p.uint16; 17550 this.baseCoordPoint = p.uint16; 17551 } 17552 if ( this.baseCoordFormat === 3 ) { 17553 this.deviceTable = p.Offset16; 17554 } 17555 } 17556 } 17557 var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } ); 17558 class ClassDefinition { 17559 constructor( p ) { 17560 this.classFormat = p.uint16; 17561 if ( this.classFormat === 1 ) { 17562 this.startGlyphID = p.uint16; 17563 this.glyphCount = p.uint16; 17564 this.classValueArray = [ ...new Array( this.glyphCount ) ].map( 17565 ( _ ) => p.uint16 17566 ); 17567 } 17568 if ( this.classFormat === 2 ) { 17569 this.classRangeCount = p.uint16; 17570 this.classRangeRecords = [ 17571 ...new Array( this.classRangeCount ), 17572 ].map( ( _ ) => new ClassRangeRecord( p ) ); 17573 } 17574 } 17575 } 17576 class ClassRangeRecord { 17577 constructor( p ) { 17578 this.startGlyphID = p.uint16; 17579 this.endGlyphID = p.uint16; 17580 this.class = p.uint16; 17581 } 17582 } 17583 class CoverageTable extends ParsedData { 17584 constructor( p ) { 17585 super( p ); 17586 this.coverageFormat = p.uint16; 17587 if ( this.coverageFormat === 1 ) { 17588 this.glyphCount = p.uint16; 17589 this.glyphArray = [ ...new Array( this.glyphCount ) ].map( 17590 ( _ ) => p.uint16 17591 ); 17592 } 17593 if ( this.coverageFormat === 2 ) { 17594 this.rangeCount = p.uint16; 17595 this.rangeRecords = [ ...new Array( this.rangeCount ) ].map( 17596 ( _ ) => new CoverageRangeRecord( p ) 17597 ); 17598 } 17599 } 17600 } 17601 class CoverageRangeRecord { 17602 constructor( p ) { 17603 this.startGlyphID = p.uint16; 17604 this.endGlyphID = p.uint16; 17605 this.startCoverageIndex = p.uint16; 17606 } 17607 } 17608 class ItemVariationStoreTable { 17609 constructor( table, p ) { 17610 this.table = table; 17611 this.parser = p; 17612 this.start = p.currentPosition; 17613 this.format = p.uint16; 17614 this.variationRegionListOffset = p.Offset32; 17615 this.itemVariationDataCount = p.uint16; 17616 this.itemVariationDataOffsets = [ 17617 ...new Array( this.itemVariationDataCount ), 17618 ].map( ( _ ) => p.Offset32 ); 17619 } 17620 } 17621 class GDEF extends SimpleTable { 17622 constructor( dict, dataview ) { 17623 const { p: p } = super( dict, dataview ); 17624 this.majorVersion = p.uint16; 17625 this.minorVersion = p.uint16; 17626 this.glyphClassDefOffset = p.Offset16; 17627 lazy$1( this, `glyphClassDefs`, () => { 17628 if ( this.glyphClassDefOffset === 0 ) return undefined; 17629 p.currentPosition = this.tableStart + this.glyphClassDefOffset; 17630 return new ClassDefinition( p ); 17631 } ); 17632 this.attachListOffset = p.Offset16; 17633 lazy$1( this, `attachList`, () => { 17634 if ( this.attachListOffset === 0 ) return undefined; 17635 p.currentPosition = this.tableStart + this.attachListOffset; 17636 return new AttachList( p ); 17637 } ); 17638 this.ligCaretListOffset = p.Offset16; 17639 lazy$1( this, `ligCaretList`, () => { 17640 if ( this.ligCaretListOffset === 0 ) return undefined; 17641 p.currentPosition = this.tableStart + this.ligCaretListOffset; 17642 return new LigCaretList( p ); 17643 } ); 17644 this.markAttachClassDefOffset = p.Offset16; 17645 lazy$1( this, `markAttachClassDef`, () => { 17646 if ( this.markAttachClassDefOffset === 0 ) return undefined; 17647 p.currentPosition = this.tableStart + this.markAttachClassDefOffset; 17648 return new ClassDefinition( p ); 17649 } ); 17650 if ( this.minorVersion >= 2 ) { 17651 this.markGlyphSetsDefOffset = p.Offset16; 17652 lazy$1( this, `markGlyphSetsDef`, () => { 17653 if ( this.markGlyphSetsDefOffset === 0 ) return undefined; 17654 p.currentPosition = 17655 this.tableStart + this.markGlyphSetsDefOffset; 17656 return new MarkGlyphSetsTable( p ); 17657 } ); 17658 } 17659 if ( this.minorVersion === 3 ) { 17660 this.itemVarStoreOffset = p.Offset32; 17661 lazy$1( this, `itemVarStore`, () => { 17662 if ( this.itemVarStoreOffset === 0 ) return undefined; 17663 p.currentPosition = this.tableStart + this.itemVarStoreOffset; 17664 return new ItemVariationStoreTable( p ); 17665 } ); 17666 } 17667 } 17668 } 17669 class AttachList extends ParsedData { 17670 constructor( p ) { 17671 super( p ); 17672 this.coverageOffset = p.Offset16; 17673 this.glyphCount = p.uint16; 17674 this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map( 17675 ( _ ) => p.Offset16 17676 ); 17677 } 17678 getPoint( pointID ) { 17679 this.parser.currentPosition = 17680 this.start + this.attachPointOffsets[ pointID ]; 17681 return new AttachPoint( this.parser ); 17682 } 17683 } 17684 class AttachPoint { 17685 constructor( p ) { 17686 this.pointCount = p.uint16; 17687 this.pointIndices = [ ...new Array( this.pointCount ) ].map( 17688 ( _ ) => p.uint16 17689 ); 17690 } 17691 } 17692 class LigCaretList extends ParsedData { 17693 constructor( p ) { 17694 super( p ); 17695 this.coverageOffset = p.Offset16; 17696 lazy$1( this, `coverage`, () => { 17697 p.currentPosition = this.start + this.coverageOffset; 17698 return new CoverageTable( p ); 17699 } ); 17700 this.ligGlyphCount = p.uint16; 17701 this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map( 17702 ( _ ) => p.Offset16 17703 ); 17704 } 17705 getLigGlyph( ligGlyphID ) { 17706 this.parser.currentPosition = 17707 this.start + this.ligGlyphOffsets[ ligGlyphID ]; 17708 return new LigGlyph( this.parser ); 17709 } 17710 } 17711 class LigGlyph extends ParsedData { 17712 constructor( p ) { 17713 super( p ); 17714 this.caretCount = p.uint16; 17715 this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map( 17716 ( _ ) => p.Offset16 17717 ); 17718 } 17719 getCaretValue( caretID ) { 17720 this.parser.currentPosition = 17721 this.start + this.caretValueOffsets[ caretID ]; 17722 return new CaretValue( this.parser ); 17723 } 17724 } 17725 class CaretValue { 17726 constructor( p ) { 17727 this.caretValueFormat = p.uint16; 17728 if ( this.caretValueFormat === 1 ) { 17729 this.coordinate = p.int16; 17730 } 17731 if ( this.caretValueFormat === 2 ) { 17732 this.caretValuePointIndex = p.uint16; 17733 } 17734 if ( this.caretValueFormat === 3 ) { 17735 this.coordinate = p.int16; 17736 this.deviceOffset = p.Offset16; 17737 } 17738 } 17739 } 17740 class MarkGlyphSetsTable extends ParsedData { 17741 constructor( p ) { 17742 super( p ); 17743 this.markGlyphSetTableFormat = p.uint16; 17744 this.markGlyphSetCount = p.uint16; 17745 this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map( 17746 ( _ ) => p.Offset32 17747 ); 17748 } 17749 getMarkGlyphSet( markGlyphSetID ) { 17750 this.parser.currentPosition = 17751 this.start + this.coverageOffsets[ markGlyphSetID ]; 17752 return new CoverageTable( this.parser ); 17753 } 17754 } 17755 var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } ); 17756 class ScriptList extends ParsedData { 17757 static EMPTY = { scriptCount: 0, scriptRecords: [] }; 17758 constructor( p ) { 17759 super( p ); 17760 this.scriptCount = p.uint16; 17761 this.scriptRecords = [ ...new Array( this.scriptCount ) ].map( 17762 ( _ ) => new ScriptRecord( p ) 17763 ); 17764 } 17765 } 17766 class ScriptRecord { 17767 constructor( p ) { 17768 this.scriptTag = p.tag; 17769 this.scriptOffset = p.Offset16; 17770 } 17771 } 17772 class ScriptTable extends ParsedData { 17773 constructor( p ) { 17774 super( p ); 17775 this.defaultLangSys = p.Offset16; 17776 this.langSysCount = p.uint16; 17777 this.langSysRecords = [ ...new Array( this.langSysCount ) ].map( 17778 ( _ ) => new LangSysRecord( p ) 17779 ); 17780 } 17781 } 17782 class LangSysRecord { 17783 constructor( p ) { 17784 this.langSysTag = p.tag; 17785 this.langSysOffset = p.Offset16; 17786 } 17787 } 17788 class LangSysTable { 17789 constructor( p ) { 17790 this.lookupOrder = p.Offset16; 17791 this.requiredFeatureIndex = p.uint16; 17792 this.featureIndexCount = p.uint16; 17793 this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map( 17794 ( _ ) => p.uint16 17795 ); 17796 } 17797 } 17798 class FeatureList extends ParsedData { 17799 static EMPTY = { featureCount: 0, featureRecords: [] }; 17800 constructor( p ) { 17801 super( p ); 17802 this.featureCount = p.uint16; 17803 this.featureRecords = [ ...new Array( this.featureCount ) ].map( 17804 ( _ ) => new FeatureRecord( p ) 17805 ); 17806 } 17807 } 17808 class FeatureRecord { 17809 constructor( p ) { 17810 this.featureTag = p.tag; 17811 this.featureOffset = p.Offset16; 17812 } 17813 } 17814 class FeatureTable extends ParsedData { 17815 constructor( p ) { 17816 super( p ); 17817 this.featureParams = p.Offset16; 17818 this.lookupIndexCount = p.uint16; 17819 this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map( 17820 ( _ ) => p.uint16 17821 ); 17822 } 17823 getFeatureParams() { 17824 if ( this.featureParams > 0 ) { 17825 const p = this.parser; 17826 p.currentPosition = this.start + this.featureParams; 17827 const tag = this.featureTag; 17828 if ( tag === `size` ) return new Size( p ); 17829 if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p ); 17830 if ( tag.startsWith( `ss` ) ) return new StylisticSet( p ); 17831 } 17832 } 17833 } 17834 class CharacterVariant { 17835 constructor( p ) { 17836 this.format = p.uint16; 17837 this.featUiLabelNameId = p.uint16; 17838 this.featUiTooltipTextNameId = p.uint16; 17839 this.sampleTextNameId = p.uint16; 17840 this.numNamedParameters = p.uint16; 17841 this.firstParamUiLabelNameId = p.uint16; 17842 this.charCount = p.uint16; 17843 this.character = [ ...new Array( this.charCount ) ].map( 17844 ( _ ) => p.uint24 17845 ); 17846 } 17847 } 17848 class Size { 17849 constructor( p ) { 17850 this.designSize = p.uint16; 17851 this.subfamilyIdentifier = p.uint16; 17852 this.subfamilyNameID = p.uint16; 17853 this.smallEnd = p.uint16; 17854 this.largeEnd = p.uint16; 17855 } 17856 } 17857 class StylisticSet { 17858 constructor( p ) { 17859 this.version = p.uint16; 17860 this.UINameID = p.uint16; 17861 } 17862 } 17863 function undoCoverageOffsetParsing( instance ) { 17864 instance.parser.currentPosition -= 2; 17865 delete instance.coverageOffset; 17866 delete instance.getCoverageTable; 17867 } 17868 class LookupType$1 extends ParsedData { 17869 constructor( p ) { 17870 super( p ); 17871 this.substFormat = p.uint16; 17872 this.coverageOffset = p.Offset16; 17873 } 17874 getCoverageTable() { 17875 let p = this.parser; 17876 p.currentPosition = this.start + this.coverageOffset; 17877 return new CoverageTable( p ); 17878 } 17879 } 17880 class SubstLookupRecord { 17881 constructor( p ) { 17882 this.glyphSequenceIndex = p.uint16; 17883 this.lookupListIndex = p.uint16; 17884 } 17885 } 17886 class LookupType1$1 extends LookupType$1 { 17887 constructor( p ) { 17888 super( p ); 17889 this.deltaGlyphID = p.int16; 17890 } 17891 } 17892 class LookupType2$1 extends LookupType$1 { 17893 constructor( p ) { 17894 super( p ); 17895 this.sequenceCount = p.uint16; 17896 this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map( 17897 ( _ ) => p.Offset16 17898 ); 17899 } 17900 getSequence( index ) { 17901 let p = this.parser; 17902 p.currentPosition = this.start + this.sequenceOffsets[ index ]; 17903 return new SequenceTable( p ); 17904 } 17905 } 17906 class SequenceTable { 17907 constructor( p ) { 17908 this.glyphCount = p.uint16; 17909 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 17910 ( _ ) => p.uint16 17911 ); 17912 } 17913 } 17914 class LookupType3$1 extends LookupType$1 { 17915 constructor( p ) { 17916 super( p ); 17917 this.alternateSetCount = p.uint16; 17918 this.alternateSetOffsets = [ 17919 ...new Array( this.alternateSetCount ), 17920 ].map( ( _ ) => p.Offset16 ); 17921 } 17922 getAlternateSet( index ) { 17923 let p = this.parser; 17924 p.currentPosition = this.start + this.alternateSetOffsets[ index ]; 17925 return new AlternateSetTable( p ); 17926 } 17927 } 17928 class AlternateSetTable { 17929 constructor( p ) { 17930 this.glyphCount = p.uint16; 17931 this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 17932 ( _ ) => p.uint16 17933 ); 17934 } 17935 } 17936 class LookupType4$1 extends LookupType$1 { 17937 constructor( p ) { 17938 super( p ); 17939 this.ligatureSetCount = p.uint16; 17940 this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map( 17941 ( _ ) => p.Offset16 17942 ); 17943 } 17944 getLigatureSet( index ) { 17945 let p = this.parser; 17946 p.currentPosition = this.start + this.ligatureSetOffsets[ index ]; 17947 return new LigatureSetTable( p ); 17948 } 17949 } 17950 class LigatureSetTable extends ParsedData { 17951 constructor( p ) { 17952 super( p ); 17953 this.ligatureCount = p.uint16; 17954 this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map( 17955 ( _ ) => p.Offset16 17956 ); 17957 } 17958 getLigature( index ) { 17959 let p = this.parser; 17960 p.currentPosition = this.start + this.ligatureOffsets[ index ]; 17961 return new LigatureTable( p ); 17962 } 17963 } 17964 class LigatureTable { 17965 constructor( p ) { 17966 this.ligatureGlyph = p.uint16; 17967 this.componentCount = p.uint16; 17968 this.componentGlyphIDs = [ 17969 ...new Array( this.componentCount - 1 ), 17970 ].map( ( _ ) => p.uint16 ); 17971 } 17972 } 17973 class LookupType5$1 extends LookupType$1 { 17974 constructor( p ) { 17975 super( p ); 17976 if ( this.substFormat === 1 ) { 17977 this.subRuleSetCount = p.uint16; 17978 this.subRuleSetOffsets = [ 17979 ...new Array( this.subRuleSetCount ), 17980 ].map( ( _ ) => p.Offset16 ); 17981 } 17982 if ( this.substFormat === 2 ) { 17983 this.classDefOffset = p.Offset16; 17984 this.subClassSetCount = p.uint16; 17985 this.subClassSetOffsets = [ 17986 ...new Array( this.subClassSetCount ), 17987 ].map( ( _ ) => p.Offset16 ); 17988 } 17989 if ( this.substFormat === 3 ) { 17990 undoCoverageOffsetParsing( this ); 17991 this.glyphCount = p.uint16; 17992 this.substitutionCount = p.uint16; 17993 this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map( 17994 ( _ ) => p.Offset16 17995 ); 17996 this.substLookupRecords = [ 17997 ...new Array( this.substitutionCount ), 17998 ].map( ( _ ) => new SubstLookupRecord( p ) ); 17999 } 18000 } 18001 getSubRuleSet( index ) { 18002 if ( this.substFormat !== 1 ) 18003 throw new Error( 18004 `lookup type 5.${ this.substFormat } has no subrule sets.` 18005 ); 18006 let p = this.parser; 18007 p.currentPosition = this.start + this.subRuleSetOffsets[ index ]; 18008 return new SubRuleSetTable( p ); 18009 } 18010 getSubClassSet( index ) { 18011 if ( this.substFormat !== 2 ) 18012 throw new Error( 18013 `lookup type 5.${ this.substFormat } has no subclass sets.` 18014 ); 18015 let p = this.parser; 18016 p.currentPosition = this.start + this.subClassSetOffsets[ index ]; 18017 return new SubClassSetTable( p ); 18018 } 18019 getCoverageTable( index ) { 18020 if ( this.substFormat !== 3 && ! index ) 18021 return super.getCoverageTable(); 18022 if ( ! index ) 18023 throw new Error( 18024 `lookup type 5.${ this.substFormat } requires an coverage table index.` 18025 ); 18026 let p = this.parser; 18027 p.currentPosition = this.start + this.coverageOffsets[ index ]; 18028 return new CoverageTable( p ); 18029 } 18030 } 18031 class SubRuleSetTable extends ParsedData { 18032 constructor( p ) { 18033 super( p ); 18034 this.subRuleCount = p.uint16; 18035 this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map( 18036 ( _ ) => p.Offset16 18037 ); 18038 } 18039 getSubRule( index ) { 18040 let p = this.parser; 18041 p.currentPosition = this.start + this.subRuleOffsets[ index ]; 18042 return new SubRuleTable( p ); 18043 } 18044 } 18045 class SubRuleTable { 18046 constructor( p ) { 18047 this.glyphCount = p.uint16; 18048 this.substitutionCount = p.uint16; 18049 this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map( 18050 ( _ ) => p.uint16 18051 ); 18052 this.substLookupRecords = [ 18053 ...new Array( this.substitutionCount ), 18054 ].map( ( _ ) => new SubstLookupRecord( p ) ); 18055 } 18056 } 18057 class SubClassSetTable extends ParsedData { 18058 constructor( p ) { 18059 super( p ); 18060 this.subClassRuleCount = p.uint16; 18061 this.subClassRuleOffsets = [ 18062 ...new Array( this.subClassRuleCount ), 18063 ].map( ( _ ) => p.Offset16 ); 18064 } 18065 getSubClass( index ) { 18066 let p = this.parser; 18067 p.currentPosition = this.start + this.subClassRuleOffsets[ index ]; 18068 return new SubClassRuleTable( p ); 18069 } 18070 } 18071 class SubClassRuleTable extends SubRuleTable { 18072 constructor( p ) { 18073 super( p ); 18074 } 18075 } 18076 class LookupType6$1 extends LookupType$1 { 18077 constructor( p ) { 18078 super( p ); 18079 if ( this.substFormat === 1 ) { 18080 this.chainSubRuleSetCount = p.uint16; 18081 this.chainSubRuleSetOffsets = [ 18082 ...new Array( this.chainSubRuleSetCount ), 18083 ].map( ( _ ) => p.Offset16 ); 18084 } 18085 if ( this.substFormat === 2 ) { 18086 this.backtrackClassDefOffset = p.Offset16; 18087 this.inputClassDefOffset = p.Offset16; 18088 this.lookaheadClassDefOffset = p.Offset16; 18089 this.chainSubClassSetCount = p.uint16; 18090 this.chainSubClassSetOffsets = [ 18091 ...new Array( this.chainSubClassSetCount ), 18092 ].map( ( _ ) => p.Offset16 ); 18093 } 18094 if ( this.substFormat === 3 ) { 18095 undoCoverageOffsetParsing( this ); 18096 this.backtrackGlyphCount = p.uint16; 18097 this.backtrackCoverageOffsets = [ 18098 ...new Array( this.backtrackGlyphCount ), 18099 ].map( ( _ ) => p.Offset16 ); 18100 this.inputGlyphCount = p.uint16; 18101 this.inputCoverageOffsets = [ 18102 ...new Array( this.inputGlyphCount ), 18103 ].map( ( _ ) => p.Offset16 ); 18104 this.lookaheadGlyphCount = p.uint16; 18105 this.lookaheadCoverageOffsets = [ 18106 ...new Array( this.lookaheadGlyphCount ), 18107 ].map( ( _ ) => p.Offset16 ); 18108 this.seqLookupCount = p.uint16; 18109 this.seqLookupRecords = [ 18110 ...new Array( this.substitutionCount ), 18111 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 18112 } 18113 } 18114 getChainSubRuleSet( index ) { 18115 if ( this.substFormat !== 1 ) 18116 throw new Error( 18117 `lookup type 6.${ this.substFormat } has no chainsubrule sets.` 18118 ); 18119 let p = this.parser; 18120 p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ]; 18121 return new ChainSubRuleSetTable( p ); 18122 } 18123 getChainSubClassSet( index ) { 18124 if ( this.substFormat !== 2 ) 18125 throw new Error( 18126 `lookup type 6.${ this.substFormat } has no chainsubclass sets.` 18127 ); 18128 let p = this.parser; 18129 p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ]; 18130 return new ChainSubClassSetTable( p ); 18131 } 18132 getCoverageFromOffset( offset ) { 18133 if ( this.substFormat !== 3 ) 18134 throw new Error( 18135 `lookup type 6.${ this.substFormat } does not use contextual coverage offsets.` 18136 ); 18137 let p = this.parser; 18138 p.currentPosition = this.start + offset; 18139 return new CoverageTable( p ); 18140 } 18141 } 18142 class ChainSubRuleSetTable extends ParsedData { 18143 constructor( p ) { 18144 super( p ); 18145 this.chainSubRuleCount = p.uint16; 18146 this.chainSubRuleOffsets = [ 18147 ...new Array( this.chainSubRuleCount ), 18148 ].map( ( _ ) => p.Offset16 ); 18149 } 18150 getSubRule( index ) { 18151 let p = this.parser; 18152 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 18153 return new ChainSubRuleTable( p ); 18154 } 18155 } 18156 class ChainSubRuleTable { 18157 constructor( p ) { 18158 this.backtrackGlyphCount = p.uint16; 18159 this.backtrackSequence = [ 18160 ...new Array( this.backtrackGlyphCount ), 18161 ].map( ( _ ) => p.uint16 ); 18162 this.inputGlyphCount = p.uint16; 18163 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 18164 ( _ ) => p.uint16 18165 ); 18166 this.lookaheadGlyphCount = p.uint16; 18167 this.lookAheadSequence = [ 18168 ...new Array( this.lookAheadGlyphCount ), 18169 ].map( ( _ ) => p.uint16 ); 18170 this.substitutionCount = p.uint16; 18171 this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map( 18172 ( _ ) => new SubstLookupRecord( p ) 18173 ); 18174 } 18175 } 18176 class ChainSubClassSetTable extends ParsedData { 18177 constructor( p ) { 18178 super( p ); 18179 this.chainSubClassRuleCount = p.uint16; 18180 this.chainSubClassRuleOffsets = [ 18181 ...new Array( this.chainSubClassRuleCount ), 18182 ].map( ( _ ) => p.Offset16 ); 18183 } 18184 getSubClass( index ) { 18185 let p = this.parser; 18186 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 18187 return new ChainSubClassRuleTable( p ); 18188 } 18189 } 18190 class ChainSubClassRuleTable { 18191 constructor( p ) { 18192 this.backtrackGlyphCount = p.uint16; 18193 this.backtrackSequence = [ 18194 ...new Array( this.backtrackGlyphCount ), 18195 ].map( ( _ ) => p.uint16 ); 18196 this.inputGlyphCount = p.uint16; 18197 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 18198 ( _ ) => p.uint16 18199 ); 18200 this.lookaheadGlyphCount = p.uint16; 18201 this.lookAheadSequence = [ 18202 ...new Array( this.lookAheadGlyphCount ), 18203 ].map( ( _ ) => p.uint16 ); 18204 this.substitutionCount = p.uint16; 18205 this.substLookupRecords = [ 18206 ...new Array( this.substitutionCount ), 18207 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 18208 } 18209 } 18210 class SequenceLookupRecord extends ParsedData { 18211 constructor( p ) { 18212 super( p ); 18213 this.sequenceIndex = p.uint16; 18214 this.lookupListIndex = p.uint16; 18215 } 18216 } 18217 class LookupType7$1 extends ParsedData { 18218 constructor( p ) { 18219 super( p ); 18220 this.substFormat = p.uint16; 18221 this.extensionLookupType = p.uint16; 18222 this.extensionOffset = p.Offset32; 18223 } 18224 } 18225 class LookupType8$1 extends LookupType$1 { 18226 constructor( p ) { 18227 super( p ); 18228 this.backtrackGlyphCount = p.uint16; 18229 this.backtrackCoverageOffsets = [ 18230 ...new Array( this.backtrackGlyphCount ), 18231 ].map( ( _ ) => p.Offset16 ); 18232 this.lookaheadGlyphCount = p.uint16; 18233 this.lookaheadCoverageOffsets = [ 18234 new Array( this.lookaheadGlyphCount ), 18235 ].map( ( _ ) => p.Offset16 ); 18236 this.glyphCount = p.uint16; 18237 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 18238 ( _ ) => p.uint16 18239 ); 18240 } 18241 } 18242 var GSUBtables = { 18243 buildSubtable: function ( type, p ) { 18244 const subtable = new [ 18245 undefined, 18246 LookupType1$1, 18247 LookupType2$1, 18248 LookupType3$1, 18249 LookupType4$1, 18250 LookupType5$1, 18251 LookupType6$1, 18252 LookupType7$1, 18253 LookupType8$1, 18254 ][ type ]( p ); 18255 subtable.type = type; 18256 return subtable; 18257 }, 18258 }; 18259 class LookupType extends ParsedData { 18260 constructor( p ) { 18261 super( p ); 18262 } 18263 } 18264 class LookupType1 extends LookupType { 18265 constructor( p ) { 18266 super( p ); 18267 console.log( `lookup type 1` ); 18268 } 18269 } 18270 class LookupType2 extends LookupType { 18271 constructor( p ) { 18272 super( p ); 18273 console.log( `lookup type 2` ); 18274 } 18275 } 18276 class LookupType3 extends LookupType { 18277 constructor( p ) { 18278 super( p ); 18279 console.log( `lookup type 3` ); 18280 } 18281 } 18282 class LookupType4 extends LookupType { 18283 constructor( p ) { 18284 super( p ); 18285 console.log( `lookup type 4` ); 18286 } 18287 } 18288 class LookupType5 extends LookupType { 18289 constructor( p ) { 18290 super( p ); 18291 console.log( `lookup type 5` ); 18292 } 18293 } 18294 class LookupType6 extends LookupType { 18295 constructor( p ) { 18296 super( p ); 18297 console.log( `lookup type 6` ); 18298 } 18299 } 18300 class LookupType7 extends LookupType { 18301 constructor( p ) { 18302 super( p ); 18303 console.log( `lookup type 7` ); 18304 } 18305 } 18306 class LookupType8 extends LookupType { 18307 constructor( p ) { 18308 super( p ); 18309 console.log( `lookup type 8` ); 18310 } 18311 } 18312 class LookupType9 extends LookupType { 18313 constructor( p ) { 18314 super( p ); 18315 console.log( `lookup type 9` ); 18316 } 18317 } 18318 var GPOStables = { 18319 buildSubtable: function ( type, p ) { 18320 const subtable = new [ 18321 undefined, 18322 LookupType1, 18323 LookupType2, 18324 LookupType3, 18325 LookupType4, 18326 LookupType5, 18327 LookupType6, 18328 LookupType7, 18329 LookupType8, 18330 LookupType9, 18331 ][ type ]( p ); 18332 subtable.type = type; 18333 return subtable; 18334 }, 18335 }; 18336 class LookupList extends ParsedData { 18337 static EMPTY = { lookupCount: 0, lookups: [] }; 18338 constructor( p ) { 18339 super( p ); 18340 this.lookupCount = p.uint16; 18341 this.lookups = [ ...new Array( this.lookupCount ) ].map( 18342 ( _ ) => p.Offset16 18343 ); 18344 } 18345 } 18346 class LookupTable extends ParsedData { 18347 constructor( p, type ) { 18348 super( p ); 18349 this.ctType = type; 18350 this.lookupType = p.uint16; 18351 this.lookupFlag = p.uint16; 18352 this.subTableCount = p.uint16; 18353 this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map( 18354 ( _ ) => p.Offset16 18355 ); 18356 this.markFilteringSet = p.uint16; 18357 } 18358 get rightToLeft() { 18359 return this.lookupFlag & ( 1 === 1 ); 18360 } 18361 get ignoreBaseGlyphs() { 18362 return this.lookupFlag & ( 2 === 2 ); 18363 } 18364 get ignoreLigatures() { 18365 return this.lookupFlag & ( 4 === 4 ); 18366 } 18367 get ignoreMarks() { 18368 return this.lookupFlag & ( 8 === 8 ); 18369 } 18370 get useMarkFilteringSet() { 18371 return this.lookupFlag & ( 16 === 16 ); 18372 } 18373 get markAttachmentType() { 18374 return this.lookupFlag & ( 65280 === 65280 ); 18375 } 18376 getSubTable( index ) { 18377 const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; 18378 this.parser.currentPosition = 18379 this.start + this.subtableOffsets[ index ]; 18380 return builder.buildSubtable( this.lookupType, this.parser ); 18381 } 18382 } 18383 class CommonLayoutTable extends SimpleTable { 18384 constructor( dict, dataview, name ) { 18385 const { p: p, tableStart: tableStart } = super( dict, dataview, name ); 18386 this.majorVersion = p.uint16; 18387 this.minorVersion = p.uint16; 18388 this.scriptListOffset = p.Offset16; 18389 this.featureListOffset = p.Offset16; 18390 this.lookupListOffset = p.Offset16; 18391 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 18392 this.featureVariationsOffset = p.Offset32; 18393 } 18394 const no_content = ! ( 18395 this.scriptListOffset || 18396 this.featureListOffset || 18397 this.lookupListOffset 18398 ); 18399 lazy$1( this, `scriptList`, () => { 18400 if ( no_content ) return ScriptList.EMPTY; 18401 p.currentPosition = tableStart + this.scriptListOffset; 18402 return new ScriptList( p ); 18403 } ); 18404 lazy$1( this, `featureList`, () => { 18405 if ( no_content ) return FeatureList.EMPTY; 18406 p.currentPosition = tableStart + this.featureListOffset; 18407 return new FeatureList( p ); 18408 } ); 18409 lazy$1( this, `lookupList`, () => { 18410 if ( no_content ) return LookupList.EMPTY; 18411 p.currentPosition = tableStart + this.lookupListOffset; 18412 return new LookupList( p ); 18413 } ); 18414 if ( this.featureVariationsOffset ) { 18415 lazy$1( this, `featureVariations`, () => { 18416 if ( no_content ) return FeatureVariations.EMPTY; 18417 p.currentPosition = tableStart + this.featureVariationsOffset; 18418 return new FeatureVariations( p ); 18419 } ); 18420 } 18421 } 18422 getSupportedScripts() { 18423 return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag ); 18424 } 18425 getScriptTable( scriptTag ) { 18426 let record = this.scriptList.scriptRecords.find( 18427 ( r ) => r.scriptTag === scriptTag 18428 ); 18429 this.parser.currentPosition = 18430 this.scriptList.start + record.scriptOffset; 18431 let table = new ScriptTable( this.parser ); 18432 table.scriptTag = scriptTag; 18433 return table; 18434 } 18435 ensureScriptTable( arg ) { 18436 if ( typeof arg === 'string' ) { 18437 return this.getScriptTable( arg ); 18438 } 18439 return arg; 18440 } 18441 getSupportedLangSys( scriptTable ) { 18442 scriptTable = this.ensureScriptTable( scriptTable ); 18443 const hasDefault = scriptTable.defaultLangSys !== 0; 18444 const supported = scriptTable.langSysRecords.map( 18445 ( l ) => l.langSysTag 18446 ); 18447 if ( hasDefault ) supported.unshift( `dflt` ); 18448 return supported; 18449 } 18450 getDefaultLangSysTable( scriptTable ) { 18451 scriptTable = this.ensureScriptTable( scriptTable ); 18452 let offset = scriptTable.defaultLangSys; 18453 if ( offset !== 0 ) { 18454 this.parser.currentPosition = scriptTable.start + offset; 18455 let table = new LangSysTable( this.parser ); 18456 table.langSysTag = ``; 18457 table.defaultForScript = scriptTable.scriptTag; 18458 return table; 18459 } 18460 } 18461 getLangSysTable( scriptTable, langSysTag = `dflt` ) { 18462 if ( langSysTag === `dflt` ) 18463 return this.getDefaultLangSysTable( scriptTable ); 18464 scriptTable = this.ensureScriptTable( scriptTable ); 18465 let record = scriptTable.langSysRecords.find( 18466 ( l ) => l.langSysTag === langSysTag 18467 ); 18468 this.parser.currentPosition = scriptTable.start + record.langSysOffset; 18469 let table = new LangSysTable( this.parser ); 18470 table.langSysTag = langSysTag; 18471 return table; 18472 } 18473 getFeatures( langSysTable ) { 18474 return langSysTable.featureIndices.map( ( index ) => 18475 this.getFeature( index ) 18476 ); 18477 } 18478 getFeature( indexOrTag ) { 18479 let record; 18480 if ( parseInt( indexOrTag ) == indexOrTag ) { 18481 record = this.featureList.featureRecords[ indexOrTag ]; 18482 } else { 18483 record = this.featureList.featureRecords.find( 18484 ( f ) => f.featureTag === indexOrTag 18485 ); 18486 } 18487 if ( ! record ) return; 18488 this.parser.currentPosition = 18489 this.featureList.start + record.featureOffset; 18490 let table = new FeatureTable( this.parser ); 18491 table.featureTag = record.featureTag; 18492 return table; 18493 } 18494 getLookups( featureTable ) { 18495 return featureTable.lookupListIndices.map( ( index ) => 18496 this.getLookup( index ) 18497 ); 18498 } 18499 getLookup( lookupIndex, type ) { 18500 let lookupOffset = this.lookupList.lookups[ lookupIndex ]; 18501 this.parser.currentPosition = this.lookupList.start + lookupOffset; 18502 return new LookupTable( this.parser, type ); 18503 } 18504 } 18505 class GSUB extends CommonLayoutTable { 18506 constructor( dict, dataview ) { 18507 super( dict, dataview, `GSUB` ); 18508 } 18509 getLookup( lookupIndex ) { 18510 return super.getLookup( lookupIndex, `GSUB` ); 18511 } 18512 } 18513 var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } ); 18514 class GPOS extends CommonLayoutTable { 18515 constructor( dict, dataview ) { 18516 super( dict, dataview, `GPOS` ); 18517 } 18518 getLookup( lookupIndex ) { 18519 return super.getLookup( lookupIndex, `GPOS` ); 18520 } 18521 } 18522 var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } ); 18523 class SVG extends SimpleTable { 18524 constructor( dict, dataview ) { 18525 const { p: p } = super( dict, dataview ); 18526 this.version = p.uint16; 18527 this.offsetToSVGDocumentList = p.Offset32; 18528 p.currentPosition = this.tableStart + this.offsetToSVGDocumentList; 18529 this.documentList = new SVGDocumentList( p ); 18530 } 18531 } 18532 class SVGDocumentList extends ParsedData { 18533 constructor( p ) { 18534 super( p ); 18535 this.numEntries = p.uint16; 18536 this.documentRecords = [ ...new Array( this.numEntries ) ].map( 18537 ( _ ) => new SVGDocumentRecord( p ) 18538 ); 18539 } 18540 getDocument( documentID ) { 18541 let record = this.documentRecords[ documentID ]; 18542 if ( ! record ) return ''; 18543 let offset = this.start + record.svgDocOffset; 18544 this.parser.currentPosition = offset; 18545 return this.parser.readBytes( record.svgDocLength ); 18546 } 18547 getDocumentForGlyph( glyphID ) { 18548 let id = this.documentRecords.findIndex( 18549 ( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID 18550 ); 18551 if ( id === -1 ) return ''; 18552 return this.getDocument( id ); 18553 } 18554 } 18555 class SVGDocumentRecord { 18556 constructor( p ) { 18557 this.startGlyphID = p.uint16; 18558 this.endGlyphID = p.uint16; 18559 this.svgDocOffset = p.Offset32; 18560 this.svgDocLength = p.uint32; 18561 } 18562 } 18563 var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } ); 18564 class fvar extends SimpleTable { 18565 constructor( dict, dataview ) { 18566 const { p: p } = super( dict, dataview ); 18567 this.majorVersion = p.uint16; 18568 this.minorVersion = p.uint16; 18569 this.axesArrayOffset = p.Offset16; 18570 p.uint16; 18571 this.axisCount = p.uint16; 18572 this.axisSize = p.uint16; 18573 this.instanceCount = p.uint16; 18574 this.instanceSize = p.uint16; 18575 const axisStart = this.tableStart + this.axesArrayOffset; 18576 lazy$1( this, `axes`, () => { 18577 p.currentPosition = axisStart; 18578 return [ ...new Array( this.axisCount ) ].map( 18579 ( _ ) => new VariationAxisRecord( p ) 18580 ); 18581 } ); 18582 const instanceStart = axisStart + this.axisCount * this.axisSize; 18583 lazy$1( this, `instances`, () => { 18584 let instances = []; 18585 for ( let i = 0; i < this.instanceCount; i++ ) { 18586 p.currentPosition = instanceStart + i * this.instanceSize; 18587 instances.push( 18588 new InstanceRecord( p, this.axisCount, this.instanceSize ) 18589 ); 18590 } 18591 return instances; 18592 } ); 18593 } 18594 getSupportedAxes() { 18595 return this.axes.map( ( a ) => a.tag ); 18596 } 18597 getAxis( name ) { 18598 return this.axes.find( ( a ) => a.tag === name ); 18599 } 18600 } 18601 class VariationAxisRecord { 18602 constructor( p ) { 18603 this.tag = p.tag; 18604 this.minValue = p.fixed; 18605 this.defaultValue = p.fixed; 18606 this.maxValue = p.fixed; 18607 this.flags = p.flags( 16 ); 18608 this.axisNameID = p.uint16; 18609 } 18610 } 18611 class InstanceRecord { 18612 constructor( p, axisCount, size ) { 18613 let start = p.currentPosition; 18614 this.subfamilyNameID = p.uint16; 18615 p.uint16; 18616 this.coordinates = [ ...new Array( axisCount ) ].map( 18617 ( _ ) => p.fixed 18618 ); 18619 if ( p.currentPosition - start < size ) { 18620 this.postScriptNameID = p.uint16; 18621 } 18622 } 18623 } 18624 var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } ); 18625 class cvt extends SimpleTable { 18626 constructor( dict, dataview ) { 18627 const { p: p } = super( dict, dataview ); 18628 const n = dict.length / 2; 18629 lazy$1( this, `items`, () => 18630 [ ...new Array( n ) ].map( ( _ ) => p.fword ) 18631 ); 18632 } 18633 } 18634 var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } ); 18635 class fpgm extends SimpleTable { 18636 constructor( dict, dataview ) { 18637 const { p: p } = super( dict, dataview ); 18638 lazy$1( this, `instructions`, () => 18639 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 18640 ); 18641 } 18642 } 18643 var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } ); 18644 class gasp extends SimpleTable { 18645 constructor( dict, dataview ) { 18646 const { p: p } = super( dict, dataview ); 18647 this.version = p.uint16; 18648 this.numRanges = p.uint16; 18649 const getter = () => 18650 [ ...new Array( this.numRanges ) ].map( 18651 ( _ ) => new GASPRange( p ) 18652 ); 18653 lazy$1( this, `gaspRanges`, getter ); 18654 } 18655 } 18656 class GASPRange { 18657 constructor( p ) { 18658 this.rangeMaxPPEM = p.uint16; 18659 this.rangeGaspBehavior = p.uint16; 18660 } 18661 } 18662 var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } ); 18663 class glyf extends SimpleTable { 18664 constructor( dict, dataview ) { 18665 super( dict, dataview ); 18666 } 18667 getGlyphData( offset, length ) { 18668 this.parser.currentPosition = this.tableStart + offset; 18669 return this.parser.readBytes( length ); 18670 } 18671 } 18672 var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } ); 18673 class loca extends SimpleTable { 18674 constructor( dict, dataview, tables ) { 18675 const { p: p } = super( dict, dataview ); 18676 const n = tables.maxp.numGlyphs + 1; 18677 if ( tables.head.indexToLocFormat === 0 ) { 18678 this.x2 = true; 18679 lazy$1( this, `offsets`, () => 18680 [ ...new Array( n ) ].map( ( _ ) => p.Offset16 ) 18681 ); 18682 } else { 18683 lazy$1( this, `offsets`, () => 18684 [ ...new Array( n ) ].map( ( _ ) => p.Offset32 ) 18685 ); 18686 } 18687 } 18688 getGlyphDataOffsetAndLength( glyphID ) { 18689 let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1; 18690 let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1; 18691 return { offset: offset, length: nextOffset - offset }; 18692 } 18693 } 18694 var loca$1 = Object.freeze( { __proto__: null, loca: loca } ); 18695 class prep extends SimpleTable { 18696 constructor( dict, dataview ) { 18697 const { p: p } = super( dict, dataview ); 18698 lazy$1( this, `instructions`, () => 18699 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 18700 ); 18701 } 18702 } 18703 var prep$1 = Object.freeze( { __proto__: null, prep: prep } ); 18704 class CFF extends SimpleTable { 18705 constructor( dict, dataview ) { 18706 const { p: p } = super( dict, dataview ); 18707 lazy$1( this, `data`, () => p.readBytes() ); 18708 } 18709 } 18710 var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } ); 18711 class CFF2 extends SimpleTable { 18712 constructor( dict, dataview ) { 18713 const { p: p } = super( dict, dataview ); 18714 lazy$1( this, `data`, () => p.readBytes() ); 18715 } 18716 } 18717 var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } ); 18718 class VORG extends SimpleTable { 18719 constructor( dict, dataview ) { 18720 const { p: p } = super( dict, dataview ); 18721 this.majorVersion = p.uint16; 18722 this.minorVersion = p.uint16; 18723 this.defaultVertOriginY = p.int16; 18724 this.numVertOriginYMetrics = p.uint16; 18725 lazy$1( this, `vertORiginYMetrics`, () => 18726 [ ...new Array( this.numVertOriginYMetrics ) ].map( 18727 ( _ ) => new VertOriginYMetric( p ) 18728 ) 18729 ); 18730 } 18731 } 18732 class VertOriginYMetric { 18733 constructor( p ) { 18734 this.glyphIndex = p.uint16; 18735 this.vertOriginY = p.int16; 18736 } 18737 } 18738 var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } ); 18739 class BitmapSize { 18740 constructor( p ) { 18741 this.indexSubTableArrayOffset = p.Offset32; 18742 this.indexTablesSize = p.uint32; 18743 this.numberofIndexSubTables = p.uint32; 18744 this.colorRef = p.uint32; 18745 this.hori = new SbitLineMetrics( p ); 18746 this.vert = new SbitLineMetrics( p ); 18747 this.startGlyphIndex = p.uint16; 18748 this.endGlyphIndex = p.uint16; 18749 this.ppemX = p.uint8; 18750 this.ppemY = p.uint8; 18751 this.bitDepth = p.uint8; 18752 this.flags = p.int8; 18753 } 18754 } 18755 class BitmapScale { 18756 constructor( p ) { 18757 this.hori = new SbitLineMetrics( p ); 18758 this.vert = new SbitLineMetrics( p ); 18759 this.ppemX = p.uint8; 18760 this.ppemY = p.uint8; 18761 this.substitutePpemX = p.uint8; 18762 this.substitutePpemY = p.uint8; 18763 } 18764 } 18765 class SbitLineMetrics { 18766 constructor( p ) { 18767 this.ascender = p.int8; 18768 this.descender = p.int8; 18769 this.widthMax = p.uint8; 18770 this.caretSlopeNumerator = p.int8; 18771 this.caretSlopeDenominator = p.int8; 18772 this.caretOffset = p.int8; 18773 this.minOriginSB = p.int8; 18774 this.minAdvanceSB = p.int8; 18775 this.maxBeforeBL = p.int8; 18776 this.minAfterBL = p.int8; 18777 this.pad1 = p.int8; 18778 this.pad2 = p.int8; 18779 } 18780 } 18781 class EBLC extends SimpleTable { 18782 constructor( dict, dataview, name ) { 18783 const { p: p } = super( dict, dataview, name ); 18784 this.majorVersion = p.uint16; 18785 this.minorVersion = p.uint16; 18786 this.numSizes = p.uint32; 18787 lazy$1( this, `bitMapSizes`, () => 18788 [ ...new Array( this.numSizes ) ].map( 18789 ( _ ) => new BitmapSize( p ) 18790 ) 18791 ); 18792 } 18793 } 18794 var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } ); 18795 class EBDT extends SimpleTable { 18796 constructor( dict, dataview, name ) { 18797 const { p: p } = super( dict, dataview, name ); 18798 this.majorVersion = p.uint16; 18799 this.minorVersion = p.uint16; 18800 } 18801 } 18802 var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } ); 18803 class EBSC extends SimpleTable { 18804 constructor( dict, dataview ) { 18805 const { p: p } = super( dict, dataview ); 18806 this.majorVersion = p.uint16; 18807 this.minorVersion = p.uint16; 18808 this.numSizes = p.uint32; 18809 lazy$1( this, `bitmapScales`, () => 18810 [ ...new Array( this.numSizes ) ].map( 18811 ( _ ) => new BitmapScale( p ) 18812 ) 18813 ); 18814 } 18815 } 18816 var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } ); 18817 class CBLC extends EBLC { 18818 constructor( dict, dataview ) { 18819 super( dict, dataview, `CBLC` ); 18820 } 18821 } 18822 var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } ); 18823 class CBDT extends EBDT { 18824 constructor( dict, dataview ) { 18825 super( dict, dataview, `CBDT` ); 18826 } 18827 } 18828 var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } ); 18829 class sbix extends SimpleTable { 18830 constructor( dict, dataview ) { 18831 const { p: p } = super( dict, dataview ); 18832 this.version = p.uint16; 18833 this.flags = p.flags( 16 ); 18834 this.numStrikes = p.uint32; 18835 lazy$1( this, `strikeOffsets`, () => 18836 [ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 ) 18837 ); 18838 } 18839 } 18840 var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } ); 18841 class COLR extends SimpleTable { 18842 constructor( dict, dataview ) { 18843 const { p: p } = super( dict, dataview ); 18844 this.version = p.uint16; 18845 this.numBaseGlyphRecords = p.uint16; 18846 this.baseGlyphRecordsOffset = p.Offset32; 18847 this.layerRecordsOffset = p.Offset32; 18848 this.numLayerRecords = p.uint16; 18849 } 18850 getBaseGlyphRecord( glyphID ) { 18851 let start = this.tableStart + this.baseGlyphRecordsOffset; 18852 this.parser.currentPosition = start; 18853 let first = new BaseGlyphRecord( this.parser ); 18854 let firstID = first.gID; 18855 let end = this.tableStart + this.layerRecordsOffset - 6; 18856 this.parser.currentPosition = end; 18857 let last = new BaseGlyphRecord( this.parser ); 18858 let lastID = last.gID; 18859 if ( firstID === glyphID ) return first; 18860 if ( lastID === glyphID ) return last; 18861 while ( true ) { 18862 if ( start === end ) break; 18863 let mid = start + ( end - start ) / 12; 18864 this.parser.currentPosition = mid; 18865 let middle = new BaseGlyphRecord( this.parser ); 18866 let midID = middle.gID; 18867 if ( midID === glyphID ) return middle; 18868 else if ( midID > glyphID ) { 18869 end = mid; 18870 } else if ( midID < glyphID ) { 18871 start = mid; 18872 } 18873 } 18874 return false; 18875 } 18876 getLayers( glyphID ) { 18877 let record = this.getBaseGlyphRecord( glyphID ); 18878 this.parser.currentPosition = 18879 this.tableStart + 18880 this.layerRecordsOffset + 18881 4 * record.firstLayerIndex; 18882 return [ ...new Array( record.numLayers ) ].map( 18883 ( _ ) => new LayerRecord( p ) 18884 ); 18885 } 18886 } 18887 class BaseGlyphRecord { 18888 constructor( p ) { 18889 this.gID = p.uint16; 18890 this.firstLayerIndex = p.uint16; 18891 this.numLayers = p.uint16; 18892 } 18893 } 18894 class LayerRecord { 18895 constructor( p ) { 18896 this.gID = p.uint16; 18897 this.paletteIndex = p.uint16; 18898 } 18899 } 18900 var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } ); 18901 class CPAL extends SimpleTable { 18902 constructor( dict, dataview ) { 18903 const { p: p } = super( dict, dataview ); 18904 this.version = p.uint16; 18905 this.numPaletteEntries = p.uint16; 18906 const numPalettes = ( this.numPalettes = p.uint16 ); 18907 this.numColorRecords = p.uint16; 18908 this.offsetFirstColorRecord = p.Offset32; 18909 this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map( 18910 ( _ ) => p.uint16 18911 ); 18912 lazy$1( this, `colorRecords`, () => { 18913 p.currentPosition = this.tableStart + this.offsetFirstColorRecord; 18914 return [ ...new Array( this.numColorRecords ) ].map( 18915 ( _ ) => new ColorRecord( p ) 18916 ); 18917 } ); 18918 if ( this.version === 1 ) { 18919 this.offsetPaletteTypeArray = p.Offset32; 18920 this.offsetPaletteLabelArray = p.Offset32; 18921 this.offsetPaletteEntryLabelArray = p.Offset32; 18922 lazy$1( this, `paletteTypeArray`, () => { 18923 p.currentPosition = 18924 this.tableStart + this.offsetPaletteTypeArray; 18925 return new PaletteTypeArray( p, numPalettes ); 18926 } ); 18927 lazy$1( this, `paletteLabelArray`, () => { 18928 p.currentPosition = 18929 this.tableStart + this.offsetPaletteLabelArray; 18930 return new PaletteLabelsArray( p, numPalettes ); 18931 } ); 18932 lazy$1( this, `paletteEntryLabelArray`, () => { 18933 p.currentPosition = 18934 this.tableStart + this.offsetPaletteEntryLabelArray; 18935 return new PaletteEntryLabelArray( p, numPalettes ); 18936 } ); 18937 } 18938 } 18939 } 18940 class ColorRecord { 18941 constructor( p ) { 18942 this.blue = p.uint8; 18943 this.green = p.uint8; 18944 this.red = p.uint8; 18945 this.alpha = p.uint8; 18946 } 18947 } 18948 class PaletteTypeArray { 18949 constructor( p, numPalettes ) { 18950 this.paletteTypes = [ ...new Array( numPalettes ) ].map( 18951 ( _ ) => p.uint32 18952 ); 18953 } 18954 } 18955 class PaletteLabelsArray { 18956 constructor( p, numPalettes ) { 18957 this.paletteLabels = [ ...new Array( numPalettes ) ].map( 18958 ( _ ) => p.uint16 18959 ); 18960 } 18961 } 18962 class PaletteEntryLabelArray { 18963 constructor( p, numPalettes ) { 18964 this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map( 18965 ( _ ) => p.uint16 18966 ); 18967 } 18968 } 18969 var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } ); 18970 class DSIG extends SimpleTable { 18971 constructor( dict, dataview ) { 18972 const { p: p } = super( dict, dataview ); 18973 this.version = p.uint32; 18974 this.numSignatures = p.uint16; 18975 this.flags = p.uint16; 18976 this.signatureRecords = [ ...new Array( this.numSignatures ) ].map( 18977 ( _ ) => new SignatureRecord( p ) 18978 ); 18979 } 18980 getData( signatureID ) { 18981 const record = this.signatureRecords[ signatureID ]; 18982 this.parser.currentPosition = this.tableStart + record.offset; 18983 return new SignatureBlockFormat1( this.parser ); 18984 } 18985 } 18986 class SignatureRecord { 18987 constructor( p ) { 18988 this.format = p.uint32; 18989 this.length = p.uint32; 18990 this.offset = p.Offset32; 18991 } 18992 } 18993 class SignatureBlockFormat1 { 18994 constructor( p ) { 18995 p.uint16; 18996 p.uint16; 18997 this.signatureLength = p.uint32; 18998 this.signature = p.readBytes( this.signatureLength ); 18999 } 19000 } 19001 var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } ); 19002 class hdmx extends SimpleTable { 19003 constructor( dict, dataview, tables ) { 19004 const { p: p } = super( dict, dataview ); 19005 const numGlyphs = tables.hmtx.numGlyphs; 19006 this.version = p.uint16; 19007 this.numRecords = p.int16; 19008 this.sizeDeviceRecord = p.int32; 19009 this.records = [ ...new Array( numRecords ) ].map( 19010 ( _ ) => new DeviceRecord( p, numGlyphs ) 19011 ); 19012 } 19013 } 19014 class DeviceRecord { 19015 constructor( p, numGlyphs ) { 19016 this.pixelSize = p.uint8; 19017 this.maxWidth = p.uint8; 19018 this.widths = p.readBytes( numGlyphs ); 19019 } 19020 } 19021 var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } ); 19022 class kern extends SimpleTable { 19023 constructor( dict, dataview ) { 19024 const { p: p } = super( dict, dataview ); 19025 this.version = p.uint16; 19026 this.nTables = p.uint16; 19027 lazy$1( this, `tables`, () => { 19028 let offset = this.tableStart + 4; 19029 const tables = []; 19030 for ( let i = 0; i < this.nTables; i++ ) { 19031 p.currentPosition = offset; 19032 let subtable = new KernSubTable( p ); 19033 tables.push( subtable ); 19034 offset += subtable; 19035 } 19036 return tables; 19037 } ); 19038 } 19039 } 19040 class KernSubTable { 19041 constructor( p ) { 19042 this.version = p.uint16; 19043 this.length = p.uint16; 19044 this.coverage = p.flags( 8 ); 19045 this.format = p.uint8; 19046 if ( this.format === 0 ) { 19047 this.nPairs = p.uint16; 19048 this.searchRange = p.uint16; 19049 this.entrySelector = p.uint16; 19050 this.rangeShift = p.uint16; 19051 lazy$1( this, `pairs`, () => 19052 [ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) ) 19053 ); 19054 } 19055 if ( this.format === 2 ) { 19056 console.warn( 19057 `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` 19058 ); 19059 } 19060 } 19061 get horizontal() { 19062 return this.coverage[ 0 ]; 19063 } 19064 get minimum() { 19065 return this.coverage[ 1 ]; 19066 } 19067 get crossstream() { 19068 return this.coverage[ 2 ]; 19069 } 19070 get override() { 19071 return this.coverage[ 3 ]; 19072 } 19073 } 19074 class Pair { 19075 constructor( p ) { 19076 this.left = p.uint16; 19077 this.right = p.uint16; 19078 this.value = p.fword; 19079 } 19080 } 19081 var kern$1 = Object.freeze( { __proto__: null, kern: kern } ); 19082 class LTSH extends SimpleTable { 19083 constructor( dict, dataview ) { 19084 const { p: p } = super( dict, dataview ); 19085 this.version = p.uint16; 19086 this.numGlyphs = p.uint16; 19087 this.yPels = p.readBytes( this.numGlyphs ); 19088 } 19089 } 19090 var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } ); 19091 class MERG extends SimpleTable { 19092 constructor( dict, dataview ) { 19093 const { p: p } = super( dict, dataview ); 19094 this.version = p.uint16; 19095 this.mergeClassCount = p.uint16; 19096 this.mergeDataOffset = p.Offset16; 19097 this.classDefCount = p.uint16; 19098 this.offsetToClassDefOffsets = p.Offset16; 19099 lazy$1( this, `mergeEntryMatrix`, () => 19100 [ ...new Array( this.mergeClassCount ) ].map( ( _ ) => 19101 p.readBytes( this.mergeClassCount ) 19102 ) 19103 ); 19104 console.warn( `Full MERG parsing is currently not supported.` ); 19105 console.warn( 19106 `If you need this table parsed, please file an issue, or better yet, a PR.` 19107 ); 19108 } 19109 } 19110 var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } ); 19111 class meta extends SimpleTable { 19112 constructor( dict, dataview ) { 19113 const { p: p } = super( dict, dataview ); 19114 this.version = p.uint32; 19115 this.flags = p.uint32; 19116 p.uint32; 19117 this.dataMapsCount = p.uint32; 19118 this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map( 19119 ( _ ) => new DataMap( this.tableStart, p ) 19120 ); 19121 } 19122 } 19123 class DataMap { 19124 constructor( tableStart, p ) { 19125 this.tableStart = tableStart; 19126 this.parser = p; 19127 this.tag = p.tag; 19128 this.dataOffset = p.Offset32; 19129 this.dataLength = p.uint32; 19130 } 19131 getData() { 19132 this.parser.currentField = this.tableStart + this.dataOffset; 19133 return this.parser.readBytes( this.dataLength ); 19134 } 19135 } 19136 var meta$1 = Object.freeze( { __proto__: null, meta: meta } ); 19137 class PCLT extends SimpleTable { 19138 constructor( dict, dataview ) { 19139 super( dict, dataview ); 19140 console.warn( 19141 `This font uses a PCLT table, which is currently not supported by this parser.` 19142 ); 19143 console.warn( 19144 `If you need this table parsed, please file an issue, or better yet, a PR.` 19145 ); 19146 } 19147 } 19148 var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } ); 19149 class VDMX extends SimpleTable { 19150 constructor( dict, dataview ) { 19151 const { p: p } = super( dict, dataview ); 19152 this.version = p.uint16; 19153 this.numRecs = p.uint16; 19154 this.numRatios = p.uint16; 19155 this.ratRanges = [ ...new Array( this.numRatios ) ].map( 19156 ( _ ) => new RatioRange( p ) 19157 ); 19158 this.offsets = [ ...new Array( this.numRatios ) ].map( 19159 ( _ ) => p.Offset16 19160 ); 19161 this.VDMXGroups = [ ...new Array( this.numRecs ) ].map( 19162 ( _ ) => new VDMXGroup( p ) 19163 ); 19164 } 19165 } 19166 class RatioRange { 19167 constructor( p ) { 19168 this.bCharSet = p.uint8; 19169 this.xRatio = p.uint8; 19170 this.yStartRatio = p.uint8; 19171 this.yEndRatio = p.uint8; 19172 } 19173 } 19174 class VDMXGroup { 19175 constructor( p ) { 19176 this.recs = p.uint16; 19177 this.startsz = p.uint8; 19178 this.endsz = p.uint8; 19179 this.records = [ ...new Array( this.recs ) ].map( 19180 ( _ ) => new vTable( p ) 19181 ); 19182 } 19183 } 19184 class vTable { 19185 constructor( p ) { 19186 this.yPelHeight = p.uint16; 19187 this.yMax = p.int16; 19188 this.yMin = p.int16; 19189 } 19190 } 19191 var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } ); 19192 class vhea extends SimpleTable { 19193 constructor( dict, dataview ) { 19194 const { p: p } = super( dict, dataview ); 19195 this.version = p.fixed; 19196 this.ascent = this.vertTypoAscender = p.int16; 19197 this.descent = this.vertTypoDescender = p.int16; 19198 this.lineGap = this.vertTypoLineGap = p.int16; 19199 this.advanceHeightMax = p.int16; 19200 this.minTopSideBearing = p.int16; 19201 this.minBottomSideBearing = p.int16; 19202 this.yMaxExtent = p.int16; 19203 this.caretSlopeRise = p.int16; 19204 this.caretSlopeRun = p.int16; 19205 this.caretOffset = p.int16; 19206 this.reserved = p.int16; 19207 this.reserved = p.int16; 19208 this.reserved = p.int16; 19209 this.reserved = p.int16; 19210 this.metricDataFormat = p.int16; 19211 this.numOfLongVerMetrics = p.uint16; 19212 p.verifyLength(); 19213 } 19214 } 19215 var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } ); 19216 class vmtx extends SimpleTable { 19217 constructor( dict, dataview, tables ) { 19218 super( dict, dataview ); 19219 const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; 19220 const numGlyphs = tables.maxp.numGlyphs; 19221 const metricsStart = p.currentPosition; 19222 lazy( this, `vMetrics`, () => { 19223 p.currentPosition = metricsStart; 19224 return [ ...new Array( numOfLongVerMetrics ) ].map( 19225 ( _ ) => new LongVertMetric( p.uint16, p.int16 ) 19226 ); 19227 } ); 19228 if ( numOfLongVerMetrics < numGlyphs ) { 19229 const tsbStart = metricsStart + numOfLongVerMetrics * 4; 19230 lazy( this, `topSideBearings`, () => { 19231 p.currentPosition = tsbStart; 19232 return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map( 19233 ( _ ) => p.int16 19234 ); 19235 } ); 19236 } 19237 } 19238 } 19239 class LongVertMetric { 19240 constructor( h, b ) { 19241 this.advanceHeight = h; 19242 this.topSideBearing = b; 19243 } 19244 } 19245 var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } ); 19246 19247 /* eslint-enable */ 19248 19249 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js 19250 /* wp:polyfill */ 19251 /** 19252 * WordPress dependencies 19253 */ 19254 19255 19256 /** 19257 * Internal dependencies 19258 */ 19259 19260 const { 19261 kebabCase: make_families_from_faces_kebabCase 19262 } = unlock(external_wp_components_namespaceObject.privateApis); 19263 function makeFamiliesFromFaces(fontFaces) { 19264 const fontFamiliesObject = fontFaces.reduce((acc, item) => { 19265 if (!acc[item.fontFamily]) { 19266 acc[item.fontFamily] = { 19267 name: item.fontFamily, 19268 fontFamily: item.fontFamily, 19269 slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()), 19270 fontFace: [] 19271 }; 19272 } 19273 acc[item.fontFamily].fontFace.push(item); 19274 return acc; 19275 }, {}); 19276 return Object.values(fontFamiliesObject); 19277 } 19278 19279 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js 19280 /* wp:polyfill */ 19281 /** 19282 * WordPress dependencies 19283 */ 19284 19285 19286 19287 19288 /** 19289 * Internal dependencies 19290 */ 19291 19292 19293 19294 19295 19296 19297 function UploadFonts() { 19298 const { 19299 installFonts 19300 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19301 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); 19302 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 19303 const handleDropZone = files => { 19304 handleFilesUpload(files); 19305 }; 19306 const onFilesUpload = event => { 19307 handleFilesUpload(event.target.files); 19308 }; 19309 19310 /** 19311 * Filters the selected files to only allow the ones with the allowed extensions 19312 * 19313 * @param {Array} files The files to be filtered 19314 * @return {void} 19315 */ 19316 const handleFilesUpload = async files => { 19317 setNotice(null); 19318 setIsUploading(true); 19319 const uniqueFilenames = new Set(); 19320 const selectedFiles = [...files]; 19321 let hasInvalidFiles = false; 19322 19323 // Use map to create a promise for each file check, then filter with Promise.all. 19324 const checkFilesPromises = selectedFiles.map(async file => { 19325 const isFont = await isFontFile(file); 19326 if (!isFont) { 19327 hasInvalidFiles = true; 19328 return null; // Return null for invalid files. 19329 } 19330 // Check for duplicates 19331 if (uniqueFilenames.has(file.name)) { 19332 return null; // Return null for duplicates. 19333 } 19334 // Check if the file extension is allowed. 19335 const fileExtension = file.name.split('.').pop().toLowerCase(); 19336 if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) { 19337 uniqueFilenames.add(file.name); 19338 return file; // Return the file if it passes all checks. 19339 } 19340 return null; // Return null for disallowed file extensions. 19341 }); 19342 19343 // Filter out the nulls after all promises have resolved. 19344 const allowedFiles = (await Promise.all(checkFilesPromises)).filter(file => null !== file); 19345 if (allowedFiles.length > 0) { 19346 loadFiles(allowedFiles); 19347 } else { 19348 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.'); 19349 setNotice({ 19350 type: 'error', 19351 message 19352 }); 19353 setIsUploading(false); 19354 } 19355 }; 19356 19357 /** 19358 * Loads the selected files and reads the font metadata 19359 * 19360 * @param {Array} files The files to be loaded 19361 * @return {void} 19362 */ 19363 const loadFiles = async files => { 19364 const fontFacesLoaded = await Promise.all(files.map(async fontFile => { 19365 const fontFaceData = await getFontFaceMetadata(fontFile); 19366 await loadFontFaceInBrowser(fontFaceData, fontFaceData.file, 'all'); 19367 return fontFaceData; 19368 })); 19369 handleInstall(fontFacesLoaded); 19370 }; 19371 19372 /** 19373 * Checks if a file is a valid Font file. 19374 * 19375 * @param {File} file The file to be checked. 19376 * @return {boolean} Whether the file is a valid font file. 19377 */ 19378 async function isFontFile(file) { 19379 const font = new Font('Uploaded Font'); 19380 try { 19381 const buffer = await readFileAsArrayBuffer(file); 19382 await font.fromDataBuffer(buffer, 'font'); 19383 return true; 19384 } catch (error) { 19385 return false; 19386 } 19387 } 19388 19389 // Create a function to read the file as array buffer 19390 async function readFileAsArrayBuffer(file) { 19391 return new Promise((resolve, reject) => { 19392 const reader = new window.FileReader(); 19393 reader.readAsArrayBuffer(file); 19394 reader.onload = () => resolve(reader.result); 19395 reader.onerror = reject; 19396 }); 19397 } 19398 const getFontFaceMetadata = async fontFile => { 19399 const buffer = await readFileAsArrayBuffer(fontFile); 19400 const fontObj = new Font('Uploaded Font'); 19401 fontObj.fromDataBuffer(buffer, fontFile.name); 19402 // Assuming that fromDataBuffer triggers onload event and returning a Promise 19403 const onloadEvent = await new Promise(resolve => fontObj.onload = resolve); 19404 const font = onloadEvent.detail.font; 19405 const { 19406 name 19407 } = font.opentype.tables; 19408 const fontName = name.get(16) || name.get(1); 19409 const isItalic = name.get(2).toLowerCase().includes('italic'); 19410 const fontWeight = font.opentype.tables['OS/2'].usWeightClass || 'normal'; 19411 const isVariable = !!font.opentype.tables.fvar; 19412 const weightAxis = isVariable && font.opentype.tables.fvar.axes.find(({ 19413 tag 19414 }) => tag === 'wght'); 19415 const weightRange = weightAxis ? `$weightAxis.minValue} $weightAxis.maxValue}` : null; 19416 return { 19417 file: fontFile, 19418 fontFamily: fontName, 19419 fontStyle: isItalic ? 'italic' : 'normal', 19420 fontWeight: weightRange || fontWeight 19421 }; 19422 }; 19423 19424 /** 19425 * Creates the font family definition and sends it to the server 19426 * 19427 * @param {Array} fontFaces The font faces to be installed 19428 * @return {void} 19429 */ 19430 const handleInstall = async fontFaces => { 19431 const fontFamilies = makeFamiliesFromFaces(fontFaces); 19432 try { 19433 await installFonts(fontFamilies); 19434 setNotice({ 19435 type: 'success', 19436 message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') 19437 }); 19438 } catch (error) { 19439 setNotice({ 19440 type: 'error', 19441 message: error.message, 19442 errors: error?.installationErrors 19443 }); 19444 } 19445 setIsUploading(false); 19446 }; 19447 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19448 className: "font-library-modal__tabpanel-layout", 19449 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { 19450 onFilesDrop: handleDropZone 19451 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19452 className: "font-library-modal__local-fonts", 19453 children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Notice, { 19454 status: notice.type, 19455 __unstableHTML: true, 19456 onRemove: () => setNotice(null), 19457 children: [notice.message, notice.errors && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 19458 children: notice.errors.map((error, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 19459 children: error 19460 }, index)) 19461 })] 19462 }), isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19463 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19464 className: "font-library-modal__upload-area", 19465 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 19466 }) 19467 }), !isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { 19468 accept: ALLOWED_FILE_EXTENSIONS.map(ext => `.$ext}`).join(','), 19469 multiple: true, 19470 onChange: onFilesUpload, 19471 render: ({ 19472 openFileDialog 19473 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19474 __next40pxDefaultSize: true, 19475 className: "font-library-modal__upload-area", 19476 onClick: openFileDialog, 19477 children: (0,external_wp_i18n_namespaceObject.__)('Upload font') 19478 }) 19479 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19480 margin: 2 19481 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 19482 className: "font-library-modal__upload-area__text", 19483 children: (0,external_wp_i18n_namespaceObject.__)('Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.') 19484 })] 19485 })] 19486 }); 19487 } 19488 /* harmony default export */ const upload_fonts = (UploadFonts); 19489 19490 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js 19491 /* wp:polyfill */ 19492 /** 19493 * WordPress dependencies 19494 */ 19495 19496 19497 19498 19499 19500 19501 /** 19502 * Internal dependencies 19503 */ 19504 19505 19506 19507 19508 19509 19510 const { 19511 Tabs 19512 } = unlock(external_wp_components_namespaceObject.privateApis); 19513 const DEFAULT_TAB = { 19514 id: 'installed-fonts', 19515 title: (0,external_wp_i18n_namespaceObject._x)('Library', 'Font library') 19516 }; 19517 const UPLOAD_TAB = { 19518 id: 'upload-fonts', 19519 title: (0,external_wp_i18n_namespaceObject._x)('Upload', 'noun') 19520 }; 19521 const tabsFromCollections = collections => collections.map(({ 19522 slug, 19523 name 19524 }) => ({ 19525 id: slug, 19526 title: collections.length === 1 && slug === 'google-fonts' ? (0,external_wp_i18n_namespaceObject.__)('Install Fonts') : name 19527 })); 19528 function FontLibraryModal({ 19529 onRequestClose, 19530 defaultTabId = 'installed-fonts' 19531 }) { 19532 const { 19533 collections 19534 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19535 const canUserCreate = (0,external_wp_data_namespaceObject.useSelect)(select => { 19536 return select(external_wp_coreData_namespaceObject.store).canUser('create', { 19537 kind: 'postType', 19538 name: 'wp_font_family' 19539 }); 19540 }, []); 19541 const tabs = [DEFAULT_TAB]; 19542 if (canUserCreate) { 19543 tabs.push(UPLOAD_TAB); 19544 tabs.push(...tabsFromCollections(collections || [])); 19545 } 19546 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 19547 title: (0,external_wp_i18n_namespaceObject.__)('Fonts'), 19548 onRequestClose: onRequestClose, 19549 isFullScreen: true, 19550 className: "font-library-modal", 19551 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { 19552 defaultTabId: defaultTabId, 19553 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19554 className: "font-library-modal__tablist-container", 19555 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { 19556 children: tabs.map(({ 19557 id, 19558 title 19559 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 19560 tabId: id, 19561 children: title 19562 }, id)) 19563 }) 19564 }), tabs.map(({ 19565 id 19566 }) => { 19567 let contents; 19568 switch (id) { 19569 case 'upload-fonts': 19570 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts, {}); 19571 break; 19572 case 'installed-fonts': 19573 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts, {}); 19574 break; 19575 default: 19576 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection, { 19577 slug: id 19578 }); 19579 } 19580 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { 19581 tabId: id, 19582 focusable: false, 19583 children: contents 19584 }, id); 19585 })] 19586 }) 19587 }); 19588 } 19589 /* harmony default export */ const font_library_modal = (FontLibraryModal); 19590 19591 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js 19592 /** 19593 * WordPress dependencies 19594 */ 19595 19596 19597 19598 19599 /** 19600 * Internal dependencies 19601 */ 19602 19603 19604 19605 function FontFamilyItem({ 19606 font 19607 }) { 19608 const { 19609 handleSetLibraryFontSelected, 19610 setModalTabOpen 19611 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19612 const variantsCount = font?.fontFace?.length || 1; 19613 const handleClick = () => { 19614 handleSetLibraryFontSelected(font); 19615 setModalTabOpen('installed-fonts'); 19616 }; 19617 const previewStyle = getFamilyPreviewStyle(font); 19618 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 19619 onClick: handleClick, 19620 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 19621 justify: "space-between", 19622 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19623 style: previewStyle, 19624 children: font.name 19625 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19626 className: "edit-site-global-styles-screen-typography__font-variants-count", 19627 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of font variants. */ 19628 (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) 19629 })] 19630 }) 19631 }); 19632 } 19633 /* harmony default export */ const font_family_item = (FontFamilyItem); 19634 19635 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js 19636 /* wp:polyfill */ 19637 /** 19638 * WordPress dependencies 19639 */ 19640 19641 19642 19643 19644 19645 19646 /** 19647 * Internal dependencies 19648 */ 19649 19650 19651 19652 19653 19654 19655 19656 const { 19657 useGlobalSetting: font_families_useGlobalSetting 19658 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19659 19660 /** 19661 * Maps the fonts with the source, if available. 19662 * 19663 * @param {Array} fonts The fonts to map. 19664 * @param {string} source The source of the fonts. 19665 * @return {Array} The mapped fonts. 19666 */ 19667 function mapFontsWithSource(fonts, source) { 19668 return fonts ? fonts.map(f => setUIValuesNeeded(f, { 19669 source 19670 })) : []; 19671 } 19672 function FontFamilies() { 19673 const { 19674 baseCustomFonts, 19675 modalTabOpen, 19676 setModalTabOpen 19677 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19678 const [fontFamilies] = font_families_useGlobalSetting('typography.fontFamilies'); 19679 const [baseFontFamilies] = font_families_useGlobalSetting('typography.fontFamilies', undefined, 'base'); 19680 const themeFonts = mapFontsWithSource(fontFamilies?.theme, 'theme'); 19681 const customFonts = mapFontsWithSource(fontFamilies?.custom, 'custom'); 19682 const activeFonts = [...themeFonts, ...customFonts].sort((a, b) => a.name.localeCompare(b.name)); 19683 const hasFonts = 0 < activeFonts.length; 19684 const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0; 19685 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19686 children: [!!modalTabOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_library_modal, { 19687 onRequestClose: () => setModalTabOpen(null), 19688 defaultTabId: modalTabOpen 19689 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19690 spacing: 2, 19691 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 19692 justify: "space-between", 19693 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 19694 level: 3, 19695 children: (0,external_wp_i18n_namespaceObject.__)('Fonts') 19696 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19697 onClick: () => setModalTabOpen('installed-fonts'), 19698 label: (0,external_wp_i18n_namespaceObject.__)('Manage fonts'), 19699 icon: library_settings, 19700 size: "small" 19701 })] 19702 }), activeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19703 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 19704 size: "large", 19705 isBordered: true, 19706 isSeparated: true, 19707 children: activeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_family_item, { 19708 font: font 19709 }, font.slug)) 19710 }) 19711 }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19712 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 19713 as: "p", 19714 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('No fonts activated.') : (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') 19715 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19716 className: "edit-site-global-styles-font-families__manage-fonts", 19717 variant: "secondary", 19718 __next40pxDefaultSize: true, 19719 onClick: () => { 19720 setModalTabOpen(hasInstalledFonts ? 'installed-fonts' : 'upload-fonts'); 19721 }, 19722 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('Manage fonts') : (0,external_wp_i18n_namespaceObject.__)('Add fonts') 19723 })] 19724 })] 19725 })] 19726 }); 19727 } 19728 /* harmony default export */ const font_families = (({ 19729 ...props 19730 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context, { 19731 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { 19732 ...props 19733 }) 19734 })); 19735 19736 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js 19737 /** 19738 * WordPress dependencies 19739 */ 19740 19741 19742 19743 19744 19745 /** 19746 * Internal dependencies 19747 */ 19748 19749 19750 19751 19752 19753 19754 function ScreenTypography() { 19755 const fontLibraryEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled, []); 19756 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19757 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 19758 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 19759 description: (0,external_wp_i18n_namespaceObject.__)('Available fonts, typographic styles, and the application of those styles.') 19760 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19761 className: "edit-site-global-styles-screen", 19762 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19763 spacing: 7, 19764 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { 19765 title: (0,external_wp_i18n_namespaceObject.__)('Typesets') 19766 }), fontLibraryEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_count, {})] 19767 }) 19768 })] 19769 }); 19770 } 19771 /* harmony default export */ const screen_typography = (ScreenTypography); 19772 19773 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js 19774 /** 19775 * WordPress dependencies 19776 */ 19777 19778 19779 /** 19780 * Internal dependencies 19781 */ 19782 19783 19784 const { 19785 useGlobalStyle: typography_panel_useGlobalStyle, 19786 useGlobalSetting: typography_panel_useGlobalSetting, 19787 useSettingsForBlockElement: typography_panel_useSettingsForBlockElement, 19788 TypographyPanel: typography_panel_StylesTypographyPanel 19789 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19790 function TypographyPanel({ 19791 element, 19792 headingLevel 19793 }) { 19794 let prefixParts = []; 19795 if (element === 'heading') { 19796 prefixParts = prefixParts.concat(['elements', headingLevel]); 19797 } else if (element && element !== 'text') { 19798 prefixParts = prefixParts.concat(['elements', element]); 19799 } 19800 const prefix = prefixParts.join('.'); 19801 const [style] = typography_panel_useGlobalStyle(prefix, undefined, 'user', { 19802 shouldDecodeEncode: false 19803 }); 19804 const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle(prefix, undefined, 'all', { 19805 shouldDecodeEncode: false 19806 }); 19807 const [rawSettings] = typography_panel_useGlobalSetting(''); 19808 const usedElement = element === 'heading' ? headingLevel : element; 19809 const settings = typography_panel_useSettingsForBlockElement(rawSettings, undefined, usedElement); 19810 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_panel_StylesTypographyPanel, { 19811 inheritedValue: inheritedStyle, 19812 value: style, 19813 onChange: setStyle, 19814 settings: settings 19815 }); 19816 } 19817 19818 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js 19819 /** 19820 * WordPress dependencies 19821 */ 19822 19823 19824 /** 19825 * Internal dependencies 19826 */ 19827 19828 19829 const { 19830 useGlobalStyle: typography_preview_useGlobalStyle 19831 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19832 function TypographyPreview({ 19833 name, 19834 element, 19835 headingLevel 19836 }) { 19837 var _ref; 19838 let prefix = ''; 19839 if (element === 'heading') { 19840 prefix = `elements.$headingLevel}.`; 19841 } else if (element && element !== 'text') { 19842 prefix = `elements.$element}.`; 19843 } 19844 const [fontFamily] = typography_preview_useGlobalStyle(prefix + 'typography.fontFamily', name); 19845 const [gradientValue] = typography_preview_useGlobalStyle(prefix + 'color.gradient', name); 19846 const [backgroundColor] = typography_preview_useGlobalStyle(prefix + 'color.background', name); 19847 const [fallbackBackgroundColor] = typography_preview_useGlobalStyle('color.background'); 19848 const [color] = typography_preview_useGlobalStyle(prefix + 'color.text', name); 19849 const [fontSize] = typography_preview_useGlobalStyle(prefix + 'typography.fontSize', name); 19850 const [fontStyle] = typography_preview_useGlobalStyle(prefix + 'typography.fontStyle', name); 19851 const [fontWeight] = typography_preview_useGlobalStyle(prefix + 'typography.fontWeight', name); 19852 const [letterSpacing] = typography_preview_useGlobalStyle(prefix + 'typography.letterSpacing', name); 19853 const extraStyles = element === 'link' ? { 19854 textDecoration: 'underline' 19855 } : {}; 19856 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19857 className: "edit-site-typography-preview", 19858 style: { 19859 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 19860 background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, 19861 color, 19862 fontSize, 19863 fontStyle, 19864 fontWeight, 19865 letterSpacing, 19866 ...extraStyles 19867 }, 19868 children: "Aa" 19869 }); 19870 } 19871 19872 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js 19873 /** 19874 * WordPress dependencies 19875 */ 19876 19877 19878 19879 19880 /** 19881 * Internal dependencies 19882 */ 19883 19884 19885 19886 19887 const screen_typography_element_elements = { 19888 text: { 19889 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'), 19890 title: (0,external_wp_i18n_namespaceObject.__)('Text') 19891 }, 19892 link: { 19893 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'), 19894 title: (0,external_wp_i18n_namespaceObject.__)('Links') 19895 }, 19896 heading: { 19897 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on headings.'), 19898 title: (0,external_wp_i18n_namespaceObject.__)('Headings') 19899 }, 19900 caption: { 19901 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on captions.'), 19902 title: (0,external_wp_i18n_namespaceObject.__)('Captions') 19903 }, 19904 button: { 19905 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on buttons.'), 19906 title: (0,external_wp_i18n_namespaceObject.__)('Buttons') 19907 } 19908 }; 19909 function ScreenTypographyElement({ 19910 element 19911 }) { 19912 const [headingLevel, setHeadingLevel] = (0,external_wp_element_namespaceObject.useState)('heading'); 19913 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19914 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 19915 title: screen_typography_element_elements[element].title, 19916 description: screen_typography_element_elements[element].description 19917 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19918 marginX: 4, 19919 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPreview, { 19920 element: element, 19921 headingLevel: headingLevel 19922 }) 19923 }), element === 'heading' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19924 marginX: 4, 19925 marginBottom: "1em", 19926 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 19927 label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'), 19928 hideLabelFromVision: true, 19929 value: headingLevel, 19930 onChange: setHeadingLevel, 19931 isBlock: true, 19932 size: "__unstable-large", 19933 __nextHasNoMarginBottom: true, 19934 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19935 value: "heading", 19936 showTooltip: true, 19937 "aria-label": (0,external_wp_i18n_namespaceObject.__)('All headings'), 19938 label: (0,external_wp_i18n_namespaceObject._x)('All', 'heading levels') 19939 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19940 value: "h1", 19941 showTooltip: true, 19942 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 1'), 19943 label: (0,external_wp_i18n_namespaceObject.__)('H1') 19944 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19945 value: "h2", 19946 showTooltip: true, 19947 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 2'), 19948 label: (0,external_wp_i18n_namespaceObject.__)('H2') 19949 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19950 value: "h3", 19951 showTooltip: true, 19952 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 3'), 19953 label: (0,external_wp_i18n_namespaceObject.__)('H3') 19954 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19955 value: "h4", 19956 showTooltip: true, 19957 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 4'), 19958 label: (0,external_wp_i18n_namespaceObject.__)('H4') 19959 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19960 value: "h5", 19961 showTooltip: true, 19962 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 5'), 19963 label: (0,external_wp_i18n_namespaceObject.__)('H5') 19964 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19965 value: "h6", 19966 showTooltip: true, 19967 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 6'), 19968 label: (0,external_wp_i18n_namespaceObject.__)('H6') 19969 })] 19970 }) 19971 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPanel, { 19972 element: element, 19973 headingLevel: headingLevel 19974 })] 19975 }); 19976 } 19977 /* harmony default export */ const screen_typography_element = (ScreenTypographyElement); 19978 19979 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js 19980 /** 19981 * WordPress dependencies 19982 */ 19983 19984 19985 19986 /** 19987 * Internal dependencies 19988 */ 19989 19990 19991 const { 19992 useGlobalStyle: font_size_preview_useGlobalStyle 19993 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19994 function FontSizePreview({ 19995 fontSize 19996 }) { 19997 var _font$fontFamily; 19998 const [font] = font_size_preview_useGlobalStyle('typography'); 19999 const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? { 20000 minimumFontSize: fontSize.fluid.min, 20001 maximumFontSize: fontSize.fluid.max 20002 } : { 20003 fontSize: fontSize.size 20004 }; 20005 const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input); 20006 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20007 className: "edit-site-typography-preview", 20008 style: { 20009 fontSize: computedFontSize, 20010 fontFamily: (_font$fontFamily = font?.fontFamily) !== null && _font$fontFamily !== void 0 ? _font$fontFamily : 'serif' 20011 }, 20012 children: (0,external_wp_i18n_namespaceObject.__)('Aa') 20013 }); 20014 } 20015 /* harmony default export */ const font_size_preview = (FontSizePreview); 20016 20017 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js 20018 /** 20019 * WordPress dependencies 20020 */ 20021 20022 20023 20024 function ConfirmDeleteFontSizeDialog({ 20025 fontSize, 20026 isOpen, 20027 toggleOpen, 20028 handleRemoveFontSize 20029 }) { 20030 const handleConfirm = async () => { 20031 toggleOpen(); 20032 handleRemoveFontSize(fontSize); 20033 }; 20034 const handleCancel = () => { 20035 toggleOpen(); 20036 }; 20037 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 20038 isOpen: isOpen, 20039 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 20040 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 20041 onCancel: handleCancel, 20042 onConfirm: handleConfirm, 20043 size: "medium", 20044 children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the font size preset. */ 20045 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font size preset?'), fontSize.name) 20046 }); 20047 } 20048 /* harmony default export */ const confirm_delete_font_size_dialog = (ConfirmDeleteFontSizeDialog); 20049 20050 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js 20051 /** 20052 * WordPress dependencies 20053 */ 20054 20055 20056 20057 20058 function RenameFontSizeDialog({ 20059 fontSize, 20060 toggleOpen, 20061 handleRename 20062 }) { 20063 const [newName, setNewName] = (0,external_wp_element_namespaceObject.useState)(fontSize.name); 20064 const handleConfirm = () => { 20065 // If the new name is not empty, call the handleRename function 20066 if (newName.trim()) { 20067 handleRename(newName); 20068 } 20069 toggleOpen(); 20070 }; 20071 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 20072 onRequestClose: toggleOpen, 20073 focusOnMount: "firstContentElement", 20074 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 20075 size: "small", 20076 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 20077 onSubmit: event => { 20078 event.preventDefault(); 20079 handleConfirm(); 20080 toggleOpen(); 20081 }, 20082 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20083 spacing: "3", 20084 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 20085 __next40pxDefaultSize: true, 20086 autoComplete: "off", 20087 value: newName, 20088 onChange: setNewName, 20089 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 20090 placeholder: (0,external_wp_i18n_namespaceObject.__)('Font size preset name') 20091 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20092 justify: "right", 20093 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20094 __next40pxDefaultSize: true, 20095 variant: "tertiary", 20096 onClick: toggleOpen, 20097 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 20098 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20099 __next40pxDefaultSize: true, 20100 variant: "primary", 20101 type: "submit", 20102 children: (0,external_wp_i18n_namespaceObject.__)('Save') 20103 })] 20104 })] 20105 }) 20106 }) 20107 }); 20108 } 20109 /* harmony default export */ const rename_font_size_dialog = (RenameFontSizeDialog); 20110 20111 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js 20112 /** 20113 * WordPress dependencies 20114 */ 20115 20116 /** 20117 * Internal dependencies 20118 */ 20119 20120 20121 const DEFAULT_UNITS = ['px', 'em', 'rem', 'vw', 'vh']; 20122 function SizeControl({ 20123 // Do not allow manipulation of margin bottom 20124 __nextHasNoMarginBottom, 20125 ...props 20126 }) { 20127 const { 20128 baseControlProps 20129 } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props); 20130 const { 20131 value, 20132 onChange, 20133 fallbackValue, 20134 disabled, 20135 label 20136 } = props; 20137 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 20138 availableUnits: DEFAULT_UNITS 20139 }); 20140 const [valueQuantity, valueUnit = 'px'] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units); 20141 const isValueUnitRelative = !!valueUnit && ['em', 'rem', 'vw', 'vh'].includes(valueUnit); 20142 20143 // Receives the new value from the UnitControl component as a string containing the value and unit. 20144 const handleUnitControlChange = newValue => { 20145 onChange(newValue); 20146 }; 20147 20148 // Receives the new value from the RangeControl component as a number. 20149 const handleRangeControlChange = newValue => { 20150 onChange?.(newValue + valueUnit); 20151 }; 20152 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { 20153 ...baseControlProps, 20154 __nextHasNoMarginBottom: true, 20155 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 20156 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20157 isBlock: true, 20158 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { 20159 __next40pxDefaultSize: true, 20160 __nextHasNoMarginBottom: true, 20161 label: label, 20162 hideLabelFromVision: true, 20163 value: value, 20164 onChange: handleUnitControlChange, 20165 units: units, 20166 min: 0, 20167 disabled: disabled 20168 }) 20169 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20170 isBlock: true, 20171 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20172 marginX: 2, 20173 marginBottom: 0, 20174 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { 20175 __next40pxDefaultSize: true, 20176 __nextHasNoMarginBottom: true, 20177 label: label, 20178 hideLabelFromVision: true, 20179 value: valueQuantity, 20180 initialPosition: fallbackValue, 20181 withInputField: false, 20182 onChange: handleRangeControlChange, 20183 min: 0, 20184 max: isValueUnitRelative ? 10 : 100, 20185 step: isValueUnitRelative ? 0.1 : 1, 20186 disabled: disabled 20187 }) 20188 }) 20189 })] 20190 }) 20191 }); 20192 } 20193 /* harmony default export */ const size_control = (SizeControl); 20194 20195 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js 20196 /* wp:polyfill */ 20197 /** 20198 * WordPress dependencies 20199 */ 20200 20201 20202 20203 20204 20205 20206 /** 20207 * Internal dependencies 20208 */ 20209 20210 20211 20212 20213 20214 20215 20216 const { 20217 Menu 20218 } = unlock(external_wp_components_namespaceObject.privateApis); 20219 const { 20220 useGlobalSetting: font_size_useGlobalSetting 20221 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20222 function FontSize() { 20223 var _fontSizes$origin; 20224 const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20225 const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20226 const { 20227 params: { 20228 origin, 20229 slug 20230 }, 20231 goBack 20232 } = (0,external_wp_components_namespaceObject.useNavigator)(); 20233 const [fontSizes, setFontSizes] = font_size_useGlobalSetting('typography.fontSizes'); 20234 const [globalFluid] = font_size_useGlobalSetting('typography.fluid'); 20235 20236 // Get the font sizes from the origin, default to empty array. 20237 const sizes = (_fontSizes$origin = fontSizes[origin]) !== null && _fontSizes$origin !== void 0 ? _fontSizes$origin : []; 20238 20239 // Get the font size by slug. 20240 const fontSize = sizes.find(size => size.slug === slug); 20241 20242 // Navigate to the font sizes list if the font size is not available. 20243 (0,external_wp_element_namespaceObject.useEffect)(() => { 20244 if (!!slug && !fontSize) { 20245 goBack(); 20246 } 20247 }, [slug, fontSize, goBack]); 20248 if (!origin || !slug || !fontSize) { 20249 return null; 20250 } 20251 20252 // Whether the font size is fluid. If not defined, use the global fluid value of the theme. 20253 const isFluid = fontSize?.fluid !== undefined ? !!fontSize.fluid : !!globalFluid; 20254 20255 // Whether custom fluid values are used. 20256 const isCustomFluid = typeof fontSize?.fluid === 'object'; 20257 const handleNameChange = value => { 20258 updateFontSize('name', value); 20259 }; 20260 const handleFontSizeChange = value => { 20261 updateFontSize('size', value); 20262 }; 20263 const handleFluidChange = value => { 20264 updateFontSize('fluid', value); 20265 }; 20266 const handleCustomFluidValues = value => { 20267 if (value) { 20268 // If custom values are used, init the values with the current ones. 20269 updateFontSize('fluid', { 20270 min: fontSize.size, 20271 max: fontSize.size 20272 }); 20273 } else { 20274 // If custom fluid values are disabled, set fluid to true. 20275 updateFontSize('fluid', true); 20276 } 20277 }; 20278 const handleMinChange = value => { 20279 updateFontSize('fluid', { 20280 ...fontSize.fluid, 20281 min: value 20282 }); 20283 }; 20284 const handleMaxChange = value => { 20285 updateFontSize('fluid', { 20286 ...fontSize.fluid, 20287 max: value 20288 }); 20289 }; 20290 const updateFontSize = (key, value) => { 20291 const newFontSizes = sizes.map(size => { 20292 if (size.slug === slug) { 20293 return { 20294 ...size, 20295 [key]: value 20296 }; // Create a new object with updated key 20297 } 20298 return size; 20299 }); 20300 setFontSizes({ 20301 ...fontSizes, 20302 [origin]: newFontSizes 20303 }); 20304 }; 20305 const handleRemoveFontSize = () => { 20306 const newFontSizes = sizes.filter(size => size.slug !== slug); 20307 setFontSizes({ 20308 ...fontSizes, 20309 [origin]: newFontSizes 20310 }); 20311 }; 20312 const toggleDeleteConfirm = () => { 20313 setIsDeleteConfirmOpen(!isDeleteConfirmOpen); 20314 }; 20315 const toggleRenameDialog = () => { 20316 setIsRenameDialogOpen(!isRenameDialogOpen); 20317 }; 20318 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20319 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_delete_font_size_dialog, { 20320 fontSize: fontSize, 20321 isOpen: isDeleteConfirmOpen, 20322 toggleOpen: toggleDeleteConfirm, 20323 handleRemoveFontSize: handleRemoveFontSize 20324 }), isRenameDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_font_size_dialog, { 20325 fontSize: fontSize, 20326 toggleOpen: toggleRenameDialog, 20327 handleRename: handleNameChange 20328 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20329 spacing: 4, 20330 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20331 justify: "space-between", 20332 align: "flex-start", 20333 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20334 title: fontSize.name, 20335 description: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: font size preset name. */ 20336 (0,external_wp_i18n_namespaceObject.__)('Manage the font size %s.'), fontSize.name) 20337 }), origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20338 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20339 marginTop: 3, 20340 marginBottom: 0, 20341 paddingX: 4, 20342 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { 20343 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { 20344 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20345 size: "small", 20346 icon: more_vertical, 20347 label: (0,external_wp_i18n_namespaceObject.__)('Font size options') 20348 }) 20349 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Popover, { 20350 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { 20351 onClick: toggleRenameDialog, 20352 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { 20353 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 20354 }) 20355 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { 20356 onClick: toggleDeleteConfirm, 20357 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { 20358 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 20359 }) 20360 })] 20361 })] 20362 }) 20363 }) 20364 })] 20365 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 20366 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20367 paddingX: 4, 20368 marginBottom: 0, 20369 paddingBottom: 6, 20370 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20371 spacing: 4, 20372 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20373 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview, { 20374 fontSize: fontSize 20375 }) 20376 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20377 label: (0,external_wp_i18n_namespaceObject.__)('Size'), 20378 value: !isCustomFluid ? fontSize.size : '', 20379 onChange: handleFontSizeChange, 20380 disabled: isCustomFluid 20381 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { 20382 label: (0,external_wp_i18n_namespaceObject.__)('Fluid typography'), 20383 help: (0,external_wp_i18n_namespaceObject.__)('Scale the font size dynamically to fit the screen or viewport.'), 20384 checked: isFluid, 20385 onChange: handleFluidChange, 20386 __nextHasNoMarginBottom: true 20387 }), isFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { 20388 label: (0,external_wp_i18n_namespaceObject.__)('Custom fluid values'), 20389 help: (0,external_wp_i18n_namespaceObject.__)('Set custom min and max values for the fluid font size.'), 20390 checked: isCustomFluid, 20391 onChange: handleCustomFluidValues, 20392 __nextHasNoMarginBottom: true 20393 }), isCustomFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20394 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20395 label: (0,external_wp_i18n_namespaceObject.__)('Minimum'), 20396 value: fontSize.fluid?.min, 20397 onChange: handleMinChange 20398 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20399 label: (0,external_wp_i18n_namespaceObject.__)('Maximum'), 20400 value: fontSize.fluid?.max, 20401 onChange: handleMaxChange 20402 })] 20403 })] 20404 }) 20405 }) 20406 })] 20407 })] 20408 }); 20409 } 20410 /* harmony default export */ const font_size = (FontSize); 20411 20412 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 20413 /** 20414 * WordPress dependencies 20415 */ 20416 20417 20418 const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 20419 xmlns: "http://www.w3.org/2000/svg", 20420 viewBox: "0 0 24 24", 20421 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 20422 d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" 20423 }) 20424 }); 20425 /* harmony default export */ const library_plus = (plus); 20426 20427 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js 20428 /** 20429 * WordPress dependencies 20430 */ 20431 20432 20433 20434 function ConfirmResetFontSizesDialog({ 20435 text, 20436 confirmButtonText, 20437 isOpen, 20438 toggleOpen, 20439 onConfirm 20440 }) { 20441 const handleConfirm = async () => { 20442 toggleOpen(); 20443 onConfirm(); 20444 }; 20445 const handleCancel = () => { 20446 toggleOpen(); 20447 }; 20448 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 20449 isOpen: isOpen, 20450 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 20451 confirmButtonText: confirmButtonText, 20452 onCancel: handleCancel, 20453 onConfirm: handleConfirm, 20454 size: "medium", 20455 children: text 20456 }); 20457 } 20458 /* harmony default export */ const confirm_reset_font_sizes_dialog = (ConfirmResetFontSizesDialog); 20459 20460 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js 20461 /* wp:polyfill */ 20462 /** 20463 * WordPress dependencies 20464 */ 20465 20466 20467 20468 20469 20470 20471 /** 20472 * Internal dependencies 20473 */ 20474 20475 20476 20477 20478 20479 20480 20481 const { 20482 Menu: font_sizes_Menu 20483 } = unlock(external_wp_components_namespaceObject.privateApis); 20484 const { 20485 useGlobalSetting: font_sizes_useGlobalSetting 20486 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20487 function FontSizeGroup({ 20488 label, 20489 origin, 20490 sizes, 20491 handleAddFontSize, 20492 handleResetFontSizes 20493 }) { 20494 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20495 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); 20496 const resetDialogText = origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to remove all custom font size presets?') : (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to reset all font size presets to their default values?'); 20497 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20498 children: [isResetDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_reset_font_sizes_dialog, { 20499 text: resetDialogText, 20500 confirmButtonText: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove') : (0,external_wp_i18n_namespaceObject.__)('Reset'), 20501 isOpen: isResetDialogOpen, 20502 toggleOpen: toggleResetDialog, 20503 onConfirm: handleResetFontSizes 20504 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20505 spacing: 4, 20506 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20507 justify: "space-between", 20508 align: "center", 20509 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20510 level: 3, 20511 children: label 20512 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 20513 children: [origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20514 label: (0,external_wp_i18n_namespaceObject.__)('Add font size'), 20515 icon: library_plus, 20516 size: "small", 20517 onClick: handleAddFontSize 20518 }), !!handleResetFontSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(font_sizes_Menu, { 20519 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.TriggerButton, { 20520 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20521 size: "small", 20522 icon: more_vertical, 20523 label: (0,external_wp_i18n_namespaceObject.__)('Font size presets options') 20524 }) 20525 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Popover, { 20526 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Item, { 20527 onClick: toggleResetDialog, 20528 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.ItemLabel, { 20529 children: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove font size presets') : (0,external_wp_i18n_namespaceObject.__)('Reset font size presets') 20530 }) 20531 }) 20532 })] 20533 })] 20534 })] 20535 }), !!sizes.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 20536 isBordered: true, 20537 isSeparated: true, 20538 children: sizes.map(size => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 20539 path: `/typography/font-sizes/$origin}/$size.slug}`, 20540 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20541 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20542 className: "edit-site-font-size__item", 20543 children: size.name 20544 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20545 display: "flex", 20546 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 20547 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 20548 }) 20549 })] 20550 }) 20551 }, size.slug)) 20552 })] 20553 })] 20554 }); 20555 } 20556 function font_sizes_FontSizes() { 20557 const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme'); 20558 const [baseThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme', null, 'base'); 20559 const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default'); 20560 const [baseDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default', null, 'base'); 20561 const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.custom'); 20562 const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting('typography.defaultFontSizes'); 20563 const handleAddFontSize = () => { 20564 const index = getNewIndexFromPresets(customFontSizes, 'custom-'); 20565 const newFontSize = { 20566 /* translators: %d: font size index */ 20567 name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('New Font Size %d'), index), 20568 size: '16px', 20569 slug: `custom-$index}` 20570 }; 20571 setCustomFontSizes([...customFontSizes, newFontSize]); 20572 }; 20573 const hasSameSizeValues = (arr1, arr2) => arr1.map(item => item.size).join('') === arr2.map(item => item.size).join(''); 20574 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20575 spacing: 2, 20576 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20577 title: (0,external_wp_i18n_namespaceObject.__)('Font size presets'), 20578 description: (0,external_wp_i18n_namespaceObject.__)('Create and edit the presets used for font sizes across the site.') 20579 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 20580 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20581 paddingX: 4, 20582 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20583 spacing: 8, 20584 children: [!!themeFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20585 label: (0,external_wp_i18n_namespaceObject.__)('Theme'), 20586 origin: "theme", 20587 sizes: themeFontSizes, 20588 baseSizes: baseThemeFontSizes, 20589 handleAddFontSize: handleAddFontSize, 20590 handleResetFontSizes: hasSameSizeValues(themeFontSizes, baseThemeFontSizes) ? null : () => setThemeFontSizes(baseThemeFontSizes) 20591 }), defaultFontSizesEnabled && !!defaultFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20592 label: (0,external_wp_i18n_namespaceObject.__)('Default'), 20593 origin: "default", 20594 sizes: defaultFontSizes, 20595 baseSizes: baseDefaultFontSizes, 20596 handleAddFontSize: handleAddFontSize, 20597 handleResetFontSizes: hasSameSizeValues(defaultFontSizes, baseDefaultFontSizes) ? null : () => setDefaultFontSizes(baseDefaultFontSizes) 20598 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20599 label: (0,external_wp_i18n_namespaceObject.__)('Custom'), 20600 origin: "custom", 20601 sizes: customFontSizes, 20602 handleAddFontSize: handleAddFontSize, 20603 handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null 20604 })] 20605 }) 20606 }) 20607 })] 20608 }); 20609 } 20610 /* harmony default export */ const font_sizes = (font_sizes_FontSizes); 20611 20612 ;// ./node_modules/@wordpress/icons/build-module/library/shuffle.js 20613 /** 20614 * WordPress dependencies 20615 */ 20616 20617 20618 const shuffle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 20619 viewBox: "0 0 24 24", 20620 xmlns: "http://www.w3.org/2000/SVG", 20621 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 20622 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" 20623 }) 20624 }); 20625 /* harmony default export */ const library_shuffle = (shuffle); 20626 20627 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js 20628 /** 20629 * External dependencies 20630 */ 20631 20632 20633 /** 20634 * WordPress dependencies 20635 */ 20636 20637 20638 function ColorIndicatorWrapper({ 20639 className, 20640 ...props 20641 }) { 20642 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 20643 className: dist_clsx('edit-site-global-styles__color-indicator-wrapper', className), 20644 ...props 20645 }); 20646 } 20647 /* harmony default export */ const color_indicator_wrapper = (ColorIndicatorWrapper); 20648 20649 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js 20650 /* wp:polyfill */ 20651 /** 20652 * WordPress dependencies 20653 */ 20654 20655 20656 20657 20658 20659 20660 /** 20661 * Internal dependencies 20662 */ 20663 20664 20665 20666 20667 20668 20669 const { 20670 useGlobalSetting: palette_useGlobalSetting 20671 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20672 const EMPTY_COLORS = []; 20673 function Palette({ 20674 name 20675 }) { 20676 const [customColors] = palette_useGlobalSetting('color.palette.custom'); 20677 const [themeColors] = palette_useGlobalSetting('color.palette.theme'); 20678 const [defaultColors] = palette_useGlobalSetting('color.palette.default'); 20679 const [defaultPaletteEnabled] = palette_useGlobalSetting('color.defaultPalette', name); 20680 const [randomizeThemeColors] = useColorRandomizer(); 20681 const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]); 20682 const screenPath = !name ? '/colors/palette' : '/blocks/' + encodeURIComponent(name) + '/colors/palette'; 20683 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20684 spacing: 3, 20685 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20686 level: 3, 20687 children: (0,external_wp_i18n_namespaceObject.__)('Palette') 20688 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 20689 isBordered: true, 20690 isSeparated: true, 20691 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 20692 path: screenPath, 20693 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20694 direction: "row", 20695 children: [colors.length > 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20696 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { 20697 isLayered: false, 20698 offset: -8, 20699 children: colors.slice(0, 5).map(({ 20700 color 20701 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator_wrapper, { 20702 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { 20703 colorValue: color 20704 }) 20705 }, `$color}-$index}`)) 20706 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20707 isBlock: true, 20708 children: (0,external_wp_i18n_namespaceObject.__)('Edit palette') 20709 })] 20710 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20711 children: (0,external_wp_i18n_namespaceObject.__)('Add colors') 20712 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 20713 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 20714 })] 20715 }) 20716 }) 20717 }), window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20718 __next40pxDefaultSize: true, 20719 variant: "secondary", 20720 icon: library_shuffle, 20721 onClick: randomizeThemeColors, 20722 children: (0,external_wp_i18n_namespaceObject.__)('Randomize colors') 20723 })] 20724 }); 20725 } 20726 /* harmony default export */ const palette = (Palette); 20727 20728 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js 20729 /** 20730 * WordPress dependencies 20731 */ 20732 20733 20734 20735 20736 /** 20737 * Internal dependencies 20738 */ 20739 20740 20741 20742 20743 const { 20744 useGlobalStyle: screen_colors_useGlobalStyle, 20745 useGlobalSetting: screen_colors_useGlobalSetting, 20746 useSettingsForBlockElement: screen_colors_useSettingsForBlockElement, 20747 ColorPanel: screen_colors_StylesColorPanel 20748 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20749 function ScreenColors() { 20750 const [style] = screen_colors_useGlobalStyle('', undefined, 'user', { 20751 shouldDecodeEncode: false 20752 }); 20753 const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle('', undefined, 'all', { 20754 shouldDecodeEncode: false 20755 }); 20756 const [rawSettings] = screen_colors_useGlobalSetting(''); 20757 const settings = screen_colors_useSettingsForBlockElement(rawSettings); 20758 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20759 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20760 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 20761 description: (0,external_wp_i18n_namespaceObject.__)('Palette colors and the application of those colors on site elements.') 20762 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20763 className: "edit-site-global-styles-screen", 20764 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20765 spacing: 7, 20766 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(palette, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_StylesColorPanel, { 20767 inheritedValue: inheritedStyle, 20768 value: style, 20769 onChange: setStyle, 20770 settings: settings 20771 })] 20772 }) 20773 })] 20774 }); 20775 } 20776 /* harmony default export */ const screen_colors = (ScreenColors); 20777 20778 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js 20779 /* wp:polyfill */ 20780 /** 20781 * Internal dependencies 20782 */ 20783 20784 20785 function PresetColors() { 20786 const { 20787 paletteColors 20788 } = useStylesPreviewColors(); 20789 return paletteColors.slice(0, 4).map(({ 20790 slug, 20791 color 20792 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20793 style: { 20794 flexGrow: 1, 20795 height: '100%', 20796 background: color 20797 } 20798 }, `$slug}-$index}`)); 20799 } 20800 20801 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js 20802 /** 20803 * WordPress dependencies 20804 */ 20805 20806 20807 /** 20808 * Internal dependencies 20809 */ 20810 20811 20812 20813 const preview_colors_firstFrameVariants = { 20814 start: { 20815 scale: 1, 20816 opacity: 1 20817 }, 20818 hover: { 20819 scale: 0, 20820 opacity: 0 20821 } 20822 }; 20823 const StylesPreviewColors = ({ 20824 label, 20825 isFocused, 20826 withHoverView 20827 }) => { 20828 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewWrapper, { 20829 label: label, 20830 isFocused: isFocused, 20831 withHoverView: withHoverView, 20832 children: ({ 20833 key 20834 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 20835 variants: preview_colors_firstFrameVariants, 20836 style: { 20837 height: '100%', 20838 overflow: 'hidden' 20839 }, 20840 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 20841 spacing: 0, 20842 justify: "center", 20843 style: { 20844 height: '100%', 20845 overflow: 'hidden' 20846 }, 20847 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {}) 20848 }) 20849 }, key) 20850 }); 20851 }; 20852 /* harmony default export */ const preview_colors = (StylesPreviewColors); 20853 20854 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js 20855 /* wp:polyfill */ 20856 /** 20857 * WordPress dependencies 20858 */ 20859 20860 20861 /** 20862 * Internal dependencies 20863 */ 20864 20865 20866 20867 20868 20869 function ColorVariations({ 20870 title, 20871 gap = 2 20872 }) { 20873 const propertiesToFilter = ['color']; 20874 const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 20875 20876 // Return null if there is only one variation (the default). 20877 if (colorVariations?.length <= 1) { 20878 return null; 20879 } 20880 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20881 spacing: 3, 20882 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20883 level: 3, 20884 children: title 20885 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 20886 spacing: gap, 20887 children: colorVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 20888 variation: variation, 20889 isPill: true, 20890 properties: propertiesToFilter, 20891 showTooltip: true, 20892 children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors, {}) 20893 }, index)) 20894 })] 20895 }); 20896 } 20897 20898 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js 20899 /** 20900 * WordPress dependencies 20901 */ 20902 20903 20904 20905 20906 20907 /** 20908 * Internal dependencies 20909 */ 20910 20911 20912 20913 const { 20914 useGlobalSetting: color_palette_panel_useGlobalSetting 20915 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20916 const mobilePopoverProps = { 20917 placement: 'bottom-start', 20918 offset: 8 20919 }; 20920 function ColorPalettePanel({ 20921 name 20922 }) { 20923 const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name); 20924 const [baseThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name, 'base'); 20925 const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name); 20926 const [baseDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name, 'base'); 20927 const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting('color.palette.custom', name); 20928 const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting('color.defaultPalette', name); 20929 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 20930 const popoverProps = isMobileViewport ? mobilePopoverProps : undefined; 20931 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20932 className: "edit-site-global-styles-color-palette-panel", 20933 spacing: 8, 20934 children: [!!themeColors && !!themeColors.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20935 canReset: themeColors !== baseThemeColors, 20936 canOnlyChangeValues: true, 20937 colors: themeColors, 20938 onChange: setThemeColors, 20939 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), 20940 paletteLabelHeadingLevel: 3, 20941 popoverProps: popoverProps 20942 }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20943 canReset: defaultColors !== baseDefaultColors, 20944 canOnlyChangeValues: true, 20945 colors: defaultColors, 20946 onChange: setDefaultColors, 20947 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), 20948 paletteLabelHeadingLevel: 3, 20949 popoverProps: popoverProps 20950 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20951 colors: customColors, 20952 onChange: setCustomColors, 20953 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 20954 paletteLabelHeadingLevel: 3, 20955 slugPrefix: "custom-", 20956 popoverProps: popoverProps 20957 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { 20958 title: (0,external_wp_i18n_namespaceObject.__)('Palettes') 20959 })] 20960 }); 20961 } 20962 20963 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js 20964 /** 20965 * WordPress dependencies 20966 */ 20967 20968 20969 20970 20971 20972 /** 20973 * Internal dependencies 20974 */ 20975 20976 20977 20978 const { 20979 useGlobalSetting: gradients_palette_panel_useGlobalSetting 20980 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20981 const gradients_palette_panel_mobilePopoverProps = { 20982 placement: 'bottom-start', 20983 offset: 8 20984 }; 20985 const noop = () => {}; 20986 function GradientPalettePanel({ 20987 name 20988 }) { 20989 const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name); 20990 const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name, 'base'); 20991 const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name); 20992 const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name, 'base'); 20993 const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.custom', name); 20994 const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultGradients', name); 20995 const [customDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.custom') || []; 20996 const [defaultDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.default') || []; 20997 const [themeDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.theme') || []; 20998 const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultDuotone'); 20999 const duotonePalette = [...(customDuotone || []), ...(themeDuotone || []), ...(defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [])]; 21000 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 21001 const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : undefined; 21002 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21003 className: "edit-site-global-styles-gradient-palette-panel", 21004 spacing: 8, 21005 children: [!!themeGradients && !!themeGradients.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 21006 canReset: themeGradients !== baseThemeGradients, 21007 canOnlyChangeValues: true, 21008 gradients: themeGradients, 21009 onChange: setThemeGradients, 21010 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), 21011 paletteLabelHeadingLevel: 3, 21012 popoverProps: popoverProps 21013 }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 21014 canReset: defaultGradients !== baseDefaultGradients, 21015 canOnlyChangeValues: true, 21016 gradients: defaultGradients, 21017 onChange: setDefaultGradients, 21018 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), 21019 paletteLabelLevel: 3, 21020 popoverProps: popoverProps 21021 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 21022 gradients: customGradients, 21023 onChange: setCustomGradients, 21024 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 21025 paletteLabelLevel: 3, 21026 slugPrefix: "custom-", 21027 popoverProps: popoverProps 21028 }), !!duotonePalette && !!duotonePalette.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21029 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21030 level: 3, 21031 children: (0,external_wp_i18n_namespaceObject.__)('Duotone') 21032 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21033 margin: 3 21034 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { 21035 duotonePalette: duotonePalette, 21036 disableCustomDuotone: true, 21037 disableCustomColors: true, 21038 clearable: false, 21039 onChange: noop 21040 })] 21041 })] 21042 }); 21043 } 21044 21045 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js 21046 /** 21047 * WordPress dependencies 21048 */ 21049 21050 21051 21052 /** 21053 * Internal dependencies 21054 */ 21055 21056 21057 21058 21059 21060 const { 21061 Tabs: screen_color_palette_Tabs 21062 } = unlock(external_wp_components_namespaceObject.privateApis); 21063 function ScreenColorPalette({ 21064 name 21065 }) { 21066 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21067 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21068 title: (0,external_wp_i18n_namespaceObject.__)('Edit palette'), 21069 description: (0,external_wp_i18n_namespaceObject.__)('The combination of colors used across the site and in color pickers.') 21070 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { 21071 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { 21072 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { 21073 tabId: "color", 21074 children: (0,external_wp_i18n_namespaceObject.__)('Color') 21075 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { 21076 tabId: "gradient", 21077 children: (0,external_wp_i18n_namespaceObject.__)('Gradient') 21078 })] 21079 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { 21080 tabId: "color", 21081 focusable: false, 21082 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { 21083 name: name 21084 }) 21085 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { 21086 tabId: "gradient", 21087 focusable: false, 21088 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { 21089 name: name 21090 }) 21091 })] 21092 })] 21093 }); 21094 } 21095 /* harmony default export */ const screen_color_palette = (ScreenColorPalette); 21096 21097 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js 21098 /** 21099 * WordPress dependencies 21100 */ 21101 21102 21103 /** 21104 * Internal dependencies 21105 */ 21106 21107 21108 // Initial control values where no block style is set. 21109 21110 const BACKGROUND_DEFAULT_VALUES = { 21111 backgroundSize: 'auto' 21112 }; 21113 const { 21114 useGlobalStyle: background_panel_useGlobalStyle, 21115 useGlobalSetting: background_panel_useGlobalSetting, 21116 BackgroundPanel: background_panel_StylesBackgroundPanel 21117 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21118 21119 /** 21120 * Checks if there is a current value in the background image block support 21121 * attributes. 21122 * 21123 * @param {Object} style Style attribute. 21124 * @return {boolean} Whether the block has a background image value set. 21125 */ 21126 function hasBackgroundImageValue(style) { 21127 return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === 'string'; 21128 } 21129 function BackgroundPanel() { 21130 const [style] = background_panel_useGlobalStyle('', undefined, 'user', { 21131 shouldDecodeEncode: false 21132 }); 21133 const [inheritedStyle, setStyle] = background_panel_useGlobalStyle('', undefined, 'all', { 21134 shouldDecodeEncode: false 21135 }); 21136 const [settings] = background_panel_useGlobalSetting(''); 21137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(background_panel_StylesBackgroundPanel, { 21138 inheritedValue: inheritedStyle, 21139 value: style, 21140 onChange: setStyle, 21141 settings: settings, 21142 defaultValues: BACKGROUND_DEFAULT_VALUES 21143 }); 21144 } 21145 21146 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js 21147 /** 21148 * WordPress dependencies 21149 */ 21150 21151 21152 21153 21154 /** 21155 * Internal dependencies 21156 */ 21157 21158 21159 21160 21161 const { 21162 useHasBackgroundPanel: screen_background_useHasBackgroundPanel, 21163 useGlobalSetting: screen_background_useGlobalSetting 21164 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21165 function ScreenBackground() { 21166 const [settings] = screen_background_useGlobalSetting(''); 21167 const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings); 21168 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21169 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21170 title: (0,external_wp_i18n_namespaceObject.__)('Background'), 21171 description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 21172 children: (0,external_wp_i18n_namespaceObject.__)('Set styles for the site’s background.') 21173 }) 21174 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {})] 21175 }); 21176 } 21177 /* harmony default export */ const screen_background = (ScreenBackground); 21178 21179 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/confirm-reset-shadow-dialog.js 21180 /** 21181 * WordPress dependencies 21182 */ 21183 21184 21185 21186 function ConfirmResetShadowDialog({ 21187 text, 21188 confirmButtonText, 21189 isOpen, 21190 toggleOpen, 21191 onConfirm 21192 }) { 21193 const handleConfirm = async () => { 21194 toggleOpen(); 21195 onConfirm(); 21196 }; 21197 const handleCancel = () => { 21198 toggleOpen(); 21199 }; 21200 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 21201 isOpen: isOpen, 21202 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 21203 confirmButtonText: confirmButtonText, 21204 onCancel: handleCancel, 21205 onConfirm: handleConfirm, 21206 size: "medium", 21207 children: text 21208 }); 21209 } 21210 /* harmony default export */ const confirm_reset_shadow_dialog = (ConfirmResetShadowDialog); 21211 21212 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js 21213 /* wp:polyfill */ 21214 /** 21215 * WordPress dependencies 21216 */ 21217 21218 21219 21220 21221 21222 /** 21223 * Internal dependencies 21224 */ 21225 21226 21227 21228 21229 21230 21231 21232 21233 const { 21234 useGlobalSetting: shadows_panel_useGlobalSetting 21235 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21236 const { 21237 Menu: shadows_panel_Menu 21238 } = unlock(external_wp_components_namespaceObject.privateApis); 21239 const defaultShadow = '6px 6px 9px rgba(0, 0, 0, 0.2)'; 21240 function ShadowsPanel() { 21241 const [defaultShadows] = shadows_panel_useGlobalSetting('shadow.presets.default'); 21242 const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting('shadow.defaultPresets'); 21243 const [themeShadows] = shadows_panel_useGlobalSetting('shadow.presets.theme'); 21244 const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting('shadow.presets.custom'); 21245 const onCreateShadow = shadow => { 21246 setCustomShadows([...(customShadows || []), shadow]); 21247 }; 21248 const handleResetShadows = () => { 21249 setCustomShadows([]); 21250 }; 21251 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 21252 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); 21253 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21254 children: [isResetDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_reset_shadow_dialog, { 21255 text: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to remove all custom shadows?'), 21256 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Remove'), 21257 isOpen: isResetDialogOpen, 21258 toggleOpen: toggleResetDialog, 21259 onConfirm: handleResetShadows 21260 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21261 title: (0,external_wp_i18n_namespaceObject.__)('Shadows'), 21262 description: (0,external_wp_i18n_namespaceObject.__)('Manage and create shadow styles for use across the site.') 21263 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21264 className: "edit-site-global-styles-screen", 21265 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21266 className: "edit-site-global-styles__shadows-panel", 21267 spacing: 7, 21268 children: [defaultShadowsEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21269 label: (0,external_wp_i18n_namespaceObject.__)('Default'), 21270 shadows: defaultShadows || [], 21271 category: "default" 21272 }), themeShadows && themeShadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21273 label: (0,external_wp_i18n_namespaceObject.__)('Theme'), 21274 shadows: themeShadows || [], 21275 category: "theme" 21276 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21277 label: (0,external_wp_i18n_namespaceObject.__)('Custom'), 21278 shadows: customShadows || [], 21279 category: "custom", 21280 canCreate: true, 21281 onCreate: onCreateShadow, 21282 onReset: toggleResetDialog 21283 })] 21284 }) 21285 })] 21286 }); 21287 } 21288 function ShadowList({ 21289 label, 21290 shadows, 21291 category, 21292 canCreate, 21293 onCreate, 21294 onReset 21295 }) { 21296 const handleAddShadow = () => { 21297 const newIndex = getNewIndexFromPresets(shadows, 'shadow-'); 21298 onCreate({ 21299 name: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: is an index for a preset */ 21300 (0,external_wp_i18n_namespaceObject.__)('Shadow %s'), newIndex), 21301 shadow: defaultShadow, 21302 slug: `shadow-$newIndex}` 21303 }); 21304 }; 21305 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21306 spacing: 2, 21307 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21308 justify: "space-between", 21309 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 21310 align: "center", 21311 className: "edit-site-global-styles__shadows-panel__title", 21312 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21313 level: 3, 21314 children: label 21315 }) 21316 }), canCreate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21317 className: "edit-site-global-styles__shadows-panel__options-container", 21318 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21319 size: "small", 21320 icon: library_plus, 21321 label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), 21322 onClick: () => { 21323 handleAddShadow(); 21324 } 21325 }) 21326 }), !!shadows?.length && category === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_panel_Menu, { 21327 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.TriggerButton, { 21328 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21329 size: "small", 21330 icon: more_vertical, 21331 label: (0,external_wp_i18n_namespaceObject.__)('Shadow options') 21332 }) 21333 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Popover, { 21334 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Item, { 21335 onClick: onReset, 21336 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.ItemLabel, { 21337 children: (0,external_wp_i18n_namespaceObject.__)('Remove all custom shadows') 21338 }) 21339 }) 21340 })] 21341 })] 21342 }), shadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 21343 isBordered: true, 21344 isSeparated: true, 21345 children: shadows.map(shadow => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowItem, { 21346 shadow: shadow, 21347 category: category 21348 }, shadow.slug)) 21349 })] 21350 }); 21351 } 21352 function ShadowItem({ 21353 shadow, 21354 category 21355 }) { 21356 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 21357 path: `/shadows/edit/$category}/$shadow.slug}`, 21358 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21359 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21360 children: shadow.name 21361 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 21362 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 21363 })] 21364 }) 21365 }); 21366 } 21367 21368 ;// ./node_modules/@wordpress/icons/build-module/library/reset.js 21369 /** 21370 * WordPress dependencies 21371 */ 21372 21373 21374 const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 21375 xmlns: "http://www.w3.org/2000/svg", 21376 viewBox: "0 0 24 24", 21377 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 21378 d: "M7 11.5h10V13H7z" 21379 }) 21380 }); 21381 /* harmony default export */ const library_reset = (reset_reset); 21382 21383 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js 21384 /* wp:polyfill */ 21385 const CUSTOM_VALUE_SETTINGS = { 21386 px: { 21387 max: 20, 21388 step: 1 21389 }, 21390 '%': { 21391 max: 100, 21392 step: 1 21393 }, 21394 vw: { 21395 max: 100, 21396 step: 1 21397 }, 21398 vh: { 21399 max: 100, 21400 step: 1 21401 }, 21402 em: { 21403 max: 10, 21404 step: 0.1 21405 }, 21406 rm: { 21407 max: 10, 21408 step: 0.1 21409 }, 21410 svw: { 21411 max: 100, 21412 step: 1 21413 }, 21414 lvw: { 21415 max: 100, 21416 step: 1 21417 }, 21418 dvw: { 21419 max: 100, 21420 step: 1 21421 }, 21422 svh: { 21423 max: 100, 21424 step: 1 21425 }, 21426 lvh: { 21427 max: 100, 21428 step: 1 21429 }, 21430 dvh: { 21431 max: 100, 21432 step: 1 21433 }, 21434 vi: { 21435 max: 100, 21436 step: 1 21437 }, 21438 svi: { 21439 max: 100, 21440 step: 1 21441 }, 21442 lvi: { 21443 max: 100, 21444 step: 1 21445 }, 21446 dvi: { 21447 max: 100, 21448 step: 1 21449 }, 21450 vb: { 21451 max: 100, 21452 step: 1 21453 }, 21454 svb: { 21455 max: 100, 21456 step: 1 21457 }, 21458 lvb: { 21459 max: 100, 21460 step: 1 21461 }, 21462 dvb: { 21463 max: 100, 21464 step: 1 21465 }, 21466 vmin: { 21467 max: 100, 21468 step: 1 21469 }, 21470 svmin: { 21471 max: 100, 21472 step: 1 21473 }, 21474 lvmin: { 21475 max: 100, 21476 step: 1 21477 }, 21478 dvmin: { 21479 max: 100, 21480 step: 1 21481 }, 21482 vmax: { 21483 max: 100, 21484 step: 1 21485 }, 21486 svmax: { 21487 max: 100, 21488 step: 1 21489 }, 21490 lvmax: { 21491 max: 100, 21492 step: 1 21493 }, 21494 dvmax: { 21495 max: 100, 21496 step: 1 21497 } 21498 }; 21499 function getShadowParts(shadow) { 21500 const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || []; 21501 return shadowValues.map(value => value.trim()); 21502 } 21503 function shadowStringToObject(shadowValue) { 21504 /* 21505 * Shadow spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow 21506 * Shadow string format: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> [inset] 21507 * 21508 * A shadow to be valid it must satisfy the following. 21509 * 21510 * 1. Should not contain "none" keyword. 21511 * 2. Values x, y, blur, spread should be in the order. Color and inset can be anywhere in the string except in between x, y, blur, spread values. 21512 * 3. Should not contain more than one set of x, y, blur, spread values. 21513 * 4. Should contain at least x and y values. Others are optional. 21514 * 5. Should not contain more than one "inset" (case insensitive) keyword. 21515 * 6. Should not contain more than one color value. 21516 */ 21517 21518 const defaultShadow = { 21519 x: '0', 21520 y: '0', 21521 blur: '0', 21522 spread: '0', 21523 color: '#000', 21524 inset: false 21525 }; 21526 if (!shadowValue) { 21527 return defaultShadow; 21528 } 21529 21530 // Rule 1: Should not contain "none" keyword. 21531 // if the shadow has "none" keyword, it is not a valid shadow string 21532 if (shadowValue.includes('none')) { 21533 return defaultShadow; 21534 } 21535 21536 // Rule 2: Values x, y, blur, spread should be in the order. 21537 // Color and inset can be anywhere in the string except in between x, y, blur, spread values. 21538 // Extract length values (x, y, blur, spread) from shadow string 21539 // Regex match groups of 1 to 4 length values. 21540 const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g; 21541 const matches = shadowValue.match(lengthsRegex) || []; 21542 21543 // Rule 3: Should not contain more than one set of x, y, blur, spread values. 21544 // if the string doesn't contain exactly 1 set of x, y, blur, spread values, 21545 // it is not a valid shadow string 21546 if (matches.length !== 1) { 21547 return defaultShadow; 21548 } 21549 21550 // Extract length values (x, y, blur, spread) from shadow string 21551 const lengths = matches[0].split(' ').map(value => value.trim()).filter(value => value); 21552 21553 // Rule 4: Should contain at least x and y values. Others are optional. 21554 if (lengths.length < 2) { 21555 return defaultShadow; 21556 } 21557 21558 // Rule 5: Should not contain more than one "inset" (case insensitive) keyword. 21559 // check if the shadow string contains "inset" keyword 21560 const insets = shadowValue.match(/inset/gi) || []; 21561 if (insets.length > 1) { 21562 return defaultShadow; 21563 } 21564 21565 // Strip lengths and inset from shadow string, leaving just color. 21566 const hasInset = insets.length === 1; 21567 let colorString = shadowValue.replace(lengthsRegex, '').trim(); 21568 if (hasInset) { 21569 colorString = colorString.replace('inset', '').replace('INSET', '').trim(); 21570 } 21571 21572 // Rule 6: Should not contain more than one color value. 21573 // validate color string with regular expression 21574 // check if color has matching hex, rgb or hsl values 21575 const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi; 21576 let colorMatches = (colorString.match(colorRegex) || []).map(value => value?.trim()).filter(value => value); 21577 21578 // If color string has more than one color values, it is not a valid 21579 if (colorMatches.length > 1) { 21580 return defaultShadow; 21581 } else if (colorMatches.length === 0) { 21582 // check if color string has multiple named color values separated by space 21583 colorMatches = colorString.trim().split(' ').filter(value => value); 21584 // If color string has more than one color values, it is not a valid 21585 if (colorMatches.length > 1) { 21586 return defaultShadow; 21587 } 21588 } 21589 21590 // Return parsed shadow object. 21591 const [x, y, blur, spread] = lengths; 21592 return { 21593 x, 21594 y, 21595 blur: blur || defaultShadow.blur, 21596 spread: spread || defaultShadow.spread, 21597 inset: hasInset, 21598 color: colorString || defaultShadow.color 21599 }; 21600 } 21601 function shadowObjectToString(shadowObj) { 21602 const shadowString = `$shadowObj.x || '0px'} $shadowObj.y || '0px'} $shadowObj.blur || '0px'} $shadowObj.spread || '0px'}`; 21603 return `$shadowObj.inset ? 'inset' : ''} $shadowString} $shadowObj.color || ''}`.trim(); 21604 } 21605 21606 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js 21607 /* wp:polyfill */ 21608 /** 21609 * External dependencies 21610 */ 21611 21612 21613 /** 21614 * WordPress dependencies 21615 */ 21616 21617 21618 21619 21620 21621 21622 /** 21623 * Internal dependencies 21624 */ 21625 21626 21627 21628 21629 21630 21631 const { 21632 useGlobalSetting: shadows_edit_panel_useGlobalSetting 21633 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21634 const { 21635 Menu: shadows_edit_panel_Menu 21636 } = unlock(external_wp_components_namespaceObject.privateApis); 21637 const customShadowMenuItems = [{ 21638 label: (0,external_wp_i18n_namespaceObject.__)('Rename'), 21639 action: 'rename' 21640 }, { 21641 label: (0,external_wp_i18n_namespaceObject.__)('Delete'), 21642 action: 'delete' 21643 }]; 21644 const presetShadowMenuItems = [{ 21645 label: (0,external_wp_i18n_namespaceObject.__)('Reset'), 21646 action: 'reset' 21647 }]; 21648 function ShadowsEditPanel() { 21649 const { 21650 goBack, 21651 params: { 21652 category, 21653 slug 21654 } 21655 } = (0,external_wp_components_namespaceObject.useNavigator)(); 21656 const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.$category}`); 21657 (0,external_wp_element_namespaceObject.useEffect)(() => { 21658 const hasCurrentShadow = shadows?.some(shadow => shadow.slug === slug); 21659 // If the shadow being edited doesn't exist anymore in the global styles setting, navigate back 21660 // to prevent the user from editing a non-existent shadow entry. 21661 // This can happen, for example: 21662 // - when the user deletes the shadow 21663 // - when the user resets the styles while editing a custom shadow 21664 // 21665 // The check on the slug is necessary to prevent a double back navigation when the user triggers 21666 // a backward navigation by interacting with the screen's UI. 21667 if (!!slug && !hasCurrentShadow) { 21668 goBack(); 21669 } 21670 }, [shadows, slug, goBack]); 21671 const [baseShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.$category}`, undefined, 'base'); 21672 const [selectedShadow, setSelectedShadow] = (0,external_wp_element_namespaceObject.useState)(() => (shadows || []).find(shadow => shadow.slug === slug)); 21673 const baseSelectedShadow = (0,external_wp_element_namespaceObject.useMemo)(() => (baseShadows || []).find(b => b.slug === slug), [baseShadows, slug]); 21674 const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_namespaceObject.useState)(false); 21675 const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); 21676 const [shadowName, setShadowName] = (0,external_wp_element_namespaceObject.useState)(selectedShadow.name); 21677 if (!category || !slug) { 21678 return null; 21679 } 21680 const onShadowChange = shadow => { 21681 setSelectedShadow({ 21682 ...selectedShadow, 21683 shadow 21684 }); 21685 const updatedShadows = shadows.map(s => s.slug === slug ? { 21686 ...selectedShadow, 21687 shadow 21688 } : s); 21689 setShadows(updatedShadows); 21690 }; 21691 const onMenuClick = action => { 21692 if (action === 'reset') { 21693 const updatedShadows = shadows.map(s => s.slug === slug ? baseSelectedShadow : s); 21694 setSelectedShadow(baseSelectedShadow); 21695 setShadows(updatedShadows); 21696 } else if (action === 'delete') { 21697 setIsConfirmDialogVisible(true); 21698 } else if (action === 'rename') { 21699 setIsRenameModalVisible(true); 21700 } 21701 }; 21702 const handleShadowDelete = () => { 21703 setShadows(shadows.filter(s => s.slug !== slug)); 21704 }; 21705 const handleShadowRename = newName => { 21706 if (!newName) { 21707 return; 21708 } 21709 const updatedShadows = shadows.map(s => s.slug === slug ? { 21710 ...selectedShadow, 21711 name: newName 21712 } : s); 21713 setSelectedShadow({ 21714 ...selectedShadow, 21715 name: newName 21716 }); 21717 setShadows(updatedShadows); 21718 }; 21719 return !selectedShadow ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21720 title: "" 21721 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21722 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21723 justify: "space-between", 21724 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21725 title: selectedShadow.name 21726 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21727 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21728 marginTop: 2, 21729 marginBottom: 0, 21730 paddingX: 4, 21731 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_edit_panel_Menu, { 21732 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.TriggerButton, { 21733 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21734 size: "small", 21735 icon: more_vertical, 21736 label: (0,external_wp_i18n_namespaceObject.__)('Menu') 21737 }) 21738 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Popover, { 21739 children: (category === 'custom' ? customShadowMenuItems : presetShadowMenuItems).map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Item, { 21740 onClick: () => onMenuClick(item.action), 21741 disabled: item.action === 'reset' && selectedShadow.shadow === baseSelectedShadow.shadow, 21742 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.ItemLabel, { 21743 children: item.label 21744 }) 21745 }, item.action)) 21746 })] 21747 }) 21748 }) 21749 })] 21750 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21751 className: "edit-site-global-styles-screen", 21752 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { 21753 shadow: selectedShadow.shadow 21754 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowEditor, { 21755 shadow: selectedShadow.shadow, 21756 onChange: onShadowChange 21757 })] 21758 }), isConfirmDialogVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 21759 isOpen: true, 21760 onConfirm: () => { 21761 handleShadowDelete(); 21762 setIsConfirmDialogVisible(false); 21763 }, 21764 onCancel: () => { 21765 setIsConfirmDialogVisible(false); 21766 }, 21767 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 21768 size: "medium", 21769 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the shadow preset. */ 21770 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" shadow preset?'), selectedShadow.name) 21771 }), isRenameModalVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 21772 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 21773 onRequestClose: () => setIsRenameModalVisible(false), 21774 size: "small", 21775 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { 21776 onSubmit: event => { 21777 event.preventDefault(); 21778 handleShadowRename(shadowName); 21779 setIsRenameModalVisible(false); 21780 }, 21781 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 21782 __next40pxDefaultSize: true, 21783 autoComplete: "off", 21784 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 21785 placeholder: (0,external_wp_i18n_namespaceObject.__)('Shadow name'), 21786 value: shadowName, 21787 onChange: value => setShadowName(value) 21788 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21789 marginBottom: 6 21790 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 21791 className: "block-editor-shadow-edit-modal__actions", 21792 justify: "flex-end", 21793 expanded: false, 21794 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21795 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21796 __next40pxDefaultSize: true, 21797 variant: "tertiary", 21798 onClick: () => setIsRenameModalVisible(false), 21799 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 21800 }) 21801 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21802 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21803 __next40pxDefaultSize: true, 21804 variant: "primary", 21805 type: "submit", 21806 children: (0,external_wp_i18n_namespaceObject.__)('Save') 21807 }) 21808 })] 21809 })] 21810 }) 21811 })] 21812 }); 21813 } 21814 function ShadowsPreview({ 21815 shadow 21816 }) { 21817 const shadowStyle = { 21818 boxShadow: shadow 21819 }; 21820 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21821 marginBottom: 4, 21822 marginTop: -2, 21823 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 21824 align: "center", 21825 justify: "center", 21826 className: "edit-site-global-styles__shadow-preview-panel", 21827 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21828 className: "edit-site-global-styles__shadow-preview-block", 21829 style: shadowStyle 21830 }) 21831 }) 21832 }); 21833 } 21834 function ShadowEditor({ 21835 shadow, 21836 onChange 21837 }) { 21838 const addShadowButtonRef = (0,external_wp_element_namespaceObject.useRef)(); 21839 const shadowParts = (0,external_wp_element_namespaceObject.useMemo)(() => getShadowParts(shadow), [shadow]); 21840 const onChangeShadowPart = (index, part) => { 21841 const newShadowParts = [...shadowParts]; 21842 newShadowParts[index] = part; 21843 onChange(newShadowParts.join(', ')); 21844 }; 21845 const onAddShadowPart = () => { 21846 onChange([...shadowParts, defaultShadow].join(', ')); 21847 }; 21848 const onRemoveShadowPart = index => { 21849 onChange(shadowParts.filter((p, i) => i !== index).join(', ')); 21850 addShadowButtonRef.current.focus(); 21851 }; 21852 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21853 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 21854 spacing: 2, 21855 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21856 justify: "space-between", 21857 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 21858 align: "center", 21859 className: "edit-site-global-styles__shadows-panel__title", 21860 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21861 level: 3, 21862 children: (0,external_wp_i18n_namespaceObject.__)('Shadows') 21863 }) 21864 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21865 className: "edit-site-global-styles__shadows-panel__options-container", 21866 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21867 size: "small", 21868 icon: library_plus, 21869 label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), 21870 onClick: () => { 21871 onAddShadowPart(); 21872 }, 21873 ref: addShadowButtonRef 21874 }) 21875 })] 21876 }) 21877 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 21878 isBordered: true, 21879 isSeparated: true, 21880 children: shadowParts.map((part, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_ShadowItem, { 21881 shadow: part, 21882 onChange: value => onChangeShadowPart(index, value), 21883 canRemove: shadowParts.length > 1, 21884 onRemove: () => onRemoveShadowPart(index) 21885 }, index)) 21886 })] 21887 }); 21888 } 21889 function shadows_edit_panel_ShadowItem({ 21890 shadow, 21891 onChange, 21892 canRemove, 21893 onRemove 21894 }) { 21895 const popoverProps = { 21896 placement: 'left-start', 21897 offset: 36, 21898 shift: true 21899 }; 21900 const shadowObj = (0,external_wp_element_namespaceObject.useMemo)(() => shadowStringToObject(shadow), [shadow]); 21901 const onShadowChange = newShadow => { 21902 onChange(shadowObjectToString(newShadow)); 21903 }; 21904 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 21905 popoverProps: popoverProps, 21906 className: "edit-site-global-styles__shadow-editor__dropdown", 21907 renderToggle: ({ 21908 onToggle, 21909 isOpen 21910 }) => { 21911 const toggleProps = { 21912 onClick: onToggle, 21913 className: dist_clsx('edit-site-global-styles__shadow-editor__dropdown-toggle', { 21914 'is-open': isOpen 21915 }), 21916 'aria-expanded': isOpen 21917 }; 21918 const removeButtonProps = { 21919 onClick: () => { 21920 if (isOpen) { 21921 onToggle(); 21922 } 21923 onRemove(); 21924 }, 21925 className: dist_clsx('edit-site-global-styles__shadow-editor__remove-button', { 21926 'is-open': isOpen 21927 }), 21928 label: (0,external_wp_i18n_namespaceObject.__)('Remove shadow') 21929 }; 21930 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21931 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21932 __next40pxDefaultSize: true, 21933 icon: library_shadow, 21934 ...toggleProps, 21935 children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)('Inner shadow') : (0,external_wp_i18n_namespaceObject.__)('Drop shadow') 21936 }), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21937 size: "small", 21938 icon: library_reset, 21939 ...removeButtonProps 21940 })] 21941 }); 21942 }, 21943 renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { 21944 paddingSize: "medium", 21945 className: "edit-site-global-styles__shadow-editor__dropdown-content", 21946 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopover, { 21947 shadowObj: shadowObj, 21948 onChange: onShadowChange 21949 }) 21950 }) 21951 }); 21952 } 21953 function ShadowPopover({ 21954 shadowObj, 21955 onChange 21956 }) { 21957 const __experimentalIsRenderedInSidebar = true; 21958 const enableAlpha = true; 21959 const onShadowChange = (key, value) => { 21960 const newShadow = { 21961 ...shadowObj, 21962 [key]: value 21963 }; 21964 onChange(newShadow); 21965 }; 21966 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21967 spacing: 4, 21968 className: "edit-site-global-styles__shadow-editor-panel", 21969 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorPalette, { 21970 clearable: false, 21971 enableAlpha: enableAlpha, 21972 __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, 21973 value: shadowObj.color, 21974 onChange: value => onShadowChange('color', value) 21975 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 21976 __nextHasNoMarginBottom: true, 21977 value: shadowObj.inset ? 'inset' : 'outset', 21978 isBlock: true, 21979 onChange: value => onShadowChange('inset', value === 'inset'), 21980 hideLabelFromVision: true, 21981 __next40pxDefaultSize: true, 21982 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 21983 value: "outset", 21984 label: (0,external_wp_i18n_namespaceObject.__)('Outset') 21985 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 21986 value: "inset", 21987 label: (0,external_wp_i18n_namespaceObject.__)('Inset') 21988 })] 21989 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 21990 columns: 2, 21991 gap: 4, 21992 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 21993 label: (0,external_wp_i18n_namespaceObject.__)('X Position'), 21994 value: shadowObj.x, 21995 onChange: value => onShadowChange('x', value) 21996 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 21997 label: (0,external_wp_i18n_namespaceObject.__)('Y Position'), 21998 value: shadowObj.y, 21999 onChange: value => onShadowChange('y', value) 22000 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 22001 label: (0,external_wp_i18n_namespaceObject.__)('Blur'), 22002 value: shadowObj.blur, 22003 onChange: value => onShadowChange('blur', value) 22004 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 22005 label: (0,external_wp_i18n_namespaceObject.__)('Spread'), 22006 value: shadowObj.spread, 22007 onChange: value => onShadowChange('spread', value) 22008 })] 22009 })] 22010 }); 22011 } 22012 function ShadowInputControl({ 22013 label, 22014 value, 22015 onChange 22016 }) { 22017 const onValueChange = next => { 22018 const isNumeric = next !== undefined && !isNaN(parseFloat(next)); 22019 const nextValue = isNumeric ? next : '0px'; 22020 onChange(nextValue); 22021 }; 22022 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { 22023 label: label, 22024 __next40pxDefaultSize: true, 22025 value: value, 22026 onChange: onValueChange 22027 }); 22028 } 22029 22030 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js 22031 /** 22032 * Internal dependencies 22033 */ 22034 22035 22036 22037 function ScreenShadows() { 22038 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {}); 22039 } 22040 function ScreenShadowsEdit() { 22041 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {}); 22042 } 22043 22044 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js 22045 /** 22046 * WordPress dependencies 22047 */ 22048 22049 22050 22051 /** 22052 * Internal dependencies 22053 */ 22054 22055 22056 const { 22057 useGlobalStyle: dimensions_panel_useGlobalStyle, 22058 useGlobalSetting: dimensions_panel_useGlobalSetting, 22059 useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement, 22060 DimensionsPanel: dimensions_panel_StylesDimensionsPanel 22061 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22062 const DEFAULT_CONTROLS = { 22063 contentSize: true, 22064 wideSize: true, 22065 padding: true, 22066 margin: true, 22067 blockGap: true, 22068 minHeight: true, 22069 childLayout: false 22070 }; 22071 function DimensionsPanel() { 22072 const [style] = dimensions_panel_useGlobalStyle('', undefined, 'user', { 22073 shouldDecodeEncode: false 22074 }); 22075 const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle('', undefined, 'all', { 22076 shouldDecodeEncode: false 22077 }); 22078 const [userSettings] = dimensions_panel_useGlobalSetting('', undefined, 'user'); 22079 const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting(''); 22080 const settings = dimensions_panel_useSettingsForBlockElement(rawSettings); 22081 22082 // These intermediary objects are needed because the "layout" property is stored 22083 // in settings rather than styles. 22084 const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 22085 return { 22086 ...inheritedStyle, 22087 layout: settings.layout 22088 }; 22089 }, [inheritedStyle, settings.layout]); 22090 const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 22091 return { 22092 ...style, 22093 layout: userSettings.layout 22094 }; 22095 }, [style, userSettings.layout]); 22096 const onChange = newStyle => { 22097 const updatedStyle = { 22098 ...newStyle 22099 }; 22100 delete updatedStyle.layout; 22101 setStyle(updatedStyle); 22102 if (newStyle.layout !== userSettings.layout) { 22103 const updatedSettings = { 22104 ...userSettings, 22105 layout: newStyle.layout 22106 }; 22107 22108 // Ensure any changes to layout definitions are not persisted. 22109 if (updatedSettings.layout?.definitions) { 22110 delete updatedSettings.layout.definitions; 22111 } 22112 setSettings(updatedSettings); 22113 } 22114 }; 22115 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_panel_StylesDimensionsPanel, { 22116 inheritedValue: inheritedStyleWithLayout, 22117 value: styleWithLayout, 22118 onChange: onChange, 22119 settings: settings, 22120 includeLayoutControls: true, 22121 defaultControls: DEFAULT_CONTROLS 22122 }); 22123 } 22124 22125 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js 22126 /** 22127 * WordPress dependencies 22128 */ 22129 22130 22131 22132 /** 22133 * Internal dependencies 22134 */ 22135 22136 22137 22138 22139 const { 22140 useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, 22141 useGlobalSetting: screen_layout_useGlobalSetting, 22142 useSettingsForBlockElement: screen_layout_useSettingsForBlockElement 22143 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22144 function ScreenLayout() { 22145 const [rawSettings] = screen_layout_useGlobalSetting(''); 22146 const settings = screen_layout_useSettingsForBlockElement(rawSettings); 22147 const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings); 22148 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22149 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22150 title: (0,external_wp_i18n_namespaceObject.__)('Layout') 22151 }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {})] 22152 }); 22153 } 22154 /* harmony default export */ const screen_layout = (ScreenLayout); 22155 22156 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js 22157 /* wp:polyfill */ 22158 /** 22159 * WordPress dependencies 22160 */ 22161 22162 22163 22164 22165 22166 22167 22168 /** 22169 * Internal dependencies 22170 */ 22171 22172 22173 22174 22175 22176 const { 22177 GlobalStylesContext: style_variations_container_GlobalStylesContext 22178 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22179 function StyleVariationsContainer({ 22180 gap = 2 22181 }) { 22182 const { 22183 user 22184 } = (0,external_wp_element_namespaceObject.useContext)(style_variations_container_GlobalStylesContext); 22185 const userStyles = user?.styles; 22186 const variations = (0,external_wp_data_namespaceObject.useSelect)(select => { 22187 return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); 22188 }, []); 22189 22190 // Filter out variations that are color or typography variations. 22191 const fullStyleVariations = variations?.filter(variation => { 22192 return !isVariationWithProperties(variation, ['color']) && !isVariationWithProperties(variation, ['typography', 'spacing']); 22193 }); 22194 const themeVariations = (0,external_wp_element_namespaceObject.useMemo)(() => { 22195 const withEmptyVariation = [{ 22196 title: (0,external_wp_i18n_namespaceObject.__)('Default'), 22197 settings: {}, 22198 styles: {} 22199 }, ...(fullStyleVariations !== null && fullStyleVariations !== void 0 ? fullStyleVariations : [])]; 22200 return [...withEmptyVariation.map(variation => { 22201 var _variation$settings; 22202 const blockStyles = { 22203 ...variation?.styles?.blocks 22204 } || {}; 22205 22206 // We need to copy any user custom CSS to the variation to prevent it being lost 22207 // when switching variations. 22208 if (userStyles?.blocks) { 22209 Object.keys(userStyles.blocks).forEach(blockName => { 22210 // First get any block specific custom CSS from the current user styles and merge with any custom CSS for 22211 // that block in the variation. 22212 if (userStyles.blocks[blockName].css) { 22213 const variationBlockStyles = blockStyles[blockName] || {}; 22214 const customCSS = { 22215 css: `$blockStyles[blockName]?.css || ''} $userStyles.blocks[blockName].css.trim() || ''}` 22216 }; 22217 blockStyles[blockName] = { 22218 ...variationBlockStyles, 22219 ...customCSS 22220 }; 22221 } 22222 }); 22223 } 22224 // Now merge any global custom CSS from current user styles with global custom CSS in the variation. 22225 const css = userStyles?.css || variation.styles?.css ? { 22226 css: `$variation.styles?.css || ''} $userStyles?.css || ''}` 22227 } : {}; 22228 const blocks = Object.keys(blockStyles).length > 0 ? { 22229 blocks: blockStyles 22230 } : {}; 22231 const styles = { 22232 ...variation.styles, 22233 ...css, 22234 ...blocks 22235 }; 22236 return { 22237 ...variation, 22238 settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {}, 22239 styles 22240 }; 22241 })]; 22242 }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); 22243 if (!fullStyleVariations || fullStyleVariations?.length < 1) { 22244 return null; 22245 } 22246 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 22247 columns: 2, 22248 className: "edit-site-global-styles-style-variations-container", 22249 gap: gap, 22250 children: themeVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 22251 variation: variation, 22252 children: isFocused => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, { 22253 label: variation?.title, 22254 withHoverView: true, 22255 isFocused: isFocused, 22256 variation: variation 22257 }) 22258 }, index)) 22259 }); 22260 } 22261 22262 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js 22263 /** 22264 * WordPress dependencies 22265 */ 22266 22267 22268 22269 /** 22270 * Internal dependencies 22271 */ 22272 22273 22274 22275 22276 function SidebarNavigationScreenGlobalStylesContent() { 22277 const gap = 3; 22278 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 22279 spacing: 10, 22280 className: "edit-site-global-styles-variation-container", 22281 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { 22282 gap: gap 22283 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { 22284 title: (0,external_wp_i18n_namespaceObject.__)('Palettes'), 22285 gap: gap 22286 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { 22287 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 22288 gap: gap 22289 })] 22290 }); 22291 } 22292 22293 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js 22294 /** 22295 * WordPress dependencies 22296 */ 22297 22298 22299 22300 22301 22302 22303 22304 /** 22305 * Internal dependencies 22306 */ 22307 22308 22309 22310 22311 const { 22312 useZoomOut 22313 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22314 function ScreenStyleVariations() { 22315 // Style Variations should only be previewed in with 22316 // - a "zoomed out" editor (but not when in preview mode) 22317 // - "Desktop" device preview 22318 const isPreviewMode = (0,external_wp_data_namespaceObject.useSelect)(select => { 22319 return select(external_wp_blockEditor_namespaceObject.store).getSettings().isPreviewMode; 22320 }, []); 22321 const { 22322 setDeviceType 22323 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 22324 useZoomOut(!isPreviewMode); 22325 (0,external_wp_element_namespaceObject.useEffect)(() => { 22326 setDeviceType('desktop'); 22327 }, [setDeviceType]); 22328 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22329 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22330 title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'), 22331 description: (0,external_wp_i18n_namespaceObject.__)('Choose a variation to change the look of the site.') 22332 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 22333 size: "small", 22334 isBorderless: true, 22335 className: "edit-site-global-styles-screen-style-variations", 22336 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { 22337 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) 22338 }) 22339 })] 22340 }); 22341 } 22342 /* harmony default export */ const screen_style_variations = (ScreenStyleVariations); 22343 22344 ;// external ["wp","mediaUtils"] 22345 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 22346 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/constants.js 22347 /** 22348 * WordPress dependencies 22349 */ 22350 22351 22352 /** 22353 * Internal dependencies 22354 */ 22355 22356 const STYLE_BOOK_COLOR_GROUPS = [{ 22357 slug: 'theme-colors', 22358 title: (0,external_wp_i18n_namespaceObject.__)('Theme Colors'), 22359 origin: 'theme', 22360 type: 'colors' 22361 }, { 22362 slug: 'theme-gradients', 22363 title: (0,external_wp_i18n_namespaceObject.__)('Theme Gradients'), 22364 origin: 'theme', 22365 type: 'gradients' 22366 }, { 22367 slug: 'custom-colors', 22368 title: (0,external_wp_i18n_namespaceObject.__)('Custom Colors'), 22369 origin: 'custom', 22370 type: 'colors' 22371 }, { 22372 slug: 'custom-gradients', 22373 title: (0,external_wp_i18n_namespaceObject.__)('Custom Gradients'), 22374 origin: 'custom', 22375 // User. 22376 type: 'gradients' 22377 }, { 22378 slug: 'duotones', 22379 title: (0,external_wp_i18n_namespaceObject.__)('Duotones'), 22380 origin: 'theme', 22381 type: 'duotones' 22382 }, { 22383 slug: 'default-colors', 22384 title: (0,external_wp_i18n_namespaceObject.__)('Default Colors'), 22385 origin: 'default', 22386 type: 'colors' 22387 }, { 22388 slug: 'default-gradients', 22389 title: (0,external_wp_i18n_namespaceObject.__)('Default Gradients'), 22390 origin: 'default', 22391 type: 'gradients' 22392 }]; 22393 const STYLE_BOOK_THEME_SUBCATEGORIES = [{ 22394 slug: 'site-identity', 22395 title: (0,external_wp_i18n_namespaceObject.__)('Site Identity'), 22396 blocks: ['core/site-logo', 'core/site-title', 'core/site-tagline'] 22397 }, { 22398 slug: 'design', 22399 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 22400 blocks: ['core/navigation', 'core/avatar', 'core/post-time-to-read'], 22401 exclude: ['core/home-link', 'core/navigation-link'] 22402 }, { 22403 slug: 'posts', 22404 title: (0,external_wp_i18n_namespaceObject.__)('Posts'), 22405 blocks: ['core/post-title', 'core/post-excerpt', 'core/post-author', 'core/post-author-name', 'core/post-author-biography', 'core/post-date', 'core/post-terms', 'core/term-description', 'core/query-title', 'core/query-no-results', 'core/query-pagination', 'core/query-numbers'] 22406 }, { 22407 slug: 'comments', 22408 title: (0,external_wp_i18n_namespaceObject.__)('Comments'), 22409 blocks: ['core/comments-title', 'core/comments-pagination', 'core/comments-pagination-numbers', 'core/comments', 'core/comments-author-name', 'core/comment-content', 'core/comment-date', 'core/comment-edit-link', 'core/comment-reply-link', 'core/comment-template', 'core/post-comments-count', 'core/post-comments-link'] 22410 }]; 22411 const STYLE_BOOK_CATEGORIES = [{ 22412 slug: 'overview', 22413 title: (0,external_wp_i18n_namespaceObject.__)('Overview'), 22414 blocks: [] 22415 }, { 22416 slug: 'text', 22417 title: (0,external_wp_i18n_namespaceObject.__)('Text'), 22418 blocks: ['core/post-content', 'core/home-link', 'core/navigation-link'] 22419 }, { 22420 slug: 'colors', 22421 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 22422 blocks: [] 22423 }, { 22424 slug: 'theme', 22425 title: (0,external_wp_i18n_namespaceObject.__)('Theme'), 22426 subcategories: STYLE_BOOK_THEME_SUBCATEGORIES 22427 }, { 22428 slug: 'media', 22429 title: (0,external_wp_i18n_namespaceObject.__)('Media'), 22430 blocks: ['core/post-featured-image'] 22431 }, { 22432 slug: 'widgets', 22433 title: (0,external_wp_i18n_namespaceObject.__)('Widgets'), 22434 blocks: [] 22435 }, { 22436 slug: 'embed', 22437 title: (0,external_wp_i18n_namespaceObject.__)('Embeds'), 22438 include: [] 22439 }]; 22440 22441 // Style book preview subcategories for all blocks section. 22442 const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [...STYLE_BOOK_THEME_SUBCATEGORIES, { 22443 slug: 'media', 22444 title: (0,external_wp_i18n_namespaceObject.__)('Media'), 22445 blocks: ['core/post-featured-image'] 22446 }, { 22447 slug: 'widgets', 22448 title: (0,external_wp_i18n_namespaceObject.__)('Widgets'), 22449 blocks: [] 22450 }, { 22451 slug: 'embed', 22452 title: (0,external_wp_i18n_namespaceObject.__)('Embeds'), 22453 include: [] 22454 }]; 22455 22456 // Style book preview categories are organized slightly differently to the editor ones. 22457 const STYLE_BOOK_PREVIEW_CATEGORIES = [{ 22458 slug: 'overview', 22459 title: (0,external_wp_i18n_namespaceObject.__)('Overview'), 22460 blocks: [] 22461 }, { 22462 slug: 'text', 22463 title: (0,external_wp_i18n_namespaceObject.__)('Text'), 22464 blocks: ['core/post-content', 'core/home-link', 'core/navigation-link'] 22465 }, { 22466 slug: 'colors', 22467 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 22468 blocks: [] 22469 }, { 22470 slug: 'blocks', 22471 title: (0,external_wp_i18n_namespaceObject.__)('All Blocks'), 22472 blocks: [], 22473 subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES 22474 }]; 22475 22476 // Forming a "block formatting context" to prevent margin collapsing. 22477 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 22478 const ROOT_CONTAINER = ` 22479 .is-root-container { 22480 display: flow-root; 22481 } 22482 `; 22483 // The content area of the Style Book is rendered within an iframe so that global styles 22484 // are applied to elements within the entire content area. To support elements that are 22485 // not part of the block previews, such as headings and layout for the block previews, 22486 // additional CSS rules need to be passed into the iframe. These are hard-coded below. 22487 // Note that button styles are unset, and then focus rules from the `Button` component are 22488 // applied to the `button` element, targeted via `.edit-site-style-book__example`. 22489 // This is to ensure that browser default styles for buttons are not applied to the previews. 22490 const STYLE_BOOK_IFRAME_STYLES = ` 22491 body { 22492 position: relative; 22493 padding: 32px !important; 22494 } 22495 22496 $ROOT_CONTAINER} 22497 22498 .edit-site-style-book__examples { 22499 max-width: 1200px; 22500 margin: 0 auto; 22501 } 22502 22503 .edit-site-style-book__example { 22504 max-width: 900px; 22505 border-radius: 2px; 22506 cursor: pointer; 22507 display: flex; 22508 flex-direction: column; 22509 gap: 40px; 22510 padding: 16px; 22511 width: 100%; 22512 box-sizing: border-box; 22513 scroll-margin-top: 32px; 22514 scroll-margin-bottom: 32px; 22515 margin: 0 auto 40px auto; 22516 } 22517 22518 .edit-site-style-book__example.is-selected { 22519 box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22520 } 22521 22522 .edit-site-style-book__example.is-disabled-example { 22523 pointer-events: none; 22524 } 22525 22526 .edit-site-style-book__example:focus:not(:disabled) { 22527 box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22528 outline: 3px solid transparent; 22529 } 22530 22531 .edit-site-style-book__duotone-example > div:first-child { 22532 display: flex; 22533 aspect-ratio: 16 / 9; 22534 grid-row: span 1; 22535 grid-column: span 2; 22536 } 22537 .edit-site-style-book__duotone-example img { 22538 width: 100%; 22539 height: 100%; 22540 object-fit: cover; 22541 } 22542 .edit-site-style-book__duotone-example > div:not(:first-child) { 22543 height: 20px; 22544 border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 22545 } 22546 22547 .edit-site-style-book__color-example { 22548 border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 22549 } 22550 22551 .edit-site-style-book__subcategory-title, 22552 .edit-site-style-book__example-title { 22553 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 22554 font-size: 13px; 22555 font-weight: normal; 22556 line-height: normal; 22557 margin: 0; 22558 text-align: left; 22559 padding-top: 8px; 22560 border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 22561 color: color-mix( in srgb, currentColor 60%, transparent ); 22562 } 22563 22564 .edit-site-style-book__subcategory-title { 22565 font-size: 16px; 22566 margin-bottom: 40px; 22567 padding-bottom: 8px; 22568 } 22569 22570 .edit-site-style-book__example-preview { 22571 width: 100%; 22572 } 22573 22574 .edit-site-style-book__example-preview .block-editor-block-list__insertion-point, 22575 .edit-site-style-book__example-preview .block-list-appender { 22576 display: none; 22577 } 22578 :where(.is-root-container > .wp-block:first-child) { 22579 margin-top: 0; 22580 } 22581 :where(.is-root-container > .wp-block:last-child) { 22582 margin-bottom: 0; 22583 } 22584 `; 22585 22586 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/categories.js 22587 /* wp:polyfill */ 22588 /** 22589 * WordPress dependencies 22590 */ 22591 // @wordpress/blocks imports are not typed. 22592 // @ts-expect-error 22593 22594 22595 /** 22596 * Internal dependencies 22597 */ 22598 22599 22600 22601 /** 22602 * Returns category examples for a given category definition and list of examples. 22603 * @param {StyleBookCategory} categoryDefinition The category definition. 22604 * @param {BlockExample[]} examples An array of block examples. 22605 * @return {CategoryExamples|undefined} An object containing the category examples. 22606 */ 22607 function getExamplesByCategory(categoryDefinition, examples) { 22608 var _categoryDefinition$s; 22609 if (!categoryDefinition?.slug || !examples?.length) { 22610 return; 22611 } 22612 const categories = (_categoryDefinition$s = categoryDefinition?.subcategories) !== null && _categoryDefinition$s !== void 0 ? _categoryDefinition$s : []; 22613 if (categories.length) { 22614 return categories.reduce((acc, subcategoryDefinition) => { 22615 const subcategoryExamples = getExamplesByCategory(subcategoryDefinition, examples); 22616 if (subcategoryExamples) { 22617 if (!acc.subcategories) { 22618 acc.subcategories = []; 22619 } 22620 acc.subcategories = [...acc.subcategories, subcategoryExamples]; 22621 } 22622 return acc; 22623 }, { 22624 title: categoryDefinition.title, 22625 slug: categoryDefinition.slug 22626 }); 22627 } 22628 const blocksToInclude = categoryDefinition?.blocks || []; 22629 const blocksToExclude = categoryDefinition?.exclude || []; 22630 const categoryExamples = examples.filter(example => { 22631 return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name)); 22632 }); 22633 if (!categoryExamples.length) { 22634 return; 22635 } 22636 return { 22637 title: categoryDefinition.title, 22638 slug: categoryDefinition.slug, 22639 examples: categoryExamples 22640 }; 22641 } 22642 22643 /** 22644 * Returns category examples for a given category definition and list of examples. 22645 * 22646 * @return {StyleBookCategory[]} An array of top-level category definitions. 22647 */ 22648 function getTopLevelStyleBookCategories() { 22649 const reservedCategories = [...STYLE_BOOK_THEME_SUBCATEGORIES, ...STYLE_BOOK_CATEGORIES].map(({ 22650 slug 22651 }) => slug); 22652 const extraCategories = (0,external_wp_blocks_namespaceObject.getCategories)(); 22653 const extraCategoriesFiltered = extraCategories.filter(({ 22654 slug 22655 }) => !reservedCategories.includes(slug)); 22656 return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered]; 22657 } 22658 22659 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/color-examples.js 22660 /* wp:polyfill */ 22661 /** 22662 * External dependencies 22663 */ 22664 22665 22666 /** 22667 * WordPress dependencies 22668 */ 22669 22670 22671 22672 22673 /** 22674 * Internal dependencies 22675 */ 22676 22677 const ColorExamples = ({ 22678 colors, 22679 type, 22680 templateColumns = '1fr 1fr', 22681 itemHeight = '52px' 22682 }) => { 22683 if (!colors) { 22684 return null; 22685 } 22686 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 22687 templateColumns: templateColumns, 22688 rowGap: 8, 22689 columnGap: 16, 22690 children: colors.map(color => { 22691 const className = type === 'gradients' ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(color.slug) : (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', color.slug); 22692 const classes = dist_clsx('edit-site-style-book__color-example', className); 22693 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { 22694 className: classes, 22695 style: { 22696 height: itemHeight 22697 } 22698 }, color.slug); 22699 }) 22700 }); 22701 }; 22702 /* harmony default export */ const color_examples = (ColorExamples); 22703 22704 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/duotone-examples.js 22705 /* wp:polyfill */ 22706 /** 22707 * WordPress dependencies 22708 */ 22709 22710 22711 22712 /** 22713 * Internal dependencies 22714 */ 22715 22716 const DuotoneExamples = ({ 22717 duotones 22718 }) => { 22719 if (!duotones) { 22720 return null; 22721 } 22722 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 22723 columns: 2, 22724 rowGap: 16, 22725 columnGap: 16, 22726 children: duotones.map(duotone => { 22727 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 22728 className: "edit-site-style-book__duotone-example", 22729 columns: 2, 22730 rowGap: 8, 22731 columnGap: 8, 22732 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { 22733 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 22734 alt: `Duotone example: $duotone.slug}`, 22735 src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg", 22736 style: { 22737 filter: `url(#wp-duotone-$duotone.slug})` 22738 } 22739 }) 22740 }), duotone.colors.map(color => { 22741 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { 22742 className: "edit-site-style-book__color-example", 22743 style: { 22744 backgroundColor: color 22745 } 22746 }, color); 22747 })] 22748 }, duotone.slug); 22749 }) 22750 }); 22751 }; 22752 /* harmony default export */ const duotone_examples = (DuotoneExamples); 22753 22754 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/examples.js 22755 /* wp:polyfill */ 22756 /** 22757 * WordPress dependencies 22758 */ 22759 22760 22761 22762 /** 22763 * Internal dependencies 22764 */ 22765 22766 22767 22768 22769 22770 /** 22771 * Returns examples color examples for each origin 22772 * e.g. Core (Default), Theme, and User. 22773 * 22774 * @param {MultiOriginPalettes} colors Global Styles color palettes per origin. 22775 * @return {BlockExample[]} An array of color block examples. 22776 */ 22777 22778 function getColorExamples(colors) { 22779 if (!colors) { 22780 return []; 22781 } 22782 const examples = []; 22783 STYLE_BOOK_COLOR_GROUPS.forEach(group => { 22784 const palette = colors[group.type]; 22785 const paletteFiltered = Array.isArray(palette) ? palette.find(origin => origin.slug === group.origin) : undefined; 22786 if (paletteFiltered?.[group.type]) { 22787 const example = { 22788 name: group.slug, 22789 title: group.title, 22790 category: 'colors' 22791 }; 22792 if (group.type === 'duotones') { 22793 example.content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(duotone_examples, { 22794 duotones: paletteFiltered[group.type] 22795 }); 22796 examples.push(example); 22797 } else { 22798 example.content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_examples, { 22799 colors: paletteFiltered[group.type], 22800 type: group.type 22801 }); 22802 examples.push(example); 22803 } 22804 } 22805 }); 22806 return examples; 22807 } 22808 22809 /** 22810 * Returns examples for the overview page. 22811 * 22812 * @param {MultiOriginPalettes} colors Global Styles color palettes per origin. 22813 * @return {BlockExample[]} An array of block examples. 22814 */ 22815 function getOverviewBlockExamples(colors) { 22816 const examples = []; 22817 22818 // Get theme palette from colors if they exist. 22819 const themePalette = Array.isArray(colors?.colors) ? colors.colors.find(origin => origin.slug === 'theme') : undefined; 22820 if (themePalette) { 22821 const themeColorexample = { 22822 name: 'theme-colors', 22823 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 22824 category: 'overview', 22825 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_examples, { 22826 colors: themePalette.colors, 22827 type: "colors", 22828 templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))", 22829 itemHeight: "32px" 22830 }) 22831 }; 22832 examples.push(themeColorexample); 22833 } 22834 22835 // Get examples for typography blocks. 22836 const typographyBlockExamples = []; 22837 if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/heading')) { 22838 const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { 22839 content: (0,external_wp_i18n_namespaceObject.__)(`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`), 22840 level: 1 22841 }); 22842 typographyBlockExamples.push(headingBlock); 22843 } 22844 if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/paragraph')) { 22845 const firstParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', { 22846 content: (0,external_wp_i18n_namespaceObject.__)(`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.`) 22847 }); 22848 const secondParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', { 22849 content: (0,external_wp_i18n_namespaceObject.__)(`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.`) 22850 }); 22851 if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/group')) { 22852 const groupBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { 22853 layout: { 22854 type: 'grid', 22855 columnCount: 2, 22856 minimumColumnWidth: '12rem' 22857 }, 22858 style: { 22859 spacing: { 22860 blockGap: '1.5rem' 22861 } 22862 } 22863 }, [firstParagraphBlock, secondParagraphBlock]); 22864 typographyBlockExamples.push(groupBlock); 22865 } else { 22866 typographyBlockExamples.push(firstParagraphBlock); 22867 } 22868 } 22869 if (!!typographyBlockExamples.length) { 22870 examples.push({ 22871 name: 'typography', 22872 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 22873 category: 'overview', 22874 blocks: typographyBlockExamples 22875 }); 22876 } 22877 const otherBlockExamples = ['core/image', 'core/separator', 'core/buttons', 'core/pullquote', 'core/search']; 22878 22879 // Get examples for other blocks and put them in order of above array. 22880 otherBlockExamples.forEach(blockName => { 22881 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 22882 if (blockType && blockType.example) { 22883 const blockExample = { 22884 name: blockName, 22885 title: blockType.title, 22886 category: 'overview', 22887 /* 22888 * CSS generated from style attributes will take precedence over global styles CSS, 22889 * so remove the style attribute from the example to ensure the example 22890 * demonstrates changes to global styles. 22891 */ 22892 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { 22893 ...blockType.example, 22894 attributes: { 22895 ...blockType.example.attributes, 22896 style: undefined 22897 } 22898 }) 22899 }; 22900 examples.push(blockExample); 22901 } 22902 }); 22903 return examples; 22904 } 22905 22906 /** 22907 * Returns a list of examples for registered block types. 22908 * 22909 * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User. 22910 * @return {BlockExample[]} An array of block examples. 22911 */ 22912 function getExamples(colors) { 22913 const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => { 22914 const { 22915 name, 22916 example, 22917 supports 22918 } = blockType; 22919 return name !== 'core/heading' && !!example && supports?.inserter !== false; 22920 }).map(blockType => ({ 22921 name: blockType.name, 22922 title: blockType.title, 22923 category: blockType.category, 22924 /* 22925 * CSS generated from style attributes will take precedence over global styles CSS, 22926 * so remove the style attribute from the example to ensure the example 22927 * demonstrates changes to global styles. 22928 */ 22929 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, { 22930 ...blockType.example, 22931 attributes: { 22932 ...blockType.example.attributes, 22933 style: undefined 22934 } 22935 }) 22936 })); 22937 const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/heading'); 22938 if (!isHeadingBlockRegistered) { 22939 return nonHeadingBlockExamples; 22940 } 22941 22942 // Use our own example for the Heading block so that we can show multiple 22943 // heading levels. 22944 const headingsExample = { 22945 name: 'core/heading', 22946 title: (0,external_wp_i18n_namespaceObject.__)('Headings'), 22947 category: 'text', 22948 blocks: [1, 2, 3, 4, 5, 6].map(level => { 22949 return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { 22950 content: (0,external_wp_i18n_namespaceObject.sprintf)( 22951 // translators: %d: heading level e.g: "1", "2", "3" 22952 (0,external_wp_i18n_namespaceObject.__)('Heading %d'), level), 22953 level 22954 }); 22955 }) 22956 }; 22957 const colorExamples = getColorExamples(colors); 22958 const overviewBlockExamples = getOverviewBlockExamples(colors); 22959 return [headingsExample, ...colorExamples, ...nonHeadingBlockExamples, ...overviewBlockExamples]; 22960 } 22961 22962 ;// ./node_modules/@wordpress/edit-site/build-module/components/page/header.js 22963 /** 22964 * WordPress dependencies 22965 */ 22966 22967 22968 /** 22969 * Internal dependencies 22970 */ 22971 22972 function Header({ 22973 title, 22974 subTitle, 22975 actions 22976 }) { 22977 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 22978 className: "edit-site-page-header", 22979 as: "header", 22980 spacing: 0, 22981 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 22982 className: "edit-site-page-header__page-title", 22983 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 22984 as: "h2", 22985 level: 3, 22986 weight: 500, 22987 className: "edit-site-page-header__title", 22988 truncate: true, 22989 children: title 22990 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 22991 className: "edit-site-page-header__actions", 22992 children: actions 22993 })] 22994 }), subTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 22995 variant: "muted", 22996 as: "p", 22997 className: "edit-site-page-header__sub-title", 22998 children: subTitle 22999 })] 23000 }); 23001 } 23002 23003 ;// ./node_modules/@wordpress/edit-site/build-module/components/page/index.js 23004 /** 23005 * External dependencies 23006 */ 23007 23008 23009 /** 23010 * WordPress dependencies 23011 */ 23012 23013 23014 /** 23015 * Internal dependencies 23016 */ 23017 23018 23019 23020 const { 23021 NavigableRegion: page_NavigableRegion 23022 } = unlock(external_wp_editor_namespaceObject.privateApis); 23023 function Page({ 23024 title, 23025 subTitle, 23026 actions, 23027 children, 23028 className, 23029 hideTitleFromUI = false 23030 }) { 23031 const classes = dist_clsx('edit-site-page', className); 23032 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_NavigableRegion, { 23033 className: classes, 23034 ariaLabel: title, 23035 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 23036 className: "edit-site-page-content", 23037 children: [!hideTitleFromUI && title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, { 23038 title: title, 23039 subTitle: subTitle, 23040 actions: actions 23041 }), children] 23042 }) 23043 }); 23044 } 23045 23046 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-global-styles-wrapper/index.js 23047 /** 23048 * WordPress dependencies 23049 */ 23050 23051 23052 23053 23054 23055 23056 23057 23058 /** 23059 * Internal dependencies 23060 */ 23061 23062 23063 23064 23065 const { 23066 useLocation: sidebar_global_styles_wrapper_useLocation, 23067 useHistory: sidebar_global_styles_wrapper_useHistory 23068 } = unlock(external_wp_router_namespaceObject.privateApis); 23069 const GlobalStylesPageActions = ({ 23070 isStyleBookOpened, 23071 setIsStyleBookOpened, 23072 path 23073 }) => { 23074 const history = sidebar_global_styles_wrapper_useHistory(); 23075 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23076 isPressed: isStyleBookOpened, 23077 icon: library_seen, 23078 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 23079 onClick: () => { 23080 setIsStyleBookOpened(!isStyleBookOpened); 23081 const updatedPath = !isStyleBookOpened ? (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 23082 preview: 'stylebook' 23083 }) : (0,external_wp_url_namespaceObject.removeQueryArgs)(path, 'preview'); 23084 // Navigate to the updated path. 23085 history.navigate(updatedPath); 23086 }, 23087 size: "compact" 23088 }); 23089 }; 23090 23091 /** 23092 * Hook to deal with navigation and location state. 23093 * 23094 * @return {Array} The current section and a function to update it. 23095 */ 23096 const useSection = () => { 23097 const { 23098 path, 23099 query 23100 } = sidebar_global_styles_wrapper_useLocation(); 23101 const history = sidebar_global_styles_wrapper_useHistory(); 23102 return (0,external_wp_element_namespaceObject.useMemo)(() => { 23103 var _query$section; 23104 return [(_query$section = query.section) !== null && _query$section !== void 0 ? _query$section : '/', updatedSection => { 23105 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 23106 section: updatedSection 23107 })); 23108 }]; 23109 }, [path, query.section, history]); 23110 }; 23111 function GlobalStylesUIWrapper() { 23112 const { 23113 path 23114 } = sidebar_global_styles_wrapper_useLocation(); 23115 const [isStyleBookOpened, setIsStyleBookOpened] = (0,external_wp_element_namespaceObject.useState)(path.includes('preview=stylebook')); 23116 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 23117 const [section, onChangeSection] = useSection(); 23118 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23119 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 23120 actions: !isMobileViewport ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesPageActions, { 23121 isStyleBookOpened: isStyleBookOpened, 23122 setIsStyleBookOpened: setIsStyleBookOpened, 23123 path: path 23124 }) : null, 23125 className: "edit-site-styles", 23126 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 23127 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, { 23128 path: section, 23129 onPathChange: onChangeSection 23130 }) 23131 }) 23132 }); 23133 } 23134 23135 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js 23136 /* wp:polyfill */ 23137 /** 23138 * External dependencies 23139 */ 23140 23141 23142 /** 23143 * WordPress dependencies 23144 */ 23145 23146 23147 23148 23149 23150 23151 23152 23153 23154 23155 23156 /** 23157 * Internal dependencies 23158 */ 23159 23160 23161 23162 23163 23164 23165 23166 23167 23168 23169 const { 23170 ExperimentalBlockEditorProvider, 23171 useGlobalStyle: style_book_useGlobalStyle, 23172 GlobalStylesContext: style_book_GlobalStylesContext, 23173 useGlobalStylesOutputWithConfig 23174 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23175 const { 23176 mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs 23177 } = unlock(external_wp_editor_namespaceObject.privateApis); 23178 const { 23179 Tabs: style_book_Tabs 23180 } = unlock(external_wp_components_namespaceObject.privateApis); 23181 function isObjectEmpty(object) { 23182 return !object || Object.keys(object).length === 0; 23183 } 23184 23185 /** 23186 * Scrolls to a section within an iframe. 23187 * 23188 * @param {string} anchorId The id of the element to scroll to. 23189 * @param {HTMLIFrameElement} iframe The target iframe. 23190 */ 23191 const scrollToSection = (anchorId, iframe) => { 23192 if (!anchorId || !iframe || !iframe?.contentDocument) { 23193 return; 23194 } 23195 const element = anchorId === 'top' ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId); 23196 if (element) { 23197 element.scrollIntoView({ 23198 behavior: 'smooth' 23199 }); 23200 } 23201 }; 23202 23203 /** 23204 * Parses a Block Editor navigation path to build a style book navigation path. 23205 * The object can be extended to include a category, representing a style book tab/section. 23206 * 23207 * @param {string} path An internal Block Editor navigation path. 23208 * @return {null|{block: string}} An object containing the example to navigate to. 23209 */ 23210 const getStyleBookNavigationFromPath = path => { 23211 if (path && typeof path === 'string') { 23212 if (path === '/' || path.startsWith('/typography') || path.startsWith('/colors') || path.startsWith('/blocks')) { 23213 return { 23214 top: true 23215 }; 23216 } 23217 } 23218 return null; 23219 }; 23220 23221 /** 23222 * Retrieves colors, gradients, and duotone filters from Global Styles. 23223 * The inclusion of default (Core) palettes is controlled by the relevant 23224 * theme.json property e.g. defaultPalette, defaultGradients, defaultDuotone. 23225 * 23226 * @return {Object} Object containing properties for each type of palette. 23227 */ 23228 function useMultiOriginPalettes() { 23229 const { 23230 colors, 23231 gradients 23232 } = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)(); 23233 23234 // Add duotone filters to the palettes data. 23235 const [shouldDisplayDefaultDuotones, customDuotones, themeDuotones, defaultDuotones] = (0,external_wp_blockEditor_namespaceObject.useSettings)('color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default'); 23236 const palettes = (0,external_wp_element_namespaceObject.useMemo)(() => { 23237 const result = { 23238 colors, 23239 gradients, 23240 duotones: [] 23241 }; 23242 if (themeDuotones && themeDuotones.length) { 23243 result.duotones.push({ 23244 name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates these duotone filters come from the theme.'), 23245 slug: 'theme', 23246 duotones: themeDuotones 23247 }); 23248 } 23249 if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) { 23250 result.duotones.push({ 23251 name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates these duotone filters come from WordPress.'), 23252 slug: 'default', 23253 duotones: defaultDuotones 23254 }); 23255 } 23256 if (customDuotones && customDuotones.length) { 23257 result.duotones.push({ 23258 name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates these doutone filters are created by the user.'), 23259 slug: 'custom', 23260 duotones: customDuotones 23261 }); 23262 } 23263 return result; 23264 }, [colors, gradients, customDuotones, themeDuotones, defaultDuotones, shouldDisplayDefaultDuotones]); 23265 return palettes; 23266 } 23267 23268 /** 23269 * Get deduped examples for single page stylebook. 23270 * @param {Array} examples Array of examples. 23271 * @return {Array} Deduped examples. 23272 */ 23273 function getExamplesForSinglePageUse(examples) { 23274 const examplesForSinglePageUse = []; 23275 const overviewCategoryExamples = getExamplesByCategory({ 23276 slug: 'overview' 23277 }, examples); 23278 examplesForSinglePageUse.push(...overviewCategoryExamples.examples); 23279 const otherExamples = examples.filter(example => { 23280 return example.category !== 'overview' && !overviewCategoryExamples.examples.find(overviewExample => overviewExample.name === example.name); 23281 }); 23282 examplesForSinglePageUse.push(...otherExamples); 23283 return examplesForSinglePageUse; 23284 } 23285 function StyleBook({ 23286 enableResizing = true, 23287 isSelected, 23288 onClick, 23289 onSelect, 23290 showCloseButton = true, 23291 onClose, 23292 showTabs = true, 23293 userConfig = {}, 23294 path = '' 23295 }) { 23296 const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 23297 const [textColor] = style_book_useGlobalStyle('color.text'); 23298 const [backgroundColor] = style_book_useGlobalStyle('color.background'); 23299 const colors = useMultiOriginPalettes(); 23300 const examples = (0,external_wp_element_namespaceObject.useMemo)(() => getExamples(colors), [colors]); 23301 const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => getTopLevelStyleBookCategories().filter(category => examples.some(example => example.category === category.slug)), [examples]); 23302 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); 23303 const { 23304 base: baseConfig 23305 } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); 23306 const goTo = getStyleBookNavigationFromPath(path); 23307 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 23308 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 23309 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 23310 } 23311 return {}; 23312 }, [baseConfig, userConfig]); 23313 23314 // Copied from packages/edit-site/src/components/revisions/index.js 23315 // could we create a shared hook? 23316 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 23317 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 23318 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23319 ...originalSettings, 23320 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles, 23321 isPreviewMode: true 23322 }), [globalStyles, originalSettings, userConfig]); 23323 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 23324 onClose: onClose, 23325 enableResizing: enableResizing, 23326 closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)('Close') : null, 23327 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 23328 className: dist_clsx('edit-site-style-book', { 23329 'is-wide': sizes.width > 600, 23330 'is-button': !!onClick 23331 }), 23332 style: { 23333 color: textColor, 23334 background: backgroundColor 23335 }, 23336 children: [resizeObserver, showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { 23337 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23338 className: "edit-site-style-book__tablist-container", 23339 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { 23340 children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.Tab, { 23341 tabId: tab.slug, 23342 children: tab.title 23343 }, tab.slug)) 23344 }) 23345 }), tabs.map(tab => { 23346 const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find(_category => _category.slug === tab.slug) : null; 23347 const filteredExamples = categoryDefinition ? getExamplesByCategory(categoryDefinition, examples) : { 23348 examples 23349 }; 23350 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabPanel, { 23351 tabId: tab.slug, 23352 focusable: false, 23353 className: "edit-site-style-book__tabpanel", 23354 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 23355 category: tab.slug, 23356 examples: filteredExamples, 23357 isSelected: isSelected, 23358 onSelect: onSelect, 23359 settings: settings, 23360 sizes: sizes, 23361 title: tab.title, 23362 goTo: goTo 23363 }) 23364 }, tab.slug); 23365 })] 23366 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 23367 examples: { 23368 examples: examplesForSinglePageUse 23369 }, 23370 isSelected: isSelected, 23371 onClick: onClick, 23372 onSelect: onSelect, 23373 settings: settings, 23374 sizes: sizes, 23375 goTo: goTo 23376 })] 23377 }) 23378 }); 23379 } 23380 23381 /** 23382 * Style Book Preview component renders the stylebook without the Editor dependency. 23383 * 23384 * @param {Object} props Component props. 23385 * @param {Object} props.userConfig User configuration. 23386 * @param {boolean} props.isStatic Whether the stylebook is static or clickable. 23387 * @return {Object} Style Book Preview component. 23388 */ 23389 const StyleBookPreview = ({ 23390 userConfig = {}, 23391 isStatic = false 23392 }) => { 23393 const siteEditorSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []); 23394 const canUserUploadMedia = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).canUser('create', { 23395 kind: 'root', 23396 name: 'media' 23397 }), []); 23398 23399 // Update block editor settings because useMultipleOriginColorsAndGradients fetch colours from there. 23400 (0,external_wp_element_namespaceObject.useEffect)(() => { 23401 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blockEditor_namespaceObject.store).updateSettings({ 23402 ...siteEditorSettings, 23403 mediaUpload: canUserUploadMedia ? external_wp_mediaUtils_namespaceObject.uploadMedia : undefined 23404 }); 23405 }, [siteEditorSettings, canUserUploadMedia]); 23406 const [section, onChangeSection] = useSection(); 23407 const isSelected = blockName => { 23408 // Match '/blocks/core%2Fbutton' and 23409 // '/blocks/core%2Fbutton/typography', but not 23410 // '/blocks/core%2Fbuttons'. 23411 return section === `/blocks/$encodeURIComponent(blockName)}` || section.startsWith(`/blocks/$encodeURIComponent(blockName)}/`); 23412 }; 23413 const onSelect = blockName => { 23414 if (STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) { 23415 // Go to color palettes Global Styles. 23416 onChangeSection('/colors/palette'); 23417 return; 23418 } 23419 if (blockName === 'typography') { 23420 // Go to typography Global Styles. 23421 onChangeSection('/typography'); 23422 return; 23423 } 23424 23425 // Now go to the selected block. 23426 onChangeSection(`/blocks/$encodeURIComponent(blockName)}`); 23427 }; 23428 const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 23429 const colors = useMultiOriginPalettes(); 23430 const examples = getExamples(colors); 23431 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); 23432 let previewCategory = null; 23433 if (section.includes('/colors')) { 23434 previewCategory = 'colors'; 23435 } else if (section.includes('/typography')) { 23436 previewCategory = 'text'; 23437 } else if (section.includes('/blocks')) { 23438 previewCategory = 'blocks'; 23439 const blockName = decodeURIComponent(section).split('/blocks/')[1]; 23440 if (blockName && examples.find(example => example.name === blockName)) { 23441 previewCategory = blockName; 23442 } 23443 } else if (!isStatic) { 23444 previewCategory = 'overview'; 23445 } 23446 const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(category => category.slug === previewCategory); 23447 23448 // If there's no category definition there may be a single block. 23449 const filteredExamples = categoryDefinition ? getExamplesByCategory(categoryDefinition, examples) : { 23450 examples: [examples.find(example => example.name === previewCategory)] 23451 }; 23452 23453 // If there's no preview category, show all examples. 23454 const displayedExamples = previewCategory ? filteredExamples : { 23455 examples: examplesForSinglePageUse 23456 }; 23457 const { 23458 base: baseConfig 23459 } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); 23460 const goTo = getStyleBookNavigationFromPath(section); 23461 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 23462 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 23463 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 23464 } 23465 return {}; 23466 }, [baseConfig, userConfig]); 23467 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 23468 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23469 ...siteEditorSettings, 23470 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : siteEditorSettings.styles, 23471 isPreviewMode: true 23472 }), [globalStyles, siteEditorSettings, userConfig]); 23473 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 23474 className: "edit-site-style-book", 23475 children: [resizeObserver, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 23476 settings: settings, 23477 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { 23478 disableRootPadding: true 23479 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 23480 examples: displayedExamples, 23481 settings: settings, 23482 goTo: goTo, 23483 sizes: sizes, 23484 isSelected: !isStatic ? isSelected : null, 23485 onSelect: !isStatic ? onSelect : null 23486 })] 23487 })] 23488 }); 23489 }; 23490 const StyleBookBody = ({ 23491 examples, 23492 isSelected, 23493 onClick, 23494 onSelect, 23495 settings, 23496 sizes, 23497 title, 23498 goTo 23499 }) => { 23500 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 23501 const [hasIframeLoaded, setHasIframeLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 23502 const iframeRef = (0,external_wp_element_namespaceObject.useRef)(null); 23503 // The presence of an `onClick` prop indicates that the Style Book is being used as a button. 23504 // In this case, add additional props to the iframe to make it behave like a button. 23505 const buttonModeProps = { 23506 role: 'button', 23507 onFocus: () => setIsFocused(true), 23508 onBlur: () => setIsFocused(false), 23509 onKeyDown: event => { 23510 if (event.defaultPrevented) { 23511 return; 23512 } 23513 const { 23514 keyCode 23515 } = event; 23516 if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) { 23517 event.preventDefault(); 23518 onClick(event); 23519 } 23520 }, 23521 onClick: event => { 23522 if (event.defaultPrevented) { 23523 return; 23524 } 23525 if (onClick) { 23526 event.preventDefault(); 23527 onClick(event); 23528 } 23529 }, 23530 readonly: true 23531 }; 23532 const handleLoad = () => setHasIframeLoaded(true); 23533 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 23534 if (hasIframeLoaded && iframeRef?.current) { 23535 if (goTo?.top) { 23536 scrollToSection('top', iframeRef?.current); 23537 } 23538 } 23539 }, [iframeRef?.current, goTo, scrollToSection, hasIframeLoaded]); 23540 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 23541 onLoad: handleLoad, 23542 ref: iframeRef, 23543 className: dist_clsx('edit-site-style-book__iframe', { 23544 'is-focused': isFocused && !!onClick, 23545 'is-button': !!onClick 23546 }), 23547 name: "style-book-canvas", 23548 tabIndex: 0, 23549 ...(onClick ? buttonModeProps : {}), 23550 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 23551 styles: settings.styles 23552 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("style", { 23553 children: [STYLE_BOOK_IFRAME_STYLES, !!onClick && 'body { cursor: pointer; } body * { pointer-events: none; }'] 23554 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Examples, { 23555 className: dist_clsx('edit-site-style-book__examples', { 23556 'is-wide': sizes.width > 600 23557 }), 23558 filteredExamples: examples, 23559 label: title ? (0,external_wp_i18n_namespaceObject.sprintf)( 23560 // translators: %s: Category of blocks, e.g. Text. 23561 (0,external_wp_i18n_namespaceObject.__)('Examples of blocks in the %s category'), title) : (0,external_wp_i18n_namespaceObject.__)('Examples of blocks'), 23562 isSelected: isSelected, 23563 onSelect: onSelect 23564 }, title)] 23565 }); 23566 }; 23567 const Examples = (0,external_wp_element_namespaceObject.memo)(({ 23568 className, 23569 filteredExamples, 23570 label, 23571 isSelected, 23572 onSelect 23573 }) => { 23574 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite, { 23575 orientation: "vertical", 23576 className: className, 23577 "aria-label": label, 23578 role: "grid", 23579 children: [!!filteredExamples?.examples?.length && filteredExamples.examples.map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { 23580 id: `example-$example.name}`, 23581 title: example.title, 23582 content: example.content, 23583 blocks: example.blocks, 23584 isSelected: isSelected?.(example.name), 23585 onClick: !!onSelect ? () => onSelect(example.name) : null 23586 }, example.name)), !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map(subcategory => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Group, { 23587 className: "edit-site-style-book__subcategory", 23588 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.GroupLabel, { 23589 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 23590 className: "edit-site-style-book__subcategory-title", 23591 children: subcategory.title 23592 }) 23593 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Subcategory, { 23594 examples: subcategory.examples, 23595 isSelected: isSelected, 23596 onSelect: onSelect 23597 })] 23598 }, `subcategory-$subcategory.slug}`))] 23599 }); 23600 }); 23601 const Subcategory = ({ 23602 examples, 23603 isSelected, 23604 onSelect 23605 }) => { 23606 return !!examples?.length && examples.map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { 23607 id: `example-$example.name}`, 23608 title: example.title, 23609 content: example.content, 23610 blocks: example.blocks, 23611 isSelected: isSelected?.(example.name), 23612 onClick: !!onSelect ? () => onSelect(example.name) : null 23613 }, example.name)); 23614 }; 23615 const disabledExamples = ['example-duotones']; 23616 const Example = ({ 23617 id, 23618 title, 23619 blocks, 23620 isSelected, 23621 onClick, 23622 content 23623 }) => { 23624 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 23625 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23626 ...originalSettings, 23627 focusMode: false, 23628 // Disable "Spotlight mode". 23629 isPreviewMode: true 23630 }), [originalSettings]); 23631 23632 // Cache the list of blocks to avoid additional processing when the component is re-rendered. 23633 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 23634 const disabledProps = disabledExamples.includes(id) || !onClick ? { 23635 disabled: true, 23636 accessibleWhenDisabled: !!onClick 23637 } : {}; 23638 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23639 role: "row", 23640 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23641 role: "gridcell", 23642 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 23643 className: dist_clsx('edit-site-style-book__example', { 23644 'is-selected': isSelected, 23645 'is-disabled-example': !!disabledProps?.disabled 23646 }), 23647 id: id, 23648 "aria-label": !!onClick ? (0,external_wp_i18n_namespaceObject.sprintf)( 23649 // translators: %s: Title of a block, e.g. Heading. 23650 (0,external_wp_i18n_namespaceObject.__)('Open %s styles in Styles panel'), title) : undefined, 23651 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 23652 role: !!onClick ? 'button' : null, 23653 onClick: onClick, 23654 ...disabledProps, 23655 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23656 className: "edit-site-style-book__example-title", 23657 children: title 23658 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23659 className: "edit-site-style-book__example-preview", 23660 "aria-hidden": true, 23661 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 23662 className: "edit-site-style-book__example-preview__content", 23663 children: content ? content : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalBlockEditorProvider, { 23664 value: renderedBlocks, 23665 settings: settings, 23666 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 23667 renderAppender: false 23668 })] 23669 }) 23670 }) 23671 })] 23672 }) 23673 }) 23674 }); 23675 }; 23676 /* harmony default export */ const style_book = (StyleBook); 23677 23678 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js 23679 /** 23680 * WordPress dependencies 23681 */ 23682 23683 23684 23685 23686 /** 23687 * Internal dependencies 23688 */ 23689 23690 23691 23692 const { 23693 useGlobalStyle: screen_css_useGlobalStyle, 23694 AdvancedPanel: screen_css_StylesAdvancedPanel 23695 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23696 function ScreenCSS() { 23697 const description = (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.'); 23698 const [style] = screen_css_useGlobalStyle('', undefined, 'user', { 23699 shouldDecodeEncode: false 23700 }); 23701 const [inheritedStyle, setStyle] = screen_css_useGlobalStyle('', undefined, 'all', { 23702 shouldDecodeEncode: false 23703 }); 23704 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23705 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 23706 title: (0,external_wp_i18n_namespaceObject.__)('CSS'), 23707 description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23708 children: [description, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 23709 href: (0,external_wp_i18n_namespaceObject.__)('https://developer.wordpress.org/advanced-administration/wordpress/css/'), 23710 className: "edit-site-global-styles-screen-css-help-link", 23711 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about CSS') 23712 })] 23713 }) 23714 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23715 className: "edit-site-global-styles-screen-css", 23716 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_StylesAdvancedPanel, { 23717 value: style, 23718 onChange: setStyle, 23719 inheritedValue: inheritedStyle 23720 }) 23721 })] 23722 }); 23723 } 23724 /* harmony default export */ const screen_css = (ScreenCSS); 23725 23726 ;// ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js 23727 /** 23728 * WordPress dependencies 23729 */ 23730 23731 23732 23733 23734 23735 23736 23737 /** 23738 * Internal dependencies 23739 */ 23740 23741 23742 23743 23744 const { 23745 ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider, 23746 GlobalStylesContext: revisions_GlobalStylesContext, 23747 useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig, 23748 __unstableBlockStyleVariationOverridesWithConfig 23749 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23750 const { 23751 mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs 23752 } = unlock(external_wp_editor_namespaceObject.privateApis); 23753 function revisions_isObjectEmpty(object) { 23754 return !object || Object.keys(object).length === 0; 23755 } 23756 function Revisions({ 23757 userConfig, 23758 blocks 23759 }) { 23760 const { 23761 base: baseConfig 23762 } = (0,external_wp_element_namespaceObject.useContext)(revisions_GlobalStylesContext); 23763 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 23764 if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) { 23765 return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig); 23766 } 23767 return {}; 23768 }, [baseConfig, userConfig]); 23769 const renderedBlocksArray = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 23770 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 23771 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23772 ...originalSettings, 23773 isPreviewMode: true 23774 }), [originalSettings]); 23775 const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig); 23776 const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles; 23777 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 23778 title: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 23779 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions'), 23780 enableResizing: true, 23781 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 23782 className: "edit-site-revisions__iframe", 23783 name: "revisions", 23784 tabIndex: 0, 23785 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { 23786 children: 23787 // Forming a "block formatting context" to prevent margin collapsing. 23788 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 23789 `.is-root-container { display: flow-root; }` 23790 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 23791 className: "edit-site-revisions__example-preview__content", 23792 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(revisions_ExperimentalBlockEditorProvider, { 23793 value: renderedBlocksArray, 23794 settings: settings, 23795 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 23796 renderAppender: false 23797 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 23798 styles: editorStyles 23799 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(__unstableBlockStyleVariationOverridesWithConfig, { 23800 config: mergedConfig 23801 })] 23802 }) 23803 })] 23804 }) 23805 }); 23806 } 23807 /* harmony default export */ const components_revisions = (Revisions); 23808 23809 ;// external ["wp","date"] 23810 const external_wp_date_namespaceObject = window["wp"]["date"]; 23811 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js 23812 /* wp:polyfill */ 23813 /** 23814 * WordPress dependencies 23815 */ 23816 23817 23818 23819 23820 23821 23822 23823 /** 23824 * Internal dependencies 23825 */ 23826 23827 23828 const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24; 23829 const { 23830 getGlobalStylesChanges 23831 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23832 function ChangesSummary({ 23833 revision, 23834 previousRevision 23835 }) { 23836 const changes = getGlobalStylesChanges(revision, previousRevision, { 23837 maxResults: 7 23838 }); 23839 if (!changes.length) { 23840 return null; 23841 } 23842 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 23843 "data-testid": "global-styles-revision-changes", 23844 className: "edit-site-global-styles-screen-revisions__changes", 23845 children: changes.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 23846 children: change 23847 }, change)) 23848 }); 23849 } 23850 23851 /** 23852 * Returns a button label for the revision. 23853 * 23854 * @param {string|number} id A revision object. 23855 * @param {string} authorDisplayName Author name. 23856 * @param {string} formattedModifiedDate Revision modified date formatted. 23857 * @param {boolean} areStylesEqual Whether the revision matches the current editor styles. 23858 * @return {string} Translated label. 23859 */ 23860 function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) { 23861 if ('parent' === id) { 23862 return (0,external_wp_i18n_namespaceObject.__)('Reset the styles to the theme defaults'); 23863 } 23864 if ('unsaved' === id) { 23865 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: author display name */ 23866 (0,external_wp_i18n_namespaceObject.__)('Unsaved changes by %s'), authorDisplayName); 23867 } 23868 return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)( 23869 // translators: 1: author display name. 2: revision creation date. 23870 (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s. This revision matches current editor styles.'), authorDisplayName, formattedModifiedDate) : (0,external_wp_i18n_namespaceObject.sprintf)( 23871 // translators: 1: author display name. 2: revision creation date. 23872 (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s'), authorDisplayName, formattedModifiedDate); 23873 } 23874 23875 /** 23876 * Returns a rendered list of revisions buttons. 23877 * 23878 * @typedef {Object} props 23879 * @property {Array<Object>} userRevisions A collection of user revisions. 23880 * @property {number} selectedRevisionId The id of the currently-selected revision. 23881 * @property {Function} onChange Callback fired when a revision is selected. 23882 * 23883 * @param {props} Component props. 23884 * @return {JSX.Element} The modal component. 23885 */ 23886 function RevisionsButtons({ 23887 userRevisions, 23888 selectedRevisionId, 23889 onChange, 23890 canApplyRevision, 23891 onApplyRevision 23892 }) { 23893 const { 23894 currentThemeName, 23895 currentUser 23896 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23897 const { 23898 getCurrentTheme, 23899 getCurrentUser 23900 } = select(external_wp_coreData_namespaceObject.store); 23901 const currentTheme = getCurrentTheme(); 23902 return { 23903 currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet, 23904 currentUser: getCurrentUser() 23905 }; 23906 }, []); 23907 const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime(); 23908 const { 23909 datetimeAbbreviated 23910 } = (0,external_wp_date_namespaceObject.getSettings)().formats; 23911 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 23912 orientation: "vertical", 23913 className: "edit-site-global-styles-screen-revisions__revisions-list", 23914 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Global styles revisions list'), 23915 role: "listbox", 23916 children: userRevisions.map((revision, index) => { 23917 const { 23918 id, 23919 author, 23920 modified 23921 } = revision; 23922 const isUnsaved = 'unsaved' === id; 23923 // Unsaved changes are created by the current user. 23924 const revisionAuthor = isUnsaved ? currentUser : author; 23925 const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)('User'); 23926 const authorAvatar = revisionAuthor?.avatar_urls?.['48']; 23927 const isFirstItem = index === 0; 23928 const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem; 23929 const areStylesEqual = !canApplyRevision && isSelected; 23930 const isReset = 'parent' === id; 23931 const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified); 23932 const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified); 23933 const revisionLabel = getRevisionLabel(id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual); 23934 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 23935 className: "edit-site-global-styles-screen-revisions__revision-item", 23936 "aria-current": isSelected, 23937 role: "option", 23938 onKeyDown: event => { 23939 const { 23940 keyCode 23941 } = event; 23942 if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) { 23943 onChange(revision); 23944 } 23945 }, 23946 onClick: event => { 23947 event.preventDefault(); 23948 onChange(revision); 23949 }, 23950 "aria-selected": isSelected, 23951 "aria-label": revisionLabel, 23952 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 23953 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23954 className: "edit-site-global-styles-screen-revisions__revision-item-wrapper", 23955 children: isReset ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23956 className: "edit-site-global-styles-screen-revisions__description", 23957 children: [(0,external_wp_i18n_namespaceObject.__)('Default styles'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23958 className: "edit-site-global-styles-screen-revisions__meta", 23959 children: currentThemeName 23960 })] 23961 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23962 className: "edit-site-global-styles-screen-revisions__description", 23963 children: [isUnsaved ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23964 className: "edit-site-global-styles-screen-revisions__date", 23965 children: (0,external_wp_i18n_namespaceObject.__)('(Unsaved)') 23966 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 23967 className: "edit-site-global-styles-screen-revisions__date", 23968 dateTime: modified, 23969 children: displayDate 23970 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23971 className: "edit-site-global-styles-screen-revisions__meta", 23972 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 23973 alt: authorDisplayName, 23974 src: authorAvatar 23975 }), authorDisplayName] 23976 }), isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangesSummary, { 23977 revision: revision, 23978 previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {} 23979 })] 23980 }) 23981 }), isSelected && (areStylesEqual ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 23982 className: "edit-site-global-styles-screen-revisions__applied-text", 23983 children: (0,external_wp_i18n_namespaceObject.__)('These styles are already applied to your site.') 23984 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23985 size: "compact", 23986 variant: "primary", 23987 className: "edit-site-global-styles-screen-revisions__apply-button", 23988 onClick: onApplyRevision, 23989 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Apply the selected revision to your site.'), 23990 children: isReset ? (0,external_wp_i18n_namespaceObject.__)('Reset to defaults') : (0,external_wp_i18n_namespaceObject.__)('Apply') 23991 }))] 23992 }, id); 23993 }) 23994 }); 23995 } 23996 /* harmony default export */ const revisions_buttons = (RevisionsButtons); 23997 23998 ;// ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js 23999 /** 24000 * External dependencies 24001 */ 24002 24003 24004 /** 24005 * WordPress dependencies 24006 */ 24007 24008 24009 24010 24011 function Pagination({ 24012 currentPage, 24013 numPages, 24014 changePage, 24015 totalItems, 24016 className, 24017 disabled = false, 24018 buttonVariant = 'tertiary', 24019 label = (0,external_wp_i18n_namespaceObject.__)('Pagination') 24020 }) { 24021 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 24022 expanded: false, 24023 as: "nav", 24024 "aria-label": label, 24025 spacing: 3, 24026 justify: "flex-start", 24027 className: dist_clsx('edit-site-pagination', className), 24028 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 24029 variant: "muted", 24030 className: "edit-site-pagination__total", 24031 children: 24032 // translators: %s: Total number of patterns. 24033 (0,external_wp_i18n_namespaceObject.sprintf)( 24034 // translators: %s: Total number of patterns. 24035 (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems) 24036 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 24037 expanded: false, 24038 spacing: 1, 24039 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24040 variant: buttonVariant, 24041 onClick: () => changePage(1), 24042 accessibleWhenDisabled: true, 24043 disabled: disabled || currentPage === 1, 24044 label: (0,external_wp_i18n_namespaceObject.__)('First page'), 24045 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 24046 size: "compact" 24047 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24048 variant: buttonVariant, 24049 onClick: () => changePage(currentPage - 1), 24050 accessibleWhenDisabled: true, 24051 disabled: disabled || currentPage === 1, 24052 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 24053 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 24054 size: "compact" 24055 })] 24056 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 24057 variant: "muted", 24058 children: (0,external_wp_i18n_namespaceObject.sprintf)( 24059 // translators: 1: Current page number. 2: Total number of pages. 24060 (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages) 24061 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 24062 expanded: false, 24063 spacing: 1, 24064 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24065 variant: buttonVariant, 24066 onClick: () => changePage(currentPage + 1), 24067 accessibleWhenDisabled: true, 24068 disabled: disabled || currentPage === numPages, 24069 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 24070 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, 24071 size: "compact" 24072 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24073 variant: buttonVariant, 24074 onClick: () => changePage(numPages), 24075 accessibleWhenDisabled: true, 24076 disabled: disabled || currentPage === numPages, 24077 label: (0,external_wp_i18n_namespaceObject.__)('Last page'), 24078 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 24079 size: "compact" 24080 })] 24081 })] 24082 }); 24083 } 24084 24085 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js 24086 /** 24087 * WordPress dependencies 24088 */ 24089 24090 24091 24092 24093 24094 24095 /** 24096 * Internal dependencies 24097 */ 24098 24099 24100 24101 24102 24103 24104 24105 24106 24107 const { 24108 GlobalStylesContext: screen_revisions_GlobalStylesContext, 24109 areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual 24110 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 24111 const PAGE_SIZE = 10; 24112 function ScreenRevisions() { 24113 const { 24114 user: currentEditorGlobalStyles, 24115 setUserConfig 24116 } = (0,external_wp_element_namespaceObject.useContext)(screen_revisions_GlobalStylesContext); 24117 const { 24118 blocks, 24119 editorCanvasContainerView 24120 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 24121 editorCanvasContainerView: unlock(select(store)).getEditorCanvasContainerView(), 24122 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() 24123 }), []); 24124 const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); 24125 const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_namespaceObject.useState)([]); 24126 const { 24127 revisions, 24128 isLoading, 24129 hasUnsavedChanges, 24130 revisionsCount 24131 } = useGlobalStylesRevisions({ 24132 query: { 24133 per_page: PAGE_SIZE, 24134 page: currentPage 24135 } 24136 }); 24137 const numPages = Math.ceil(revisionsCount / PAGE_SIZE); 24138 const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_namespaceObject.useState)(currentEditorGlobalStyles); 24139 const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = (0,external_wp_element_namespaceObject.useState)(false); 24140 const { 24141 setEditorCanvasContainerView 24142 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24143 const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(currentlySelectedRevision, currentEditorGlobalStyles); 24144 24145 // The actual code that triggers the revisions screen to navigate back 24146 // to the home screen in in `packages/edit-site/src/components/global-styles/ui.js`. 24147 const onCloseRevisions = () => { 24148 const canvasContainerView = editorCanvasContainerView === 'global-styles-revisions:style-book' ? 'style-book' : undefined; 24149 setEditorCanvasContainerView(canvasContainerView); 24150 }; 24151 const restoreRevision = revision => { 24152 setUserConfig(() => revision); 24153 setIsLoadingRevisionWithUnsavedChanges(false); 24154 onCloseRevisions(); 24155 }; 24156 (0,external_wp_element_namespaceObject.useEffect)(() => { 24157 if (!isLoading && revisions.length) { 24158 setCurrentRevisions(revisions); 24159 } 24160 }, [revisions, isLoading]); 24161 const firstRevision = revisions[0]; 24162 const currentlySelectedRevisionId = currentlySelectedRevision?.id; 24163 const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId; 24164 (0,external_wp_element_namespaceObject.useEffect)(() => { 24165 /* 24166 * Ensure that the first item is selected and loaded into the preview pane 24167 * when no revision is selected and the selected styles don't match the current editor styles. 24168 * This is required in case editor styles are changed outside the revisions panel, 24169 * e.g., via the reset styles function of useGlobalStylesReset(). 24170 * See: https://github.com/WordPress/gutenberg/issues/55866 24171 */ 24172 if (shouldSelectFirstItem) { 24173 setCurrentlySelectedRevision(firstRevision); 24174 } 24175 }, [shouldSelectFirstItem, firstRevision]); 24176 24177 // Only display load button if there is a revision to load, 24178 // and it is different from the current editor styles. 24179 const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== 'unsaved' && !selectedRevisionMatchesEditorStyles; 24180 const hasRevisions = !!currentRevisions.length; 24181 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24182 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 24183 title: revisionsCount && 24184 // translators: %s: number of revisions. 24185 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount), 24186 description: (0,external_wp_i18n_namespaceObject.__)('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.'), 24187 onBack: onCloseRevisions 24188 }), !hasRevisions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 24189 className: "edit-site-global-styles-screen-revisions__loading" 24190 }), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 24191 userConfig: currentlySelectedRevision, 24192 isSelected: () => {}, 24193 onClose: () => { 24194 setEditorCanvasContainerView('global-styles-revisions'); 24195 } 24196 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_revisions, { 24197 blocks: blocks, 24198 userConfig: currentlySelectedRevision, 24199 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions') 24200 })), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(revisions_buttons, { 24201 onChange: setCurrentlySelectedRevision, 24202 selectedRevisionId: currentlySelectedRevisionId, 24203 userRevisions: currentRevisions, 24204 canApplyRevision: isLoadButtonEnabled, 24205 onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision) 24206 }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 24207 className: "edit-site-global-styles-screen-revisions__footer", 24208 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { 24209 className: "edit-site-global-styles-screen-revisions__pagination", 24210 currentPage: currentPage, 24211 numPages: numPages, 24212 changePage: setCurrentPage, 24213 totalItems: revisionsCount, 24214 disabled: isLoading, 24215 label: (0,external_wp_i18n_namespaceObject.__)('Global Styles pagination') 24216 }) 24217 }), isLoadingRevisionWithUnsavedChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 24218 isOpen: isLoadingRevisionWithUnsavedChanges, 24219 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Apply'), 24220 onConfirm: () => restoreRevision(currentlySelectedRevision), 24221 onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false), 24222 size: "medium", 24223 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to apply this revision? Any unsaved changes will be lost.') 24224 })] 24225 }); 24226 } 24227 /* harmony default export */ const screen_revisions = (ScreenRevisions); 24228 24229 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js 24230 /* wp:polyfill */ 24231 /** 24232 * WordPress dependencies 24233 */ 24234 24235 24236 24237 24238 24239 24240 24241 24242 24243 24244 24245 /** 24246 * Internal dependencies 24247 */ 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 24260 24261 24262 24263 24264 24265 24266 24267 24268 const SLOT_FILL_NAME = 'GlobalStylesMenu'; 24269 const { 24270 useGlobalStylesReset: ui_useGlobalStylesReset 24271 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 24272 const { 24273 Slot: GlobalStylesMenuSlot, 24274 Fill: GlobalStylesMenuFill 24275 } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME); 24276 function GlobalStylesActionMenu() { 24277 const [canReset, onReset] = ui_useGlobalStylesReset(); 24278 const { 24279 toggle 24280 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 24281 const { 24282 canEditCSS 24283 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24284 const { 24285 getEntityRecord, 24286 __experimentalGetCurrentGlobalStylesId 24287 } = select(external_wp_coreData_namespaceObject.store); 24288 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 24289 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 24290 return { 24291 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 24292 }; 24293 }, []); 24294 const { 24295 setEditorCanvasContainerView 24296 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24297 const loadCustomCSS = () => { 24298 setEditorCanvasContainerView('global-styles-css'); 24299 }; 24300 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { 24301 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 24302 icon: more_vertical, 24303 label: (0,external_wp_i18n_namespaceObject.__)('More'), 24304 toggleProps: { 24305 size: 'compact' 24306 }, 24307 children: ({ 24308 onClose 24309 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24310 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 24311 children: [canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24312 onClick: loadCustomCSS, 24313 children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') 24314 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24315 onClick: () => { 24316 toggle('core/edit-site', 'welcomeGuideStyles'); 24317 onClose(); 24318 }, 24319 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 24320 })] 24321 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 24322 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24323 onClick: () => { 24324 onReset(); 24325 onClose(); 24326 }, 24327 disabled: !canReset, 24328 children: (0,external_wp_i18n_namespaceObject.__)('Reset styles') 24329 }) 24330 })] 24331 }) 24332 }) 24333 }); 24334 } 24335 function GlobalStylesNavigationScreen({ 24336 className, 24337 ...props 24338 }) { 24339 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { 24340 className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' '), 24341 ...props 24342 }); 24343 } 24344 function BlockStylesNavigationScreens({ 24345 parentMenu, 24346 blockStyles, 24347 blockName 24348 }) { 24349 return blockStyles.map((style, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24350 path: parentMenu + '/variations/' + style.name, 24351 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 24352 name: blockName, 24353 variation: style.name 24354 }) 24355 }, index)); 24356 } 24357 function ContextScreens({ 24358 name, 24359 parentMenu = '' 24360 }) { 24361 const blockStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => { 24362 const { 24363 getBlockStyles 24364 } = select(external_wp_blocks_namespaceObject.store); 24365 return getBlockStyles(name); 24366 }, [name]); 24367 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24368 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24369 path: parentMenu + '/colors/palette', 24370 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette, { 24371 name: name 24372 }) 24373 }), !!blockStyleVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesNavigationScreens, { 24374 parentMenu: parentMenu, 24375 blockStyles: blockStyleVariations, 24376 blockName: name 24377 })] 24378 }); 24379 } 24380 function GlobalStylesStyleBook() { 24381 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 24382 const { 24383 path 24384 } = navigator.location; 24385 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 24386 isSelected: blockName => 24387 // Match '/blocks/core%2Fbutton' and 24388 // '/blocks/core%2Fbutton/typography', but not 24389 // '/blocks/core%2Fbuttons'. 24390 path === `/blocks/$encodeURIComponent(blockName)}` || path.startsWith(`/blocks/$encodeURIComponent(blockName)}/`), 24391 onSelect: blockName => { 24392 if (STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) { 24393 // Go to color palettes Global Styles. 24394 navigator.goTo('/colors/palette'); 24395 return; 24396 } 24397 if (blockName === 'typography') { 24398 // Go to typography Global Styles. 24399 navigator.goTo('/typography'); 24400 return; 24401 } 24402 24403 // Now go to the selected block. 24404 navigator.goTo('/blocks/' + encodeURIComponent(blockName)); 24405 } 24406 }); 24407 } 24408 function GlobalStylesBlockLink() { 24409 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 24410 const { 24411 selectedBlockName, 24412 selectedBlockClientId 24413 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24414 const { 24415 getSelectedBlockClientId, 24416 getBlockName 24417 } = select(external_wp_blockEditor_namespaceObject.store); 24418 const clientId = getSelectedBlockClientId(); 24419 return { 24420 selectedBlockName: getBlockName(clientId), 24421 selectedBlockClientId: clientId 24422 }; 24423 }, []); 24424 const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName); 24425 // When we're in the `Blocks` screen enable deep linking to the selected block. 24426 (0,external_wp_element_namespaceObject.useEffect)(() => { 24427 if (!selectedBlockClientId || !blockHasGlobalStyles) { 24428 return; 24429 } 24430 const currentPath = navigator.location.path; 24431 if (currentPath !== '/blocks' && !currentPath.startsWith('/blocks/')) { 24432 return; 24433 } 24434 const newPath = '/blocks/' + encodeURIComponent(selectedBlockName); 24435 // Avoid navigating to the same path. This can happen when selecting 24436 // a new block of the same type. 24437 if (newPath !== currentPath) { 24438 navigator.goTo(newPath, { 24439 skipFocus: true 24440 }); 24441 } 24442 }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]); 24443 } 24444 function GlobalStylesEditorCanvasContainerLink() { 24445 const { 24446 goTo, 24447 location 24448 } = (0,external_wp_components_namespaceObject.useNavigator)(); 24449 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 24450 const path = location?.path; 24451 const isRevisionsOpen = path === '/revisions'; 24452 24453 // If the user switches the editor canvas container view, redirect 24454 // to the appropriate screen. This effectively allows deep linking to the 24455 // desired screens from outside the global styles navigation provider. 24456 (0,external_wp_element_namespaceObject.useEffect)(() => { 24457 switch (editorCanvasContainerView) { 24458 case 'global-styles-revisions': 24459 case 'global-styles-revisions:style-book': 24460 if (!isRevisionsOpen) { 24461 goTo('/revisions'); 24462 } 24463 break; 24464 case 'global-styles-css': 24465 goTo('/css'); 24466 break; 24467 // The stand-alone style book is open 24468 // and the revisions panel is open, 24469 // close the revisions panel. 24470 // Otherwise keep the style book open while 24471 // browsing global styles panel. 24472 // 24473 // Falling through as it matches the default scenario. 24474 case 'style-book': 24475 default: 24476 // In general, if the revision screen is in view but the 24477 // `editorCanvasContainerView` is not a revision view, close it. 24478 // This also includes the scenario when the stand-alone style 24479 // book is open, in which case we want the user to close the 24480 // revisions screen and browse global styles. 24481 if (isRevisionsOpen) { 24482 goTo('/', { 24483 isBack: true 24484 }); 24485 } 24486 break; 24487 } 24488 }, [editorCanvasContainerView, isRevisionsOpen, goTo]); 24489 } 24490 function useNavigatorSync(parentPath, onPathChange) { 24491 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 24492 const { 24493 path: childPath 24494 } = navigator.location; 24495 const previousParentPath = (0,external_wp_compose_namespaceObject.usePrevious)(parentPath); 24496 const previousChildPath = (0,external_wp_compose_namespaceObject.usePrevious)(childPath); 24497 (0,external_wp_element_namespaceObject.useEffect)(() => { 24498 if (parentPath !== childPath) { 24499 if (parentPath !== previousParentPath) { 24500 navigator.goTo(parentPath); 24501 } else if (childPath !== previousChildPath) { 24502 onPathChange(childPath); 24503 } 24504 } 24505 }, [onPathChange, parentPath, previousChildPath, previousParentPath, childPath, navigator]); 24506 } 24507 24508 // This component is used to wrap the hook in order to conditionally execute it 24509 // when the parent component is used on controlled mode. 24510 function NavigationSync({ 24511 path: parentPath, 24512 onPathChange, 24513 children 24514 }) { 24515 useNavigatorSync(parentPath, onPathChange); 24516 return children; 24517 } 24518 function GlobalStylesUI({ 24519 path, 24520 onPathChange 24521 }) { 24522 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); 24523 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 24524 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { 24525 className: "edit-site-global-styles-sidebar__navigator-provider", 24526 initialPath: "/", 24527 children: [path && onPathChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSync, { 24528 path: path, 24529 onPathChange: onPathChange 24530 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24531 path: "/", 24532 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root, {}) 24533 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24534 path: "/variations", 24535 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations, {}) 24536 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24537 path: "/blocks", 24538 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list, {}) 24539 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24540 path: "/typography", 24541 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography, {}) 24542 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24543 path: "/typography/font-sizes", 24544 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes, {}) 24545 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24546 path: "/typography/font-sizes/:origin/:slug", 24547 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size, {}) 24548 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24549 path: "/typography/text", 24550 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24551 element: "text" 24552 }) 24553 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24554 path: "/typography/link", 24555 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24556 element: "link" 24557 }) 24558 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24559 path: "/typography/heading", 24560 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24561 element: "heading" 24562 }) 24563 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24564 path: "/typography/caption", 24565 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24566 element: "caption" 24567 }) 24568 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24569 path: "/typography/button", 24570 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24571 element: "button" 24572 }) 24573 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24574 path: "/colors", 24575 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors, {}) 24576 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24577 path: "/shadows", 24578 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) 24579 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24580 path: "/shadows/edit/:category/:slug", 24581 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) 24582 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24583 path: "/layout", 24584 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout, {}) 24585 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24586 path: "/css", 24587 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css, {}) 24588 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24589 path: "/revisions", 24590 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions, {}) 24591 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24592 path: "/background", 24593 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background, {}) 24594 }), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24595 path: '/blocks/' + encodeURIComponent(block.name), 24596 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 24597 name: block.name 24598 }) 24599 }, 'menu-block-' + block.name)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, { 24600 name: block.name, 24601 parentMenu: '/blocks/' + encodeURIComponent(block.name) 24602 }, 'screens-block-' + block.name)), 'style-book' === editorCanvasContainerView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {})] 24603 }); 24604 } 24605 24606 /* harmony default export */ const global_styles_ui = (GlobalStylesUI); 24607 24608 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js 24609 24610 24611 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js 24612 /** 24613 * WordPress dependencies 24614 */ 24615 24616 24617 /** 24618 * Internal dependencies 24619 */ 24620 24621 24622 const { 24623 ComplementaryArea, 24624 ComplementaryAreaMoreMenuItem 24625 } = unlock(external_wp_editor_namespaceObject.privateApis); 24626 function DefaultSidebar({ 24627 className, 24628 identifier, 24629 title, 24630 icon, 24631 children, 24632 closeLabel, 24633 header, 24634 headerClassName, 24635 panelClassName, 24636 isActiveByDefault 24637 }) { 24638 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24639 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryArea, { 24640 className: className, 24641 scope: "core", 24642 identifier: identifier, 24643 title: title, 24644 icon: icon, 24645 closeLabel: closeLabel, 24646 header: header, 24647 headerClassName: headerClassName, 24648 panelClassName: panelClassName, 24649 isActiveByDefault: isActiveByDefault, 24650 children: children 24651 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { 24652 scope: "core", 24653 identifier: identifier, 24654 icon: icon, 24655 children: title 24656 })] 24657 }); 24658 } 24659 24660 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js 24661 /** 24662 * WordPress dependencies 24663 */ 24664 24665 24666 24667 24668 24669 24670 24671 24672 24673 24674 /** 24675 * Internal dependencies 24676 */ 24677 24678 24679 24680 24681 24682 24683 24684 const { 24685 interfaceStore: global_styles_sidebar_interfaceStore 24686 } = unlock(external_wp_editor_namespaceObject.privateApis); 24687 const { 24688 useLocation: global_styles_sidebar_useLocation 24689 } = unlock(external_wp_router_namespaceObject.privateApis); 24690 function GlobalStylesSidebar() { 24691 const { 24692 query 24693 } = global_styles_sidebar_useLocation(); 24694 const { 24695 canvas = 'view', 24696 name 24697 } = query; 24698 const { 24699 shouldClearCanvasContainerView, 24700 isStyleBookOpened, 24701 showListViewByDefault, 24702 hasRevisions, 24703 isRevisionsOpened, 24704 isRevisionsStyleBookOpened 24705 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24706 const { 24707 getActiveComplementaryArea 24708 } = select(global_styles_sidebar_interfaceStore); 24709 const { 24710 getEditorCanvasContainerView 24711 } = unlock(select(store)); 24712 const canvasContainerView = getEditorCanvasContainerView(); 24713 const _isVisualEditorMode = 'visual' === select(external_wp_editor_namespaceObject.store).getEditorMode(); 24714 const _isEditCanvasMode = 'edit' === canvas; 24715 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 24716 const { 24717 getEntityRecord, 24718 __experimentalGetCurrentGlobalStylesId 24719 } = select(external_wp_coreData_namespaceObject.store); 24720 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 24721 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 24722 return { 24723 isStyleBookOpened: 'style-book' === canvasContainerView, 24724 shouldClearCanvasContainerView: 'edit-site/global-styles' !== getActiveComplementaryArea('core') || !_isVisualEditorMode || !_isEditCanvasMode, 24725 showListViewByDefault: _showListViewByDefault, 24726 hasRevisions: !!globalStyles?._links?.['version-history']?.[0]?.count, 24727 isRevisionsStyleBookOpened: 'global-styles-revisions:style-book' === canvasContainerView, 24728 isRevisionsOpened: 'global-styles-revisions' === canvasContainerView 24729 }; 24730 }, [canvas]); 24731 const { 24732 setEditorCanvasContainerView 24733 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24734 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 24735 (0,external_wp_element_namespaceObject.useEffect)(() => { 24736 if (shouldClearCanvasContainerView) { 24737 setEditorCanvasContainerView(undefined); 24738 } 24739 }, [shouldClearCanvasContainerView, setEditorCanvasContainerView]); 24740 const { 24741 setIsListViewOpened 24742 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 24743 const toggleRevisions = () => { 24744 setIsListViewOpened(false); 24745 if (isRevisionsStyleBookOpened) { 24746 setEditorCanvasContainerView('style-book'); 24747 return; 24748 } 24749 if (isRevisionsOpened) { 24750 setEditorCanvasContainerView(undefined); 24751 return; 24752 } 24753 if (isStyleBookOpened) { 24754 setEditorCanvasContainerView('global-styles-revisions:style-book'); 24755 } else { 24756 setEditorCanvasContainerView('global-styles-revisions'); 24757 } 24758 }; 24759 const toggleStyleBook = () => { 24760 if (isRevisionsOpened) { 24761 setEditorCanvasContainerView('global-styles-revisions:style-book'); 24762 return; 24763 } 24764 if (isRevisionsStyleBookOpened) { 24765 setEditorCanvasContainerView('global-styles-revisions'); 24766 return; 24767 } 24768 setIsListViewOpened(isStyleBookOpened && showListViewByDefault); 24769 setEditorCanvasContainerView(isStyleBookOpened ? undefined : 'style-book'); 24770 }; 24771 const { 24772 getActiveComplementaryArea 24773 } = (0,external_wp_data_namespaceObject.useSelect)(global_styles_sidebar_interfaceStore); 24774 const { 24775 enableComplementaryArea 24776 } = (0,external_wp_data_namespaceObject.useDispatch)(global_styles_sidebar_interfaceStore); 24777 const previousActiveAreaRef = (0,external_wp_element_namespaceObject.useRef)(null); 24778 (0,external_wp_element_namespaceObject.useEffect)(() => { 24779 if (name === 'styles' && canvas === 'edit') { 24780 previousActiveAreaRef.current = getActiveComplementaryArea('core'); 24781 enableComplementaryArea('core', 'edit-site/global-styles'); 24782 } else if (previousActiveAreaRef.current) { 24783 enableComplementaryArea('core', previousActiveAreaRef.current); 24784 } 24785 }, [name, enableComplementaryArea, canvas, getActiveComplementaryArea]); 24786 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultSidebar, { 24787 className: "edit-site-global-styles-sidebar", 24788 identifier: "edit-site/global-styles", 24789 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 24790 icon: library_styles, 24791 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Styles'), 24792 panelClassName: "edit-site-global-styles-sidebar__panel", 24793 header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 24794 className: "edit-site-global-styles-sidebar__header", 24795 gap: 1, 24796 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24797 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 24798 className: "edit-site-global-styles-sidebar__header-title", 24799 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 24800 }) 24801 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 24802 justify: "flex-end", 24803 gap: 1, 24804 className: "edit-site-global-styles-sidebar__header-actions", 24805 children: [!isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24806 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24807 icon: library_seen, 24808 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 24809 isPressed: isStyleBookOpened || isRevisionsStyleBookOpened, 24810 accessibleWhenDisabled: true, 24811 disabled: shouldClearCanvasContainerView, 24812 onClick: toggleStyleBook, 24813 size: "compact" 24814 }) 24815 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24816 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24817 label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 24818 icon: library_backup, 24819 onClick: toggleRevisions, 24820 accessibleWhenDisabled: true, 24821 disabled: !hasRevisions, 24822 isPressed: isRevisionsOpened || isRevisionsStyleBookOpened, 24823 size: "compact" 24824 }) 24825 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})] 24826 })] 24827 }), 24828 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, {}) 24829 }); 24830 } 24831 24832 ;// ./node_modules/@wordpress/icons/build-module/library/download.js 24833 /** 24834 * WordPress dependencies 24835 */ 24836 24837 24838 const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 24839 xmlns: "http://www.w3.org/2000/svg", 24840 viewBox: "0 0 24 24", 24841 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 24842 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" 24843 }) 24844 }); 24845 /* harmony default export */ const library_download = (download); 24846 24847 ;// external ["wp","blob"] 24848 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 24849 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js 24850 /** 24851 * WordPress dependencies 24852 */ 24853 24854 24855 24856 24857 24858 24859 24860 24861 function SiteExport() { 24862 const { 24863 createErrorNotice 24864 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24865 async function handleExport() { 24866 try { 24867 const response = await external_wp_apiFetch_default()({ 24868 path: '/wp-block-editor/v1/export', 24869 parse: false, 24870 headers: { 24871 Accept: 'application/zip' 24872 } 24873 }); 24874 const blob = await response.blob(); 24875 const contentDisposition = response.headers.get('content-disposition'); 24876 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); 24877 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export'; 24878 (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + '.zip', blob, 'application/zip'); 24879 } catch (errorResponse) { 24880 let error = {}; 24881 try { 24882 error = await errorResponse.json(); 24883 } catch (e) {} 24884 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); 24885 createErrorNotice(errorMessage, { 24886 type: 'snackbar' 24887 }); 24888 } 24889 } 24890 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24891 role: "menuitem", 24892 icon: library_download, 24893 onClick: handleExport, 24894 info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.'), 24895 children: (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item') 24896 }); 24897 } 24898 24899 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js 24900 /** 24901 * WordPress dependencies 24902 */ 24903 24904 24905 24906 24907 24908 function WelcomeGuideMenuItem() { 24909 const { 24910 toggle 24911 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 24912 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24913 onClick: () => toggle('core/edit-site', 'welcomeGuide'), 24914 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 24915 }); 24916 } 24917 24918 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js 24919 /** 24920 * WordPress dependencies 24921 */ 24922 24923 24924 24925 24926 /** 24927 * Internal dependencies 24928 */ 24929 24930 24931 24932 24933 const { 24934 ToolsMoreMenuGroup, 24935 PreferencesModal 24936 } = unlock(external_wp_editor_namespaceObject.privateApis); 24937 function MoreMenu() { 24938 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 24939 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 24940 }, []); 24941 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24942 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { 24943 children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})] 24944 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})] 24945 }); 24946 } 24947 24948 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js 24949 /** 24950 * External dependencies 24951 */ 24952 24953 24954 /** 24955 * WordPress dependencies 24956 */ 24957 24958 24959 24960 24961 24962 24963 24964 24965 /** 24966 * Internal dependencies 24967 */ 24968 24969 const { 24970 useLocation: use_editor_iframe_props_useLocation, 24971 useHistory: use_editor_iframe_props_useHistory 24972 } = unlock(external_wp_router_namespaceObject.privateApis); 24973 function useEditorIframeProps() { 24974 const { 24975 query, 24976 path 24977 } = use_editor_iframe_props_useLocation(); 24978 const history = use_editor_iframe_props_useHistory(); 24979 const { 24980 canvas = 'view' 24981 } = query; 24982 const currentPostIsTrashed = (0,external_wp_data_namespaceObject.useSelect)(select => { 24983 return select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash'; 24984 }, []); 24985 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 24986 (0,external_wp_element_namespaceObject.useEffect)(() => { 24987 if (canvas === 'edit') { 24988 setIsFocused(false); 24989 } 24990 }, [canvas]); 24991 24992 // In view mode, make the canvas iframe be perceived and behave as a button 24993 // to switch to edit mode, with a meaningful label and no title attribute. 24994 const viewModeIframeProps = { 24995 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Edit'), 24996 'aria-disabled': currentPostIsTrashed, 24997 title: null, 24998 role: 'button', 24999 tabIndex: 0, 25000 onFocus: () => setIsFocused(true), 25001 onBlur: () => setIsFocused(false), 25002 onKeyDown: event => { 25003 const { 25004 keyCode 25005 } = event; 25006 if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) { 25007 event.preventDefault(); 25008 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 25009 canvas: 'edit' 25010 }), { 25011 transition: 'canvas-mode-edit-transition' 25012 }); 25013 } 25014 }, 25015 onClick: () => history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 25016 canvas: 'edit' 25017 }), { 25018 transition: 'canvas-mode-edit-transition' 25019 }), 25020 onClickCapture: event => { 25021 if (currentPostIsTrashed) { 25022 event.preventDefault(); 25023 event.stopPropagation(); 25024 } 25025 }, 25026 readonly: true 25027 }; 25028 return { 25029 className: dist_clsx('edit-site-visual-editor__editor-canvas', { 25030 'is-focused': isFocused && canvas === 'view' 25031 }), 25032 ...(canvas === 'view' ? viewModeIframeProps : {}) 25033 }; 25034 } 25035 25036 ;// ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js 25037 /** 25038 * WordPress dependencies 25039 */ 25040 25041 25042 25043 25044 25045 25046 25047 25048 /** 25049 * Internal dependencies 25050 */ 25051 25052 const { 25053 useLocation: use_title_useLocation 25054 } = unlock(external_wp_router_namespaceObject.privateApis); 25055 function useTitle(title) { 25056 const location = use_title_useLocation(); 25057 const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')?.title, []); 25058 const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); 25059 (0,external_wp_element_namespaceObject.useEffect)(() => { 25060 isInitialLocationRef.current = false; 25061 }, [location]); 25062 (0,external_wp_element_namespaceObject.useEffect)(() => { 25063 // Don't update or announce the title for initial page load. 25064 if (isInitialLocationRef.current) { 25065 return; 25066 } 25067 if (title && siteTitle) { 25068 // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 25069 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ 25070 (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s ‹ Editor — WordPress'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)); 25071 document.title = formattedTitle; 25072 25073 // Announce title on route change for screen readers. 25074 (0,external_wp_a11y_namespaceObject.speak)(title, 'assertive'); 25075 } 25076 }, [title, siteTitle, location]); 25077 } 25078 25079 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js 25080 /** 25081 * WordPress dependencies 25082 */ 25083 25084 25085 25086 25087 25088 25089 /** 25090 * Internal dependencies 25091 */ 25092 25093 25094 25095 const { 25096 getTemplateInfo 25097 } = unlock(external_wp_editor_namespaceObject.privateApis); 25098 function useEditorTitle(postType, postId) { 25099 const { 25100 title, 25101 isLoaded 25102 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25103 var _select$getEntityReco; 25104 const { 25105 getEditedEntityRecord, 25106 hasFinishedResolution 25107 } = select(external_wp_coreData_namespaceObject.store); 25108 if (!postId) { 25109 return { 25110 isLoaded: false 25111 }; 25112 } 25113 const _record = getEditedEntityRecord('postType', postType, postId); 25114 const { 25115 default_template_types: templateTypes = [] 25116 } = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : {}; 25117 const templateInfo = getTemplateInfo({ 25118 template: _record, 25119 templateTypes 25120 }); 25121 const _isLoaded = hasFinishedResolution('getEditedEntityRecord', ['postType', postType, postId]); 25122 return { 25123 title: templateInfo.title, 25124 isLoaded: _isLoaded 25125 }; 25126 }, [postType, postId]); 25127 let editorTitle; 25128 if (isLoaded) { 25129 var _POST_TYPE_LABELS$pos; 25130 editorTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 25131 // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part). 25132 (0,external_wp_i18n_namespaceObject._x)('%1$s ‹ %2$s', 'breadcrumb trail'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (_POST_TYPE_LABELS$pos = POST_TYPE_LABELS[postType]) !== null && _POST_TYPE_LABELS$pos !== void 0 ? _POST_TYPE_LABELS$pos : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]); 25133 } 25134 25135 // Only announce the title once the editor is ready to prevent "Replace" 25136 // action in <URLQueryController> from double-announcing. 25137 useTitle(isLoaded && editorTitle); 25138 } 25139 /* harmony default export */ const use_editor_title = (useEditorTitle); 25140 25141 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.js 25142 /** 25143 * WordPress dependencies 25144 */ 25145 25146 25147 25148 25149 25150 function useAdaptEditorToCanvas(canvas) { 25151 const { 25152 clearSelectedBlock 25153 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 25154 const { 25155 setDeviceType, 25156 closePublishSidebar, 25157 setIsListViewOpened, 25158 setIsInserterOpened 25159 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 25160 const { 25161 get: getPreference 25162 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 25163 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 25164 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 25165 const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches; 25166 registry.batch(() => { 25167 clearSelectedBlock(); 25168 setDeviceType('Desktop'); 25169 closePublishSidebar(); 25170 setIsInserterOpened(false); 25171 25172 // Check if the block list view should be open by default. 25173 // If `distractionFree` mode is enabled, the block list view should not be open. 25174 // This behavior is disabled for small viewports. 25175 if (isMediumOrBigger && canvas === 'edit' && getPreference('core', 'showListViewByDefault') && !getPreference('core', 'distractionFree')) { 25176 setIsListViewOpened(true); 25177 } else { 25178 setIsListViewOpened(false); 25179 } 25180 }); 25181 }, [canvas, registry, clearSelectedBlock, setDeviceType, closePublishSidebar, setIsInserterOpened, setIsListViewOpened, getPreference]); 25182 } 25183 25184 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-resolve-edited-entity.js 25185 /** 25186 * WordPress dependencies 25187 */ 25188 25189 25190 25191 25192 25193 /** 25194 * Internal dependencies 25195 */ 25196 25197 25198 25199 const { 25200 useLocation: use_resolve_edited_entity_useLocation 25201 } = unlock(external_wp_router_namespaceObject.privateApis); 25202 const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; 25203 const authorizedPostTypes = ['page', 'post']; 25204 function useResolveEditedEntity() { 25205 const { 25206 name, 25207 params = {}, 25208 query 25209 } = use_resolve_edited_entity_useLocation(); 25210 const { 25211 postId = query?.postId 25212 } = params; // Fallback to query param for postId for list view routes. 25213 let postType; 25214 if (name === 'navigation-item') { 25215 postType = NAVIGATION_POST_TYPE; 25216 } else if (name === 'pattern-item') { 25217 postType = PATTERN_TYPES.user; 25218 } else if (name === 'template-part-item') { 25219 postType = TEMPLATE_PART_POST_TYPE; 25220 } else if (name === 'template-item' || name === 'templates') { 25221 postType = TEMPLATE_POST_TYPE; 25222 } else if (name === 'page-item' || name === 'pages') { 25223 postType = 'page'; 25224 } else if (name === 'post-item' || name === 'posts') { 25225 postType = 'post'; 25226 } 25227 const homePage = (0,external_wp_data_namespaceObject.useSelect)(select => { 25228 const { 25229 getHomePage 25230 } = unlock(select(external_wp_coreData_namespaceObject.store)); 25231 return getHomePage(); 25232 }, []); 25233 25234 /** 25235 * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId 25236 * in order to match the frontend as closely as possible in the site editor. 25237 * 25238 * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution. 25239 */ 25240 const resolvedTemplateId = (0,external_wp_data_namespaceObject.useSelect)(select => { 25241 // If we're rendering a post type that doesn't have a template 25242 // no need to resolve its template. 25243 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 25244 return; 25245 } 25246 25247 // Don't trigger resolution for multi-selected posts. 25248 if (postId && postId.includes(',')) { 25249 return; 25250 } 25251 const { 25252 getTemplateId 25253 } = unlock(select(external_wp_coreData_namespaceObject.store)); 25254 25255 // If we're rendering a specific page, we need to resolve its template. 25256 // The site editor only supports pages for now, not other CPTs. 25257 if (postType && postId && authorizedPostTypes.includes(postType)) { 25258 return getTemplateId(postType, postId); 25259 } 25260 25261 // If we're rendering the home page, and we have a static home page, resolve its template. 25262 if (homePage?.postType === 'page') { 25263 return getTemplateId('page', homePage?.postId); 25264 } 25265 if (homePage?.postType === 'wp_template') { 25266 return homePage?.postId; 25267 } 25268 }, [homePage, postId, postType]); 25269 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 25270 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 25271 return {}; 25272 } 25273 if (postType && postId && authorizedPostTypes.includes(postType)) { 25274 return { 25275 postType, 25276 postId 25277 }; 25278 } 25279 // TODO: for post types lists we should probably not render the front page, but maybe a placeholder 25280 // with a message like "Select a page" or something similar. 25281 if (homePage?.postType === 'page') { 25282 return { 25283 postType: 'page', 25284 postId: homePage?.postId 25285 }; 25286 } 25287 return {}; 25288 }, [homePage, postType, postId]); 25289 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 25290 return { 25291 isReady: true, 25292 postType, 25293 postId, 25294 context 25295 }; 25296 } 25297 if (!!homePage) { 25298 return { 25299 isReady: resolvedTemplateId !== undefined, 25300 postType: TEMPLATE_POST_TYPE, 25301 postId: resolvedTemplateId, 25302 context 25303 }; 25304 } 25305 return { 25306 isReady: false 25307 }; 25308 } 25309 function useSyncDeprecatedEntityIntoState({ 25310 postType, 25311 postId, 25312 context, 25313 isReady 25314 }) { 25315 const { 25316 setEditedEntity 25317 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 25318 (0,external_wp_element_namespaceObject.useEffect)(() => { 25319 if (isReady) { 25320 setEditedEntity(postType, postId, context); 25321 } 25322 }, [isReady, postType, postId, context, setEditedEntity]); 25323 } 25324 25325 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js 25326 /** 25327 * External dependencies 25328 */ 25329 25330 25331 /** 25332 * WordPress dependencies 25333 */ 25334 25335 25336 25337 25338 25339 25340 25341 25342 25343 25344 25345 25346 25347 25348 /** 25349 * Internal dependencies 25350 */ 25351 25352 25353 25354 25355 25356 25357 25358 25359 25360 25361 25362 25363 25364 25365 25366 25367 25368 25369 25370 25371 25372 25373 const { 25374 Editor, 25375 BackButton 25376 } = unlock(external_wp_editor_namespaceObject.privateApis); 25377 const { 25378 useHistory: editor_useHistory, 25379 useLocation: editor_useLocation 25380 } = unlock(external_wp_router_namespaceObject.privateApis); 25381 const { 25382 BlockKeyboardShortcuts 25383 } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); 25384 const toggleHomeIconVariants = { 25385 edit: { 25386 opacity: 0, 25387 scale: 0.2 25388 }, 25389 hover: { 25390 opacity: 1, 25391 scale: 1, 25392 clipPath: 'inset( 22% round 2px )' 25393 } 25394 }; 25395 const siteIconVariants = { 25396 edit: { 25397 clipPath: 'inset(0% round 0px)' 25398 }, 25399 hover: { 25400 clipPath: 'inset( 22% round 2px )' 25401 }, 25402 tap: { 25403 clipPath: 'inset(0% round 0px)' 25404 } 25405 }; 25406 function getListPathForPostType(postType) { 25407 switch (postType) { 25408 case 'navigation': 25409 return '/navigation'; 25410 case 'wp_block': 25411 return '/pattern?postType=wp_block'; 25412 case 'wp_template_part': 25413 return '/pattern?postType=wp_template_part'; 25414 case 'wp_template': 25415 return '/template'; 25416 case 'page': 25417 return '/page'; 25418 case 'post': 25419 return '/'; 25420 } 25421 throw 'Unknown post type'; 25422 } 25423 function getNavigationPath(location, postType) { 25424 const { 25425 path, 25426 name 25427 } = location; 25428 if (['pattern-item', 'template-part-item', 'page-item', 'template-item', 'post-item'].includes(name)) { 25429 return getListPathForPostType(postType); 25430 } 25431 return (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 25432 canvas: undefined 25433 }); 25434 } 25435 function EditSiteEditor({ 25436 isPostsList = false 25437 }) { 25438 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 25439 const location = editor_useLocation(); 25440 const { 25441 canvas = 'view' 25442 } = location.query; 25443 const isLoading = useIsSiteEditorLoading(); 25444 useAdaptEditorToCanvas(canvas); 25445 const entity = useResolveEditedEntity(); 25446 // deprecated sync state with url 25447 useSyncDeprecatedEntityIntoState(entity); 25448 const { 25449 postType, 25450 postId, 25451 context 25452 } = entity; 25453 const { 25454 supportsGlobalStyles, 25455 editorCanvasView, 25456 currentPostIsTrashed, 25457 hasSiteIcon 25458 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25459 const { 25460 getEditorCanvasContainerView 25461 } = unlock(select(store)); 25462 const { 25463 getCurrentTheme, 25464 getEntityRecord 25465 } = select(external_wp_coreData_namespaceObject.store); 25466 const siteData = getEntityRecord('root', '__unstableBase', undefined); 25467 return { 25468 supportsGlobalStyles: getCurrentTheme()?.is_block_theme, 25469 editorCanvasView: getEditorCanvasContainerView(), 25470 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash', 25471 hasSiteIcon: !!siteData?.site_icon_url 25472 }; 25473 }, []); 25474 const postWithTemplate = !!context?.postId; 25475 use_editor_title(postWithTemplate ? context.postType : postType, postWithTemplate ? context.postId : postId); 25476 const _isPreviewingTheme = isPreviewingTheme(); 25477 const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer(); 25478 const iframeProps = useEditorIframeProps(); 25479 const isEditMode = canvas === 'edit'; 25480 const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(CanvasLoader, 'edit-site-editor__loading-progress'); 25481 const settings = useSpecificEditorSettings(); 25482 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...settings.styles, { 25483 // Forming a "block formatting context" to prevent margin collapsing. 25484 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 25485 css: canvas === 'view' ? `body{min-height: 100vh; $currentPostIsTrashed ? '' : 'cursor: pointer;'}}` : undefined 25486 }], [settings.styles, canvas, currentPostIsTrashed]); 25487 const { 25488 resetZoomLevel 25489 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 25490 const { 25491 createSuccessNotice 25492 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 25493 const history = editor_useHistory(); 25494 const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => { 25495 switch (actionId) { 25496 case 'move-to-trash': 25497 case 'delete-post': 25498 { 25499 history.navigate(getListPathForPostType(postWithTemplate ? context.postType : postType)); 25500 } 25501 break; 25502 case 'duplicate-post': 25503 { 25504 const newItem = items[0]; 25505 const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered; 25506 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 25507 // translators: %s: Title of the created post or template, e.g: "Hello world". 25508 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title)), { 25509 type: 'snackbar', 25510 id: 'duplicate-post-action', 25511 actions: [{ 25512 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 25513 onClick: () => { 25514 history.navigate(`/$newItem.type}/$newItem.id}?canvas=edit`); 25515 } 25516 }] 25517 }); 25518 } 25519 break; 25520 } 25521 }, [postType, context?.postType, postWithTemplate, history, createSuccessNotice]); 25522 25523 // Replace the title and icon displayed in the DocumentBar when there's an overlay visible. 25524 const title = getEditorCanvasContainerTitle(editorCanvasView); 25525 const isReady = !isLoading; 25526 const transition = { 25527 duration: disableMotion ? 0 : 0.2 25528 }; 25529 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25530 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { 25531 disableRootPadding: postType !== TEMPLATE_POST_TYPE 25532 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, { 25533 id: loadingProgressId 25534 }) : null, isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, { 25535 postType: postWithTemplate ? context.postType : postType 25536 }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Editor, { 25537 postType: postWithTemplate ? context.postType : postType, 25538 postId: postWithTemplate ? context.postId : postId, 25539 templateId: postWithTemplate ? postId : undefined, 25540 settings: settings, 25541 className: "edit-site-editor__editor-interface", 25542 styles: styles, 25543 customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { 25544 size: "compact" 25545 }), 25546 customSavePanel: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}), 25547 forceDisableBlockTools: !hasDefaultEditorCanvasView, 25548 title: title, 25549 iframeProps: iframeProps, 25550 onActionPerformed: onActionPerformed, 25551 extraSidebarPanels: !postWithTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel.Slot, {}), 25552 children: [isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { 25553 children: ({ 25554 length 25555 }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 25556 className: "edit-site-editor__view-mode-toggle", 25557 transition: transition, 25558 animate: "edit", 25559 initial: "edit", 25560 whileHover: "hover", 25561 whileTap: "tap", 25562 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25563 __next40pxDefaultSize: true, 25564 label: (0,external_wp_i18n_namespaceObject.__)('Open Navigation'), 25565 showTooltip: true, 25566 tooltipPosition: "middle right", 25567 onClick: () => { 25568 resetZoomLevel(); 25569 25570 // TODO: this is a temporary solution to navigate to the posts list if we are 25571 // come here through `posts list` and are in focus mode editing a template, template part etc.. 25572 if (isPostsList && location.query?.focusMode) { 25573 history.navigate('/', { 25574 transition: 'canvas-mode-view-transition' 25575 }); 25576 } else { 25577 history.navigate(getNavigationPath(location, postWithTemplate ? context.postType : postType), { 25578 transition: 'canvas-mode-view-transition' 25579 }); 25580 } 25581 }, 25582 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 25583 variants: siteIconVariants, 25584 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 25585 className: "edit-site-editor__view-mode-toggle-icon" 25586 }) 25587 }) 25588 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 25589 className: dist_clsx('edit-site-editor__back-icon', { 25590 'has-site-icon': hasSiteIcon 25591 }), 25592 variants: toggleHomeIconVariants, 25593 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 25594 icon: arrow_up_left 25595 }) 25596 })] 25597 }) 25598 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), supportsGlobalStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})] 25599 })] 25600 }); 25601 } 25602 25603 ;// ./node_modules/@wordpress/edit-site/build-module/components/maybe-editor/index.js 25604 /* wp:polyfill */ 25605 /** 25606 * WordPress dependencies 25607 */ 25608 25609 25610 25611 25612 25613 /** 25614 * Internal dependencies 25615 */ 25616 25617 25618 25619 function MaybeEditor({ 25620 showEditor = true 25621 }) { 25622 const { 25623 isBlockBasedTheme, 25624 siteUrl 25625 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25626 const { 25627 getEntityRecord, 25628 getCurrentTheme 25629 } = select(external_wp_coreData_namespaceObject.store); 25630 const siteData = getEntityRecord('root', '__unstableBase'); 25631 return { 25632 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 25633 siteUrl: siteData?.home 25634 }; 25635 }, []); 25636 25637 // If theme is block based, return the Editor, otherwise return the site preview. 25638 return isBlockBasedTheme || showEditor ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { 25639 src: siteUrl, 25640 title: (0,external_wp_i18n_namespaceObject.__)('Site Preview'), 25641 style: { 25642 display: 'block', 25643 width: '100%', 25644 height: '100%', 25645 backgroundColor: '#fff' 25646 }, 25647 onLoad: event => { 25648 // Hide the admin bar in the front-end preview. 25649 const document = event.target.contentDocument; 25650 document.getElementById('wpadminbar').remove(); 25651 document.getElementsByTagName('html')[0].setAttribute('style', 'margin-top: 0 !important;'); 25652 document.getElementsByTagName('body')[0].classList.remove('admin-bar'); 25653 // Make interactive elements unclickable. 25654 const interactiveElements = document.querySelectorAll('a, button, input, details, audio'); 25655 interactiveElements.forEach(element => { 25656 element.style.pointerEvents = 'none'; 25657 element.tabIndex = -1; 25658 element.setAttribute('aria-hidden', 'true'); 25659 }); 25660 } 25661 }); 25662 } 25663 25664 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/home.js 25665 /** 25666 * Internal dependencies 25667 */ 25668 25669 25670 25671 const homeRoute = { 25672 name: 'home', 25673 path: '/', 25674 areas: { 25675 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), 25676 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeEditor, { 25677 showEditor: false 25678 }), 25679 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) 25680 } 25681 }; 25682 25683 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/styles.js 25684 /** 25685 * WordPress dependencies 25686 */ 25687 25688 25689 /** 25690 * Internal dependencies 25691 */ 25692 25693 25694 25695 25696 25697 25698 const { 25699 useLocation: styles_useLocation 25700 } = unlock(external_wp_router_namespaceObject.privateApis); 25701 function MobileGlobalStylesUI() { 25702 const { 25703 query = {} 25704 } = styles_useLocation(); 25705 const { 25706 canvas 25707 } = query; 25708 if (canvas === 'edit') { 25709 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); 25710 } 25711 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}); 25712 } 25713 const stylesRoute = { 25714 name: 'styles', 25715 path: '/styles', 25716 areas: { 25717 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}), 25718 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { 25719 backPath: "/" 25720 }), 25721 preview({ 25722 query 25723 }) { 25724 const isStylebook = query.preview === 'stylebook'; 25725 return isStylebook ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); 25726 }, 25727 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileGlobalStylesUI, {}) 25728 }, 25729 widths: { 25730 content: 380 25731 } 25732 }; 25733 25734 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js 25735 // This requested is preloaded in `gutenberg_preload_navigation_posts`. 25736 // As unbounded queries are limited to 100 by `fetchAllMiddleware` 25737 // on apiFetch this query is limited to 100. 25738 // These parameters must be kept aligned with those in 25739 // lib/compat/wordpress-6.3/navigation-block-preloading.php 25740 // and 25741 // block-library/src/navigation/constants.js 25742 const PRELOADED_NAVIGATION_MENUS_QUERY = { 25743 per_page: 100, 25744 status: ['publish', 'draft'], 25745 order: 'desc', 25746 orderby: 'date' 25747 }; 25748 25749 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js 25750 /** 25751 * WordPress dependencies 25752 */ 25753 25754 25755 25756 25757 const notEmptyString = testString => testString?.trim()?.length > 0; 25758 function RenameModal({ 25759 menuTitle, 25760 onClose, 25761 onSave 25762 }) { 25763 const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_namespaceObject.useState)(menuTitle); 25764 const titleHasChanged = editedMenuTitle !== menuTitle; 25765 const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); 25766 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 25767 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 25768 onRequestClose: onClose, 25769 focusOnMount: "firstContentElement", 25770 size: "small", 25771 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 25772 className: "sidebar-navigation__rename-modal-form", 25773 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 25774 spacing: "3", 25775 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 25776 __nextHasNoMarginBottom: true, 25777 __next40pxDefaultSize: true, 25778 value: editedMenuTitle, 25779 placeholder: (0,external_wp_i18n_namespaceObject.__)('Navigation title'), 25780 onChange: setEditedMenuTitle, 25781 label: (0,external_wp_i18n_namespaceObject.__)('Name') 25782 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 25783 justify: "right", 25784 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25785 __next40pxDefaultSize: true, 25786 variant: "tertiary", 25787 onClick: onClose, 25788 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 25789 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25790 __next40pxDefaultSize: true, 25791 accessibleWhenDisabled: true, 25792 disabled: !isEditedMenuTitleValid, 25793 variant: "primary", 25794 type: "submit", 25795 onClick: e => { 25796 e.preventDefault(); 25797 if (!isEditedMenuTitleValid) { 25798 return; 25799 } 25800 onSave({ 25801 title: editedMenuTitle 25802 }); 25803 25804 // Immediate close avoids ability to hit save multiple times. 25805 onClose(); 25806 }, 25807 children: (0,external_wp_i18n_namespaceObject.__)('Save') 25808 })] 25809 })] 25810 }) 25811 }) 25812 }); 25813 } 25814 25815 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js 25816 /** 25817 * WordPress dependencies 25818 */ 25819 25820 25821 25822 function DeleteConfirmDialog({ 25823 onClose, 25824 onConfirm 25825 }) { 25826 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 25827 isOpen: true, 25828 onConfirm: () => { 25829 onConfirm(); 25830 25831 // Immediate close avoids ability to hit delete multiple times. 25832 onClose(); 25833 }, 25834 onCancel: onClose, 25835 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 25836 size: "medium", 25837 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation Menu?') 25838 }); 25839 } 25840 25841 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js 25842 /** 25843 * WordPress dependencies 25844 */ 25845 25846 25847 25848 25849 25850 25851 /** 25852 * Internal dependencies 25853 */ 25854 25855 25856 25857 25858 const { 25859 useHistory: more_menu_useHistory 25860 } = unlock(external_wp_router_namespaceObject.privateApis); 25861 const POPOVER_PROPS = { 25862 position: 'bottom right' 25863 }; 25864 function ScreenNavigationMoreMenu(props) { 25865 const { 25866 onDelete, 25867 onSave, 25868 onDuplicate, 25869 menuTitle, 25870 menuId 25871 } = props; 25872 const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 25873 const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 25874 const history = more_menu_useHistory(); 25875 const closeModals = () => { 25876 setRenameModalOpen(false); 25877 setDeleteConfirmDialogOpen(false); 25878 }; 25879 const openRenameModal = () => setRenameModalOpen(true); 25880 const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); 25881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25882 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 25883 className: "sidebar-navigation__more-menu", 25884 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 25885 icon: more_vertical, 25886 popoverProps: POPOVER_PROPS, 25887 children: ({ 25888 onClose 25889 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25890 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 25891 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25892 onClick: () => { 25893 openRenameModal(); 25894 // Close the dropdown after opening the modal. 25895 onClose(); 25896 }, 25897 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 25898 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25899 onClick: () => { 25900 history.navigate(`/wp_navigation/$menuId}?canvas=edit`); 25901 }, 25902 children: (0,external_wp_i18n_namespaceObject.__)('Edit') 25903 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25904 onClick: () => { 25905 onDuplicate(); 25906 onClose(); 25907 }, 25908 children: (0,external_wp_i18n_namespaceObject.__)('Duplicate') 25909 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25910 isDestructive: true, 25911 onClick: () => { 25912 openDeleteConfirmDialog(); 25913 25914 // Close the dropdown after opening the modal. 25915 onClose(); 25916 }, 25917 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 25918 })] 25919 }) 25920 }) 25921 }), deleteConfirmDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteConfirmDialog, { 25922 onClose: closeModals, 25923 onConfirm: onDelete 25924 }), renameModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameModal, { 25925 onClose: closeModals, 25926 menuTitle: menuTitle, 25927 onSave: onSave 25928 })] 25929 }); 25930 } 25931 25932 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 25933 /** 25934 * WordPress dependencies 25935 */ 25936 25937 25938 const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25939 viewBox: "0 0 24 24", 25940 xmlns: "http://www.w3.org/2000/svg", 25941 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25942 d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" 25943 }) 25944 }); 25945 /* harmony default export */ const chevron_up = (chevronUp); 25946 25947 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 25948 /** 25949 * WordPress dependencies 25950 */ 25951 25952 25953 const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25954 viewBox: "0 0 24 24", 25955 xmlns: "http://www.w3.org/2000/svg", 25956 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25957 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" 25958 }) 25959 }); 25960 /* harmony default export */ const chevron_down = (chevronDown); 25961 25962 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js 25963 /** 25964 * WordPress dependencies 25965 */ 25966 25967 25968 25969 25970 25971 25972 25973 25974 const leaf_more_menu_POPOVER_PROPS = { 25975 className: 'block-editor-block-settings-menu__popover', 25976 placement: 'bottom-start' 25977 }; 25978 25979 /** 25980 * Internal dependencies 25981 */ 25982 25983 25984 const { 25985 useHistory: leaf_more_menu_useHistory, 25986 useLocation: leaf_more_menu_useLocation 25987 } = unlock(external_wp_router_namespaceObject.privateApis); 25988 function LeafMoreMenu(props) { 25989 const history = leaf_more_menu_useHistory(); 25990 const { 25991 path 25992 } = leaf_more_menu_useLocation(); 25993 const { 25994 block 25995 } = props; 25996 const { 25997 clientId 25998 } = block; 25999 const { 26000 moveBlocksDown, 26001 moveBlocksUp, 26002 removeBlocks 26003 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 26004 const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ 26005 (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 26006 clientId, 26007 maximumLength: 25 26008 })); 26009 const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ 26010 (0,external_wp_i18n_namespaceObject.__)('Go to %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 26011 clientId, 26012 maximumLength: 25 26013 })); 26014 const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { 26015 const { 26016 getBlockRootClientId 26017 } = select(external_wp_blockEditor_namespaceObject.store); 26018 return getBlockRootClientId(clientId); 26019 }, [clientId]); 26020 const onGoToPage = (0,external_wp_element_namespaceObject.useCallback)(selectedBlock => { 26021 const { 26022 attributes, 26023 name 26024 } = selectedBlock; 26025 if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) { 26026 history.navigate(`/$attributes.type}/$attributes.id}?canvas=edit`, { 26027 state: { 26028 backPath: path 26029 } 26030 }); 26031 } 26032 if (name === 'core/page-list-item' && attributes.id && history) { 26033 history.navigate(`/page/$attributes.id}?canvas=edit`, { 26034 state: { 26035 backPath: path 26036 } 26037 }); 26038 } 26039 }, [path, history]); 26040 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 26041 icon: more_vertical, 26042 label: (0,external_wp_i18n_namespaceObject.__)('Options'), 26043 className: "block-editor-block-settings-menu", 26044 popoverProps: leaf_more_menu_POPOVER_PROPS, 26045 noIcons: true, 26046 ...props, 26047 children: ({ 26048 onClose 26049 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26050 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 26051 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26052 icon: chevron_up, 26053 onClick: () => { 26054 moveBlocksUp([clientId], rootClientId); 26055 onClose(); 26056 }, 26057 children: (0,external_wp_i18n_namespaceObject.__)('Move up') 26058 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26059 icon: chevron_down, 26060 onClick: () => { 26061 moveBlocksDown([clientId], rootClientId); 26062 onClose(); 26063 }, 26064 children: (0,external_wp_i18n_namespaceObject.__)('Move down') 26065 }), block.attributes?.type === 'page' && block.attributes?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26066 onClick: () => { 26067 onGoToPage(block); 26068 onClose(); 26069 }, 26070 children: goToLabel 26071 })] 26072 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 26073 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26074 onClick: () => { 26075 removeBlocks([clientId], false); 26076 onClose(); 26077 }, 26078 children: removeLabel 26079 }) 26080 })] 26081 }) 26082 }); 26083 } 26084 26085 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js 26086 /** 26087 * WordPress dependencies 26088 */ 26089 26090 26091 26092 26093 26094 26095 /** 26096 * Internal dependencies 26097 */ 26098 26099 26100 26101 const { 26102 PrivateListView 26103 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 26104 26105 // Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js. 26106 const MAX_PAGE_COUNT = 100; 26107 const PAGES_QUERY = ['postType', 'page', { 26108 per_page: MAX_PAGE_COUNT, 26109 _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'], 26110 // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby 26111 // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent 26112 // sort. 26113 orderby: 'menu_order', 26114 order: 'asc' 26115 }]; 26116 function NavigationMenuContent({ 26117 rootClientId 26118 }) { 26119 const { 26120 listViewRootClientId, 26121 isLoading 26122 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26123 const { 26124 areInnerBlocksControlled, 26125 getBlockName, 26126 getBlockCount, 26127 getBlockOrder 26128 } = select(external_wp_blockEditor_namespaceObject.store); 26129 const { 26130 isResolving 26131 } = select(external_wp_coreData_namespaceObject.store); 26132 const blockClientIds = getBlockOrder(rootClientId); 26133 const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === 'core/page-list'; 26134 const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; 26135 const isLoadingPages = isResolving('getEntityRecords', PAGES_QUERY); 26136 return { 26137 listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, 26138 // This is a small hack to wait for the navigation block 26139 // to actually load its inner blocks. 26140 isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages 26141 }; 26142 }, [rootClientId]); 26143 const { 26144 replaceBlock, 26145 __unstableMarkNextChangeAsNotPersistent 26146 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 26147 const offCanvasOnselect = (0,external_wp_element_namespaceObject.useCallback)(block => { 26148 if (block.name === 'core/navigation-link' && !block.attributes.url) { 26149 __unstableMarkNextChangeAsNotPersistent(); 26150 replaceBlock(block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', block.attributes)); 26151 } 26152 }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock]); 26153 26154 // The hidden block is needed because it makes block edit side effects trigger. 26155 // For example a navigation page list load its items has an effect on edit to load its items. 26156 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26157 children: [!isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { 26158 rootClientId: listViewRootClientId, 26159 onSelect: offCanvasOnselect, 26160 blockSettingsMenu: LeafMoreMenu, 26161 showAppender: false 26162 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26163 className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", 26164 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) 26165 })] 26166 }); 26167 } 26168 26169 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js 26170 /** 26171 * WordPress dependencies 26172 */ 26173 26174 26175 26176 26177 26178 /** 26179 * Internal dependencies 26180 */ 26181 26182 26183 26184 26185 const navigation_menu_editor_noop = () => {}; 26186 function NavigationMenuEditor({ 26187 navigationMenuId 26188 }) { 26189 const { 26190 storedSettings 26191 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26192 const { 26193 getSettings 26194 } = unlock(select(store)); 26195 return { 26196 storedSettings: getSettings() 26197 }; 26198 }, []); 26199 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 26200 if (!navigationMenuId) { 26201 return []; 26202 } 26203 return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { 26204 ref: navigationMenuId 26205 })]; 26206 }, [navigationMenuId]); 26207 if (!navigationMenuId || !blocks?.length) { 26208 return null; 26209 } 26210 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 26211 settings: storedSettings, 26212 value: blocks, 26213 onChange: navigation_menu_editor_noop, 26214 onInput: navigation_menu_editor_noop, 26215 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26216 className: "edit-site-sidebar-navigation-screen-navigation-menus__content", 26217 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { 26218 rootClientId: blocks[0].clientId 26219 }) 26220 }) 26221 }); 26222 } 26223 26224 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js 26225 /** 26226 * WordPress dependencies 26227 */ 26228 26229 26230 26231 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 26232 function buildNavigationLabel(title, id, status) { 26233 if (!title?.rendered) { 26234 /* translators: %s: the index of the menu in the list of menus. */ 26235 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 26236 } 26237 if (status === 'publish') { 26238 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered); 26239 } 26240 return (0,external_wp_i18n_namespaceObject.sprintf)( 26241 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 26242 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status); 26243 } 26244 26245 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js 26246 /** 26247 * WordPress dependencies 26248 */ 26249 26250 26251 /** 26252 * Internal dependencies 26253 */ 26254 26255 26256 26257 26258 26259 function SingleNavigationMenu({ 26260 navigationMenu, 26261 backPath, 26262 handleDelete, 26263 handleDuplicate, 26264 handleSave 26265 }) { 26266 const menuTitle = navigationMenu?.title?.rendered; 26267 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26268 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26269 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 26270 menuId: navigationMenu?.id, 26271 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 26272 onDelete: handleDelete, 26273 onSave: handleSave, 26274 onDuplicate: handleDuplicate 26275 }) 26276 }), 26277 backPath: backPath, 26278 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 26279 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 26280 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { 26281 navigationMenuId: navigationMenu?.id 26282 }) 26283 }); 26284 } 26285 26286 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js 26287 /** 26288 * WordPress dependencies 26289 */ 26290 26291 26292 26293 26294 26295 26296 26297 /** 26298 * Internal dependencies 26299 */ 26300 26301 26302 26303 26304 26305 26306 26307 const { 26308 useLocation: sidebar_navigation_screen_navigation_menu_useLocation 26309 } = unlock(external_wp_router_namespaceObject.privateApis); 26310 const postType = `wp_navigation`; 26311 function SidebarNavigationScreenNavigationMenu({ 26312 backPath 26313 }) { 26314 const { 26315 params: { 26316 postId 26317 } 26318 } = sidebar_navigation_screen_navigation_menu_useLocation(); 26319 const { 26320 record: navigationMenu, 26321 isResolving 26322 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId); 26323 const { 26324 isSaving, 26325 isDeleting 26326 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26327 const { 26328 isSavingEntityRecord, 26329 isDeletingEntityRecord 26330 } = select(external_wp_coreData_namespaceObject.store); 26331 return { 26332 isSaving: isSavingEntityRecord('postType', postType, postId), 26333 isDeleting: isDeletingEntityRecord('postType', postType, postId) 26334 }; 26335 }, [postId]); 26336 const isLoading = isResolving || isSaving || isDeleting; 26337 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 26338 const { 26339 handleSave, 26340 handleDelete, 26341 handleDuplicate 26342 } = useNavigationMenuHandlers(); 26343 const _handleDelete = () => handleDelete(navigationMenu); 26344 const _handleSave = edits => handleSave(navigationMenu, edits); 26345 const _handleDuplicate = () => handleDuplicate(navigationMenu); 26346 if (isLoading) { 26347 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26348 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 26349 backPath: backPath, 26350 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 26351 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 26352 }) 26353 }); 26354 } 26355 if (!isLoading && !navigationMenu) { 26356 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26357 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menu missing.'), 26358 backPath: backPath 26359 }); 26360 } 26361 if (!navigationMenu?.content?.raw) { 26362 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26363 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 26364 menuId: navigationMenu?.id, 26365 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 26366 onDelete: _handleDelete, 26367 onSave: _handleSave, 26368 onDuplicate: _handleDuplicate 26369 }), 26370 backPath: backPath, 26371 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 26372 description: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.') 26373 }); 26374 } 26375 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 26376 navigationMenu: navigationMenu, 26377 backPath: backPath, 26378 handleDelete: _handleDelete, 26379 handleSave: _handleSave, 26380 handleDuplicate: _handleDuplicate 26381 }); 26382 } 26383 26384 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js 26385 /** 26386 * WordPress dependencies 26387 */ 26388 26389 26390 26391 26392 26393 26394 /** 26395 * Internal dependencies 26396 */ 26397 26398 26399 26400 const { 26401 useHistory: use_navigation_menu_handlers_useHistory 26402 } = unlock(external_wp_router_namespaceObject.privateApis); 26403 function useDeleteNavigationMenu() { 26404 const { 26405 deleteEntityRecord 26406 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 26407 const { 26408 createSuccessNotice, 26409 createErrorNotice 26410 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 26411 const history = use_navigation_menu_handlers_useHistory(); 26412 const handleDelete = async navigationMenu => { 26413 const postId = navigationMenu?.id; 26414 try { 26415 await deleteEntityRecord('postType', postType, postId, { 26416 force: true 26417 }, { 26418 throwOnError: true 26419 }); 26420 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Navigation Menu successfully deleted.'), { 26421 type: 'snackbar' 26422 }); 26423 history.navigate('/navigation'); 26424 } catch (error) { 26425 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be deleted. */ 26426 (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), error?.message), { 26427 type: 'snackbar' 26428 }); 26429 } 26430 }; 26431 return handleDelete; 26432 } 26433 function useSaveNavigationMenu() { 26434 const { 26435 getEditedEntityRecord 26436 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26437 const { 26438 getEditedEntityRecord: getEditedEntityRecordSelector 26439 } = select(external_wp_coreData_namespaceObject.store); 26440 return { 26441 getEditedEntityRecord: getEditedEntityRecordSelector 26442 }; 26443 }, []); 26444 const { 26445 editEntityRecord, 26446 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 26447 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 26448 const { 26449 createSuccessNotice, 26450 createErrorNotice 26451 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 26452 const handleSave = async (navigationMenu, edits) => { 26453 if (!edits) { 26454 return; 26455 } 26456 const postId = navigationMenu?.id; 26457 // Prepare for revert in case of error. 26458 const originalRecord = getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, postId); 26459 26460 // Apply the edits. 26461 editEntityRecord('postType', postType, postId, edits); 26462 const recordPropertiesToSave = Object.keys(edits); 26463 26464 // Attempt to persist. 26465 try { 26466 await saveSpecifiedEntityEdits('postType', postType, postId, recordPropertiesToSave, { 26467 throwOnError: true 26468 }); 26469 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Renamed Navigation Menu'), { 26470 type: 'snackbar' 26471 }); 26472 } catch (error) { 26473 // Revert to original in case of error. 26474 editEntityRecord('postType', postType, postId, originalRecord); 26475 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be renamed. */ 26476 (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), error?.message), { 26477 type: 'snackbar' 26478 }); 26479 } 26480 }; 26481 return handleSave; 26482 } 26483 function useDuplicateNavigationMenu() { 26484 const history = use_navigation_menu_handlers_useHistory(); 26485 const { 26486 saveEntityRecord 26487 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 26488 const { 26489 createSuccessNotice, 26490 createErrorNotice 26491 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 26492 const handleDuplicate = async navigationMenu => { 26493 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 26494 try { 26495 const savedRecord = await saveEntityRecord('postType', postType, { 26496 title: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Navigation menu title */ 26497 (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'navigation menu'), menuTitle), 26498 content: navigationMenu?.content?.raw, 26499 status: 'publish' 26500 }, { 26501 throwOnError: true 26502 }); 26503 if (savedRecord) { 26504 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Duplicated Navigation Menu'), { 26505 type: 'snackbar' 26506 }); 26507 history.navigate(`/wp_navigation/$savedRecord.id}`); 26508 } 26509 } catch (error) { 26510 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be deleted. */ 26511 (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), error?.message), { 26512 type: 'snackbar' 26513 }); 26514 } 26515 }; 26516 return handleDuplicate; 26517 } 26518 function useNavigationMenuHandlers() { 26519 return { 26520 handleDelete: useDeleteNavigationMenu(), 26521 handleSave: useSaveNavigationMenu(), 26522 handleDuplicate: useDuplicateNavigationMenu() 26523 }; 26524 } 26525 26526 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js 26527 /** 26528 * WordPress dependencies 26529 */ 26530 26531 26532 26533 26534 26535 26536 26537 /** 26538 * Internal dependencies 26539 */ 26540 26541 26542 26543 26544 26545 26546 26547 26548 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 26549 26550 function buildMenuLabel(title, id, status) { 26551 if (!title) { 26552 /* translators: %s: the index of the menu in the list of menus. */ 26553 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 26554 } 26555 if (status === 'publish') { 26556 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); 26557 } 26558 return (0,external_wp_i18n_namespaceObject.sprintf)( 26559 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 26560 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status); 26561 } 26562 function SidebarNavigationScreenNavigationMenus({ 26563 backPath 26564 }) { 26565 const { 26566 records: navigationMenus, 26567 isResolving: isResolvingNavigationMenus, 26568 hasResolved: hasResolvedNavigationMenus 26569 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY); 26570 const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; 26571 const { 26572 getNavigationFallbackId 26573 } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store)); 26574 const isCreatingNavigationFallback = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).isResolving('getNavigationFallbackId'), []); 26575 const firstNavigationMenu = navigationMenus?.[0]; 26576 26577 // If there is no navigation menu found 26578 // then trigger fallback algorithm to create one. 26579 if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && 26580 // Ensure a fallback navigation is created only once 26581 !isCreatingNavigationFallback) { 26582 getNavigationFallbackId(); 26583 } 26584 const { 26585 handleSave, 26586 handleDelete, 26587 handleDuplicate 26588 } = useNavigationMenuHandlers(); 26589 const hasNavigationMenus = !!navigationMenus?.length; 26590 if (isLoading) { 26591 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26592 backPath: backPath, 26593 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 26594 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 26595 }) 26596 }); 26597 } 26598 if (!isLoading && !hasNavigationMenus) { 26599 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26600 description: (0,external_wp_i18n_namespaceObject.__)('No Navigation Menus found.'), 26601 backPath: backPath 26602 }); 26603 } 26604 26605 // if single menu then render it 26606 if (navigationMenus?.length === 1) { 26607 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 26608 navigationMenu: firstNavigationMenu, 26609 backPath: backPath, 26610 handleDelete: () => handleDelete(firstNavigationMenu), 26611 handleDuplicate: () => handleDuplicate(firstNavigationMenu), 26612 handleSave: edits => handleSave(firstNavigationMenu, edits) 26613 }); 26614 } 26615 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26616 backPath: backPath, 26617 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 26618 className: "edit-site-sidebar-navigation-screen-navigation-menus", 26619 children: navigationMenus?.map(({ 26620 id, 26621 title, 26622 status 26623 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavMenuItem, { 26624 postId: id, 26625 withChevron: true, 26626 icon: library_navigation, 26627 children: buildMenuLabel(title?.rendered, index + 1, status) 26628 }, id)) 26629 }) 26630 }); 26631 } 26632 function SidebarNavigationScreenWrapper({ 26633 children, 26634 actions, 26635 title, 26636 description, 26637 backPath 26638 }) { 26639 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 26640 title: title || (0,external_wp_i18n_namespaceObject.__)('Navigation'), 26641 actions: actions, 26642 description: description || (0,external_wp_i18n_namespaceObject.__)('Manage your Navigation Menus.'), 26643 backPath: backPath, 26644 content: children 26645 }); 26646 } 26647 const NavMenuItem = ({ 26648 postId, 26649 ...props 26650 }) => { 26651 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 26652 to: `/wp_navigation/$postId}`, 26653 ...props 26654 }); 26655 }; 26656 26657 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation.js 26658 /** 26659 * WordPress dependencies 26660 */ 26661 26662 26663 /** 26664 * Internal dependencies 26665 */ 26666 26667 26668 26669 26670 const { 26671 useLocation: navigation_useLocation 26672 } = unlock(external_wp_router_namespaceObject.privateApis); 26673 function MobileNavigationView() { 26674 const { 26675 query = {} 26676 } = navigation_useLocation(); 26677 const { 26678 canvas = 'view' 26679 } = query; 26680 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { 26681 backPath: "/" 26682 }); 26683 } 26684 const navigationRoute = { 26685 name: 'navigation', 26686 path: '/navigation', 26687 areas: { 26688 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { 26689 backPath: "/" 26690 }), 26691 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 26692 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationView, {}) 26693 } 26694 }; 26695 26696 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation-item.js 26697 /** 26698 * WordPress dependencies 26699 */ 26700 26701 26702 /** 26703 * Internal dependencies 26704 */ 26705 26706 26707 26708 26709 26710 const { 26711 useLocation: navigation_item_useLocation 26712 } = unlock(external_wp_router_namespaceObject.privateApis); 26713 function MobileNavigationItemView() { 26714 const { 26715 query = {} 26716 } = navigation_item_useLocation(); 26717 const { 26718 canvas = 'view' 26719 } = query; 26720 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { 26721 backPath: { 26722 postType: NAVIGATION_POST_TYPE 26723 } 26724 }); 26725 } 26726 const navigationItemRoute = { 26727 name: 'navigation-item', 26728 path: '/wp_navigation/:postId', 26729 areas: { 26730 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { 26731 backPath: "/navigation" 26732 }), 26733 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 26734 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationItemView, {}) 26735 } 26736 }; 26737 26738 ;// ./node_modules/@wordpress/icons/build-module/library/file.js 26739 /** 26740 * WordPress dependencies 26741 */ 26742 26743 26744 const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 26745 viewBox: "0 0 24 24", 26746 xmlns: "http://www.w3.org/2000/svg", 26747 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 26748 fillRule: "evenodd", 26749 clipRule: "evenodd", 26750 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" 26751 }) 26752 }); 26753 /* harmony default export */ const library_file = (file); 26754 26755 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js 26756 /** 26757 * Internal dependencies 26758 */ 26759 26760 26761 function CategoryItem({ 26762 count, 26763 icon, 26764 id, 26765 isActive, 26766 label, 26767 type 26768 }) { 26769 if (!count) { 26770 return; 26771 } 26772 const queryArgs = [`postType=$type}`]; 26773 if (id) { 26774 queryArgs.push(`categoryId=$id}`); 26775 } 26776 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 26777 icon: icon, 26778 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 26779 children: count 26780 }), 26781 "aria-current": isActive ? 'true' : undefined, 26782 to: `/pattern?$queryArgs.join('&')}`, 26783 children: label 26784 }); 26785 } 26786 26787 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js 26788 /** 26789 * WordPress dependencies 26790 */ 26791 26792 26793 26794 /** 26795 * Internal dependencies 26796 */ 26797 26798 26799 function useDefaultPatternCategories() { 26800 const blockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => { 26801 var _settings$__experimen; 26802 const { 26803 getSettings 26804 } = unlock(select(store)); 26805 const settings = getSettings(); 26806 return (_settings$__experimen = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatternCategories; 26807 }); 26808 const restBlockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()); 26809 return [...(blockPatternCategories || []), ...(restBlockPatternCategories || [])]; 26810 } 26811 26812 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js 26813 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); 26814 26815 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js 26816 /* wp:polyfill */ 26817 /** 26818 * WordPress dependencies 26819 */ 26820 26821 26822 26823 26824 /** 26825 * Internal dependencies 26826 */ 26827 26828 26829 26830 26831 function useThemePatterns() { 26832 const blockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => { 26833 var _getSettings$__experi; 26834 const { 26835 getSettings 26836 } = unlock(select(store)); 26837 return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns; 26838 }); 26839 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns()); 26840 const patterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]); 26841 return patterns; 26842 } 26843 26844 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js 26845 /* wp:polyfill */ 26846 /** 26847 * WordPress dependencies 26848 */ 26849 26850 26851 /** 26852 * Internal dependencies 26853 */ 26854 26855 const { 26856 extractWords, 26857 getNormalizedSearchTerms, 26858 normalizeString 26859 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 26860 26861 /** 26862 * Internal dependencies 26863 */ 26864 26865 26866 // Default search helpers. 26867 const defaultGetName = item => { 26868 if (item.type === PATTERN_TYPES.user) { 26869 return item.slug; 26870 } 26871 if (item.type === TEMPLATE_PART_POST_TYPE) { 26872 return ''; 26873 } 26874 return item.name || ''; 26875 }; 26876 const defaultGetTitle = item => { 26877 if (typeof item.title === 'string') { 26878 return item.title; 26879 } 26880 if (item.title && item.title.rendered) { 26881 return item.title.rendered; 26882 } 26883 if (item.title && item.title.raw) { 26884 return item.title.raw; 26885 } 26886 return ''; 26887 }; 26888 const defaultGetDescription = item => { 26889 if (item.type === PATTERN_TYPES.user) { 26890 return item.excerpt.raw; 26891 } 26892 return item.description || ''; 26893 }; 26894 const defaultGetKeywords = item => item.keywords || []; 26895 const defaultHasCategory = () => false; 26896 const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 26897 return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term))); 26898 }; 26899 26900 /** 26901 * Filters an item list given a search term. 26902 * 26903 * @param {Array} items Item list 26904 * @param {string} searchInput Search input. 26905 * @param {Object} config Search Config. 26906 * 26907 * @return {Array} Filtered item list. 26908 */ 26909 const searchItems = (items = [], searchInput = '', config = {}) => { 26910 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 26911 26912 // Filter patterns by category: the default category indicates that all patterns will be shown. 26913 const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; 26914 const searchRankConfig = { 26915 ...config, 26916 onlyFilterByCategory 26917 }; 26918 26919 // If we aren't filtering on search terms, matching on category is satisfactory. 26920 // If we are, then we need more than a category match. 26921 const threshold = onlyFilterByCategory ? 0 : 1; 26922 const rankedItems = items.map(item => { 26923 return [item, getItemSearchRank(item, searchInput, searchRankConfig)]; 26924 }).filter(([, rank]) => rank > threshold); 26925 26926 // If we didn't have terms to search on, there's no point sorting. 26927 if (normalizedSearchTerms.length === 0) { 26928 return rankedItems.map(([item]) => item); 26929 } 26930 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 26931 return rankedItems.map(([item]) => item); 26932 }; 26933 26934 /** 26935 * Get the search rank for a given item and a specific search term. 26936 * The better the match, the higher the rank. 26937 * If the rank equals 0, it should be excluded from the results. 26938 * 26939 * @param {Object} item Item to filter. 26940 * @param {string} searchTerm Search term. 26941 * @param {Object} config Search Config. 26942 * 26943 * @return {number} Search Rank. 26944 */ 26945 function getItemSearchRank(item, searchTerm, config) { 26946 const { 26947 categoryId, 26948 getName = defaultGetName, 26949 getTitle = defaultGetTitle, 26950 getDescription = defaultGetDescription, 26951 getKeywords = defaultGetKeywords, 26952 hasCategory = defaultHasCategory, 26953 onlyFilterByCategory 26954 } = config; 26955 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; 26956 26957 // If an item doesn't belong to the current category or we don't have 26958 // search terms to filter by, return the initial rank value. 26959 if (!rank || onlyFilterByCategory) { 26960 return rank; 26961 } 26962 const name = getName(item); 26963 const title = getTitle(item); 26964 const description = getDescription(item); 26965 const keywords = getKeywords(item); 26966 const normalizedSearchInput = normalizeString(searchTerm); 26967 const normalizedTitle = normalizeString(title); 26968 26969 // Prefers exact matches 26970 // Then prefers if the beginning of the title matches the search term 26971 // name, keywords, description matches come later. 26972 if (normalizedSearchInput === normalizedTitle) { 26973 rank += 30; 26974 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 26975 rank += 20; 26976 } else { 26977 const terms = [name, title, description, ...keywords].join(' '); 26978 const normalizedSearchTerms = extractWords(normalizedSearchInput); 26979 const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); 26980 if (unmatchedTerms.length === 0) { 26981 rank += 10; 26982 } 26983 } 26984 return rank; 26985 } 26986 26987 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js 26988 /* wp:polyfill */ 26989 /** 26990 * WordPress dependencies 26991 */ 26992 26993 26994 26995 26996 26997 /** 26998 * Internal dependencies 26999 */ 27000 27001 27002 27003 27004 27005 const EMPTY_PATTERN_LIST = []; 27006 const selectTemplateParts = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, search = '') => { 27007 var _getEntityRecords; 27008 const { 27009 getEntityRecords, 27010 isResolving: isResolvingSelector 27011 } = select(external_wp_coreData_namespaceObject.store); 27012 const query = { 27013 per_page: -1 27014 }; 27015 const templateParts = (_getEntityRecords = getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST; 27016 27017 // In the case where a custom template part area has been removed we need 27018 // the current list of areas to cross check against so orphaned template 27019 // parts can be treated as uncategorized. 27020 const knownAreas = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || []; 27021 const templatePartAreas = knownAreas.map(area => area.area); 27022 const templatePartHasCategory = (item, category) => { 27023 if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { 27024 return item.area === category; 27025 } 27026 return item.area === category || !templatePartAreas.includes(item.area); 27027 }; 27028 const isResolving = isResolvingSelector('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, query]); 27029 const patterns = searchItems(templateParts, search, { 27030 categoryId, 27031 hasCategory: templatePartHasCategory 27032 }); 27033 return { 27034 patterns, 27035 isResolving 27036 }; 27037 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 27038 per_page: -1 27039 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, { 27040 per_page: -1 27041 }]), select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas]); 27042 const selectThemePatterns = (0,external_wp_data_namespaceObject.createSelector)(select => { 27043 var _settings$__experimen; 27044 const { 27045 getSettings 27046 } = unlock(select(store)); 27047 const { 27048 isResolving: isResolvingSelector 27049 } = select(external_wp_coreData_namespaceObject.store); 27050 const settings = getSettings(); 27051 const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns; 27052 const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns(); 27053 const patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({ 27054 ...pattern, 27055 keywords: pattern.keywords || [], 27056 type: PATTERN_TYPES.theme, 27057 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 27058 __unstableSkipMigrationLogs: true 27059 }) 27060 })); 27061 return { 27062 patterns, 27063 isResolving: isResolvingSelector('getBlockPatterns') 27064 }; 27065 }, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).isResolving('getBlockPatterns'), unlock(select(store)).getSettings()]); 27066 const selectPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, syncStatus, search = '') => { 27067 const { 27068 patterns: themePatterns, 27069 isResolving: isResolvingThemePatterns 27070 } = selectThemePatterns(select); 27071 const { 27072 patterns: userPatterns, 27073 isResolving: isResolvingUserPatterns, 27074 categories: userPatternCategories 27075 } = selectUserPatterns(select); 27076 let patterns = [...(themePatterns || []), ...(userPatterns || [])]; 27077 if (syncStatus) { 27078 // User patterns can have their sync statuses checked directly 27079 // Non-user patterns are all unsynced for the time being. 27080 patterns = patterns.filter(pattern => { 27081 return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; 27082 }); 27083 } 27084 if (categoryId) { 27085 patterns = searchItems(patterns, search, { 27086 categoryId, 27087 hasCategory: (item, currentCategory) => { 27088 if (item.type === PATTERN_TYPES.user) { 27089 return item.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId)?.slug === currentCategory); 27090 } 27091 return item.categories?.includes(currentCategory); 27092 } 27093 }); 27094 } else { 27095 patterns = searchItems(patterns, search, { 27096 hasCategory: item => { 27097 if (item.type === PATTERN_TYPES.user) { 27098 return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))); 27099 } 27100 return !item.hasOwnProperty('categories'); 27101 } 27102 }); 27103 } 27104 return { 27105 patterns, 27106 isResolving: isResolvingThemePatterns || isResolvingUserPatterns 27107 }; 27108 }, select => [selectThemePatterns(select), selectUserPatterns(select)]); 27109 const selectUserPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, syncStatus, search = '') => { 27110 const { 27111 getEntityRecords, 27112 isResolving: isResolvingSelector, 27113 getUserPatternCategories 27114 } = select(external_wp_coreData_namespaceObject.store); 27115 const query = { 27116 per_page: -1 27117 }; 27118 const patternPosts = getEntityRecords('postType', PATTERN_TYPES.user, query); 27119 const userPatternCategories = getUserPatternCategories(); 27120 const categories = new Map(); 27121 userPatternCategories.forEach(userCategory => categories.set(userCategory.id, userCategory)); 27122 let patterns = patternPosts !== null && patternPosts !== void 0 ? patternPosts : EMPTY_PATTERN_LIST; 27123 const isResolving = isResolvingSelector('getEntityRecords', ['postType', PATTERN_TYPES.user, query]); 27124 if (syncStatus) { 27125 patterns = patterns.filter(pattern => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus); 27126 } 27127 patterns = searchItems(patterns, search, { 27128 // We exit user pattern retrieval early if we aren't in the 27129 // catch-all category for user created patterns, so it has 27130 // to be in the category. 27131 hasCategory: () => true 27132 }); 27133 return { 27134 patterns, 27135 isResolving, 27136 categories: userPatternCategories 27137 }; 27138 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', PATTERN_TYPES.user, { 27139 per_page: -1 27140 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, { 27141 per_page: -1 27142 }]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()]); 27143 function useAugmentPatternsWithPermissions(patterns) { 27144 const idsAndTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 27145 var _patterns$filter$map; 27146 return (_patterns$filter$map = patterns?.filter(record => record.type !== PATTERN_TYPES.theme).map(record => [record.type, record.id])) !== null && _patterns$filter$map !== void 0 ? _patterns$filter$map : []; 27147 }, [patterns]); 27148 const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => { 27149 const { 27150 getEntityRecordPermissions 27151 } = unlock(select(external_wp_coreData_namespaceObject.store)); 27152 return idsAndTypes.reduce((acc, [type, id]) => { 27153 acc[id] = getEntityRecordPermissions('postType', type, id); 27154 return acc; 27155 }, {}); 27156 }, [idsAndTypes]); 27157 return (0,external_wp_element_namespaceObject.useMemo)(() => { 27158 var _patterns$map; 27159 return (_patterns$map = patterns?.map(record => { 27160 var _permissions$record$i; 27161 return { 27162 ...record, 27163 permissions: (_permissions$record$i = permissions?.[record.id]) !== null && _permissions$record$i !== void 0 ? _permissions$record$i : {} 27164 }; 27165 })) !== null && _patterns$map !== void 0 ? _patterns$map : []; 27166 }, [patterns, permissions]); 27167 } 27168 const usePatterns = (postType, categoryId, { 27169 search = '', 27170 syncStatus 27171 } = {}) => { 27172 return (0,external_wp_data_namespaceObject.useSelect)(select => { 27173 if (postType === TEMPLATE_PART_POST_TYPE) { 27174 return selectTemplateParts(select, categoryId, search); 27175 } else if (postType === PATTERN_TYPES.user && !!categoryId) { 27176 const appliedCategory = categoryId === 'uncategorized' ? '' : categoryId; 27177 return selectPatterns(select, appliedCategory, syncStatus, search); 27178 } else if (postType === PATTERN_TYPES.user) { 27179 return selectUserPatterns(select, syncStatus, search); 27180 } 27181 return { 27182 patterns: EMPTY_PATTERN_LIST, 27183 isResolving: false 27184 }; 27185 }, [categoryId, postType, search, syncStatus]); 27186 }; 27187 /* harmony default export */ const use_patterns = (usePatterns); 27188 27189 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js 27190 /* wp:polyfill */ 27191 /** 27192 * WordPress dependencies 27193 */ 27194 27195 27196 27197 /** 27198 * Internal dependencies 27199 */ 27200 27201 27202 27203 27204 function usePatternCategories() { 27205 const defaultCategories = useDefaultPatternCategories(); 27206 defaultCategories.push({ 27207 name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, 27208 label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') 27209 }); 27210 const themePatterns = useThemePatterns(); 27211 const { 27212 patterns: userPatterns, 27213 categories: userPatternCategories 27214 } = use_patterns(PATTERN_TYPES.user); 27215 const patternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { 27216 const categoryMap = {}; 27217 const categoriesWithCounts = []; 27218 27219 // Create a map for easier counting of patterns in categories. 27220 defaultCategories.forEach(category => { 27221 if (!categoryMap[category.name]) { 27222 categoryMap[category.name] = { 27223 ...category, 27224 count: 0 27225 }; 27226 } 27227 }); 27228 userPatternCategories.forEach(category => { 27229 if (!categoryMap[category.name]) { 27230 categoryMap[category.name] = { 27231 ...category, 27232 count: 0 27233 }; 27234 } 27235 }); 27236 27237 // Update the category counts to reflect theme registered patterns. 27238 themePatterns.forEach(pattern => { 27239 pattern.categories?.forEach(category => { 27240 if (categoryMap[category]) { 27241 categoryMap[category].count += 1; 27242 } 27243 }); 27244 // If the pattern has no categories, add it to uncategorized. 27245 if (!pattern.categories?.length) { 27246 categoryMap.uncategorized.count += 1; 27247 } 27248 }); 27249 27250 // Update the category counts to reflect user registered patterns. 27251 userPatterns.forEach(pattern => { 27252 pattern.wp_pattern_category?.forEach(catId => { 27253 const category = userPatternCategories.find(cat => cat.id === catId)?.name; 27254 if (categoryMap[category]) { 27255 categoryMap[category].count += 1; 27256 } 27257 }); 27258 // If the pattern has no categories, add it to uncategorized. 27259 if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))) { 27260 categoryMap.uncategorized.count += 1; 27261 } 27262 }); 27263 27264 // Filter categories so we only have those containing patterns. 27265 [...defaultCategories, ...userPatternCategories].forEach(category => { 27266 if (categoryMap[category.name].count && !categoriesWithCounts.find(cat => cat.name === category.name)) { 27267 categoriesWithCounts.push(categoryMap[category.name]); 27268 } 27269 }); 27270 const sortedCategories = categoriesWithCounts.sort((a, b) => a.label.localeCompare(b.label)); 27271 sortedCategories.unshift({ 27272 name: PATTERN_USER_CATEGORY, 27273 label: (0,external_wp_i18n_namespaceObject.__)('My patterns'), 27274 count: userPatterns.length 27275 }); 27276 sortedCategories.unshift({ 27277 name: PATTERN_DEFAULT_CATEGORY, 27278 label: (0,external_wp_i18n_namespaceObject.__)('All patterns'), 27279 description: (0,external_wp_i18n_namespaceObject.__)('A list of all patterns from all sources.'), 27280 count: themePatterns.length + userPatterns.length 27281 }); 27282 return sortedCategories; 27283 }, [defaultCategories, themePatterns, userPatternCategories, userPatterns]); 27284 return { 27285 patternCategories, 27286 hasPatterns: !!patternCategories.length 27287 }; 27288 } 27289 27290 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js 27291 /* wp:polyfill */ 27292 /** 27293 * WordPress dependencies 27294 */ 27295 27296 27297 27298 /** 27299 * Internal dependencies 27300 */ 27301 27302 const useTemplatePartsGroupedByArea = items => { 27303 const allItems = items || []; 27304 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [], []); 27305 27306 // Create map of template areas ensuring that default areas are displayed before 27307 // any custom registered template part areas. 27308 const knownAreas = { 27309 header: {}, 27310 footer: {}, 27311 sidebar: {}, 27312 uncategorized: {} 27313 }; 27314 templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { 27315 ...templatePartArea, 27316 templateParts: [] 27317 }); 27318 const groupedByArea = allItems.reduce((accumulator, item) => { 27319 const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; 27320 accumulator[key]?.templateParts?.push(item); 27321 return accumulator; 27322 }, knownAreas); 27323 return groupedByArea; 27324 }; 27325 function useTemplatePartAreas() { 27326 const { 27327 records: templateParts, 27328 isResolving: isLoading 27329 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 27330 per_page: -1 27331 }); 27332 return { 27333 hasTemplateParts: templateParts ? !!templateParts.length : false, 27334 isLoading, 27335 templatePartAreas: useTemplatePartsGroupedByArea(templateParts) 27336 }; 27337 } 27338 27339 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js 27340 /* wp:polyfill */ 27341 /** 27342 * WordPress dependencies 27343 */ 27344 27345 27346 27347 27348 27349 27350 /** 27351 * Internal dependencies 27352 */ 27353 27354 27355 27356 27357 27358 27359 27360 const { 27361 useLocation: sidebar_navigation_screen_patterns_useLocation 27362 } = unlock(external_wp_router_namespaceObject.privateApis); 27363 function CategoriesGroup({ 27364 templatePartAreas, 27365 patternCategories, 27366 currentCategory, 27367 currentType 27368 }) { 27369 const [allPatterns, ...otherPatterns] = patternCategories; 27370 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 27371 className: "edit-site-sidebar-navigation-screen-patterns__group", 27372 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27373 count: Object.values(templatePartAreas).map(({ 27374 templateParts 27375 }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0), 27376 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)() /* no name, so it provides the fallback icon */, 27377 label: (0,external_wp_i18n_namespaceObject.__)('All template parts'), 27378 id: TEMPLATE_PART_ALL_AREAS_CATEGORY, 27379 type: TEMPLATE_PART_POST_TYPE, 27380 isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE 27381 }, "all"), Object.entries(templatePartAreas).map(([area, { 27382 label, 27383 templateParts 27384 }]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27385 count: templateParts?.length, 27386 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area), 27387 label: label, 27388 id: area, 27389 type: TEMPLATE_PART_POST_TYPE, 27390 isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE 27391 }, area)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 27392 className: "edit-site-sidebar-navigation-screen-patterns__divider" 27393 }), allPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27394 count: allPatterns.count, 27395 label: allPatterns.label, 27396 icon: library_file, 27397 id: allPatterns.name, 27398 type: PATTERN_TYPES.user, 27399 isActive: currentCategory === `$allPatterns.name}` && currentType === PATTERN_TYPES.user 27400 }, allPatterns.name), otherPatterns.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27401 count: category.count, 27402 label: category.label, 27403 icon: library_file, 27404 id: category.name, 27405 type: PATTERN_TYPES.user, 27406 isActive: currentCategory === `$category.name}` && currentType === PATTERN_TYPES.user 27407 }, category.name))] 27408 }); 27409 } 27410 function SidebarNavigationScreenPatterns({ 27411 backPath 27412 }) { 27413 const { 27414 query: { 27415 postType = 'wp_block', 27416 categoryId 27417 } 27418 } = sidebar_navigation_screen_patterns_useLocation(); 27419 const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); 27420 const { 27421 templatePartAreas, 27422 hasTemplateParts, 27423 isLoading 27424 } = useTemplatePartAreas(); 27425 const { 27426 patternCategories, 27427 hasPatterns 27428 } = usePatternCategories(); 27429 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 27430 title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), 27431 description: (0,external_wp_i18n_namespaceObject.__)('Manage what patterns are available when editing the site.'), 27432 backPath: backPath, 27433 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27434 children: [isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading items…'), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27435 children: [!hasTemplateParts && !hasPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 27436 className: "edit-site-sidebar-navigation-screen-patterns__group", 27437 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 27438 children: (0,external_wp_i18n_namespaceObject.__)('No items found') 27439 }) 27440 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoriesGroup, { 27441 templatePartAreas: templatePartAreas, 27442 patternCategories: patternCategories, 27443 currentCategory: currentCategory, 27444 currentType: postType 27445 })] 27446 })] 27447 }) 27448 }); 27449 } 27450 27451 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 27452 var remove_accents = __webpack_require__(9681); 27453 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 27454 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up.js 27455 /** 27456 * WordPress dependencies 27457 */ 27458 27459 27460 const arrowUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 27461 xmlns: "http://www.w3.org/2000/svg", 27462 viewBox: "0 0 24 24", 27463 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 27464 d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" 27465 }) 27466 }); 27467 /* harmony default export */ const arrow_up = (arrowUp); 27468 27469 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js 27470 /** 27471 * WordPress dependencies 27472 */ 27473 27474 27475 const arrowDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 27476 xmlns: "http://www.w3.org/2000/svg", 27477 viewBox: "0 0 24 24", 27478 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 27479 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" 27480 }) 27481 }); 27482 /* harmony default export */ const arrow_down = (arrowDown); 27483 27484 ;// ./node_modules/@wordpress/dataviews/build-module/constants.js 27485 /** 27486 * WordPress dependencies 27487 */ 27488 27489 27490 27491 /** 27492 * Internal dependencies 27493 */ 27494 27495 // Filter operators. 27496 const constants_OPERATOR_IS = 'is'; 27497 const constants_OPERATOR_IS_NOT = 'isNot'; 27498 const constants_OPERATOR_IS_ANY = 'isAny'; 27499 const constants_OPERATOR_IS_NONE = 'isNone'; 27500 const OPERATOR_IS_ALL = 'isAll'; 27501 const OPERATOR_IS_NOT_ALL = 'isNotAll'; 27502 const ALL_OPERATORS = [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL]; 27503 const OPERATORS = { 27504 [constants_OPERATOR_IS]: { 27505 key: 'is-filter', 27506 label: (0,external_wp_i18n_namespaceObject.__)('Is') 27507 }, 27508 [constants_OPERATOR_IS_NOT]: { 27509 key: 'is-not-filter', 27510 label: (0,external_wp_i18n_namespaceObject.__)('Is not') 27511 }, 27512 [constants_OPERATOR_IS_ANY]: { 27513 key: 'is-any-filter', 27514 label: (0,external_wp_i18n_namespaceObject.__)('Is any') 27515 }, 27516 [constants_OPERATOR_IS_NONE]: { 27517 key: 'is-none-filter', 27518 label: (0,external_wp_i18n_namespaceObject.__)('Is none') 27519 }, 27520 [OPERATOR_IS_ALL]: { 27521 key: 'is-all-filter', 27522 label: (0,external_wp_i18n_namespaceObject.__)('Is all') 27523 }, 27524 [OPERATOR_IS_NOT_ALL]: { 27525 key: 'is-not-all-filter', 27526 label: (0,external_wp_i18n_namespaceObject.__)('Is not all') 27527 } 27528 }; 27529 const SORTING_DIRECTIONS = ['asc', 'desc']; 27530 const sortArrows = { 27531 asc: '↑', 27532 desc: '↓' 27533 }; 27534 const sortValues = { 27535 asc: 'ascending', 27536 desc: 'descending' 27537 }; 27538 const sortLabels = { 27539 asc: (0,external_wp_i18n_namespaceObject.__)('Sort ascending'), 27540 desc: (0,external_wp_i18n_namespaceObject.__)('Sort descending') 27541 }; 27542 const sortIcons = { 27543 asc: arrow_up, 27544 desc: arrow_down 27545 }; 27546 27547 // View layouts. 27548 const constants_LAYOUT_TABLE = 'table'; 27549 const constants_LAYOUT_GRID = 'grid'; 27550 const constants_LAYOUT_LIST = 'list'; 27551 27552 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js 27553 /** 27554 * Internal dependencies 27555 */ 27556 27557 function sort(a, b, direction) { 27558 return direction === 'asc' ? a - b : b - a; 27559 } 27560 function isValid(value, context) { 27561 // TODO: this implicitly means the value is required. 27562 if (value === '') { 27563 return false; 27564 } 27565 if (!Number.isInteger(Number(value))) { 27566 return false; 27567 } 27568 if (context?.elements) { 27569 const validValues = context?.elements.map(f => f.value); 27570 if (!validValues.includes(Number(value))) { 27571 return false; 27572 } 27573 } 27574 return true; 27575 } 27576 /* harmony default export */ const integer = ({ 27577 sort, 27578 isValid, 27579 Edit: 'integer' 27580 }); 27581 27582 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js 27583 /** 27584 * Internal dependencies 27585 */ 27586 27587 function text_sort(valueA, valueB, direction) { 27588 return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 27589 } 27590 function text_isValid(value, context) { 27591 if (context?.elements) { 27592 const validValues = context?.elements?.map(f => f.value); 27593 if (!validValues.includes(value)) { 27594 return false; 27595 } 27596 } 27597 return true; 27598 } 27599 /* harmony default export */ const field_types_text = ({ 27600 sort: text_sort, 27601 isValid: text_isValid, 27602 Edit: 'text' 27603 }); 27604 27605 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js 27606 /** 27607 * Internal dependencies 27608 */ 27609 27610 function datetime_sort(a, b, direction) { 27611 const timeA = new Date(a).getTime(); 27612 const timeB = new Date(b).getTime(); 27613 return direction === 'asc' ? timeA - timeB : timeB - timeA; 27614 } 27615 function datetime_isValid(value, context) { 27616 if (context?.elements) { 27617 const validValues = context?.elements.map(f => f.value); 27618 if (!validValues.includes(value)) { 27619 return false; 27620 } 27621 } 27622 return true; 27623 } 27624 /* harmony default export */ const datetime = ({ 27625 sort: datetime_sort, 27626 isValid: datetime_isValid, 27627 Edit: 'datetime' 27628 }); 27629 27630 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js 27631 /** 27632 * Internal dependencies 27633 */ 27634 27635 27636 27637 27638 27639 /** 27640 * 27641 * @param {FieldType} type The field type definition to get. 27642 * 27643 * @return A field type definition. 27644 */ 27645 function getFieldTypeDefinition(type) { 27646 if ('integer' === type) { 27647 return integer; 27648 } 27649 if ('text' === type) { 27650 return field_types_text; 27651 } 27652 if ('datetime' === type) { 27653 return datetime; 27654 } 27655 return { 27656 sort: (a, b, direction) => { 27657 if (typeof a === 'number' && typeof b === 'number') { 27658 return direction === 'asc' ? a - b : b - a; 27659 } 27660 return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); 27661 }, 27662 isValid: (value, context) => { 27663 if (context?.elements) { 27664 const validValues = context?.elements?.map(f => f.value); 27665 if (!validValues.includes(value)) { 27666 return false; 27667 } 27668 } 27669 return true; 27670 }, 27671 Edit: () => null 27672 }; 27673 } 27674 27675 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js 27676 /** 27677 * WordPress dependencies 27678 */ 27679 27680 27681 27682 /** 27683 * Internal dependencies 27684 */ 27685 27686 function DateTime({ 27687 data, 27688 field, 27689 onChange, 27690 hideLabelFromVision 27691 }) { 27692 const { 27693 id, 27694 label 27695 } = field; 27696 const value = field.getValue({ 27697 item: data 27698 }); 27699 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27700 [id]: newValue 27701 }), [id, onChange]); 27702 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 27703 className: "dataviews-controls__datetime", 27704 children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 27705 as: "legend", 27706 children: label 27707 }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 27708 as: "legend", 27709 children: label 27710 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { 27711 currentTime: value, 27712 onChange: onChangeControl, 27713 hideLabelFromVision: true 27714 })] 27715 }); 27716 } 27717 27718 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js 27719 /** 27720 * WordPress dependencies 27721 */ 27722 27723 27724 27725 /** 27726 * Internal dependencies 27727 */ 27728 27729 function Integer({ 27730 data, 27731 field, 27732 onChange, 27733 hideLabelFromVision 27734 }) { 27735 var _field$getValue; 27736 const { 27737 id, 27738 label, 27739 description 27740 } = field; 27741 const value = (_field$getValue = field.getValue({ 27742 item: data 27743 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 27744 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27745 [id]: Number(newValue) 27746 }), [id, onChange]); 27747 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 27748 label: label, 27749 help: description, 27750 value: value, 27751 onChange: onChangeControl, 27752 __next40pxDefaultSize: true, 27753 hideLabelFromVision: hideLabelFromVision 27754 }); 27755 } 27756 27757 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js 27758 /** 27759 * WordPress dependencies 27760 */ 27761 27762 27763 27764 /** 27765 * Internal dependencies 27766 */ 27767 27768 function Radio({ 27769 data, 27770 field, 27771 onChange, 27772 hideLabelFromVision 27773 }) { 27774 const { 27775 id, 27776 label 27777 } = field; 27778 const value = field.getValue({ 27779 item: data 27780 }); 27781 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27782 [id]: newValue 27783 }), [id, onChange]); 27784 if (field.elements) { 27785 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 27786 label: label, 27787 onChange: onChangeControl, 27788 options: field.elements, 27789 selected: value, 27790 hideLabelFromVision: hideLabelFromVision 27791 }); 27792 } 27793 return null; 27794 } 27795 27796 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js 27797 /** 27798 * WordPress dependencies 27799 */ 27800 27801 27802 27803 27804 /** 27805 * Internal dependencies 27806 */ 27807 27808 function Select({ 27809 data, 27810 field, 27811 onChange, 27812 hideLabelFromVision 27813 }) { 27814 var _field$getValue, _field$elements; 27815 const { 27816 id, 27817 label 27818 } = field; 27819 const value = (_field$getValue = field.getValue({ 27820 item: data 27821 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 27822 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27823 [id]: newValue 27824 }), [id, onChange]); 27825 const elements = [ 27826 /* 27827 * Value can be undefined when: 27828 * 27829 * - the field is not required 27830 * - in bulk editing 27831 * 27832 */ 27833 { 27834 label: (0,external_wp_i18n_namespaceObject.__)('Select item'), 27835 value: '' 27836 }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; 27837 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 27838 label: label, 27839 value: value, 27840 options: elements, 27841 onChange: onChangeControl, 27842 __next40pxDefaultSize: true, 27843 __nextHasNoMarginBottom: true, 27844 hideLabelFromVision: hideLabelFromVision 27845 }); 27846 } 27847 27848 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js 27849 /** 27850 * WordPress dependencies 27851 */ 27852 27853 27854 27855 /** 27856 * Internal dependencies 27857 */ 27858 27859 function Text({ 27860 data, 27861 field, 27862 onChange, 27863 hideLabelFromVision 27864 }) { 27865 const { 27866 id, 27867 label, 27868 placeholder 27869 } = field; 27870 const value = field.getValue({ 27871 item: data 27872 }); 27873 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27874 [id]: newValue 27875 }), [id, onChange]); 27876 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 27877 label: label, 27878 placeholder: placeholder, 27879 value: value !== null && value !== void 0 ? value : '', 27880 onChange: onChangeControl, 27881 __next40pxDefaultSize: true, 27882 __nextHasNoMarginBottom: true, 27883 hideLabelFromVision: hideLabelFromVision 27884 }); 27885 } 27886 27887 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js 27888 /** 27889 * External dependencies 27890 */ 27891 27892 /** 27893 * Internal dependencies 27894 */ 27895 27896 27897 27898 27899 27900 27901 const FORM_CONTROLS = { 27902 datetime: DateTime, 27903 integer: Integer, 27904 radio: Radio, 27905 select: Select, 27906 text: Text 27907 }; 27908 function getControl(field, fieldTypeDefinition) { 27909 if (typeof field.Edit === 'function') { 27910 return field.Edit; 27911 } 27912 if (typeof field.Edit === 'string') { 27913 return getControlByType(field.Edit); 27914 } 27915 if (field.elements) { 27916 return getControlByType('select'); 27917 } 27918 if (typeof fieldTypeDefinition.Edit === 'string') { 27919 return getControlByType(fieldTypeDefinition.Edit); 27920 } 27921 return fieldTypeDefinition.Edit; 27922 } 27923 function getControlByType(type) { 27924 if (Object.keys(FORM_CONTROLS).includes(type)) { 27925 return FORM_CONTROLS[type]; 27926 } 27927 throw 'Control ' + type + ' not found'; 27928 } 27929 27930 ;// ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js 27931 /* wp:polyfill */ 27932 /** 27933 * Internal dependencies 27934 */ 27935 27936 27937 const getValueFromId = id => ({ 27938 item 27939 }) => { 27940 const path = id.split('.'); 27941 let value = item; 27942 for (const segment of path) { 27943 if (value.hasOwnProperty(segment)) { 27944 value = value[segment]; 27945 } else { 27946 value = undefined; 27947 } 27948 } 27949 return value; 27950 }; 27951 27952 /** 27953 * Apply default values and normalize the fields config. 27954 * 27955 * @param fields Fields config. 27956 * @return Normalized fields config. 27957 */ 27958 function normalizeFields(fields) { 27959 return fields.map(field => { 27960 var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; 27961 const fieldTypeDefinition = getFieldTypeDefinition(field.type); 27962 const getValue = field.getValue || getValueFromId(field.id); 27963 const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { 27964 return fieldTypeDefinition.sort(getValue({ 27965 item: a 27966 }), getValue({ 27967 item: b 27968 }), direction); 27969 }; 27970 const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { 27971 return fieldTypeDefinition.isValid(getValue({ 27972 item 27973 }), context); 27974 }; 27975 const Edit = getControl(field, fieldTypeDefinition); 27976 const renderFromElements = ({ 27977 item 27978 }) => { 27979 const value = getValue({ 27980 item 27981 }); 27982 return field?.elements?.find(element => element.value === value)?.label || getValue({ 27983 item 27984 }); 27985 }; 27986 const render = field.render || (field.elements ? renderFromElements : getValue); 27987 return { 27988 ...field, 27989 label: field.label || field.id, 27990 header: field.header || field.label || field.id, 27991 getValue, 27992 render, 27993 sort, 27994 isValid, 27995 Edit, 27996 enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, 27997 enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true 27998 }; 27999 }); 28000 } 28001 28002 ;// ./node_modules/@wordpress/dataviews/build-module/filter-and-sort-data-view.js 28003 /* wp:polyfill */ 28004 /** 28005 * External dependencies 28006 */ 28007 28008 28009 /** 28010 * Internal dependencies 28011 */ 28012 28013 28014 function normalizeSearchInput(input = '') { 28015 return remove_accents_default()(input.trim().toLowerCase()); 28016 } 28017 const filter_and_sort_data_view_EMPTY_ARRAY = []; 28018 28019 /** 28020 * Applies the filtering, sorting and pagination to the raw data based on the view configuration. 28021 * 28022 * @param data Raw data. 28023 * @param view View config. 28024 * @param fields Fields config. 28025 * 28026 * @return Filtered, sorted and paginated data. 28027 */ 28028 function filterSortAndPaginate(data, view, fields) { 28029 if (!data) { 28030 return { 28031 data: filter_and_sort_data_view_EMPTY_ARRAY, 28032 paginationInfo: { 28033 totalItems: 0, 28034 totalPages: 0 28035 } 28036 }; 28037 } 28038 const _fields = normalizeFields(fields); 28039 let filteredData = [...data]; 28040 // Handle global search. 28041 if (view.search) { 28042 const normalizedSearch = normalizeSearchInput(view.search); 28043 filteredData = filteredData.filter(item => { 28044 return _fields.filter(field => field.enableGlobalSearch).map(field => { 28045 return normalizeSearchInput(field.getValue({ 28046 item 28047 })); 28048 }).some(field => field.includes(normalizedSearch)); 28049 }); 28050 } 28051 if (view.filters && view.filters?.length > 0) { 28052 view.filters.forEach(filter => { 28053 const field = _fields.find(_field => _field.id === filter.field); 28054 if (field) { 28055 if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) { 28056 filteredData = filteredData.filter(item => { 28057 const fieldValue = field.getValue({ 28058 item 28059 }); 28060 if (Array.isArray(fieldValue)) { 28061 return filter.value.some(filterValue => fieldValue.includes(filterValue)); 28062 } else if (typeof fieldValue === 'string') { 28063 return filter.value.includes(fieldValue); 28064 } 28065 return false; 28066 }); 28067 } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) { 28068 filteredData = filteredData.filter(item => { 28069 const fieldValue = field.getValue({ 28070 item 28071 }); 28072 if (Array.isArray(fieldValue)) { 28073 return !filter.value.some(filterValue => fieldValue.includes(filterValue)); 28074 } else if (typeof fieldValue === 'string') { 28075 return !filter.value.includes(fieldValue); 28076 } 28077 return false; 28078 }); 28079 } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) { 28080 filteredData = filteredData.filter(item => { 28081 return filter.value.every(value => { 28082 return field.getValue({ 28083 item 28084 })?.includes(value); 28085 }); 28086 }); 28087 } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) { 28088 filteredData = filteredData.filter(item => { 28089 return filter.value.every(value => { 28090 return !field.getValue({ 28091 item 28092 })?.includes(value); 28093 }); 28094 }); 28095 } else if (filter.operator === constants_OPERATOR_IS) { 28096 filteredData = filteredData.filter(item => { 28097 return filter.value === field.getValue({ 28098 item 28099 }); 28100 }); 28101 } else if (filter.operator === constants_OPERATOR_IS_NOT) { 28102 filteredData = filteredData.filter(item => { 28103 return filter.value !== field.getValue({ 28104 item 28105 }); 28106 }); 28107 } 28108 } 28109 }); 28110 } 28111 28112 // Handle sorting. 28113 if (view.sort) { 28114 const fieldId = view.sort.field; 28115 const fieldToSort = _fields.find(field => { 28116 return field.id === fieldId; 28117 }); 28118 if (fieldToSort) { 28119 filteredData.sort((a, b) => { 28120 var _view$sort$direction; 28121 return fieldToSort.sort(a, b, (_view$sort$direction = view.sort?.direction) !== null && _view$sort$direction !== void 0 ? _view$sort$direction : 'desc'); 28122 }); 28123 } 28124 } 28125 28126 // Handle pagination. 28127 let totalItems = filteredData.length; 28128 let totalPages = 1; 28129 if (view.page !== undefined && view.perPage !== undefined) { 28130 const start = (view.page - 1) * view.perPage; 28131 totalItems = filteredData?.length || 0; 28132 totalPages = Math.ceil(totalItems / view.perPage); 28133 filteredData = filteredData?.slice(start, start + view.perPage); 28134 } 28135 return { 28136 data: filteredData, 28137 paginationInfo: { 28138 totalItems, 28139 totalPages 28140 } 28141 }; 28142 } 28143 28144 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js 28145 /** 28146 * WordPress dependencies 28147 */ 28148 28149 28150 /** 28151 * Internal dependencies 28152 */ 28153 28154 28155 const DataViewsContext = (0,external_wp_element_namespaceObject.createContext)({ 28156 view: { 28157 type: constants_LAYOUT_TABLE 28158 }, 28159 onChangeView: () => {}, 28160 fields: [], 28161 data: [], 28162 paginationInfo: { 28163 totalItems: 0, 28164 totalPages: 0 28165 }, 28166 selection: [], 28167 onChangeSelection: () => {}, 28168 setOpenedFilter: () => {}, 28169 openedFilter: null, 28170 getItemId: item => item.id, 28171 isItemClickable: () => true, 28172 containerWidth: 0 28173 }); 28174 /* harmony default export */ const dataviews_context = (DataViewsContext); 28175 28176 ;// ./node_modules/@wordpress/icons/build-module/library/funnel.js 28177 /** 28178 * WordPress dependencies 28179 */ 28180 28181 28182 const funnel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 28183 viewBox: "0 0 24 24", 28184 xmlns: "http://www.w3.org/2000/svg", 28185 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 28186 d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" 28187 }) 28188 }); 28189 /* harmony default export */ const library_funnel = (funnel); 28190 28191 ;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js 28192 "use client"; 28193 var __defProp = Object.defineProperty; 28194 var __defProps = Object.defineProperties; 28195 var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 28196 var __getOwnPropSymbols = Object.getOwnPropertySymbols; 28197 var __hasOwnProp = Object.prototype.hasOwnProperty; 28198 var __propIsEnum = Object.prototype.propertyIsEnumerable; 28199 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 28200 var _3YLGPPWQ_spreadValues = (a, b) => { 28201 for (var prop in b || (b = {})) 28202 if (__hasOwnProp.call(b, prop)) 28203 __defNormalProp(a, prop, b[prop]); 28204 if (__getOwnPropSymbols) 28205 for (var prop of __getOwnPropSymbols(b)) { 28206 if (__propIsEnum.call(b, prop)) 28207 __defNormalProp(a, prop, b[prop]); 28208 } 28209 return a; 28210 }; 28211 var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 28212 var __objRest = (source, exclude) => { 28213 var target = {}; 28214 for (var prop in source) 28215 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 28216 target[prop] = source[prop]; 28217 if (source != null && __getOwnPropSymbols) 28218 for (var prop of __getOwnPropSymbols(source)) { 28219 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) 28220 target[prop] = source[prop]; 28221 } 28222 return target; 28223 }; 28224 28225 28226 28227 ;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js 28228 "use client"; 28229 var _3YLGPPWQ_defProp = Object.defineProperty; 28230 var _3YLGPPWQ_defProps = Object.defineProperties; 28231 var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; 28232 var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; 28233 var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; 28234 var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; 28235 var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 28236 var _chunks_3YLGPPWQ_spreadValues = (a, b) => { 28237 for (var prop in b || (b = {})) 28238 if (_3YLGPPWQ_hasOwnProp.call(b, prop)) 28239 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 28240 if (_3YLGPPWQ_getOwnPropSymbols) 28241 for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { 28242 if (_3YLGPPWQ_propIsEnum.call(b, prop)) 28243 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 28244 } 28245 return a; 28246 }; 28247 var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); 28248 var _3YLGPPWQ_objRest = (source, exclude) => { 28249 var target = {}; 28250 for (var prop in source) 28251 if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 28252 target[prop] = source[prop]; 28253 if (source != null && _3YLGPPWQ_getOwnPropSymbols) 28254 for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { 28255 if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) 28256 target[prop] = source[prop]; 28257 } 28258 return target; 28259 }; 28260 28261 28262 28263 ;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js 28264 "use client"; 28265 28266 28267 // src/utils/misc.ts 28268 function PBFD2E7P_noop(..._) { 28269 } 28270 function shallowEqual(a, b) { 28271 if (a === b) return true; 28272 if (!a) return false; 28273 if (!b) return false; 28274 if (typeof a !== "object") return false; 28275 if (typeof b !== "object") return false; 28276 const aKeys = Object.keys(a); 28277 const bKeys = Object.keys(b); 28278 const { length } = aKeys; 28279 if (bKeys.length !== length) return false; 28280 for (const key of aKeys) { 28281 if (a[key] !== b[key]) { 28282 return false; 28283 } 28284 } 28285 return true; 28286 } 28287 function applyState(argument, currentValue) { 28288 if (isUpdater(argument)) { 28289 const value = isLazyValue(currentValue) ? currentValue() : currentValue; 28290 return argument(value); 28291 } 28292 return argument; 28293 } 28294 function isUpdater(argument) { 28295 return typeof argument === "function"; 28296 } 28297 function isLazyValue(value) { 28298 return typeof value === "function"; 28299 } 28300 function isObject(arg) { 28301 return typeof arg === "object" && arg != null; 28302 } 28303 function isEmpty(arg) { 28304 if (Array.isArray(arg)) return !arg.length; 28305 if (isObject(arg)) return !Object.keys(arg).length; 28306 if (arg == null) return true; 28307 if (arg === "") return true; 28308 return false; 28309 } 28310 function isInteger(arg) { 28311 if (typeof arg === "number") { 28312 return Math.floor(arg) === arg; 28313 } 28314 return String(Math.floor(Number(arg))) === arg; 28315 } 28316 function PBFD2E7P_hasOwnProperty(object, prop) { 28317 if (typeof Object.hasOwn === "function") { 28318 return Object.hasOwn(object, prop); 28319 } 28320 return Object.prototype.hasOwnProperty.call(object, prop); 28321 } 28322 function chain(...fns) { 28323 return (...args) => { 28324 for (const fn of fns) { 28325 if (typeof fn === "function") { 28326 fn(...args); 28327 } 28328 } 28329 }; 28330 } 28331 function cx(...args) { 28332 return args.filter(Boolean).join(" ") || void 0; 28333 } 28334 function PBFD2E7P_normalizeString(str) { 28335 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 28336 } 28337 function omit(object, keys) { 28338 const result = _chunks_3YLGPPWQ_spreadValues({}, object); 28339 for (const key of keys) { 28340 if (PBFD2E7P_hasOwnProperty(result, key)) { 28341 delete result[key]; 28342 } 28343 } 28344 return result; 28345 } 28346 function pick(object, paths) { 28347 const result = {}; 28348 for (const key of paths) { 28349 if (PBFD2E7P_hasOwnProperty(object, key)) { 28350 result[key] = object[key]; 28351 } 28352 } 28353 return result; 28354 } 28355 function identity(value) { 28356 return value; 28357 } 28358 function beforePaint(cb = PBFD2E7P_noop) { 28359 const raf = requestAnimationFrame(cb); 28360 return () => cancelAnimationFrame(raf); 28361 } 28362 function afterPaint(cb = PBFD2E7P_noop) { 28363 let raf = requestAnimationFrame(() => { 28364 raf = requestAnimationFrame(cb); 28365 }); 28366 return () => cancelAnimationFrame(raf); 28367 } 28368 function invariant(condition, message) { 28369 if (condition) return; 28370 if (typeof message !== "string") throw new Error("Invariant failed"); 28371 throw new Error(message); 28372 } 28373 function getKeys(obj) { 28374 return Object.keys(obj); 28375 } 28376 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 28377 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 28378 if (result == null) return false; 28379 return !result; 28380 } 28381 function disabledFromProps(props) { 28382 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 28383 } 28384 function removeUndefinedValues(obj) { 28385 const result = {}; 28386 for (const key in obj) { 28387 if (obj[key] !== void 0) { 28388 result[key] = obj[key]; 28389 } 28390 } 28391 return result; 28392 } 28393 function defaultValue(...values) { 28394 for (const value of values) { 28395 if (value !== void 0) return value; 28396 } 28397 return void 0; 28398 } 28399 28400 28401 28402 ;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js 28403 "use client"; 28404 28405 28406 // src/utils/misc.ts 28407 28408 28409 function setRef(ref, value) { 28410 if (typeof ref === "function") { 28411 ref(value); 28412 } else if (ref) { 28413 ref.current = value; 28414 } 28415 } 28416 function isValidElementWithRef(element) { 28417 if (!element) return false; 28418 if (!(0,external_React_.isValidElement)(element)) return false; 28419 if ("ref" in element.props) return true; 28420 if ("ref" in element) return true; 28421 return false; 28422 } 28423 function getRefProperty(element) { 28424 if (!isValidElementWithRef(element)) return null; 28425 const props = _3YLGPPWQ_spreadValues({}, element.props); 28426 return props.ref || element.ref; 28427 } 28428 function mergeProps(base, overrides) { 28429 const props = _3YLGPPWQ_spreadValues({}, base); 28430 for (const key in overrides) { 28431 if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; 28432 if (key === "className") { 28433 const prop = "className"; 28434 props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop]; 28435 continue; 28436 } 28437 if (key === "style") { 28438 const prop = "style"; 28439 props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; 28440 continue; 28441 } 28442 const overrideValue = overrides[key]; 28443 if (typeof overrideValue === "function" && key.startsWith("on")) { 28444 const baseValue = base[key]; 28445 if (typeof baseValue === "function") { 28446 props[key] = (...args) => { 28447 overrideValue(...args); 28448 baseValue(...args); 28449 }; 28450 continue; 28451 } 28452 } 28453 props[key] = overrideValue; 28454 } 28455 return props; 28456 } 28457 28458 28459 28460 ;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js 28461 "use client"; 28462 28463 // src/utils/dom.ts 28464 var DTR5TSDJ_canUseDOM = checkIsBrowser(); 28465 function checkIsBrowser() { 28466 var _a; 28467 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); 28468 } 28469 function getDocument(node) { 28470 if (!node) return document; 28471 if ("self" in node) return node.document; 28472 return node.ownerDocument || document; 28473 } 28474 function getWindow(node) { 28475 if (!node) return self; 28476 if ("self" in node) return node.self; 28477 return getDocument(node).defaultView || window; 28478 } 28479 function DTR5TSDJ_getActiveElement(node, activeDescendant = false) { 28480 const { activeElement } = getDocument(node); 28481 if (!(activeElement == null ? void 0 : activeElement.nodeName)) { 28482 return null; 28483 } 28484 if (DTR5TSDJ_isFrame(activeElement) && activeElement.contentDocument) { 28485 return DTR5TSDJ_getActiveElement( 28486 activeElement.contentDocument.body, 28487 activeDescendant 28488 ); 28489 } 28490 if (activeDescendant) { 28491 const id = activeElement.getAttribute("aria-activedescendant"); 28492 if (id) { 28493 const element = getDocument(activeElement).getElementById(id); 28494 if (element) { 28495 return element; 28496 } 28497 } 28498 } 28499 return activeElement; 28500 } 28501 function contains(parent, child) { 28502 return parent === child || parent.contains(child); 28503 } 28504 function DTR5TSDJ_isFrame(element) { 28505 return element.tagName === "IFRAME"; 28506 } 28507 function isButton(element) { 28508 const tagName = element.tagName.toLowerCase(); 28509 if (tagName === "button") return true; 28510 if (tagName === "input" && element.type) { 28511 return buttonInputTypes.indexOf(element.type) !== -1; 28512 } 28513 return false; 28514 } 28515 var buttonInputTypes = [ 28516 "button", 28517 "color", 28518 "file", 28519 "image", 28520 "reset", 28521 "submit" 28522 ]; 28523 function isVisible(element) { 28524 if (typeof element.checkVisibility === "function") { 28525 return element.checkVisibility(); 28526 } 28527 const htmlElement = element; 28528 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 28529 } 28530 function isTextField(element) { 28531 try { 28532 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 28533 const isTextArea = element.tagName === "TEXTAREA"; 28534 return isTextInput || isTextArea || false; 28535 } catch (error) { 28536 return false; 28537 } 28538 } 28539 function isTextbox(element) { 28540 return element.isContentEditable || isTextField(element); 28541 } 28542 function getTextboxValue(element) { 28543 if (isTextField(element)) { 28544 return element.value; 28545 } 28546 if (element.isContentEditable) { 28547 const range = getDocument(element).createRange(); 28548 range.selectNodeContents(element); 28549 return range.toString(); 28550 } 28551 return ""; 28552 } 28553 function getTextboxSelection(element) { 28554 let start = 0; 28555 let end = 0; 28556 if (isTextField(element)) { 28557 start = element.selectionStart || 0; 28558 end = element.selectionEnd || 0; 28559 } else if (element.isContentEditable) { 28560 const selection = getDocument(element).getSelection(); 28561 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { 28562 const range = selection.getRangeAt(0); 28563 const nextRange = range.cloneRange(); 28564 nextRange.selectNodeContents(element); 28565 nextRange.setEnd(range.startContainer, range.startOffset); 28566 start = nextRange.toString().length; 28567 nextRange.setEnd(range.endContainer, range.endOffset); 28568 end = nextRange.toString().length; 28569 } 28570 } 28571 return { start, end }; 28572 } 28573 function getPopupRole(element, fallback) { 28574 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; 28575 const role = element == null ? void 0 : element.getAttribute("role"); 28576 if (role && allowedPopupRoles.indexOf(role) !== -1) { 28577 return role; 28578 } 28579 return fallback; 28580 } 28581 function getPopupItemRole(element, fallback) { 28582 var _a; 28583 const itemRoleByPopupRole = { 28584 menu: "menuitem", 28585 listbox: "option", 28586 tree: "treeitem" 28587 }; 28588 const popupRole = getPopupRole(element); 28589 if (!popupRole) return fallback; 28590 const key = popupRole; 28591 return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; 28592 } 28593 function scrollIntoViewIfNeeded(element, arg) { 28594 if (isPartiallyHidden(element) && "scrollIntoView" in element) { 28595 element.scrollIntoView(arg); 28596 } 28597 } 28598 function getScrollingElement(element) { 28599 if (!element) return null; 28600 const isScrollableOverflow = (overflow) => { 28601 if (overflow === "auto") return true; 28602 if (overflow === "scroll") return true; 28603 return false; 28604 }; 28605 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 28606 const { overflowY } = getComputedStyle(element); 28607 if (isScrollableOverflow(overflowY)) return element; 28608 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 28609 const { overflowX } = getComputedStyle(element); 28610 if (isScrollableOverflow(overflowX)) return element; 28611 } 28612 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; 28613 } 28614 function isPartiallyHidden(element) { 28615 const elementRect = element.getBoundingClientRect(); 28616 const scroller = getScrollingElement(element); 28617 if (!scroller) return false; 28618 const scrollerRect = scroller.getBoundingClientRect(); 28619 const isHTML = scroller.tagName === "HTML"; 28620 const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; 28621 const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; 28622 const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; 28623 const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; 28624 const top = elementRect.top < scrollerTop; 28625 const left = elementRect.left < scrollerLeft; 28626 const bottom = elementRect.bottom > scrollerBottom; 28627 const right = elementRect.right > scrollerRight; 28628 return top || left || bottom || right; 28629 } 28630 function setSelectionRange(element, ...args) { 28631 if (/text|search|password|tel|url/i.test(element.type)) { 28632 element.setSelectionRange(...args); 28633 } 28634 } 28635 function sortBasedOnDOMPosition(items, getElement) { 28636 const pairs = items.map((item, index) => [index, item]); 28637 let isOrderDifferent = false; 28638 pairs.sort(([indexA, a], [indexB, b]) => { 28639 const elementA = getElement(a); 28640 const elementB = getElement(b); 28641 if (elementA === elementB) return 0; 28642 if (!elementA || !elementB) return 0; 28643 if (isElementPreceding(elementA, elementB)) { 28644 if (indexA > indexB) { 28645 isOrderDifferent = true; 28646 } 28647 return -1; 28648 } 28649 if (indexA < indexB) { 28650 isOrderDifferent = true; 28651 } 28652 return 1; 28653 }); 28654 if (isOrderDifferent) { 28655 return pairs.map(([_, item]) => item); 28656 } 28657 return items; 28658 } 28659 function isElementPreceding(a, b) { 28660 return Boolean( 28661 b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING 28662 ); 28663 } 28664 28665 28666 28667 ;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js 28668 "use client"; 28669 28670 28671 // src/utils/platform.ts 28672 function isTouchDevice() { 28673 return DTR5TSDJ_canUseDOM && !!navigator.maxTouchPoints; 28674 } 28675 function isApple() { 28676 if (!DTR5TSDJ_canUseDOM) return false; 28677 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 28678 } 28679 function isSafari() { 28680 return DTR5TSDJ_canUseDOM && isApple() && /apple/i.test(navigator.vendor); 28681 } 28682 function isFirefox() { 28683 return DTR5TSDJ_canUseDOM && /firefox\//i.test(navigator.userAgent); 28684 } 28685 function isMac() { 28686 return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); 28687 } 28688 28689 28690 28691 ;// ./node_modules/@ariakit/core/esm/utils/events.js 28692 "use client"; 28693 28694 28695 28696 28697 // src/utils/events.ts 28698 function isPortalEvent(event) { 28699 return Boolean( 28700 event.currentTarget && !contains(event.currentTarget, event.target) 28701 ); 28702 } 28703 function isSelfTarget(event) { 28704 return event.target === event.currentTarget; 28705 } 28706 function isOpeningInNewTab(event) { 28707 const element = event.currentTarget; 28708 if (!element) return false; 28709 const isAppleDevice = isApple(); 28710 if (isAppleDevice && !event.metaKey) return false; 28711 if (!isAppleDevice && !event.ctrlKey) return false; 28712 const tagName = element.tagName.toLowerCase(); 28713 if (tagName === "a") return true; 28714 if (tagName === "button" && element.type === "submit") return true; 28715 if (tagName === "input" && element.type === "submit") return true; 28716 return false; 28717 } 28718 function isDownloading(event) { 28719 const element = event.currentTarget; 28720 if (!element) return false; 28721 const tagName = element.tagName.toLowerCase(); 28722 if (!event.altKey) return false; 28723 if (tagName === "a") return true; 28724 if (tagName === "button" && element.type === "submit") return true; 28725 if (tagName === "input" && element.type === "submit") return true; 28726 return false; 28727 } 28728 function fireEvent(element, type, eventInit) { 28729 const event = new Event(type, eventInit); 28730 return element.dispatchEvent(event); 28731 } 28732 function fireBlurEvent(element, eventInit) { 28733 const event = new FocusEvent("blur", eventInit); 28734 const defaultAllowed = element.dispatchEvent(event); 28735 const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); 28736 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 28737 return defaultAllowed; 28738 } 28739 function fireFocusEvent(element, eventInit) { 28740 const event = new FocusEvent("focus", eventInit); 28741 const defaultAllowed = element.dispatchEvent(event); 28742 const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); 28743 element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); 28744 return defaultAllowed; 28745 } 28746 function fireKeyboardEvent(element, type, eventInit) { 28747 const event = new KeyboardEvent(type, eventInit); 28748 return element.dispatchEvent(event); 28749 } 28750 function fireClickEvent(element, eventInit) { 28751 const event = new MouseEvent("click", eventInit); 28752 return element.dispatchEvent(event); 28753 } 28754 function isFocusEventOutside(event, container) { 28755 const containerElement = container || event.currentTarget; 28756 const relatedTarget = event.relatedTarget; 28757 return !relatedTarget || !contains(containerElement, relatedTarget); 28758 } 28759 function getInputType(event) { 28760 const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; 28761 if (!nativeEvent) return; 28762 if (!("inputType" in nativeEvent)) return; 28763 if (typeof nativeEvent.inputType !== "string") return; 28764 return nativeEvent.inputType; 28765 } 28766 function queueBeforeEvent(element, type, callback, timeout) { 28767 const createTimer = (callback2) => { 28768 if (timeout) { 28769 const timerId2 = setTimeout(callback2, timeout); 28770 return () => clearTimeout(timerId2); 28771 } 28772 const timerId = requestAnimationFrame(callback2); 28773 return () => cancelAnimationFrame(timerId); 28774 }; 28775 const cancelTimer = createTimer(() => { 28776 element.removeEventListener(type, callSync, true); 28777 callback(); 28778 }); 28779 const callSync = () => { 28780 cancelTimer(); 28781 callback(); 28782 }; 28783 element.addEventListener(type, callSync, { once: true, capture: true }); 28784 return cancelTimer; 28785 } 28786 function addGlobalEventListener(type, listener, options, scope = window) { 28787 const children = []; 28788 try { 28789 scope.document.addEventListener(type, listener, options); 28790 for (const frame of Array.from(scope.frames)) { 28791 children.push(addGlobalEventListener(type, listener, options, frame)); 28792 } 28793 } catch (e) { 28794 } 28795 const removeEventListener = () => { 28796 try { 28797 scope.document.removeEventListener(type, listener, options); 28798 } catch (e) { 28799 } 28800 for (const remove of children) { 28801 remove(); 28802 } 28803 }; 28804 return removeEventListener; 28805 } 28806 28807 28808 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js 28809 "use client"; 28810 28811 28812 28813 // src/utils/hooks.ts 28814 28815 28816 28817 28818 var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); 28819 var useReactId = _React.useId; 28820 var useReactDeferredValue = _React.useDeferredValue; 28821 var useReactInsertionEffect = _React.useInsertionEffect; 28822 var useSafeLayoutEffect = DTR5TSDJ_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; 28823 function useInitialValue(value) { 28824 const [initialValue] = (0,external_React_.useState)(value); 28825 return initialValue; 28826 } 28827 function useLazyValue(init) { 28828 const ref = useRef(); 28829 if (ref.current === void 0) { 28830 ref.current = init(); 28831 } 28832 return ref.current; 28833 } 28834 function useLiveRef(value) { 28835 const ref = (0,external_React_.useRef)(value); 28836 useSafeLayoutEffect(() => { 28837 ref.current = value; 28838 }); 28839 return ref; 28840 } 28841 function usePreviousValue(value) { 28842 const [previousValue, setPreviousValue] = useState(value); 28843 if (value !== previousValue) { 28844 setPreviousValue(value); 28845 } 28846 return previousValue; 28847 } 28848 function useEvent(callback) { 28849 const ref = (0,external_React_.useRef)(() => { 28850 throw new Error("Cannot call an event handler while rendering."); 28851 }); 28852 if (useReactInsertionEffect) { 28853 useReactInsertionEffect(() => { 28854 ref.current = callback; 28855 }); 28856 } else { 28857 ref.current = callback; 28858 } 28859 return (0,external_React_.useCallback)((...args) => { 28860 var _a; 28861 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); 28862 }, []); 28863 } 28864 function useTransactionState(callback) { 28865 const [state, setState] = (0,external_React_.useState)(null); 28866 useSafeLayoutEffect(() => { 28867 if (state == null) return; 28868 if (!callback) return; 28869 let prevState = null; 28870 callback((prev) => { 28871 prevState = prev; 28872 return state; 28873 }); 28874 return () => { 28875 callback(prevState); 28876 }; 28877 }, [state, callback]); 28878 return [state, setState]; 28879 } 28880 function useMergeRefs(...refs) { 28881 return (0,external_React_.useMemo)(() => { 28882 if (!refs.some(Boolean)) return; 28883 return (value) => { 28884 for (const ref of refs) { 28885 setRef(ref, value); 28886 } 28887 }; 28888 }, refs); 28889 } 28890 function useId(defaultId) { 28891 if (useReactId) { 28892 const reactId = useReactId(); 28893 if (defaultId) return defaultId; 28894 return reactId; 28895 } 28896 const [id, setId] = (0,external_React_.useState)(defaultId); 28897 useSafeLayoutEffect(() => { 28898 if (defaultId || id) return; 28899 const random = Math.random().toString(36).slice(2, 8); 28900 setId(`id-$random}`); 28901 }, [defaultId, id]); 28902 return defaultId || id; 28903 } 28904 function useDeferredValue(value) { 28905 if (useReactDeferredValue) { 28906 return useReactDeferredValue(value); 28907 } 28908 const [deferredValue, setDeferredValue] = useState(value); 28909 useEffect(() => { 28910 const raf = requestAnimationFrame(() => setDeferredValue(value)); 28911 return () => cancelAnimationFrame(raf); 28912 }, [value]); 28913 return deferredValue; 28914 } 28915 function useTagName(refOrElement, type) { 28916 const stringOrUndefined = (type2) => { 28917 if (typeof type2 !== "string") return; 28918 return type2; 28919 }; 28920 const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); 28921 useSafeLayoutEffect(() => { 28922 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 28923 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); 28924 }, [refOrElement, type]); 28925 return tagName; 28926 } 28927 function useAttribute(refOrElement, attributeName, defaultValue) { 28928 const initialValue = useInitialValue(defaultValue); 28929 const [attribute, setAttribute] = (0,external_React_.useState)(initialValue); 28930 (0,external_React_.useEffect)(() => { 28931 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 28932 if (!element) return; 28933 const callback = () => { 28934 const value = element.getAttribute(attributeName); 28935 setAttribute(value == null ? initialValue : value); 28936 }; 28937 const observer = new MutationObserver(callback); 28938 observer.observe(element, { attributeFilter: [attributeName] }); 28939 callback(); 28940 return () => observer.disconnect(); 28941 }, [refOrElement, attributeName, initialValue]); 28942 return attribute; 28943 } 28944 function useUpdateEffect(effect, deps) { 28945 const mounted = (0,external_React_.useRef)(false); 28946 (0,external_React_.useEffect)(() => { 28947 if (mounted.current) { 28948 return effect(); 28949 } 28950 mounted.current = true; 28951 }, deps); 28952 (0,external_React_.useEffect)( 28953 () => () => { 28954 mounted.current = false; 28955 }, 28956 [] 28957 ); 28958 } 28959 function useUpdateLayoutEffect(effect, deps) { 28960 const mounted = (0,external_React_.useRef)(false); 28961 useSafeLayoutEffect(() => { 28962 if (mounted.current) { 28963 return effect(); 28964 } 28965 mounted.current = true; 28966 }, deps); 28967 useSafeLayoutEffect( 28968 () => () => { 28969 mounted.current = false; 28970 }, 28971 [] 28972 ); 28973 } 28974 function useForceUpdate() { 28975 return (0,external_React_.useReducer)(() => [], []); 28976 } 28977 function useBooleanEvent(booleanOrCallback) { 28978 return useEvent( 28979 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback 28980 ); 28981 } 28982 function useWrapElement(props, callback, deps = []) { 28983 const wrapElement = (0,external_React_.useCallback)( 28984 (element) => { 28985 if (props.wrapElement) { 28986 element = props.wrapElement(element); 28987 } 28988 return callback(element); 28989 }, 28990 [...deps, props.wrapElement] 28991 ); 28992 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); 28993 } 28994 function usePortalRef(portalProp = false, portalRefProp) { 28995 const [portalNode, setPortalNode] = useState(null); 28996 const portalRef = useMergeRefs(setPortalNode, portalRefProp); 28997 const domReady = !portalProp || portalNode; 28998 return { portalRef, portalNode, domReady }; 28999 } 29000 function useMetadataProps(props, key, value) { 29001 const parent = props.onLoadedMetadataCapture; 29002 const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { 29003 return Object.assign(() => { 29004 }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); 29005 }, [parent, key, value]); 29006 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; 29007 } 29008 function useIsMouseMoving() { 29009 (0,external_React_.useEffect)(() => { 29010 addGlobalEventListener("mousemove", setMouseMoving, true); 29011 addGlobalEventListener("mousedown", resetMouseMoving, true); 29012 addGlobalEventListener("mouseup", resetMouseMoving, true); 29013 addGlobalEventListener("keydown", resetMouseMoving, true); 29014 addGlobalEventListener("scroll", resetMouseMoving, true); 29015 }, []); 29016 const isMouseMoving = useEvent(() => mouseMoving); 29017 return isMouseMoving; 29018 } 29019 var mouseMoving = false; 29020 var previousScreenX = 0; 29021 var previousScreenY = 0; 29022 function hasMouseMovement(event) { 29023 const movementX = event.movementX || event.screenX - previousScreenX; 29024 const movementY = event.movementY || event.screenY - previousScreenY; 29025 previousScreenX = event.screenX; 29026 previousScreenY = event.screenY; 29027 return movementX || movementY || "production" === "test"; 29028 } 29029 function setMouseMoving(event) { 29030 if (!hasMouseMovement(event)) return; 29031 mouseMoving = true; 29032 } 29033 function resetMouseMoving() { 29034 mouseMoving = false; 29035 } 29036 29037 29038 29039 ;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js 29040 "use client"; 29041 29042 29043 29044 29045 // src/utils/system.tsx 29046 29047 29048 function forwardRef2(render) { 29049 const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); 29050 Role.displayName = render.displayName || render.name; 29051 return Role; 29052 } 29053 function memo2(Component, propsAreEqual) { 29054 return external_React_.memo(Component, propsAreEqual); 29055 } 29056 function createElement(Type, props) { 29057 const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); 29058 const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); 29059 let element; 29060 if (external_React_.isValidElement(render)) { 29061 const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); 29062 element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); 29063 } else if (render) { 29064 element = render(rest); 29065 } else { 29066 element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); 29067 } 29068 if (wrapElement) { 29069 return wrapElement(element); 29070 } 29071 return element; 29072 } 29073 function createHook(useProps) { 29074 const useRole = (props = {}) => { 29075 return useProps(props); 29076 }; 29077 useRole.displayName = useProps.name; 29078 return useRole; 29079 } 29080 function createStoreContext(providers = [], scopedProviders = []) { 29081 const context = external_React_.createContext(void 0); 29082 const scopedContext = external_React_.createContext(void 0); 29083 const useContext2 = () => external_React_.useContext(context); 29084 const useScopedContext = (onlyScoped = false) => { 29085 const scoped = external_React_.useContext(scopedContext); 29086 const store = useContext2(); 29087 if (onlyScoped) return scoped; 29088 return scoped || store; 29089 }; 29090 const useProviderContext = () => { 29091 const scoped = external_React_.useContext(scopedContext); 29092 const store = useContext2(); 29093 if (scoped && scoped === store) return; 29094 return store; 29095 }; 29096 const ContextProvider = (props) => { 29097 return providers.reduceRight( 29098 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 29099 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) 29100 ); 29101 }; 29102 const ScopedContextProvider = (props) => { 29103 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( 29104 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 29105 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) 29106 ) })); 29107 }; 29108 return { 29109 context, 29110 scopedContext, 29111 useContext: useContext2, 29112 useScopedContext, 29113 useProviderContext, 29114 ContextProvider, 29115 ScopedContextProvider 29116 }; 29117 } 29118 29119 29120 29121 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js 29122 "use client"; 29123 29124 29125 // src/collection/collection-context.tsx 29126 var ctx = createStoreContext(); 29127 var useCollectionContext = ctx.useContext; 29128 var useCollectionScopedContext = ctx.useScopedContext; 29129 var useCollectionProviderContext = ctx.useProviderContext; 29130 var CollectionContextProvider = ctx.ContextProvider; 29131 var CollectionScopedContextProvider = ctx.ScopedContextProvider; 29132 29133 29134 29135 ;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js 29136 "use client"; 29137 29138 29139 29140 // src/composite/composite-context.tsx 29141 29142 var P7GR5CS5_ctx = createStoreContext( 29143 [CollectionContextProvider], 29144 [CollectionScopedContextProvider] 29145 ); 29146 var useCompositeContext = P7GR5CS5_ctx.useContext; 29147 var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext; 29148 var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext; 29149 var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider; 29150 var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider; 29151 var CompositeItemContext = (0,external_React_.createContext)( 29152 void 0 29153 ); 29154 var CompositeRowContext = (0,external_React_.createContext)( 29155 void 0 29156 ); 29157 29158 29159 29160 ;// ./node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js 29161 "use client"; 29162 29163 29164 29165 // src/tag/tag-context.tsx 29166 29167 var TagValueContext = (0,external_React_.createContext)(null); 29168 var TagRemoveIdContext = (0,external_React_.createContext)( 29169 null 29170 ); 29171 var _3XAVFTCA_ctx = createStoreContext( 29172 [CompositeContextProvider], 29173 [CompositeScopedContextProvider] 29174 ); 29175 var useTagContext = _3XAVFTCA_ctx.useContext; 29176 var useTagScopedContext = _3XAVFTCA_ctx.useScopedContext; 29177 var useTagProviderContext = _3XAVFTCA_ctx.useProviderContext; 29178 var TagContextProvider = _3XAVFTCA_ctx.ContextProvider; 29179 var TagScopedContextProvider = _3XAVFTCA_ctx.ScopedContextProvider; 29180 29181 29182 29183 ;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js 29184 "use client"; 29185 29186 29187 29188 // src/utils/store.ts 29189 function getInternal(store, key) { 29190 const internals = store.__unstableInternals; 29191 invariant(internals, "Invalid store"); 29192 return internals[key]; 29193 } 29194 function createStore(initialState, ...stores) { 29195 let state = initialState; 29196 let prevStateBatch = state; 29197 let lastUpdate = Symbol(); 29198 let destroy = PBFD2E7P_noop; 29199 const instances = /* @__PURE__ */ new Set(); 29200 const updatedKeys = /* @__PURE__ */ new Set(); 29201 const setups = /* @__PURE__ */ new Set(); 29202 const listeners = /* @__PURE__ */ new Set(); 29203 const batchListeners = /* @__PURE__ */ new Set(); 29204 const disposables = /* @__PURE__ */ new WeakMap(); 29205 const listenerKeys = /* @__PURE__ */ new WeakMap(); 29206 const storeSetup = (callback) => { 29207 setups.add(callback); 29208 return () => setups.delete(callback); 29209 }; 29210 const storeInit = () => { 29211 const initialized = instances.size; 29212 const instance = Symbol(); 29213 instances.add(instance); 29214 const maybeDestroy = () => { 29215 instances.delete(instance); 29216 if (instances.size) return; 29217 destroy(); 29218 }; 29219 if (initialized) return maybeDestroy; 29220 const desyncs = getKeys(state).map( 29221 (key) => chain( 29222 ...stores.map((store) => { 29223 var _a; 29224 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); 29225 if (!storeState) return; 29226 if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; 29227 return sync(store, [key], (state2) => { 29228 setState( 29229 key, 29230 state2[key], 29231 // @ts-expect-error - Not public API. This is just to prevent 29232 // infinite loops. 29233 true 29234 ); 29235 }); 29236 }) 29237 ) 29238 ); 29239 const teardowns = []; 29240 for (const setup2 of setups) { 29241 teardowns.push(setup2()); 29242 } 29243 const cleanups = stores.map(init); 29244 destroy = chain(...desyncs, ...teardowns, ...cleanups); 29245 return maybeDestroy; 29246 }; 29247 const sub = (keys, listener, set = listeners) => { 29248 set.add(listener); 29249 listenerKeys.set(listener, keys); 29250 return () => { 29251 var _a; 29252 (_a = disposables.get(listener)) == null ? void 0 : _a(); 29253 disposables.delete(listener); 29254 listenerKeys.delete(listener); 29255 set.delete(listener); 29256 }; 29257 }; 29258 const storeSubscribe = (keys, listener) => sub(keys, listener); 29259 const storeSync = (keys, listener) => { 29260 disposables.set(listener, listener(state, state)); 29261 return sub(keys, listener); 29262 }; 29263 const storeBatch = (keys, listener) => { 29264 disposables.set(listener, listener(state, prevStateBatch)); 29265 return sub(keys, listener, batchListeners); 29266 }; 29267 const storePick = (keys) => createStore(pick(state, keys), finalStore); 29268 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 29269 const getState = () => state; 29270 const setState = (key, value, fromStores = false) => { 29271 var _a; 29272 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 29273 const nextValue = applyState(value, state[key]); 29274 if (nextValue === state[key]) return; 29275 if (!fromStores) { 29276 for (const store of stores) { 29277 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); 29278 } 29279 } 29280 const prevState = state; 29281 state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); 29282 const thisUpdate = Symbol(); 29283 lastUpdate = thisUpdate; 29284 updatedKeys.add(key); 29285 const run = (listener, prev, uKeys) => { 29286 var _a2; 29287 const keys = listenerKeys.get(listener); 29288 const updated = (k) => uKeys ? uKeys.has(k) : k === key; 29289 if (!keys || keys.some(updated)) { 29290 (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); 29291 disposables.set(listener, listener(state, prev)); 29292 } 29293 }; 29294 for (const listener of listeners) { 29295 run(listener, prevState); 29296 } 29297 queueMicrotask(() => { 29298 if (lastUpdate !== thisUpdate) return; 29299 const snapshot = state; 29300 for (const listener of batchListeners) { 29301 run(listener, prevStateBatch, updatedKeys); 29302 } 29303 prevStateBatch = snapshot; 29304 updatedKeys.clear(); 29305 }); 29306 }; 29307 const finalStore = { 29308 getState, 29309 setState, 29310 __unstableInternals: { 29311 setup: storeSetup, 29312 init: storeInit, 29313 subscribe: storeSubscribe, 29314 sync: storeSync, 29315 batch: storeBatch, 29316 pick: storePick, 29317 omit: storeOmit 29318 } 29319 }; 29320 return finalStore; 29321 } 29322 function setup(store, ...args) { 29323 if (!store) return; 29324 return getInternal(store, "setup")(...args); 29325 } 29326 function init(store, ...args) { 29327 if (!store) return; 29328 return getInternal(store, "init")(...args); 29329 } 29330 function subscribe(store, ...args) { 29331 if (!store) return; 29332 return getInternal(store, "subscribe")(...args); 29333 } 29334 function sync(store, ...args) { 29335 if (!store) return; 29336 return getInternal(store, "sync")(...args); 29337 } 29338 function batch(store, ...args) { 29339 if (!store) return; 29340 return getInternal(store, "batch")(...args); 29341 } 29342 function omit2(store, ...args) { 29343 if (!store) return; 29344 return getInternal(store, "omit")(...args); 29345 } 29346 function pick2(store, ...args) { 29347 if (!store) return; 29348 return getInternal(store, "pick")(...args); 29349 } 29350 function mergeStore(...stores) { 29351 const initialState = stores.reduce((state, store2) => { 29352 var _a; 29353 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); 29354 if (!nextState) return state; 29355 return Object.assign(state, nextState); 29356 }, {}); 29357 const store = createStore(initialState, ...stores); 29358 return Object.assign({}, ...stores, store); 29359 } 29360 function throwOnConflictingProps(props, store) { 29361 if (true) return; 29362 if (!store) return; 29363 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 29364 var _a; 29365 const stateKey = key.replace("default", ""); 29366 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`; 29367 }); 29368 if (!defaultKeys.length) return; 29369 const storeState = store.getState(); 29370 const conflictingProps = defaultKeys.filter( 29371 (key) => PBFD2E7P_hasOwnProperty(storeState, key) 29372 ); 29373 if (!conflictingProps.length) return; 29374 throw new Error( 29375 `Passing a store prop in conjunction with a default state is not supported. 29376 29377 const store = useSelectStore(); 29378 <SelectProvider store={store} defaultValue="Apple" /> 29379 ^ ^ 29380 29381 Instead, pass the default state to the topmost store: 29382 29383 const store = useSelectStore({ defaultValue: "Apple" }); 29384 <SelectProvider store={store} /> 29385 29386 See https://github.com/ariakit/ariakit/pull/2745 for more details. 29387 29388 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 29389 ` 29390 ); 29391 } 29392 29393 29394 29395 // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js 29396 var shim = __webpack_require__(422); 29397 ;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js 29398 "use client"; 29399 29400 29401 29402 // src/utils/store.tsx 29403 29404 29405 29406 29407 var { useSyncExternalStore } = shim; 29408 var noopSubscribe = () => () => { 29409 }; 29410 function useStoreState(store, keyOrSelector = identity) { 29411 const storeSubscribe = external_React_.useCallback( 29412 (callback) => { 29413 if (!store) return noopSubscribe(); 29414 return subscribe(store, null, callback); 29415 }, 29416 [store] 29417 ); 29418 const getSnapshot = () => { 29419 const key = typeof keyOrSelector === "string" ? keyOrSelector : null; 29420 const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; 29421 const state = store == null ? void 0 : store.getState(); 29422 if (selector) return selector(state); 29423 if (!state) return; 29424 if (!key) return; 29425 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 29426 return state[key]; 29427 }; 29428 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 29429 } 29430 function useStoreStateObject(store, object) { 29431 const objRef = external_React_.useRef( 29432 {} 29433 ); 29434 const storeSubscribe = external_React_.useCallback( 29435 (callback) => { 29436 if (!store) return noopSubscribe(); 29437 return subscribe(store, null, callback); 29438 }, 29439 [store] 29440 ); 29441 const getSnapshot = () => { 29442 const state = store == null ? void 0 : store.getState(); 29443 let updated = false; 29444 const obj = objRef.current; 29445 for (const prop in object) { 29446 const keyOrSelector = object[prop]; 29447 if (typeof keyOrSelector === "function") { 29448 const value = keyOrSelector(state); 29449 if (value !== obj[prop]) { 29450 obj[prop] = value; 29451 updated = true; 29452 } 29453 } 29454 if (typeof keyOrSelector === "string") { 29455 if (!state) continue; 29456 if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue; 29457 const value = state[keyOrSelector]; 29458 if (value !== obj[prop]) { 29459 obj[prop] = value; 29460 updated = true; 29461 } 29462 } 29463 } 29464 if (updated) { 29465 objRef.current = _3YLGPPWQ_spreadValues({}, obj); 29466 } 29467 return objRef.current; 29468 }; 29469 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 29470 } 29471 function useStoreProps(store, props, key, setKey) { 29472 const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; 29473 const setValue = setKey ? props[setKey] : void 0; 29474 const propsRef = useLiveRef({ value, setValue }); 29475 useSafeLayoutEffect(() => { 29476 return sync(store, [key], (state, prev) => { 29477 const { value: value2, setValue: setValue2 } = propsRef.current; 29478 if (!setValue2) return; 29479 if (state[key] === prev[key]) return; 29480 if (state[key] === value2) return; 29481 setValue2(state[key]); 29482 }); 29483 }, [store, key]); 29484 useSafeLayoutEffect(() => { 29485 if (value === void 0) return; 29486 store.setState(key, value); 29487 return batch(store, [key], () => { 29488 if (value === void 0) return; 29489 store.setState(key, value); 29490 }); 29491 }); 29492 } 29493 function YV4JVR4I_useStore(createStore, props) { 29494 const [store, setStore] = external_React_.useState(() => createStore(props)); 29495 useSafeLayoutEffect(() => init(store), [store]); 29496 const useState2 = external_React_.useCallback( 29497 (keyOrSelector) => useStoreState(store, keyOrSelector), 29498 [store] 29499 ); 29500 const memoizedStore = external_React_.useMemo( 29501 () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), 29502 [store, useState2] 29503 ); 29504 const updateStore = useEvent(() => { 29505 setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); 29506 }); 29507 return [memoizedStore, updateStore]; 29508 } 29509 29510 29511 29512 ;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js 29513 "use client"; 29514 29515 29516 29517 // src/collection/collection-store.ts 29518 29519 function useCollectionStoreProps(store, update, props) { 29520 useUpdateEffect(update, [props.store]); 29521 useStoreProps(store, props, "items", "setItems"); 29522 return store; 29523 } 29524 function useCollectionStore(props = {}) { 29525 const [store, update] = useStore(Core.createCollectionStore, props); 29526 return useCollectionStoreProps(store, update, props); 29527 } 29528 29529 29530 29531 ;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js 29532 "use client"; 29533 29534 29535 29536 29537 29538 // src/composite/composite-store.ts 29539 29540 function useCompositeStoreOptions(props) { 29541 const id = useId(props.id); 29542 return _3YLGPPWQ_spreadValues({ id }, props); 29543 } 29544 function useCompositeStoreProps(store, update, props) { 29545 store = useCollectionStoreProps(store, update, props); 29546 useStoreProps(store, props, "activeId", "setActiveId"); 29547 useStoreProps(store, props, "includesBaseElement"); 29548 useStoreProps(store, props, "virtualFocus"); 29549 useStoreProps(store, props, "orientation"); 29550 useStoreProps(store, props, "rtl"); 29551 useStoreProps(store, props, "focusLoop"); 29552 useStoreProps(store, props, "focusWrap"); 29553 useStoreProps(store, props, "focusShift"); 29554 return store; 29555 } 29556 function useCompositeStore(props = {}) { 29557 props = useCompositeStoreOptions(props); 29558 const [store, update] = useStore(Core.createCompositeStore, props); 29559 return useCompositeStoreProps(store, update, props); 29560 } 29561 29562 29563 29564 ;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js 29565 "use client"; 29566 29567 29568 29569 // src/disclosure/disclosure-store.ts 29570 29571 function useDisclosureStoreProps(store, update, props) { 29572 useUpdateEffect(update, [props.store, props.disclosure]); 29573 useStoreProps(store, props, "open", "setOpen"); 29574 useStoreProps(store, props, "mounted", "setMounted"); 29575 useStoreProps(store, props, "animated"); 29576 return Object.assign(store, { disclosure: props.disclosure }); 29577 } 29578 function useDisclosureStore(props = {}) { 29579 const [store, update] = useStore(Core.createDisclosureStore, props); 29580 return useDisclosureStoreProps(store, update, props); 29581 } 29582 29583 29584 29585 ;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js 29586 "use client"; 29587 29588 29589 29590 // src/dialog/dialog-store.ts 29591 29592 function useDialogStoreProps(store, update, props) { 29593 return useDisclosureStoreProps(store, update, props); 29594 } 29595 function useDialogStore(props = {}) { 29596 const [store, update] = useStore(Core.createDialogStore, props); 29597 return useDialogStoreProps(store, update, props); 29598 } 29599 29600 29601 29602 ;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js 29603 "use client"; 29604 29605 29606 29607 29608 // src/popover/popover-store.ts 29609 29610 function usePopoverStoreProps(store, update, props) { 29611 useUpdateEffect(update, [props.popover]); 29612 useStoreProps(store, props, "placement"); 29613 return useDialogStoreProps(store, update, props); 29614 } 29615 function usePopoverStore(props = {}) { 29616 const [store, update] = useStore(Core.createPopoverStore, props); 29617 return usePopoverStoreProps(store, update, props); 29618 } 29619 29620 29621 29622 ;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js 29623 "use client"; 29624 29625 29626 29627 29628 29629 // src/collection/collection-store.ts 29630 function getCommonParent(items) { 29631 var _a; 29632 const firstItem = items.find((item) => !!item.element); 29633 const lastItem = [...items].reverse().find((item) => !!item.element); 29634 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; 29635 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { 29636 const parent = parentElement; 29637 if (lastItem && parent.contains(lastItem.element)) { 29638 return parentElement; 29639 } 29640 parentElement = parentElement.parentElement; 29641 } 29642 return getDocument(parentElement).body; 29643 } 29644 function getPrivateStore(store) { 29645 return store == null ? void 0 : store.__unstablePrivateStore; 29646 } 29647 function createCollectionStore(props = {}) { 29648 var _a; 29649 throwOnConflictingProps(props, props.store); 29650 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 29651 const items = defaultValue( 29652 props.items, 29653 syncState == null ? void 0 : syncState.items, 29654 props.defaultItems, 29655 [] 29656 ); 29657 const itemsMap = new Map(items.map((item) => [item.id, item])); 29658 const initialState = { 29659 items, 29660 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) 29661 }; 29662 const syncPrivateStore = getPrivateStore(props.store); 29663 const privateStore = createStore( 29664 { items, renderedItems: initialState.renderedItems }, 29665 syncPrivateStore 29666 ); 29667 const collection = createStore(initialState, props.store); 29668 const sortItems = (renderedItems) => { 29669 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element); 29670 privateStore.setState("renderedItems", sortedItems); 29671 collection.setState("renderedItems", sortedItems); 29672 }; 29673 setup(collection, () => init(privateStore)); 29674 setup(privateStore, () => { 29675 return batch(privateStore, ["items"], (state) => { 29676 collection.setState("items", state.items); 29677 }); 29678 }); 29679 setup(privateStore, () => { 29680 return batch(privateStore, ["renderedItems"], (state) => { 29681 let firstRun = true; 29682 let raf = requestAnimationFrame(() => { 29683 const { renderedItems } = collection.getState(); 29684 if (state.renderedItems === renderedItems) return; 29685 sortItems(state.renderedItems); 29686 }); 29687 if (typeof IntersectionObserver !== "function") { 29688 return () => cancelAnimationFrame(raf); 29689 } 29690 const ioCallback = () => { 29691 if (firstRun) { 29692 firstRun = false; 29693 return; 29694 } 29695 cancelAnimationFrame(raf); 29696 raf = requestAnimationFrame(() => sortItems(state.renderedItems)); 29697 }; 29698 const root = getCommonParent(state.renderedItems); 29699 const observer = new IntersectionObserver(ioCallback, { root }); 29700 for (const item of state.renderedItems) { 29701 if (!item.element) continue; 29702 observer.observe(item.element); 29703 } 29704 return () => { 29705 cancelAnimationFrame(raf); 29706 observer.disconnect(); 29707 }; 29708 }); 29709 }); 29710 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 29711 let prevItem; 29712 setItems((items2) => { 29713 const index = items2.findIndex(({ id }) => id === item.id); 29714 const nextItems = items2.slice(); 29715 if (index !== -1) { 29716 prevItem = items2[index]; 29717 const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); 29718 nextItems[index] = nextItem; 29719 itemsMap.set(item.id, nextItem); 29720 } else { 29721 nextItems.push(item); 29722 itemsMap.set(item.id, item); 29723 } 29724 return nextItems; 29725 }); 29726 const unmergeItem = () => { 29727 setItems((items2) => { 29728 if (!prevItem) { 29729 if (canDeleteFromMap) { 29730 itemsMap.delete(item.id); 29731 } 29732 return items2.filter(({ id }) => id !== item.id); 29733 } 29734 const index = items2.findIndex(({ id }) => id === item.id); 29735 if (index === -1) return items2; 29736 const nextItems = items2.slice(); 29737 nextItems[index] = prevItem; 29738 itemsMap.set(item.id, prevItem); 29739 return nextItems; 29740 }); 29741 }; 29742 return unmergeItem; 29743 }; 29744 const registerItem = (item) => mergeItem( 29745 item, 29746 (getItems) => privateStore.setState("items", getItems), 29747 true 29748 ); 29749 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { 29750 registerItem, 29751 renderItem: (item) => chain( 29752 registerItem(item), 29753 mergeItem( 29754 item, 29755 (getItems) => privateStore.setState("renderedItems", getItems) 29756 ) 29757 ), 29758 item: (id) => { 29759 if (!id) return null; 29760 let item = itemsMap.get(id); 29761 if (!item) { 29762 const { items: items2 } = privateStore.getState(); 29763 item = items2.find((item2) => item2.id === id); 29764 if (item) { 29765 itemsMap.set(id, item); 29766 } 29767 } 29768 return item || null; 29769 }, 29770 // @ts-expect-error Internal 29771 __unstablePrivateStore: privateStore 29772 }); 29773 } 29774 29775 29776 29777 ;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js 29778 "use client"; 29779 29780 // src/utils/array.ts 29781 function toArray(arg) { 29782 if (Array.isArray(arg)) { 29783 return arg; 29784 } 29785 return typeof arg !== "undefined" ? [arg] : []; 29786 } 29787 function addItemToArray(array, item, index = -1) { 29788 if (!(index in array)) { 29789 return [...array, item]; 29790 } 29791 return [...array.slice(0, index), item, ...array.slice(index)]; 29792 } 29793 function flatten2DArray(array) { 29794 const flattened = []; 29795 for (const row of array) { 29796 flattened.push(...row); 29797 } 29798 return flattened; 29799 } 29800 function reverseArray(array) { 29801 return array.slice().reverse(); 29802 } 29803 29804 29805 29806 ;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js 29807 "use client"; 29808 29809 29810 29811 29812 29813 29814 // src/composite/composite-store.ts 29815 var NULL_ITEM = { id: null }; 29816 function findFirstEnabledItem(items, excludeId) { 29817 return items.find((item) => { 29818 if (excludeId) { 29819 return !item.disabled && item.id !== excludeId; 29820 } 29821 return !item.disabled; 29822 }); 29823 } 29824 function getEnabledItems(items, excludeId) { 29825 return items.filter((item) => { 29826 if (excludeId) { 29827 return !item.disabled && item.id !== excludeId; 29828 } 29829 return !item.disabled; 29830 }); 29831 } 29832 function getItemsInRow(items, rowId) { 29833 return items.filter((item) => item.rowId === rowId); 29834 } 29835 function flipItems(items, activeId, shouldInsertNullItem = false) { 29836 const index = items.findIndex((item) => item.id === activeId); 29837 return [ 29838 ...items.slice(index + 1), 29839 ...shouldInsertNullItem ? [NULL_ITEM] : [], 29840 ...items.slice(0, index) 29841 ]; 29842 } 29843 function groupItemsByRows(items) { 29844 const rows = []; 29845 for (const item of items) { 29846 const row = rows.find((currentRow) => { 29847 var _a; 29848 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 29849 }); 29850 if (row) { 29851 row.push(item); 29852 } else { 29853 rows.push([item]); 29854 } 29855 } 29856 return rows; 29857 } 29858 function getMaxRowLength(array) { 29859 let maxLength = 0; 29860 for (const { length } of array) { 29861 if (length > maxLength) { 29862 maxLength = length; 29863 } 29864 } 29865 return maxLength; 29866 } 29867 function createEmptyItem(rowId) { 29868 return { 29869 id: "__EMPTY_ITEM__", 29870 disabled: true, 29871 rowId 29872 }; 29873 } 29874 function normalizeRows(rows, activeId, focusShift) { 29875 const maxLength = getMaxRowLength(rows); 29876 for (const row of rows) { 29877 for (let i = 0; i < maxLength; i += 1) { 29878 const item = row[i]; 29879 if (!item || focusShift && item.disabled) { 29880 const isFirst = i === 0; 29881 const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; 29882 row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); 29883 } 29884 } 29885 } 29886 return rows; 29887 } 29888 function verticalizeItems(items) { 29889 const rows = groupItemsByRows(items); 29890 const maxLength = getMaxRowLength(rows); 29891 const verticalized = []; 29892 for (let i = 0; i < maxLength; i += 1) { 29893 for (const row of rows) { 29894 const item = row[i]; 29895 if (item) { 29896 verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { 29897 // If there's no rowId, it means that it's not a grid composite, but 29898 // a single row instead. So, instead of verticalizing it, that is, 29899 // assigning a different rowId based on the column index, we keep it 29900 // undefined so they will be part of the same row. This is useful 29901 // when using up/down on one-dimensional composites. 29902 rowId: item.rowId ? `$i}` : void 0 29903 })); 29904 } 29905 } 29906 } 29907 return verticalized; 29908 } 29909 function createCompositeStore(props = {}) { 29910 var _a; 29911 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 29912 const collection = createCollectionStore(props); 29913 const activeId = defaultValue( 29914 props.activeId, 29915 syncState == null ? void 0 : syncState.activeId, 29916 props.defaultActiveId 29917 ); 29918 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { 29919 id: defaultValue( 29920 props.id, 29921 syncState == null ? void 0 : syncState.id, 29922 `id-$Math.random().toString(36).slice(2, 8)}` 29923 ), 29924 activeId, 29925 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), 29926 includesBaseElement: defaultValue( 29927 props.includesBaseElement, 29928 syncState == null ? void 0 : syncState.includesBaseElement, 29929 activeId === null 29930 ), 29931 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), 29932 orientation: defaultValue( 29933 props.orientation, 29934 syncState == null ? void 0 : syncState.orientation, 29935 "both" 29936 ), 29937 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), 29938 virtualFocus: defaultValue( 29939 props.virtualFocus, 29940 syncState == null ? void 0 : syncState.virtualFocus, 29941 false 29942 ), 29943 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), 29944 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), 29945 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) 29946 }); 29947 const composite = createStore(initialState, collection, props.store); 29948 setup( 29949 composite, 29950 () => sync(composite, ["renderedItems", "activeId"], (state) => { 29951 composite.setState("activeId", (activeId2) => { 29952 var _a2; 29953 if (activeId2 !== void 0) return activeId2; 29954 return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; 29955 }); 29956 }) 29957 ); 29958 const getNextId = (direction = "next", options = {}) => { 29959 var _a2, _b; 29960 const defaultState = composite.getState(); 29961 const { 29962 skip = 0, 29963 activeId: activeId2 = defaultState.activeId, 29964 focusShift = defaultState.focusShift, 29965 focusLoop = defaultState.focusLoop, 29966 focusWrap = defaultState.focusWrap, 29967 includesBaseElement = defaultState.includesBaseElement, 29968 renderedItems = defaultState.renderedItems, 29969 rtl = defaultState.rtl 29970 } = options; 29971 const isVerticalDirection = direction === "up" || direction === "down"; 29972 const isNextDirection = direction === "next" || direction === "down"; 29973 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; 29974 const canShift = focusShift && !skip; 29975 let items = !isVerticalDirection ? renderedItems : flatten2DArray( 29976 normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift) 29977 ); 29978 items = canReverse ? reverseArray(items) : items; 29979 items = isVerticalDirection ? verticalizeItems(items) : items; 29980 if (activeId2 == null) { 29981 return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id; 29982 } 29983 const activeItem = items.find((item) => item.id === activeId2); 29984 if (!activeItem) { 29985 return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id; 29986 } 29987 const isGrid = items.some((item) => item.rowId); 29988 const activeIndex = items.indexOf(activeItem); 29989 const nextItems = items.slice(activeIndex + 1); 29990 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 29991 if (skip) { 29992 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 29993 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. 29994 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; 29995 return nextItem2 == null ? void 0 : nextItem2.id; 29996 } 29997 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); 29998 const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); 29999 const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; 30000 if (canLoop) { 30001 const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); 30002 const sortedItems = flipItems(loopItems, activeId2, hasNullItem); 30003 const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); 30004 return nextItem2 == null ? void 0 : nextItem2.id; 30005 } 30006 if (canWrap) { 30007 const nextItem2 = findFirstEnabledItem( 30008 // We can use nextItems, which contains all the next items, including 30009 // items from other rows, to wrap between rows. However, if there is a 30010 // null item (the composite container), we'll only use the next items in 30011 // the row. So moving next from the last item will focus on the 30012 // composite container. On grid composites, horizontal navigation never 30013 // focuses on the composite container, only vertical. 30014 hasNullItem ? nextItemsInRow : nextItems, 30015 activeId2 30016 ); 30017 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; 30018 return nextId; 30019 } 30020 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); 30021 if (!nextItem && hasNullItem) { 30022 return null; 30023 } 30024 return nextItem == null ? void 0 : nextItem.id; 30025 }; 30026 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { 30027 setBaseElement: (element) => composite.setState("baseElement", element), 30028 setActiveId: (id) => composite.setState("activeId", id), 30029 move: (id) => { 30030 if (id === void 0) return; 30031 composite.setState("activeId", id); 30032 composite.setState("moves", (moves) => moves + 1); 30033 }, 30034 first: () => { 30035 var _a2; 30036 return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; 30037 }, 30038 last: () => { 30039 var _a2; 30040 return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; 30041 }, 30042 next: (options) => { 30043 if (options !== void 0 && typeof options === "number") { 30044 options = { skip: options }; 30045 } 30046 return getNextId("next", options); 30047 }, 30048 previous: (options) => { 30049 if (options !== void 0 && typeof options === "number") { 30050 options = { skip: options }; 30051 } 30052 return getNextId("previous", options); 30053 }, 30054 down: (options) => { 30055 if (options !== void 0 && typeof options === "number") { 30056 options = { skip: options }; 30057 } 30058 return getNextId("down", options); 30059 }, 30060 up: (options) => { 30061 if (options !== void 0 && typeof options === "number") { 30062 options = { skip: options }; 30063 } 30064 return getNextId("up", options); 30065 } 30066 }); 30067 } 30068 30069 30070 30071 ;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js 30072 "use client"; 30073 30074 30075 30076 30077 // src/disclosure/disclosure-store.ts 30078 function createDisclosureStore(props = {}) { 30079 const store = mergeStore( 30080 props.store, 30081 omit2(props.disclosure, ["contentElement", "disclosureElement"]) 30082 ); 30083 throwOnConflictingProps(props, store); 30084 const syncState = store == null ? void 0 : store.getState(); 30085 const open = defaultValue( 30086 props.open, 30087 syncState == null ? void 0 : syncState.open, 30088 props.defaultOpen, 30089 false 30090 ); 30091 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); 30092 const initialState = { 30093 open, 30094 animated, 30095 animating: !!animated && open, 30096 mounted: open, 30097 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), 30098 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) 30099 }; 30100 const disclosure = createStore(initialState, store); 30101 setup( 30102 disclosure, 30103 () => sync(disclosure, ["animated", "animating"], (state) => { 30104 if (state.animated) return; 30105 disclosure.setState("animating", false); 30106 }) 30107 ); 30108 setup( 30109 disclosure, 30110 () => subscribe(disclosure, ["open"], () => { 30111 if (!disclosure.getState().animated) return; 30112 disclosure.setState("animating", true); 30113 }) 30114 ); 30115 setup( 30116 disclosure, 30117 () => sync(disclosure, ["open", "animating"], (state) => { 30118 disclosure.setState("mounted", state.open || state.animating); 30119 }) 30120 ); 30121 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { 30122 disclosure: props.disclosure, 30123 setOpen: (value) => disclosure.setState("open", value), 30124 show: () => disclosure.setState("open", true), 30125 hide: () => disclosure.setState("open", false), 30126 toggle: () => disclosure.setState("open", (open2) => !open2), 30127 stopAnimation: () => disclosure.setState("animating", false), 30128 setContentElement: (value) => disclosure.setState("contentElement", value), 30129 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 30130 }); 30131 } 30132 30133 30134 30135 ;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js 30136 "use client"; 30137 30138 30139 // src/dialog/dialog-store.ts 30140 function createDialogStore(props = {}) { 30141 return createDisclosureStore(props); 30142 } 30143 30144 30145 30146 ;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js 30147 "use client"; 30148 30149 30150 30151 30152 30153 // src/popover/popover-store.ts 30154 function createPopoverStore(_a = {}) { 30155 var _b = _a, { 30156 popover: otherPopover 30157 } = _b, props = _3YLGPPWQ_objRest(_b, [ 30158 "popover" 30159 ]); 30160 const store = mergeStore( 30161 props.store, 30162 omit2(otherPopover, [ 30163 "arrowElement", 30164 "anchorElement", 30165 "contentElement", 30166 "popoverElement", 30167 "disclosureElement" 30168 ]) 30169 ); 30170 throwOnConflictingProps(props, store); 30171 const syncState = store == null ? void 0 : store.getState(); 30172 const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); 30173 const placement = defaultValue( 30174 props.placement, 30175 syncState == null ? void 0 : syncState.placement, 30176 "bottom" 30177 ); 30178 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { 30179 placement, 30180 currentPlacement: placement, 30181 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), 30182 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), 30183 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), 30184 rendered: Symbol("rendered") 30185 }); 30186 const popover = createStore(initialState, dialog, store); 30187 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { 30188 setAnchorElement: (element) => popover.setState("anchorElement", element), 30189 setPopoverElement: (element) => popover.setState("popoverElement", element), 30190 setArrowElement: (element) => popover.setState("arrowElement", element), 30191 render: () => popover.setState("rendered", Symbol("rendered")) 30192 }); 30193 } 30194 30195 30196 30197 ;// ./node_modules/@ariakit/core/esm/combobox/combobox-store.js 30198 "use client"; 30199 30200 30201 30202 30203 30204 30205 30206 30207 30208 30209 30210 30211 // src/combobox/combobox-store.ts 30212 var isTouchSafari = isSafari() && isTouchDevice(); 30213 function createComboboxStore(_a = {}) { 30214 var _b = _a, { 30215 tag 30216 } = _b, props = _3YLGPPWQ_objRest(_b, [ 30217 "tag" 30218 ]); 30219 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 30220 throwOnConflictingProps(props, store); 30221 const tagState = tag == null ? void 0 : tag.getState(); 30222 const syncState = store == null ? void 0 : store.getState(); 30223 const activeId = defaultValue( 30224 props.activeId, 30225 syncState == null ? void 0 : syncState.activeId, 30226 props.defaultActiveId, 30227 null 30228 ); 30229 const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 30230 activeId, 30231 includesBaseElement: defaultValue( 30232 props.includesBaseElement, 30233 syncState == null ? void 0 : syncState.includesBaseElement, 30234 true 30235 ), 30236 orientation: defaultValue( 30237 props.orientation, 30238 syncState == null ? void 0 : syncState.orientation, 30239 "vertical" 30240 ), 30241 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), 30242 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), 30243 virtualFocus: defaultValue( 30244 props.virtualFocus, 30245 syncState == null ? void 0 : syncState.virtualFocus, 30246 true 30247 ) 30248 })); 30249 const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 30250 placement: defaultValue( 30251 props.placement, 30252 syncState == null ? void 0 : syncState.placement, 30253 "bottom-start" 30254 ) 30255 })); 30256 const value = defaultValue( 30257 props.value, 30258 syncState == null ? void 0 : syncState.value, 30259 props.defaultValue, 30260 "" 30261 ); 30262 const selectedValue = defaultValue( 30263 props.selectedValue, 30264 syncState == null ? void 0 : syncState.selectedValue, 30265 tagState == null ? void 0 : tagState.values, 30266 props.defaultSelectedValue, 30267 "" 30268 ); 30269 const multiSelectable = Array.isArray(selectedValue); 30270 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { 30271 value, 30272 selectedValue, 30273 resetValueOnSelect: defaultValue( 30274 props.resetValueOnSelect, 30275 syncState == null ? void 0 : syncState.resetValueOnSelect, 30276 multiSelectable 30277 ), 30278 resetValueOnHide: defaultValue( 30279 props.resetValueOnHide, 30280 syncState == null ? void 0 : syncState.resetValueOnHide, 30281 multiSelectable && !tag 30282 ), 30283 activeValue: syncState == null ? void 0 : syncState.activeValue 30284 }); 30285 const combobox = createStore(initialState, composite, popover, store); 30286 if (isTouchSafari) { 30287 setup( 30288 combobox, 30289 () => sync(combobox, ["virtualFocus"], () => { 30290 combobox.setState("virtualFocus", false); 30291 }) 30292 ); 30293 } 30294 setup(combobox, () => { 30295 if (!tag) return; 30296 return chain( 30297 sync(combobox, ["selectedValue"], (state) => { 30298 if (!Array.isArray(state.selectedValue)) return; 30299 tag.setValues(state.selectedValue); 30300 }), 30301 sync(tag, ["values"], (state) => { 30302 combobox.setState("selectedValue", state.values); 30303 }) 30304 ); 30305 }); 30306 setup( 30307 combobox, 30308 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { 30309 if (!state.resetValueOnHide) return; 30310 if (state.mounted) return; 30311 combobox.setState("value", value); 30312 }) 30313 ); 30314 setup( 30315 combobox, 30316 () => sync(combobox, ["open"], (state) => { 30317 if (state.open) return; 30318 combobox.setState("activeId", activeId); 30319 combobox.setState("moves", 0); 30320 }) 30321 ); 30322 setup( 30323 combobox, 30324 () => sync(combobox, ["moves", "activeId"], (state, prevState) => { 30325 if (state.moves === prevState.moves) { 30326 combobox.setState("activeValue", void 0); 30327 } 30328 }) 30329 ); 30330 setup( 30331 combobox, 30332 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 30333 if (state.moves === prev.moves) return; 30334 const { activeId: activeId2 } = combobox.getState(); 30335 const activeItem = composite.item(activeId2); 30336 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); 30337 }) 30338 ); 30339 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), { 30340 tag, 30341 setValue: (value2) => combobox.setState("value", value2), 30342 resetValue: () => combobox.setState("value", initialState.value), 30343 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 30344 }); 30345 } 30346 30347 30348 ;// ./node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js 30349 "use client"; 30350 30351 30352 30353 30354 30355 30356 30357 // src/combobox/combobox-store.ts 30358 30359 function useComboboxStoreOptions(props) { 30360 const tag = useTagContext(); 30361 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 30362 tag: props.tag !== void 0 ? props.tag : tag 30363 }); 30364 return useCompositeStoreOptions(props); 30365 } 30366 function useComboboxStoreProps(store, update, props) { 30367 useUpdateEffect(update, [props.tag]); 30368 useStoreProps(store, props, "value", "setValue"); 30369 useStoreProps(store, props, "selectedValue", "setSelectedValue"); 30370 useStoreProps(store, props, "resetValueOnHide"); 30371 useStoreProps(store, props, "resetValueOnSelect"); 30372 return Object.assign( 30373 useCompositeStoreProps( 30374 usePopoverStoreProps(store, update, props), 30375 update, 30376 props 30377 ), 30378 { tag: props.tag } 30379 ); 30380 } 30381 function useComboboxStore(props = {}) { 30382 props = useComboboxStoreOptions(props); 30383 const [store, update] = YV4JVR4I_useStore(createComboboxStore, props); 30384 return useComboboxStoreProps(store, update, props); 30385 } 30386 30387 30388 30389 ;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js 30390 "use client"; 30391 30392 30393 // src/disclosure/disclosure-context.tsx 30394 var S6EF7IVO_ctx = createStoreContext(); 30395 var useDisclosureContext = S6EF7IVO_ctx.useContext; 30396 var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext; 30397 var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext; 30398 var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider; 30399 var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider; 30400 30401 30402 30403 ;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js 30404 "use client"; 30405 30406 30407 30408 // src/dialog/dialog-context.tsx 30409 30410 var RS7LB2H4_ctx = createStoreContext( 30411 [DisclosureContextProvider], 30412 [DisclosureScopedContextProvider] 30413 ); 30414 var useDialogContext = RS7LB2H4_ctx.useContext; 30415 var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext; 30416 var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext; 30417 var DialogContextProvider = RS7LB2H4_ctx.ContextProvider; 30418 var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider; 30419 var DialogHeadingContext = (0,external_React_.createContext)(void 0); 30420 var DialogDescriptionContext = (0,external_React_.createContext)(void 0); 30421 30422 30423 30424 ;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js 30425 "use client"; 30426 30427 30428 30429 // src/popover/popover-context.tsx 30430 var MTZPJQMC_ctx = createStoreContext( 30431 [DialogContextProvider], 30432 [DialogScopedContextProvider] 30433 ); 30434 var usePopoverContext = MTZPJQMC_ctx.useContext; 30435 var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext; 30436 var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext; 30437 var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider; 30438 var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider; 30439 30440 30441 30442 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js 30443 "use client"; 30444 30445 30446 30447 30448 // src/combobox/combobox-context.tsx 30449 30450 var ComboboxListRoleContext = (0,external_React_.createContext)( 30451 void 0 30452 ); 30453 var VEVQD5MH_ctx = createStoreContext( 30454 [PopoverContextProvider, CompositeContextProvider], 30455 [PopoverScopedContextProvider, CompositeScopedContextProvider] 30456 ); 30457 var useComboboxContext = VEVQD5MH_ctx.useContext; 30458 var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext; 30459 var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext; 30460 var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider; 30461 var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider; 30462 var ComboboxItemValueContext = (0,external_React_.createContext)( 30463 void 0 30464 ); 30465 var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); 30466 30467 30468 30469 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js 30470 "use client"; 30471 30472 30473 30474 30475 30476 30477 30478 30479 30480 30481 30482 30483 30484 30485 30486 30487 30488 30489 30490 // src/combobox/combobox-provider.tsx 30491 30492 function ComboboxProvider(props = {}) { 30493 const store = useComboboxStore(props); 30494 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children }); 30495 } 30496 30497 30498 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js 30499 "use client"; 30500 30501 30502 30503 30504 30505 30506 30507 30508 30509 30510 30511 // src/combobox/combobox-label.tsx 30512 30513 var TagName = "label"; 30514 var useComboboxLabel = createHook( 30515 function useComboboxLabel2(_a) { 30516 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 30517 const context = useComboboxProviderContext(); 30518 store = store || context; 30519 invariant( 30520 store, 30521 false && 0 30522 ); 30523 const comboboxId = store.useState((state) => { 30524 var _a2; 30525 return (_a2 = state.baseElement) == null ? void 0 : _a2.id; 30526 }); 30527 props = _3YLGPPWQ_spreadValues({ 30528 htmlFor: comboboxId 30529 }, props); 30530 return removeUndefinedValues(props); 30531 } 30532 ); 30533 var ComboboxLabel = memo2( 30534 forwardRef2(function ComboboxLabel2(props) { 30535 const htmlProps = useComboboxLabel(props); 30536 return createElement(TagName, htmlProps); 30537 }) 30538 ); 30539 30540 30541 ;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js 30542 "use client"; 30543 30544 30545 30546 30547 30548 // src/popover/popover-anchor.tsx 30549 var OMU7RWRV_TagName = "div"; 30550 var usePopoverAnchor = createHook( 30551 function usePopoverAnchor2(_a) { 30552 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 30553 const context = usePopoverProviderContext(); 30554 store = store || context; 30555 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 30556 ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) 30557 }); 30558 return props; 30559 } 30560 ); 30561 var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { 30562 const htmlProps = usePopoverAnchor(props); 30563 return createElement(OMU7RWRV_TagName, htmlProps); 30564 }); 30565 30566 30567 30568 ;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js 30569 "use client"; 30570 30571 // src/composite/utils.ts 30572 30573 var _5VQZOHHZ_NULL_ITEM = { id: null }; 30574 function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { 30575 const index = items.findIndex((item) => item.id === activeId); 30576 return [ 30577 ...items.slice(index + 1), 30578 ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], 30579 ...items.slice(0, index) 30580 ]; 30581 } 30582 function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { 30583 return items.find((item) => { 30584 if (excludeId) { 30585 return !item.disabled && item.id !== excludeId; 30586 } 30587 return !item.disabled; 30588 }); 30589 } 30590 function getEnabledItem(store, id) { 30591 if (!id) return null; 30592 return store.item(id) || null; 30593 } 30594 function _5VQZOHHZ_groupItemsByRows(items) { 30595 const rows = []; 30596 for (const item of items) { 30597 const row = rows.find((currentRow) => { 30598 var _a; 30599 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 30600 }); 30601 if (row) { 30602 row.push(item); 30603 } else { 30604 rows.push([item]); 30605 } 30606 } 30607 return rows; 30608 } 30609 function selectTextField(element, collapseToEnd = false) { 30610 if (isTextField(element)) { 30611 element.setSelectionRange( 30612 collapseToEnd ? element.value.length : 0, 30613 element.value.length 30614 ); 30615 } else if (element.isContentEditable) { 30616 const selection = getDocument(element).getSelection(); 30617 selection == null ? void 0 : selection.selectAllChildren(element); 30618 if (collapseToEnd) { 30619 selection == null ? void 0 : selection.collapseToEnd(); 30620 } 30621 } 30622 } 30623 var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); 30624 function focusSilently(element) { 30625 element[FOCUS_SILENTLY] = true; 30626 element.focus({ preventScroll: true }); 30627 } 30628 function silentlyFocused(element) { 30629 const isSilentlyFocused = element[FOCUS_SILENTLY]; 30630 delete element[FOCUS_SILENTLY]; 30631 return isSilentlyFocused; 30632 } 30633 function isItem(store, element, exclude) { 30634 if (!element) return false; 30635 if (element === exclude) return false; 30636 const item = store.item(element.id); 30637 if (!item) return false; 30638 if (exclude && item.element === exclude) return false; 30639 return true; 30640 } 30641 30642 30643 30644 ;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js 30645 "use client"; 30646 30647 // src/focusable/focusable-context.tsx 30648 30649 var FocusableContext = (0,external_React_.createContext)(true); 30650 30651 30652 30653 ;// ./node_modules/@ariakit/core/esm/utils/focus.js 30654 "use client"; 30655 30656 30657 30658 // src/utils/focus.ts 30659 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'])"; 30660 function hasNegativeTabIndex(element) { 30661 const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); 30662 return tabIndex < 0; 30663 } 30664 function isFocusable(element) { 30665 if (!element.matches(selector)) return false; 30666 if (!isVisible(element)) return false; 30667 if (element.closest("[inert]")) return false; 30668 return true; 30669 } 30670 function isTabbable(element) { 30671 if (!isFocusable(element)) return false; 30672 if (hasNegativeTabIndex(element)) return false; 30673 if (!("form" in element)) return true; 30674 if (!element.form) return true; 30675 if (element.checked) return true; 30676 if (element.type !== "radio") return true; 30677 const radioGroup = element.form.elements.namedItem(element.name); 30678 if (!radioGroup) return true; 30679 if (!("length" in radioGroup)) return true; 30680 const activeElement = getActiveElement(element); 30681 if (!activeElement) return true; 30682 if (activeElement === element) return true; 30683 if (!("form" in activeElement)) return true; 30684 if (activeElement.form !== element.form) return true; 30685 if (activeElement.name !== element.name) return true; 30686 return false; 30687 } 30688 function getAllFocusableIn(container, includeContainer) { 30689 const elements = Array.from( 30690 container.querySelectorAll(selector) 30691 ); 30692 if (includeContainer) { 30693 elements.unshift(container); 30694 } 30695 const focusableElements = elements.filter(isFocusable); 30696 focusableElements.forEach((element, i) => { 30697 if (isFrame(element) && element.contentDocument) { 30698 const frameBody = element.contentDocument.body; 30699 focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); 30700 } 30701 }); 30702 return focusableElements; 30703 } 30704 function getAllFocusable(includeBody) { 30705 return getAllFocusableIn(document.body, includeBody); 30706 } 30707 function getFirstFocusableIn(container, includeContainer) { 30708 const [first] = getAllFocusableIn(container, includeContainer); 30709 return first || null; 30710 } 30711 function getFirstFocusable(includeBody) { 30712 return getFirstFocusableIn(document.body, includeBody); 30713 } 30714 function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { 30715 const elements = Array.from( 30716 container.querySelectorAll(selector) 30717 ); 30718 const tabbableElements = elements.filter(isTabbable); 30719 if (includeContainer && isTabbable(container)) { 30720 tabbableElements.unshift(container); 30721 } 30722 tabbableElements.forEach((element, i) => { 30723 if (isFrame(element) && element.contentDocument) { 30724 const frameBody = element.contentDocument.body; 30725 const allFrameTabbable = getAllTabbableIn( 30726 frameBody, 30727 false, 30728 fallbackToFocusable 30729 ); 30730 tabbableElements.splice(i, 1, ...allFrameTabbable); 30731 } 30732 }); 30733 if (!tabbableElements.length && fallbackToFocusable) { 30734 return elements; 30735 } 30736 return tabbableElements; 30737 } 30738 function getAllTabbable(fallbackToFocusable) { 30739 return getAllTabbableIn(document.body, false, fallbackToFocusable); 30740 } 30741 function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { 30742 const [first] = getAllTabbableIn( 30743 container, 30744 includeContainer, 30745 fallbackToFocusable 30746 ); 30747 return first || null; 30748 } 30749 function getFirstTabbable(fallbackToFocusable) { 30750 return getFirstTabbableIn(document.body, false, fallbackToFocusable); 30751 } 30752 function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { 30753 const allTabbable = getAllTabbableIn( 30754 container, 30755 includeContainer, 30756 fallbackToFocusable 30757 ); 30758 return allTabbable[allTabbable.length - 1] || null; 30759 } 30760 function getLastTabbable(fallbackToFocusable) { 30761 return getLastTabbableIn(document.body, false, fallbackToFocusable); 30762 } 30763 function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { 30764 const activeElement = getActiveElement(container); 30765 const allFocusable = getAllFocusableIn(container, includeContainer); 30766 const activeIndex = allFocusable.indexOf(activeElement); 30767 const nextFocusableElements = allFocusable.slice(activeIndex + 1); 30768 return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; 30769 } 30770 function getNextTabbable(fallbackToFirst, fallbackToFocusable) { 30771 return getNextTabbableIn( 30772 document.body, 30773 false, 30774 fallbackToFirst, 30775 fallbackToFocusable 30776 ); 30777 } 30778 function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { 30779 const activeElement = getActiveElement(container); 30780 const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); 30781 const activeIndex = allFocusable.indexOf(activeElement); 30782 const previousFocusableElements = allFocusable.slice(activeIndex + 1); 30783 return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; 30784 } 30785 function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { 30786 return getPreviousTabbableIn( 30787 document.body, 30788 false, 30789 fallbackToFirst, 30790 fallbackToFocusable 30791 ); 30792 } 30793 function getClosestFocusable(element) { 30794 while (element && !isFocusable(element)) { 30795 element = element.closest(selector); 30796 } 30797 return element || null; 30798 } 30799 function hasFocus(element) { 30800 const activeElement = DTR5TSDJ_getActiveElement(element); 30801 if (!activeElement) return false; 30802 if (activeElement === element) return true; 30803 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 30804 if (!activeDescendant) return false; 30805 return activeDescendant === element.id; 30806 } 30807 function hasFocusWithin(element) { 30808 const activeElement = DTR5TSDJ_getActiveElement(element); 30809 if (!activeElement) return false; 30810 if (contains(element, activeElement)) return true; 30811 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 30812 if (!activeDescendant) return false; 30813 if (!("id" in element)) return false; 30814 if (activeDescendant === element.id) return true; 30815 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 30816 } 30817 function focusIfNeeded(element) { 30818 if (!hasFocusWithin(element) && isFocusable(element)) { 30819 element.focus(); 30820 } 30821 } 30822 function disableFocus(element) { 30823 var _a; 30824 const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; 30825 element.setAttribute("data-tabindex", currentTabindex); 30826 element.setAttribute("tabindex", "-1"); 30827 } 30828 function disableFocusIn(container, includeContainer) { 30829 const tabbableElements = getAllTabbableIn(container, includeContainer); 30830 for (const element of tabbableElements) { 30831 disableFocus(element); 30832 } 30833 } 30834 function restoreFocusIn(container) { 30835 const elements = container.querySelectorAll("[data-tabindex]"); 30836 const restoreTabIndex = (element) => { 30837 const tabindex = element.getAttribute("data-tabindex"); 30838 element.removeAttribute("data-tabindex"); 30839 if (tabindex) { 30840 element.setAttribute("tabindex", tabindex); 30841 } else { 30842 element.removeAttribute("tabindex"); 30843 } 30844 }; 30845 if (container.hasAttribute("data-tabindex")) { 30846 restoreTabIndex(container); 30847 } 30848 for (const element of elements) { 30849 restoreTabIndex(element); 30850 } 30851 } 30852 function focusIntoView(element, options) { 30853 if (!("scrollIntoView" in element)) { 30854 element.focus(); 30855 } else { 30856 element.focus({ preventScroll: true }); 30857 element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); 30858 } 30859 } 30860 30861 30862 ;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js 30863 "use client"; 30864 30865 30866 30867 30868 30869 // src/focusable/focusable.tsx 30870 30871 30872 30873 30874 30875 30876 var LVA2YJMS_TagName = "div"; 30877 var isSafariBrowser = isSafari(); 30878 var alwaysFocusVisibleInputTypes = [ 30879 "text", 30880 "search", 30881 "url", 30882 "tel", 30883 "email", 30884 "password", 30885 "number", 30886 "date", 30887 "month", 30888 "week", 30889 "time", 30890 "datetime", 30891 "datetime-local" 30892 ]; 30893 var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); 30894 function isSafariFocusAncestor(element) { 30895 if (!element) return false; 30896 return !!element[safariFocusAncestorSymbol]; 30897 } 30898 function markSafariFocusAncestor(element, value) { 30899 if (!element) return; 30900 element[safariFocusAncestorSymbol] = value; 30901 } 30902 function isAlwaysFocusVisible(element) { 30903 const { tagName, readOnly, type } = element; 30904 if (tagName === "TEXTAREA" && !readOnly) return true; 30905 if (tagName === "SELECT" && !readOnly) return true; 30906 if (tagName === "INPUT" && !readOnly) { 30907 return alwaysFocusVisibleInputTypes.includes(type); 30908 } 30909 if (element.isContentEditable) return true; 30910 const role = element.getAttribute("role"); 30911 if (role === "combobox" && element.dataset.name) { 30912 return true; 30913 } 30914 return false; 30915 } 30916 function getLabels(element) { 30917 if ("labels" in element) { 30918 return element.labels; 30919 } 30920 return null; 30921 } 30922 function isNativeCheckboxOrRadio(element) { 30923 const tagName = element.tagName.toLowerCase(); 30924 if (tagName === "input" && element.type) { 30925 return element.type === "radio" || element.type === "checkbox"; 30926 } 30927 return false; 30928 } 30929 function isNativeTabbable(tagName) { 30930 if (!tagName) return true; 30931 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 30932 } 30933 function supportsDisabledAttribute(tagName) { 30934 if (!tagName) return true; 30935 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 30936 } 30937 function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { 30938 if (!focusable) { 30939 return tabIndexProp; 30940 } 30941 if (trulyDisabled) { 30942 if (nativeTabbable && !supportsDisabled) { 30943 return -1; 30944 } 30945 return; 30946 } 30947 if (nativeTabbable) { 30948 return tabIndexProp; 30949 } 30950 return tabIndexProp || 0; 30951 } 30952 function useDisableEvent(onEvent, disabled) { 30953 return useEvent((event) => { 30954 onEvent == null ? void 0 : onEvent(event); 30955 if (event.defaultPrevented) return; 30956 if (disabled) { 30957 event.stopPropagation(); 30958 event.preventDefault(); 30959 } 30960 }); 30961 } 30962 var isKeyboardModality = true; 30963 function onGlobalMouseDown(event) { 30964 const target = event.target; 30965 if (target && "hasAttribute" in target) { 30966 if (!target.hasAttribute("data-focus-visible")) { 30967 isKeyboardModality = false; 30968 } 30969 } 30970 } 30971 function onGlobalKeyDown(event) { 30972 if (event.metaKey) return; 30973 if (event.ctrlKey) return; 30974 if (event.altKey) return; 30975 isKeyboardModality = true; 30976 } 30977 var useFocusable = createHook( 30978 function useFocusable2(_a) { 30979 var _b = _a, { 30980 focusable = true, 30981 accessibleWhenDisabled, 30982 autoFocus, 30983 onFocusVisible 30984 } = _b, props = __objRest(_b, [ 30985 "focusable", 30986 "accessibleWhenDisabled", 30987 "autoFocus", 30988 "onFocusVisible" 30989 ]); 30990 const ref = (0,external_React_.useRef)(null); 30991 (0,external_React_.useEffect)(() => { 30992 if (!focusable) return; 30993 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 30994 addGlobalEventListener("keydown", onGlobalKeyDown, true); 30995 }, [focusable]); 30996 if (isSafariBrowser) { 30997 (0,external_React_.useEffect)(() => { 30998 if (!focusable) return; 30999 const element = ref.current; 31000 if (!element) return; 31001 if (!isNativeCheckboxOrRadio(element)) return; 31002 const labels = getLabels(element); 31003 if (!labels) return; 31004 const onMouseUp = () => queueMicrotask(() => element.focus()); 31005 for (const label of labels) { 31006 label.addEventListener("mouseup", onMouseUp); 31007 } 31008 return () => { 31009 for (const label of labels) { 31010 label.removeEventListener("mouseup", onMouseUp); 31011 } 31012 }; 31013 }, [focusable]); 31014 } 31015 const disabled = focusable && disabledFromProps(props); 31016 const trulyDisabled = !!disabled && !accessibleWhenDisabled; 31017 const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); 31018 (0,external_React_.useEffect)(() => { 31019 if (!focusable) return; 31020 if (trulyDisabled && focusVisible) { 31021 setFocusVisible(false); 31022 } 31023 }, [focusable, trulyDisabled, focusVisible]); 31024 (0,external_React_.useEffect)(() => { 31025 if (!focusable) return; 31026 if (!focusVisible) return; 31027 const element = ref.current; 31028 if (!element) return; 31029 if (typeof IntersectionObserver === "undefined") return; 31030 const observer = new IntersectionObserver(() => { 31031 if (!isFocusable(element)) { 31032 setFocusVisible(false); 31033 } 31034 }); 31035 observer.observe(element); 31036 return () => observer.disconnect(); 31037 }, [focusable, focusVisible]); 31038 const onKeyPressCapture = useDisableEvent( 31039 props.onKeyPressCapture, 31040 disabled 31041 ); 31042 const onMouseDownCapture = useDisableEvent( 31043 props.onMouseDownCapture, 31044 disabled 31045 ); 31046 const onClickCapture = useDisableEvent(props.onClickCapture, disabled); 31047 const onMouseDownProp = props.onMouseDown; 31048 const onMouseDown = useEvent((event) => { 31049 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 31050 if (event.defaultPrevented) return; 31051 if (!focusable) return; 31052 const element = event.currentTarget; 31053 if (!isSafariBrowser) return; 31054 if (isPortalEvent(event)) return; 31055 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; 31056 let receivedFocus = false; 31057 const onFocus = () => { 31058 receivedFocus = true; 31059 }; 31060 const options = { capture: true, once: true }; 31061 element.addEventListener("focusin", onFocus, options); 31062 const focusableContainer = getClosestFocusable(element.parentElement); 31063 markSafariFocusAncestor(focusableContainer, true); 31064 queueBeforeEvent(element, "mouseup", () => { 31065 element.removeEventListener("focusin", onFocus, true); 31066 markSafariFocusAncestor(focusableContainer, false); 31067 if (receivedFocus) return; 31068 focusIfNeeded(element); 31069 }); 31070 }); 31071 const handleFocusVisible = (event, currentTarget) => { 31072 if (currentTarget) { 31073 event.currentTarget = currentTarget; 31074 } 31075 if (!focusable) return; 31076 const element = event.currentTarget; 31077 if (!element) return; 31078 if (!hasFocus(element)) return; 31079 onFocusVisible == null ? void 0 : onFocusVisible(event); 31080 if (event.defaultPrevented) return; 31081 element.dataset.focusVisible = "true"; 31082 setFocusVisible(true); 31083 }; 31084 const onKeyDownCaptureProp = props.onKeyDownCapture; 31085 const onKeyDownCapture = useEvent((event) => { 31086 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); 31087 if (event.defaultPrevented) return; 31088 if (!focusable) return; 31089 if (focusVisible) return; 31090 if (event.metaKey) return; 31091 if (event.altKey) return; 31092 if (event.ctrlKey) return; 31093 if (!isSelfTarget(event)) return; 31094 const element = event.currentTarget; 31095 const applyFocusVisible = () => handleFocusVisible(event, element); 31096 queueBeforeEvent(element, "focusout", applyFocusVisible); 31097 }); 31098 const onFocusCaptureProp = props.onFocusCapture; 31099 const onFocusCapture = useEvent((event) => { 31100 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 31101 if (event.defaultPrevented) return; 31102 if (!focusable) return; 31103 if (!isSelfTarget(event)) { 31104 setFocusVisible(false); 31105 return; 31106 } 31107 const element = event.currentTarget; 31108 const applyFocusVisible = () => handleFocusVisible(event, element); 31109 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { 31110 queueBeforeEvent(event.target, "focusout", applyFocusVisible); 31111 } else { 31112 setFocusVisible(false); 31113 } 31114 }); 31115 const onBlurProp = props.onBlur; 31116 const onBlur = useEvent((event) => { 31117 onBlurProp == null ? void 0 : onBlurProp(event); 31118 if (!focusable) return; 31119 if (!isFocusEventOutside(event)) return; 31120 setFocusVisible(false); 31121 }); 31122 const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); 31123 const autoFocusRef = useEvent((element) => { 31124 if (!focusable) return; 31125 if (!autoFocus) return; 31126 if (!element) return; 31127 if (!autoFocusOnShow) return; 31128 queueMicrotask(() => { 31129 if (hasFocus(element)) return; 31130 if (!isFocusable(element)) return; 31131 element.focus(); 31132 }); 31133 }); 31134 const tagName = useTagName(ref); 31135 const nativeTabbable = focusable && isNativeTabbable(tagName); 31136 const supportsDisabled = focusable && supportsDisabledAttribute(tagName); 31137 const styleProp = props.style; 31138 const style = (0,external_React_.useMemo)(() => { 31139 if (trulyDisabled) { 31140 return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); 31141 } 31142 return styleProp; 31143 }, [trulyDisabled, styleProp]); 31144 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31145 "data-focus-visible": focusable && focusVisible || void 0, 31146 "data-autofocus": autoFocus || void 0, 31147 "aria-disabled": disabled || void 0 31148 }, props), { 31149 ref: useMergeRefs(ref, autoFocusRef, props.ref), 31150 style, 31151 tabIndex: getTabIndex( 31152 focusable, 31153 trulyDisabled, 31154 nativeTabbable, 31155 supportsDisabled, 31156 props.tabIndex 31157 ), 31158 disabled: supportsDisabled && trulyDisabled ? true : void 0, 31159 // TODO: Test Focusable contentEditable. 31160 contentEditable: disabled ? void 0 : props.contentEditable, 31161 onKeyPressCapture, 31162 onClickCapture, 31163 onMouseDownCapture, 31164 onMouseDown, 31165 onKeyDownCapture, 31166 onFocusCapture, 31167 onBlur 31168 }); 31169 return removeUndefinedValues(props); 31170 } 31171 ); 31172 var Focusable = forwardRef2(function Focusable2(props) { 31173 const htmlProps = useFocusable(props); 31174 return createElement(LVA2YJMS_TagName, htmlProps); 31175 }); 31176 31177 31178 31179 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js 31180 "use client"; 31181 31182 31183 31184 31185 31186 31187 31188 // src/composite/composite.tsx 31189 31190 31191 31192 31193 31194 31195 31196 var ITI7HKP4_TagName = "div"; 31197 function isGrid(items) { 31198 return items.some((item) => !!item.rowId); 31199 } 31200 function isPrintableKey(event) { 31201 const target = event.target; 31202 if (target && !isTextField(target)) return false; 31203 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 31204 } 31205 function isModifierKey(event) { 31206 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 31207 } 31208 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { 31209 return useEvent((event) => { 31210 var _a; 31211 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); 31212 if (event.defaultPrevented) return; 31213 if (event.isPropagationStopped()) return; 31214 if (!isSelfTarget(event)) return; 31215 if (isModifierKey(event)) return; 31216 if (isPrintableKey(event)) return; 31217 const state = store.getState(); 31218 const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; 31219 if (!activeElement) return; 31220 const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]); 31221 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; 31222 if (activeElement !== previousElement) { 31223 activeElement.focus(); 31224 } 31225 if (!fireKeyboardEvent(activeElement, event.type, eventInit)) { 31226 event.preventDefault(); 31227 } 31228 if (event.currentTarget.contains(activeElement)) { 31229 event.stopPropagation(); 31230 } 31231 }); 31232 } 31233 function findFirstEnabledItemInTheLastRow(items) { 31234 return _5VQZOHHZ_findFirstEnabledItem( 31235 flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items))) 31236 ); 31237 } 31238 function useScheduleFocus(store) { 31239 const [scheduled, setScheduled] = (0,external_React_.useState)(false); 31240 const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []); 31241 const activeItem = store.useState( 31242 (state) => getEnabledItem(store, state.activeId) 31243 ); 31244 (0,external_React_.useEffect)(() => { 31245 const activeElement = activeItem == null ? void 0 : activeItem.element; 31246 if (!scheduled) return; 31247 if (!activeElement) return; 31248 setScheduled(false); 31249 activeElement.focus({ preventScroll: true }); 31250 }, [activeItem, scheduled]); 31251 return schedule; 31252 } 31253 var useComposite = createHook( 31254 function useComposite2(_a) { 31255 var _b = _a, { 31256 store, 31257 composite = true, 31258 focusOnMove = composite, 31259 moveOnKeyPress = true 31260 } = _b, props = __objRest(_b, [ 31261 "store", 31262 "composite", 31263 "focusOnMove", 31264 "moveOnKeyPress" 31265 ]); 31266 const context = useCompositeProviderContext(); 31267 store = store || context; 31268 invariant( 31269 store, 31270 false && 0 31271 ); 31272 const ref = (0,external_React_.useRef)(null); 31273 const previousElementRef = (0,external_React_.useRef)(null); 31274 const scheduleFocus = useScheduleFocus(store); 31275 const moves = store.useState("moves"); 31276 const [, setBaseElement] = useTransactionState( 31277 composite ? store.setBaseElement : null 31278 ); 31279 (0,external_React_.useEffect)(() => { 31280 var _a2; 31281 if (!store) return; 31282 if (!moves) return; 31283 if (!composite) return; 31284 if (!focusOnMove) return; 31285 const { activeId: activeId2 } = store.getState(); 31286 const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 31287 if (!itemElement) return; 31288 focusIntoView(itemElement); 31289 }, [store, moves, composite, focusOnMove]); 31290 useSafeLayoutEffect(() => { 31291 if (!store) return; 31292 if (!moves) return; 31293 if (!composite) return; 31294 const { baseElement, activeId: activeId2 } = store.getState(); 31295 const isSelfAcive = activeId2 === null; 31296 if (!isSelfAcive) return; 31297 if (!baseElement) return; 31298 const previousElement = previousElementRef.current; 31299 previousElementRef.current = null; 31300 if (previousElement) { 31301 fireBlurEvent(previousElement, { relatedTarget: baseElement }); 31302 } 31303 if (!hasFocus(baseElement)) { 31304 baseElement.focus(); 31305 } 31306 }, [store, moves, composite]); 31307 const activeId = store.useState("activeId"); 31308 const virtualFocus = store.useState("virtualFocus"); 31309 useSafeLayoutEffect(() => { 31310 var _a2; 31311 if (!store) return; 31312 if (!composite) return; 31313 if (!virtualFocus) return; 31314 const previousElement = previousElementRef.current; 31315 previousElementRef.current = null; 31316 if (!previousElement) return; 31317 const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element; 31318 const relatedTarget = activeElement || DTR5TSDJ_getActiveElement(previousElement); 31319 if (relatedTarget === previousElement) return; 31320 fireBlurEvent(previousElement, { relatedTarget }); 31321 }, [store, activeId, virtualFocus, composite]); 31322 const onKeyDownCapture = useKeyboardEventProxy( 31323 store, 31324 props.onKeyDownCapture, 31325 previousElementRef 31326 ); 31327 const onKeyUpCapture = useKeyboardEventProxy( 31328 store, 31329 props.onKeyUpCapture, 31330 previousElementRef 31331 ); 31332 const onFocusCaptureProp = props.onFocusCapture; 31333 const onFocusCapture = useEvent((event) => { 31334 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 31335 if (event.defaultPrevented) return; 31336 if (!store) return; 31337 const { virtualFocus: virtualFocus2 } = store.getState(); 31338 if (!virtualFocus2) return; 31339 const previousActiveElement = event.relatedTarget; 31340 const isSilentlyFocused = silentlyFocused(event.currentTarget); 31341 if (isSelfTarget(event) && isSilentlyFocused) { 31342 event.stopPropagation(); 31343 previousElementRef.current = previousActiveElement; 31344 } 31345 }); 31346 const onFocusProp = props.onFocus; 31347 const onFocus = useEvent((event) => { 31348 onFocusProp == null ? void 0 : onFocusProp(event); 31349 if (event.defaultPrevented) return; 31350 if (!composite) return; 31351 if (!store) return; 31352 const { relatedTarget } = event; 31353 const { virtualFocus: virtualFocus2 } = store.getState(); 31354 if (virtualFocus2) { 31355 if (isSelfTarget(event) && !isItem(store, relatedTarget)) { 31356 queueMicrotask(scheduleFocus); 31357 } 31358 } else if (isSelfTarget(event)) { 31359 store.setActiveId(null); 31360 } 31361 }); 31362 const onBlurCaptureProp = props.onBlurCapture; 31363 const onBlurCapture = useEvent((event) => { 31364 var _a2; 31365 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 31366 if (event.defaultPrevented) return; 31367 if (!store) return; 31368 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); 31369 if (!virtualFocus2) return; 31370 const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 31371 const nextActiveElement = event.relatedTarget; 31372 const nextActiveElementIsItem = isItem(store, nextActiveElement); 31373 const previousElement = previousElementRef.current; 31374 previousElementRef.current = null; 31375 if (isSelfTarget(event) && nextActiveElementIsItem) { 31376 if (nextActiveElement === activeElement) { 31377 if (previousElement && previousElement !== nextActiveElement) { 31378 fireBlurEvent(previousElement, event); 31379 } 31380 } else if (activeElement) { 31381 fireBlurEvent(activeElement, event); 31382 } else if (previousElement) { 31383 fireBlurEvent(previousElement, event); 31384 } 31385 event.stopPropagation(); 31386 } else { 31387 const targetIsItem = isItem(store, event.target); 31388 if (!targetIsItem && activeElement) { 31389 fireBlurEvent(activeElement, event); 31390 } 31391 } 31392 }); 31393 const onKeyDownProp = props.onKeyDown; 31394 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 31395 const onKeyDown = useEvent((event) => { 31396 var _a2; 31397 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 31398 if (event.defaultPrevented) return; 31399 if (!store) return; 31400 if (!isSelfTarget(event)) return; 31401 const { orientation, renderedItems, activeId: activeId2 } = store.getState(); 31402 const activeItem = getEnabledItem(store, activeId2); 31403 if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return; 31404 const isVertical = orientation !== "horizontal"; 31405 const isHorizontal = orientation !== "vertical"; 31406 const grid = isGrid(renderedItems); 31407 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; 31408 if (isHorizontalKey && isTextField(event.currentTarget)) return; 31409 const up = () => { 31410 if (grid) { 31411 const item = findFirstEnabledItemInTheLastRow(renderedItems); 31412 return item == null ? void 0 : item.id; 31413 } 31414 return store == null ? void 0 : store.last(); 31415 }; 31416 const keyMap = { 31417 ArrowUp: (grid || isVertical) && up, 31418 ArrowRight: (grid || isHorizontal) && store.first, 31419 ArrowDown: (grid || isVertical) && store.first, 31420 ArrowLeft: (grid || isHorizontal) && store.last, 31421 Home: store.first, 31422 End: store.last, 31423 PageUp: store.first, 31424 PageDown: store.last 31425 }; 31426 const action = keyMap[event.key]; 31427 if (action) { 31428 const id = action(); 31429 if (id !== void 0) { 31430 if (!moveOnKeyPressProp(event)) return; 31431 event.preventDefault(); 31432 store.move(id); 31433 } 31434 } 31435 }); 31436 props = useWrapElement( 31437 props, 31438 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }), 31439 [store] 31440 ); 31441 const activeDescendant = store.useState((state) => { 31442 var _a2; 31443 if (!store) return; 31444 if (!composite) return; 31445 if (!state.virtualFocus) return; 31446 return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id; 31447 }); 31448 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31449 "aria-activedescendant": activeDescendant 31450 }, props), { 31451 ref: useMergeRefs(ref, setBaseElement, props.ref), 31452 onKeyDownCapture, 31453 onKeyUpCapture, 31454 onFocusCapture, 31455 onFocus, 31456 onBlurCapture, 31457 onKeyDown 31458 }); 31459 const focusable = store.useState( 31460 (state) => composite && (state.virtualFocus || state.activeId === null) 31461 ); 31462 props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props)); 31463 return props; 31464 } 31465 ); 31466 var Composite = forwardRef2(function Composite2(props) { 31467 const htmlProps = useComposite(props); 31468 return createElement(ITI7HKP4_TagName, htmlProps); 31469 }); 31470 31471 31472 31473 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox.js 31474 "use client"; 31475 31476 31477 31478 31479 31480 31481 31482 31483 31484 31485 31486 31487 31488 31489 31490 31491 // src/combobox/combobox.tsx 31492 31493 31494 31495 31496 31497 31498 var combobox_TagName = "input"; 31499 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 31500 if (!autoSelect) return false; 31501 const firstItem = items.find((item) => !item.disabled && item.value); 31502 return (firstItem == null ? void 0 : firstItem.value) === activeValue; 31503 } 31504 function hasCompletionString(value, activeValue) { 31505 if (!activeValue) return false; 31506 if (value == null) return false; 31507 value = PBFD2E7P_normalizeString(value); 31508 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; 31509 } 31510 function isInputEvent(event) { 31511 return event.type === "input"; 31512 } 31513 function isAriaAutoCompleteValue(value) { 31514 return value === "inline" || value === "list" || value === "both" || value === "none"; 31515 } 31516 function getDefaultAutoSelectId(items) { 31517 const item = items.find((item2) => { 31518 var _a; 31519 if (item2.disabled) return false; 31520 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; 31521 }); 31522 return item == null ? void 0 : item.id; 31523 } 31524 var useCombobox = createHook( 31525 function useCombobox2(_a) { 31526 var _b = _a, { 31527 store, 31528 focusable = true, 31529 autoSelect: autoSelectProp = false, 31530 getAutoSelectId, 31531 setValueOnChange, 31532 showMinLength = 0, 31533 showOnChange, 31534 showOnMouseDown, 31535 showOnClick = showOnMouseDown, 31536 showOnKeyDown, 31537 showOnKeyPress = showOnKeyDown, 31538 blurActiveItemOnClick, 31539 setValueOnClick = true, 31540 moveOnKeyPress = true, 31541 autoComplete = "list" 31542 } = _b, props = __objRest(_b, [ 31543 "store", 31544 "focusable", 31545 "autoSelect", 31546 "getAutoSelectId", 31547 "setValueOnChange", 31548 "showMinLength", 31549 "showOnChange", 31550 "showOnMouseDown", 31551 "showOnClick", 31552 "showOnKeyDown", 31553 "showOnKeyPress", 31554 "blurActiveItemOnClick", 31555 "setValueOnClick", 31556 "moveOnKeyPress", 31557 "autoComplete" 31558 ]); 31559 const context = useComboboxProviderContext(); 31560 store = store || context; 31561 invariant( 31562 store, 31563 false && 0 31564 ); 31565 const ref = (0,external_React_.useRef)(null); 31566 const [valueUpdated, forceValueUpdate] = useForceUpdate(); 31567 const canAutoSelectRef = (0,external_React_.useRef)(false); 31568 const composingRef = (0,external_React_.useRef)(false); 31569 const autoSelect = store.useState( 31570 (state) => state.virtualFocus && autoSelectProp 31571 ); 31572 const inline = autoComplete === "inline" || autoComplete === "both"; 31573 const [canInline, setCanInline] = (0,external_React_.useState)(inline); 31574 useUpdateLayoutEffect(() => { 31575 if (!inline) return; 31576 setCanInline(true); 31577 }, [inline]); 31578 const storeValue = store.useState("value"); 31579 const prevSelectedValueRef = (0,external_React_.useRef)(); 31580 (0,external_React_.useEffect)(() => { 31581 return sync(store, ["selectedValue", "activeId"], (_, prev) => { 31582 prevSelectedValueRef.current = prev.selectedValue; 31583 }); 31584 }, []); 31585 const inlineActiveValue = store.useState((state) => { 31586 var _a2; 31587 if (!inline) return; 31588 if (!canInline) return; 31589 if (state.activeValue && Array.isArray(state.selectedValue)) { 31590 if (state.selectedValue.includes(state.activeValue)) return; 31591 if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return; 31592 } 31593 return state.activeValue; 31594 }); 31595 const items = store.useState("renderedItems"); 31596 const open = store.useState("open"); 31597 const contentElement = store.useState("contentElement"); 31598 const value = (0,external_React_.useMemo)(() => { 31599 if (!inline) return storeValue; 31600 if (!canInline) return storeValue; 31601 const firstItemAutoSelected = isFirstItemAutoSelected( 31602 items, 31603 inlineActiveValue, 31604 autoSelect 31605 ); 31606 if (firstItemAutoSelected) { 31607 if (hasCompletionString(storeValue, inlineActiveValue)) { 31608 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; 31609 return storeValue + slice; 31610 } 31611 return storeValue; 31612 } 31613 return inlineActiveValue || storeValue; 31614 }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]); 31615 (0,external_React_.useEffect)(() => { 31616 const element = ref.current; 31617 if (!element) return; 31618 const onCompositeItemMove = () => setCanInline(true); 31619 element.addEventListener("combobox-item-move", onCompositeItemMove); 31620 return () => { 31621 element.removeEventListener("combobox-item-move", onCompositeItemMove); 31622 }; 31623 }, []); 31624 (0,external_React_.useEffect)(() => { 31625 if (!inline) return; 31626 if (!canInline) return; 31627 if (!inlineActiveValue) return; 31628 const firstItemAutoSelected = isFirstItemAutoSelected( 31629 items, 31630 inlineActiveValue, 31631 autoSelect 31632 ); 31633 if (!firstItemAutoSelected) return; 31634 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 31635 let cleanup = PBFD2E7P_noop; 31636 queueMicrotask(() => { 31637 const element = ref.current; 31638 if (!element) return; 31639 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 31640 const nextStart = storeValue.length; 31641 const nextEnd = inlineActiveValue.length; 31642 setSelectionRange(element, nextStart, nextEnd); 31643 cleanup = () => { 31644 if (!hasFocus(element)) return; 31645 const { start, end } = getTextboxSelection(element); 31646 if (start !== nextStart) return; 31647 if (end !== nextEnd) return; 31648 setSelectionRange(element, prevStart, prevEnd); 31649 }; 31650 }); 31651 return () => cleanup(); 31652 }, [ 31653 valueUpdated, 31654 inline, 31655 canInline, 31656 inlineActiveValue, 31657 items, 31658 autoSelect, 31659 storeValue 31660 ]); 31661 const scrollingElementRef = (0,external_React_.useRef)(null); 31662 const getAutoSelectIdProp = useEvent(getAutoSelectId); 31663 const autoSelectIdRef = (0,external_React_.useRef)(null); 31664 (0,external_React_.useEffect)(() => { 31665 if (!open) return; 31666 if (!contentElement) return; 31667 const scrollingElement = getScrollingElement(contentElement); 31668 if (!scrollingElement) return; 31669 scrollingElementRef.current = scrollingElement; 31670 const onUserScroll = () => { 31671 canAutoSelectRef.current = false; 31672 }; 31673 const onScroll = () => { 31674 if (!store) return; 31675 if (!canAutoSelectRef.current) return; 31676 const { activeId } = store.getState(); 31677 if (activeId === null) return; 31678 if (activeId === autoSelectIdRef.current) return; 31679 canAutoSelectRef.current = false; 31680 }; 31681 const options = { passive: true, capture: true }; 31682 scrollingElement.addEventListener("wheel", onUserScroll, options); 31683 scrollingElement.addEventListener("touchmove", onUserScroll, options); 31684 scrollingElement.addEventListener("scroll", onScroll, options); 31685 return () => { 31686 scrollingElement.removeEventListener("wheel", onUserScroll, true); 31687 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 31688 scrollingElement.removeEventListener("scroll", onScroll, true); 31689 }; 31690 }, [open, contentElement, store]); 31691 useSafeLayoutEffect(() => { 31692 if (!storeValue) return; 31693 if (composingRef.current) return; 31694 canAutoSelectRef.current = true; 31695 }, [storeValue]); 31696 useSafeLayoutEffect(() => { 31697 if (autoSelect !== "always" && open) return; 31698 canAutoSelectRef.current = open; 31699 }, [autoSelect, open]); 31700 const resetValueOnSelect = store.useState("resetValueOnSelect"); 31701 useUpdateEffect(() => { 31702 var _a2, _b2; 31703 const canAutoSelect = canAutoSelectRef.current; 31704 if (!store) return; 31705 if (!open) return; 31706 if (!canAutoSelect && !resetValueOnSelect) return; 31707 const { baseElement, contentElement: contentElement2, activeId } = store.getState(); 31708 if (baseElement && !hasFocus(baseElement)) return; 31709 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { 31710 const observer = new MutationObserver(forceValueUpdate); 31711 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 31712 return () => observer.disconnect(); 31713 } 31714 if (autoSelect && canAutoSelect) { 31715 const userAutoSelectId = getAutoSelectIdProp(items); 31716 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first(); 31717 autoSelectIdRef.current = autoSelectId; 31718 store.move(autoSelectId != null ? autoSelectId : null); 31719 } else { 31720 const element = (_b2 = store.item(activeId || store.first())) == null ? void 0 : _b2.element; 31721 if (element && "scrollIntoView" in element) { 31722 element.scrollIntoView({ block: "nearest", inline: "nearest" }); 31723 } 31724 } 31725 return; 31726 }, [ 31727 store, 31728 open, 31729 valueUpdated, 31730 storeValue, 31731 autoSelect, 31732 resetValueOnSelect, 31733 getAutoSelectIdProp, 31734 items 31735 ]); 31736 (0,external_React_.useEffect)(() => { 31737 if (!inline) return; 31738 const combobox = ref.current; 31739 if (!combobox) return; 31740 const elements = [combobox, contentElement].filter( 31741 (value2) => !!value2 31742 ); 31743 const onBlur2 = (event) => { 31744 if (elements.every((el) => isFocusEventOutside(event, el))) { 31745 store == null ? void 0 : store.setValue(value); 31746 } 31747 }; 31748 for (const element of elements) { 31749 element.addEventListener("focusout", onBlur2); 31750 } 31751 return () => { 31752 for (const element of elements) { 31753 element.removeEventListener("focusout", onBlur2); 31754 } 31755 }; 31756 }, [inline, contentElement, store, value]); 31757 const canShow = (event) => { 31758 const currentTarget = event.currentTarget; 31759 return currentTarget.value.length >= showMinLength; 31760 }; 31761 const onChangeProp = props.onChange; 31762 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); 31763 const setValueOnChangeProp = useBooleanEvent( 31764 // If the combobox is combined with tags, the value will be set by the tag 31765 // input component. 31766 setValueOnChange != null ? setValueOnChange : !store.tag 31767 ); 31768 const onChange = useEvent((event) => { 31769 onChangeProp == null ? void 0 : onChangeProp(event); 31770 if (event.defaultPrevented) return; 31771 if (!store) return; 31772 const currentTarget = event.currentTarget; 31773 const { value: value2, selectionStart, selectionEnd } = currentTarget; 31774 const nativeEvent = event.nativeEvent; 31775 canAutoSelectRef.current = true; 31776 if (isInputEvent(nativeEvent)) { 31777 if (nativeEvent.isComposing) { 31778 canAutoSelectRef.current = false; 31779 composingRef.current = true; 31780 } 31781 if (inline) { 31782 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 31783 const caretAtEnd = selectionStart === value2.length; 31784 setCanInline(textInserted && caretAtEnd); 31785 } 31786 } 31787 if (setValueOnChangeProp(event)) { 31788 const isSameValue = value2 === store.getState().value; 31789 store.setValue(value2); 31790 queueMicrotask(() => { 31791 setSelectionRange(currentTarget, selectionStart, selectionEnd); 31792 }); 31793 if (inline && autoSelect && isSameValue) { 31794 forceValueUpdate(); 31795 } 31796 } 31797 if (showOnChangeProp(event)) { 31798 store.show(); 31799 } 31800 if (!autoSelect || !canAutoSelectRef.current) { 31801 store.setActiveId(null); 31802 } 31803 }); 31804 const onCompositionEndProp = props.onCompositionEnd; 31805 const onCompositionEnd = useEvent((event) => { 31806 canAutoSelectRef.current = true; 31807 composingRef.current = false; 31808 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); 31809 if (event.defaultPrevented) return; 31810 if (!autoSelect) return; 31811 forceValueUpdate(); 31812 }); 31813 const onMouseDownProp = props.onMouseDown; 31814 const blurActiveItemOnClickProp = useBooleanEvent( 31815 blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement) 31816 ); 31817 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 31818 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); 31819 const onMouseDown = useEvent((event) => { 31820 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 31821 if (event.defaultPrevented) return; 31822 if (event.button) return; 31823 if (event.ctrlKey) return; 31824 if (!store) return; 31825 if (blurActiveItemOnClickProp(event)) { 31826 store.setActiveId(null); 31827 } 31828 if (setValueOnClickProp(event)) { 31829 store.setValue(value); 31830 } 31831 if (showOnClickProp(event)) { 31832 queueBeforeEvent(event.currentTarget, "mouseup", store.show); 31833 } 31834 }); 31835 const onKeyDownProp = props.onKeyDown; 31836 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); 31837 const onKeyDown = useEvent((event) => { 31838 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 31839 if (!event.repeat) { 31840 canAutoSelectRef.current = false; 31841 } 31842 if (event.defaultPrevented) return; 31843 if (event.ctrlKey) return; 31844 if (event.altKey) return; 31845 if (event.shiftKey) return; 31846 if (event.metaKey) return; 31847 if (!store) return; 31848 const { open: open2 } = store.getState(); 31849 if (open2) return; 31850 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 31851 if (showOnKeyPressProp(event)) { 31852 event.preventDefault(); 31853 store.show(); 31854 } 31855 } 31856 }); 31857 const onBlurProp = props.onBlur; 31858 const onBlur = useEvent((event) => { 31859 canAutoSelectRef.current = false; 31860 onBlurProp == null ? void 0 : onBlurProp(event); 31861 if (event.defaultPrevented) return; 31862 }); 31863 const id = useId(props.id); 31864 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 31865 const isActiveItem = store.useState((state) => state.activeId === null); 31866 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31867 id, 31868 role: "combobox", 31869 "aria-autocomplete": ariaAutoComplete, 31870 "aria-haspopup": getPopupRole(contentElement, "listbox"), 31871 "aria-expanded": open, 31872 "aria-controls": contentElement == null ? void 0 : contentElement.id, 31873 "data-active-item": isActiveItem || void 0, 31874 value 31875 }, props), { 31876 ref: useMergeRefs(ref, props.ref), 31877 onChange, 31878 onCompositionEnd, 31879 onMouseDown, 31880 onKeyDown, 31881 onBlur 31882 }); 31883 props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31884 store, 31885 focusable 31886 }, props), { 31887 // Enable inline autocomplete when the user moves from the combobox input 31888 // to an item. 31889 moveOnKeyPress: (event) => { 31890 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 31891 if (inline) setCanInline(true); 31892 return true; 31893 } 31894 })); 31895 props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props)); 31896 return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props); 31897 } 31898 ); 31899 var Combobox = forwardRef2(function Combobox2(props) { 31900 const htmlProps = useCombobox(props); 31901 return createElement(combobox_TagName, htmlProps); 31902 }); 31903 31904 31905 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js 31906 "use client"; 31907 31908 31909 31910 31911 31912 31913 31914 // src/disclosure/disclosure-content.tsx 31915 31916 31917 31918 31919 var VGCJ63VH_TagName = "div"; 31920 function afterTimeout(timeoutMs, cb) { 31921 const timeoutId = setTimeout(cb, timeoutMs); 31922 return () => clearTimeout(timeoutId); 31923 } 31924 function VGCJ63VH_afterPaint(cb) { 31925 let raf = requestAnimationFrame(() => { 31926 raf = requestAnimationFrame(cb); 31927 }); 31928 return () => cancelAnimationFrame(raf); 31929 } 31930 function parseCSSTime(...times) { 31931 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { 31932 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; 31933 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; 31934 if (currentTime > longestTime) return currentTime; 31935 return longestTime; 31936 }, 0); 31937 } 31938 function isHidden(mounted, hidden, alwaysVisible) { 31939 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 31940 } 31941 var useDisclosureContent = createHook(function useDisclosureContent2(_a) { 31942 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 31943 const context = useDisclosureProviderContext(); 31944 store = store || context; 31945 invariant( 31946 store, 31947 false && 0 31948 ); 31949 const ref = (0,external_React_.useRef)(null); 31950 const id = useId(props.id); 31951 const [transition, setTransition] = (0,external_React_.useState)(null); 31952 const open = store.useState("open"); 31953 const mounted = store.useState("mounted"); 31954 const animated = store.useState("animated"); 31955 const contentElement = store.useState("contentElement"); 31956 const otherElement = useStoreState(store.disclosure, "contentElement"); 31957 useSafeLayoutEffect(() => { 31958 if (!ref.current) return; 31959 store == null ? void 0 : store.setContentElement(ref.current); 31960 }, [store]); 31961 useSafeLayoutEffect(() => { 31962 let previousAnimated; 31963 store == null ? void 0 : store.setState("animated", (animated2) => { 31964 previousAnimated = animated2; 31965 return true; 31966 }); 31967 return () => { 31968 if (previousAnimated === void 0) return; 31969 store == null ? void 0 : store.setState("animated", previousAnimated); 31970 }; 31971 }, [store]); 31972 useSafeLayoutEffect(() => { 31973 if (!animated) return; 31974 if (!(contentElement == null ? void 0 : contentElement.isConnected)) { 31975 setTransition(null); 31976 return; 31977 } 31978 return VGCJ63VH_afterPaint(() => { 31979 setTransition(open ? "enter" : mounted ? "leave" : null); 31980 }); 31981 }, [animated, contentElement, open, mounted]); 31982 useSafeLayoutEffect(() => { 31983 if (!store) return; 31984 if (!animated) return; 31985 if (!transition) return; 31986 if (!contentElement) return; 31987 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); 31988 const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation); 31989 if (transition === "leave" && open) return; 31990 if (transition === "enter" && !open) return; 31991 if (typeof animated === "number") { 31992 const timeout2 = animated; 31993 return afterTimeout(timeout2, stopAnimationSync); 31994 } 31995 const { 31996 transitionDuration, 31997 animationDuration, 31998 transitionDelay, 31999 animationDelay 32000 } = getComputedStyle(contentElement); 32001 const { 32002 transitionDuration: transitionDuration2 = "0", 32003 animationDuration: animationDuration2 = "0", 32004 transitionDelay: transitionDelay2 = "0", 32005 animationDelay: animationDelay2 = "0" 32006 } = otherElement ? getComputedStyle(otherElement) : {}; 32007 const delay = parseCSSTime( 32008 transitionDelay, 32009 animationDelay, 32010 transitionDelay2, 32011 animationDelay2 32012 ); 32013 const duration = parseCSSTime( 32014 transitionDuration, 32015 animationDuration, 32016 transitionDuration2, 32017 animationDuration2 32018 ); 32019 const timeout = delay + duration; 32020 if (!timeout) { 32021 if (transition === "enter") { 32022 store.setState("animated", false); 32023 } 32024 stopAnimation(); 32025 return; 32026 } 32027 const frameRate = 1e3 / 60; 32028 const maxTimeout = Math.max(timeout - frameRate, 0); 32029 return afterTimeout(maxTimeout, stopAnimationSync); 32030 }, [store, animated, contentElement, otherElement, open, transition]); 32031 props = useWrapElement( 32032 props, 32033 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }), 32034 [store] 32035 ); 32036 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 32037 const styleProp = props.style; 32038 const style = (0,external_React_.useMemo)(() => { 32039 if (hidden) { 32040 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" }); 32041 } 32042 return styleProp; 32043 }, [hidden, styleProp]); 32044 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32045 id, 32046 "data-open": open || void 0, 32047 "data-enter": transition === "enter" || void 0, 32048 "data-leave": transition === "leave" || void 0, 32049 hidden 32050 }, props), { 32051 ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref), 32052 style 32053 }); 32054 return removeUndefinedValues(props); 32055 }); 32056 var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) { 32057 const htmlProps = useDisclosureContent(props); 32058 return createElement(VGCJ63VH_TagName, htmlProps); 32059 }); 32060 var DisclosureContent = forwardRef2(function DisclosureContent2(_a) { 32061 var _b = _a, { 32062 unmountOnHide 32063 } = _b, props = __objRest(_b, [ 32064 "unmountOnHide" 32065 ]); 32066 const context = useDisclosureProviderContext(); 32067 const store = props.store || context; 32068 const mounted = useStoreState( 32069 store, 32070 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) 32071 ); 32072 if (mounted === false) return null; 32073 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props)); 32074 }); 32075 32076 32077 32078 ;// ./node_modules/@ariakit/react-core/esm/__chunks/HUWAI7RB.js 32079 "use client"; 32080 32081 32082 32083 32084 32085 32086 // src/combobox/combobox-list.tsx 32087 32088 32089 32090 var HUWAI7RB_TagName = "div"; 32091 var useComboboxList = createHook( 32092 function useComboboxList2(_a) { 32093 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 32094 const scopedContext = useComboboxScopedContext(true); 32095 const context = useComboboxContext(); 32096 store = store || context; 32097 const scopedContextSameStore = !!store && store === scopedContext; 32098 invariant( 32099 store, 32100 false && 0 32101 ); 32102 const ref = (0,external_React_.useRef)(null); 32103 const id = useId(props.id); 32104 const mounted = store.useState("mounted"); 32105 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 32106 const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; 32107 const multiSelectable = store.useState( 32108 (state) => Array.isArray(state.selectedValue) 32109 ); 32110 const role = useAttribute(ref, "role", props.role); 32111 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; 32112 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; 32113 const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false); 32114 const contentElement = store.useState("contentElement"); 32115 useSafeLayoutEffect(() => { 32116 if (!mounted) return; 32117 const element = ref.current; 32118 if (!element) return; 32119 if (contentElement !== element) return; 32120 const callback = () => { 32121 setHasListboxInside(!!element.querySelector("[role='listbox']")); 32122 }; 32123 const observer = new MutationObserver(callback); 32124 observer.observe(element, { 32125 subtree: true, 32126 childList: true, 32127 attributeFilter: ["role"] 32128 }); 32129 callback(); 32130 return () => observer.disconnect(); 32131 }, [mounted, contentElement]); 32132 if (!hasListboxInside) { 32133 props = _3YLGPPWQ_spreadValues({ 32134 role: "listbox", 32135 "aria-multiselectable": ariaMultiSelectable 32136 }, props); 32137 } 32138 props = useWrapElement( 32139 props, 32140 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), 32141 [store, role] 32142 ); 32143 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; 32144 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32145 id, 32146 hidden 32147 }, props), { 32148 ref: useMergeRefs(setContentElement, ref, props.ref), 32149 style 32150 }); 32151 return removeUndefinedValues(props); 32152 } 32153 ); 32154 var ComboboxList = forwardRef2(function ComboboxList2(props) { 32155 const htmlProps = useComboboxList(props); 32156 return createElement(HUWAI7RB_TagName, htmlProps); 32157 }); 32158 32159 32160 32161 ;// ./node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js 32162 "use client"; 32163 32164 32165 32166 32167 32168 // src/composite/composite-hover.tsx 32169 32170 32171 32172 32173 var UQQRIHDV_TagName = "div"; 32174 function getMouseDestination(event) { 32175 const relatedTarget = event.relatedTarget; 32176 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { 32177 return relatedTarget; 32178 } 32179 return null; 32180 } 32181 function hoveringInside(event) { 32182 const nextElement = getMouseDestination(event); 32183 if (!nextElement) return false; 32184 return contains(event.currentTarget, nextElement); 32185 } 32186 var UQQRIHDV_symbol = Symbol("composite-hover"); 32187 function movingToAnotherItem(event) { 32188 let dest = getMouseDestination(event); 32189 if (!dest) return false; 32190 do { 32191 if (PBFD2E7P_hasOwnProperty(dest, UQQRIHDV_symbol) && dest[UQQRIHDV_symbol]) return true; 32192 dest = dest.parentElement; 32193 } while (dest); 32194 return false; 32195 } 32196 var useCompositeHover = createHook( 32197 function useCompositeHover2(_a) { 32198 var _b = _a, { 32199 store, 32200 focusOnHover = true, 32201 blurOnHoverEnd = !!focusOnHover 32202 } = _b, props = __objRest(_b, [ 32203 "store", 32204 "focusOnHover", 32205 "blurOnHoverEnd" 32206 ]); 32207 const context = useCompositeContext(); 32208 store = store || context; 32209 invariant( 32210 store, 32211 false && 0 32212 ); 32213 const isMouseMoving = useIsMouseMoving(); 32214 const onMouseMoveProp = props.onMouseMove; 32215 const focusOnHoverProp = useBooleanEvent(focusOnHover); 32216 const onMouseMove = useEvent((event) => { 32217 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); 32218 if (event.defaultPrevented) return; 32219 if (!isMouseMoving()) return; 32220 if (!focusOnHoverProp(event)) return; 32221 if (!hasFocusWithin(event.currentTarget)) { 32222 const baseElement = store == null ? void 0 : store.getState().baseElement; 32223 if (baseElement && !hasFocus(baseElement)) { 32224 baseElement.focus(); 32225 } 32226 } 32227 store == null ? void 0 : store.setActiveId(event.currentTarget.id); 32228 }); 32229 const onMouseLeaveProp = props.onMouseLeave; 32230 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 32231 const onMouseLeave = useEvent((event) => { 32232 var _a2; 32233 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); 32234 if (event.defaultPrevented) return; 32235 if (!isMouseMoving()) return; 32236 if (hoveringInside(event)) return; 32237 if (movingToAnotherItem(event)) return; 32238 if (!focusOnHoverProp(event)) return; 32239 if (!blurOnHoverEndProp(event)) return; 32240 store == null ? void 0 : store.setActiveId(null); 32241 (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus(); 32242 }); 32243 const ref = (0,external_React_.useCallback)((element) => { 32244 if (!element) return; 32245 element[UQQRIHDV_symbol] = true; 32246 }, []); 32247 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 32248 ref: useMergeRefs(ref, props.ref), 32249 onMouseMove, 32250 onMouseLeave 32251 }); 32252 return removeUndefinedValues(props); 32253 } 32254 ); 32255 var CompositeHover = memo2( 32256 forwardRef2(function CompositeHover2(props) { 32257 const htmlProps = useCompositeHover(props); 32258 return createElement(UQQRIHDV_TagName, htmlProps); 32259 }) 32260 ); 32261 32262 32263 32264 ;// ./node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js 32265 "use client"; 32266 32267 32268 32269 32270 32271 // src/collection/collection-item.tsx 32272 32273 32274 var RZ4GPYOB_TagName = "div"; 32275 var useCollectionItem = createHook( 32276 function useCollectionItem2(_a) { 32277 var _b = _a, { 32278 store, 32279 shouldRegisterItem = true, 32280 getItem = identity, 32281 element: element 32282 } = _b, props = __objRest(_b, [ 32283 "store", 32284 "shouldRegisterItem", 32285 "getItem", 32286 // @ts-expect-error This prop may come from a collection renderer. 32287 "element" 32288 ]); 32289 const context = useCollectionContext(); 32290 store = store || context; 32291 const id = useId(props.id); 32292 const ref = (0,external_React_.useRef)(element); 32293 (0,external_React_.useEffect)(() => { 32294 const element2 = ref.current; 32295 if (!id) return; 32296 if (!element2) return; 32297 if (!shouldRegisterItem) return; 32298 const item = getItem({ id, element: element2 }); 32299 return store == null ? void 0 : store.renderItem(item); 32300 }, [id, shouldRegisterItem, getItem, store]); 32301 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 32302 ref: useMergeRefs(ref, props.ref) 32303 }); 32304 return removeUndefinedValues(props); 32305 } 32306 ); 32307 var CollectionItem = forwardRef2(function CollectionItem2(props) { 32308 const htmlProps = useCollectionItem(props); 32309 return createElement(RZ4GPYOB_TagName, htmlProps); 32310 }); 32311 32312 32313 32314 ;// ./node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js 32315 "use client"; 32316 32317 32318 32319 32320 32321 // src/command/command.tsx 32322 32323 32324 32325 32326 32327 var KUU7WJ55_TagName = "button"; 32328 function isNativeClick(event) { 32329 if (!event.isTrusted) return false; 32330 const element = event.currentTarget; 32331 if (event.key === "Enter") { 32332 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 32333 } 32334 if (event.key === " ") { 32335 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 32336 } 32337 return false; 32338 } 32339 var KUU7WJ55_symbol = Symbol("command"); 32340 var useCommand = createHook( 32341 function useCommand2(_a) { 32342 var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]); 32343 const ref = (0,external_React_.useRef)(null); 32344 const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(false); 32345 (0,external_React_.useEffect)(() => { 32346 if (!ref.current) return; 32347 setIsNativeButton(isButton(ref.current)); 32348 }, []); 32349 const [active, setActive] = (0,external_React_.useState)(false); 32350 const activeRef = (0,external_React_.useRef)(false); 32351 const disabled = disabledFromProps(props); 32352 const [isDuplicate, metadataProps] = useMetadataProps(props, KUU7WJ55_symbol, true); 32353 const onKeyDownProp = props.onKeyDown; 32354 const onKeyDown = useEvent((event) => { 32355 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 32356 const element = event.currentTarget; 32357 if (event.defaultPrevented) return; 32358 if (isDuplicate) return; 32359 if (disabled) return; 32360 if (!isSelfTarget(event)) return; 32361 if (isTextField(element)) return; 32362 if (element.isContentEditable) return; 32363 const isEnter = clickOnEnter && event.key === "Enter"; 32364 const isSpace = clickOnSpace && event.key === " "; 32365 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 32366 const shouldPreventSpace = event.key === " " && !clickOnSpace; 32367 if (shouldPreventEnter || shouldPreventSpace) { 32368 event.preventDefault(); 32369 return; 32370 } 32371 if (isEnter || isSpace) { 32372 const nativeClick = isNativeClick(event); 32373 if (isEnter) { 32374 if (!nativeClick) { 32375 event.preventDefault(); 32376 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 32377 const click = () => fireClickEvent(element, eventInit); 32378 if (isFirefox()) { 32379 queueBeforeEvent(element, "keyup", click); 32380 } else { 32381 queueMicrotask(click); 32382 } 32383 } 32384 } else if (isSpace) { 32385 activeRef.current = true; 32386 if (!nativeClick) { 32387 event.preventDefault(); 32388 setActive(true); 32389 } 32390 } 32391 } 32392 }); 32393 const onKeyUpProp = props.onKeyUp; 32394 const onKeyUp = useEvent((event) => { 32395 onKeyUpProp == null ? void 0 : onKeyUpProp(event); 32396 if (event.defaultPrevented) return; 32397 if (isDuplicate) return; 32398 if (disabled) return; 32399 if (event.metaKey) return; 32400 const isSpace = clickOnSpace && event.key === " "; 32401 if (activeRef.current && isSpace) { 32402 activeRef.current = false; 32403 if (!isNativeClick(event)) { 32404 event.preventDefault(); 32405 setActive(false); 32406 const element = event.currentTarget; 32407 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 32408 queueMicrotask(() => fireClickEvent(element, eventInit)); 32409 } 32410 } 32411 }); 32412 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ 32413 "data-active": active || void 0, 32414 type: isNativeButton ? "button" : void 0 32415 }, metadataProps), props), { 32416 ref: useMergeRefs(ref, props.ref), 32417 onKeyDown, 32418 onKeyUp 32419 }); 32420 props = useFocusable(props); 32421 return props; 32422 } 32423 ); 32424 var Command = forwardRef2(function Command2(props) { 32425 const htmlProps = useCommand(props); 32426 return createElement(KUU7WJ55_TagName, htmlProps); 32427 }); 32428 32429 32430 32431 ;// ./node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js 32432 "use client"; 32433 32434 32435 32436 32437 32438 32439 32440 32441 32442 // src/composite/composite-item.tsx 32443 32444 32445 32446 32447 32448 32449 var P2CTZE2T_TagName = "button"; 32450 function isEditableElement(element) { 32451 if (isTextbox(element)) return true; 32452 return element.tagName === "INPUT" && !isButton(element); 32453 } 32454 function getNextPageOffset(scrollingElement, pageUp = false) { 32455 const height = scrollingElement.clientHeight; 32456 const { top } = scrollingElement.getBoundingClientRect(); 32457 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 32458 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 32459 if (scrollingElement.tagName === "HTML") { 32460 return pageOffset + scrollingElement.scrollTop; 32461 } 32462 return pageOffset; 32463 } 32464 function getItemOffset(itemElement, pageUp = false) { 32465 const { top } = itemElement.getBoundingClientRect(); 32466 if (pageUp) { 32467 return top + itemElement.clientHeight; 32468 } 32469 return top; 32470 } 32471 function findNextPageItemId(element, store, next, pageUp = false) { 32472 var _a; 32473 if (!store) return; 32474 if (!next) return; 32475 const { renderedItems } = store.getState(); 32476 const scrollingElement = getScrollingElement(element); 32477 if (!scrollingElement) return; 32478 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 32479 let id; 32480 let prevDifference; 32481 for (let i = 0; i < renderedItems.length; i += 1) { 32482 const previousId = id; 32483 id = next(i); 32484 if (!id) break; 32485 if (id === previousId) continue; 32486 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; 32487 if (!itemElement) continue; 32488 const itemOffset = getItemOffset(itemElement, pageUp); 32489 const difference = itemOffset - nextPageOffset; 32490 const absDifference = Math.abs(difference); 32491 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 32492 if (prevDifference !== void 0 && prevDifference < absDifference) { 32493 id = previousId; 32494 } 32495 break; 32496 } 32497 prevDifference = absDifference; 32498 } 32499 return id; 32500 } 32501 function targetIsAnotherItem(event, store) { 32502 if (isSelfTarget(event)) return false; 32503 return isItem(store, event.target); 32504 } 32505 var useCompositeItem = createHook( 32506 function useCompositeItem2(_a) { 32507 var _b = _a, { 32508 store, 32509 rowId: rowIdProp, 32510 preventScrollOnKeyDown = false, 32511 moveOnKeyPress = true, 32512 tabbable = false, 32513 getItem: getItemProp, 32514 "aria-setsize": ariaSetSizeProp, 32515 "aria-posinset": ariaPosInSetProp 32516 } = _b, props = __objRest(_b, [ 32517 "store", 32518 "rowId", 32519 "preventScrollOnKeyDown", 32520 "moveOnKeyPress", 32521 "tabbable", 32522 "getItem", 32523 "aria-setsize", 32524 "aria-posinset" 32525 ]); 32526 const context = useCompositeContext(); 32527 store = store || context; 32528 const id = useId(props.id); 32529 const ref = (0,external_React_.useRef)(null); 32530 const row = (0,external_React_.useContext)(CompositeRowContext); 32531 const disabled = disabledFromProps(props); 32532 const trulyDisabled = disabled && !props.accessibleWhenDisabled; 32533 const { 32534 rowId, 32535 baseElement, 32536 isActiveItem, 32537 ariaSetSize, 32538 ariaPosInSet, 32539 isTabbable 32540 } = useStoreStateObject(store, { 32541 rowId(state) { 32542 if (rowIdProp) return rowIdProp; 32543 if (!state) return; 32544 if (!(row == null ? void 0 : row.baseElement)) return; 32545 if (row.baseElement !== state.baseElement) return; 32546 return row.id; 32547 }, 32548 baseElement(state) { 32549 return (state == null ? void 0 : state.baseElement) || void 0; 32550 }, 32551 isActiveItem(state) { 32552 return !!state && state.activeId === id; 32553 }, 32554 ariaSetSize(state) { 32555 if (ariaSetSizeProp != null) return ariaSetSizeProp; 32556 if (!state) return; 32557 if (!(row == null ? void 0 : row.ariaSetSize)) return; 32558 if (row.baseElement !== state.baseElement) return; 32559 return row.ariaSetSize; 32560 }, 32561 ariaPosInSet(state) { 32562 if (ariaPosInSetProp != null) return ariaPosInSetProp; 32563 if (!state) return; 32564 if (!(row == null ? void 0 : row.ariaPosInSet)) return; 32565 if (row.baseElement !== state.baseElement) return; 32566 const itemsInRow = state.renderedItems.filter( 32567 (item) => item.rowId === rowId 32568 ); 32569 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 32570 }, 32571 isTabbable(state) { 32572 if (!(state == null ? void 0 : state.renderedItems.length)) return true; 32573 if (state.virtualFocus) return false; 32574 if (tabbable) return true; 32575 if (state.activeId === null) return false; 32576 const item = store == null ? void 0 : store.item(state.activeId); 32577 if (item == null ? void 0 : item.disabled) return true; 32578 if (!(item == null ? void 0 : item.element)) return true; 32579 return state.activeId === id; 32580 } 32581 }); 32582 const getItem = (0,external_React_.useCallback)( 32583 (item) => { 32584 var _a2; 32585 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { 32586 id: id || item.id, 32587 rowId, 32588 disabled: !!trulyDisabled, 32589 children: (_a2 = item.element) == null ? void 0 : _a2.textContent 32590 }); 32591 if (getItemProp) { 32592 return getItemProp(nextItem); 32593 } 32594 return nextItem; 32595 }, 32596 [id, rowId, trulyDisabled, getItemProp] 32597 ); 32598 const onFocusProp = props.onFocus; 32599 const hasFocusedComposite = (0,external_React_.useRef)(false); 32600 const onFocus = useEvent((event) => { 32601 onFocusProp == null ? void 0 : onFocusProp(event); 32602 if (event.defaultPrevented) return; 32603 if (isPortalEvent(event)) return; 32604 if (!id) return; 32605 if (!store) return; 32606 if (targetIsAnotherItem(event, store)) return; 32607 const { virtualFocus, baseElement: baseElement2 } = store.getState(); 32608 store.setActiveId(id); 32609 if (isTextbox(event.currentTarget)) { 32610 selectTextField(event.currentTarget); 32611 } 32612 if (!virtualFocus) return; 32613 if (!isSelfTarget(event)) return; 32614 if (isEditableElement(event.currentTarget)) return; 32615 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; 32616 if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) { 32617 event.currentTarget.scrollIntoView({ 32618 block: "nearest", 32619 inline: "nearest" 32620 }); 32621 } 32622 hasFocusedComposite.current = true; 32623 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); 32624 if (fromComposite) { 32625 focusSilently(baseElement2); 32626 } else { 32627 baseElement2.focus(); 32628 } 32629 }); 32630 const onBlurCaptureProp = props.onBlurCapture; 32631 const onBlurCapture = useEvent((event) => { 32632 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 32633 if (event.defaultPrevented) return; 32634 const state = store == null ? void 0 : store.getState(); 32635 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { 32636 hasFocusedComposite.current = false; 32637 event.preventDefault(); 32638 event.stopPropagation(); 32639 } 32640 }); 32641 const onKeyDownProp = props.onKeyDown; 32642 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 32643 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 32644 const onKeyDown = useEvent((event) => { 32645 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 32646 if (event.defaultPrevented) return; 32647 if (!isSelfTarget(event)) return; 32648 if (!store) return; 32649 const { currentTarget } = event; 32650 const state = store.getState(); 32651 const item = store.item(id); 32652 const isGrid = !!(item == null ? void 0 : item.rowId); 32653 const isVertical = state.orientation !== "horizontal"; 32654 const isHorizontal = state.orientation !== "vertical"; 32655 const canHomeEnd = () => { 32656 if (isGrid) return true; 32657 if (isHorizontal) return true; 32658 if (!state.baseElement) return true; 32659 if (!isTextField(state.baseElement)) return true; 32660 return false; 32661 }; 32662 const keyMap = { 32663 ArrowUp: (isGrid || isVertical) && store.up, 32664 ArrowRight: (isGrid || isHorizontal) && store.next, 32665 ArrowDown: (isGrid || isVertical) && store.down, 32666 ArrowLeft: (isGrid || isHorizontal) && store.previous, 32667 Home: () => { 32668 if (!canHomeEnd()) return; 32669 if (!isGrid || event.ctrlKey) { 32670 return store == null ? void 0 : store.first(); 32671 } 32672 return store == null ? void 0 : store.previous(-1); 32673 }, 32674 End: () => { 32675 if (!canHomeEnd()) return; 32676 if (!isGrid || event.ctrlKey) { 32677 return store == null ? void 0 : store.last(); 32678 } 32679 return store == null ? void 0 : store.next(-1); 32680 }, 32681 PageUp: () => { 32682 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); 32683 }, 32684 PageDown: () => { 32685 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); 32686 } 32687 }; 32688 const action = keyMap[event.key]; 32689 if (action) { 32690 if (isTextbox(currentTarget)) { 32691 const selection = getTextboxSelection(currentTarget); 32692 const isLeft = isHorizontal && event.key === "ArrowLeft"; 32693 const isRight = isHorizontal && event.key === "ArrowRight"; 32694 const isUp = isVertical && event.key === "ArrowUp"; 32695 const isDown = isVertical && event.key === "ArrowDown"; 32696 if (isRight || isDown) { 32697 const { length: valueLength } = getTextboxValue(currentTarget); 32698 if (selection.end !== valueLength) return; 32699 } else if ((isLeft || isUp) && selection.start !== 0) return; 32700 } 32701 const nextId = action(); 32702 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { 32703 if (!moveOnKeyPressProp(event)) return; 32704 event.preventDefault(); 32705 store.move(nextId); 32706 } 32707 } 32708 }); 32709 const providerValue = (0,external_React_.useMemo)( 32710 () => ({ id, baseElement }), 32711 [id, baseElement] 32712 ); 32713 props = useWrapElement( 32714 props, 32715 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), 32716 [providerValue] 32717 ); 32718 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32719 id, 32720 "data-active-item": isActiveItem || void 0 32721 }, props), { 32722 ref: useMergeRefs(ref, props.ref), 32723 tabIndex: isTabbable ? props.tabIndex : -1, 32724 onFocus, 32725 onBlurCapture, 32726 onKeyDown 32727 }); 32728 props = useCommand(props); 32729 props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32730 store 32731 }, props), { 32732 getItem, 32733 shouldRegisterItem: id ? props.shouldRegisterItem : false 32734 })); 32735 return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 32736 "aria-setsize": ariaSetSize, 32737 "aria-posinset": ariaPosInSet 32738 })); 32739 } 32740 ); 32741 var CompositeItem = memo2( 32742 forwardRef2(function CompositeItem2(props) { 32743 const htmlProps = useCompositeItem(props); 32744 return createElement(P2CTZE2T_TagName, htmlProps); 32745 }) 32746 ); 32747 32748 32749 32750 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ZTDSJLD6.js 32751 "use client"; 32752 32753 32754 32755 32756 32757 32758 32759 32760 // src/combobox/combobox-item.tsx 32761 32762 32763 32764 32765 32766 32767 var ZTDSJLD6_TagName = "div"; 32768 function isSelected(storeValue, itemValue) { 32769 if (itemValue == null) return; 32770 if (storeValue == null) return false; 32771 if (Array.isArray(storeValue)) { 32772 return storeValue.includes(itemValue); 32773 } 32774 return storeValue === itemValue; 32775 } 32776 function getItemRole(popupRole) { 32777 var _a; 32778 const itemRoleByPopupRole = { 32779 menu: "menuitem", 32780 listbox: "option", 32781 tree: "treeitem" 32782 }; 32783 const key = popupRole; 32784 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option"; 32785 } 32786 var useComboboxItem = createHook( 32787 function useComboboxItem2(_a) { 32788 var _b = _a, { 32789 store, 32790 value, 32791 hideOnClick, 32792 setValueOnClick, 32793 selectValueOnClick = true, 32794 resetValueOnSelect, 32795 focusOnHover = false, 32796 moveOnKeyPress = true, 32797 getItem: getItemProp 32798 } = _b, props = __objRest(_b, [ 32799 "store", 32800 "value", 32801 "hideOnClick", 32802 "setValueOnClick", 32803 "selectValueOnClick", 32804 "resetValueOnSelect", 32805 "focusOnHover", 32806 "moveOnKeyPress", 32807 "getItem" 32808 ]); 32809 var _a2; 32810 const context = useComboboxScopedContext(); 32811 store = store || context; 32812 invariant( 32813 store, 32814 false && 0 32815 ); 32816 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, { 32817 resetValueOnSelectState: "resetValueOnSelect", 32818 multiSelectable(state) { 32819 return Array.isArray(state.selectedValue); 32820 }, 32821 selected(state) { 32822 return isSelected(state.selectedValue, value); 32823 } 32824 }); 32825 const getItem = (0,external_React_.useCallback)( 32826 (item) => { 32827 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value }); 32828 if (getItemProp) { 32829 return getItemProp(nextItem); 32830 } 32831 return nextItem; 32832 }, 32833 [value, getItemProp] 32834 ); 32835 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; 32836 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; 32837 const onClickProp = props.onClick; 32838 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 32839 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 32840 const resetValueOnSelectProp = useBooleanEvent( 32841 (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable 32842 ); 32843 const hideOnClickProp = useBooleanEvent(hideOnClick); 32844 const onClick = useEvent((event) => { 32845 onClickProp == null ? void 0 : onClickProp(event); 32846 if (event.defaultPrevented) return; 32847 if (isDownloading(event)) return; 32848 if (isOpeningInNewTab(event)) return; 32849 if (value != null) { 32850 if (selectValueOnClickProp(event)) { 32851 if (resetValueOnSelectProp(event)) { 32852 store == null ? void 0 : store.resetValue(); 32853 } 32854 store == null ? void 0 : store.setSelectedValue((prevValue) => { 32855 if (!Array.isArray(prevValue)) return value; 32856 if (prevValue.includes(value)) { 32857 return prevValue.filter((v) => v !== value); 32858 } 32859 return [...prevValue, value]; 32860 }); 32861 } 32862 if (setValueOnClickProp(event)) { 32863 store == null ? void 0 : store.setValue(value); 32864 } 32865 } 32866 if (hideOnClickProp(event)) { 32867 store == null ? void 0 : store.hide(); 32868 } 32869 }); 32870 const onKeyDownProp = props.onKeyDown; 32871 const onKeyDown = useEvent((event) => { 32872 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 32873 if (event.defaultPrevented) return; 32874 const baseElement = store == null ? void 0 : store.getState().baseElement; 32875 if (!baseElement) return; 32876 if (hasFocus(baseElement)) return; 32877 const printable = event.key.length === 1; 32878 if (printable || event.key === "Backspace" || event.key === "Delete") { 32879 queueMicrotask(() => baseElement.focus()); 32880 if (isTextField(baseElement)) { 32881 store == null ? void 0 : store.setValue(baseElement.value); 32882 } 32883 } 32884 }); 32885 if (multiSelectable && selected != null) { 32886 props = _3YLGPPWQ_spreadValues({ 32887 "aria-selected": selected 32888 }, props); 32889 } 32890 props = useWrapElement( 32891 props, 32892 (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 }) }), 32893 [value, selected] 32894 ); 32895 const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext); 32896 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32897 role: getItemRole(popupRole), 32898 children: value 32899 }, props), { 32900 onClick, 32901 onKeyDown 32902 }); 32903 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 32904 props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32905 store 32906 }, props), { 32907 getItem, 32908 // Dispatch a custom event on the combobox input when moving to an item 32909 // with the keyboard so the Combobox component can enable inline 32910 // autocompletion. 32911 moveOnKeyPress: (event) => { 32912 if (!moveOnKeyPressProp(event)) return false; 32913 const moveEvent = new Event("combobox-item-move"); 32914 const baseElement = store == null ? void 0 : store.getState().baseElement; 32915 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); 32916 return true; 32917 } 32918 })); 32919 props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props)); 32920 return props; 32921 } 32922 ); 32923 var ComboboxItem = memo2( 32924 forwardRef2(function ComboboxItem2(props) { 32925 const htmlProps = useComboboxItem(props); 32926 return createElement(ZTDSJLD6_TagName, htmlProps); 32927 }) 32928 ); 32929 32930 32931 32932 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js 32933 "use client"; 32934 32935 32936 32937 32938 32939 32940 32941 32942 32943 32944 32945 32946 // src/combobox/combobox-item-value.tsx 32947 32948 32949 32950 32951 var combobox_item_value_TagName = "span"; 32952 function normalizeValue(value) { 32953 return PBFD2E7P_normalizeString(value).toLowerCase(); 32954 } 32955 function getOffsets(string, values) { 32956 const offsets = []; 32957 for (const value of values) { 32958 let pos = 0; 32959 const length = value.length; 32960 while (string.indexOf(value, pos) !== -1) { 32961 const index = string.indexOf(value, pos); 32962 if (index !== -1) { 32963 offsets.push([index, length]); 32964 } 32965 pos = index + 1; 32966 } 32967 } 32968 return offsets; 32969 } 32970 function filterOverlappingOffsets(offsets) { 32971 return offsets.filter(([offset, length], i, arr) => { 32972 return !arr.some( 32973 ([o, l], j) => j !== i && o <= offset && o + l >= offset + length 32974 ); 32975 }); 32976 } 32977 function sortOffsets(offsets) { 32978 return offsets.sort(([a], [b]) => a - b); 32979 } 32980 function splitValue(itemValue, userValue) { 32981 if (!itemValue) return itemValue; 32982 if (!userValue) return itemValue; 32983 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue); 32984 const parts = []; 32985 const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32986 "span", 32987 { 32988 "data-autocomplete-value": autocomplete ? "" : void 0, 32989 "data-user-value": autocomplete ? void 0 : "", 32990 children: value 32991 }, 32992 parts.length 32993 ); 32994 const offsets = sortOffsets( 32995 filterOverlappingOffsets( 32996 // Convert userValues into a set to avoid duplicates 32997 getOffsets(normalizeValue(itemValue), new Set(userValues)) 32998 ) 32999 ); 33000 if (!offsets.length) { 33001 parts.push(span(itemValue, true)); 33002 return parts; 33003 } 33004 const [firstOffset] = offsets[0]; 33005 const values = [ 33006 itemValue.slice(0, firstOffset), 33007 ...offsets.flatMap(([offset, length], i) => { 33008 var _a; 33009 const value = itemValue.slice(offset, offset + length); 33010 const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0]; 33011 const nextValue = itemValue.slice(offset + length, nextOffset); 33012 return [value, nextValue]; 33013 }) 33014 ]; 33015 values.forEach((value, i) => { 33016 if (!value) return; 33017 parts.push(span(value, i % 2 === 0)); 33018 }); 33019 return parts; 33020 } 33021 var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) { 33022 var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]); 33023 const context = useComboboxScopedContext(); 33024 store = store || context; 33025 const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext); 33026 const itemValue = value != null ? value : itemContext; 33027 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); 33028 const children = (0,external_React_.useMemo)(() => { 33029 if (!itemValue) return; 33030 if (!inputValue) return itemValue; 33031 return splitValue(itemValue, inputValue); 33032 }, [itemValue, inputValue]); 33033 props = _3YLGPPWQ_spreadValues({ 33034 children 33035 }, props); 33036 return removeUndefinedValues(props); 33037 }); 33038 var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) { 33039 const htmlProps = useComboboxItemValue(props); 33040 return createElement(combobox_item_value_TagName, htmlProps); 33041 }); 33042 33043 33044 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js 33045 /* wp:polyfill */ 33046 /** 33047 * External dependencies 33048 */ 33049 // eslint-disable-next-line no-restricted-imports 33050 33051 33052 33053 /** 33054 * WordPress dependencies 33055 */ 33056 33057 33058 33059 33060 33061 33062 33063 /** 33064 * Internal dependencies 33065 */ 33066 33067 const radioCheck = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33068 xmlns: "http://www.w3.org/2000/svg", 33069 viewBox: "0 0 24 24", 33070 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, { 33071 cx: 12, 33072 cy: 12, 33073 r: 3 33074 }) 33075 }); 33076 function search_widget_normalizeSearchInput(input = '') { 33077 return remove_accents_default()(input.trim().toLowerCase()); 33078 } 33079 const search_widget_EMPTY_ARRAY = []; 33080 const getCurrentValue = (filterDefinition, currentFilter) => { 33081 if (filterDefinition.singleSelection) { 33082 return currentFilter?.value; 33083 } 33084 if (Array.isArray(currentFilter?.value)) { 33085 return currentFilter.value; 33086 } 33087 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 33088 return [currentFilter.value]; 33089 } 33090 return search_widget_EMPTY_ARRAY; 33091 }; 33092 const getNewValue = (filterDefinition, currentFilter, value) => { 33093 if (filterDefinition.singleSelection) { 33094 return value; 33095 } 33096 if (Array.isArray(currentFilter?.value)) { 33097 return currentFilter.value.includes(value) ? currentFilter.value.filter(v => v !== value) : [...currentFilter.value, value]; 33098 } 33099 return [value]; 33100 }; 33101 function generateFilterElementCompositeItemId(prefix, filterElementValue) { 33102 return `$prefix}-$filterElementValue}`; 33103 } 33104 function ListBox({ 33105 view, 33106 filter, 33107 onChangeView 33108 }) { 33109 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, 'dataviews-filter-list-box'); 33110 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)( 33111 // When there are one or less operators, the first item is set as active 33112 // (by setting the initial `activeId` to `undefined`). 33113 // With 2 or more operators, the focus is moved on the operators control 33114 // (by setting the initial `activeId` to `null`), meaning that there won't 33115 // be an active item initially. Focus is then managed via the 33116 // `onFocusVisible` callback. 33117 filter.operators?.length === 1 ? undefined : null); 33118 const currentFilter = view.filters?.find(f => f.field === filter.field); 33119 const currentValue = getCurrentValue(filter, currentFilter); 33120 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 33121 virtualFocus: true, 33122 focusLoop: true, 33123 activeId: activeCompositeId, 33124 setActiveId: setActiveCompositeId, 33125 role: "listbox", 33126 className: "dataviews-filters__search-widget-listbox", 33127 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 33128 (0,external_wp_i18n_namespaceObject.__)('List of: %1$s'), filter.name), 33129 onFocusVisible: () => { 33130 // `onFocusVisible` needs the `Composite` component to be focusable, 33131 // which is implicitly achieved via the `virtualFocus` prop. 33132 if (!activeCompositeId && filter.elements.length) { 33133 setActiveCompositeId(generateFilterElementCompositeItemId(baseId, filter.elements[0].value)); 33134 } 33135 }, 33136 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}), 33137 children: filter.elements.map(element => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Hover, { 33138 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 33139 id: generateFilterElementCompositeItemId(baseId, element.value), 33140 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33141 "aria-label": element.label, 33142 role: "option", 33143 className: "dataviews-filters__search-widget-listitem" 33144 }), 33145 onClick: () => { 33146 var _view$filters, _view$filters2; 33147 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 33148 if (_filter.field === filter.field) { 33149 return { 33150 ..._filter, 33151 operator: currentFilter.operator || filter.operators[0], 33152 value: getNewValue(filter, currentFilter, element.value) 33153 }; 33154 } 33155 return _filter; 33156 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 33157 field: filter.field, 33158 operator: filter.operators[0], 33159 value: getNewValue(filter, currentFilter, element.value) 33160 }]; 33161 onChangeView({ 33162 ...view, 33163 page: 1, 33164 filters: newFilters 33165 }); 33166 } 33167 }), 33168 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 33169 className: "dataviews-filters__search-widget-listitem-check", 33170 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33171 icon: radioCheck 33172 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33173 icon: library_check 33174 })] 33175 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33176 children: element.label 33177 })] 33178 }, element.value)) 33179 }); 33180 } 33181 function search_widget_ComboboxList({ 33182 view, 33183 filter, 33184 onChangeView 33185 }) { 33186 const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(''); 33187 const deferredSearchValue = (0,external_wp_element_namespaceObject.useDeferredValue)(searchValue); 33188 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 33189 const currentValue = getCurrentValue(filter, currentFilter); 33190 const matches = (0,external_wp_element_namespaceObject.useMemo)(() => { 33191 const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue); 33192 return filter.elements.filter(item => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch)); 33193 }, [filter.elements, deferredSearchValue]); 33194 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxProvider, { 33195 selectedValue: currentValue, 33196 setSelectedValue: value => { 33197 var _view$filters3, _view$filters4; 33198 const newFilters = currentFilter ? [...((_view$filters3 = view.filters) !== null && _view$filters3 !== void 0 ? _view$filters3 : []).map(_filter => { 33199 if (_filter.field === filter.field) { 33200 return { 33201 ..._filter, 33202 operator: currentFilter.operator || filter.operators[0], 33203 value 33204 }; 33205 } 33206 return _filter; 33207 })] : [...((_view$filters4 = view.filters) !== null && _view$filters4 !== void 0 ? _view$filters4 : []), { 33208 field: filter.field, 33209 operator: filter.operators[0], 33210 value 33211 }]; 33212 onChangeView({ 33213 ...view, 33214 page: 1, 33215 filters: newFilters 33216 }); 33217 }, 33218 setValue: setSearchValue, 33219 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33220 className: "dataviews-filters__search-widget-filter-combobox__wrapper", 33221 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxLabel, { 33222 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 33223 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 33224 }), 33225 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 33226 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Combobox, { 33227 autoSelect: "always", 33228 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'), 33229 className: "dataviews-filters__search-widget-filter-combobox__input" 33230 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33231 className: "dataviews-filters__search-widget-filter-combobox__icon", 33232 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33233 icon: library_search 33234 }) 33235 })] 33236 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxList, { 33237 className: "dataviews-filters__search-widget-filter-combobox-list", 33238 alwaysVisible: true, 33239 children: [matches.map(element => { 33240 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxItem, { 33241 resetValueOnSelect: false, 33242 value: element.value, 33243 className: "dataviews-filters__search-widget-listitem", 33244 hideOnClick: false, 33245 setValueOnClick: false, 33246 focusOnHover: true, 33247 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 33248 className: "dataviews-filters__search-widget-listitem-check", 33249 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33250 icon: radioCheck 33251 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33252 icon: library_check 33253 })] 33254 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 33255 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValue, { 33256 className: "dataviews-filters__search-widget-filter-combobox-item-value", 33257 value: element.label 33258 }), !!element.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33259 className: "dataviews-filters__search-widget-listitem-description", 33260 children: element.description 33261 })] 33262 })] 33263 }, element.value); 33264 }), !matches.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 33265 children: (0,external_wp_i18n_namespaceObject.__)('No results found') 33266 })] 33267 })] 33268 }); 33269 } 33270 function SearchWidget(props) { 33271 const Widget = props.filter.elements.length > 10 ? search_widget_ComboboxList : ListBox; 33272 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { 33273 ...props 33274 }); 33275 } 33276 33277 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter-summary.js 33278 /* wp:polyfill */ 33279 /** 33280 * External dependencies 33281 */ 33282 33283 /** 33284 * WordPress dependencies 33285 */ 33286 33287 33288 33289 33290 const ENTER = 'Enter'; 33291 const SPACE = ' '; 33292 33293 /** 33294 * Internal dependencies 33295 */ 33296 33297 33298 33299 const FilterText = ({ 33300 activeElements, 33301 filterInView, 33302 filter 33303 }) => { 33304 if (activeElements === undefined || activeElements.length === 0) { 33305 return filter.name; 33306 } 33307 const filterTextWrappers = { 33308 Name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33309 className: "dataviews-filters__summary-filter-text-name" 33310 }), 33311 Value: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33312 className: "dataviews-filters__summary-filter-text-value" 33313 }) 33314 }; 33315 if (filterInView?.operator === constants_OPERATOR_IS_ANY) { 33316 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is any: Admin, Editor". */ 33317 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is any: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33318 } 33319 if (filterInView?.operator === constants_OPERATOR_IS_NONE) { 33320 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is none: Admin, Editor". */ 33321 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is none: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33322 } 33323 if (filterInView?.operator === OPERATOR_IS_ALL) { 33324 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is all: Admin, Editor". */ 33325 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33326 } 33327 if (filterInView?.operator === OPERATOR_IS_NOT_ALL) { 33328 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not all: Admin, Editor". */ 33329 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33330 } 33331 if (filterInView?.operator === constants_OPERATOR_IS) { 33332 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is: Admin". */ 33333 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 33334 } 33335 if (filterInView?.operator === constants_OPERATOR_IS_NOT) { 33336 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not: Admin". */ 33337 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 33338 } 33339 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name e.g.: "Unknown status for Author". */ 33340 (0,external_wp_i18n_namespaceObject.__)('Unknown status for %1$s'), filter.name); 33341 }; 33342 function OperatorSelector({ 33343 filter, 33344 view, 33345 onChangeView 33346 }) { 33347 const operatorOptions = filter.operators?.map(operator => ({ 33348 value: operator, 33349 label: OPERATORS[operator]?.label 33350 })); 33351 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 33352 const value = currentFilter?.operator || filter.operators[0]; 33353 return operatorOptions.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33354 spacing: 2, 33355 justify: "flex-start", 33356 className: "dataviews-filters__summary-operators-container", 33357 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 33358 className: "dataviews-filters__summary-operators-filter-name", 33359 children: filter.name 33360 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 33361 label: (0,external_wp_i18n_namespaceObject.__)('Conditions'), 33362 value: value, 33363 options: operatorOptions, 33364 onChange: newValue => { 33365 var _view$filters, _view$filters2; 33366 const operator = newValue; 33367 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 33368 if (_filter.field === filter.field) { 33369 return { 33370 ..._filter, 33371 operator 33372 }; 33373 } 33374 return _filter; 33375 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 33376 field: filter.field, 33377 operator, 33378 value: undefined 33379 }]; 33380 onChangeView({ 33381 ...view, 33382 page: 1, 33383 filters: newFilters 33384 }); 33385 }, 33386 size: "small", 33387 __nextHasNoMarginBottom: true, 33388 hideLabelFromVision: true 33389 })] 33390 }); 33391 } 33392 function FilterSummary({ 33393 addFilterRef, 33394 openedFilter, 33395 ...commonProps 33396 }) { 33397 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(null); 33398 const { 33399 filter, 33400 view, 33401 onChangeView 33402 } = commonProps; 33403 const filterInView = view.filters?.find(f => f.field === filter.field); 33404 const activeElements = filter.elements.filter(element => { 33405 if (filter.singleSelection) { 33406 return element.value === filterInView?.value; 33407 } 33408 return filterInView?.value?.includes(element.value); 33409 }); 33410 const isPrimary = filter.isPrimary; 33411 const hasValues = filterInView?.value !== undefined; 33412 const canResetOrRemove = !isPrimary || hasValues; 33413 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 33414 defaultOpen: openedFilter === filter.field, 33415 contentClassName: "dataviews-filters__summary-popover", 33416 popoverProps: { 33417 placement: 'bottom-start', 33418 role: 'dialog' 33419 }, 33420 onClose: () => { 33421 toggleRef.current?.focus(); 33422 }, 33423 renderToggle: ({ 33424 isOpen, 33425 onToggle 33426 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33427 className: "dataviews-filters__summary-chip-container", 33428 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 33429 text: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. */ 33430 (0,external_wp_i18n_namespaceObject.__)('Filter by: %1$s'), filter.name.toLowerCase()), 33431 placement: "top", 33432 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33433 className: dist_clsx('dataviews-filters__summary-chip', { 33434 'has-reset': canResetOrRemove, 33435 'has-values': hasValues 33436 }), 33437 role: "button", 33438 tabIndex: 0, 33439 onClick: onToggle, 33440 onKeyDown: event => { 33441 if ([ENTER, SPACE].includes(event.key)) { 33442 onToggle(); 33443 event.preventDefault(); 33444 } 33445 }, 33446 "aria-pressed": isOpen, 33447 "aria-expanded": isOpen, 33448 ref: toggleRef, 33449 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterText, { 33450 activeElements: activeElements, 33451 filterInView: filterInView, 33452 filter: filter 33453 }) 33454 }) 33455 }), canResetOrRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 33456 text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove'), 33457 placement: "top", 33458 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 33459 className: dist_clsx('dataviews-filters__summary-chip-remove', { 33460 'has-values': hasValues 33461 }), 33462 onClick: () => { 33463 onChangeView({ 33464 ...view, 33465 page: 1, 33466 filters: view.filters?.filter(_filter => _filter.field !== filter.field) 33467 }); 33468 // If the filter is not primary and can be removed, it will be added 33469 // back to the available filters from `Add filter` component. 33470 if (!isPrimary) { 33471 addFilterRef.current?.focus(); 33472 } else { 33473 // If is primary, focus the toggle button. 33474 toggleRef.current?.focus(); 33475 } 33476 }, 33477 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33478 icon: close_small 33479 }) 33480 }) 33481 })] 33482 }), 33483 renderContent: () => { 33484 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33485 spacing: 0, 33486 justify: "flex-start", 33487 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { 33488 ...commonProps 33489 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchWidget, { 33490 ...commonProps 33491 })] 33492 }); 33493 } 33494 }); 33495 } 33496 33497 ;// ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js 33498 /** 33499 * WordPress dependencies 33500 */ 33501 33502 const { 33503 lock: lock_unlock_lock, 33504 unlock: lock_unlock_unlock 33505 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/dataviews'); 33506 33507 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js 33508 /* wp:polyfill */ 33509 /** 33510 * External dependencies 33511 */ 33512 33513 /** 33514 * WordPress dependencies 33515 */ 33516 33517 33518 33519 33520 /** 33521 * Internal dependencies 33522 */ 33523 33524 33525 const { 33526 Menu: add_filter_Menu 33527 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 33528 function AddFilterMenu({ 33529 filters, 33530 view, 33531 onChangeView, 33532 setOpenedFilter, 33533 triggerProps 33534 }) { 33535 const inactiveFilters = filters.filter(filter => !filter.isVisible); 33536 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_filter_Menu, { 33537 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.TriggerButton, { 33538 ...triggerProps 33539 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Popover, { 33540 children: inactiveFilters.map(filter => { 33541 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Item, { 33542 onClick: () => { 33543 setOpenedFilter(filter.field); 33544 onChangeView({ 33545 ...view, 33546 page: 1, 33547 filters: [...(view.filters || []), { 33548 field: filter.field, 33549 value: undefined, 33550 operator: filter.operators[0] 33551 }] 33552 }); 33553 }, 33554 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.ItemLabel, { 33555 children: filter.name 33556 }) 33557 }, filter.field); 33558 }) 33559 })] 33560 }); 33561 } 33562 function AddFilter({ 33563 filters, 33564 view, 33565 onChangeView, 33566 setOpenedFilter 33567 }, ref) { 33568 if (!filters.length || filters.every(({ 33569 isPrimary 33570 }) => isPrimary)) { 33571 return null; 33572 } 33573 const inactiveFilters = filters.filter(filter => !filter.isVisible); 33574 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterMenu, { 33575 triggerProps: { 33576 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33577 accessibleWhenDisabled: true, 33578 size: "compact", 33579 className: "dataviews-filters-button", 33580 variant: "tertiary", 33581 disabled: !inactiveFilters.length, 33582 ref: ref 33583 }), 33584 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 33585 }, 33586 filters, 33587 view, 33588 onChangeView, 33589 setOpenedFilter 33590 }); 33591 } 33592 /* harmony default export */ const add_filter = ((0,external_wp_element_namespaceObject.forwardRef)(AddFilter)); 33593 33594 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js 33595 /* wp:polyfill */ 33596 /** 33597 * WordPress dependencies 33598 */ 33599 33600 33601 33602 /** 33603 * Internal dependencies 33604 */ 33605 33606 function ResetFilter({ 33607 filters, 33608 view, 33609 onChangeView 33610 }) { 33611 const isPrimary = field => filters.some(_filter => _filter.field === field && _filter.isPrimary); 33612 const isDisabled = !view.search && !view.filters?.some(_filter => _filter.value !== undefined || !isPrimary(_filter.field)); 33613 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33614 disabled: isDisabled, 33615 accessibleWhenDisabled: true, 33616 size: "compact", 33617 variant: "tertiary", 33618 className: "dataviews-filters__reset-button", 33619 onClick: () => { 33620 onChangeView({ 33621 ...view, 33622 page: 1, 33623 search: '', 33624 filters: [] 33625 }); 33626 }, 33627 children: (0,external_wp_i18n_namespaceObject.__)('Reset') 33628 }); 33629 } 33630 33631 ;// ./node_modules/@wordpress/dataviews/build-module/utils.js 33632 /* wp:polyfill */ 33633 /** 33634 * Internal dependencies 33635 */ 33636 33637 function sanitizeOperators(field) { 33638 let operators = field.filterBy?.operators; 33639 33640 // Assign default values. 33641 if (!operators || !Array.isArray(operators)) { 33642 operators = [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE]; 33643 } 33644 33645 // Make sure only valid operators are used. 33646 operators = operators.filter(operator => ALL_OPERATORS.includes(operator)); 33647 33648 // Do not allow mixing single & multiselection operators. 33649 // Remove multiselection operators if any of the single selection ones is present. 33650 if (operators.includes(constants_OPERATOR_IS) || operators.includes(constants_OPERATOR_IS_NOT)) { 33651 operators = operators.filter(operator => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(operator)); 33652 } 33653 return operators; 33654 } 33655 33656 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/index.js 33657 /* wp:polyfill */ 33658 /** 33659 * WordPress dependencies 33660 */ 33661 33662 33663 33664 33665 33666 /** 33667 * Internal dependencies 33668 */ 33669 33670 33671 33672 33673 33674 33675 33676 function useFilters(fields, view) { 33677 return (0,external_wp_element_namespaceObject.useMemo)(() => { 33678 const filters = []; 33679 fields.forEach(field => { 33680 if (!field.elements?.length) { 33681 return; 33682 } 33683 const operators = sanitizeOperators(field); 33684 if (operators.length === 0) { 33685 return; 33686 } 33687 const isPrimary = !!field.filterBy?.isPrimary; 33688 filters.push({ 33689 field: field.id, 33690 name: field.label, 33691 elements: field.elements, 33692 singleSelection: operators.some(op => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(op)), 33693 operators, 33694 isVisible: isPrimary || !!view.filters?.some(f => f.field === field.id && ALL_OPERATORS.includes(f.operator)), 33695 isPrimary 33696 }); 33697 }); 33698 // Sort filters by primary property. We need the primary filters to be first. 33699 // Then we sort by name. 33700 filters.sort((a, b) => { 33701 if (a.isPrimary && !b.isPrimary) { 33702 return -1; 33703 } 33704 if (!a.isPrimary && b.isPrimary) { 33705 return 1; 33706 } 33707 return a.name.localeCompare(b.name); 33708 }); 33709 return filters; 33710 }, [fields, view]); 33711 } 33712 function FiltersToggle({ 33713 filters, 33714 view, 33715 onChangeView, 33716 setOpenedFilter, 33717 isShowingFilter, 33718 setIsShowingFilter 33719 }) { 33720 const buttonRef = (0,external_wp_element_namespaceObject.useRef)(null); 33721 const onChangeViewWithFilterVisibility = (0,external_wp_element_namespaceObject.useCallback)(_view => { 33722 onChangeView(_view); 33723 setIsShowingFilter(true); 33724 }, [onChangeView, setIsShowingFilter]); 33725 const visibleFilters = filters.filter(filter => filter.isVisible); 33726 const hasVisibleFilters = !!visibleFilters.length; 33727 if (filters.length === 0) { 33728 return null; 33729 } 33730 const addFilterButtonProps = { 33731 label: (0,external_wp_i18n_namespaceObject.__)('Add filter'), 33732 'aria-expanded': false, 33733 isPressed: false 33734 }; 33735 const toggleFiltersButtonProps = { 33736 label: (0,external_wp_i18n_namespaceObject._x)('Filter', 'verb'), 33737 'aria-expanded': isShowingFilter, 33738 isPressed: isShowingFilter, 33739 onClick: () => { 33740 if (!isShowingFilter) { 33741 setOpenedFilter(null); 33742 } 33743 setIsShowingFilter(!isShowingFilter); 33744 } 33745 }; 33746 const buttonComponent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33747 ref: buttonRef, 33748 className: "dataviews-filters__visibility-toggle", 33749 size: "compact", 33750 icon: library_funnel, 33751 ...(hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps) 33752 }); 33753 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33754 className: "dataviews-filters__container-visibility-toggle", 33755 children: !hasVisibleFilters ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterMenu, { 33756 filters: filters, 33757 view: view, 33758 onChangeView: onChangeViewWithFilterVisibility, 33759 setOpenedFilter: setOpenedFilter, 33760 triggerProps: { 33761 render: buttonComponent 33762 } 33763 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterVisibilityToggle, { 33764 buttonRef: buttonRef, 33765 filtersCount: view.filters?.length, 33766 children: buttonComponent 33767 }) 33768 }); 33769 } 33770 function FilterVisibilityToggle({ 33771 buttonRef, 33772 filtersCount, 33773 children 33774 }) { 33775 // Focus the `add filter` button when unmounts. 33776 (0,external_wp_element_namespaceObject.useEffect)(() => () => { 33777 buttonRef.current?.focus(); 33778 }, [buttonRef]); 33779 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33780 children: [children, !!filtersCount && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33781 className: "dataviews-filters-toggle__count", 33782 children: filtersCount 33783 })] 33784 }); 33785 } 33786 function Filters() { 33787 const { 33788 fields, 33789 view, 33790 onChangeView, 33791 openedFilter, 33792 setOpenedFilter 33793 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 33794 const addFilterRef = (0,external_wp_element_namespaceObject.useRef)(null); 33795 const filters = useFilters(fields, view); 33796 const addFilter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter, { 33797 filters: filters, 33798 view: view, 33799 onChangeView: onChangeView, 33800 ref: addFilterRef, 33801 setOpenedFilter: setOpenedFilter 33802 }, "add-filter"); 33803 const visibleFilters = filters.filter(filter => filter.isVisible); 33804 if (visibleFilters.length === 0) { 33805 return null; 33806 } 33807 const filterComponents = [...visibleFilters.map(filter => { 33808 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterSummary, { 33809 filter: filter, 33810 view: view, 33811 onChangeView: onChangeView, 33812 addFilterRef: addFilterRef, 33813 openedFilter: openedFilter 33814 }, filter.field); 33815 }), addFilter]; 33816 filterComponents.push(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetFilter, { 33817 filters: filters, 33818 view: view, 33819 onChangeView: onChangeView 33820 }, "reset-filters")); 33821 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 33822 justify: "flex-start", 33823 style: { 33824 width: 'fit-content' 33825 }, 33826 className: "dataviews-filters__container", 33827 wrap: true, 33828 children: filterComponents 33829 }); 33830 } 33831 /* harmony default export */ const dataviews_filters = ((0,external_wp_element_namespaceObject.memo)(Filters)); 33832 33833 ;// ./node_modules/@wordpress/icons/build-module/library/block-table.js 33834 /** 33835 * WordPress dependencies 33836 */ 33837 33838 33839 const blockTable = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33840 viewBox: "0 0 24 24", 33841 xmlns: "http://www.w3.org/2000/svg", 33842 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33843 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" 33844 }) 33845 }); 33846 /* harmony default export */ const block_table = (blockTable); 33847 33848 ;// ./node_modules/@wordpress/icons/build-module/library/category.js 33849 /** 33850 * WordPress dependencies 33851 */ 33852 33853 33854 const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33855 viewBox: "0 0 24 24", 33856 xmlns: "http://www.w3.org/2000/svg", 33857 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33858 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", 33859 fillRule: "evenodd", 33860 clipRule: "evenodd" 33861 }) 33862 }); 33863 /* harmony default export */ const library_category = (category); 33864 33865 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js 33866 /** 33867 * WordPress dependencies 33868 */ 33869 33870 33871 const formatListBulletsRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33872 xmlns: "http://www.w3.org/2000/svg", 33873 viewBox: "0 0 24 24", 33874 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33875 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" 33876 }) 33877 }); 33878 /* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL); 33879 33880 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 33881 /** 33882 * WordPress dependencies 33883 */ 33884 33885 33886 const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33887 xmlns: "http://www.w3.org/2000/svg", 33888 viewBox: "0 0 24 24", 33889 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33890 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" 33891 }) 33892 }); 33893 /* harmony default export */ const format_list_bullets = (formatListBullets); 33894 33895 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js 33896 /* wp:polyfill */ 33897 /** 33898 * WordPress dependencies 33899 */ 33900 33901 33902 33903 /** 33904 * Internal dependencies 33905 */ 33906 33907 function DataViewsSelectionCheckbox({ 33908 selection, 33909 onChangeSelection, 33910 item, 33911 getItemId, 33912 titleField, 33913 disabled 33914 }) { 33915 const id = getItemId(item); 33916 const checked = !disabled && selection.includes(id); 33917 33918 // Fallback label to ensure accessibility 33919 const selectionLabel = titleField?.getValue?.({ 33920 item 33921 }) || (0,external_wp_i18n_namespaceObject.__)('(no title)'); 33922 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 33923 className: "dataviews-selection-checkbox", 33924 __nextHasNoMarginBottom: true, 33925 "aria-label": selectionLabel, 33926 "aria-disabled": disabled, 33927 checked: checked, 33928 onChange: () => { 33929 if (disabled) { 33930 return; 33931 } 33932 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 33933 } 33934 }); 33935 } 33936 33937 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js 33938 /* wp:polyfill */ 33939 /** 33940 * External dependencies 33941 */ 33942 33943 /** 33944 * WordPress dependencies 33945 */ 33946 33947 33948 33949 33950 33951 33952 /** 33953 * Internal dependencies 33954 */ 33955 33956 33957 const { 33958 Menu: dataviews_item_actions_Menu, 33959 kebabCase: dataviews_item_actions_kebabCase 33960 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 33961 function ButtonTrigger({ 33962 action, 33963 onClick, 33964 items 33965 }) { 33966 const label = typeof action.label === 'string' ? action.label : action.label(items); 33967 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33968 label: label, 33969 icon: action.icon, 33970 disabled: !!action.disabled, 33971 accessibleWhenDisabled: true, 33972 isDestructive: action.isDestructive, 33973 size: "compact", 33974 onClick: onClick 33975 }); 33976 } 33977 function MenuItemTrigger({ 33978 action, 33979 onClick, 33980 items 33981 }) { 33982 const label = typeof action.label === 'string' ? action.label : action.label(items); 33983 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Item, { 33984 disabled: action.disabled, 33985 onClick: onClick, 33986 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.ItemLabel, { 33987 children: label 33988 }) 33989 }); 33990 } 33991 function ActionModal({ 33992 action, 33993 items, 33994 closeModal 33995 }) { 33996 const label = typeof action.label === 'string' ? action.label : action.label(items); 33997 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 33998 title: action.modalHeader || label, 33999 __experimentalHideHeader: !!action.hideModalHeader, 34000 onRequestClose: closeModal, 34001 focusOnMount: "firstContentElement", 34002 size: "medium", 34003 overlayClassName: `dataviews-action-modal dataviews-action-modal__$dataviews_item_actions_kebabCase(action.id)}`, 34004 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { 34005 items: items, 34006 closeModal: closeModal 34007 }) 34008 }); 34009 } 34010 function ActionsMenuGroup({ 34011 actions, 34012 item, 34013 registry, 34014 setActiveModalAction 34015 }) { 34016 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Group, { 34017 children: actions.map(action => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuItemTrigger, { 34018 action: action, 34019 onClick: () => { 34020 if ('RenderModal' in action) { 34021 setActiveModalAction(action); 34022 return; 34023 } 34024 action.callback([item], { 34025 registry 34026 }); 34027 }, 34028 items: [item] 34029 }, action.id)) 34030 }); 34031 } 34032 function ItemActions({ 34033 item, 34034 actions, 34035 isCompact 34036 }) { 34037 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 34038 const { 34039 primaryActions, 34040 eligibleActions 34041 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 34042 // If an action is eligible for all items, doesn't need 34043 // to provide the `isEligible` function. 34044 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 34045 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 34046 return { 34047 primaryActions: _primaryActions, 34048 eligibleActions: _eligibleActions 34049 }; 34050 }, [actions, item]); 34051 if (isCompact) { 34052 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 34053 item: item, 34054 actions: eligibleActions, 34055 isSmall: true, 34056 registry: registry 34057 }); 34058 } 34059 34060 // If all actions are primary, there is no need to render the dropdown. 34061 if (primaryActions.length === eligibleActions.length) { 34062 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActions, { 34063 item: item, 34064 actions: primaryActions, 34065 registry: registry 34066 }); 34067 } 34068 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34069 spacing: 1, 34070 justify: "flex-end", 34071 className: "dataviews-item-actions", 34072 style: { 34073 flexShrink: '0', 34074 width: 'auto' 34075 }, 34076 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActions, { 34077 item: item, 34078 actions: primaryActions, 34079 registry: registry 34080 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 34081 item: item, 34082 actions: eligibleActions, 34083 registry: registry 34084 })] 34085 }); 34086 } 34087 function CompactItemActions({ 34088 item, 34089 actions, 34090 isSmall, 34091 registry 34092 }) { 34093 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 34094 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34095 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_item_actions_Menu, { 34096 placement: "bottom-end", 34097 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.TriggerButton, { 34098 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34099 size: isSmall ? 'small' : 'compact', 34100 icon: more_vertical, 34101 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 34102 accessibleWhenDisabled: true, 34103 disabled: !actions.length, 34104 className: "dataviews-all-actions-button" 34105 }) 34106 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Popover, { 34107 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsMenuGroup, { 34108 actions: actions, 34109 item: item, 34110 registry: registry, 34111 setActiveModalAction: setActiveModalAction 34112 }) 34113 })] 34114 }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 34115 action: activeModalAction, 34116 items: [item], 34117 closeModal: () => setActiveModalAction(null) 34118 })] 34119 }); 34120 } 34121 function PrimaryActions({ 34122 item, 34123 actions, 34124 registry 34125 }) { 34126 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 34127 if (!Array.isArray(actions) || actions.length === 0) { 34128 return null; 34129 } 34130 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34131 children: [actions.map(action => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ButtonTrigger, { 34132 action: action, 34133 onClick: () => { 34134 if ('RenderModal' in action) { 34135 setActiveModalAction(action); 34136 return; 34137 } 34138 action.callback([item], { 34139 registry 34140 }); 34141 }, 34142 items: [item] 34143 }, action.id)), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 34144 action: activeModalAction, 34145 items: [item], 34146 closeModal: () => setActiveModalAction(null) 34147 })] 34148 }); 34149 } 34150 34151 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js 34152 /* wp:polyfill */ 34153 /** 34154 * External dependencies 34155 */ 34156 34157 /** 34158 * WordPress dependencies 34159 */ 34160 34161 34162 34163 34164 34165 34166 /** 34167 * Internal dependencies 34168 */ 34169 34170 34171 34172 function ActionWithModal({ 34173 action, 34174 items, 34175 ActionTriggerComponent 34176 }) { 34177 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 34178 const actionTriggerProps = { 34179 action, 34180 onClick: () => { 34181 setIsModalOpen(true); 34182 }, 34183 items 34184 }; 34185 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34186 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTriggerComponent, { 34187 ...actionTriggerProps 34188 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 34189 action: action, 34190 items: items, 34191 closeModal: () => setIsModalOpen(false) 34192 })] 34193 }); 34194 } 34195 function useHasAPossibleBulkAction(actions, item) { 34196 return (0,external_wp_element_namespaceObject.useMemo)(() => { 34197 return actions.some(action => { 34198 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 34199 }); 34200 }, [actions, item]); 34201 } 34202 function useSomeItemHasAPossibleBulkAction(actions, data) { 34203 return (0,external_wp_element_namespaceObject.useMemo)(() => { 34204 return data.some(item => { 34205 return actions.some(action => { 34206 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 34207 }); 34208 }); 34209 }, [actions, data]); 34210 } 34211 function BulkSelectionCheckbox({ 34212 selection, 34213 onChangeSelection, 34214 data, 34215 actions, 34216 getItemId 34217 }) { 34218 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34219 return data.filter(item => { 34220 return actions.some(action => action.supportsBulk && (!action.isEligible || action.isEligible(item))); 34221 }); 34222 }, [data, actions]); 34223 const selectedItems = data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 34224 const areAllSelected = selectedItems.length === selectableItems.length; 34225 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 34226 className: "dataviews-view-table-selection-checkbox", 34227 __nextHasNoMarginBottom: true, 34228 checked: areAllSelected, 34229 indeterminate: !areAllSelected && !!selectedItems.length, 34230 onChange: () => { 34231 if (areAllSelected) { 34232 onChangeSelection([]); 34233 } else { 34234 onChangeSelection(selectableItems.map(item => getItemId(item))); 34235 } 34236 }, 34237 "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect all') : (0,external_wp_i18n_namespaceObject.__)('Select all') 34238 }); 34239 } 34240 function ActionTrigger({ 34241 action, 34242 onClick, 34243 isBusy, 34244 items 34245 }) { 34246 const label = typeof action.label === 'string' ? action.label : action.label(items); 34247 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34248 disabled: isBusy, 34249 accessibleWhenDisabled: true, 34250 label: label, 34251 icon: action.icon, 34252 isDestructive: action.isDestructive, 34253 size: "compact", 34254 onClick: onClick, 34255 isBusy: isBusy, 34256 tooltipPosition: "top" 34257 }); 34258 } 34259 const dataviews_bulk_actions_EMPTY_ARRAY = []; 34260 function ActionButton({ 34261 action, 34262 selectedItems, 34263 actionInProgress, 34264 setActionInProgress 34265 }) { 34266 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 34267 const selectedEligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34268 return selectedItems.filter(item => { 34269 return !action.isEligible || action.isEligible(item); 34270 }); 34271 }, [action, selectedItems]); 34272 if ('RenderModal' in action) { 34273 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 34274 action: action, 34275 items: selectedEligibleItems, 34276 ActionTriggerComponent: ActionTrigger 34277 }, action.id); 34278 } 34279 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { 34280 action: action, 34281 onClick: async () => { 34282 setActionInProgress(action.id); 34283 await action.callback(selectedItems, { 34284 registry 34285 }); 34286 setActionInProgress(null); 34287 }, 34288 items: selectedEligibleItems, 34289 isBusy: actionInProgress === action.id 34290 }, action.id); 34291 } 34292 function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) { 34293 const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of items. */ 34294 (0,external_wp_i18n_namespaceObject._n)('%d Item selected', '%d Items selected', selectedItems.length), selectedItems.length) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of items. */ 34295 (0,external_wp_i18n_namespaceObject._n)('%d Item', '%d Items', data.length), data.length); 34296 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34297 expanded: false, 34298 className: "dataviews-bulk-actions-footer__container", 34299 spacing: 3, 34300 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 34301 selection: selection, 34302 onChangeSelection: onChangeSelection, 34303 data: data, 34304 actions: actions, 34305 getItemId: getItemId 34306 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34307 className: "dataviews-bulk-actions-footer__item-count", 34308 children: message 34309 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34310 className: "dataviews-bulk-actions-footer__action-buttons", 34311 expanded: false, 34312 spacing: 1, 34313 children: [actionsToShow.map(action => { 34314 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionButton, { 34315 action: action, 34316 selectedItems: selectedItems, 34317 actionInProgress: actionInProgress, 34318 setActionInProgress: setActionInProgress 34319 }, action.id); 34320 }), selectedItems.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34321 icon: close_small, 34322 showTooltip: true, 34323 tooltipPosition: "top", 34324 size: "compact", 34325 label: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 34326 disabled: !!actionInProgress, 34327 accessibleWhenDisabled: false, 34328 onClick: () => { 34329 onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY); 34330 } 34331 })] 34332 })] 34333 }); 34334 } 34335 function FooterContent({ 34336 selection, 34337 actions, 34338 onChangeSelection, 34339 data, 34340 getItemId 34341 }) { 34342 const [actionInProgress, setActionInProgress] = (0,external_wp_element_namespaceObject.useState)(null); 34343 const footerContentRef = (0,external_wp_element_namespaceObject.useRef)(null); 34344 const bulkActions = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => action.supportsBulk), [actions]); 34345 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34346 return data.filter(item => { 34347 return bulkActions.some(action => !action.isEligible || action.isEligible(item)); 34348 }); 34349 }, [data, bulkActions]); 34350 const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34351 return data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 34352 }, [selection, data, getItemId, selectableItems]); 34353 const actionsToShow = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => { 34354 return action.supportsBulk && action.icon && selectedItems.some(item => !action.isEligible || action.isEligible(item)); 34355 }), [actions, selectedItems]); 34356 if (!actionInProgress) { 34357 if (footerContentRef.current) { 34358 footerContentRef.current = null; 34359 } 34360 return renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 34361 } else if (!footerContentRef.current) { 34362 footerContentRef.current = renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 34363 } 34364 return footerContentRef.current; 34365 } 34366 function BulkActionsFooter() { 34367 const { 34368 data, 34369 selection, 34370 actions = dataviews_bulk_actions_EMPTY_ARRAY, 34371 onChangeSelection, 34372 getItemId 34373 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 34374 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FooterContent, { 34375 selection: selection, 34376 onChangeSelection: onChangeSelection, 34377 data: data, 34378 actions: actions, 34379 getItemId: getItemId 34380 }); 34381 } 34382 34383 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 34384 /** 34385 * WordPress dependencies 34386 */ 34387 34388 34389 const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 34390 xmlns: "http://www.w3.org/2000/svg", 34391 viewBox: "0 0 24 24", 34392 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 34393 d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" 34394 }) 34395 }); 34396 /* harmony default export */ const arrow_left = (arrowLeft); 34397 34398 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js 34399 /** 34400 * WordPress dependencies 34401 */ 34402 34403 34404 const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 34405 xmlns: "http://www.w3.org/2000/svg", 34406 viewBox: "0 0 24 24", 34407 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 34408 d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" 34409 }) 34410 }); 34411 /* harmony default export */ const arrow_right = (arrowRight); 34412 34413 ;// ./node_modules/@wordpress/icons/build-module/library/unseen.js 34414 /** 34415 * WordPress dependencies 34416 */ 34417 34418 34419 const unseen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 34420 viewBox: "0 0 24 24", 34421 xmlns: "http://www.w3.org/2000/svg", 34422 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 34423 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" 34424 }) 34425 }); 34426 /* harmony default export */ const library_unseen = (unseen); 34427 34428 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js 34429 /* wp:polyfill */ 34430 /** 34431 * External dependencies 34432 */ 34433 34434 /** 34435 * WordPress dependencies 34436 */ 34437 34438 34439 34440 34441 34442 /** 34443 * Internal dependencies 34444 */ 34445 34446 34447 34448 34449 const { 34450 Menu: column_header_menu_Menu 34451 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 34452 function WithMenuSeparators({ 34453 children 34454 }) { 34455 return external_wp_element_namespaceObject.Children.toArray(children).filter(Boolean).map((child, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { 34456 children: [i > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Separator, {}), child] 34457 }, i)); 34458 } 34459 const _HeaderMenu = (0,external_wp_element_namespaceObject.forwardRef)(function HeaderMenu({ 34460 fieldId, 34461 view, 34462 fields, 34463 onChangeView, 34464 onHide, 34465 setOpenedFilter, 34466 canMove = true 34467 }, ref) { 34468 var _view$fields; 34469 const visibleFieldIds = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 34470 const index = visibleFieldIds?.indexOf(fieldId); 34471 const isSorted = view.sort?.field === fieldId; 34472 let isHidable = false; 34473 let isSortable = false; 34474 let canAddFilter = false; 34475 let operators = []; 34476 const field = fields.find(f => f.id === fieldId); 34477 if (!field) { 34478 // No combined or regular field found. 34479 return null; 34480 } 34481 isHidable = field.enableHiding !== false; 34482 isSortable = field.enableSorting !== false; 34483 const header = field.header; 34484 operators = sanitizeOperators(field); 34485 // Filter can be added: 34486 // 1. If the field is not already part of a view's filters. 34487 // 2. If the field meets the type and operator requirements. 34488 // 3. If it's not primary. If it is, it should be already visible. 34489 canAddFilter = !view.filters?.some(_filter => fieldId === _filter.field) && !!field.elements?.length && !!operators.length && !field.filterBy?.isPrimary; 34490 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu, { 34491 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.TriggerButton, { 34492 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34493 size: "compact", 34494 className: "dataviews-view-table-header-button", 34495 ref: ref, 34496 variant: "tertiary" 34497 }), 34498 children: [header, view.sort && isSorted && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34499 "aria-hidden": "true", 34500 children: sortArrows[view.sort.direction] 34501 })] 34502 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Popover, { 34503 style: { 34504 minWidth: '240px' 34505 }, 34506 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithMenuSeparators, { 34507 children: [isSortable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { 34508 children: SORTING_DIRECTIONS.map(direction => { 34509 const isChecked = view.sort && isSorted && view.sort.direction === direction; 34510 const value = `$fieldId}-$direction}`; 34511 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.RadioItem, { 34512 // All sorting radio items share the same name, so that 34513 // selecting a sorting option automatically deselects the 34514 // previously selected one, even if it is displayed in 34515 // another submenu. The field and direction are passed via 34516 // the `value` prop. 34517 name: "view-table-sorting", 34518 value: value, 34519 checked: isChecked, 34520 onChange: () => { 34521 onChangeView({ 34522 ...view, 34523 sort: { 34524 field: fieldId, 34525 direction 34526 }, 34527 showLevels: false 34528 }); 34529 }, 34530 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34531 children: sortLabels[direction] 34532 }) 34533 }, value); 34534 }) 34535 }), canAddFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { 34536 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34537 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34538 icon: library_funnel 34539 }), 34540 onClick: () => { 34541 setOpenedFilter(fieldId); 34542 onChangeView({ 34543 ...view, 34544 page: 1, 34545 filters: [...(view.filters || []), { 34546 field: fieldId, 34547 value: undefined, 34548 operator: operators[0] 34549 }] 34550 }); 34551 }, 34552 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34553 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 34554 }) 34555 }) 34556 }), (canMove || isHidable) && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.Group, { 34557 children: [canMove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34558 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34559 icon: arrow_left 34560 }), 34561 disabled: index < 1, 34562 onClick: () => { 34563 var _visibleFieldIds$slic; 34564 onChangeView({ 34565 ...view, 34566 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), fieldId, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 34567 }); 34568 }, 34569 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34570 children: (0,external_wp_i18n_namespaceObject.__)('Move left') 34571 }) 34572 }), canMove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34573 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34574 icon: arrow_right 34575 }), 34576 disabled: index >= visibleFieldIds.length - 1, 34577 onClick: () => { 34578 var _visibleFieldIds$slic2; 34579 onChangeView({ 34580 ...view, 34581 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], fieldId, ...visibleFieldIds.slice(index + 2)] 34582 }); 34583 }, 34584 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34585 children: (0,external_wp_i18n_namespaceObject.__)('Move right') 34586 }) 34587 }), isHidable && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34588 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34589 icon: library_unseen 34590 }), 34591 onClick: () => { 34592 onHide(field); 34593 onChangeView({ 34594 ...view, 34595 fields: visibleFieldIds.filter(id => id !== fieldId) 34596 }); 34597 }, 34598 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34599 children: (0,external_wp_i18n_namespaceObject.__)('Hide column') 34600 }) 34601 })] 34602 })] 34603 }) 34604 })] 34605 }); 34606 }); 34607 34608 // @ts-expect-error Lift the `Item` type argument through the forwardRef. 34609 const ColumnHeaderMenu = _HeaderMenu; 34610 /* harmony default export */ const column_header_menu = (ColumnHeaderMenu); 34611 34612 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/get-clickable-item-props.js 34613 function getClickableItemProps({ 34614 item, 34615 isItemClickable, 34616 onClickItem, 34617 className 34618 }) { 34619 if (!isItemClickable(item) || !onClickItem) { 34620 return { 34621 className 34622 }; 34623 } 34624 return { 34625 className: className ? `$className} $className}--clickable` : undefined, 34626 role: 'button', 34627 tabIndex: 0, 34628 onClick: event => { 34629 // Prevents onChangeSelection from triggering. 34630 event.stopPropagation(); 34631 onClickItem(item); 34632 }, 34633 onKeyDown: event => { 34634 if (event.key === 'Enter' || event.key === '' || event.key === ' ') { 34635 // Prevents onChangeSelection from triggering. 34636 event.stopPropagation(); 34637 onClickItem(item); 34638 } 34639 } 34640 }; 34641 } 34642 34643 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-primary.js 34644 /** 34645 * WordPress dependencies 34646 */ 34647 34648 34649 /** 34650 * Internal dependencies 34651 */ 34652 34653 34654 34655 function ColumnPrimary({ 34656 item, 34657 level, 34658 titleField, 34659 mediaField, 34660 descriptionField, 34661 onClickItem, 34662 isItemClickable 34663 }) { 34664 const clickableProps = getClickableItemProps({ 34665 item, 34666 isItemClickable, 34667 onClickItem, 34668 className: 'dataviews-view-table__cell-content-wrapper dataviews-title-field' 34669 }); 34670 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34671 spacing: 3, 34672 justify: "flex-start", 34673 children: [mediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34674 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", 34675 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 34676 item: item 34677 }) 34678 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 34679 spacing: 0, 34680 children: [titleField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 34681 ...clickableProps, 34682 children: [level !== undefined && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 34683 className: "dataviews-view-table__level", 34684 children: ['—'.repeat(level), "\xA0"] 34685 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { 34686 item: item 34687 })] 34688 }), descriptionField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { 34689 item: item 34690 })] 34691 })] 34692 }); 34693 } 34694 /* harmony default export */ const column_primary = (ColumnPrimary); 34695 34696 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js 34697 /* wp:polyfill */ 34698 /** 34699 * External dependencies 34700 */ 34701 34702 34703 /** 34704 * WordPress dependencies 34705 */ 34706 34707 34708 34709 34710 /** 34711 * Internal dependencies 34712 */ 34713 34714 34715 34716 34717 34718 34719 34720 function TableColumnField({ 34721 item, 34722 fields, 34723 column 34724 }) { 34725 const field = fields.find(f => f.id === column); 34726 if (!field) { 34727 return null; 34728 } 34729 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34730 className: "dataviews-view-table__cell-content-wrapper", 34731 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 34732 item 34733 }) 34734 }); 34735 } 34736 function TableRow({ 34737 hasBulkActions, 34738 item, 34739 level, 34740 actions, 34741 fields, 34742 id, 34743 view, 34744 titleField, 34745 mediaField, 34746 descriptionField, 34747 selection, 34748 getItemId, 34749 isItemClickable, 34750 onClickItem, 34751 onChangeSelection 34752 }) { 34753 var _view$fields; 34754 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 34755 const isSelected = hasPossibleBulkAction && selection.includes(id); 34756 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 34757 const { 34758 showTitle = true, 34759 showMedia = true, 34760 showDescription = true 34761 } = view; 34762 const handleMouseEnter = () => { 34763 setIsHovered(true); 34764 }; 34765 const handleMouseLeave = () => { 34766 setIsHovered(false); 34767 }; 34768 34769 // Will be set to true if `onTouchStart` fires. This happens before 34770 // `onClick` and can be used to exclude touchscreen devices from certain 34771 // behaviours. 34772 const isTouchDeviceRef = (0,external_wp_element_namespaceObject.useRef)(false); 34773 const columns = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 34774 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 34775 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 34776 className: dist_clsx('dataviews-view-table__row', { 34777 'is-selected': hasPossibleBulkAction && isSelected, 34778 'is-hovered': isHovered, 34779 'has-bulk-actions': hasPossibleBulkAction 34780 }), 34781 onMouseEnter: handleMouseEnter, 34782 onMouseLeave: handleMouseLeave, 34783 onTouchStart: () => { 34784 isTouchDeviceRef.current = true; 34785 }, 34786 onClick: () => { 34787 if (!hasPossibleBulkAction) { 34788 return; 34789 } 34790 if (!isTouchDeviceRef.current && document.getSelection()?.type !== 'Range') { 34791 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [id]); 34792 } 34793 }, 34794 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34795 className: "dataviews-view-table__checkbox-column", 34796 style: { 34797 width: '1%' 34798 }, 34799 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34800 className: "dataviews-view-table__cell-content-wrapper", 34801 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 34802 item: item, 34803 selection: selection, 34804 onChangeSelection: onChangeSelection, 34805 getItemId: getItemId, 34806 titleField: titleField, 34807 disabled: !hasPossibleBulkAction 34808 }) 34809 }) 34810 }), hasPrimaryColumn && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34811 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_primary, { 34812 item: item, 34813 level: level, 34814 titleField: showTitle ? titleField : undefined, 34815 mediaField: showMedia ? mediaField : undefined, 34816 descriptionField: showDescription ? descriptionField : undefined, 34817 isItemClickable: isItemClickable, 34818 onClickItem: onClickItem 34819 }) 34820 }), columns.map(column => { 34821 var _view$layout$styles$c; 34822 // Explicit picks the supported styles. 34823 const { 34824 width, 34825 maxWidth, 34826 minWidth 34827 } = (_view$layout$styles$c = view.layout?.styles?.[column]) !== null && _view$layout$styles$c !== void 0 ? _view$layout$styles$c : {}; 34828 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34829 style: { 34830 width, 34831 maxWidth, 34832 minWidth 34833 }, 34834 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumnField, { 34835 fields: fields, 34836 item: item, 34837 column: column 34838 }) 34839 }, column); 34840 }), !!actions?.length && 34841 /*#__PURE__*/ 34842 // Disable reason: we are not making the element interactive, 34843 // but preventing any click events from bubbling up to the 34844 // table row. This allows us to add a click handler to the row 34845 // itself (to toggle row selection) without erroneously 34846 // intercepting click events from ItemActions. 34847 /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ 34848 (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34849 className: "dataviews-view-table__actions-column", 34850 onClick: e => e.stopPropagation(), 34851 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 34852 item: item, 34853 actions: actions 34854 }) 34855 }) 34856 /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */] 34857 }); 34858 } 34859 function ViewTable({ 34860 actions, 34861 data, 34862 fields, 34863 getItemId, 34864 getItemLevel, 34865 isLoading = false, 34866 onChangeView, 34867 onChangeSelection, 34868 selection, 34869 setOpenedFilter, 34870 onClickItem, 34871 isItemClickable, 34872 view 34873 }) { 34874 var _view$fields2; 34875 const headerMenuRefs = (0,external_wp_element_namespaceObject.useRef)(new Map()); 34876 const headerMenuToFocusRef = (0,external_wp_element_namespaceObject.useRef)(); 34877 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_namespaceObject.useState)(); 34878 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 34879 (0,external_wp_element_namespaceObject.useEffect)(() => { 34880 if (headerMenuToFocusRef.current) { 34881 headerMenuToFocusRef.current.focus(); 34882 headerMenuToFocusRef.current = undefined; 34883 } 34884 }); 34885 const tableNoticeId = (0,external_wp_element_namespaceObject.useId)(); 34886 if (nextHeaderMenuToFocus) { 34887 // If we need to force focus, we short-circuit rendering here 34888 // to prevent any additional work while we handle that. 34889 // Clearing out the focus directive is necessary to make sure 34890 // future renders don't cause unexpected focus jumps. 34891 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 34892 setNextHeaderMenuToFocus(undefined); 34893 return; 34894 } 34895 const onHide = field => { 34896 const hidden = headerMenuRefs.current.get(field.id); 34897 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : undefined; 34898 setNextHeaderMenuToFocus(fallback?.node); 34899 }; 34900 const hasData = !!data?.length; 34901 const titleField = fields.find(field => field.id === view.titleField); 34902 const mediaField = fields.find(field => field.id === view.mediaField); 34903 const descriptionField = fields.find(field => field.id === view.descriptionField); 34904 const { 34905 showTitle = true, 34906 showMedia = true, 34907 showDescription = true 34908 } = view; 34909 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 34910 const columns = (_view$fields2 = view.fields) !== null && _view$fields2 !== void 0 ? _view$fields2 : []; 34911 const headerMenuRef = (column, index) => node => { 34912 if (node) { 34913 headerMenuRefs.current.set(column, { 34914 node, 34915 fallback: columns[index > 0 ? index - 1 : 1] 34916 }); 34917 } else { 34918 headerMenuRefs.current.delete(column); 34919 } 34920 }; 34921 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34922 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("table", { 34923 className: dist_clsx('dataviews-view-table', { 34924 [`has-$view.layout?.density}-density`]: view.layout?.density && ['compact', 'comfortable'].includes(view.layout.density) 34925 }), 34926 "aria-busy": isLoading, 34927 "aria-describedby": tableNoticeId, 34928 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { 34929 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 34930 className: "dataviews-view-table__row", 34931 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 34932 className: "dataviews-view-table__checkbox-column", 34933 style: { 34934 width: '1%' 34935 }, 34936 scope: "col", 34937 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 34938 selection: selection, 34939 onChangeSelection: onChangeSelection, 34940 data: data, 34941 actions: actions, 34942 getItemId: getItemId 34943 }) 34944 }), hasPrimaryColumn && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 34945 scope: "col", 34946 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34947 className: "dataviews-view-table-header", 34948 children: titleField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { 34949 ref: headerMenuRef(titleField.id, 0), 34950 fieldId: titleField.id, 34951 view: view, 34952 fields: fields, 34953 onChangeView: onChangeView, 34954 onHide: onHide, 34955 setOpenedFilter: setOpenedFilter, 34956 canMove: false 34957 }) 34958 }) 34959 }), columns.map((column, index) => { 34960 var _view$layout$styles$c2; 34961 // Explicit picks the supported styles. 34962 const { 34963 width, 34964 maxWidth, 34965 minWidth 34966 } = (_view$layout$styles$c2 = view.layout?.styles?.[column]) !== null && _view$layout$styles$c2 !== void 0 ? _view$layout$styles$c2 : {}; 34967 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 34968 style: { 34969 width, 34970 maxWidth, 34971 minWidth 34972 }, 34973 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : undefined, 34974 scope: "col", 34975 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { 34976 ref: headerMenuRef(column, index), 34977 fieldId: column, 34978 view: view, 34979 fields: fields, 34980 onChangeView: onChangeView, 34981 onHide: onHide, 34982 setOpenedFilter: setOpenedFilter 34983 }) 34984 }, column); 34985 }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 34986 className: "dataviews-view-table__actions-column", 34987 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34988 className: "dataviews-view-table-header", 34989 children: (0,external_wp_i18n_namespaceObject.__)('Actions') 34990 }) 34991 })] 34992 }) 34993 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { 34994 children: hasData && data.map((item, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableRow, { 34995 item: item, 34996 level: view.showLevels && typeof getItemLevel === 'function' ? getItemLevel(item) : undefined, 34997 hasBulkActions: hasBulkActions, 34998 actions: actions, 34999 fields: fields, 35000 id: getItemId(item) || index.toString(), 35001 view: view, 35002 titleField: titleField, 35003 mediaField: mediaField, 35004 descriptionField: descriptionField, 35005 selection: selection, 35006 getItemId: getItemId, 35007 onChangeSelection: onChangeSelection, 35008 onClickItem: onClickItem, 35009 isItemClickable: isItemClickable 35010 }, getItemId(item))) 35011 })] 35012 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35013 className: dist_clsx({ 35014 'dataviews-loading': isLoading, 35015 'dataviews-no-results': !hasData && !isLoading 35016 }), 35017 id: tableNoticeId, 35018 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 35019 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 35020 }) 35021 })] 35022 }); 35023 } 35024 /* harmony default export */ const table = (ViewTable); 35025 35026 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/preview-size-picker.js 35027 /** 35028 * WordPress dependencies 35029 */ 35030 35031 35032 35033 35034 /** 35035 * Internal dependencies 35036 */ 35037 35038 35039 const viewportBreaks = { 35040 xhuge: { 35041 min: 3, 35042 max: 6, 35043 default: 5 35044 }, 35045 huge: { 35046 min: 2, 35047 max: 4, 35048 default: 4 35049 }, 35050 xlarge: { 35051 min: 2, 35052 max: 3, 35053 default: 3 35054 }, 35055 large: { 35056 min: 1, 35057 max: 2, 35058 default: 2 35059 }, 35060 mobile: { 35061 min: 1, 35062 max: 2, 35063 default: 2 35064 } 35065 }; 35066 35067 /** 35068 * Breakpoints were adjusted from media queries breakpoints to account for 35069 * the sidebar width. This was done to match the existing styles we had. 35070 */ 35071 const BREAKPOINTS = { 35072 xhuge: 1520, 35073 huge: 1140, 35074 xlarge: 780, 35075 large: 480, 35076 mobile: 0 35077 }; 35078 function useViewPortBreakpoint() { 35079 const containerWidth = (0,external_wp_element_namespaceObject.useContext)(dataviews_context).containerWidth; 35080 for (const [key, value] of Object.entries(BREAKPOINTS)) { 35081 if (containerWidth >= value) { 35082 return key; 35083 } 35084 } 35085 return 'mobile'; 35086 } 35087 function useUpdatedPreviewSizeOnViewportChange() { 35088 const view = (0,external_wp_element_namespaceObject.useContext)(dataviews_context).view; 35089 const viewport = useViewPortBreakpoint(); 35090 return (0,external_wp_element_namespaceObject.useMemo)(() => { 35091 const previewSize = view.layout?.previewSize; 35092 let newPreviewSize; 35093 if (!previewSize) { 35094 return; 35095 } 35096 const breakValues = viewportBreaks[viewport]; 35097 if (previewSize < breakValues.min) { 35098 newPreviewSize = breakValues.min; 35099 } 35100 if (previewSize > breakValues.max) { 35101 newPreviewSize = breakValues.max; 35102 } 35103 return newPreviewSize; 35104 }, [viewport, view]); 35105 } 35106 function PreviewSizePicker() { 35107 const viewport = useViewPortBreakpoint(); 35108 const context = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35109 const view = context.view; 35110 const breakValues = viewportBreaks[viewport]; 35111 const previewSizeToUse = view.layout?.previewSize || breakValues.default; 35112 const marks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.from({ 35113 length: breakValues.max - breakValues.min + 1 35114 }, (_, i) => { 35115 return { 35116 value: breakValues.min + i 35117 }; 35118 }), [breakValues]); 35119 if (viewport === 'mobile') { 35120 return null; 35121 } 35122 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { 35123 __nextHasNoMarginBottom: true, 35124 __next40pxDefaultSize: true, 35125 showTooltip: false, 35126 label: (0,external_wp_i18n_namespaceObject.__)('Preview size'), 35127 value: breakValues.max + breakValues.min - previewSizeToUse, 35128 marks: marks, 35129 min: breakValues.min, 35130 max: breakValues.max, 35131 withInputField: false, 35132 onChange: (value = 0) => { 35133 context.onChangeView({ 35134 ...view, 35135 layout: { 35136 ...view.layout, 35137 previewSize: breakValues.max + breakValues.min - value 35138 } 35139 }); 35140 }, 35141 step: 1 35142 }); 35143 } 35144 35145 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js 35146 /* wp:polyfill */ 35147 /** 35148 * External dependencies 35149 */ 35150 35151 35152 /** 35153 * WordPress dependencies 35154 */ 35155 35156 35157 35158 35159 /** 35160 * Internal dependencies 35161 */ 35162 35163 35164 35165 35166 35167 35168 35169 const { 35170 Badge 35171 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 35172 function GridItem({ 35173 view, 35174 selection, 35175 onChangeSelection, 35176 onClickItem, 35177 isItemClickable, 35178 getItemId, 35179 item, 35180 actions, 35181 mediaField, 35182 titleField, 35183 descriptionField, 35184 regularFields, 35185 badgeFields, 35186 hasBulkActions 35187 }) { 35188 const { 35189 showTitle = true, 35190 showMedia = true, 35191 showDescription = true 35192 } = view; 35193 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 35194 const id = getItemId(item); 35195 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItem); 35196 const isSelected = selection.includes(id); 35197 const renderedMediaField = mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 35198 item: item 35199 }) : null; 35200 const renderedTitleField = showTitle && titleField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { 35201 item: item 35202 }) : null; 35203 const clickableMediaItemProps = getClickableItemProps({ 35204 item, 35205 isItemClickable, 35206 onClickItem, 35207 className: 'dataviews-view-grid__media' 35208 }); 35209 const clickableTitleItemProps = getClickableItemProps({ 35210 item, 35211 isItemClickable, 35212 onClickItem, 35213 className: 'dataviews-view-grid__title-field dataviews-title-field' 35214 }); 35215 let mediaA11yProps; 35216 let titleA11yProps; 35217 if (isItemClickable(item) && onClickItem) { 35218 if (renderedTitleField) { 35219 mediaA11yProps = { 35220 'aria-labelledby': `dataviews-view-grid__title-field-$instanceId}` 35221 }; 35222 titleA11yProps = { 35223 id: `dataviews-view-grid__title-field-$instanceId}` 35224 }; 35225 } else { 35226 mediaA11yProps = { 35227 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Navigate to item') 35228 }; 35229 } 35230 } 35231 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35232 spacing: 0, 35233 className: dist_clsx('dataviews-view-grid__card', { 35234 'is-selected': hasBulkAction && isSelected 35235 }), 35236 onClickCapture: event => { 35237 if (event.ctrlKey || event.metaKey) { 35238 event.stopPropagation(); 35239 event.preventDefault(); 35240 if (!hasBulkAction) { 35241 return; 35242 } 35243 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 35244 } 35245 }, 35246 children: [showMedia && renderedMediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35247 ...clickableMediaItemProps, 35248 ...mediaA11yProps, 35249 children: renderedMediaField 35250 }), hasBulkActions && showMedia && renderedMediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 35251 item: item, 35252 selection: selection, 35253 onChangeSelection: onChangeSelection, 35254 getItemId: getItemId, 35255 titleField: titleField, 35256 disabled: !hasBulkAction 35257 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35258 justify: "space-between", 35259 className: "dataviews-view-grid__title-actions", 35260 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35261 ...clickableTitleItemProps, 35262 ...titleA11yProps, 35263 children: renderedTitleField 35264 }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 35265 item: item, 35266 actions: actions, 35267 isCompact: true 35268 })] 35269 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35270 spacing: 1, 35271 children: [showDescription && descriptionField?.render && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { 35272 item: item 35273 }), !!badgeFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 35274 className: "dataviews-view-grid__badge-fields", 35275 spacing: 2, 35276 wrap: true, 35277 alignment: "top", 35278 justify: "flex-start", 35279 children: badgeFields.map(field => { 35280 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { 35281 className: "dataviews-view-grid__field-value", 35282 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 35283 item: item 35284 }) 35285 }, field.id); 35286 }) 35287 }), !!regularFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 35288 className: "dataviews-view-grid__fields", 35289 spacing: 1, 35290 children: regularFields.map(field => { 35291 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 35292 className: "dataviews-view-grid__field", 35293 gap: 1, 35294 justify: "flex-start", 35295 expanded: true, 35296 style: { 35297 height: 'auto' 35298 }, 35299 direction: "row", 35300 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35301 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 35302 className: "dataviews-view-grid__field-name", 35303 children: field.header 35304 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 35305 className: "dataviews-view-grid__field-value", 35306 style: { 35307 maxHeight: 'none' 35308 }, 35309 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 35310 item: item 35311 }) 35312 })] 35313 }) 35314 }, field.id); 35315 }) 35316 })] 35317 })] 35318 }, id); 35319 } 35320 function ViewGrid({ 35321 actions, 35322 data, 35323 fields, 35324 getItemId, 35325 isLoading, 35326 onChangeSelection, 35327 onClickItem, 35328 isItemClickable, 35329 selection, 35330 view 35331 }) { 35332 var _view$fields; 35333 const titleField = fields.find(field => field.id === view?.titleField); 35334 const mediaField = fields.find(field => field.id === view?.mediaField); 35335 const descriptionField = fields.find(field => field.id === view?.descriptionField); 35336 const otherFields = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 35337 const { 35338 regularFields, 35339 badgeFields 35340 } = otherFields.reduce((accumulator, fieldId) => { 35341 const field = fields.find(f => f.id === fieldId); 35342 if (!field) { 35343 return accumulator; 35344 } 35345 // If the field is a badge field, add it to the badgeFields array 35346 // otherwise add it to the rest visibleFields array. 35347 const key = view.layout?.badgeFields?.includes(fieldId) ? 'badgeFields' : 'regularFields'; 35348 accumulator[key].push(field); 35349 return accumulator; 35350 }, { 35351 regularFields: [], 35352 badgeFields: [] 35353 }); 35354 const hasData = !!data?.length; 35355 const updatedPreviewSize = useUpdatedPreviewSizeOnViewportChange(); 35356 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 35357 const usedPreviewSize = updatedPreviewSize || view.layout?.previewSize; 35358 const gridStyle = usedPreviewSize ? { 35359 gridTemplateColumns: `repeat($usedPreviewSize}, minmax(0, 1fr))` 35360 } : {}; 35361 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35362 children: [hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 35363 gap: 8, 35364 columns: 2, 35365 alignment: "top", 35366 className: "dataviews-view-grid", 35367 style: gridStyle, 35368 "aria-busy": isLoading, 35369 children: data.map(item => { 35370 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItem, { 35371 view: view, 35372 selection: selection, 35373 onChangeSelection: onChangeSelection, 35374 onClickItem: onClickItem, 35375 isItemClickable: isItemClickable, 35376 getItemId: getItemId, 35377 item: item, 35378 actions: actions, 35379 mediaField: mediaField, 35380 titleField: titleField, 35381 descriptionField: descriptionField, 35382 regularFields: regularFields, 35383 badgeFields: badgeFields, 35384 hasBulkActions: hasBulkActions 35385 }, getItemId(item)); 35386 }) 35387 }), !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35388 className: dist_clsx({ 35389 'dataviews-loading': isLoading, 35390 'dataviews-no-results': !isLoading 35391 }), 35392 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 35393 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 35394 }) 35395 })] 35396 }); 35397 } 35398 35399 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js 35400 /* wp:polyfill */ 35401 /** 35402 * External dependencies 35403 */ 35404 35405 35406 /** 35407 * WordPress dependencies 35408 */ 35409 35410 35411 35412 35413 35414 35415 35416 /** 35417 * Internal dependencies 35418 */ 35419 35420 35421 35422 const { 35423 Menu: list_Menu 35424 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 35425 function generateItemWrapperCompositeId(idPrefix) { 35426 return `$idPrefix}-item-wrapper`; 35427 } 35428 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 35429 return `$idPrefix}-primary-action-$primaryActionId}`; 35430 } 35431 function generateDropdownTriggerCompositeId(idPrefix) { 35432 return `$idPrefix}-dropdown`; 35433 } 35434 function PrimaryActionGridCell({ 35435 idPrefix, 35436 primaryAction, 35437 item 35438 }) { 35439 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 35440 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 35441 const compositeItemId = generatePrimaryActionCompositeId(idPrefix, primaryAction.id); 35442 const label = typeof primaryAction.label === 'string' ? primaryAction.label : primaryAction.label([item]); 35443 return 'RenderModal' in primaryAction ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35444 role: "gridcell", 35445 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35446 id: compositeItemId, 35447 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35448 label: label, 35449 disabled: !!primaryAction.disabled, 35450 accessibleWhenDisabled: true, 35451 icon: primaryAction.icon, 35452 isDestructive: primaryAction.isDestructive, 35453 size: "small", 35454 onClick: () => setIsModalOpen(true) 35455 }), 35456 children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 35457 action: primaryAction, 35458 items: [item], 35459 closeModal: () => setIsModalOpen(false) 35460 }) 35461 }) 35462 }, primaryAction.id) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35463 role: "gridcell", 35464 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35465 id: compositeItemId, 35466 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35467 label: label, 35468 disabled: !!primaryAction.disabled, 35469 accessibleWhenDisabled: true, 35470 icon: primaryAction.icon, 35471 isDestructive: primaryAction.isDestructive, 35472 size: "small", 35473 onClick: () => { 35474 primaryAction.callback([item], { 35475 registry 35476 }); 35477 } 35478 }) 35479 }) 35480 }, primaryAction.id); 35481 } 35482 function ListItem({ 35483 view, 35484 actions, 35485 idPrefix, 35486 isSelected, 35487 item, 35488 titleField, 35489 mediaField, 35490 descriptionField, 35491 onSelect, 35492 otherFields, 35493 onDropdownTriggerKeyDown 35494 }) { 35495 const { 35496 showTitle = true, 35497 showMedia = true, 35498 showDescription = true 35499 } = view; 35500 const itemRef = (0,external_wp_element_namespaceObject.useRef)(null); 35501 const labelId = `$idPrefix}-label`; 35502 const descriptionId = `$idPrefix}-description`; 35503 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 35504 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 35505 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 35506 const handleHover = ({ 35507 type 35508 }) => { 35509 const isHover = type === 'mouseenter'; 35510 setIsHovered(isHover); 35511 }; 35512 (0,external_wp_element_namespaceObject.useEffect)(() => { 35513 if (isSelected) { 35514 itemRef.current?.scrollIntoView({ 35515 behavior: 'auto', 35516 block: 'nearest', 35517 inline: 'nearest' 35518 }); 35519 } 35520 }, [isSelected]); 35521 const { 35522 primaryAction, 35523 eligibleActions 35524 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 35525 // If an action is eligible for all items, doesn't need 35526 // to provide the `isEligible` function. 35527 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 35528 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 35529 return { 35530 primaryAction: _primaryActions[0], 35531 eligibleActions: _eligibleActions 35532 }; 35533 }, [actions, item]); 35534 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; 35535 const renderedMediaField = showMedia && mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35536 className: "dataviews-view-list__media-wrapper", 35537 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 35538 item: item 35539 }) 35540 }) : null; 35541 const renderedTitleField = showTitle && titleField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { 35542 item: item 35543 }) : null; 35544 const usedActions = eligibleActions?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35545 spacing: 3, 35546 className: "dataviews-view-list__item-actions", 35547 children: [primaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActionGridCell, { 35548 idPrefix: idPrefix, 35549 primaryAction: primaryAction, 35550 item: item 35551 }), !hasOnlyOnePrimaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 35552 role: "gridcell", 35553 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(list_Menu, { 35554 placement: "bottom-end", 35555 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.TriggerButton, { 35556 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35557 id: generateDropdownTriggerCompositeId(idPrefix), 35558 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35559 size: "small", 35560 icon: more_vertical, 35561 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 35562 accessibleWhenDisabled: true, 35563 disabled: !actions.length, 35564 onKeyDown: onDropdownTriggerKeyDown 35565 }) 35566 }) 35567 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.Popover, { 35568 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsMenuGroup, { 35569 actions: eligibleActions, 35570 item: item, 35571 registry: registry, 35572 setActiveModalAction: setActiveModalAction 35573 }) 35574 })] 35575 }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 35576 action: activeModalAction, 35577 items: [item], 35578 closeModal: () => setActiveModalAction(null) 35579 })] 35580 })] 35581 }); 35582 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Row, { 35583 ref: itemRef, 35584 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 35585 role: "row", 35586 className: dist_clsx({ 35587 'is-selected': isSelected, 35588 'is-hovered': isHovered 35589 }), 35590 onMouseEnter: handleHover, 35591 onMouseLeave: handleHover, 35592 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35593 className: "dataviews-view-list__item-wrapper", 35594 spacing: 0, 35595 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35596 role: "gridcell", 35597 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35598 id: generateItemWrapperCompositeId(idPrefix), 35599 "aria-pressed": isSelected, 35600 "aria-labelledby": labelId, 35601 "aria-describedby": descriptionId, 35602 className: "dataviews-view-list__item", 35603 onClick: () => onSelect(item) 35604 }) 35605 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35606 spacing: 3, 35607 justify: "start", 35608 alignment: "flex-start", 35609 children: [renderedMediaField, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35610 spacing: 1, 35611 className: "dataviews-view-list__field-wrapper", 35612 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35613 spacing: 0, 35614 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35615 className: "dataviews-title-field", 35616 id: labelId, 35617 children: renderedTitleField 35618 }), usedActions] 35619 }), showDescription && descriptionField?.render && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35620 className: "dataviews-view-list__field", 35621 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { 35622 item: item 35623 }) 35624 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35625 className: "dataviews-view-list__fields", 35626 id: descriptionId, 35627 children: otherFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 35628 className: "dataviews-view-list__field", 35629 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 35630 as: "span", 35631 className: "dataviews-view-list__field-label", 35632 children: field.label 35633 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 35634 className: "dataviews-view-list__field-value", 35635 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 35636 item: item 35637 }) 35638 })] 35639 }, field.id)) 35640 })] 35641 })] 35642 })] 35643 }) 35644 }); 35645 } 35646 function isDefined(item) { 35647 return !!item; 35648 } 35649 function ViewList(props) { 35650 var _view$fields; 35651 const { 35652 actions, 35653 data, 35654 fields, 35655 getItemId, 35656 isLoading, 35657 onChangeSelection, 35658 selection, 35659 view 35660 } = props; 35661 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, 'view-list'); 35662 const selectedItem = data?.findLast(item => selection.includes(getItemId(item))); 35663 const titleField = fields.find(field => field.id === view.titleField); 35664 const mediaField = fields.find(field => field.id === view.mediaField); 35665 const descriptionField = fields.find(field => field.id === view.descriptionField); 35666 const otherFields = ((_view$fields = view?.fields) !== null && _view$fields !== void 0 ? _view$fields : []).map(fieldId => fields.find(f => fieldId === f.id)).filter(isDefined); 35667 const onSelect = item => onChangeSelection([getItemId(item)]); 35668 const generateCompositeItemIdPrefix = (0,external_wp_element_namespaceObject.useCallback)(item => `$baseId}-$getItemId(item)}`, [baseId, getItemId]); 35669 const isActiveCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((item, idToCheck) => { 35670 // All composite items use the same prefix in their IDs. 35671 return idToCheck.startsWith(generateCompositeItemIdPrefix(item)); 35672 }, [generateCompositeItemIdPrefix]); 35673 35674 // Controlled state for the active composite item. 35675 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(undefined); 35676 35677 // Update the active composite item when the selected item changes. 35678 (0,external_wp_element_namespaceObject.useEffect)(() => { 35679 if (selectedItem) { 35680 setActiveCompositeId(generateItemWrapperCompositeId(generateCompositeItemIdPrefix(selectedItem))); 35681 } 35682 }, [selectedItem, generateCompositeItemIdPrefix]); 35683 const activeItemIndex = data.findIndex(item => isActiveCompositeItem(item, activeCompositeId !== null && activeCompositeId !== void 0 ? activeCompositeId : '')); 35684 const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex); 35685 const isActiveIdInList = activeItemIndex !== -1; 35686 const selectCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((targetIndex, generateCompositeId) => { 35687 // Clamping between 0 and data.length - 1 to avoid out of bounds. 35688 const clampedIndex = Math.min(data.length - 1, Math.max(0, targetIndex)); 35689 if (!data[clampedIndex]) { 35690 return; 35691 } 35692 const itemIdPrefix = generateCompositeItemIdPrefix(data[clampedIndex]); 35693 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 35694 setActiveCompositeId(targetCompositeItemId); 35695 document.getElementById(targetCompositeItemId)?.focus(); 35696 }, [data, generateCompositeItemIdPrefix]); 35697 35698 // Select a new active composite item when the current active item 35699 // is removed from the list. 35700 (0,external_wp_element_namespaceObject.useEffect)(() => { 35701 const wasActiveIdInList = previousActiveItemIndex !== undefined && previousActiveItemIndex !== -1; 35702 if (!isActiveIdInList && wasActiveIdInList) { 35703 // By picking `previousActiveItemIndex` as the next item index, we are 35704 // basically picking the item that would have been after the deleted one. 35705 // If the previously active (and removed) item was the last of the list, 35706 // we will select the item before it — which is the new last item. 35707 selectCompositeItem(previousActiveItemIndex, generateItemWrapperCompositeId); 35708 } 35709 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 35710 35711 // Prevent the default behavior (open dropdown menu) and instead select the 35712 // dropdown menu trigger on the previous/next row. 35713 // https://github.com/ariakit/ariakit/issues/3768 35714 const onDropdownTriggerKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => { 35715 if (event.key === 'ArrowDown') { 35716 // Select the dropdown menu trigger item in the next row. 35717 event.preventDefault(); 35718 selectCompositeItem(activeItemIndex + 1, generateDropdownTriggerCompositeId); 35719 } 35720 if (event.key === 'ArrowUp') { 35721 // Select the dropdown menu trigger item in the previous row. 35722 event.preventDefault(); 35723 selectCompositeItem(activeItemIndex - 1, generateDropdownTriggerCompositeId); 35724 } 35725 }, [selectCompositeItem, activeItemIndex]); 35726 const hasData = data?.length; 35727 if (!hasData) { 35728 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35729 className: dist_clsx({ 35730 'dataviews-loading': isLoading, 35731 'dataviews-no-results': !hasData && !isLoading 35732 }), 35733 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 35734 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 35735 }) 35736 }); 35737 } 35738 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 35739 id: baseId, 35740 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 35741 className: "dataviews-view-list", 35742 role: "grid", 35743 activeId: activeCompositeId, 35744 setActiveId: setActiveCompositeId, 35745 children: data.map(item => { 35746 const id = generateCompositeItemIdPrefix(item); 35747 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListItem, { 35748 view: view, 35749 idPrefix: id, 35750 actions: actions, 35751 item: item, 35752 isSelected: item === selectedItem, 35753 onSelect: onSelect, 35754 mediaField: mediaField, 35755 titleField: titleField, 35756 descriptionField: descriptionField, 35757 otherFields: otherFields, 35758 onDropdownTriggerKeyDown: onDropdownTriggerKeyDown 35759 }, id); 35760 }) 35761 }); 35762 } 35763 35764 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/density-picker.js 35765 /** 35766 * WordPress dependencies 35767 */ 35768 35769 35770 35771 35772 /** 35773 * Internal dependencies 35774 */ 35775 35776 35777 function DensityPicker() { 35778 const context = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35779 const view = context.view; 35780 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 35781 __nextHasNoMarginBottom: true, 35782 size: "__unstable-large", 35783 label: (0,external_wp_i18n_namespaceObject.__)('Density'), 35784 value: view.layout?.density || 'balanced', 35785 onChange: value => { 35786 context.onChangeView({ 35787 ...view, 35788 layout: { 35789 ...view.layout, 35790 density: value 35791 } 35792 }); 35793 }, 35794 isBlock: true, 35795 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 35796 value: "comfortable", 35797 label: (0,external_wp_i18n_namespaceObject._x)('Comfortable', 'Density option for DataView layout') 35798 }, "comfortable"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 35799 value: "balanced", 35800 label: (0,external_wp_i18n_namespaceObject._x)('Balanced', 'Density option for DataView layout') 35801 }, "balanced"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 35802 value: "compact", 35803 label: (0,external_wp_i18n_namespaceObject._x)('Compact', 'Density option for DataView layout') 35804 }, "compact")] 35805 }); 35806 } 35807 35808 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js 35809 /** 35810 * WordPress dependencies 35811 */ 35812 35813 35814 35815 /** 35816 * Internal dependencies 35817 */ 35818 35819 35820 35821 35822 35823 35824 const VIEW_LAYOUTS = [{ 35825 type: constants_LAYOUT_TABLE, 35826 label: (0,external_wp_i18n_namespaceObject.__)('Table'), 35827 component: table, 35828 icon: block_table, 35829 viewConfigOptions: DensityPicker 35830 }, { 35831 type: constants_LAYOUT_GRID, 35832 label: (0,external_wp_i18n_namespaceObject.__)('Grid'), 35833 component: ViewGrid, 35834 icon: library_category, 35835 viewConfigOptions: PreviewSizePicker 35836 }, { 35837 type: constants_LAYOUT_LIST, 35838 label: (0,external_wp_i18n_namespaceObject.__)('List'), 35839 component: ViewList, 35840 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets 35841 }]; 35842 35843 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js 35844 /* wp:polyfill */ 35845 /** 35846 * External dependencies 35847 */ 35848 35849 /** 35850 * WordPress dependencies 35851 */ 35852 35853 35854 /** 35855 * Internal dependencies 35856 */ 35857 35858 35859 35860 function DataViewsLayout() { 35861 const { 35862 actions = [], 35863 data, 35864 fields, 35865 getItemId, 35866 getItemLevel, 35867 isLoading, 35868 view, 35869 onChangeView, 35870 selection, 35871 onChangeSelection, 35872 setOpenedFilter, 35873 onClickItem, 35874 isItemClickable 35875 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35876 const ViewComponent = VIEW_LAYOUTS.find(v => v.type === view.type)?.component; 35877 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewComponent, { 35878 actions: actions, 35879 data: data, 35880 fields: fields, 35881 getItemId: getItemId, 35882 getItemLevel: getItemLevel, 35883 isLoading: isLoading, 35884 onChangeView: onChangeView, 35885 onChangeSelection: onChangeSelection, 35886 selection: selection, 35887 setOpenedFilter: setOpenedFilter, 35888 onClickItem: onClickItem, 35889 isItemClickable: isItemClickable, 35890 view: view 35891 }); 35892 } 35893 35894 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js 35895 /* wp:polyfill */ 35896 /** 35897 * WordPress dependencies 35898 */ 35899 35900 35901 35902 35903 35904 /** 35905 * Internal dependencies 35906 */ 35907 35908 35909 function DataViewsPagination() { 35910 var _view$page; 35911 const { 35912 view, 35913 onChangeView, 35914 paginationInfo: { 35915 totalItems = 0, 35916 totalPages 35917 } 35918 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35919 if (!totalItems || !totalPages) { 35920 return null; 35921 } 35922 const currentPage = (_view$page = view.page) !== null && _view$page !== void 0 ? _view$page : 1; 35923 const pageSelectOptions = Array.from(Array(totalPages)).map((_, i) => { 35924 const page = i + 1; 35925 return { 35926 value: page.toString(), 35927 label: page.toString(), 35928 'aria-label': currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)( 35929 // translators: Current page number in total number of pages 35930 (0,external_wp_i18n_namespaceObject.__)('Page %1$s of %2$s'), currentPage, totalPages) : page.toString() 35931 }; 35932 }); 35933 return !!totalItems && totalPages !== 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35934 expanded: false, 35935 className: "dataviews-pagination", 35936 justify: "end", 35937 spacing: 6, 35938 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 35939 justify: "flex-start", 35940 expanded: false, 35941 spacing: 1, 35942 className: "dataviews-pagination__page-select", 35943 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( 35944 // translators: 1: Current page number, 2: Total number of pages. 35945 (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { 35946 div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35947 "aria-hidden": true 35948 }), 35949 CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 35950 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), 35951 value: currentPage.toString(), 35952 options: pageSelectOptions, 35953 onChange: newValue => { 35954 onChangeView({ 35955 ...view, 35956 page: +newValue 35957 }); 35958 }, 35959 size: "small", 35960 __nextHasNoMarginBottom: true, 35961 variant: "minimal" 35962 }) 35963 }) 35964 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35965 expanded: false, 35966 spacing: 1, 35967 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35968 onClick: () => onChangeView({ 35969 ...view, 35970 page: currentPage - 1 35971 }), 35972 disabled: currentPage === 1, 35973 accessibleWhenDisabled: true, 35974 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 35975 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 35976 showTooltip: true, 35977 size: "compact", 35978 tooltipPosition: "top" 35979 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35980 onClick: () => onChangeView({ 35981 ...view, 35982 page: currentPage + 1 35983 }), 35984 disabled: currentPage >= totalPages, 35985 accessibleWhenDisabled: true, 35986 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 35987 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 35988 showTooltip: true, 35989 size: "compact", 35990 tooltipPosition: "top" 35991 })] 35992 })] 35993 }); 35994 } 35995 /* harmony default export */ const dataviews_pagination = ((0,external_wp_element_namespaceObject.memo)(DataViewsPagination)); 35996 35997 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js 35998 /** 35999 * WordPress dependencies 36000 */ 36001 36002 36003 36004 /** 36005 * Internal dependencies 36006 */ 36007 36008 36009 36010 36011 36012 const dataviews_footer_EMPTY_ARRAY = []; 36013 function DataViewsFooter() { 36014 const { 36015 view, 36016 paginationInfo: { 36017 totalItems = 0, 36018 totalPages 36019 }, 36020 data, 36021 actions = dataviews_footer_EMPTY_ARRAY 36022 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36023 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type); 36024 if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) { 36025 return null; 36026 } 36027 return !!totalItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36028 expanded: false, 36029 justify: "end", 36030 className: "dataviews-footer", 36031 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination, {})] 36032 }); 36033 } 36034 36035 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js 36036 /** 36037 * WordPress dependencies 36038 */ 36039 36040 36041 36042 36043 36044 /** 36045 * Internal dependencies 36046 */ 36047 36048 36049 const DataViewsSearch = (0,external_wp_element_namespaceObject.memo)(function Search({ 36050 label 36051 }) { 36052 const { 36053 view, 36054 onChangeView 36055 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36056 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(view.search); 36057 (0,external_wp_element_namespaceObject.useEffect)(() => { 36058 var _view$search; 36059 setSearch((_view$search = view.search) !== null && _view$search !== void 0 ? _view$search : ''); 36060 }, [view.search, setSearch]); 36061 const onChangeViewRef = (0,external_wp_element_namespaceObject.useRef)(onChangeView); 36062 const viewRef = (0,external_wp_element_namespaceObject.useRef)(view); 36063 (0,external_wp_element_namespaceObject.useEffect)(() => { 36064 onChangeViewRef.current = onChangeView; 36065 viewRef.current = view; 36066 }, [onChangeView, view]); 36067 (0,external_wp_element_namespaceObject.useEffect)(() => { 36068 if (debouncedSearch !== viewRef.current?.search) { 36069 onChangeViewRef.current({ 36070 ...viewRef.current, 36071 page: 1, 36072 search: debouncedSearch 36073 }); 36074 } 36075 }, [debouncedSearch]); 36076 const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)('Search'); 36077 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 36078 className: "dataviews-search", 36079 __nextHasNoMarginBottom: true, 36080 onChange: setSearch, 36081 value: search, 36082 label: searchLabel, 36083 placeholder: searchLabel, 36084 size: "compact" 36085 }); 36086 }); 36087 /* harmony default export */ const dataviews_search = (DataViewsSearch); 36088 36089 ;// ./node_modules/@wordpress/icons/build-module/library/lock.js 36090 /** 36091 * WordPress dependencies 36092 */ 36093 36094 36095 const lock_lock = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36096 viewBox: "0 0 24 24", 36097 xmlns: "http://www.w3.org/2000/svg", 36098 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36099 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" 36100 }) 36101 }); 36102 /* harmony default export */ const library_lock = (lock_lock); 36103 36104 ;// ./node_modules/@wordpress/icons/build-module/library/cog.js 36105 /** 36106 * WordPress dependencies 36107 */ 36108 36109 36110 const cog = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36111 xmlns: "http://www.w3.org/2000/svg", 36112 viewBox: "0 0 24 24", 36113 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36114 fillRule: "evenodd", 36115 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", 36116 clipRule: "evenodd" 36117 }) 36118 }); 36119 /* harmony default export */ const library_cog = (cog); 36120 36121 ;// external ["wp","warning"] 36122 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 36123 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 36124 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js 36125 /* wp:polyfill */ 36126 /** 36127 * External dependencies 36128 */ 36129 36130 36131 36132 /** 36133 * WordPress dependencies 36134 */ 36135 36136 36137 36138 36139 36140 36141 36142 /** 36143 * Internal dependencies 36144 */ 36145 36146 36147 36148 36149 36150 const { 36151 Menu: dataviews_view_config_Menu 36152 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 36153 const DATAVIEWS_CONFIG_POPOVER_PROPS = { 36154 className: 'dataviews-config__popover', 36155 placement: 'bottom-end', 36156 offset: 9 36157 }; 36158 function ViewTypeMenu({ 36159 defaultLayouts = { 36160 list: {}, 36161 grid: {}, 36162 table: {} 36163 } 36164 }) { 36165 const { 36166 view, 36167 onChangeView 36168 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36169 const availableLayouts = Object.keys(defaultLayouts); 36170 if (availableLayouts.length <= 1) { 36171 return null; 36172 } 36173 const activeView = VIEW_LAYOUTS.find(v => view.type === v.type); 36174 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { 36175 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.TriggerButton, { 36176 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36177 size: "compact", 36178 icon: activeView?.icon, 36179 label: (0,external_wp_i18n_namespaceObject.__)('Layout') 36180 }) 36181 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { 36182 children: availableLayouts.map(layout => { 36183 const config = VIEW_LAYOUTS.find(v => v.type === layout); 36184 if (!config) { 36185 return null; 36186 } 36187 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.RadioItem, { 36188 value: layout, 36189 name: "view-actions-available-view", 36190 checked: layout === view.type, 36191 hideOnClick: true, 36192 onChange: e => { 36193 switch (e.target.value) { 36194 case 'list': 36195 case 'grid': 36196 case 'table': 36197 const viewWithoutLayout = { 36198 ...view 36199 }; 36200 if ('layout' in viewWithoutLayout) { 36201 delete viewWithoutLayout.layout; 36202 } 36203 // @ts-expect-error 36204 return onChangeView({ 36205 ...viewWithoutLayout, 36206 type: e.target.value, 36207 ...defaultLayouts[e.target.value] 36208 }); 36209 } 36210 true ? external_wp_warning_default()('Invalid dataview') : 0; 36211 }, 36212 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { 36213 children: config.label 36214 }) 36215 }, layout); 36216 }) 36217 })] 36218 }); 36219 } 36220 function SortFieldControl() { 36221 const { 36222 view, 36223 fields, 36224 onChangeView 36225 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36226 const orderOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 36227 const sortableFields = fields.filter(field => field.enableSorting !== false); 36228 return sortableFields.map(field => { 36229 return { 36230 label: field.label, 36231 value: field.id 36232 }; 36233 }); 36234 }, [fields]); 36235 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 36236 __nextHasNoMarginBottom: true, 36237 __next40pxDefaultSize: true, 36238 label: (0,external_wp_i18n_namespaceObject.__)('Sort by'), 36239 value: view.sort?.field, 36240 options: orderOptions, 36241 onChange: value => { 36242 onChangeView({ 36243 ...view, 36244 sort: { 36245 direction: view?.sort?.direction || 'desc', 36246 field: value 36247 }, 36248 showLevels: false 36249 }); 36250 } 36251 }); 36252 } 36253 function SortDirectionControl() { 36254 const { 36255 view, 36256 fields, 36257 onChangeView 36258 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36259 const sortableFields = fields.filter(field => field.enableSorting !== false); 36260 if (sortableFields.length === 0) { 36261 return null; 36262 } 36263 let value = view.sort?.direction; 36264 if (!value && view.sort?.field) { 36265 value = 'desc'; 36266 } 36267 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 36268 className: "dataviews-view-config__sort-direction", 36269 __nextHasNoMarginBottom: true, 36270 __next40pxDefaultSize: true, 36271 isBlock: true, 36272 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 36273 value: value, 36274 onChange: newDirection => { 36275 if (newDirection === 'asc' || newDirection === 'desc') { 36276 onChangeView({ 36277 ...view, 36278 sort: { 36279 direction: newDirection, 36280 field: view.sort?.field || 36281 // If there is no field assigned as the sorting field assign the first sortable field. 36282 fields.find(field => field.enableSorting !== false)?.id || '' 36283 }, 36284 showLevels: false 36285 }); 36286 return; 36287 } 36288 true ? external_wp_warning_default()('Invalid direction') : 0; 36289 }, 36290 children: SORTING_DIRECTIONS.map(direction => { 36291 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { 36292 value: direction, 36293 icon: sortIcons[direction], 36294 label: sortLabels[direction] 36295 }, direction); 36296 }) 36297 }); 36298 } 36299 const PAGE_SIZE_VALUES = [10, 20, 50, 100]; 36300 function ItemsPerPageControl() { 36301 const { 36302 view, 36303 onChangeView 36304 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36305 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 36306 __nextHasNoMarginBottom: true, 36307 __next40pxDefaultSize: true, 36308 isBlock: true, 36309 label: (0,external_wp_i18n_namespaceObject.__)('Items per page'), 36310 value: view.perPage || 10, 36311 disabled: !view?.sort?.field, 36312 onChange: newItemsPerPage => { 36313 const newItemsPerPageNumber = typeof newItemsPerPage === 'number' || newItemsPerPage === undefined ? newItemsPerPage : parseInt(newItemsPerPage, 10); 36314 onChangeView({ 36315 ...view, 36316 perPage: newItemsPerPageNumber, 36317 page: 1 36318 }); 36319 }, 36320 children: PAGE_SIZE_VALUES.map(value => { 36321 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 36322 value: value, 36323 label: value.toString() 36324 }, value); 36325 }) 36326 }); 36327 } 36328 function PreviewOptions({ 36329 previewOptions, 36330 onChangePreviewOption, 36331 onMenuOpenChange, 36332 activeOption 36333 }) { 36334 const focusPreviewOptionsField = id => { 36335 // Focus the visibility button to avoid focus loss. 36336 // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. 36337 // eslint-disable-next-line @wordpress/react-no-unsafe-timeout 36338 setTimeout(() => { 36339 const element = document.querySelector(`.dataviews-field-control__field-$id} .dataviews-field-control__field-preview-options-button`); 36340 if (element instanceof HTMLElement) { 36341 element.focus(); 36342 } 36343 }, 50); 36344 }; 36345 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { 36346 onOpenChange: onMenuOpenChange, 36347 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.TriggerButton, { 36348 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36349 className: "dataviews-field-control__field-preview-options-button", 36350 size: "compact", 36351 icon: more_vertical, 36352 label: (0,external_wp_i18n_namespaceObject.__)('Preview') 36353 }) 36354 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { 36355 children: previewOptions?.map(({ 36356 id, 36357 label 36358 }) => { 36359 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.RadioItem, { 36360 value: id, 36361 checked: id === activeOption, 36362 onChange: () => { 36363 onChangePreviewOption?.(id); 36364 focusPreviewOptionsField(id); 36365 }, 36366 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { 36367 children: label 36368 }) 36369 }, id); 36370 }) 36371 })] 36372 }); 36373 } 36374 function FieldItem({ 36375 field, 36376 label, 36377 description, 36378 isVisible, 36379 isFirst, 36380 isLast, 36381 canMove = true, 36382 onToggleVisibility, 36383 onMoveUp, 36384 onMoveDown, 36385 previewOptions, 36386 onChangePreviewOption 36387 }) { 36388 const [isChangingPreviewOption, setIsChangingPreviewOption] = (0,external_wp_element_namespaceObject.useState)(false); 36389 const focusVisibilityField = () => { 36390 // Focus the visibility button to avoid focus loss. 36391 // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. 36392 // eslint-disable-next-line @wordpress/react-no-unsafe-timeout 36393 setTimeout(() => { 36394 const element = document.querySelector(`.dataviews-field-control__field-$field.id} .dataviews-field-control__field-visibility-button`); 36395 if (element instanceof HTMLElement) { 36396 element.focus(); 36397 } 36398 }, 50); 36399 }; 36400 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 36401 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36402 expanded: true, 36403 className: dist_clsx('dataviews-field-control__field', `dataviews-field-control__field-$field.id}`, 36404 // The actions are hidden when the mouse is not hovering the item, or focus 36405 // is outside the item. 36406 // For actions that require a popover, a menu etc, that would mean that when the interactive element 36407 // opens and the focus goes there the actions would be hidden. 36408 // To avoid that we add a class to the item, that makes sure actions are visible while there is some 36409 // interaction with the item. 36410 { 36411 'is-interacting': isChangingPreviewOption 36412 }), 36413 justify: "flex-start", 36414 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36415 className: "dataviews-field-control__icon", 36416 children: !canMove && !field.enableHiding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 36417 icon: library_lock 36418 }) 36419 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 36420 className: "dataviews-field-control__label-sub-label-container", 36421 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36422 className: "dataviews-field-control__label", 36423 children: label || field.label 36424 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36425 className: "dataviews-field-control__sub-label", 36426 children: description 36427 })] 36428 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36429 justify: "flex-end", 36430 expanded: false, 36431 className: "dataviews-field-control__actions", 36432 children: [isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 36433 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36434 disabled: isFirst || !canMove, 36435 accessibleWhenDisabled: true, 36436 size: "compact", 36437 onClick: onMoveUp, 36438 icon: chevron_up, 36439 label: isFirst || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved up") : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36440 (0,external_wp_i18n_namespaceObject.__)('Move %s up'), field.label) 36441 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36442 disabled: isLast || !canMove, 36443 accessibleWhenDisabled: true, 36444 size: "compact", 36445 onClick: onMoveDown, 36446 icon: chevron_down, 36447 label: isLast || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved down") : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36448 (0,external_wp_i18n_namespaceObject.__)('Move %s down'), field.label) 36449 })] 36450 }), onToggleVisibility && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36451 className: "dataviews-field-control__field-visibility-button", 36452 disabled: !field.enableHiding, 36453 accessibleWhenDisabled: true, 36454 size: "compact", 36455 onClick: () => { 36456 onToggleVisibility(); 36457 focusVisibilityField(); 36458 }, 36459 icon: isVisible ? library_unseen : library_seen, 36460 label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36461 (0,external_wp_i18n_namespaceObject._x)('Hide %s', 'field'), field.label) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36462 (0,external_wp_i18n_namespaceObject._x)('Show %s', 'field'), field.label) 36463 }), previewOptions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewOptions, { 36464 previewOptions: previewOptions, 36465 onChangePreviewOption: onChangePreviewOption, 36466 onMenuOpenChange: setIsChangingPreviewOption, 36467 activeOption: field.id 36468 })] 36469 })] 36470 }) 36471 }); 36472 } 36473 function RegularFieldItem({ 36474 index, 36475 field, 36476 view, 36477 onChangeView 36478 }) { 36479 var _view$fields; 36480 const visibleFieldIds = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 36481 const isVisible = index !== undefined && visibleFieldIds.includes(field.id); 36482 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36483 field: field, 36484 isVisible: isVisible, 36485 isFirst: index !== undefined && index < 1, 36486 isLast: index !== undefined && index === visibleFieldIds.length - 1, 36487 onToggleVisibility: () => { 36488 onChangeView({ 36489 ...view, 36490 fields: isVisible ? visibleFieldIds.filter(fieldId => fieldId !== field.id) : [...visibleFieldIds, field.id] 36491 }); 36492 }, 36493 onMoveUp: index !== undefined ? () => { 36494 var _visibleFieldIds$slic; 36495 onChangeView({ 36496 ...view, 36497 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), field.id, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 36498 }); 36499 } : undefined, 36500 onMoveDown: index !== undefined ? () => { 36501 var _visibleFieldIds$slic2; 36502 onChangeView({ 36503 ...view, 36504 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], field.id, ...visibleFieldIds.slice(index + 2)] 36505 }); 36506 } : undefined 36507 }); 36508 } 36509 function dataviews_view_config_isDefined(item) { 36510 return !!item; 36511 } 36512 function FieldControl() { 36513 var _view$fields2; 36514 const { 36515 view, 36516 fields, 36517 onChangeView 36518 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36519 const togglableFields = [view?.titleField, view?.mediaField, view?.descriptionField].filter(Boolean); 36520 const visibleFieldIds = (_view$fields2 = view.fields) !== null && _view$fields2 !== void 0 ? _view$fields2 : []; 36521 const hiddenFields = fields.filter(f => !visibleFieldIds.includes(f.id) && !togglableFields.includes(f.id) && f.type !== 'media'); 36522 const visibleFields = visibleFieldIds.map(fieldId => fields.find(f => f.id === fieldId)).filter(dataviews_view_config_isDefined); 36523 if (!visibleFields?.length && !hiddenFields?.length) { 36524 return null; 36525 } 36526 const titleField = fields.find(f => f.id === view.titleField); 36527 const previewField = fields.find(f => f.id === view.mediaField); 36528 const descriptionField = fields.find(f => f.id === view.descriptionField); 36529 const previewFields = fields.filter(f => f.type === 'media'); 36530 let previewFieldUI; 36531 if (previewFields.length > 1) { 36532 var _view$showMedia; 36533 const isPreviewFieldVisible = dataviews_view_config_isDefined(previewField) && ((_view$showMedia = view.showMedia) !== null && _view$showMedia !== void 0 ? _view$showMedia : true); 36534 previewFieldUI = dataviews_view_config_isDefined(previewField) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36535 field: previewField, 36536 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 36537 description: previewField.label, 36538 isVisible: isPreviewFieldVisible, 36539 onToggleVisibility: () => { 36540 onChangeView({ 36541 ...view, 36542 showMedia: !isPreviewFieldVisible 36543 }); 36544 }, 36545 canMove: false, 36546 previewOptions: previewFields.map(field => ({ 36547 label: field.label, 36548 id: field.id 36549 })), 36550 onChangePreviewOption: newPreviewId => onChangeView({ 36551 ...view, 36552 mediaField: newPreviewId 36553 }) 36554 }, previewField.id); 36555 } 36556 const lockedFields = [{ 36557 field: titleField, 36558 isVisibleFlag: 'showTitle' 36559 }, { 36560 field: previewField, 36561 isVisibleFlag: 'showMedia', 36562 ui: previewFieldUI 36563 }, { 36564 field: descriptionField, 36565 isVisibleFlag: 'showDescription' 36566 }].filter(({ 36567 field 36568 }) => dataviews_view_config_isDefined(field)); 36569 const visibleLockedFields = lockedFields.filter(({ 36570 field, 36571 isVisibleFlag 36572 }) => { 36573 var _view$isVisibleFlag; 36574 return ( 36575 // @ts-expect-error 36576 dataviews_view_config_isDefined(field) && ((_view$isVisibleFlag = view[isVisibleFlag]) !== null && _view$isVisibleFlag !== void 0 ? _view$isVisibleFlag : true) 36577 ); 36578 }); 36579 const hiddenLockedFields = lockedFields.filter(({ 36580 field, 36581 isVisibleFlag 36582 }) => { 36583 var _view$isVisibleFlag2; 36584 return ( 36585 // @ts-expect-error 36586 dataviews_view_config_isDefined(field) && !((_view$isVisibleFlag2 = view[isVisibleFlag]) !== null && _view$isVisibleFlag2 !== void 0 ? _view$isVisibleFlag2 : true) 36587 ); 36588 }); 36589 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 36590 className: "dataviews-field-control", 36591 spacing: 6, 36592 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 36593 className: "dataviews-view-config__properties", 36594 spacing: 0, 36595 children: (visibleLockedFields.length > 0 || !!visibleFields?.length) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 36596 isBordered: true, 36597 isSeparated: true, 36598 children: [visibleLockedFields.map(({ 36599 field, 36600 isVisibleFlag, 36601 ui 36602 }) => { 36603 return ui !== null && ui !== void 0 ? ui : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36604 field: field, 36605 isVisible: true, 36606 onToggleVisibility: () => { 36607 onChangeView({ 36608 ...view, 36609 [isVisibleFlag]: false 36610 }); 36611 }, 36612 canMove: false 36613 }, field.id); 36614 }), visibleFields.map((field, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegularFieldItem, { 36615 field: field, 36616 view: view, 36617 onChangeView: onChangeView, 36618 index: index 36619 }, field.id))] 36620 }) 36621 }), (!!hiddenFields?.length || !!hiddenLockedFields.length) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 36622 spacing: 4, 36623 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 36624 style: { 36625 margin: 0 36626 }, 36627 children: (0,external_wp_i18n_namespaceObject.__)('Hidden') 36628 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 36629 className: "dataviews-view-config__properties", 36630 spacing: 0, 36631 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 36632 isBordered: true, 36633 isSeparated: true, 36634 children: [hiddenLockedFields.length > 0 && hiddenLockedFields.map(({ 36635 field, 36636 isVisibleFlag, 36637 ui 36638 }) => { 36639 return ui !== null && ui !== void 0 ? ui : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36640 field: field, 36641 isVisible: false, 36642 onToggleVisibility: () => { 36643 onChangeView({ 36644 ...view, 36645 [isVisibleFlag]: true 36646 }); 36647 }, 36648 canMove: false 36649 }, field.id); 36650 }), hiddenFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegularFieldItem, { 36651 field: field, 36652 view: view, 36653 onChangeView: onChangeView 36654 }, field.id))] 36655 }) 36656 })] 36657 })] 36658 }); 36659 } 36660 function SettingsSection({ 36661 title, 36662 description, 36663 children 36664 }) { 36665 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 36666 columns: 12, 36667 className: "dataviews-settings-section", 36668 gap: 4, 36669 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 36670 className: "dataviews-settings-section__sidebar", 36671 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 36672 level: 2, 36673 className: "dataviews-settings-section__title", 36674 children: title 36675 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 36676 variant: "muted", 36677 className: "dataviews-settings-section__description", 36678 children: description 36679 })] 36680 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 36681 columns: 8, 36682 gap: 4, 36683 className: "dataviews-settings-section__content", 36684 children: children 36685 })] 36686 }); 36687 } 36688 function DataviewsViewConfigDropdown() { 36689 const { 36690 view 36691 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36692 const popoverId = (0,external_wp_compose_namespaceObject.useInstanceId)(_DataViewsViewConfig, 'dataviews-view-config-dropdown'); 36693 const activeLayout = VIEW_LAYOUTS.find(layout => layout.type === view.type); 36694 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 36695 expandOnMobile: true, 36696 popoverProps: { 36697 ...DATAVIEWS_CONFIG_POPOVER_PROPS, 36698 id: popoverId 36699 }, 36700 renderToggle: ({ 36701 onToggle, 36702 isOpen 36703 }) => { 36704 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36705 size: "compact", 36706 icon: library_cog, 36707 label: (0,external_wp_i18n_namespaceObject._x)('View options', 'View is used as a noun'), 36708 onClick: onToggle, 36709 "aria-expanded": isOpen ? 'true' : 'false', 36710 "aria-controls": popoverId 36711 }); 36712 }, 36713 renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { 36714 paddingSize: "medium", 36715 className: "dataviews-config__popover-content-wrapper", 36716 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 36717 className: "dataviews-view-config", 36718 spacing: 6, 36719 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { 36720 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 36721 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36722 expanded: true, 36723 className: "is-divided-in-two", 36724 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {})] 36725 }), !!activeLayout?.viewConfigOptions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(activeLayout.viewConfigOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {})] 36726 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { 36727 title: (0,external_wp_i18n_namespaceObject.__)('Properties'), 36728 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) 36729 })] 36730 }) 36731 }) 36732 }); 36733 } 36734 function _DataViewsViewConfig({ 36735 defaultLayouts = { 36736 list: {}, 36737 grid: {}, 36738 table: {} 36739 } 36740 }) { 36741 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 36742 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, { 36743 defaultLayouts: defaultLayouts 36744 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigDropdown, {})] 36745 }); 36746 } 36747 const DataViewsViewConfig = (0,external_wp_element_namespaceObject.memo)(_DataViewsViewConfig); 36748 /* harmony default export */ const dataviews_view_config = (DataViewsViewConfig); 36749 36750 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js 36751 /* wp:polyfill */ 36752 /** 36753 * External dependencies 36754 */ 36755 36756 /** 36757 * WordPress dependencies 36758 */ 36759 36760 36761 36762 36763 /** 36764 * Internal dependencies 36765 */ 36766 36767 36768 36769 36770 36771 36772 36773 36774 const defaultGetItemId = item => item.id; 36775 const defaultIsItemClickable = () => true; 36776 const dataviews_EMPTY_ARRAY = []; 36777 function DataViews({ 36778 view, 36779 onChangeView, 36780 fields, 36781 search = true, 36782 searchLabel = undefined, 36783 actions = dataviews_EMPTY_ARRAY, 36784 data, 36785 getItemId = defaultGetItemId, 36786 getItemLevel, 36787 isLoading = false, 36788 paginationInfo, 36789 defaultLayouts, 36790 selection: selectionProperty, 36791 onChangeSelection, 36792 onClickItem, 36793 isItemClickable = defaultIsItemClickable, 36794 header 36795 }) { 36796 const [containerWidth, setContainerWidth] = (0,external_wp_element_namespaceObject.useState)(0); 36797 const containerRef = (0,external_wp_compose_namespaceObject.useResizeObserver)(resizeObserverEntries => { 36798 setContainerWidth(resizeObserverEntries[0].borderBoxSize[0].inlineSize); 36799 }, { 36800 box: 'border-box' 36801 }); 36802 const [selectionState, setSelectionState] = (0,external_wp_element_namespaceObject.useState)([]); 36803 const isUncontrolled = selectionProperty === undefined || onChangeSelection === undefined; 36804 const selection = isUncontrolled ? selectionState : selectionProperty; 36805 const [openedFilter, setOpenedFilter] = (0,external_wp_element_namespaceObject.useState)(null); 36806 function setSelectionWithChange(value) { 36807 const newValue = typeof value === 'function' ? value(selection) : value; 36808 if (isUncontrolled) { 36809 setSelectionState(newValue); 36810 } 36811 if (onChangeSelection) { 36812 onChangeSelection(newValue); 36813 } 36814 } 36815 const _fields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); 36816 const _selection = (0,external_wp_element_namespaceObject.useMemo)(() => { 36817 return selection.filter(id => data.some(item => getItemId(item) === id)); 36818 }, [selection, data, getItemId]); 36819 const filters = useFilters(_fields, view); 36820 const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_namespaceObject.useState)(() => (filters || []).some(filter => filter.isPrimary)); 36821 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_context.Provider, { 36822 value: { 36823 view, 36824 onChangeView, 36825 fields: _fields, 36826 actions, 36827 data, 36828 isLoading, 36829 paginationInfo, 36830 selection: _selection, 36831 onChangeSelection: setSelectionWithChange, 36832 openedFilter, 36833 setOpenedFilter, 36834 getItemId, 36835 getItemLevel, 36836 isItemClickable, 36837 onClickItem, 36838 containerWidth 36839 }, 36840 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 36841 className: "dataviews-wrapper", 36842 ref: containerRef, 36843 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36844 alignment: "top", 36845 justify: "space-between", 36846 className: "dataviews__view-actions", 36847 spacing: 1, 36848 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36849 justify: "start", 36850 expanded: false, 36851 className: "dataviews__search", 36852 children: [search && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search, { 36853 label: searchLabel 36854 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FiltersToggle, { 36855 filters: filters, 36856 view: view, 36857 onChangeView: onChangeView, 36858 setOpenedFilter: setOpenedFilter, 36859 setIsShowingFilter: setIsShowingFilter, 36860 isShowingFilter: isShowingFilter 36861 })] 36862 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36863 spacing: 1, 36864 expanded: false, 36865 style: { 36866 flexShrink: 0 36867 }, 36868 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config, { 36869 defaultLayouts: defaultLayouts 36870 }), header] 36871 })] 36872 }), isShowingFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_filters, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {})] 36873 }) 36874 }); 36875 } 36876 36877 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js 36878 /* wp:polyfill */ 36879 /** 36880 * WordPress dependencies 36881 */ 36882 36883 36884 36885 36886 /** 36887 * Internal dependencies 36888 */ 36889 36890 36891 36892 function usePatternSettings() { 36893 var _storedSettings$__exp; 36894 const storedSettings = (0,external_wp_data_namespaceObject.useSelect)(select => { 36895 const { 36896 getSettings 36897 } = unlock(select(store)); 36898 return getSettings(); 36899 }, []); 36900 const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : 36901 // WP 6.0 36902 storedSettings.__experimentalBlockPatterns; // WP 5.9 36903 36904 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), []); 36905 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]); 36906 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { 36907 const { 36908 __experimentalAdditionalBlockPatterns, 36909 ...restStoredSettings 36910 } = storedSettings; 36911 return { 36912 ...restStoredSettings, 36913 __experimentalBlockPatterns: blockPatterns, 36914 isPreviewMode: true 36915 }; 36916 }, [storedSettings, blockPatterns]); 36917 return settings; 36918 } 36919 36920 ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 36921 /** 36922 * WordPress dependencies 36923 */ 36924 36925 36926 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36927 xmlns: "http://www.w3.org/2000/svg", 36928 viewBox: "0 0 24 24", 36929 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36930 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" 36931 }) 36932 }); 36933 /* harmony default export */ const symbol_filled = (symbolFilled); 36934 36935 ;// ./node_modules/@wordpress/icons/build-module/library/upload.js 36936 /** 36937 * WordPress dependencies 36938 */ 36939 36940 36941 const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36942 xmlns: "http://www.w3.org/2000/svg", 36943 viewBox: "0 0 24 24", 36944 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36945 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" 36946 }) 36947 }); 36948 /* harmony default export */ const library_upload = (upload); 36949 36950 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js 36951 /* wp:polyfill */ 36952 /** 36953 * WordPress dependencies 36954 */ 36955 36956 36957 36958 36959 36960 36961 36962 36963 36964 36965 36966 /** 36967 * Internal dependencies 36968 */ 36969 36970 36971 36972 const { 36973 useHistory: add_new_pattern_useHistory, 36974 useLocation: add_new_pattern_useLocation 36975 } = unlock(external_wp_router_namespaceObject.privateApis); 36976 const { 36977 CreatePatternModal, 36978 useAddPatternCategory 36979 } = unlock(external_wp_patterns_namespaceObject.privateApis); 36980 const { 36981 CreateTemplatePartModal 36982 } = unlock(external_wp_editor_namespaceObject.privateApis); 36983 function AddNewPattern() { 36984 const history = add_new_pattern_useHistory(); 36985 const location = add_new_pattern_useLocation(); 36986 const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false); 36987 const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false); 36988 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 36989 const { 36990 createPatternFromFile 36991 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store)); 36992 const { 36993 createSuccessNotice, 36994 createErrorNotice 36995 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 36996 const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)(); 36997 const { 36998 isBlockBasedTheme, 36999 addNewPatternLabel, 37000 addNewTemplatePartLabel, 37001 canCreatePattern, 37002 canCreateTemplatePart 37003 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 37004 const { 37005 getCurrentTheme, 37006 getPostType, 37007 canUser 37008 } = select(external_wp_coreData_namespaceObject.store); 37009 return { 37010 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 37011 addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, 37012 addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, 37013 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 37014 canCreatePattern: canUser('create', { 37015 kind: 'postType', 37016 name: PATTERN_TYPES.user 37017 }), 37018 canCreateTemplatePart: canUser('create', { 37019 kind: 'postType', 37020 name: TEMPLATE_PART_POST_TYPE 37021 }) 37022 }; 37023 }, []); 37024 function handleCreatePattern({ 37025 pattern 37026 }) { 37027 setShowPatternModal(false); 37028 history.navigate(`/$PATTERN_TYPES.user}/$pattern.id}?canvas=edit`); 37029 } 37030 function handleCreateTemplatePart(templatePart) { 37031 setShowTemplatePartModal(false); 37032 history.navigate(`/$TEMPLATE_PART_POST_TYPE}/$templatePart.id}?canvas=edit`); 37033 } 37034 function handleError() { 37035 setShowPatternModal(false); 37036 setShowTemplatePartModal(false); 37037 } 37038 const controls = []; 37039 if (canCreatePattern) { 37040 controls.push({ 37041 icon: library_symbol, 37042 onClick: () => setShowPatternModal(true), 37043 title: addNewPatternLabel 37044 }); 37045 } 37046 if (isBlockBasedTheme && canCreateTemplatePart) { 37047 controls.push({ 37048 icon: symbol_filled, 37049 onClick: () => setShowTemplatePartModal(true), 37050 title: addNewTemplatePartLabel 37051 }); 37052 } 37053 if (canCreatePattern) { 37054 controls.push({ 37055 icon: library_upload, 37056 onClick: () => { 37057 patternUploadInputRef.current.click(); 37058 }, 37059 title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON') 37060 }); 37061 } 37062 const { 37063 categoryMap, 37064 findOrCreateTerm 37065 } = useAddPatternCategory(); 37066 if (controls.length === 0) { 37067 return null; 37068 } 37069 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37070 children: [addNewPatternLabel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 37071 controls: controls, 37072 icon: null, 37073 toggleProps: { 37074 variant: 'primary', 37075 showTooltip: false, 37076 __next40pxDefaultSize: true 37077 }, 37078 text: addNewPatternLabel, 37079 label: addNewPatternLabel 37080 }), showPatternModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModal, { 37081 onClose: () => setShowPatternModal(false), 37082 onSuccess: handleCreatePattern, 37083 onError: handleError 37084 }), showTemplatePartModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { 37085 closeModal: () => setShowTemplatePartModal(false), 37086 blocks: [], 37087 onCreate: handleCreateTemplatePart, 37088 onError: handleError 37089 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 37090 type: "file", 37091 accept: ".json", 37092 hidden: true, 37093 ref: patternUploadInputRef, 37094 onChange: async event => { 37095 const file = event.target.files?.[0]; 37096 if (!file) { 37097 return; 37098 } 37099 try { 37100 let currentCategoryId; 37101 // When we're not handling template parts, we should 37102 // add or create the proper pattern category. 37103 if (location.query.postType !== TEMPLATE_PART_POST_TYPE) { 37104 /* 37105 * categoryMap.values() returns an iterator. 37106 * Iterator.prototype.find() is not yet widely supported. 37107 * Convert to array to use the Array.prototype.find method. 37108 */ 37109 const currentCategory = Array.from(categoryMap.values()).find(term => term.name === location.query.categoryId); 37110 if (currentCategory) { 37111 currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label)); 37112 } 37113 } 37114 const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined); 37115 37116 // Navigate to the All patterns category for the newly created pattern 37117 // if we're not on that page already and if we're not in the `my-patterns` 37118 // category. 37119 if (!currentCategoryId && location.query.categoryId !== 'my-patterns') { 37120 history.navigate(`/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}`); 37121 } 37122 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 37123 // translators: %s: The imported pattern's title. 37124 (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), { 37125 type: 'snackbar', 37126 id: 'import-pattern-success' 37127 }); 37128 } catch (err) { 37129 createErrorNotice(err.message, { 37130 type: 'snackbar', 37131 id: 'import-pattern-error' 37132 }); 37133 } finally { 37134 event.target.value = ''; 37135 } 37136 } 37137 })] 37138 }); 37139 } 37140 37141 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js 37142 /** 37143 * WordPress dependencies 37144 */ 37145 37146 37147 37148 37149 /** 37150 * Internal dependencies 37151 */ 37152 37153 37154 /** 37155 * Internal dependencies 37156 */ 37157 37158 37159 const { 37160 RenamePatternCategoryModal 37161 } = unlock(external_wp_patterns_namespaceObject.privateApis); 37162 function RenameCategoryMenuItem({ 37163 category, 37164 onClose 37165 }) { 37166 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 37167 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37168 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 37169 onClick: () => setIsModalOpen(true), 37170 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 37171 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_category_menu_item_RenameModal, { 37172 category: category, 37173 onClose: () => { 37174 setIsModalOpen(false); 37175 onClose(); 37176 } 37177 })] 37178 }); 37179 } 37180 function rename_category_menu_item_RenameModal({ 37181 category, 37182 onClose 37183 }) { 37184 // User created pattern categories have their properties updated when 37185 // retrieved via `getUserPatternCategories`. The rename modal expects an 37186 // object that will match the pattern category entity. 37187 const normalizedCategory = { 37188 id: category.id, 37189 slug: category.slug, 37190 name: category.label 37191 }; 37192 37193 // Optimization - only use pattern categories when the modal is open. 37194 const existingCategories = usePatternCategories(); 37195 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternCategoryModal, { 37196 category: normalizedCategory, 37197 existingCategories: existingCategories, 37198 onClose: onClose, 37199 overlayClassName: "edit-site-list__rename-modal", 37200 focusOnMount: "firstContentElement", 37201 size: "small" 37202 }); 37203 } 37204 37205 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js 37206 /** 37207 * WordPress dependencies 37208 */ 37209 37210 37211 37212 37213 37214 37215 37216 37217 37218 /** 37219 * Internal dependencies 37220 */ 37221 37222 37223 37224 const { 37225 useHistory: delete_category_menu_item_useHistory 37226 } = unlock(external_wp_router_namespaceObject.privateApis); 37227 function DeleteCategoryMenuItem({ 37228 category, 37229 onClose 37230 }) { 37231 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 37232 const history = delete_category_menu_item_useHistory(); 37233 const { 37234 createSuccessNotice, 37235 createErrorNotice 37236 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 37237 const { 37238 deleteEntityRecord, 37239 invalidateResolution 37240 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 37241 const onDelete = async () => { 37242 try { 37243 await deleteEntityRecord('taxonomy', 'wp_pattern_category', category.id, { 37244 force: true 37245 }, { 37246 throwOnError: true 37247 }); 37248 37249 // Prevent the need to refresh the page to get up-to-date categories 37250 // and pattern categorization. 37251 invalidateResolution('getUserPatternCategories'); 37252 invalidateResolution('getEntityRecords', ['postType', PATTERN_TYPES.user, { 37253 per_page: -1 37254 }]); 37255 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The pattern category's name */ 37256 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'pattern category'), category.label), { 37257 type: 'snackbar', 37258 id: 'pattern-category-delete' 37259 }); 37260 onClose?.(); 37261 history.navigate(`/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}`); 37262 } catch (error) { 37263 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the pattern category.'); 37264 createErrorNotice(errorMessage, { 37265 type: 'snackbar', 37266 id: 'pattern-category-delete' 37267 }); 37268 } 37269 }; 37270 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37271 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 37272 isDestructive: true, 37273 onClick: () => setIsModalOpen(true), 37274 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 37275 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 37276 isOpen: isModalOpen, 37277 onConfirm: onDelete, 37278 onCancel: () => setIsModalOpen(false), 37279 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 37280 className: "edit-site-patterns__delete-modal", 37281 title: (0,external_wp_i18n_namespaceObject.sprintf)( 37282 // translators: %s: The pattern category's name. 37283 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'pattern category'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)), 37284 size: "medium", 37285 __experimentalHideHeader: false, 37286 children: (0,external_wp_i18n_namespaceObject.sprintf)( 37287 // translators: %s: The pattern category's name. 37288 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)) 37289 })] 37290 }); 37291 } 37292 37293 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/header.js 37294 /* wp:polyfill */ 37295 /** 37296 * WordPress dependencies 37297 */ 37298 37299 37300 37301 37302 37303 37304 /** 37305 * Internal dependencies 37306 */ 37307 37308 37309 37310 37311 37312 37313 function PatternsHeader({ 37314 categoryId, 37315 type, 37316 titleId, 37317 descriptionId 37318 }) { 37319 const { 37320 patternCategories 37321 } = usePatternCategories(); 37322 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [], []); 37323 let title, description, patternCategory; 37324 if (type === TEMPLATE_PART_POST_TYPE) { 37325 const templatePartArea = templatePartAreas.find(area => area.area === categoryId); 37326 title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)('All Template Parts'); 37327 description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)('Includes every template part defined for any area.'); 37328 } else if (type === PATTERN_TYPES.user && !!categoryId) { 37329 patternCategory = patternCategories.find(category => category.name === categoryId); 37330 title = patternCategory?.label; 37331 description = patternCategory?.description; 37332 } 37333 if (!title) { 37334 return null; 37335 } 37336 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37337 className: "edit-site-patterns__section-header", 37338 spacing: 1, 37339 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37340 justify: "space-between", 37341 className: "edit-site-patterns__title", 37342 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 37343 as: "h2", 37344 level: 3, 37345 id: titleId, 37346 weight: 500, 37347 truncate: true, 37348 children: title 37349 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37350 expanded: false, 37351 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}), !!patternCategory?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 37352 icon: more_vertical, 37353 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 37354 toggleProps: { 37355 className: 'edit-site-patterns__button', 37356 description: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: pattern category name */ 37357 (0,external_wp_i18n_namespaceObject.__)('Action menu for %s pattern category'), title), 37358 size: 'compact' 37359 }, 37360 children: ({ 37361 onClose 37362 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 37363 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameCategoryMenuItem, { 37364 category: patternCategory, 37365 onClose: onClose 37366 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteCategoryMenuItem, { 37367 category: patternCategory, 37368 onClose: onClose 37369 })] 37370 }) 37371 })] 37372 })] 37373 }), description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37374 variant: "muted", 37375 as: "p", 37376 id: descriptionId, 37377 className: "edit-site-patterns__sub-title", 37378 children: description 37379 }) : null] 37380 }); 37381 } 37382 37383 ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js 37384 /** 37385 * WordPress dependencies 37386 */ 37387 37388 37389 const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37390 xmlns: "http://www.w3.org/2000/svg", 37391 viewBox: "0 0 24 24", 37392 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37393 d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" 37394 }) 37395 }); 37396 /* harmony default export */ const library_pencil = (pencil); 37397 37398 ;// ./node_modules/@wordpress/icons/build-module/library/edit.js 37399 /** 37400 * Internal dependencies 37401 */ 37402 37403 37404 /* harmony default export */ const edit = (library_pencil); 37405 37406 ;// ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js 37407 /** 37408 * WordPress dependencies 37409 */ 37410 37411 37412 37413 37414 37415 /** 37416 * Internal dependencies 37417 */ 37418 37419 37420 const { 37421 useHistory: dataviews_actions_useHistory 37422 } = unlock(external_wp_router_namespaceObject.privateApis); 37423 const useEditPostAction = () => { 37424 const history = dataviews_actions_useHistory(); 37425 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ 37426 id: 'edit-post', 37427 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 37428 isPrimary: true, 37429 icon: edit, 37430 isEligible(post) { 37431 if (post.status === 'trash') { 37432 return false; 37433 } 37434 // It's eligible for all post types except theme patterns. 37435 return post.type !== PATTERN_TYPES.theme; 37436 }, 37437 callback(items) { 37438 const post = items[0]; 37439 history.navigate(`/$post.type}/$post.id}?canvas=edit`); 37440 } 37441 }), [history]); 37442 }; 37443 37444 ;// ./node_modules/@wordpress/icons/build-module/library/plugins.js 37445 /** 37446 * WordPress dependencies 37447 */ 37448 37449 37450 const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37451 xmlns: "http://www.w3.org/2000/svg", 37452 viewBox: "0 0 24 24", 37453 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37454 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" 37455 }) 37456 }); 37457 /* harmony default export */ const library_plugins = (plugins); 37458 37459 ;// ./node_modules/@wordpress/icons/build-module/library/globe.js 37460 /** 37461 * WordPress dependencies 37462 */ 37463 37464 37465 const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37466 xmlns: "http://www.w3.org/2000/svg", 37467 viewBox: "0 0 24 24", 37468 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37469 d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" 37470 }) 37471 }); 37472 /* harmony default export */ const library_globe = (globe); 37473 37474 ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 37475 /** 37476 * WordPress dependencies 37477 */ 37478 37479 37480 const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37481 xmlns: "http://www.w3.org/2000/svg", 37482 viewBox: "0 0 24 24", 37483 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37484 fillRule: "evenodd", 37485 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", 37486 clipRule: "evenodd" 37487 }) 37488 }); 37489 /* harmony default export */ const comment_author_avatar = (commentAuthorAvatar); 37490 37491 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js 37492 /** 37493 * WordPress dependencies 37494 */ 37495 37496 37497 37498 37499 /** 37500 * Internal dependencies 37501 */ 37502 37503 37504 /** @typedef {'wp_template'|'wp_template_part'} TemplateType */ 37505 37506 /** 37507 * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType 37508 * 37509 * @typedef AddedByData 37510 * @type {Object} 37511 * @property {AddedByType} type The type of the data. 37512 * @property {JSX.Element} icon The icon to display. 37513 * @property {string} [imageUrl] The optional image URL to display. 37514 * @property {string} [text] The text to display. 37515 * @property {boolean} isCustomized Whether the template has been customized. 37516 * 37517 * @param {TemplateType} postType The template post type. 37518 * @param {number} postId The template post id. 37519 * @return {AddedByData} The added by object or null. 37520 */ 37521 function useAddedBy(postType, postId) { 37522 return (0,external_wp_data_namespaceObject.useSelect)(select => { 37523 const { 37524 getEntityRecord, 37525 getMedia, 37526 getUser, 37527 getEditedEntityRecord 37528 } = select(external_wp_coreData_namespaceObject.store); 37529 const template = getEditedEntityRecord('postType', postType, postId); 37530 const originalSource = template?.original_source; 37531 const authorText = template?.author_text; 37532 switch (originalSource) { 37533 case 'theme': 37534 { 37535 return { 37536 type: originalSource, 37537 icon: library_layout, 37538 text: authorText, 37539 isCustomized: template.source === TEMPLATE_ORIGINS.custom 37540 }; 37541 } 37542 case 'plugin': 37543 { 37544 return { 37545 type: originalSource, 37546 icon: library_plugins, 37547 text: authorText, 37548 isCustomized: template.source === TEMPLATE_ORIGINS.custom 37549 }; 37550 } 37551 case 'site': 37552 { 37553 const siteData = getEntityRecord('root', '__unstableBase'); 37554 return { 37555 type: originalSource, 37556 icon: library_globe, 37557 imageUrl: siteData?.site_logo ? getMedia(siteData.site_logo)?.source_url : undefined, 37558 text: authorText, 37559 isCustomized: false 37560 }; 37561 } 37562 default: 37563 { 37564 const user = getUser(template.author); 37565 return { 37566 type: 'user', 37567 icon: comment_author_avatar, 37568 imageUrl: user?.avatar_urls?.[48], 37569 text: authorText, 37570 isCustomized: false 37571 }; 37572 } 37573 } 37574 }, [postType, postId]); 37575 } 37576 37577 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js 37578 /* wp:polyfill */ 37579 /** 37580 * External dependencies 37581 */ 37582 37583 37584 /** 37585 * WordPress dependencies 37586 */ 37587 37588 37589 37590 37591 37592 37593 37594 /** 37595 * Internal dependencies 37596 */ 37597 37598 37599 37600 37601 const { 37602 useGlobalStyle: fields_useGlobalStyle 37603 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 37604 function PreviewField({ 37605 item 37606 }) { 37607 const descriptionId = (0,external_wp_element_namespaceObject.useId)(); 37608 const description = item.description || item?.excerpt?.raw; 37609 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; 37610 const [backgroundColor] = fields_useGlobalStyle('color.background'); 37611 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 37612 var _item$blocks; 37613 return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, { 37614 __unstableSkipMigrationLogs: true 37615 }); 37616 }, [item?.content?.raw, item.blocks]); 37617 const isEmpty = !blocks?.length; 37618 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 37619 className: "page-patterns-preview-field", 37620 style: { 37621 backgroundColor 37622 }, 37623 "aria-describedby": !!description ? descriptionId : undefined, 37624 children: [isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty template part'), isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty pattern'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { 37625 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 37626 blocks: blocks, 37627 viewportWidth: item.viewportWidth 37628 }) 37629 }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37630 hidden: true, 37631 id: descriptionId, 37632 children: description 37633 })] 37634 }); 37635 } 37636 const previewField = { 37637 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 37638 id: 'preview', 37639 render: PreviewField, 37640 enableSorting: false 37641 }; 37642 const SYNC_FILTERS = [{ 37643 value: PATTERN_SYNC_TYPES.full, 37644 label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), 37645 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that are kept in sync across the site.') 37646 }, { 37647 value: PATTERN_SYNC_TYPES.unsynced, 37648 label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)'), 37649 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that can be changed freely without affecting the site.') 37650 }]; 37651 const patternStatusField = { 37652 label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), 37653 id: 'sync-status', 37654 render: ({ 37655 item 37656 }) => { 37657 const syncStatus = 'wp_pattern_sync_status' in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced; 37658 // User patterns can have their sync statuses checked directly. 37659 // Non-user patterns are all unsynced for the time being. 37660 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 37661 className: `edit-site-patterns__field-sync-status-$syncStatus}`, 37662 children: SYNC_FILTERS.find(({ 37663 value 37664 }) => value === syncStatus).label 37665 }); 37666 }, 37667 elements: SYNC_FILTERS, 37668 filterBy: { 37669 operators: [OPERATOR_IS], 37670 isPrimary: true 37671 }, 37672 enableSorting: false 37673 }; 37674 function AuthorField({ 37675 item 37676 }) { 37677 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 37678 const { 37679 text, 37680 icon, 37681 imageUrl 37682 } = useAddedBy(item.type, item.id); 37683 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37684 alignment: "left", 37685 spacing: 0, 37686 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37687 className: dist_clsx('page-templates-author-field__avatar', { 37688 'is-loaded': isImageLoaded 37689 }), 37690 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 37691 onLoad: () => setIsImageLoaded(true), 37692 alt: "", 37693 src: imageUrl 37694 }) 37695 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37696 className: "page-templates-author-field__icon", 37697 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 37698 icon: icon 37699 }) 37700 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 37701 className: "page-templates-author-field__name", 37702 children: text 37703 })] 37704 }); 37705 } 37706 const templatePartAuthorField = { 37707 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 37708 id: 'author', 37709 getValue: ({ 37710 item 37711 }) => item.author_text, 37712 render: AuthorField, 37713 filterBy: { 37714 isPrimary: true 37715 } 37716 }; 37717 37718 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js 37719 /* wp:polyfill */ 37720 /** 37721 * WordPress dependencies 37722 */ 37723 37724 37725 37726 37727 37728 37729 37730 37731 37732 /** 37733 * Internal dependencies 37734 */ 37735 37736 37737 37738 37739 37740 37741 37742 37743 37744 const { 37745 ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider 37746 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 37747 const { 37748 usePostActions, 37749 patternTitleField 37750 } = unlock(external_wp_editor_namespaceObject.privateApis); 37751 const { 37752 useLocation: page_patterns_useLocation, 37753 useHistory: page_patterns_useHistory 37754 } = unlock(external_wp_router_namespaceObject.privateApis); 37755 const page_patterns_EMPTY_ARRAY = []; 37756 const defaultLayouts = { 37757 [LAYOUT_TABLE]: { 37758 layout: { 37759 styles: { 37760 author: { 37761 width: '1%' 37762 } 37763 } 37764 } 37765 }, 37766 [LAYOUT_GRID]: { 37767 layout: { 37768 badgeFields: ['sync-status'] 37769 } 37770 } 37771 }; 37772 const DEFAULT_VIEW = { 37773 type: LAYOUT_GRID, 37774 search: '', 37775 page: 1, 37776 perPage: 20, 37777 titleField: 'title', 37778 mediaField: 'preview', 37779 fields: ['sync-status'], 37780 filters: [], 37781 ...defaultLayouts[LAYOUT_GRID] 37782 }; 37783 function DataviewsPatterns() { 37784 const { 37785 query: { 37786 postType = 'wp_block', 37787 categoryId: categoryIdFromURL 37788 } 37789 } = page_patterns_useLocation(); 37790 const history = page_patterns_useHistory(); 37791 const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY; 37792 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_VIEW); 37793 const previousCategoryId = (0,external_wp_compose_namespaceObject.usePrevious)(categoryId); 37794 const previousPostType = (0,external_wp_compose_namespaceObject.usePrevious)(postType); 37795 const viewSyncStatus = view.filters?.find(({ 37796 field 37797 }) => field === 'sync-status')?.value; 37798 const { 37799 patterns, 37800 isResolving 37801 } = use_patterns(postType, categoryId, { 37802 search: view.search, 37803 syncStatus: viewSyncStatus 37804 }); 37805 const { 37806 records 37807 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 37808 per_page: -1 37809 }); 37810 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 37811 if (!records) { 37812 return page_patterns_EMPTY_ARRAY; 37813 } 37814 const authorsSet = new Set(); 37815 records.forEach(template => { 37816 authorsSet.add(template.author_text); 37817 }); 37818 return Array.from(authorsSet).map(author => ({ 37819 value: author, 37820 label: author 37821 })); 37822 }, [records]); 37823 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 37824 const _fields = [previewField, patternTitleField]; 37825 if (postType === PATTERN_TYPES.user) { 37826 _fields.push(patternStatusField); 37827 } else if (postType === TEMPLATE_PART_POST_TYPE) { 37828 _fields.push({ 37829 ...templatePartAuthorField, 37830 elements: authors 37831 }); 37832 } 37833 return _fields; 37834 }, [postType, authors]); 37835 37836 // Reset the page number when the category changes. 37837 (0,external_wp_element_namespaceObject.useEffect)(() => { 37838 if (previousCategoryId !== categoryId || previousPostType !== postType) { 37839 setView(prevView => ({ 37840 ...prevView, 37841 page: 1 37842 })); 37843 } 37844 }, [categoryId, previousCategoryId, previousPostType, postType]); 37845 const { 37846 data, 37847 paginationInfo 37848 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 37849 // Search is managed server-side as well as filters for patterns. 37850 // However, the author filter in template parts is done client-side. 37851 const viewWithoutFilters = { 37852 ...view 37853 }; 37854 delete viewWithoutFilters.search; 37855 if (postType !== TEMPLATE_PART_POST_TYPE) { 37856 viewWithoutFilters.filters = []; 37857 } 37858 return filterSortAndPaginate(patterns, viewWithoutFilters, fields); 37859 }, [patterns, view, fields, postType]); 37860 const dataWithPermissions = useAugmentPatternsWithPermissions(data); 37861 const templatePartActions = usePostActions({ 37862 postType: TEMPLATE_PART_POST_TYPE, 37863 context: 'list' 37864 }); 37865 const patternActions = usePostActions({ 37866 postType: PATTERN_TYPES.user, 37867 context: 'list' 37868 }); 37869 const editAction = useEditPostAction(); 37870 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { 37871 if (postType === TEMPLATE_PART_POST_TYPE) { 37872 return [editAction, ...templatePartActions].filter(Boolean); 37873 } 37874 return [editAction, ...patternActions].filter(Boolean); 37875 }, [editAction, postType, templatePartActions, patternActions]); 37876 const id = (0,external_wp_element_namespaceObject.useId)(); 37877 const settings = usePatternSettings(); 37878 // Wrap everything in a block editor provider. 37879 // This ensures 'styles' that are needed for the previews are synced 37880 // from the site editor store to the block editor store. 37881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { 37882 settings: settings, 37883 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 37884 title: (0,external_wp_i18n_namespaceObject.__)('Patterns content'), 37885 className: "edit-site-page-patterns-dataviews", 37886 hideTitleFromUI: true, 37887 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsHeader, { 37888 categoryId: categoryId, 37889 type: postType, 37890 titleId: `$id}-title`, 37891 descriptionId: `$id}-description` 37892 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 37893 paginationInfo: paginationInfo, 37894 fields: fields, 37895 actions: actions, 37896 data: dataWithPermissions || page_patterns_EMPTY_ARRAY, 37897 getItemId: item => { 37898 var _item$name; 37899 return (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id; 37900 }, 37901 isLoading: isResolving, 37902 isItemClickable: item => item.type !== PATTERN_TYPES.theme, 37903 onClickItem: item => { 37904 history.navigate(`/$item.type}/${[PATTERN_TYPES.user, TEMPLATE_PART_POST_TYPE].includes(item.type) ? item.id : item.name}?canvas=edit`); 37905 }, 37906 view: view, 37907 onChangeView: setView, 37908 defaultLayouts: defaultLayouts 37909 }, categoryId + postType)] 37910 }) 37911 }); 37912 } 37913 37914 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/patterns.js 37915 /** 37916 * Internal dependencies 37917 */ 37918 37919 37920 37921 const patternsRoute = { 37922 name: 'patterns', 37923 path: '/pattern', 37924 areas: { 37925 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 37926 backPath: "/" 37927 }), 37928 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), 37929 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}) 37930 } 37931 }; 37932 37933 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pattern-item.js 37934 /** 37935 * Internal dependencies 37936 */ 37937 37938 37939 37940 const patternItemRoute = { 37941 name: 'pattern-item', 37942 path: '/wp_block/:postId', 37943 areas: { 37944 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 37945 backPath: "/" 37946 }), 37947 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 37948 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 37949 } 37950 }; 37951 37952 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-part-item.js 37953 /** 37954 * Internal dependencies 37955 */ 37956 37957 37958 37959 const templatePartItemRoute = { 37960 name: 'template-part-item', 37961 path: '/wp_template_part/*postId', 37962 areas: { 37963 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 37964 backPath: "/" 37965 }), 37966 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeEditor, {}), 37967 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeEditor, {}) 37968 } 37969 }; 37970 37971 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js 37972 /* wp:polyfill */ 37973 /** 37974 * WordPress dependencies 37975 */ 37976 37977 37978 37979 37980 37981 37982 37983 /** 37984 * Internal dependencies 37985 */ 37986 37987 37988 37989 37990 37991 37992 const { 37993 useLocation: content_useLocation 37994 } = unlock(external_wp_router_namespaceObject.privateApis); 37995 const content_EMPTY_ARRAY = []; 37996 function TemplateDataviewItem({ 37997 template, 37998 isActive 37999 }) { 38000 const { 38001 text, 38002 icon 38003 } = useAddedBy(template.type, template.id); 38004 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38005 to: (0,external_wp_url_namespaceObject.addQueryArgs)('/template', { 38006 activeView: text 38007 }), 38008 icon: icon, 38009 "aria-current": isActive, 38010 children: text 38011 }); 38012 } 38013 function DataviewsTemplatesSidebarContent() { 38014 const { 38015 query: { 38016 activeView = 'all' 38017 } 38018 } = content_useLocation(); 38019 const { 38020 records 38021 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_POST_TYPE, { 38022 per_page: -1 38023 }); 38024 const firstItemPerAuthorText = (0,external_wp_element_namespaceObject.useMemo)(() => { 38025 var _ref; 38026 const firstItemPerAuthor = records?.reduce((acc, template) => { 38027 const author = template.author_text; 38028 if (author && !acc[author]) { 38029 acc[author] = template; 38030 } 38031 return acc; 38032 }, {}); 38033 return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : content_EMPTY_ARRAY; 38034 }, [records]); 38035 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 38036 className: "edit-site-sidebar-navigation-screen-templates-browse", 38037 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38038 to: "/template", 38039 icon: library_layout, 38040 "aria-current": activeView === 'all', 38041 children: (0,external_wp_i18n_namespaceObject.__)('All templates') 38042 }), firstItemPerAuthorText.map(template => { 38043 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateDataviewItem, { 38044 template: template, 38045 isActive: activeView === template.author_text 38046 }, template.author_text); 38047 })] 38048 }); 38049 } 38050 38051 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js 38052 /** 38053 * WordPress dependencies 38054 */ 38055 38056 38057 /** 38058 * Internal dependencies 38059 */ 38060 38061 38062 38063 function SidebarNavigationScreenTemplatesBrowse({ 38064 backPath 38065 }) { 38066 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 38067 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 38068 description: (0,external_wp_i18n_namespaceObject.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'), 38069 backPath: backPath, 38070 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, {}) 38071 }); 38072 } 38073 38074 ;// ./node_modules/@wordpress/icons/build-module/library/home.js 38075 /** 38076 * WordPress dependencies 38077 */ 38078 38079 38080 const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38081 xmlns: "http://www.w3.org/2000/svg", 38082 viewBox: "0 0 24 24", 38083 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38084 d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" 38085 }) 38086 }); 38087 /* harmony default export */ const library_home = (home); 38088 38089 ;// ./node_modules/@wordpress/icons/build-module/library/verse.js 38090 /** 38091 * WordPress dependencies 38092 */ 38093 38094 38095 const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38096 viewBox: "0 0 24 24", 38097 xmlns: "http://www.w3.org/2000/svg", 38098 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38099 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" 38100 }) 38101 }); 38102 /* harmony default export */ const library_verse = (verse); 38103 38104 ;// ./node_modules/@wordpress/icons/build-module/library/pin.js 38105 /** 38106 * WordPress dependencies 38107 */ 38108 38109 38110 const pin = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38111 xmlns: "http://www.w3.org/2000/svg", 38112 viewBox: "0 0 24 24", 38113 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38114 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" 38115 }) 38116 }); 38117 /* harmony default export */ const library_pin = (pin); 38118 38119 ;// ./node_modules/@wordpress/icons/build-module/library/archive.js 38120 /** 38121 * WordPress dependencies 38122 */ 38123 38124 38125 const archive = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38126 viewBox: "0 0 24 24", 38127 xmlns: "http://www.w3.org/2000/svg", 38128 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38129 fillRule: "evenodd", 38130 clipRule: "evenodd", 38131 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" 38132 }) 38133 }); 38134 /* harmony default export */ const library_archive = (archive); 38135 38136 ;// ./node_modules/@wordpress/icons/build-module/library/not-found.js 38137 /** 38138 * WordPress dependencies 38139 */ 38140 38141 38142 const notFound = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38143 xmlns: "http://www.w3.org/2000/svg", 38144 viewBox: "0 0 24 24", 38145 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38146 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" 38147 }) 38148 }); 38149 /* harmony default export */ const not_found = (notFound); 38150 38151 ;// ./node_modules/@wordpress/icons/build-module/library/list.js 38152 /** 38153 * WordPress dependencies 38154 */ 38155 38156 38157 const list = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38158 viewBox: "0 0 24 24", 38159 xmlns: "http://www.w3.org/2000/svg", 38160 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38161 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" 38162 }) 38163 }); 38164 /* harmony default export */ const library_list = (list); 38165 38166 ;// ./node_modules/@wordpress/icons/build-module/library/block-meta.js 38167 /** 38168 * WordPress dependencies 38169 */ 38170 38171 38172 const blockMeta = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38173 xmlns: "http://www.w3.org/2000/svg", 38174 viewBox: "0 0 24 24", 38175 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38176 fillRule: "evenodd", 38177 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", 38178 clipRule: "evenodd" 38179 }) 38180 }); 38181 /* harmony default export */ const block_meta = (blockMeta); 38182 38183 ;// ./node_modules/@wordpress/icons/build-module/library/calendar.js 38184 /** 38185 * WordPress dependencies 38186 */ 38187 38188 38189 const calendar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38190 viewBox: "0 0 24 24", 38191 xmlns: "http://www.w3.org/2000/svg", 38192 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38193 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" 38194 }) 38195 }); 38196 /* harmony default export */ const library_calendar = (calendar); 38197 38198 ;// ./node_modules/@wordpress/icons/build-module/library/tag.js 38199 /** 38200 * WordPress dependencies 38201 */ 38202 38203 38204 const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38205 xmlns: "http://www.w3.org/2000/svg", 38206 viewBox: "0 0 24 24", 38207 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38208 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" 38209 }) 38210 }); 38211 /* harmony default export */ const library_tag = (tag); 38212 38213 ;// ./node_modules/@wordpress/icons/build-module/library/media.js 38214 /** 38215 * WordPress dependencies 38216 */ 38217 38218 38219 const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 38220 xmlns: "http://www.w3.org/2000/svg", 38221 viewBox: "0 0 24 24", 38222 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38223 d: "m7 6.5 4 2.5-4 2.5z" 38224 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38225 fillRule: "evenodd", 38226 clipRule: "evenodd", 38227 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" 38228 })] 38229 }); 38230 /* harmony default export */ const library_media = (media); 38231 38232 ;// ./node_modules/@wordpress/icons/build-module/library/post.js 38233 /** 38234 * WordPress dependencies 38235 */ 38236 38237 38238 const post_post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38239 xmlns: "http://www.w3.org/2000/svg", 38240 viewBox: "0 0 24 24", 38241 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38242 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" 38243 }) 38244 }); 38245 /* harmony default export */ const library_post = (post_post); 38246 38247 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js 38248 /* wp:polyfill */ 38249 /** 38250 * WordPress dependencies 38251 */ 38252 38253 38254 38255 38256 38257 38258 38259 /** 38260 * Internal dependencies 38261 */ 38262 38263 const EMPTY_OBJECT = {}; 38264 38265 /** 38266 * @typedef IHasNameAndId 38267 * @property {string|number} id The entity's id. 38268 * @property {string} name The entity's name. 38269 */ 38270 38271 const utils_getValueFromObjectPath = (object, path) => { 38272 let value = object; 38273 path.split('.').forEach(fieldName => { 38274 value = value?.[fieldName]; 38275 }); 38276 return value; 38277 }; 38278 38279 /** 38280 * Helper util to map records to add a `name` prop from a 38281 * provided path, in order to handle all entities in the same 38282 * fashion(implementing`IHasNameAndId` interface). 38283 * 38284 * @param {Object[]} entities The array of entities. 38285 * @param {string} path The path to map a `name` property from the entity. 38286 * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface. 38287 */ 38288 const mapToIHasNameAndId = (entities, path) => { 38289 return (entities || []).map(entity => ({ 38290 ...entity, 38291 name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path)) 38292 })); 38293 }; 38294 38295 /** 38296 * @typedef {Object} EntitiesInfo 38297 * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..). 38298 * @property {number[]} existingEntitiesIds An array of the existing entities ids. 38299 */ 38300 38301 const useExistingTemplates = () => { 38302 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_POST_TYPE, { 38303 per_page: -1 38304 }), []); 38305 }; 38306 const useDefaultTemplateTypes = () => { 38307 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_types || [], []); 38308 }; 38309 const usePublicPostTypes = () => { 38310 const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({ 38311 per_page: -1 38312 }), []); 38313 return (0,external_wp_element_namespaceObject.useMemo)(() => { 38314 const excludedPostTypes = ['attachment']; 38315 return postTypes?.filter(({ 38316 viewable, 38317 slug 38318 }) => viewable && !excludedPostTypes.includes(slug)); 38319 }, [postTypes]); 38320 }; 38321 const usePublicTaxonomies = () => { 38322 const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 38323 per_page: -1 38324 }), []); 38325 return (0,external_wp_element_namespaceObject.useMemo)(() => { 38326 return taxonomies?.filter(({ 38327 visibility 38328 }) => visibility?.publicly_queryable); 38329 }, [taxonomies]); 38330 }; 38331 function usePostTypeArchiveMenuItems() { 38332 const publicPostTypes = usePublicPostTypes(); 38333 const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]); 38334 const existingTemplates = useExistingTemplates(); 38335 // We need to keep track of naming conflicts. If a conflict 38336 // occurs, we need to add slug. 38337 const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 38338 labels 38339 }) => { 38340 const singularName = labels.singular_name.toLowerCase(); 38341 accumulator[singularName] = (accumulator[singularName] || 0) + 1; 38342 return accumulator; 38343 }, {}), [publicPostTypes]); 38344 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 38345 labels, 38346 slug 38347 }) => { 38348 const singularName = labels.singular_name.toLowerCase(); 38349 return postTypeLabels[singularName] > 1 && singularName !== slug; 38350 }, [postTypeLabels]); 38351 return (0,external_wp_element_namespaceObject.useMemo)(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => { 38352 let title; 38353 if (needsUniqueIdentifier(postType)) { 38354 title = (0,external_wp_i18n_namespaceObject.sprintf)( 38355 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 38356 (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug); 38357 } else { 38358 title = (0,external_wp_i18n_namespaceObject.sprintf)( 38359 // translators: %s: Name of the post type e.g: "Post". 38360 (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name); 38361 } 38362 return { 38363 slug: 'archive-' + postType.slug, 38364 description: (0,external_wp_i18n_namespaceObject.sprintf)( 38365 // translators: %s: Name of the post type e.g: "Post". 38366 (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name), 38367 title, 38368 // `icon` is the `menu_icon` property of a post type. We 38369 // only handle `dashicons` for now, even if the `menu_icon` 38370 // also supports urls and svg as values. 38371 icon: typeof postType.icon === 'string' && postType.icon.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive, 38372 templatePrefix: 'archive' 38373 }; 38374 }) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]); 38375 } 38376 const usePostTypeMenuItems = onClickMenuItem => { 38377 const publicPostTypes = usePublicPostTypes(); 38378 const existingTemplates = useExistingTemplates(); 38379 const defaultTemplateTypes = useDefaultTemplateTypes(); 38380 // We need to keep track of naming conflicts. If a conflict 38381 // occurs, we need to add slug. 38382 const templateLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 38383 labels 38384 }) => { 38385 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38386 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 38387 return accumulator; 38388 }, {}), [publicPostTypes]); 38389 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 38390 labels, 38391 slug 38392 }) => { 38393 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38394 return templateLabels[templateName] > 1 && templateName !== slug; 38395 }, [templateLabels]); 38396 38397 // `page`is a special case in template hierarchy. 38398 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 38399 slug 38400 }) => { 38401 let suffix = slug; 38402 if (slug !== 'page') { 38403 suffix = `single-$suffix}`; 38404 } 38405 accumulator[slug] = suffix; 38406 return accumulator; 38407 }, {}), [publicPostTypes]); 38408 const postTypesInfo = useEntitiesInfo('postType', templatePrefixes); 38409 const existingTemplateSlugs = (existingTemplates || []).map(({ 38410 slug 38411 }) => slug); 38412 const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => { 38413 const { 38414 slug, 38415 labels, 38416 icon 38417 } = postType; 38418 // We need to check if the general template is part of the 38419 // defaultTemplateTypes. If it is, just use that info and 38420 // augment it with the specific template functionality. 38421 const generalTemplateSlug = templatePrefixes[slug]; 38422 const defaultTemplateType = defaultTemplateTypes?.find(({ 38423 slug: _slug 38424 }) => _slug === generalTemplateSlug); 38425 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 38426 const _needsUniqueIdentifier = needsUniqueIdentifier(postType); 38427 let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)( 38428 // translators: %s: Name of the post type e.g: "Post". 38429 (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name); 38430 if (_needsUniqueIdentifier) { 38431 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 38432 // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book". 38433 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'post type menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 38434 // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book". 38435 (0,external_wp_i18n_namespaceObject._x)('Single item: %1$s (%2$s)', 'post type menu label'), labels.singular_name, slug); 38436 } 38437 const menuItem = defaultTemplateType ? { 38438 ...defaultTemplateType, 38439 templatePrefix: templatePrefixes[slug] 38440 } : { 38441 slug: generalTemplateSlug, 38442 title: menuItemTitle, 38443 description: (0,external_wp_i18n_namespaceObject.sprintf)( 38444 // translators: %s: Name of the post type e.g: "Post". 38445 (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name), 38446 // `icon` is the `menu_icon` property of a post type. We 38447 // only handle `dashicons` for now, even if the `menu_icon` 38448 // also supports urls and svg as values. 38449 icon: typeof icon === 'string' && icon.startsWith('dashicons-') ? icon.slice(10) : library_post, 38450 templatePrefix: templatePrefixes[slug] 38451 }; 38452 const hasEntities = postTypesInfo?.[slug]?.hasEntities; 38453 // We have a different template creation flow only if they have entities. 38454 if (hasEntities) { 38455 menuItem.onClick = template => { 38456 onClickMenuItem({ 38457 type: 'postType', 38458 slug, 38459 config: { 38460 recordNamePath: 'title.rendered', 38461 queryArgs: ({ 38462 search 38463 }) => { 38464 return { 38465 _fields: 'id,title,slug,link', 38466 orderBy: search ? 'relevance' : 'modified', 38467 exclude: postTypesInfo[slug].existingEntitiesIds 38468 }; 38469 }, 38470 getSpecificTemplate: suggestion => { 38471 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 38472 return { 38473 title: templateSlug, 38474 slug: templateSlug, 38475 templatePrefix: templatePrefixes[slug] 38476 }; 38477 } 38478 }, 38479 labels, 38480 hasGeneralTemplate, 38481 template 38482 }); 38483 }; 38484 } 38485 // We don't need to add the menu item if there are no 38486 // entities and the general template exists. 38487 if (!hasGeneralTemplate || hasEntities) { 38488 accumulator.push(menuItem); 38489 } 38490 return accumulator; 38491 }, []); 38492 // Split menu items into two groups: one for the default post types 38493 // and one for the rest. 38494 const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => { 38495 const { 38496 slug 38497 } = postType; 38498 let key = 'postTypesMenuItems'; 38499 if (slug === 'page') { 38500 key = 'defaultPostTypesMenuItems'; 38501 } 38502 accumulator[key].push(postType); 38503 return accumulator; 38504 }, { 38505 defaultPostTypesMenuItems: [], 38506 postTypesMenuItems: [] 38507 }), [menuItems]); 38508 return postTypesMenuItems; 38509 }; 38510 const useTaxonomiesMenuItems = onClickMenuItem => { 38511 const publicTaxonomies = usePublicTaxonomies(); 38512 const existingTemplates = useExistingTemplates(); 38513 const defaultTemplateTypes = useDefaultTemplateTypes(); 38514 // `category` and `post_tag` are special cases in template hierarchy. 38515 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies?.reduce((accumulator, { 38516 slug 38517 }) => { 38518 let suffix = slug; 38519 if (!['category', 'post_tag'].includes(slug)) { 38520 suffix = `taxonomy-$suffix}`; 38521 } 38522 if (slug === 'post_tag') { 38523 suffix = `tag`; 38524 } 38525 accumulator[slug] = suffix; 38526 return accumulator; 38527 }, {}), [publicTaxonomies]); 38528 // We need to keep track of naming conflicts. If a conflict 38529 // occurs, we need to add slug. 38530 const taxonomyLabels = publicTaxonomies?.reduce((accumulator, { 38531 labels 38532 }) => { 38533 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38534 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 38535 return accumulator; 38536 }, {}); 38537 const needsUniqueIdentifier = (labels, slug) => { 38538 if (['category', 'post_tag'].includes(slug)) { 38539 return false; 38540 } 38541 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38542 return taxonomyLabels[templateName] > 1 && templateName !== slug; 38543 }; 38544 const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes); 38545 const existingTemplateSlugs = (existingTemplates || []).map(({ 38546 slug 38547 }) => slug); 38548 const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => { 38549 const { 38550 slug, 38551 labels 38552 } = taxonomy; 38553 // We need to check if the general template is part of the 38554 // defaultTemplateTypes. If it is, just use that info and 38555 // augment it with the specific template functionality. 38556 const generalTemplateSlug = templatePrefixes[slug]; 38557 const defaultTemplateType = defaultTemplateTypes?.find(({ 38558 slug: _slug 38559 }) => _slug === generalTemplateSlug); 38560 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 38561 const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug); 38562 let menuItemTitle = labels.template_name || labels.singular_name; 38563 if (_needsUniqueIdentifier) { 38564 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 38565 // translators: 1: Name of the template e.g: "Products by Category". 2s: Slug of the taxonomy e.g: "product_cat". 38566 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy template menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 38567 // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat". 38568 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy menu label'), labels.singular_name, slug); 38569 } 38570 const menuItem = defaultTemplateType ? { 38571 ...defaultTemplateType, 38572 templatePrefix: templatePrefixes[slug] 38573 } : { 38574 slug: generalTemplateSlug, 38575 title: menuItemTitle, 38576 description: (0,external_wp_i18n_namespaceObject.sprintf)( 38577 // translators: %s: Name of the taxonomy e.g: "Product Categories". 38578 (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name), 38579 icon: block_meta, 38580 templatePrefix: templatePrefixes[slug] 38581 }; 38582 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; 38583 // We have a different template creation flow only if they have entities. 38584 if (hasEntities) { 38585 menuItem.onClick = template => { 38586 onClickMenuItem({ 38587 type: 'taxonomy', 38588 slug, 38589 config: { 38590 queryArgs: ({ 38591 search 38592 }) => { 38593 return { 38594 _fields: 'id,name,slug,link', 38595 orderBy: search ? 'name' : 'count', 38596 exclude: taxonomiesInfo[slug].existingEntitiesIds 38597 }; 38598 }, 38599 getSpecificTemplate: suggestion => { 38600 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 38601 return { 38602 title: templateSlug, 38603 slug: templateSlug, 38604 templatePrefix: templatePrefixes[slug] 38605 }; 38606 } 38607 }, 38608 labels, 38609 hasGeneralTemplate, 38610 template 38611 }); 38612 }; 38613 } 38614 // We don't need to add the menu item if there are no 38615 // entities and the general template exists. 38616 if (!hasGeneralTemplate || hasEntities) { 38617 accumulator.push(menuItem); 38618 } 38619 return accumulator; 38620 }, []); 38621 // Split menu items into two groups: one for the default taxonomies 38622 // and one for the rest. 38623 const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => { 38624 const { 38625 slug 38626 } = taxonomy; 38627 let key = 'taxonomiesMenuItems'; 38628 if (['category', 'tag'].includes(slug)) { 38629 key = 'defaultTaxonomiesMenuItems'; 38630 } 38631 accumulator[key].push(taxonomy); 38632 return accumulator; 38633 }, { 38634 defaultTaxonomiesMenuItems: [], 38635 taxonomiesMenuItems: [] 38636 }), [menuItems]); 38637 return taxonomiesMenuItems; 38638 }; 38639 const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { 38640 user: 'author' 38641 }; 38642 const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { 38643 user: { 38644 who: 'authors' 38645 } 38646 }; 38647 function useAuthorMenuItem(onClickMenuItem) { 38648 const existingTemplates = useExistingTemplates(); 38649 const defaultTemplateTypes = useDefaultTemplateTypes(); 38650 const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS); 38651 let authorMenuItem = defaultTemplateTypes?.find(({ 38652 slug 38653 }) => slug === 'author'); 38654 if (!authorMenuItem) { 38655 authorMenuItem = { 38656 description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'), 38657 slug: 'author', 38658 title: 'Author' 38659 }; 38660 } 38661 const hasGeneralTemplate = !!existingTemplates?.find(({ 38662 slug 38663 }) => slug === 'author'); 38664 if (authorInfo.user?.hasEntities) { 38665 authorMenuItem = { 38666 ...authorMenuItem, 38667 templatePrefix: 'author' 38668 }; 38669 authorMenuItem.onClick = template => { 38670 onClickMenuItem({ 38671 type: 'root', 38672 slug: 'user', 38673 config: { 38674 queryArgs: ({ 38675 search 38676 }) => { 38677 return { 38678 _fields: 'id,name,slug,link', 38679 orderBy: search ? 'name' : 'registered_date', 38680 exclude: authorInfo.user.existingEntitiesIds, 38681 who: 'authors' 38682 }; 38683 }, 38684 getSpecificTemplate: suggestion => { 38685 const templateSlug = `author-$suggestion.slug}`; 38686 return { 38687 title: templateSlug, 38688 slug: templateSlug, 38689 templatePrefix: 'author' 38690 }; 38691 } 38692 }, 38693 labels: { 38694 singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'), 38695 search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'), 38696 not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'), 38697 all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors') 38698 }, 38699 hasGeneralTemplate, 38700 template 38701 }); 38702 }; 38703 } 38704 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { 38705 return authorMenuItem; 38706 } 38707 } 38708 38709 /** 38710 * Helper hook that filters all the existing templates by the given 38711 * object with the entity's slug as key and the template prefix as value. 38712 * 38713 * Example: 38714 * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ] 38715 * `templatePrefixes` is: { post_tag: 'tag' } 38716 * It will return: { post_tag: ['apple'] } 38717 * 38718 * Note: We append the `-` to the given template prefix in this function for our checks. 38719 * 38720 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 38721 * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value. 38722 */ 38723 const useExistingTemplateSlugs = templatePrefixes => { 38724 const existingTemplates = useExistingTemplates(); 38725 const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => { 38726 return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => { 38727 const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => { 38728 const _prefix = `$prefix}-`; 38729 if (existingTemplate.slug.startsWith(_prefix)) { 38730 _accumulator.push(existingTemplate.slug.substring(_prefix.length)); 38731 } 38732 return _accumulator; 38733 }, []); 38734 if (slugsWithTemplates.length) { 38735 accumulator[slug] = slugsWithTemplates; 38736 } 38737 return accumulator; 38738 }, {}); 38739 }, [templatePrefixes, existingTemplates]); 38740 return existingSlugs; 38741 }; 38742 38743 /** 38744 * Helper hook that finds the existing records with an associated template, 38745 * as they need to be excluded from the template suggestions. 38746 * 38747 * @param {string} entityName The entity's name. 38748 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 38749 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 38750 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value. 38751 */ 38752 const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => { 38753 const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes); 38754 const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => { 38755 return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, [slug, slugsWithTemplates]) => { 38756 const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 38757 _fields: 'id', 38758 context: 'view', 38759 slug: slugsWithTemplates, 38760 ...additionalQueryParameters[slug] 38761 }); 38762 if (entitiesWithTemplates?.length) { 38763 accumulator[slug] = entitiesWithTemplates; 38764 } 38765 return accumulator; 38766 }, {}); 38767 }, [slugsToExcludePerEntity]); 38768 return recordsToExcludePerEntity; 38769 }; 38770 38771 /** 38772 * Helper hook that returns information about an entity having 38773 * records that we can create a specific template for. 38774 * 38775 * For example we can search for `terms` in `taxonomy` entity or 38776 * `posts` in `postType` entity. 38777 * 38778 * First we need to find the existing records with an associated template, 38779 * to query afterwards for any remaining record, by excluding them. 38780 * 38781 * @param {string} entityName The entity's name. 38782 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 38783 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 38784 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value. 38785 */ 38786 const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => { 38787 const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters); 38788 const entitiesHasRecords = (0,external_wp_data_namespaceObject.useSelect)(select => { 38789 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 38790 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 38791 id 38792 }) => id) || []; 38793 accumulator[slug] = !!select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 38794 per_page: 1, 38795 _fields: 'id', 38796 context: 'view', 38797 exclude: existingEntitiesIds, 38798 ...additionalQueryParameters[slug] 38799 })?.length; 38800 return accumulator; 38801 }, {}); 38802 }, [templatePrefixes, recordsToExcludePerEntity, entityName, additionalQueryParameters]); 38803 const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => { 38804 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 38805 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 38806 id 38807 }) => id) || []; 38808 accumulator[slug] = { 38809 hasEntities: entitiesHasRecords[slug], 38810 existingEntitiesIds 38811 }; 38812 return accumulator; 38813 }, {}); 38814 }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]); 38815 return entitiesInfo; 38816 }; 38817 38818 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js 38819 /* wp:polyfill */ 38820 /** 38821 * WordPress dependencies 38822 */ 38823 38824 38825 38826 38827 38828 38829 38830 /** 38831 * Internal dependencies 38832 */ 38833 38834 38835 const add_custom_template_modal_content_EMPTY_ARRAY = []; 38836 function SuggestionListItem({ 38837 suggestion, 38838 search, 38839 onSelect, 38840 entityForSuggestions 38841 }) { 38842 const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item'; 38843 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 38844 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 38845 __next40pxDefaultSize: true, 38846 role: "option", 38847 className: baseCssClass, 38848 onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion)) 38849 }), 38850 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38851 size: "body", 38852 lineHeight: 1.53846153846 // 20px 38853 , 38854 weight: 500, 38855 className: `$baseCssClass}__title`, 38856 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight, { 38857 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name), 38858 highlight: search 38859 }) 38860 }), suggestion.link && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38861 size: "body", 38862 lineHeight: 1.53846153846 // 20px 38863 , 38864 className: `$baseCssClass}__info`, 38865 children: suggestion.link 38866 })] 38867 }); 38868 } 38869 function useSearchSuggestions(entityForSuggestions, search) { 38870 const { 38871 config 38872 } = entityForSuggestions; 38873 const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 38874 order: 'asc', 38875 context: 'view', 38876 search, 38877 per_page: search ? 20 : 10, 38878 ...config.queryArgs(search) 38879 }), [search, config]); 38880 const { 38881 records: searchResults, 38882 hasResolved: searchHasResolved 38883 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query); 38884 const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(add_custom_template_modal_content_EMPTY_ARRAY); 38885 (0,external_wp_element_namespaceObject.useEffect)(() => { 38886 if (!searchHasResolved) { 38887 return; 38888 } 38889 let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY; 38890 if (searchResults?.length) { 38891 newSuggestions = searchResults; 38892 if (config.recordNamePath) { 38893 newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath); 38894 } 38895 } 38896 // Update suggestions only when the query has resolved, so as to keep 38897 // the previous results in the UI. 38898 setSuggestions(newSuggestions); 38899 }, [searchResults, searchHasResolved]); 38900 return suggestions; 38901 } 38902 function SuggestionList({ 38903 entityForSuggestions, 38904 onSelect 38905 }) { 38906 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); 38907 const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch); 38908 const { 38909 labels 38910 } = entityForSuggestions; 38911 const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false); 38912 if (!showSearchControl && suggestions?.length > 9) { 38913 setShowSearchControl(true); 38914 } 38915 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38916 children: [showSearchControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 38917 __nextHasNoMarginBottom: true, 38918 onChange: setSearch, 38919 value: search, 38920 label: labels.search_items, 38921 placeholder: labels.search_items 38922 }), !!suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 38923 orientation: "vertical", 38924 role: "listbox", 38925 className: "edit-site-custom-template-modal__suggestions_list", 38926 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list'), 38927 children: suggestions.map(suggestion => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionListItem, { 38928 suggestion: suggestion, 38929 search: debouncedSearch, 38930 onSelect: onSelect, 38931 entityForSuggestions: entityForSuggestions 38932 }, suggestion.slug)) 38933 }), debouncedSearch && !suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38934 as: "p", 38935 className: "edit-site-custom-template-modal__no-results", 38936 children: labels.not_found 38937 })] 38938 }); 38939 } 38940 function AddCustomTemplateModalContent({ 38941 onSelect, 38942 entityForSuggestions 38943 }) { 38944 const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate); 38945 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 38946 spacing: 4, 38947 className: "edit-site-custom-template-modal__contents-wrapper", 38948 alignment: "left", 38949 children: [!showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38950 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38951 as: "p", 38952 children: (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.') 38953 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 38954 className: "edit-site-custom-template-modal__contents", 38955 gap: "4", 38956 align: "initial", 38957 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 38958 isBlock: true, 38959 as: external_wp_components_namespaceObject.Button, 38960 onClick: () => { 38961 const { 38962 slug, 38963 title, 38964 description, 38965 templatePrefix 38966 } = entityForSuggestions.template; 38967 onSelect({ 38968 slug, 38969 title, 38970 description, 38971 templatePrefix 38972 }); 38973 }, 38974 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38975 as: "span", 38976 weight: 500, 38977 lineHeight: 1.53846153846 // 20px 38978 , 38979 children: entityForSuggestions.labels.all_items 38980 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38981 as: "span", 38982 lineHeight: 1.53846153846 // 20px 38983 , 38984 children: 38985 // 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. 38986 (0,external_wp_i18n_namespaceObject.__)('For all items') 38987 })] 38988 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 38989 isBlock: true, 38990 as: external_wp_components_namespaceObject.Button, 38991 onClick: () => { 38992 setShowSearchEntities(true); 38993 }, 38994 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38995 as: "span", 38996 weight: 500, 38997 lineHeight: 1.53846153846 // 20px 38998 , 38999 children: entityForSuggestions.labels.singular_name 39000 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39001 as: "span", 39002 lineHeight: 1.53846153846 // 20px 39003 , 39004 children: 39005 // 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. 39006 (0,external_wp_i18n_namespaceObject.__)('For a specific item') 39007 })] 39008 })] 39009 })] 39010 }), showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39011 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39012 as: "p", 39013 children: (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.') 39014 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionList, { 39015 entityForSuggestions: entityForSuggestions, 39016 onSelect: onSelect 39017 })] 39018 })] 39019 }); 39020 } 39021 /* harmony default export */ const add_custom_template_modal_content = (AddCustomTemplateModalContent); 39022 39023 ;// ./node_modules/tslib/tslib.es6.mjs 39024 /****************************************************************************** 39025 Copyright (c) Microsoft Corporation. 39026 39027 Permission to use, copy, modify, and/or distribute this software for any 39028 purpose with or without fee is hereby granted. 39029 39030 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 39031 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 39032 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 39033 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 39034 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 39035 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 39036 PERFORMANCE OF THIS SOFTWARE. 39037 ***************************************************************************** */ 39038 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 39039 39040 var extendStatics = function(d, b) { 39041 extendStatics = Object.setPrototypeOf || 39042 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 39043 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 39044 return extendStatics(d, b); 39045 }; 39046 39047 function __extends(d, b) { 39048 if (typeof b !== "function" && b !== null) 39049 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 39050 extendStatics(d, b); 39051 function __() { this.constructor = d; } 39052 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 39053 } 39054 39055 var __assign = function() { 39056 __assign = Object.assign || function __assign(t) { 39057 for (var s, i = 1, n = arguments.length; i < n; i++) { 39058 s = arguments[i]; 39059 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 39060 } 39061 return t; 39062 } 39063 return __assign.apply(this, arguments); 39064 } 39065 39066 function __rest(s, e) { 39067 var t = {}; 39068 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 39069 t[p] = s[p]; 39070 if (s != null && typeof Object.getOwnPropertySymbols === "function") 39071 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 39072 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 39073 t[p[i]] = s[p[i]]; 39074 } 39075 return t; 39076 } 39077 39078 function __decorate(decorators, target, key, desc) { 39079 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 39080 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 39081 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; 39082 return c > 3 && r && Object.defineProperty(target, key, r), r; 39083 } 39084 39085 function __param(paramIndex, decorator) { 39086 return function (target, key) { decorator(target, key, paramIndex); } 39087 } 39088 39089 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 39090 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 39091 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 39092 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 39093 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 39094 var _, done = false; 39095 for (var i = decorators.length - 1; i >= 0; i--) { 39096 var context = {}; 39097 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 39098 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 39099 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 39100 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 39101 if (kind === "accessor") { 39102 if (result === void 0) continue; 39103 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 39104 if (_ = accept(result.get)) descriptor.get = _; 39105 if (_ = accept(result.set)) descriptor.set = _; 39106 if (_ = accept(result.init)) initializers.unshift(_); 39107 } 39108 else if (_ = accept(result)) { 39109 if (kind === "field") initializers.unshift(_); 39110 else descriptor[key] = _; 39111 } 39112 } 39113 if (target) Object.defineProperty(target, contextIn.name, descriptor); 39114 done = true; 39115 }; 39116 39117 function __runInitializers(thisArg, initializers, value) { 39118 var useValue = arguments.length > 2; 39119 for (var i = 0; i < initializers.length; i++) { 39120 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 39121 } 39122 return useValue ? value : void 0; 39123 }; 39124 39125 function __propKey(x) { 39126 return typeof x === "symbol" ? x : "".concat(x); 39127 }; 39128 39129 function __setFunctionName(f, name, prefix) { 39130 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 39131 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 39132 }; 39133 39134 function __metadata(metadataKey, metadataValue) { 39135 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 39136 } 39137 39138 function __awaiter(thisArg, _arguments, P, generator) { 39139 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 39140 return new (P || (P = Promise))(function (resolve, reject) { 39141 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 39142 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 39143 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 39144 step((generator = generator.apply(thisArg, _arguments || [])).next()); 39145 }); 39146 } 39147 39148 function __generator(thisArg, body) { 39149 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); 39150 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 39151 function verb(n) { return function (v) { return step([n, v]); }; } 39152 function step(op) { 39153 if (f) throw new TypeError("Generator is already executing."); 39154 while (g && (g = 0, op[0] && (_ = 0)), _) try { 39155 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; 39156 if (y = 0, t) op = [op[0] & 2, t.value]; 39157 switch (op[0]) { 39158 case 0: case 1: t = op; break; 39159 case 4: _.label++; return { value: op[1], done: false }; 39160 case 5: _.label++; y = op[1]; op = [0]; continue; 39161 case 7: op = _.ops.pop(); _.trys.pop(); continue; 39162 default: 39163 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 39164 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 39165 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 39166 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 39167 if (t[2]) _.ops.pop(); 39168 _.trys.pop(); continue; 39169 } 39170 op = body.call(thisArg, _); 39171 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 39172 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 39173 } 39174 } 39175 39176 var __createBinding = Object.create ? (function(o, m, k, k2) { 39177 if (k2 === undefined) k2 = k; 39178 var desc = Object.getOwnPropertyDescriptor(m, k); 39179 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 39180 desc = { enumerable: true, get: function() { return m[k]; } }; 39181 } 39182 Object.defineProperty(o, k2, desc); 39183 }) : (function(o, m, k, k2) { 39184 if (k2 === undefined) k2 = k; 39185 o[k2] = m[k]; 39186 }); 39187 39188 function __exportStar(m, o) { 39189 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 39190 } 39191 39192 function __values(o) { 39193 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 39194 if (m) return m.call(o); 39195 if (o && typeof o.length === "number") return { 39196 next: function () { 39197 if (o && i >= o.length) o = void 0; 39198 return { value: o && o[i++], done: !o }; 39199 } 39200 }; 39201 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 39202 } 39203 39204 function __read(o, n) { 39205 var m = typeof Symbol === "function" && o[Symbol.iterator]; 39206 if (!m) return o; 39207 var i = m.call(o), r, ar = [], e; 39208 try { 39209 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 39210 } 39211 catch (error) { e = { error: error }; } 39212 finally { 39213 try { 39214 if (r && !r.done && (m = i["return"])) m.call(i); 39215 } 39216 finally { if (e) throw e.error; } 39217 } 39218 return ar; 39219 } 39220 39221 /** @deprecated */ 39222 function __spread() { 39223 for (var ar = [], i = 0; i < arguments.length; i++) 39224 ar = ar.concat(__read(arguments[i])); 39225 return ar; 39226 } 39227 39228 /** @deprecated */ 39229 function __spreadArrays() { 39230 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 39231 for (var r = Array(s), k = 0, i = 0; i < il; i++) 39232 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 39233 r[k] = a[j]; 39234 return r; 39235 } 39236 39237 function __spreadArray(to, from, pack) { 39238 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 39239 if (ar || !(i in from)) { 39240 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 39241 ar[i] = from[i]; 39242 } 39243 } 39244 return to.concat(ar || Array.prototype.slice.call(from)); 39245 } 39246 39247 function __await(v) { 39248 return this instanceof __await ? (this.v = v, this) : new __await(v); 39249 } 39250 39251 function __asyncGenerator(thisArg, _arguments, generator) { 39252 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 39253 var g = generator.apply(thisArg, _arguments || []), i, q = []; 39254 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 39255 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 39256 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]); } } 39257 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 39258 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 39259 function fulfill(value) { resume("next", value); } 39260 function reject(value) { resume("throw", value); } 39261 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 39262 } 39263 39264 function __asyncDelegator(o) { 39265 var i, p; 39266 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 39267 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; } 39268 } 39269 39270 function __asyncValues(o) { 39271 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 39272 var m = o[Symbol.asyncIterator], i; 39273 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); 39274 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); }); }; } 39275 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 39276 } 39277 39278 function __makeTemplateObject(cooked, raw) { 39279 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 39280 return cooked; 39281 }; 39282 39283 var __setModuleDefault = Object.create ? (function(o, v) { 39284 Object.defineProperty(o, "default", { enumerable: true, value: v }); 39285 }) : function(o, v) { 39286 o["default"] = v; 39287 }; 39288 39289 var ownKeys = function(o) { 39290 ownKeys = Object.getOwnPropertyNames || function (o) { 39291 var ar = []; 39292 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 39293 return ar; 39294 }; 39295 return ownKeys(o); 39296 }; 39297 39298 function __importStar(mod) { 39299 if (mod && mod.__esModule) return mod; 39300 var result = {}; 39301 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 39302 __setModuleDefault(result, mod); 39303 return result; 39304 } 39305 39306 function __importDefault(mod) { 39307 return (mod && mod.__esModule) ? mod : { default: mod }; 39308 } 39309 39310 function __classPrivateFieldGet(receiver, state, kind, f) { 39311 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 39312 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"); 39313 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 39314 } 39315 39316 function __classPrivateFieldSet(receiver, state, value, kind, f) { 39317 if (kind === "m") throw new TypeError("Private method is not writable"); 39318 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 39319 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"); 39320 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 39321 } 39322 39323 function __classPrivateFieldIn(state, receiver) { 39324 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 39325 return typeof state === "function" ? receiver === state : state.has(receiver); 39326 } 39327 39328 function __addDisposableResource(env, value, async) { 39329 if (value !== null && value !== void 0) { 39330 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 39331 var dispose, inner; 39332 if (async) { 39333 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 39334 dispose = value[Symbol.asyncDispose]; 39335 } 39336 if (dispose === void 0) { 39337 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 39338 dispose = value[Symbol.dispose]; 39339 if (async) inner = dispose; 39340 } 39341 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 39342 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 39343 env.stack.push({ value: value, dispose: dispose, async: async }); 39344 } 39345 else if (async) { 39346 env.stack.push({ async: true }); 39347 } 39348 return value; 39349 } 39350 39351 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 39352 var e = new Error(message); 39353 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 39354 }; 39355 39356 function __disposeResources(env) { 39357 function fail(e) { 39358 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 39359 env.hasError = true; 39360 } 39361 var r, s = 0; 39362 function next() { 39363 while (r = env.stack.pop()) { 39364 try { 39365 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 39366 if (r.dispose) { 39367 var result = r.dispose.call(r.value); 39368 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 39369 } 39370 else s |= 1; 39371 } 39372 catch (e) { 39373 fail(e); 39374 } 39375 } 39376 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 39377 if (env.hasError) throw env.error; 39378 } 39379 return next(); 39380 } 39381 39382 function __rewriteRelativeImportExtension(path, preserveJsx) { 39383 if (typeof path === "string" && /^\.\.?\//.test(path)) { 39384 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { 39385 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); 39386 }); 39387 } 39388 return path; 39389 } 39390 39391 /* harmony default export */ const tslib_es6 = ({ 39392 __extends, 39393 __assign, 39394 __rest, 39395 __decorate, 39396 __param, 39397 __esDecorate, 39398 __runInitializers, 39399 __propKey, 39400 __setFunctionName, 39401 __metadata, 39402 __awaiter, 39403 __generator, 39404 __createBinding, 39405 __exportStar, 39406 __values, 39407 __read, 39408 __spread, 39409 __spreadArrays, 39410 __spreadArray, 39411 __await, 39412 __asyncGenerator, 39413 __asyncDelegator, 39414 __asyncValues, 39415 __makeTemplateObject, 39416 __importStar, 39417 __importDefault, 39418 __classPrivateFieldGet, 39419 __classPrivateFieldSet, 39420 __classPrivateFieldIn, 39421 __addDisposableResource, 39422 __disposeResources, 39423 __rewriteRelativeImportExtension, 39424 }); 39425 39426 ;// ./node_modules/lower-case/dist.es2015/index.js 39427 /** 39428 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 39429 */ 39430 var SUPPORTED_LOCALE = { 39431 tr: { 39432 regexp: /\u0130|\u0049|\u0049\u0307/g, 39433 map: { 39434 İ: "\u0069", 39435 I: "\u0131", 39436 İ: "\u0069", 39437 }, 39438 }, 39439 az: { 39440 regexp: /\u0130/g, 39441 map: { 39442 İ: "\u0069", 39443 I: "\u0131", 39444 İ: "\u0069", 39445 }, 39446 }, 39447 lt: { 39448 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 39449 map: { 39450 I: "\u0069\u0307", 39451 J: "\u006A\u0307", 39452 Į: "\u012F\u0307", 39453 Ì: "\u0069\u0307\u0300", 39454 Í: "\u0069\u0307\u0301", 39455 Ĩ: "\u0069\u0307\u0303", 39456 }, 39457 }, 39458 }; 39459 /** 39460 * Localized lower case. 39461 */ 39462 function localeLowerCase(str, locale) { 39463 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 39464 if (lang) 39465 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 39466 return lowerCase(str); 39467 } 39468 /** 39469 * Lower case as a function. 39470 */ 39471 function lowerCase(str) { 39472 return str.toLowerCase(); 39473 } 39474 39475 ;// ./node_modules/no-case/dist.es2015/index.js 39476 39477 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 39478 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 39479 // Remove all non-word characters. 39480 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 39481 /** 39482 * Normalize the string into something other libraries can manipulate easier. 39483 */ 39484 function noCase(input, options) { 39485 if (options === void 0) { options = {}; } 39486 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; 39487 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 39488 var start = 0; 39489 var end = result.length; 39490 // Trim the delimiter from around the output string. 39491 while (result.charAt(start) === "\0") 39492 start++; 39493 while (result.charAt(end - 1) === "\0") 39494 end--; 39495 // Transform each token independently. 39496 return result.slice(start, end).split("\0").map(transform).join(delimiter); 39497 } 39498 /** 39499 * Replace `re` in the input string with the replacement value. 39500 */ 39501 function replace(input, re, value) { 39502 if (re instanceof RegExp) 39503 return input.replace(re, value); 39504 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 39505 } 39506 39507 ;// ./node_modules/dot-case/dist.es2015/index.js 39508 39509 39510 function dotCase(input, options) { 39511 if (options === void 0) { options = {}; } 39512 return noCase(input, __assign({ delimiter: "." }, options)); 39513 } 39514 39515 ;// ./node_modules/param-case/dist.es2015/index.js 39516 39517 39518 function paramCase(input, options) { 39519 if (options === void 0) { options = {}; } 39520 return dotCase(input, __assign({ delimiter: "-" }, options)); 39521 } 39522 39523 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js 39524 /** 39525 * External dependencies 39526 */ 39527 39528 39529 /** 39530 * WordPress dependencies 39531 */ 39532 39533 39534 39535 39536 function AddCustomGenericTemplateModalContent({ 39537 onClose, 39538 createTemplate 39539 }) { 39540 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 39541 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); 39542 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 39543 async function onCreateTemplate(event) { 39544 event.preventDefault(); 39545 if (isBusy) { 39546 return; 39547 } 39548 setIsBusy(true); 39549 try { 39550 await createTemplate({ 39551 slug: 'wp-custom-template-' + paramCase(title || defaultTitle), 39552 title: title || defaultTitle 39553 }, false); 39554 } finally { 39555 setIsBusy(false); 39556 } 39557 } 39558 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 39559 onSubmit: onCreateTemplate, 39560 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 39561 spacing: 6, 39562 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 39563 __next40pxDefaultSize: true, 39564 __nextHasNoMarginBottom: true, 39565 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 39566 value: title, 39567 onChange: setTitle, 39568 placeholder: defaultTitle, 39569 disabled: isBusy, 39570 help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.') 39571 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 39572 className: "edit-site-custom-generic-template__modal-actions", 39573 justify: "right", 39574 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39575 __next40pxDefaultSize: true, 39576 variant: "tertiary", 39577 onClick: () => { 39578 onClose(); 39579 }, 39580 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 39581 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39582 __next40pxDefaultSize: true, 39583 variant: "primary", 39584 type: "submit", 39585 isBusy: isBusy, 39586 "aria-disabled": isBusy, 39587 children: (0,external_wp_i18n_namespaceObject.__)('Create') 39588 })] 39589 })] 39590 }) 39591 }); 39592 } 39593 /* harmony default export */ const add_custom_generic_template_modal_content = (AddCustomGenericTemplateModalContent); 39594 39595 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js 39596 /* wp:polyfill */ 39597 /** 39598 * External dependencies 39599 */ 39600 39601 39602 /** 39603 * WordPress dependencies 39604 */ 39605 39606 39607 39608 39609 39610 39611 39612 39613 39614 39615 39616 /** 39617 * Internal dependencies 39618 */ 39619 39620 39621 /** 39622 * Internal dependencies 39623 */ 39624 39625 39626 39627 39628 39629 const { 39630 useHistory: add_new_template_useHistory 39631 } = unlock(external_wp_router_namespaceObject.privateApis); 39632 const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'search', '404']; 39633 const TEMPLATE_ICONS = { 39634 'front-page': library_home, 39635 home: library_verse, 39636 single: library_pin, 39637 page: library_page, 39638 archive: library_archive, 39639 search: library_search, 39640 404: not_found, 39641 index: library_list, 39642 category: library_category, 39643 author: comment_author_avatar, 39644 taxonomy: block_meta, 39645 date: library_calendar, 39646 tag: library_tag, 39647 attachment: library_media 39648 }; 39649 function TemplateListItem({ 39650 title, 39651 direction, 39652 className, 39653 description, 39654 icon, 39655 onClick, 39656 children 39657 }) { 39658 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39659 __next40pxDefaultSize: true, 39660 className: className, 39661 onClick: onClick, 39662 label: description, 39663 showTooltip: !!description, 39664 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 39665 as: "span", 39666 spacing: 2, 39667 align: "center", 39668 justify: "center", 39669 style: { 39670 width: '100%' 39671 }, 39672 direction: direction, 39673 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39674 className: "edit-site-add-new-template__template-icon", 39675 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 39676 icon: icon 39677 }) 39678 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 39679 className: "edit-site-add-new-template__template-name", 39680 alignment: "center", 39681 spacing: 0, 39682 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39683 align: "center", 39684 weight: 500, 39685 lineHeight: 1.53846153846 // 20px 39686 , 39687 children: title 39688 }), children] 39689 })] 39690 }) 39691 }); 39692 } 39693 const modalContentMap = { 39694 templatesList: 1, 39695 customTemplate: 2, 39696 customGenericTemplate: 3 39697 }; 39698 function NewTemplateModal({ 39699 onClose 39700 }) { 39701 const [modalContent, setModalContent] = (0,external_wp_element_namespaceObject.useState)(modalContentMap.templatesList); 39702 const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({}); 39703 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 39704 const missingTemplates = useMissingTemplates(setEntityForSuggestions, () => setModalContent(modalContentMap.customTemplate)); 39705 const history = add_new_template_useHistory(); 39706 const { 39707 saveEntityRecord 39708 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39709 const { 39710 createErrorNotice, 39711 createSuccessNotice 39712 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39713 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 39714 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 39715 // Site index. 39716 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 39717 }, []); 39718 const TEMPLATE_SHORT_DESCRIPTIONS = { 39719 'front-page': homeUrl, 39720 date: (0,external_wp_i18n_namespaceObject.sprintf)( 39721 // translators: %s: The homepage url. 39722 (0,external_wp_i18n_namespaceObject.__)('E.g. %s'), homeUrl + '/' + new Date().getFullYear()) 39723 }; 39724 async function createTemplate(template, isWPSuggestion = true) { 39725 if (isSubmitting) { 39726 return; 39727 } 39728 setIsSubmitting(true); 39729 try { 39730 const { 39731 title, 39732 description, 39733 slug 39734 } = template; 39735 const newTemplate = await saveEntityRecord('postType', TEMPLATE_POST_TYPE, { 39736 description, 39737 // Slugs need to be strings, so this is for template `404` 39738 slug: slug.toString(), 39739 status: 'publish', 39740 title, 39741 // This adds a post meta field in template that is part of `is_custom` value calculation. 39742 is_wp_suggestion: isWPSuggestion 39743 }, { 39744 throwOnError: true 39745 }); 39746 39747 // Navigate to the created template editor. 39748 history.navigate(`/$TEMPLATE_POST_TYPE}/$newTemplate.id}?canvas=edit`); 39749 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 39750 // translators: %s: Title of the created post or template, e.g: "Hello world". 39751 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title)), { 39752 type: 'snackbar' 39753 }); 39754 } catch (error) { 39755 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); 39756 createErrorNotice(errorMessage, { 39757 type: 'snackbar' 39758 }); 39759 } finally { 39760 setIsSubmitting(false); 39761 } 39762 } 39763 const onModalClose = () => { 39764 onClose(); 39765 setModalContent(modalContentMap.templatesList); 39766 }; 39767 let modalTitle = (0,external_wp_i18n_namespaceObject.__)('Add template'); 39768 if (modalContent === modalContentMap.customTemplate) { 39769 modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 39770 // translators: %s: Name of the post type e.g: "Post". 39771 (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name); 39772 } else if (modalContent === modalContentMap.customGenericTemplate) { 39773 modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create custom template'); 39774 } 39775 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 39776 title: modalTitle, 39777 className: dist_clsx('edit-site-add-new-template__modal', { 39778 'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList, 39779 'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate 39780 }), 39781 onRequestClose: onModalClose, 39782 overlayClassName: modalContent === modalContentMap.customGenericTemplate ? 'edit-site-custom-generic-template__modal' : undefined, 39783 children: [modalContent === modalContentMap.templatesList && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 39784 columns: isMobile ? 2 : 3, 39785 gap: 4, 39786 align: "flex-start", 39787 justify: "center", 39788 className: "edit-site-add-new-template__template-list__contents", 39789 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 39790 className: "edit-site-add-new-template__template-list__prompt", 39791 children: (0,external_wp_i18n_namespaceObject.__)('Select what the new template should apply to:') 39792 }), missingTemplates.map(template => { 39793 const { 39794 title, 39795 slug, 39796 onClick 39797 } = template; 39798 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 39799 title: title, 39800 direction: "column", 39801 className: "edit-site-add-new-template__template-button", 39802 description: TEMPLATE_SHORT_DESCRIPTIONS[slug], 39803 icon: TEMPLATE_ICONS[slug] || library_layout, 39804 onClick: () => onClick ? onClick(template) : createTemplate(template) 39805 }, slug); 39806 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 39807 title: (0,external_wp_i18n_namespaceObject.__)('Custom template'), 39808 direction: "row", 39809 className: "edit-site-add-new-template__custom-template-button", 39810 icon: edit, 39811 onClick: () => setModalContent(modalContentMap.customGenericTemplate), 39812 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39813 lineHeight: 1.53846153846 // 20px 39814 , 39815 children: (0,external_wp_i18n_namespaceObject.__)('A custom template can be manually applied to any post or page.') 39816 }) 39817 })] 39818 }), modalContent === modalContentMap.customTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_template_modal_content, { 39819 onSelect: createTemplate, 39820 entityForSuggestions: entityForSuggestions 39821 }), modalContent === modalContentMap.customGenericTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_generic_template_modal_content, { 39822 onClose: onModalClose, 39823 createTemplate: createTemplate 39824 })] 39825 }); 39826 } 39827 function NewTemplate() { 39828 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 39829 const { 39830 postType 39831 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39832 const { 39833 getPostType 39834 } = select(external_wp_coreData_namespaceObject.store); 39835 return { 39836 postType: getPostType(TEMPLATE_POST_TYPE) 39837 }; 39838 }, []); 39839 if (!postType) { 39840 return null; 39841 } 39842 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39843 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39844 variant: "primary", 39845 onClick: () => setShowModal(true), 39846 label: postType.labels.add_new_item, 39847 __next40pxDefaultSize: true, 39848 children: postType.labels.add_new_item 39849 }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { 39850 onClose: () => setShowModal(false) 39851 })] 39852 }); 39853 } 39854 function useMissingTemplates(setEntityForSuggestions, onClick) { 39855 const existingTemplates = useExistingTemplates(); 39856 const defaultTemplateTypes = useDefaultTemplateTypes(); 39857 const existingTemplateSlugs = (existingTemplates || []).map(({ 39858 slug 39859 }) => slug); 39860 const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)); 39861 const onClickMenuItem = _entityForSuggestions => { 39862 onClick?.(); 39863 setEntityForSuggestions(_entityForSuggestions); 39864 }; 39865 // We need to replace existing default template types with 39866 // the create specific template functionality. The original 39867 // info (title, description, etc.) is preserved in the 39868 // used hooks. 39869 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; 39870 const { 39871 defaultTaxonomiesMenuItems, 39872 taxonomiesMenuItems 39873 } = useTaxonomiesMenuItems(onClickMenuItem); 39874 const { 39875 defaultPostTypesMenuItems, 39876 postTypesMenuItems 39877 } = usePostTypeMenuItems(onClickMenuItem); 39878 const authorMenuItem = useAuthorMenuItem(onClickMenuItem); 39879 [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => { 39880 if (!menuItem) { 39881 return; 39882 } 39883 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug); 39884 // Some default template types might have been filtered above from 39885 // `missingDefaultTemplates` because they only check for the general 39886 // template. So here we either replace or append the item, augmented 39887 // with the check if it has available specific item to create a 39888 // template for. 39889 if (matchIndex > -1) { 39890 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; 39891 } else { 39892 enhancedMissingDefaultTemplateTypes.push(menuItem); 39893 } 39894 }); 39895 // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order. 39896 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { 39897 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); 39898 }); 39899 const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems]; 39900 return missingTemplates; 39901 } 39902 /* harmony default export */ const add_new_template = ((0,external_wp_element_namespaceObject.memo)(NewTemplate)); 39903 39904 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js 39905 /** 39906 * External dependencies 39907 */ 39908 39909 39910 /** 39911 * WordPress dependencies 39912 */ 39913 39914 39915 39916 39917 39918 39919 39920 39921 /** 39922 * Internal dependencies 39923 */ 39924 39925 39926 39927 39928 const { 39929 useGlobalStyle: page_templates_fields_useGlobalStyle 39930 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 39931 function fields_PreviewField({ 39932 item 39933 }) { 39934 const settings = usePatternSettings(); 39935 const [backgroundColor = 'white'] = page_templates_fields_useGlobalStyle('color.background'); 39936 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 39937 return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw); 39938 }, [item.content.raw]); 39939 const isEmpty = !blocks?.length; 39940 // Wrap everything in a block editor provider to ensure 'styles' that are needed 39941 // for the previews are synced between the site editor store and the block editor store. 39942 // Additionally we need to have the `__experimentalBlockPatterns` setting in order to 39943 // render patterns inside the previews. 39944 // TODO: Same approach is used in the patterns list and it becomes obvious that some of 39945 // the block editor settings are needed in context where we don't have the block editor. 39946 // Explore how we can solve this in a better way. 39947 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { 39948 post: item, 39949 settings: settings, 39950 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 39951 className: "page-templates-preview-field", 39952 style: { 39953 backgroundColor 39954 }, 39955 children: [isEmpty && (0,external_wp_i18n_namespaceObject.__)('Empty template'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { 39956 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 39957 blocks: blocks 39958 }) 39959 })] 39960 }) 39961 }); 39962 } 39963 const fields_previewField = { 39964 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 39965 id: 'preview', 39966 render: fields_PreviewField, 39967 enableSorting: false 39968 }; 39969 const descriptionField = { 39970 label: (0,external_wp_i18n_namespaceObject.__)('Description'), 39971 id: 'description', 39972 render: ({ 39973 item 39974 }) => { 39975 return item.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 39976 className: "page-templates-description", 39977 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description) 39978 }); 39979 }, 39980 enableSorting: false, 39981 enableGlobalSearch: true 39982 }; 39983 function fields_AuthorField({ 39984 item 39985 }) { 39986 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 39987 const { 39988 text, 39989 icon, 39990 imageUrl 39991 } = useAddedBy(item.type, item.id); 39992 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 39993 alignment: "left", 39994 spacing: 0, 39995 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39996 className: dist_clsx('page-templates-author-field__avatar', { 39997 'is-loaded': isImageLoaded 39998 }), 39999 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 40000 onLoad: () => setIsImageLoaded(true), 40001 alt: "", 40002 src: imageUrl 40003 }) 40004 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40005 className: "page-templates-author-field__icon", 40006 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 40007 icon: icon 40008 }) 40009 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 40010 className: "page-templates-author-field__name", 40011 children: text 40012 })] 40013 }); 40014 } 40015 const authorField = { 40016 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 40017 id: 'author', 40018 getValue: ({ 40019 item 40020 }) => item.author_text, 40021 render: fields_AuthorField 40022 }; 40023 40024 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js 40025 /* wp:polyfill */ 40026 /** 40027 * WordPress dependencies 40028 */ 40029 40030 40031 40032 40033 40034 40035 40036 40037 /** 40038 * Internal dependencies 40039 */ 40040 40041 40042 40043 40044 40045 40046 40047 40048 const { 40049 usePostActions: page_templates_usePostActions, 40050 templateTitleField 40051 } = unlock(external_wp_editor_namespaceObject.privateApis); 40052 const { 40053 useHistory: page_templates_useHistory, 40054 useLocation: page_templates_useLocation 40055 } = unlock(external_wp_router_namespaceObject.privateApis); 40056 const { 40057 useEntityRecordsWithPermissions 40058 } = unlock(external_wp_coreData_namespaceObject.privateApis); 40059 const page_templates_EMPTY_ARRAY = []; 40060 const page_templates_defaultLayouts = { 40061 [LAYOUT_TABLE]: { 40062 showMedia: false, 40063 layout: { 40064 styles: { 40065 author: { 40066 width: '1%' 40067 } 40068 } 40069 } 40070 }, 40071 [LAYOUT_GRID]: { 40072 showMedia: true 40073 }, 40074 [LAYOUT_LIST]: { 40075 showMedia: false 40076 } 40077 }; 40078 const page_templates_DEFAULT_VIEW = { 40079 type: LAYOUT_GRID, 40080 search: '', 40081 page: 1, 40082 perPage: 20, 40083 sort: { 40084 field: 'title', 40085 direction: 'asc' 40086 }, 40087 titleField: 'title', 40088 descriptionField: 'description', 40089 mediaField: 'preview', 40090 fields: ['author'], 40091 filters: [], 40092 ...page_templates_defaultLayouts[LAYOUT_GRID] 40093 }; 40094 function PageTemplates() { 40095 const { 40096 path, 40097 query 40098 } = page_templates_useLocation(); 40099 const { 40100 activeView = 'all', 40101 layout, 40102 postId 40103 } = query; 40104 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([postId]); 40105 const defaultView = (0,external_wp_element_namespaceObject.useMemo)(() => { 40106 const usedType = layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type; 40107 return { 40108 ...page_templates_DEFAULT_VIEW, 40109 type: usedType, 40110 filters: activeView !== 'all' ? [{ 40111 field: 'author', 40112 operator: 'isAny', 40113 value: [activeView] 40114 }] : [], 40115 ...page_templates_defaultLayouts[usedType] 40116 }; 40117 }, [layout, activeView]); 40118 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(defaultView); 40119 40120 // Sync the layout from the URL to the view state. 40121 (0,external_wp_element_namespaceObject.useEffect)(() => { 40122 setView(currentView => ({ 40123 ...currentView, 40124 type: layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type 40125 })); 40126 }, [setView, layout]); 40127 40128 // Sync the active view from the URL to the view state. 40129 (0,external_wp_element_namespaceObject.useEffect)(() => { 40130 setView(currentView => ({ 40131 ...currentView, 40132 filters: activeView !== 'all' ? [{ 40133 field: 'author', 40134 operator: OPERATOR_IS_ANY, 40135 value: [activeView] 40136 }] : [] 40137 })); 40138 }, [setView, activeView]); 40139 const { 40140 records, 40141 isResolving: isLoadingData 40142 } = useEntityRecordsWithPermissions('postType', TEMPLATE_POST_TYPE, { 40143 per_page: -1 40144 }); 40145 const history = page_templates_useHistory(); 40146 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 40147 setSelection(items); 40148 if (view?.type === LAYOUT_LIST) { 40149 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 40150 postId: items.length === 1 ? items[0] : undefined 40151 })); 40152 } 40153 }, [history, path, view?.type]); 40154 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 40155 if (!records) { 40156 return page_templates_EMPTY_ARRAY; 40157 } 40158 const authorsSet = new Set(); 40159 records.forEach(template => { 40160 authorsSet.add(template.author_text); 40161 }); 40162 return Array.from(authorsSet).map(author => ({ 40163 value: author, 40164 label: author 40165 })); 40166 }, [records]); 40167 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [fields_previewField, templateTitleField, descriptionField, { 40168 ...authorField, 40169 elements: authors 40170 }], [authors]); 40171 const { 40172 data, 40173 paginationInfo 40174 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 40175 return filterSortAndPaginate(records, view, fields); 40176 }, [records, view, fields]); 40177 const postTypeActions = page_templates_usePostActions({ 40178 postType: TEMPLATE_POST_TYPE, 40179 context: 'list' 40180 }); 40181 const editAction = useEditPostAction(); 40182 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 40183 const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)(newView => { 40184 setView(newView); 40185 if (newView.type !== layout) { 40186 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 40187 layout: newView.type 40188 })); 40189 } 40190 }); 40191 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 40192 className: "edit-site-page-templates", 40193 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 40194 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template, {}), 40195 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 40196 paginationInfo: paginationInfo, 40197 fields: fields, 40198 actions: actions, 40199 data: data, 40200 isLoading: isLoadingData, 40201 view: view, 40202 onChangeView: onChangeView, 40203 onChangeSelection: onChangeSelection, 40204 isItemClickable: () => true, 40205 onClickItem: ({ 40206 id 40207 }) => { 40208 history.navigate(`/wp_template/$id}?canvas=edit`); 40209 }, 40210 selection: selection, 40211 defaultLayouts: page_templates_defaultLayouts 40212 }, activeView) 40213 }); 40214 } 40215 40216 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/templates.js 40217 /** 40218 * Internal dependencies 40219 */ 40220 40221 40222 40223 40224 const templatesRoute = { 40225 name: 'templates', 40226 path: '/template', 40227 areas: { 40228 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { 40229 backPath: "/" 40230 }), 40231 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}), 40232 preview({ 40233 query 40234 }) { 40235 const isListView = query.layout === 'list'; 40236 return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; 40237 }, 40238 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) 40239 }, 40240 widths: { 40241 content({ 40242 query 40243 }) { 40244 const isListView = query.layout === 'list'; 40245 return isListView ? 380 : undefined; 40246 } 40247 } 40248 }; 40249 40250 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-item.js 40251 /** 40252 * Internal dependencies 40253 */ 40254 40255 40256 40257 const templateItemRoute = { 40258 name: 'template-item', 40259 path: '/wp_template/*postId', 40260 areas: { 40261 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { 40262 backPath: "/" 40263 }), 40264 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeEditor, {}), 40265 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeEditor, {}) 40266 } 40267 }; 40268 40269 ;// ./node_modules/@wordpress/icons/build-module/library/pages.js 40270 /** 40271 * WordPress dependencies 40272 */ 40273 40274 40275 const pages = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 40276 xmlns: "http://www.w3.org/2000/svg", 40277 viewBox: "0 0 24 24", 40278 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40279 d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" 40280 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40281 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" 40282 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40283 d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" 40284 })] 40285 }); 40286 /* harmony default export */ const library_pages = (pages); 40287 40288 ;// ./node_modules/@wordpress/icons/build-module/library/published.js 40289 /** 40290 * WordPress dependencies 40291 */ 40292 40293 40294 const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40295 xmlns: "http://www.w3.org/2000/svg", 40296 viewBox: "0 0 24 24", 40297 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40298 fillRule: "evenodd", 40299 clipRule: "evenodd", 40300 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" 40301 }) 40302 }); 40303 /* harmony default export */ const library_published = (published); 40304 40305 ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js 40306 /** 40307 * WordPress dependencies 40308 */ 40309 40310 40311 const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40312 xmlns: "http://www.w3.org/2000/svg", 40313 viewBox: "0 0 24 24", 40314 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40315 fillRule: "evenodd", 40316 clipRule: "evenodd", 40317 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" 40318 }) 40319 }); 40320 /* harmony default export */ const library_scheduled = (scheduled); 40321 40322 ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js 40323 /** 40324 * WordPress dependencies 40325 */ 40326 40327 40328 const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40329 xmlns: "http://www.w3.org/2000/svg", 40330 viewBox: "0 0 24 24", 40331 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40332 fillRule: "evenodd", 40333 clipRule: "evenodd", 40334 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" 40335 }) 40336 }); 40337 /* harmony default export */ const library_drafts = (drafts); 40338 40339 ;// ./node_modules/@wordpress/icons/build-module/library/pending.js 40340 /** 40341 * WordPress dependencies 40342 */ 40343 40344 40345 const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40346 xmlns: "http://www.w3.org/2000/svg", 40347 viewBox: "0 0 24 24", 40348 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40349 fillRule: "evenodd", 40350 clipRule: "evenodd", 40351 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" 40352 }) 40353 }); 40354 /* harmony default export */ const library_pending = (pending); 40355 40356 ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 40357 /** 40358 * WordPress dependencies 40359 */ 40360 40361 40362 const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40363 xmlns: "http://www.w3.org/2000/svg", 40364 viewBox: "0 0 24 24", 40365 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40366 fillRule: "evenodd", 40367 clipRule: "evenodd", 40368 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" 40369 }) 40370 }); 40371 /* harmony default export */ const not_allowed = (notAllowed); 40372 40373 ;// ./node_modules/@wordpress/icons/build-module/library/trash.js 40374 /** 40375 * WordPress dependencies 40376 */ 40377 40378 40379 const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40380 xmlns: "http://www.w3.org/2000/svg", 40381 viewBox: "0 0 24 24", 40382 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40383 fillRule: "evenodd", 40384 clipRule: "evenodd", 40385 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" 40386 }) 40387 }); 40388 /* harmony default export */ const library_trash = (trash); 40389 40390 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/default-views.js 40391 /** 40392 * WordPress dependencies 40393 */ 40394 40395 40396 40397 40398 40399 40400 /** 40401 * Internal dependencies 40402 */ 40403 40404 const default_views_defaultLayouts = { 40405 [LAYOUT_TABLE]: {}, 40406 [LAYOUT_GRID]: {}, 40407 [LAYOUT_LIST]: {} 40408 }; 40409 const DEFAULT_POST_BASE = { 40410 type: LAYOUT_LIST, 40411 search: '', 40412 filters: [], 40413 page: 1, 40414 perPage: 20, 40415 sort: { 40416 field: 'title', 40417 direction: 'asc' 40418 }, 40419 showLevels: true, 40420 titleField: 'title', 40421 mediaField: 'featured_media', 40422 fields: ['author', 'status'], 40423 ...default_views_defaultLayouts[LAYOUT_LIST] 40424 }; 40425 function useDefaultViews({ 40426 postType 40427 }) { 40428 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => { 40429 const { 40430 getPostType 40431 } = select(external_wp_coreData_namespaceObject.store); 40432 return getPostType(postType)?.labels; 40433 }, [postType]); 40434 return (0,external_wp_element_namespaceObject.useMemo)(() => { 40435 return [{ 40436 title: labels?.all_items || (0,external_wp_i18n_namespaceObject.__)('All items'), 40437 slug: 'all', 40438 icon: library_pages, 40439 view: DEFAULT_POST_BASE 40440 }, { 40441 title: (0,external_wp_i18n_namespaceObject.__)('Published'), 40442 slug: 'published', 40443 icon: library_published, 40444 view: DEFAULT_POST_BASE, 40445 filters: [{ 40446 field: 'status', 40447 operator: OPERATOR_IS_ANY, 40448 value: 'publish' 40449 }] 40450 }, { 40451 title: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 40452 slug: 'future', 40453 icon: library_scheduled, 40454 view: DEFAULT_POST_BASE, 40455 filters: [{ 40456 field: 'status', 40457 operator: OPERATOR_IS_ANY, 40458 value: 'future' 40459 }] 40460 }, { 40461 title: (0,external_wp_i18n_namespaceObject.__)('Drafts'), 40462 slug: 'drafts', 40463 icon: library_drafts, 40464 view: DEFAULT_POST_BASE, 40465 filters: [{ 40466 field: 'status', 40467 operator: OPERATOR_IS_ANY, 40468 value: 'draft' 40469 }] 40470 }, { 40471 title: (0,external_wp_i18n_namespaceObject.__)('Pending'), 40472 slug: 'pending', 40473 icon: library_pending, 40474 view: DEFAULT_POST_BASE, 40475 filters: [{ 40476 field: 'status', 40477 operator: OPERATOR_IS_ANY, 40478 value: 'pending' 40479 }] 40480 }, { 40481 title: (0,external_wp_i18n_namespaceObject.__)('Private'), 40482 slug: 'private', 40483 icon: not_allowed, 40484 view: DEFAULT_POST_BASE, 40485 filters: [{ 40486 field: 'status', 40487 operator: OPERATOR_IS_ANY, 40488 value: 'private' 40489 }] 40490 }, { 40491 title: (0,external_wp_i18n_namespaceObject.__)('Trash'), 40492 slug: 'trash', 40493 icon: library_trash, 40494 view: { 40495 ...DEFAULT_POST_BASE, 40496 type: LAYOUT_TABLE, 40497 layout: default_views_defaultLayouts[LAYOUT_TABLE].layout 40498 }, 40499 filters: [{ 40500 field: 'status', 40501 operator: OPERATOR_IS_ANY, 40502 value: 'trash' 40503 }] 40504 }]; 40505 }, [labels]); 40506 } 40507 40508 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js 40509 /* wp:polyfill */ 40510 /** 40511 * External dependencies 40512 */ 40513 40514 40515 /** 40516 * WordPress dependencies 40517 */ 40518 40519 40520 40521 40522 40523 /** 40524 * Internal dependencies 40525 */ 40526 40527 40528 40529 const { 40530 useLocation: dataview_item_useLocation 40531 } = unlock(external_wp_router_namespaceObject.privateApis); 40532 function DataViewItem({ 40533 title, 40534 slug, 40535 customViewId, 40536 type, 40537 icon, 40538 isActive, 40539 isCustom, 40540 suffix 40541 }) { 40542 const { 40543 path 40544 } = dataview_item_useLocation(); 40545 const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon; 40546 let activeView = isCustom ? customViewId : slug; 40547 if (activeView === 'all') { 40548 activeView = undefined; 40549 } 40550 const query = { 40551 layout: type, 40552 activeView, 40553 isCustom: isCustom ? 'true' : undefined 40554 }; 40555 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40556 justify: "flex-start", 40557 className: dist_clsx('edit-site-sidebar-dataviews-dataview-item', { 40558 'is-selected': isActive 40559 }), 40560 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40561 icon: iconToUse, 40562 to: (0,external_wp_url_namespaceObject.addQueryArgs)(path, query), 40563 "aria-current": isActive ? 'true' : undefined, 40564 children: title 40565 }), suffix] 40566 }); 40567 } 40568 40569 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/add-new-view.js 40570 /** 40571 * WordPress dependencies 40572 */ 40573 40574 40575 40576 40577 40578 40579 40580 40581 40582 /** 40583 * Internal dependencies 40584 */ 40585 40586 40587 40588 40589 const { 40590 useLocation: add_new_view_useLocation, 40591 useHistory: add_new_view_useHistory 40592 } = unlock(external_wp_router_namespaceObject.privateApis); 40593 function AddNewItemModalContent({ 40594 type, 40595 setIsAdding 40596 }) { 40597 const history = add_new_view_useHistory(); 40598 const { 40599 path 40600 } = add_new_view_useLocation(); 40601 const { 40602 saveEntityRecord 40603 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40604 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 40605 const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); 40606 const defaultViews = useDefaultViews({ 40607 postType: type 40608 }); 40609 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40610 onSubmit: async event => { 40611 event.preventDefault(); 40612 setIsSaving(true); 40613 const { 40614 getEntityRecords 40615 } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store); 40616 let dataViewTaxonomyId; 40617 const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', { 40618 slug: type 40619 }); 40620 if (dataViewTypeRecords && dataViewTypeRecords.length > 0) { 40621 dataViewTaxonomyId = dataViewTypeRecords[0].id; 40622 } else { 40623 const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', { 40624 name: type 40625 }); 40626 if (record && record.id) { 40627 dataViewTaxonomyId = record.id; 40628 } 40629 } 40630 const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', { 40631 title, 40632 status: 'publish', 40633 wp_dataviews_type: dataViewTaxonomyId, 40634 content: JSON.stringify(defaultViews[0].view) 40635 }); 40636 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 40637 activeView: savedRecord.id, 40638 isCustom: 'true' 40639 })); 40640 setIsSaving(false); 40641 setIsAdding(false); 40642 }, 40643 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40644 spacing: "5", 40645 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40646 __next40pxDefaultSize: true, 40647 __nextHasNoMarginBottom: true, 40648 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40649 value: title, 40650 onChange: setTitle, 40651 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40652 className: "patterns-create-modal__name-input" 40653 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40654 justify: "right", 40655 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40656 __next40pxDefaultSize: true, 40657 variant: "tertiary", 40658 onClick: () => { 40659 setIsAdding(false); 40660 }, 40661 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40662 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40663 __next40pxDefaultSize: true, 40664 variant: "primary", 40665 type: "submit", 40666 "aria-disabled": !title || isSaving, 40667 isBusy: isSaving, 40668 children: (0,external_wp_i18n_namespaceObject.__)('Create') 40669 })] 40670 })] 40671 }) 40672 }); 40673 } 40674 function AddNewItem({ 40675 type 40676 }) { 40677 const [isAdding, setIsAdding] = (0,external_wp_element_namespaceObject.useState)(false); 40678 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40679 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40680 icon: library_plus, 40681 onClick: () => { 40682 setIsAdding(true); 40683 }, 40684 className: "dataviews__siderbar-content-add-new-item", 40685 children: (0,external_wp_i18n_namespaceObject.__)('New view') 40686 }), isAdding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40687 title: (0,external_wp_i18n_namespaceObject.__)('Add new view'), 40688 onRequestClose: () => { 40689 setIsAdding(false); 40690 }, 40691 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItemModalContent, { 40692 type: type, 40693 setIsAdding: setIsAdding 40694 }) 40695 })] 40696 }); 40697 } 40698 40699 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/custom-dataviews-list.js 40700 /* wp:polyfill */ 40701 /** 40702 * WordPress dependencies 40703 */ 40704 40705 40706 40707 40708 40709 40710 40711 40712 /** 40713 * Internal dependencies 40714 */ 40715 40716 40717 40718 40719 const { 40720 useHistory: custom_dataviews_list_useHistory, 40721 useLocation: custom_dataviews_list_useLocation 40722 } = unlock(external_wp_router_namespaceObject.privateApis); 40723 const custom_dataviews_list_EMPTY_ARRAY = []; 40724 function RenameItemModalContent({ 40725 dataviewId, 40726 currentTitle, 40727 setIsRenaming 40728 }) { 40729 const { 40730 editEntityRecord 40731 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40732 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(currentTitle); 40733 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40734 onSubmit: async event => { 40735 event.preventDefault(); 40736 await editEntityRecord('postType', 'wp_dataviews', dataviewId, { 40737 title 40738 }); 40739 setIsRenaming(false); 40740 }, 40741 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40742 spacing: "5", 40743 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40744 __next40pxDefaultSize: true, 40745 __nextHasNoMarginBottom: true, 40746 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40747 value: title, 40748 onChange: setTitle, 40749 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40750 className: "patterns-create-modal__name-input" 40751 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40752 justify: "right", 40753 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40754 variant: "tertiary", 40755 __next40pxDefaultSize: true, 40756 onClick: () => { 40757 setIsRenaming(false); 40758 }, 40759 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40760 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40761 variant: "primary", 40762 type: "submit", 40763 "aria-disabled": !title, 40764 __next40pxDefaultSize: true, 40765 children: (0,external_wp_i18n_namespaceObject.__)('Save') 40766 })] 40767 })] 40768 }) 40769 }); 40770 } 40771 function CustomDataViewItem({ 40772 dataviewId, 40773 isActive 40774 }) { 40775 const history = custom_dataviews_list_useHistory(); 40776 const location = custom_dataviews_list_useLocation(); 40777 const { 40778 dataview 40779 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 40780 const { 40781 getEditedEntityRecord 40782 } = select(external_wp_coreData_namespaceObject.store); 40783 return { 40784 dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId) 40785 }; 40786 }, [dataviewId]); 40787 const { 40788 deleteEntityRecord 40789 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40790 const type = (0,external_wp_element_namespaceObject.useMemo)(() => { 40791 const viewContent = JSON.parse(dataview.content); 40792 return viewContent.type; 40793 }, [dataview.content]); 40794 const [isRenaming, setIsRenaming] = (0,external_wp_element_namespaceObject.useState)(false); 40795 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40796 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40797 title: dataview.title, 40798 type: type, 40799 isActive: isActive, 40800 isCustom: true, 40801 customViewId: dataviewId, 40802 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 40803 icon: more_vertical, 40804 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 40805 className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu", 40806 toggleProps: { 40807 style: { 40808 color: 'inherit' 40809 }, 40810 size: 'small' 40811 }, 40812 children: ({ 40813 onClose 40814 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 40815 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40816 onClick: () => { 40817 setIsRenaming(true); 40818 onClose(); 40819 }, 40820 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 40821 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40822 onClick: async () => { 40823 await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, { 40824 force: true 40825 }); 40826 if (isActive) { 40827 history.replace({ 40828 postType: location.query.postType 40829 }); 40830 } 40831 onClose(); 40832 }, 40833 isDestructive: true, 40834 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 40835 })] 40836 }) 40837 }) 40838 }), isRenaming && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40839 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 40840 onRequestClose: () => { 40841 setIsRenaming(false); 40842 }, 40843 focusOnMount: "firstContentElement", 40844 size: "small", 40845 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameItemModalContent, { 40846 dataviewId: dataviewId, 40847 setIsRenaming: setIsRenaming, 40848 currentTitle: dataview.title 40849 }) 40850 })] 40851 }); 40852 } 40853 function useCustomDataViews(type) { 40854 const customDataViews = (0,external_wp_data_namespaceObject.useSelect)(select => { 40855 const { 40856 getEntityRecords 40857 } = select(external_wp_coreData_namespaceObject.store); 40858 const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', { 40859 slug: type 40860 }); 40861 if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) { 40862 return custom_dataviews_list_EMPTY_ARRAY; 40863 } 40864 const dataViews = getEntityRecords('postType', 'wp_dataviews', { 40865 wp_dataviews_type: dataViewTypeRecords[0].id, 40866 orderby: 'date', 40867 order: 'asc' 40868 }); 40869 if (!dataViews) { 40870 return custom_dataviews_list_EMPTY_ARRAY; 40871 } 40872 return dataViews; 40873 }); 40874 return customDataViews; 40875 } 40876 function CustomDataViewsList({ 40877 type, 40878 activeView, 40879 isCustom 40880 }) { 40881 const customDataViews = useCustomDataViews(type); 40882 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40883 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40884 className: "edit-site-sidebar-navigation-screen-dataviews__group-header", 40885 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 40886 level: 2, 40887 children: (0,external_wp_i18n_namespaceObject.__)('Custom Views') 40888 }) 40889 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40890 className: "edit-site-sidebar-navigation-screen-dataviews__custom-items", 40891 children: [customDataViews.map(customViewRecord => { 40892 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewItem, { 40893 dataviewId: customViewRecord.id, 40894 isActive: isCustom && Number(activeView) === customViewRecord.id 40895 }, customViewRecord.id); 40896 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItem, { 40897 type: type 40898 })] 40899 })] 40900 }); 40901 } 40902 40903 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js 40904 /* wp:polyfill */ 40905 /** 40906 * WordPress dependencies 40907 */ 40908 40909 40910 40911 /** 40912 * Internal dependencies 40913 */ 40914 40915 40916 40917 40918 40919 const { 40920 useLocation: sidebar_dataviews_useLocation 40921 } = unlock(external_wp_router_namespaceObject.privateApis); 40922 function DataViewsSidebarContent({ 40923 postType 40924 }) { 40925 const { 40926 query: { 40927 activeView = 'all', 40928 isCustom = 'false' 40929 } 40930 } = sidebar_dataviews_useLocation(); 40931 const defaultViews = useDefaultViews({ 40932 postType 40933 }); 40934 if (!postType) { 40935 return null; 40936 } 40937 const isCustomBoolean = isCustom === 'true'; 40938 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40939 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40940 className: "edit-site-sidebar-dataviews", 40941 children: defaultViews.map(dataview => { 40942 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40943 slug: dataview.slug, 40944 title: dataview.title, 40945 icon: dataview.icon, 40946 type: dataview.view.type, 40947 isActive: !isCustomBoolean && dataview.slug === activeView, 40948 isCustom: false 40949 }, dataview.slug); 40950 }) 40951 }), window?.__experimentalCustomViews && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewsList, { 40952 activeView: activeView, 40953 type: postType, 40954 isCustom: true 40955 })] 40956 }); 40957 } 40958 40959 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 40960 /** 40961 * WordPress dependencies 40962 */ 40963 40964 40965 const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40966 width: "24", 40967 height: "24", 40968 xmlns: "http://www.w3.org/2000/svg", 40969 viewBox: "0 0 24 24", 40970 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40971 fillRule: "evenodd", 40972 clipRule: "evenodd", 40973 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" 40974 }) 40975 }); 40976 /* harmony default export */ const drawer_right = (drawerRight); 40977 40978 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js 40979 /** 40980 * WordPress dependencies 40981 */ 40982 40983 40984 40985 40986 40987 40988 40989 40990 40991 function AddNewPostModal({ 40992 postType, 40993 onSave, 40994 onClose 40995 }) { 40996 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels, [postType]); 40997 const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_namespaceObject.useState)(false); 40998 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 40999 const { 41000 saveEntityRecord 41001 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 41002 const { 41003 createErrorNotice, 41004 createSuccessNotice 41005 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 41006 const { 41007 resolveSelect 41008 } = (0,external_wp_data_namespaceObject.useRegistry)(); 41009 async function createPost(event) { 41010 event.preventDefault(); 41011 if (isCreatingPost) { 41012 return; 41013 } 41014 setIsCreatingPost(true); 41015 try { 41016 const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 41017 const newPage = await saveEntityRecord('postType', postType, { 41018 status: 'draft', 41019 title, 41020 slug: title !== null && title !== void 0 ? title : undefined, 41021 content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)((0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)([], postTypeObject.template)) : undefined 41022 }, { 41023 throwOnError: true 41024 }); 41025 onSave(newPage); 41026 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 41027 // translators: %s: Title of the created post or template, e.g: "Hello world". 41028 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title)), { 41029 type: 'snackbar' 41030 }); 41031 } catch (error) { 41032 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the item.'); 41033 createErrorNotice(errorMessage, { 41034 type: 'snackbar' 41035 }); 41036 } finally { 41037 setIsCreatingPost(false); 41038 } 41039 } 41040 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 41041 title: 41042 // translators: %s: post type singular_name label e.g: "Page". 41043 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Draft new: %s'), labels?.singular_name), 41044 onRequestClose: onClose, 41045 focusOnMount: "firstContentElement", 41046 size: "small", 41047 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 41048 onSubmit: createPost, 41049 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 41050 spacing: 4, 41051 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 41052 __next40pxDefaultSize: true, 41053 __nextHasNoMarginBottom: true, 41054 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 41055 onChange: setTitle, 41056 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 41057 value: title 41058 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41059 spacing: 2, 41060 justify: "end", 41061 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41062 __next40pxDefaultSize: true, 41063 variant: "tertiary", 41064 onClick: onClose, 41065 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 41066 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41067 __next40pxDefaultSize: true, 41068 variant: "primary", 41069 type: "submit", 41070 isBusy: isCreatingPost, 41071 "aria-disabled": isCreatingPost, 41072 children: (0,external_wp_i18n_namespaceObject.__)('Create draft') 41073 })] 41074 })] 41075 }) 41076 }) 41077 }); 41078 } 41079 41080 ;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js 41081 /* wp:polyfill */ 41082 /** 41083 * WordPress dependencies 41084 */ 41085 41086 41087 41088 41089 41090 41091 41092 41093 41094 41095 41096 41097 /** 41098 * Internal dependencies 41099 */ 41100 41101 41102 41103 41104 41105 41106 41107 const { 41108 usePostActions: post_list_usePostActions, 41109 usePostFields 41110 } = unlock(external_wp_editor_namespaceObject.privateApis); 41111 const { 41112 useLocation: post_list_useLocation, 41113 useHistory: post_list_useHistory 41114 } = unlock(external_wp_router_namespaceObject.privateApis); 41115 const { 41116 useEntityRecordsWithPermissions: post_list_useEntityRecordsWithPermissions 41117 } = unlock(external_wp_coreData_namespaceObject.privateApis); 41118 const post_list_EMPTY_ARRAY = []; 41119 const getDefaultView = (defaultViews, activeView) => { 41120 return defaultViews.find(({ 41121 slug 41122 }) => slug === activeView)?.view; 41123 }; 41124 const getCustomView = editedEntityRecord => { 41125 if (!editedEntityRecord?.content) { 41126 return undefined; 41127 } 41128 const content = JSON.parse(editedEntityRecord.content); 41129 if (!content) { 41130 return undefined; 41131 } 41132 return { 41133 ...content, 41134 ...default_views_defaultLayouts[content.type] 41135 }; 41136 }; 41137 41138 /** 41139 * This function abstracts working with default & custom views by 41140 * providing a [ state, setState ] tuple based on the URL parameters. 41141 * 41142 * Consumers use the provided tuple to work with state 41143 * and don't have to deal with the specifics of default & custom views. 41144 * 41145 * @param {string} postType Post type to retrieve default views for. 41146 * @return {Array} The [ state, setState ] tuple. 41147 */ 41148 function useView(postType) { 41149 const { 41150 path, 41151 query: { 41152 activeView = 'all', 41153 isCustom = 'false', 41154 layout 41155 } 41156 } = post_list_useLocation(); 41157 const history = post_list_useHistory(); 41158 const defaultViews = useDefaultViews({ 41159 postType 41160 }); 41161 const { 41162 editEntityRecord 41163 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 41164 const editedEntityRecord = (0,external_wp_data_namespaceObject.useSelect)(select => { 41165 if (isCustom !== 'true') { 41166 return undefined; 41167 } 41168 const { 41169 getEditedEntityRecord 41170 } = select(external_wp_coreData_namespaceObject.store); 41171 return getEditedEntityRecord('postType', 'wp_dataviews', Number(activeView)); 41172 }, [activeView, isCustom]); 41173 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(() => { 41174 let initialView; 41175 if (isCustom === 'true') { 41176 var _getCustomView; 41177 initialView = (_getCustomView = getCustomView(editedEntityRecord)) !== null && _getCustomView !== void 0 ? _getCustomView : { 41178 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 41179 }; 41180 } else { 41181 var _getDefaultView; 41182 initialView = (_getDefaultView = getDefaultView(defaultViews, activeView)) !== null && _getDefaultView !== void 0 ? _getDefaultView : { 41183 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 41184 }; 41185 } 41186 const type = layout !== null && layout !== void 0 ? layout : initialView.type; 41187 return { 41188 ...initialView, 41189 type, 41190 ...default_views_defaultLayouts[type] 41191 }; 41192 }); 41193 const setViewWithUrlUpdate = (0,external_wp_compose_namespaceObject.useEvent)(newView => { 41194 setView(newView); 41195 if (isCustom === 'true' && editedEntityRecord?.id) { 41196 editEntityRecord('postType', 'wp_dataviews', editedEntityRecord?.id, { 41197 content: JSON.stringify(newView) 41198 }); 41199 } 41200 const currentUrlLayout = layout !== null && layout !== void 0 ? layout : LAYOUT_LIST; 41201 if (newView.type !== currentUrlLayout) { 41202 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 41203 layout: newView.type 41204 })); 41205 } 41206 }); 41207 41208 // When layout URL param changes, update the view type 41209 // without affecting any other config. 41210 const onUrlLayoutChange = (0,external_wp_compose_namespaceObject.useEvent)(() => { 41211 setView(prevView => { 41212 const newType = layout !== null && layout !== void 0 ? layout : LAYOUT_LIST; 41213 if (newType === prevView.type) { 41214 return prevView; 41215 } 41216 return { 41217 ...prevView, 41218 type: newType, 41219 ...default_views_defaultLayouts[newType] 41220 }; 41221 }); 41222 }); 41223 (0,external_wp_element_namespaceObject.useEffect)(() => { 41224 onUrlLayoutChange(); 41225 }, [onUrlLayoutChange, layout]); 41226 41227 // When activeView or isCustom URL parameters change, reset the view. 41228 const onUrlActiveViewChange = (0,external_wp_compose_namespaceObject.useEvent)(() => { 41229 let newView; 41230 if (isCustom === 'true') { 41231 newView = getCustomView(editedEntityRecord); 41232 } else { 41233 newView = getDefaultView(defaultViews, activeView); 41234 } 41235 if (newView) { 41236 const type = layout !== null && layout !== void 0 ? layout : newView.type; 41237 setView({ 41238 ...newView, 41239 type, 41240 ...default_views_defaultLayouts[type] 41241 }); 41242 } 41243 }); 41244 (0,external_wp_element_namespaceObject.useEffect)(() => { 41245 onUrlActiveViewChange(); 41246 }, [onUrlActiveViewChange, activeView, isCustom, defaultViews, editedEntityRecord]); 41247 return [view, setViewWithUrlUpdate]; 41248 } 41249 const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'. 41250 41251 function getItemId(item) { 41252 return item.id.toString(); 41253 } 41254 function getItemLevel(item) { 41255 return item.level; 41256 } 41257 function PostList({ 41258 postType 41259 }) { 41260 var _postId$split, _data$map, _usePrevious; 41261 const [view, setView] = useView(postType); 41262 const defaultViews = useDefaultViews({ 41263 postType 41264 }); 41265 const history = post_list_useHistory(); 41266 const location = post_list_useLocation(); 41267 const { 41268 postId, 41269 quickEdit = false, 41270 isCustom, 41271 activeView = 'all' 41272 } = location.query; 41273 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)((_postId$split = postId?.split(',')) !== null && _postId$split !== void 0 ? _postId$split : []); 41274 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 41275 var _location$query$isCus; 41276 setSelection(items); 41277 if (((_location$query$isCus = location.query.isCustom) !== null && _location$query$isCus !== void 0 ? _location$query$isCus : 'false') === 'false') { 41278 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { 41279 postId: items.join(',') 41280 })); 41281 } 41282 }, [location.path, location.query.isCustom, history]); 41283 const getActiveViewFilters = (views, match) => { 41284 var _found$filters; 41285 const found = views.find(({ 41286 slug 41287 }) => slug === match); 41288 return (_found$filters = found?.filters) !== null && _found$filters !== void 0 ? _found$filters : []; 41289 }; 41290 const { 41291 isLoading: isLoadingFields, 41292 fields: _fields 41293 } = usePostFields({ 41294 postType 41295 }); 41296 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 41297 const activeViewFilters = getActiveViewFilters(defaultViews, activeView).map(({ 41298 field 41299 }) => field); 41300 return _fields.map(field => ({ 41301 ...field, 41302 elements: activeViewFilters.includes(field.id) ? [] : field.elements 41303 })); 41304 }, [_fields, defaultViews, activeView]); 41305 const queryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => { 41306 const filters = {}; 41307 view.filters?.forEach(filter => { 41308 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 41309 filters.status = filter.value; 41310 } 41311 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 41312 filters.author = filter.value; 41313 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 41314 filters.author_exclude = filter.value; 41315 } 41316 }); 41317 41318 // The bundled views want data filtered without displaying the filter. 41319 const activeViewFilters = getActiveViewFilters(defaultViews, activeView); 41320 activeViewFilters.forEach(filter => { 41321 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 41322 filters.status = filter.value; 41323 } 41324 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 41325 filters.author = filter.value; 41326 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 41327 filters.author_exclude = filter.value; 41328 } 41329 }); 41330 41331 // We want to provide a different default item for the status filter 41332 // than the REST API provides. 41333 if (!filters.status || filters.status === '') { 41334 filters.status = DEFAULT_STATUSES; 41335 } 41336 return { 41337 per_page: view.perPage, 41338 page: view.page, 41339 _embed: 'author', 41340 order: view.sort?.direction, 41341 orderby: view.sort?.field, 41342 orderby_hierarchy: !!view.showLevels, 41343 search: view.search, 41344 ...filters 41345 }; 41346 }, [view, activeView, defaultViews]); 41347 const { 41348 records, 41349 isResolving: isLoadingData, 41350 totalItems, 41351 totalPages 41352 } = post_list_useEntityRecordsWithPermissions('postType', postType, queryArgs); 41353 41354 // The REST API sort the authors by ID, but we want to sort them by name. 41355 const data = (0,external_wp_element_namespaceObject.useMemo)(() => { 41356 if (!isLoadingFields && view?.sort?.field === 'author') { 41357 return filterSortAndPaginate(records, { 41358 sort: { 41359 ...view.sort 41360 } 41361 }, fields).data; 41362 } 41363 return records; 41364 }, [records, fields, isLoadingFields, view?.sort]); 41365 const ids = (_data$map = data?.map(record => getItemId(record))) !== null && _data$map !== void 0 ? _data$map : []; 41366 const prevIds = (_usePrevious = (0,external_wp_compose_namespaceObject.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : []; 41367 const deletedIds = prevIds.filter(id => !ids.includes(id)); 41368 const postIdWasDeleted = deletedIds.includes(postId); 41369 (0,external_wp_element_namespaceObject.useEffect)(() => { 41370 if (postIdWasDeleted) { 41371 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { 41372 postId: undefined 41373 })); 41374 } 41375 }, [history, postIdWasDeleted, location.path]); 41376 const paginationInfo = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 41377 totalItems, 41378 totalPages 41379 }), [totalItems, totalPages]); 41380 const { 41381 labels, 41382 canCreateRecord 41383 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 41384 const { 41385 getPostType, 41386 canUser 41387 } = select(external_wp_coreData_namespaceObject.store); 41388 return { 41389 labels: getPostType(postType)?.labels, 41390 canCreateRecord: canUser('create', { 41391 kind: 'postType', 41392 name: postType 41393 }) 41394 }; 41395 }, [postType]); 41396 const postTypeActions = post_list_usePostActions({ 41397 postType, 41398 context: 'list' 41399 }); 41400 const editAction = useEditPostAction(); 41401 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 41402 const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_namespaceObject.useState)(false); 41403 const openModal = () => setShowAddPostModal(true); 41404 const closeModal = () => setShowAddPostModal(false); 41405 const handleNewPage = ({ 41406 type, 41407 id 41408 }) => { 41409 history.navigate(`/$type}/$id}?canvas=edit`); 41410 closeModal(); 41411 }; 41412 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 41413 title: labels?.name, 41414 actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 41415 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41416 variant: "primary", 41417 onClick: openModal, 41418 __next40pxDefaultSize: true, 41419 children: labels.add_new_item 41420 }), showAddPostModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPostModal, { 41421 postType: postType, 41422 onSave: handleNewPage, 41423 onClose: closeModal 41424 })] 41425 }), 41426 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 41427 paginationInfo: paginationInfo, 41428 fields: fields, 41429 actions: actions, 41430 data: data || post_list_EMPTY_ARRAY, 41431 isLoading: isLoadingData || isLoadingFields, 41432 view: view, 41433 onChangeView: setView, 41434 selection: selection, 41435 onChangeSelection: onChangeSelection, 41436 isItemClickable: item => item.status !== 'trash', 41437 onClickItem: ({ 41438 id 41439 }) => { 41440 history.navigate(`/$postType}/$id}?canvas=edit`); 41441 }, 41442 getItemId: getItemId, 41443 getItemLevel: getItemLevel, 41444 defaultLayouts: default_views_defaultLayouts, 41445 header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41446 size: "compact", 41447 isPressed: quickEdit, 41448 icon: drawer_right, 41449 label: (0,external_wp_i18n_namespaceObject.__)('Details'), 41450 onClick: () => { 41451 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { 41452 quickEdit: quickEdit ? undefined : true 41453 })); 41454 } 41455 }) 41456 }, activeView + isCustom) 41457 }); 41458 } 41459 41460 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js 41461 /** 41462 * WordPress dependencies 41463 */ 41464 41465 41466 /** 41467 * Internal dependencies 41468 */ 41469 41470 const DataFormContext = (0,external_wp_element_namespaceObject.createContext)({ 41471 fields: [] 41472 }); 41473 function DataFormProvider({ 41474 fields, 41475 children 41476 }) { 41477 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { 41478 value: { 41479 fields 41480 }, 41481 children: children 41482 }); 41483 } 41484 /* harmony default export */ const dataform_context = (DataFormContext); 41485 41486 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/is-combined-field.js 41487 /** 41488 * Internal dependencies 41489 */ 41490 41491 function isCombinedField(field) { 41492 return field.children !== undefined; 41493 } 41494 41495 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js 41496 /* wp:polyfill */ 41497 /** 41498 * WordPress dependencies 41499 */ 41500 41501 41502 41503 /** 41504 * Internal dependencies 41505 */ 41506 41507 41508 41509 41510 41511 function regular_Header({ 41512 title 41513 }) { 41514 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 41515 className: "dataforms-layouts-regular__header", 41516 spacing: 4, 41517 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41518 alignment: "center", 41519 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 41520 level: 2, 41521 size: 13, 41522 children: title 41523 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})] 41524 }) 41525 }); 41526 } 41527 function FormRegularField({ 41528 data, 41529 field, 41530 onChange, 41531 hideLabelFromVision 41532 }) { 41533 var _field$labelPosition; 41534 const { 41535 fields 41536 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 41537 const form = (0,external_wp_element_namespaceObject.useMemo)(() => { 41538 if (isCombinedField(field)) { 41539 return { 41540 fields: field.children.map(child => { 41541 if (typeof child === 'string') { 41542 return { 41543 id: child 41544 }; 41545 } 41546 return child; 41547 }), 41548 type: 'regular' 41549 }; 41550 } 41551 return { 41552 type: 'regular', 41553 fields: [] 41554 }; 41555 }, [field]); 41556 if (isCombinedField(field)) { 41557 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 41558 children: [!hideLabelFromVision && field.label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(regular_Header, { 41559 title: field.label 41560 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 41561 data: data, 41562 form: form, 41563 onChange: onChange 41564 })] 41565 }); 41566 } 41567 const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'top'; 41568 const fieldDefinition = fields.find(fieldDef => fieldDef.id === field.id); 41569 if (!fieldDefinition) { 41570 return null; 41571 } 41572 if (labelPosition === 'side') { 41573 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41574 className: "dataforms-layouts-regular__field", 41575 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41576 className: "dataforms-layouts-regular__field-label", 41577 children: fieldDefinition.label 41578 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41579 className: "dataforms-layouts-regular__field-control", 41580 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { 41581 data: data, 41582 field: fieldDefinition, 41583 onChange: onChange, 41584 hideLabelFromVision: true 41585 }, fieldDefinition.id) 41586 })] 41587 }); 41588 } 41589 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41590 className: "dataforms-layouts-regular__field", 41591 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { 41592 data: data, 41593 field: fieldDefinition, 41594 onChange: onChange, 41595 hideLabelFromVision: labelPosition === 'none' ? true : hideLabelFromVision 41596 }) 41597 }); 41598 } 41599 41600 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js 41601 /* wp:polyfill */ 41602 /** 41603 * WordPress dependencies 41604 */ 41605 41606 41607 41608 41609 41610 /** 41611 * Internal dependencies 41612 */ 41613 41614 41615 41616 41617 41618 function DropdownHeader({ 41619 title, 41620 onClose 41621 }) { 41622 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 41623 className: "dataforms-layouts-panel__dropdown-header", 41624 spacing: 4, 41625 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41626 alignment: "center", 41627 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 41628 level: 2, 41629 size: 13, 41630 children: title 41631 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41632 label: (0,external_wp_i18n_namespaceObject.__)('Close'), 41633 icon: close_small, 41634 onClick: onClose, 41635 size: "small" 41636 })] 41637 }) 41638 }); 41639 } 41640 function PanelDropdown({ 41641 fieldDefinition, 41642 popoverAnchor, 41643 labelPosition = 'side', 41644 data, 41645 onChange, 41646 field 41647 }) { 41648 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 41649 const form = (0,external_wp_element_namespaceObject.useMemo)(() => { 41650 if (isCombinedField(field)) { 41651 return { 41652 type: 'regular', 41653 fields: field.children.map(child => { 41654 if (typeof child === 'string') { 41655 return { 41656 id: child 41657 }; 41658 } 41659 return child; 41660 }) 41661 }; 41662 } 41663 // If not explicit children return the field id itself. 41664 return { 41665 type: 'regular', 41666 fields: [{ 41667 id: field.id 41668 }] 41669 }; 41670 }, [field]); 41671 41672 // Memoize popoverProps to avoid returning a new object every time. 41673 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 41674 // Anchor the popover to the middle of the entire row so that it doesn't 41675 // move around when the label changes. 41676 anchor: popoverAnchor, 41677 placement: 'left-start', 41678 offset: 36, 41679 shift: true 41680 }), [popoverAnchor]); 41681 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 41682 contentClassName: "dataforms-layouts-panel__field-dropdown", 41683 popoverProps: popoverProps, 41684 focusOnMount: true, 41685 toggleProps: { 41686 size: 'compact', 41687 variant: 'tertiary', 41688 tooltipPosition: 'middle left' 41689 }, 41690 renderToggle: ({ 41691 isOpen, 41692 onToggle 41693 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41694 className: "dataforms-layouts-panel__field-control", 41695 size: "compact", 41696 variant: ['none', 'top'].includes(labelPosition) ? 'link' : 'tertiary', 41697 "aria-expanded": isOpen, 41698 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 41699 // translators: %s: Field name. 41700 (0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), fieldLabel), 41701 onClick: onToggle, 41702 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.render, { 41703 item: data 41704 }) 41705 }), 41706 renderContent: ({ 41707 onClose 41708 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 41709 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { 41710 title: fieldLabel, 41711 onClose: onClose 41712 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 41713 data: data, 41714 form: form, 41715 onChange: onChange, 41716 children: (FieldLayout, nestedField) => { 41717 var _form$fields; 41718 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { 41719 data: data, 41720 field: nestedField, 41721 onChange: onChange, 41722 hideLabelFromVision: ((_form$fields = form?.fields) !== null && _form$fields !== void 0 ? _form$fields : []).length < 2 41723 }, nestedField.id); 41724 } 41725 })] 41726 }) 41727 }); 41728 } 41729 function FormPanelField({ 41730 data, 41731 field, 41732 onChange 41733 }) { 41734 var _field$labelPosition; 41735 const { 41736 fields 41737 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 41738 const fieldDefinition = fields.find(fieldDef => { 41739 // Default to the first child if it is a combined field. 41740 if (isCombinedField(field)) { 41741 const children = field.children.filter(child => typeof child === 'string' || !isCombinedField(child)); 41742 const firstChildFieldId = typeof children[0] === 'string' ? children[0] : children[0].id; 41743 return fieldDef.id === firstChildFieldId; 41744 } 41745 return fieldDef.id === field.id; 41746 }); 41747 const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'side'; 41748 41749 // Use internal state instead of a ref to make sure that the component 41750 // re-renders when the popover's anchor updates. 41751 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 41752 if (!fieldDefinition) { 41753 return null; 41754 } 41755 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 41756 if (labelPosition === 'top') { 41757 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 41758 className: "dataforms-layouts-panel__field", 41759 spacing: 0, 41760 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41761 className: "dataforms-layouts-panel__field-label", 41762 style: { 41763 paddingBottom: 0 41764 }, 41765 children: fieldLabel 41766 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41767 className: "dataforms-layouts-panel__field-control", 41768 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 41769 field: field, 41770 popoverAnchor: popoverAnchor, 41771 fieldDefinition: fieldDefinition, 41772 data: data, 41773 onChange: onChange, 41774 labelPosition: labelPosition 41775 }) 41776 })] 41777 }); 41778 } 41779 if (labelPosition === 'none') { 41780 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41781 className: "dataforms-layouts-panel__field", 41782 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 41783 field: field, 41784 popoverAnchor: popoverAnchor, 41785 fieldDefinition: fieldDefinition, 41786 data: data, 41787 onChange: onChange, 41788 labelPosition: labelPosition 41789 }) 41790 }); 41791 } 41792 41793 // Defaults to label position side. 41794 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41795 ref: setPopoverAnchor, 41796 className: "dataforms-layouts-panel__field", 41797 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41798 className: "dataforms-layouts-panel__field-label", 41799 children: fieldLabel 41800 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41801 className: "dataforms-layouts-panel__field-control", 41802 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 41803 field: field, 41804 popoverAnchor: popoverAnchor, 41805 fieldDefinition: fieldDefinition, 41806 data: data, 41807 onChange: onChange, 41808 labelPosition: labelPosition 41809 }) 41810 })] 41811 }); 41812 } 41813 41814 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js 41815 /* wp:polyfill */ 41816 /** 41817 * Internal dependencies 41818 */ 41819 41820 41821 const FORM_FIELD_LAYOUTS = [{ 41822 type: 'regular', 41823 component: FormRegularField 41824 }, { 41825 type: 'panel', 41826 component: FormPanelField 41827 }]; 41828 function getFormFieldLayout(type) { 41829 return FORM_FIELD_LAYOUTS.find(layout => layout.type === type); 41830 } 41831 41832 ;// ./node_modules/@wordpress/dataviews/build-module/normalize-form-fields.js 41833 /* wp:polyfill */ 41834 /** 41835 * Internal dependencies 41836 */ 41837 41838 function normalizeFormFields(form) { 41839 var _form$type, _form$labelPosition, _form$fields; 41840 let layout = 'regular'; 41841 if (['regular', 'panel'].includes((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : '')) { 41842 layout = form.type; 41843 } 41844 const labelPosition = (_form$labelPosition = form.labelPosition) !== null && _form$labelPosition !== void 0 ? _form$labelPosition : layout === 'regular' ? 'top' : 'side'; 41845 return ((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(field => { 41846 var _field$layout, _field$labelPosition; 41847 if (typeof field === 'string') { 41848 return { 41849 id: field, 41850 layout, 41851 labelPosition 41852 }; 41853 } 41854 const fieldLayout = (_field$layout = field.layout) !== null && _field$layout !== void 0 ? _field$layout : layout; 41855 const fieldLabelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : fieldLayout === 'regular' ? 'top' : 'side'; 41856 return { 41857 ...field, 41858 layout: fieldLayout, 41859 labelPosition: fieldLabelPosition 41860 }; 41861 }); 41862 } 41863 41864 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/data-form-layout.js 41865 /* wp:polyfill */ 41866 /** 41867 * WordPress dependencies 41868 */ 41869 41870 41871 41872 /** 41873 * Internal dependencies 41874 */ 41875 41876 41877 41878 41879 41880 41881 function DataFormLayout({ 41882 data, 41883 form, 41884 onChange, 41885 children 41886 }) { 41887 const { 41888 fields: fieldDefinitions 41889 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 41890 function getFieldDefinition(field) { 41891 const fieldId = typeof field === 'string' ? field : field.id; 41892 return fieldDefinitions.find(fieldDefinition => fieldDefinition.id === fieldId); 41893 } 41894 const normalizedFormFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFormFields(form), [form]); 41895 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 41896 spacing: 2, 41897 children: normalizedFormFields.map(formField => { 41898 const FieldLayout = getFormFieldLayout(formField.layout)?.component; 41899 if (!FieldLayout) { 41900 return null; 41901 } 41902 const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : undefined; 41903 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { 41904 return null; 41905 } 41906 if (children) { 41907 return children(FieldLayout, formField); 41908 } 41909 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { 41910 data: data, 41911 field: formField, 41912 onChange: onChange 41913 }, formField.id); 41914 }) 41915 }); 41916 } 41917 41918 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js 41919 /** 41920 * WordPress dependencies 41921 */ 41922 41923 41924 /** 41925 * Internal dependencies 41926 */ 41927 41928 41929 41930 41931 41932 function DataForm({ 41933 data, 41934 form, 41935 fields, 41936 onChange 41937 }) { 41938 const normalizedFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); 41939 if (!form.fields) { 41940 return null; 41941 } 41942 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { 41943 fields: normalizedFields, 41944 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 41945 data: data, 41946 form: form, 41947 onChange: onChange 41948 }) 41949 }); 41950 } 41951 41952 ;// ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js 41953 /* wp:polyfill */ 41954 /** 41955 * External dependencies 41956 */ 41957 41958 41959 /** 41960 * WordPress dependencies 41961 */ 41962 41963 41964 41965 41966 41967 41968 41969 41970 /** 41971 * Internal dependencies 41972 */ 41973 41974 41975 41976 41977 41978 const { 41979 usePostFields: post_edit_usePostFields, 41980 PostCardPanel 41981 } = unlock(external_wp_editor_namespaceObject.privateApis); 41982 const fieldsWithBulkEditSupport = ['title', 'status', 'date', 'author', 'comment_status']; 41983 function PostEditForm({ 41984 postType, 41985 postId 41986 }) { 41987 const ids = (0,external_wp_element_namespaceObject.useMemo)(() => postId.split(','), [postId]); 41988 const { 41989 record, 41990 hasFinishedResolution 41991 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 41992 const args = ['postType', postType, ids[0]]; 41993 const { 41994 getEditedEntityRecord, 41995 hasFinishedResolution: hasFinished 41996 } = select(external_wp_coreData_namespaceObject.store); 41997 return { 41998 record: ids.length === 1 ? getEditedEntityRecord(...args) : null, 41999 hasFinishedResolution: hasFinished('getEditedEntityRecord', args) 42000 }; 42001 }, [postType, ids]); 42002 const [multiEdits, setMultiEdits] = (0,external_wp_element_namespaceObject.useState)({}); 42003 const { 42004 editEntityRecord 42005 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 42006 const { 42007 fields: _fields 42008 } = post_edit_usePostFields({ 42009 postType 42010 }); 42011 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => _fields?.map(field => { 42012 if (field.id === 'status') { 42013 return { 42014 ...field, 42015 elements: field.elements.filter(element => element.value !== 'trash') 42016 }; 42017 } 42018 return field; 42019 }), [_fields]); 42020 const form = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 42021 type: 'panel', 42022 fields: [{ 42023 id: 'featured_media', 42024 layout: 'regular' 42025 }, { 42026 id: 'status', 42027 label: (0,external_wp_i18n_namespaceObject.__)('Status & Visibility'), 42028 children: ['status', 'password'] 42029 }, 'author', 'date', 'slug', 'parent', 'comment_status', { 42030 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 42031 labelPosition: 'side', 42032 id: 'template', 42033 layout: 'regular' 42034 }].filter(field => ids.length === 1 || fieldsWithBulkEditSupport.includes(field)) 42035 }), [ids]); 42036 const onChange = edits => { 42037 for (const id of ids) { 42038 if (edits.status && edits.status !== 'future' && record?.status === 'future' && new Date(record.date) > new Date()) { 42039 edits.date = null; 42040 } 42041 if (edits.status && edits.status === 'private' && record.password) { 42042 edits.password = ''; 42043 } 42044 editEntityRecord('postType', postType, id, edits); 42045 if (ids.length > 1) { 42046 setMultiEdits(prev => ({ 42047 ...prev, 42048 ...edits 42049 })); 42050 } 42051 } 42052 }; 42053 (0,external_wp_element_namespaceObject.useEffect)(() => { 42054 setMultiEdits({}); 42055 }, [ids]); 42056 const { 42057 ExperimentalBlockEditorProvider 42058 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 42059 const settings = usePatternSettings(); 42060 42061 /** 42062 * The template field depends on the block editor settings. 42063 * This is a workaround to ensure that the block editor settings are available. 42064 * For more information, see: https://github.com/WordPress/gutenberg/issues/67521 42065 */ 42066 const fieldsWithDependency = (0,external_wp_element_namespaceObject.useMemo)(() => { 42067 return fields.map(field => { 42068 if (field.id === 'template') { 42069 return { 42070 ...field, 42071 Edit: data => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { 42072 settings: settings, 42073 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 42074 ...data 42075 }) 42076 }) 42077 }; 42078 } 42079 return field; 42080 }); 42081 }, [fields, settings]); 42082 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 42083 spacing: 4, 42084 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { 42085 postType: postType, 42086 postId: ids 42087 }), hasFinishedResolution && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { 42088 data: ids.length === 1 ? record : multiEdits, 42089 fields: fieldsWithDependency, 42090 form: form, 42091 onChange: onChange 42092 })] 42093 }); 42094 } 42095 function PostEdit({ 42096 postType, 42097 postId 42098 }) { 42099 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 42100 className: dist_clsx('edit-site-post-edit', { 42101 'is-empty': !postId 42102 }), 42103 label: (0,external_wp_i18n_namespaceObject.__)('Post Edit'), 42104 children: [postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { 42105 postType: postType, 42106 postId: postId 42107 }), !postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 42108 children: (0,external_wp_i18n_namespaceObject.__)('Select a page to edit') 42109 })] 42110 }); 42111 } 42112 42113 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pages.js 42114 /** 42115 * WordPress dependencies 42116 */ 42117 42118 42119 42120 /** 42121 * Internal dependencies 42122 */ 42123 42124 42125 42126 42127 42128 42129 42130 const { 42131 useLocation: pages_useLocation 42132 } = unlock(external_wp_router_namespaceObject.privateApis); 42133 function MobilePagesView() { 42134 const { 42135 query = {} 42136 } = pages_useLocation(); 42137 const { 42138 canvas = 'view' 42139 } = query; 42140 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42141 postType: "page" 42142 }); 42143 } 42144 const pagesRoute = { 42145 name: 'pages', 42146 path: '/page', 42147 areas: { 42148 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42149 title: (0,external_wp_i18n_namespaceObject.__)('Pages'), 42150 backPath: "/", 42151 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42152 postType: "page" 42153 }) 42154 }), 42155 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42156 postType: "page" 42157 }), 42158 preview({ 42159 query 42160 }) { 42161 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42162 return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; 42163 }, 42164 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePagesView, {}), 42165 edit({ 42166 query 42167 }) { 42168 var _query$layout; 42169 const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') !== 'list' && !!query.quickEdit; 42170 return hasQuickEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { 42171 postType: "page", 42172 postId: query.postId 42173 }) : undefined; 42174 } 42175 }, 42176 widths: { 42177 content({ 42178 query 42179 }) { 42180 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42181 return isListView ? 380 : undefined; 42182 }, 42183 edit({ 42184 query 42185 }) { 42186 var _query$layout2; 42187 const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') !== 'list' && !!query.quickEdit; 42188 return hasQuickEdit ? 380 : undefined; 42189 } 42190 } 42191 }; 42192 42193 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/page-item.js 42194 /** 42195 * WordPress dependencies 42196 */ 42197 42198 42199 /** 42200 * Internal dependencies 42201 */ 42202 42203 42204 42205 42206 const pageItemRoute = { 42207 name: 'page-item', 42208 path: '/page/:postId', 42209 areas: { 42210 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42211 title: (0,external_wp_i18n_namespaceObject.__)('Pages'), 42212 backPath: "/", 42213 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42214 postType: "page" 42215 }) 42216 }), 42217 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 42218 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 42219 } 42220 }; 42221 42222 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/stylebook.js 42223 /** 42224 * WordPress dependencies 42225 */ 42226 42227 42228 /** 42229 * Internal dependencies 42230 */ 42231 42232 42233 42234 const stylebookRoute = { 42235 name: 'stylebook', 42236 path: '/stylebook', 42237 areas: { 42238 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42239 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 42240 backPath: "/", 42241 description: (0,external_wp_i18n_namespaceObject.__)(`Preview your website's visual identity: colors, typography, and blocks.`) 42242 }), 42243 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { 42244 isStatic: true 42245 }), 42246 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { 42247 isStatic: true 42248 }) 42249 } 42250 }; 42251 42252 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/index.js 42253 /* wp:polyfill */ 42254 /** 42255 * WordPress dependencies 42256 */ 42257 42258 42259 42260 /** 42261 * Internal dependencies 42262 */ 42263 42264 42265 42266 42267 42268 42269 42270 42271 42272 42273 42274 42275 42276 42277 const site_editor_routes_routes = [pageItemRoute, pagesRoute, templateItemRoute, templatesRoute, templatePartItemRoute, patternItemRoute, patternsRoute, navigationItemRoute, navigationRoute, stylesRoute, homeRoute, stylebookRoute]; 42278 function useRegisterSiteEditorRoutes() { 42279 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 42280 const { 42281 registerRoute 42282 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 42283 (0,external_wp_element_namespaceObject.useEffect)(() => { 42284 registry.batch(() => { 42285 site_editor_routes_routes.forEach(registerRoute); 42286 }); 42287 }, [registry, registerRoute]); 42288 } 42289 42290 ;// ./node_modules/@wordpress/edit-site/build-module/components/app/index.js 42291 /** 42292 * WordPress dependencies 42293 */ 42294 42295 42296 42297 42298 /** 42299 * Internal dependencies 42300 */ 42301 42302 42303 42304 42305 42306 42307 42308 42309 const { 42310 RouterProvider 42311 } = unlock(external_wp_router_namespaceObject.privateApis); 42312 function AppLayout() { 42313 useCommonCommands(); 42314 useSetCommandContext(); 42315 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}); 42316 } 42317 function App() { 42318 useRegisterSiteEditorRoutes(); 42319 const routes = (0,external_wp_data_namespaceObject.useSelect)(select => { 42320 return unlock(select(store)).getRoutes(); 42321 }, []); 42322 const beforeNavigate = (0,external_wp_element_namespaceObject.useCallback)(({ 42323 path, 42324 query 42325 }) => { 42326 if (!isPreviewingTheme()) { 42327 return { 42328 path, 42329 query 42330 }; 42331 } 42332 return { 42333 path, 42334 query: { 42335 ...query, 42336 wp_theme_preview: 'wp_theme_preview' in query ? query.wp_theme_preview : currentlyPreviewingTheme() 42337 } 42338 }; 42339 }, []); 42340 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RouterProvider, { 42341 routes: routes, 42342 pathArg: "p", 42343 beforeNavigate: beforeNavigate, 42344 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {}) 42345 }); 42346 } 42347 42348 ;// ./node_modules/@wordpress/edit-site/build-module/deprecated.js 42349 /** 42350 * WordPress dependencies 42351 */ 42352 42353 42354 42355 42356 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 42357 const deprecateSlot = name => { 42358 external_wp_deprecated_default()(`wp.editPost.$name}`, { 42359 since: '6.6', 42360 alternative: `wp.editor.$name}` 42361 }); 42362 }; 42363 42364 /* eslint-disable jsdoc/require-param */ 42365 /** 42366 * @see PluginMoreMenuItem in @wordpress/editor package. 42367 */ 42368 function PluginMoreMenuItem(props) { 42369 if (!isSiteEditor) { 42370 return null; 42371 } 42372 deprecateSlot('PluginMoreMenuItem'); 42373 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { 42374 ...props 42375 }); 42376 } 42377 42378 /** 42379 * @see PluginSidebar in @wordpress/editor package. 42380 */ 42381 function PluginSidebar(props) { 42382 if (!isSiteEditor) { 42383 return null; 42384 } 42385 deprecateSlot('PluginSidebar'); 42386 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { 42387 ...props 42388 }); 42389 } 42390 42391 /** 42392 * @see PluginSidebarMoreMenuItem in @wordpress/editor package. 42393 */ 42394 function PluginSidebarMoreMenuItem(props) { 42395 if (!isSiteEditor) { 42396 return null; 42397 } 42398 deprecateSlot('PluginSidebarMoreMenuItem'); 42399 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { 42400 ...props 42401 }); 42402 } 42403 /* eslint-enable jsdoc/require-param */ 42404 42405 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/posts.js 42406 /** 42407 * WordPress dependencies 42408 */ 42409 42410 42411 42412 /** 42413 * Internal dependencies 42414 */ 42415 42416 42417 42418 42419 42420 42421 42422 const { 42423 useLocation: posts_useLocation 42424 } = unlock(external_wp_router_namespaceObject.privateApis); 42425 function MobilePostsView() { 42426 const { 42427 query = {} 42428 } = posts_useLocation(); 42429 const { 42430 canvas = 'view' 42431 } = query; 42432 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42433 postType: "post" 42434 }); 42435 } 42436 const postsRoute = { 42437 name: 'posts', 42438 path: '/', 42439 areas: { 42440 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42441 title: (0,external_wp_i18n_namespaceObject.__)('Posts'), 42442 isRoot: true, 42443 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42444 postType: "post" 42445 }) 42446 }), 42447 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42448 postType: "post" 42449 }), 42450 preview({ 42451 query 42452 }) { 42453 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42454 return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 42455 isPostsList: true 42456 }) : undefined; 42457 }, 42458 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePostsView, {}), 42459 edit({ 42460 query 42461 }) { 42462 var _query$layout; 42463 const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') === 'list' && !!query.quickEdit; 42464 return hasQuickEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { 42465 postType: "post", 42466 postId: query.postId 42467 }) : undefined; 42468 } 42469 }, 42470 widths: { 42471 content({ 42472 query 42473 }) { 42474 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42475 return isListView ? 380 : undefined; 42476 }, 42477 edit({ 42478 query 42479 }) { 42480 var _query$layout2; 42481 const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') === 'list' && !!query.quickEdit; 42482 return hasQuickEdit ? 380 : undefined; 42483 } 42484 } 42485 }; 42486 42487 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/post-item.js 42488 /** 42489 * WordPress dependencies 42490 */ 42491 42492 42493 /** 42494 * Internal dependencies 42495 */ 42496 42497 42498 42499 42500 const postItemRoute = { 42501 name: 'post-item', 42502 path: '/post/:postId', 42503 areas: { 42504 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42505 title: (0,external_wp_i18n_namespaceObject.__)('Posts'), 42506 isRoot: true, 42507 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42508 postType: "post" 42509 }) 42510 }), 42511 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 42512 isPostsList: true 42513 }), 42514 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 42515 isPostsList: true 42516 }) 42517 } 42518 }; 42519 42520 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/index.js 42521 /* wp:polyfill */ 42522 /** 42523 * WordPress dependencies 42524 */ 42525 42526 42527 42528 /** 42529 * Internal dependencies 42530 */ 42531 42532 42533 42534 42535 const posts_app_routes_routes = [postItemRoute, postsRoute]; 42536 function useRegisterPostsAppRoutes() { 42537 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 42538 const { 42539 registerRoute 42540 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 42541 (0,external_wp_element_namespaceObject.useEffect)(() => { 42542 registry.batch(() => { 42543 posts_app_routes_routes.forEach(registerRoute); 42544 }); 42545 }, [registry, registerRoute]); 42546 } 42547 42548 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js 42549 /** 42550 * WordPress dependencies 42551 */ 42552 42553 42554 42555 /** 42556 * Internal dependencies 42557 */ 42558 42559 42560 42561 42562 42563 const { 42564 RouterProvider: posts_app_RouterProvider 42565 } = unlock(external_wp_router_namespaceObject.privateApis); 42566 function PostsApp() { 42567 useRegisterPostsAppRoutes(); 42568 const routes = (0,external_wp_data_namespaceObject.useSelect)(select => { 42569 return unlock(select(store)).getRoutes(); 42570 }, []); 42571 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { 42572 routes: routes, 42573 pathArg: "p", 42574 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}) 42575 }); 42576 } 42577 42578 ;// ./node_modules/@wordpress/edit-site/build-module/posts.js 42579 /* wp:polyfill */ 42580 /** 42581 * WordPress dependencies 42582 */ 42583 42584 42585 42586 42587 42588 42589 42590 /** 42591 * Internal dependencies 42592 */ 42593 42594 42595 42596 /** 42597 * Internal dependencies 42598 */ 42599 42600 42601 /** 42602 * Initializes the "Posts Dashboard" 42603 * @param {string} id ID of the root element to render the screen in. 42604 * @param {Object} settings Editor settings. 42605 */ 42606 42607 function initializePostsDashboard(id, settings) { 42608 if (true) { 42609 return; 42610 } 42611 const target = document.getElementById(id); 42612 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 42613 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 42614 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 42615 name 42616 }) => name !== 'core/freeform'); 42617 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 42618 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 42619 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 42620 inserter: false 42621 }); 42622 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 42623 inserter: false 42624 }); 42625 if (false) {} 42626 42627 // We dispatch actions and update the store synchronously before rendering 42628 // so that we won't trigger unnecessary re-renders with useEffect. 42629 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 42630 welcomeGuide: true, 42631 welcomeGuideStyles: true, 42632 welcomeGuidePage: true, 42633 welcomeGuideTemplate: true 42634 }); 42635 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 42636 allowRightClickOverrides: true, 42637 distractionFree: false, 42638 editorMode: 'visual', 42639 editorTool: 'edit', 42640 fixedToolbar: false, 42641 focusMode: false, 42642 inactivePanels: [], 42643 keepCaretInsideBlock: false, 42644 openPanels: ['post-status'], 42645 showBlockBreadcrumbs: true, 42646 showListViewByDefault: false, 42647 enableChoosePatternModal: true 42648 }); 42649 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 42650 42651 // Prevent the default browser action for files dropped outside of dropzones. 42652 window.addEventListener('dragover', e => e.preventDefault(), false); 42653 window.addEventListener('drop', e => e.preventDefault(), false); 42654 root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 42655 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) 42656 })); 42657 return root; 42658 } 42659 42660 ;// ./node_modules/@wordpress/edit-site/build-module/index.js 42661 /* wp:polyfill */ 42662 /** 42663 * WordPress dependencies 42664 */ 42665 42666 42667 42668 42669 42670 42671 42672 42673 42674 /** 42675 * Internal dependencies 42676 */ 42677 42678 42679 42680 42681 42682 const { 42683 registerCoreBlockBindingsSources 42684 } = unlock(external_wp_editor_namespaceObject.privateApis); 42685 42686 /** 42687 * Initializes the site editor screen. 42688 * 42689 * @param {string} id ID of the root element to render the screen in. 42690 * @param {Object} settings Editor settings. 42691 */ 42692 function initializeEditor(id, settings) { 42693 const target = document.getElementById(id); 42694 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 42695 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 42696 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 42697 name 42698 }) => name !== 'core/freeform'); 42699 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 42700 registerCoreBlockBindingsSources(); 42701 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 42702 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 42703 inserter: false 42704 }); 42705 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 42706 inserter: false 42707 }); 42708 if (false) {} 42709 42710 // We dispatch actions and update the store synchronously before rendering 42711 // so that we won't trigger unnecessary re-renders with useEffect. 42712 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 42713 welcomeGuide: true, 42714 welcomeGuideStyles: true, 42715 welcomeGuidePage: true, 42716 welcomeGuideTemplate: true 42717 }); 42718 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 42719 allowRightClickOverrides: true, 42720 distractionFree: false, 42721 editorMode: 'visual', 42722 editorTool: 'edit', 42723 fixedToolbar: false, 42724 focusMode: false, 42725 inactivePanels: [], 42726 keepCaretInsideBlock: false, 42727 openPanels: ['post-status'], 42728 showBlockBreadcrumbs: true, 42729 showListViewByDefault: false, 42730 enableChoosePatternModal: true 42731 }); 42732 if (window.__experimentalMediaProcessing) { 42733 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/media', { 42734 requireApproval: true, 42735 optimizeOnUpload: true 42736 }); 42737 } 42738 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 42739 42740 // Prevent the default browser action for files dropped outside of dropzones. 42741 window.addEventListener('dragover', e => e.preventDefault(), false); 42742 window.addEventListener('drop', e => e.preventDefault(), false); 42743 root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 42744 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) 42745 })); 42746 return root; 42747 } 42748 function reinitializeEditor() { 42749 external_wp_deprecated_default()('wp.editSite.reinitializeEditor', { 42750 since: '6.2', 42751 version: '6.3' 42752 }); 42753 } 42754 42755 42756 42757 42758 // Temporary: While the posts dashboard is being iterated on 42759 // it's being built in the same package as the site editor. 42760 42761 42762 })(); 42763 42764 (window.wp = window.wp || {}).editSite = __webpack_exports__; 42765 /******/ })() 42766 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Fri Feb 21 08:20:01 2025 | Cross-referenced by PHPXref |