[ 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 /***/ 8477: 5879 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 5880 5881 "use strict"; 5882 /** 5883 * @license React 5884 * use-sync-external-store-shim.production.min.js 5885 * 5886 * Copyright (c) Facebook, Inc. and its 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 var e=__webpack_require__(1609);function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d} 5892 function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u; 5893 5894 5895 /***/ }), 5896 5897 /***/ 422: 5898 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5899 5900 "use strict"; 5901 5902 5903 if (true) { 5904 module.exports = __webpack_require__(8477); 5905 } else {} 5906 5907 5908 /***/ }), 5909 5910 /***/ 1609: 5911 /***/ ((module) => { 5912 5913 "use strict"; 5914 module.exports = window["React"]; 5915 5916 /***/ }) 5917 5918 /******/ }); 5919 /************************************************************************/ 5920 /******/ // The module cache 5921 /******/ var __webpack_module_cache__ = {}; 5922 /******/ 5923 /******/ // The require function 5924 /******/ function __webpack_require__(moduleId) { 5925 /******/ // Check if module is in cache 5926 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 5927 /******/ if (cachedModule !== undefined) { 5928 /******/ return cachedModule.exports; 5929 /******/ } 5930 /******/ // Create a new module (and put it into the cache) 5931 /******/ var module = __webpack_module_cache__[moduleId] = { 5932 /******/ // no module.id needed 5933 /******/ // no module.loaded needed 5934 /******/ exports: {} 5935 /******/ }; 5936 /******/ 5937 /******/ // Execute the module function 5938 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 5939 /******/ 5940 /******/ // Return the exports of the module 5941 /******/ return module.exports; 5942 /******/ } 5943 /******/ 5944 /************************************************************************/ 5945 /******/ /* webpack/runtime/compat get default export */ 5946 /******/ (() => { 5947 /******/ // getDefaultExport function for compatibility with non-harmony modules 5948 /******/ __webpack_require__.n = (module) => { 5949 /******/ var getter = module && module.__esModule ? 5950 /******/ () => (module['default']) : 5951 /******/ () => (module); 5952 /******/ __webpack_require__.d(getter, { a: getter }); 5953 /******/ return getter; 5954 /******/ }; 5955 /******/ })(); 5956 /******/ 5957 /******/ /* webpack/runtime/create fake namespace object */ 5958 /******/ (() => { 5959 /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); 5960 /******/ var leafPrototypes; 5961 /******/ // create a fake namespace object 5962 /******/ // mode & 1: value is a module id, require it 5963 /******/ // mode & 2: merge all properties of value into the ns 5964 /******/ // mode & 4: return value when already ns object 5965 /******/ // mode & 16: return value when it's Promise-like 5966 /******/ // mode & 8|1: behave like require 5967 /******/ __webpack_require__.t = function(value, mode) { 5968 /******/ if(mode & 1) value = this(value); 5969 /******/ if(mode & 8) return value; 5970 /******/ if(typeof value === 'object' && value) { 5971 /******/ if((mode & 4) && value.__esModule) return value; 5972 /******/ if((mode & 16) && typeof value.then === 'function') return value; 5973 /******/ } 5974 /******/ var ns = Object.create(null); 5975 /******/ __webpack_require__.r(ns); 5976 /******/ var def = {}; 5977 /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; 5978 /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { 5979 /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); 5980 /******/ } 5981 /******/ def['default'] = () => (value); 5982 /******/ __webpack_require__.d(ns, def); 5983 /******/ return ns; 5984 /******/ }; 5985 /******/ })(); 5986 /******/ 5987 /******/ /* webpack/runtime/define property getters */ 5988 /******/ (() => { 5989 /******/ // define getter functions for harmony exports 5990 /******/ __webpack_require__.d = (exports, definition) => { 5991 /******/ for(var key in definition) { 5992 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 5993 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 5994 /******/ } 5995 /******/ } 5996 /******/ }; 5997 /******/ })(); 5998 /******/ 5999 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 6000 /******/ (() => { 6001 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 6002 /******/ })(); 6003 /******/ 6004 /******/ /* webpack/runtime/make namespace object */ 6005 /******/ (() => { 6006 /******/ // define __esModule on exports 6007 /******/ __webpack_require__.r = (exports) => { 6008 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 6009 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 6010 /******/ } 6011 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 6012 /******/ }; 6013 /******/ })(); 6014 /******/ 6015 /************************************************************************/ 6016 var __webpack_exports__ = {}; 6017 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 6018 (() => { 6019 "use strict"; 6020 // ESM COMPAT FLAG 6021 __webpack_require__.r(__webpack_exports__); 6022 6023 // EXPORTS 6024 __webpack_require__.d(__webpack_exports__, { 6025 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), 6026 PluginSidebar: () => (/* reexport */ PluginSidebar), 6027 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 6028 PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel), 6029 initializeEditor: () => (/* binding */ initializeEditor), 6030 initializePostsDashboard: () => (/* reexport */ initializePostsDashboard), 6031 reinitializeEditor: () => (/* binding */ reinitializeEditor), 6032 store: () => (/* reexport */ store) 6033 }); 6034 6035 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js 6036 var actions_namespaceObject = {}; 6037 __webpack_require__.r(actions_namespaceObject); 6038 __webpack_require__.d(actions_namespaceObject, { 6039 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), 6040 addTemplate: () => (addTemplate), 6041 closeGeneralSidebar: () => (closeGeneralSidebar), 6042 openGeneralSidebar: () => (openGeneralSidebar), 6043 openNavigationPanelToMenu: () => (openNavigationPanelToMenu), 6044 removeTemplate: () => (removeTemplate), 6045 revertTemplate: () => (revertTemplate), 6046 setEditedEntity: () => (setEditedEntity), 6047 setEditedPostContext: () => (setEditedPostContext), 6048 setHasPageContentFocus: () => (setHasPageContentFocus), 6049 setHomeTemplateId: () => (setHomeTemplateId), 6050 setIsInserterOpened: () => (setIsInserterOpened), 6051 setIsListViewOpened: () => (setIsListViewOpened), 6052 setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened), 6053 setIsSaveViewOpened: () => (setIsSaveViewOpened), 6054 setNavigationMenu: () => (setNavigationMenu), 6055 setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu), 6056 setPage: () => (setPage), 6057 setTemplate: () => (setTemplate), 6058 setTemplatePart: () => (setTemplatePart), 6059 switchEditorMode: () => (switchEditorMode), 6060 toggleDistractionFree: () => (toggleDistractionFree), 6061 toggleFeature: () => (toggleFeature), 6062 updateSettings: () => (updateSettings) 6063 }); 6064 6065 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 6066 var private_actions_namespaceObject = {}; 6067 __webpack_require__.r(private_actions_namespaceObject); 6068 __webpack_require__.d(private_actions_namespaceObject, { 6069 setCanvasMode: () => (setCanvasMode), 6070 setEditorCanvasContainerView: () => (setEditorCanvasContainerView) 6071 }); 6072 6073 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 6074 var selectors_namespaceObject = {}; 6075 __webpack_require__.r(selectors_namespaceObject); 6076 __webpack_require__.d(selectors_namespaceObject, { 6077 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), 6078 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), 6079 getCanUserCreateMedia: () => (getCanUserCreateMedia), 6080 getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu), 6081 getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts), 6082 getEditedPostContext: () => (getEditedPostContext), 6083 getEditedPostId: () => (getEditedPostId), 6084 getEditedPostType: () => (getEditedPostType), 6085 getEditorMode: () => (getEditorMode), 6086 getHomeTemplateId: () => (getHomeTemplateId), 6087 getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu), 6088 getPage: () => (getPage), 6089 getReusableBlocks: () => (getReusableBlocks), 6090 getSettings: () => (getSettings), 6091 hasPageContentFocus: () => (hasPageContentFocus), 6092 isFeatureActive: () => (isFeatureActive), 6093 isInserterOpened: () => (isInserterOpened), 6094 isListViewOpened: () => (isListViewOpened), 6095 isNavigationOpened: () => (isNavigationOpened), 6096 isPage: () => (isPage), 6097 isSaveViewOpened: () => (isSaveViewOpened) 6098 }); 6099 6100 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 6101 var private_selectors_namespaceObject = {}; 6102 __webpack_require__.r(private_selectors_namespaceObject); 6103 __webpack_require__.d(private_selectors_namespaceObject, { 6104 getCanvasMode: () => (getCanvasMode), 6105 getEditorCanvasContainerView: () => (getEditorCanvasContainerView) 6106 }); 6107 6108 ;// CONCATENATED MODULE: external ["wp","blocks"] 6109 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 6110 ;// CONCATENATED MODULE: external ["wp","blockLibrary"] 6111 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 6112 ;// CONCATENATED MODULE: external ["wp","data"] 6113 const external_wp_data_namespaceObject = window["wp"]["data"]; 6114 ;// CONCATENATED MODULE: external ["wp","deprecated"] 6115 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 6116 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 6117 ;// CONCATENATED MODULE: external ["wp","element"] 6118 const external_wp_element_namespaceObject = window["wp"]["element"]; 6119 ;// CONCATENATED MODULE: external ["wp","editor"] 6120 const external_wp_editor_namespaceObject = window["wp"]["editor"]; 6121 ;// CONCATENATED MODULE: external ["wp","preferences"] 6122 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 6123 ;// CONCATENATED MODULE: external ["wp","widgets"] 6124 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; 6125 ;// CONCATENATED MODULE: external ["wp","hooks"] 6126 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 6127 ;// CONCATENATED MODULE: external ["wp","compose"] 6128 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 6129 ;// CONCATENATED MODULE: external ["wp","blockEditor"] 6130 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 6131 ;// CONCATENATED MODULE: external ["wp","components"] 6132 const external_wp_components_namespaceObject = window["wp"]["components"]; 6133 ;// CONCATENATED MODULE: external ["wp","i18n"] 6134 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 6135 ;// CONCATENATED MODULE: external ["wp","notices"] 6136 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 6137 ;// CONCATENATED MODULE: external ["wp","coreData"] 6138 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 6139 ;// CONCATENATED MODULE: ./node_modules/colord/index.mjs 6140 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()})}; 6141 6142 ;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs 6143 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}} 6144 6145 ;// CONCATENATED MODULE: external ["wp","privateApis"] 6146 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 6147 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js 6148 /** 6149 * WordPress dependencies 6150 */ 6151 6152 const { 6153 lock, 6154 unlock 6155 } = (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'); 6156 6157 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js 6158 /** 6159 * External dependencies 6160 */ 6161 6162 6163 6164 /** 6165 * WordPress dependencies 6166 */ 6167 6168 6169 6170 /** 6171 * Internal dependencies 6172 */ 6173 6174 6175 const { 6176 useGlobalSetting, 6177 useGlobalStyle 6178 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6179 6180 // Enable colord's a11y plugin. 6181 k([a11y]); 6182 function useColorRandomizer(name) { 6183 const [themeColors, setThemeColors] = useGlobalSetting('color.palette.theme', name); 6184 function randomizeColors() { 6185 /* eslint-disable no-restricted-syntax */ 6186 const randomRotationValue = Math.floor(Math.random() * 225); 6187 /* eslint-enable no-restricted-syntax */ 6188 6189 const newColors = themeColors.map(colorObject => { 6190 const { 6191 color 6192 } = colorObject; 6193 const newColor = w(color).rotate(randomRotationValue).toHex(); 6194 return { 6195 ...colorObject, 6196 color: newColor 6197 }; 6198 }); 6199 setThemeColors(newColors); 6200 } 6201 return window.__experimentalEnableColorRandomizer ? [randomizeColors] : []; 6202 } 6203 function useStylesPreviewColors() { 6204 const [textColor = 'black'] = useGlobalStyle('color.text'); 6205 const [backgroundColor = 'white'] = useGlobalStyle('color.background'); 6206 const [headingColor = textColor] = useGlobalStyle('elements.h1.color.text'); 6207 const [linkColor = headingColor] = useGlobalStyle('elements.link.color.text'); 6208 const [buttonBackgroundColor = linkColor] = useGlobalStyle('elements.button.color.background'); 6209 const [coreColors] = useGlobalSetting('color.palette.core'); 6210 const [themeColors] = useGlobalSetting('color.palette.theme'); 6211 const [customColors] = useGlobalSetting('color.palette.custom'); 6212 const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []); 6213 const textColorObject = paletteColors.filter(({ 6214 color 6215 }) => color === textColor); 6216 const buttonBackgroundColorObject = paletteColors.filter(({ 6217 color 6218 }) => color === buttonBackgroundColor); 6219 const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( 6220 // we exclude these background color because it is already visible in the preview. 6221 ({ 6222 color 6223 }) => color !== backgroundColor).slice(0, 2); 6224 return { 6225 paletteColors, 6226 highlightedColors 6227 }; 6228 } 6229 function useSupportedStyles(name, element) { 6230 const { 6231 supportedPanels 6232 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6233 return { 6234 supportedPanels: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(name, element) 6235 }; 6236 }, [name, element]); 6237 return supportedPanels; 6238 } 6239 6240 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js 6241 /** 6242 * Sets the value at path of object. 6243 * If a portion of path doesn’t exist, it’s created. 6244 * Arrays are created for missing index properties while objects are created 6245 * for all other missing properties. 6246 * 6247 * This function intentionally mutates the input object. 6248 * 6249 * Inspired by _.set(). 6250 * 6251 * @see https://lodash.com/docs/4.17.15#set 6252 * 6253 * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`. 6254 * 6255 * @param {Object} object Object to modify 6256 * @param {Array} path Path of the property to set. 6257 * @param {*} value Value to set. 6258 */ 6259 function setNestedValue(object, path, value) { 6260 if (!object || typeof object !== 'object') { 6261 return object; 6262 } 6263 path.reduce((acc, key, idx) => { 6264 if (acc[key] === undefined) { 6265 if (Number.isInteger(path[idx + 1])) { 6266 acc[key] = []; 6267 } else { 6268 acc[key] = {}; 6269 } 6270 } 6271 if (idx === path.length - 1) { 6272 acc[key] = value; 6273 } 6274 return acc[key]; 6275 }, object); 6276 return object; 6277 } 6278 6279 ;// CONCATENATED MODULE: external "ReactJSXRuntime" 6280 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 6281 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js 6282 /* wp:polyfill */ 6283 /** 6284 * WordPress dependencies 6285 */ 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 /** 6298 * Internal dependencies 6299 */ 6300 6301 6302 6303 6304 6305 6306 const { 6307 cleanEmptyObject, 6308 GlobalStylesContext 6309 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6310 6311 // Block Gap is a special case and isn't defined within the blocks 6312 // style properties config. We'll add it here to allow it to be pushed 6313 // to global styles as well. 6314 const STYLE_PROPERTY = { 6315 ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, 6316 blockGap: { 6317 value: ['spacing', 'blockGap'] 6318 } 6319 }; 6320 6321 // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be 6322 // removed by moving PushChangesToGlobalStylesControl to 6323 // @wordpress/block-editor. 6324 const STYLE_PATH_TO_CSS_VAR_INFIX = { 6325 'border.color': 'color', 6326 'color.background': 'color', 6327 'color.text': 'color', 6328 'elements.link.color.text': 'color', 6329 'elements.link.:hover.color.text': 'color', 6330 'elements.link.typography.fontFamily': 'font-family', 6331 'elements.link.typography.fontSize': 'font-size', 6332 'elements.button.color.text': 'color', 6333 'elements.button.color.background': 'color', 6334 'elements.button.typography.fontFamily': 'font-family', 6335 'elements.button.typography.fontSize': 'font-size', 6336 'elements.caption.color.text': 'color', 6337 'elements.heading.color': 'color', 6338 'elements.heading.color.background': 'color', 6339 'elements.heading.typography.fontFamily': 'font-family', 6340 'elements.heading.gradient': 'gradient', 6341 'elements.heading.color.gradient': 'gradient', 6342 'elements.h1.color': 'color', 6343 'elements.h1.color.background': 'color', 6344 'elements.h1.typography.fontFamily': 'font-family', 6345 'elements.h1.color.gradient': 'gradient', 6346 'elements.h2.color': 'color', 6347 'elements.h2.color.background': 'color', 6348 'elements.h2.typography.fontFamily': 'font-family', 6349 'elements.h2.color.gradient': 'gradient', 6350 'elements.h3.color': 'color', 6351 'elements.h3.color.background': 'color', 6352 'elements.h3.typography.fontFamily': 'font-family', 6353 'elements.h3.color.gradient': 'gradient', 6354 'elements.h4.color': 'color', 6355 'elements.h4.color.background': 'color', 6356 'elements.h4.typography.fontFamily': 'font-family', 6357 'elements.h4.color.gradient': 'gradient', 6358 'elements.h5.color': 'color', 6359 'elements.h5.color.background': 'color', 6360 'elements.h5.typography.fontFamily': 'font-family', 6361 'elements.h5.color.gradient': 'gradient', 6362 'elements.h6.color': 'color', 6363 'elements.h6.color.background': 'color', 6364 'elements.h6.typography.fontFamily': 'font-family', 6365 'elements.h6.color.gradient': 'gradient', 6366 'color.gradient': 'gradient', 6367 blockGap: 'spacing', 6368 'typography.fontSize': 'font-size', 6369 'typography.fontFamily': 'font-family' 6370 }; 6371 6372 // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be 6373 // removed by moving PushChangesToGlobalStylesControl to 6374 // @wordpress/block-editor. 6375 const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 6376 'border.color': 'borderColor', 6377 'color.background': 'backgroundColor', 6378 'color.text': 'textColor', 6379 'color.gradient': 'gradient', 6380 'typography.fontSize': 'fontSize', 6381 'typography.fontFamily': 'fontFamily' 6382 }; 6383 const SUPPORTED_STYLES = ['border', 'color', 'spacing', 'typography']; 6384 const getValueFromObjectPath = (object, path) => { 6385 let value = object; 6386 path.forEach(fieldName => { 6387 value = value?.[fieldName]; 6388 }); 6389 return value; 6390 }; 6391 const flatBorderProperties = ['borderColor', 'borderWidth', 'borderStyle']; 6392 const sides = ['top', 'right', 'bottom', 'left']; 6393 function getBorderStyleChanges(border, presetColor, userStyle) { 6394 if (!border && !presetColor) { 6395 return []; 6396 } 6397 const changes = [...getFallbackBorderStyleChange('top', border, userStyle), ...getFallbackBorderStyleChange('right', border, userStyle), ...getFallbackBorderStyleChange('bottom', border, userStyle), ...getFallbackBorderStyleChange('left', border, userStyle)]; 6398 6399 // Handle a flat border i.e. all sides the same, CSS shorthand. 6400 const { 6401 color: customColor, 6402 style, 6403 width 6404 } = border || {}; 6405 const hasColorOrWidth = presetColor || customColor || width; 6406 if (hasColorOrWidth && !style) { 6407 // Global Styles need individual side configurations to overcome 6408 // theme.json configurations which are per side as well. 6409 sides.forEach(side => { 6410 // Only add fallback border-style if global styles don't already 6411 // have something set. 6412 if (!userStyle?.[side]?.style) { 6413 changes.push({ 6414 path: ['border', side, 'style'], 6415 value: 'solid' 6416 }); 6417 } 6418 }); 6419 } 6420 return changes; 6421 } 6422 function getFallbackBorderStyleChange(side, border, globalBorderStyle) { 6423 if (!border?.[side] || globalBorderStyle?.[side]?.style) { 6424 return []; 6425 } 6426 const { 6427 color, 6428 style, 6429 width 6430 } = border[side]; 6431 const hasColorOrWidth = color || width; 6432 if (!hasColorOrWidth || style) { 6433 return []; 6434 } 6435 return [{ 6436 path: ['border', side, 'style'], 6437 value: 'solid' 6438 }]; 6439 } 6440 function useChangesToPush(name, attributes, userConfig) { 6441 const supports = useSupportedStyles(name); 6442 const blockUserConfig = userConfig?.styles?.blocks?.[name]; 6443 return (0,external_wp_element_namespaceObject.useMemo)(() => { 6444 const changes = supports.flatMap(key => { 6445 if (!STYLE_PROPERTY[key]) { 6446 return []; 6447 } 6448 const { 6449 value: path 6450 } = STYLE_PROPERTY[key]; 6451 const presetAttributeKey = path.join('.'); 6452 const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]]; 6453 const value = presetAttributeValue ? `var:preset|$STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|$presetAttributeValue}` : getValueFromObjectPath(attributes.style, path); 6454 6455 // Links only have a single support entry but have two element 6456 // style properties, color and hover color. The following check 6457 // will add the hover color to the changes if required. 6458 if (key === 'linkColor') { 6459 const linkChanges = value ? [{ 6460 path, 6461 value 6462 }] : []; 6463 const hoverPath = ['elements', 'link', ':hover', 'color', 'text']; 6464 const hoverValue = getValueFromObjectPath(attributes.style, hoverPath); 6465 if (hoverValue) { 6466 linkChanges.push({ 6467 path: hoverPath, 6468 value: hoverValue 6469 }); 6470 } 6471 return linkChanges; 6472 } 6473 6474 // The shorthand border styles can't be mapped directly as global 6475 // styles requires longhand config. 6476 if (flatBorderProperties.includes(key) && value) { 6477 // The shorthand config path is included to clear the block attribute. 6478 const borderChanges = [{ 6479 path, 6480 value 6481 }]; 6482 sides.forEach(side => { 6483 const currentPath = [...path]; 6484 currentPath.splice(-1, 0, side); 6485 borderChanges.push({ 6486 path: currentPath, 6487 value 6488 }); 6489 }); 6490 return borderChanges; 6491 } 6492 return value ? [{ 6493 path, 6494 value 6495 }] : []; 6496 }); 6497 6498 // To ensure display of a visible border, global styles require a 6499 // default border style if a border color or width is present. 6500 getBorderStyleChanges(attributes.style?.border, attributes.borderColor, blockUserConfig?.border).forEach(change => changes.push(change)); 6501 return changes; 6502 }, [supports, attributes, blockUserConfig]); 6503 } 6504 function PushChangesToGlobalStylesControl({ 6505 name, 6506 attributes, 6507 setAttributes 6508 }) { 6509 const { 6510 user: userConfig, 6511 setUserConfig 6512 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 6513 const changes = useChangesToPush(name, attributes, userConfig); 6514 const { 6515 __unstableMarkNextChangeAsNotPersistent 6516 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 6517 const { 6518 createSuccessNotice 6519 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6520 const pushChanges = (0,external_wp_element_namespaceObject.useCallback)(() => { 6521 if (changes.length === 0) { 6522 return; 6523 } 6524 if (changes.length > 0) { 6525 const { 6526 style: blockStyles 6527 } = attributes; 6528 const newBlockStyles = structuredClone(blockStyles); 6529 const newUserConfig = structuredClone(userConfig); 6530 for (const { 6531 path, 6532 value 6533 } of changes) { 6534 setNestedValue(newBlockStyles, path, undefined); 6535 setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value); 6536 } 6537 const newBlockAttributes = { 6538 borderColor: undefined, 6539 backgroundColor: undefined, 6540 textColor: undefined, 6541 gradient: undefined, 6542 fontSize: undefined, 6543 fontFamily: undefined, 6544 style: cleanEmptyObject(newBlockStyles) 6545 }; 6546 6547 // @wordpress/core-data doesn't support editing multiple entity types in 6548 // a single undo level. So for now, we disable @wordpress/core-data undo 6549 // tracking and implement our own Undo button in the snackbar 6550 // notification. 6551 __unstableMarkNextChangeAsNotPersistent(); 6552 setAttributes(newBlockAttributes); 6553 setUserConfig(newUserConfig, { 6554 undoIgnore: true 6555 }); 6556 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 6557 // translators: %s: Title of the block e.g. 'Heading'. 6558 (0,external_wp_i18n_namespaceObject.__)('%s styles applied.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title), { 6559 type: 'snackbar', 6560 actions: [{ 6561 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 6562 onClick() { 6563 __unstableMarkNextChangeAsNotPersistent(); 6564 setAttributes(attributes); 6565 setUserConfig(userConfig, { 6566 undoIgnore: true 6567 }); 6568 } 6569 }] 6570 }); 6571 } 6572 }, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, name, setAttributes, setUserConfig, userConfig]); 6573 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { 6574 __nextHasNoMarginBottom: true, 6575 className: "edit-site-push-changes-to-global-styles-control", 6576 help: (0,external_wp_i18n_namespaceObject.sprintf)( 6577 // translators: %s: Title of the block e.g. 'Heading'. 6578 (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), 6579 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 6580 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 6581 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6582 __next40pxDefaultSize: true, 6583 variant: "secondary", 6584 accessibleWhenDisabled: true, 6585 disabled: changes.length === 0, 6586 onClick: pushChanges, 6587 children: (0,external_wp_i18n_namespaceObject.__)('Apply globally') 6588 })] 6589 }); 6590 } 6591 function PushChangesToGlobalStyles(props) { 6592 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 6593 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); 6594 const supportsStyles = SUPPORTED_STYLES.some(feature => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature)); 6595 const isDisplayed = blockEditingMode === 'default' && supportsStyles && isBlockBasedTheme; 6596 if (!isDisplayed) { 6597 return null; 6598 } 6599 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { 6600 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { 6601 ...props 6602 }) 6603 }); 6604 } 6605 const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 6606 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 6607 ...props 6608 }, "edit"), props.isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { 6609 ...props 6610 })] 6611 })); 6612 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles); 6613 6614 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/index.js 6615 /** 6616 * Internal dependencies 6617 */ 6618 6619 6620 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/reducer.js 6621 /** 6622 * WordPress dependencies 6623 */ 6624 6625 6626 /** 6627 * Reducer returning the settings. 6628 * 6629 * @param {Object} state Current state. 6630 * @param {Object} action Dispatched action. 6631 * 6632 * @return {Object} Updated state. 6633 */ 6634 function settings(state = {}, action) { 6635 switch (action.type) { 6636 case 'UPDATE_SETTINGS': 6637 return { 6638 ...state, 6639 ...action.settings 6640 }; 6641 } 6642 return state; 6643 } 6644 6645 /** 6646 * Reducer keeping track of the currently edited Post Type, 6647 * Post Id and the context provided to fill the content of the block editor. 6648 * 6649 * @param {Object} state Current edited post. 6650 * @param {Object} action Dispatched action. 6651 * 6652 * @return {Object} Updated state. 6653 */ 6654 function editedPost(state = {}, action) { 6655 switch (action.type) { 6656 case 'SET_EDITED_POST': 6657 return { 6658 postType: action.postType, 6659 id: action.id, 6660 context: action.context 6661 }; 6662 case 'SET_EDITED_POST_CONTEXT': 6663 return { 6664 ...state, 6665 context: action.context 6666 }; 6667 } 6668 return state; 6669 } 6670 6671 /** 6672 * Reducer to set the save view panel open or closed. 6673 * 6674 * @param {Object} state Current state. 6675 * @param {Object} action Dispatched action. 6676 */ 6677 function saveViewPanel(state = false, action) { 6678 switch (action.type) { 6679 case 'SET_IS_SAVE_VIEW_OPENED': 6680 return action.isOpen; 6681 case 'SET_CANVAS_MODE': 6682 return false; 6683 } 6684 return state; 6685 } 6686 6687 /** 6688 * Reducer used to track the site editor canvas mode (edit or view). 6689 * 6690 * @param {Object} state Current state. 6691 * @param {Object} action Dispatched action. 6692 */ 6693 function canvasMode(state = 'init', action) { 6694 switch (action.type) { 6695 case 'SET_CANVAS_MODE': 6696 return action.mode; 6697 } 6698 return state; 6699 } 6700 6701 /** 6702 * Reducer used to track the site editor canvas container view. 6703 * Default is `undefined`, denoting the default, visual block editor. 6704 * This could be, for example, `'style-book'` (the style book). 6705 * 6706 * @param {string|undefined} state Current state. 6707 * @param {Object} action Dispatched action. 6708 */ 6709 function editorCanvasContainerView(state = undefined, action) { 6710 switch (action.type) { 6711 case 'SET_EDITOR_CANVAS_CONTAINER_VIEW': 6712 return action.view; 6713 } 6714 return state; 6715 } 6716 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 6717 settings, 6718 editedPost, 6719 saveViewPanel, 6720 canvasMode, 6721 editorCanvasContainerView 6722 })); 6723 6724 ;// CONCATENATED MODULE: external ["wp","patterns"] 6725 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 6726 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/constants.js 6727 /** 6728 * WordPress dependencies 6729 */ 6730 6731 6732 6733 /** 6734 * Internal dependencies 6735 */ 6736 6737 6738 // Navigation 6739 const NAVIGATION_POST_TYPE = 'wp_navigation'; 6740 6741 // Templates. 6742 const TEMPLATE_POST_TYPE = 'wp_template'; 6743 const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 6744 const TEMPLATE_ORIGINS = { 6745 custom: 'custom', 6746 theme: 'theme', 6747 plugin: 'plugin' 6748 }; 6749 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; 6750 const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts'; 6751 6752 // Patterns. 6753 const { 6754 PATTERN_TYPES, 6755 PATTERN_DEFAULT_CATEGORY, 6756 PATTERN_USER_CATEGORY, 6757 EXCLUDED_PATTERN_SOURCES, 6758 PATTERN_SYNC_TYPES 6759 } = unlock(external_wp_patterns_namespaceObject.privateApis); 6760 6761 // Entities that are editable in focus mode. 6762 const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; 6763 const POST_TYPE_LABELS = { 6764 [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template'), 6765 [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template part'), 6766 [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)('Pattern'), 6767 [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Navigation') 6768 }; 6769 6770 // DataViews constants 6771 const LAYOUT_GRID = 'grid'; 6772 const LAYOUT_TABLE = 'table'; 6773 const LAYOUT_LIST = 'list'; 6774 const OPERATOR_IS = 'is'; 6775 const OPERATOR_IS_NOT = 'isNot'; 6776 const OPERATOR_IS_ANY = 'isAny'; 6777 const OPERATOR_IS_NONE = 'isNone'; 6778 6779 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/actions.js 6780 /** 6781 * WordPress dependencies 6782 */ 6783 6784 6785 6786 6787 6788 6789 6790 /** 6791 * Internal dependencies 6792 */ 6793 6794 6795 const { 6796 interfaceStore 6797 } = unlock(external_wp_editor_namespaceObject.privateApis); 6798 6799 /** 6800 * Dispatches an action that toggles a feature flag. 6801 * 6802 * @param {string} featureName Feature name. 6803 */ 6804 function toggleFeature(featureName) { 6805 return function ({ 6806 registry 6807 }) { 6808 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleFeature( featureName )", { 6809 since: '6.0', 6810 alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )" 6811 }); 6812 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName); 6813 }; 6814 } 6815 6816 /** 6817 * Action that changes the width of the editing canvas. 6818 * 6819 * @deprecated 6820 * 6821 * @param {string} deviceType 6822 * 6823 * @return {Object} Action object. 6824 */ 6825 const __experimentalSetPreviewDeviceType = deviceType => ({ 6826 registry 6827 }) => { 6828 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType", { 6829 since: '6.5', 6830 version: '6.7', 6831 hint: 'registry.dispatch( editorStore ).setDeviceType' 6832 }); 6833 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); 6834 }; 6835 6836 /** 6837 * Action that sets a template, optionally fetching it from REST API. 6838 * 6839 * @return {Object} Action object. 6840 */ 6841 function setTemplate() { 6842 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", { 6843 since: '6.5', 6844 version: '6.8', 6845 hint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.' 6846 }); 6847 return { 6848 type: 'NOTHING' 6849 }; 6850 } 6851 6852 /** 6853 * Action that adds a new template and sets it as the current template. 6854 * 6855 * @param {Object} template The template. 6856 * 6857 * @deprecated 6858 * 6859 * @return {Object} Action object used to set the current template. 6860 */ 6861 const addTemplate = template => async ({ 6862 dispatch, 6863 registry 6864 }) => { 6865 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", { 6866 since: '6.5', 6867 version: '6.8', 6868 hint: 'use saveEntityRecord directly' 6869 }); 6870 const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', TEMPLATE_POST_TYPE, template); 6871 if (template.content) { 6872 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', TEMPLATE_POST_TYPE, newTemplate.id, { 6873 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) 6874 }, { 6875 undoIgnore: true 6876 }); 6877 } 6878 dispatch({ 6879 type: 'SET_EDITED_POST', 6880 postType: TEMPLATE_POST_TYPE, 6881 id: newTemplate.id 6882 }); 6883 }; 6884 6885 /** 6886 * Action that removes a template. 6887 * 6888 * @param {Object} template The template object. 6889 */ 6890 const removeTemplate = template => ({ 6891 registry 6892 }) => { 6893 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([template]); 6894 }; 6895 6896 /** 6897 * Action that sets a template part. 6898 * 6899 * @param {string} templatePartId The template part ID. 6900 * 6901 * @return {Object} Action object. 6902 */ 6903 function setTemplatePart(templatePartId) { 6904 return { 6905 type: 'SET_EDITED_POST', 6906 postType: TEMPLATE_PART_POST_TYPE, 6907 id: templatePartId 6908 }; 6909 } 6910 6911 /** 6912 * Action that sets a navigation menu. 6913 * 6914 * @param {string} navigationMenuId The Navigation Menu Post ID. 6915 * 6916 * @return {Object} Action object. 6917 */ 6918 function setNavigationMenu(navigationMenuId) { 6919 return { 6920 type: 'SET_EDITED_POST', 6921 postType: NAVIGATION_POST_TYPE, 6922 id: navigationMenuId 6923 }; 6924 } 6925 6926 /** 6927 * Action that sets an edited entity. 6928 * 6929 * @param {string} postType The entity's post type. 6930 * @param {string} postId The entity's ID. 6931 * @param {Object} context The entity's context. 6932 * 6933 * @return {Object} Action object. 6934 */ 6935 function setEditedEntity(postType, postId, context) { 6936 return { 6937 type: 'SET_EDITED_POST', 6938 postType, 6939 id: postId, 6940 context 6941 }; 6942 } 6943 6944 /** 6945 * @deprecated 6946 */ 6947 function setHomeTemplateId() { 6948 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", { 6949 since: '6.2', 6950 version: '6.4' 6951 }); 6952 return { 6953 type: 'NOTHING' 6954 }; 6955 } 6956 6957 /** 6958 * Set's the current block editor context. 6959 * 6960 * @param {Object} context The context object. 6961 * 6962 * @return {Object} Action object. 6963 */ 6964 function setEditedPostContext(context) { 6965 return { 6966 type: 'SET_EDITED_POST_CONTEXT', 6967 context 6968 }; 6969 } 6970 6971 /** 6972 * Resolves the template for a page and displays both. If no path is given, attempts 6973 * to use the postId to generate a path like `?p=${ postId }`. 6974 * 6975 * @deprecated 6976 * 6977 * @return {Object} Action object. 6978 */ 6979 function setPage() { 6980 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", { 6981 since: '6.5', 6982 version: '6.8', 6983 hint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.' 6984 }); 6985 return { 6986 type: 'NOTHING' 6987 }; 6988 } 6989 6990 /** 6991 * Action that sets the active navigation panel menu. 6992 * 6993 * @deprecated 6994 * 6995 * @return {Object} Action object. 6996 */ 6997 function setNavigationPanelActiveMenu() { 6998 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", { 6999 since: '6.2', 7000 version: '6.4' 7001 }); 7002 return { 7003 type: 'NOTHING' 7004 }; 7005 } 7006 7007 /** 7008 * Opens the navigation panel and sets its active menu at the same time. 7009 * 7010 * @deprecated 7011 */ 7012 function openNavigationPanelToMenu() { 7013 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", { 7014 since: '6.2', 7015 version: '6.4' 7016 }); 7017 return { 7018 type: 'NOTHING' 7019 }; 7020 } 7021 7022 /** 7023 * Sets whether the navigation panel should be open. 7024 * 7025 * @deprecated 7026 */ 7027 function setIsNavigationPanelOpened() { 7028 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", { 7029 since: '6.2', 7030 version: '6.4' 7031 }); 7032 return { 7033 type: 'NOTHING' 7034 }; 7035 } 7036 7037 /** 7038 * Returns an action object used to open/close the inserter. 7039 * 7040 * @deprecated 7041 * 7042 * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). 7043 */ 7044 const setIsInserterOpened = value => ({ 7045 registry 7046 }) => { 7047 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", { 7048 since: '6.5', 7049 alternative: "dispatch( 'core/editor').setIsInserterOpened" 7050 }); 7051 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); 7052 }; 7053 7054 /** 7055 * Returns an action object used to open/close the list view. 7056 * 7057 * @deprecated 7058 * 7059 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 7060 */ 7061 const setIsListViewOpened = isOpen => ({ 7062 registry 7063 }) => { 7064 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", { 7065 since: '6.5', 7066 alternative: "dispatch( 'core/editor').setIsListViewOpened" 7067 }); 7068 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); 7069 }; 7070 7071 /** 7072 * Returns an action object used to update the settings. 7073 * 7074 * @param {Object} settings New settings. 7075 * 7076 * @return {Object} Action object. 7077 */ 7078 function updateSettings(settings) { 7079 return { 7080 type: 'UPDATE_SETTINGS', 7081 settings 7082 }; 7083 } 7084 7085 /** 7086 * Sets whether the save view panel should be open. 7087 * 7088 * @param {boolean} isOpen If true, opens the save view. If false, closes it. 7089 * It does not toggle the state, but sets it directly. 7090 */ 7091 function setIsSaveViewOpened(isOpen) { 7092 return { 7093 type: 'SET_IS_SAVE_VIEW_OPENED', 7094 isOpen 7095 }; 7096 } 7097 7098 /** 7099 * Reverts a template to its original theme-provided file. 7100 * 7101 * @param {Object} template The template to revert. 7102 * @param {Object} [options] 7103 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 7104 * reverting the template. Default true. 7105 */ 7106 const revertTemplate = (template, options) => ({ 7107 registry 7108 }) => { 7109 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate(template, options); 7110 }; 7111 7112 /** 7113 * Action that opens an editor sidebar. 7114 * 7115 * @param {?string} name Sidebar name to be opened. 7116 */ 7117 const openGeneralSidebar = name => ({ 7118 registry 7119 }) => { 7120 registry.dispatch(interfaceStore).enableComplementaryArea('core', name); 7121 }; 7122 7123 /** 7124 * Action that closes the sidebar. 7125 */ 7126 const closeGeneralSidebar = () => ({ 7127 registry 7128 }) => { 7129 registry.dispatch(interfaceStore).disableComplementaryArea('core'); 7130 }; 7131 7132 /** 7133 * Triggers an action used to switch editor mode. 7134 * 7135 * @deprecated 7136 * 7137 * @param {string} mode The editor mode. 7138 */ 7139 const switchEditorMode = mode => ({ 7140 registry 7141 }) => { 7142 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", { 7143 since: '6.6', 7144 alternative: "dispatch( 'core/editor').switchEditorMode" 7145 }); 7146 registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); 7147 }; 7148 7149 /** 7150 * Sets whether or not the editor allows only page content to be edited. 7151 * 7152 * @param {boolean} hasPageContentFocus True to allow only page content to be 7153 * edited, false to allow template to be 7154 * edited. 7155 */ 7156 const setHasPageContentFocus = hasPageContentFocus => ({ 7157 dispatch, 7158 registry 7159 }) => { 7160 external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, { 7161 since: '6.5' 7162 }); 7163 if (hasPageContentFocus) { 7164 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 7165 } 7166 dispatch({ 7167 type: 'SET_HAS_PAGE_CONTENT_FOCUS', 7168 hasPageContentFocus 7169 }); 7170 }; 7171 7172 /** 7173 * Action that toggles Distraction free mode. 7174 * Distraction free mode expects there are no sidebars, as due to the 7175 * z-index values set, you can't close sidebars. 7176 * 7177 * @deprecated 7178 */ 7179 const toggleDistractionFree = () => ({ 7180 registry 7181 }) => { 7182 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", { 7183 since: '6.6', 7184 alternative: "dispatch( 'core/editor').toggleDistractionFree" 7185 }); 7186 registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); 7187 }; 7188 7189 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 7190 /** 7191 * WordPress dependencies 7192 */ 7193 7194 7195 7196 7197 /** 7198 * Action that switches the canvas mode. 7199 * 7200 * @param {?string} mode Canvas mode. 7201 */ 7202 const setCanvasMode = mode => ({ 7203 registry, 7204 dispatch 7205 }) => { 7206 const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches; 7207 const switchCanvasMode = () => { 7208 registry.batch(() => { 7209 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 7210 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType('Desktop'); 7211 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableSetEditorMode('edit'); 7212 const isPublishSidebarOpened = registry.select(external_wp_editor_namespaceObject.store).isPublishSidebarOpened(); 7213 dispatch({ 7214 type: 'SET_CANVAS_MODE', 7215 mode 7216 }); 7217 const isEditMode = mode === 'edit'; 7218 if (isPublishSidebarOpened && !isEditMode) { 7219 registry.dispatch(external_wp_editor_namespaceObject.store).closePublishSidebar(); 7220 } 7221 7222 // Check if the block list view should be open by default. 7223 // If `distractionFree` mode is enabled, the block list view should not be open. 7224 // This behavior is disabled for small viewports. 7225 if (isMediumOrBigger && isEditMode && registry.select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) { 7226 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(true); 7227 } else { 7228 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false); 7229 } 7230 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(false); 7231 }); 7232 }; 7233 7234 /* 7235 * Skip transition in mobile, otherwise it crashes the browser. 7236 * See: https://github.com/WordPress/gutenberg/pull/63002. 7237 */ 7238 if (!isMediumOrBigger || !document.startViewTransition) { 7239 switchCanvasMode(); 7240 } else { 7241 document.documentElement.classList.add(`canvas-mode-$mode}-transition`); 7242 const transition = document.startViewTransition(() => switchCanvasMode()); 7243 transition.finished.finally(() => { 7244 document.documentElement.classList.remove(`canvas-mode-$mode}-transition`); 7245 }); 7246 } 7247 }; 7248 7249 /** 7250 * Action that switches the editor canvas container view. 7251 * 7252 * @param {?string} view Editor canvas container view. 7253 */ 7254 const setEditorCanvasContainerView = view => ({ 7255 dispatch 7256 }) => { 7257 dispatch({ 7258 type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW', 7259 view 7260 }); 7261 }; 7262 7263 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js 7264 /** 7265 * WordPress dependencies 7266 */ 7267 7268 const EMPTY_ARRAY = []; 7269 7270 /** 7271 * Get a flattened and filtered list of template parts and the matching block for that template part. 7272 * 7273 * Takes a list of blocks defined within a template, and a list of template parts, and returns a 7274 * flattened list of template parts and the matching block for that template part. 7275 * 7276 * @param {Array} blocks Blocks to flatten. 7277 * @param {?Array} templateParts Available template parts. 7278 * @return {Array} An array of template parts and their blocks. 7279 */ 7280 function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { 7281 const templatePartsById = templateParts ? 7282 // Key template parts by their ID. 7283 templateParts.reduce((newTemplateParts, part) => ({ 7284 ...newTemplateParts, 7285 [part.id]: part 7286 }), {}) : {}; 7287 const result = []; 7288 7289 // Iterate over all blocks, recursing into inner blocks. 7290 // Output will be based on a depth-first traversal. 7291 const stack = [...blocks]; 7292 while (stack.length) { 7293 const { 7294 innerBlocks, 7295 ...block 7296 } = stack.shift(); 7297 // Place inner blocks at the beginning of the stack to preserve order. 7298 stack.unshift(...innerBlocks); 7299 if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { 7300 const { 7301 attributes: { 7302 theme, 7303 slug 7304 } 7305 } = block; 7306 const templatePartId = `$theme}//${slug}`; 7307 const templatePart = templatePartsById[templatePartId]; 7308 7309 // Only add to output if the found template part block is in the list of available template parts. 7310 if (templatePart) { 7311 result.push({ 7312 templatePart, 7313 block 7314 }); 7315 } 7316 } 7317 } 7318 return result; 7319 } 7320 7321 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 7322 /** 7323 * WordPress dependencies 7324 */ 7325 7326 7327 7328 7329 7330 7331 7332 7333 /** 7334 * Internal dependencies 7335 */ 7336 7337 7338 7339 7340 /** 7341 * @typedef {'template'|'template_type'} TemplateType Template type. 7342 */ 7343 7344 /** 7345 * Returns whether the given feature is enabled or not. 7346 * 7347 * @deprecated 7348 * @param {Object} state Global application state. 7349 * @param {string} featureName Feature slug. 7350 * 7351 * @return {boolean} Is active. 7352 */ 7353 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (_, featureName) => { 7354 external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, { 7355 since: '6.0', 7356 alternative: `select( 'core/preferences' ).get` 7357 }); 7358 return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName); 7359 }); 7360 7361 /** 7362 * Returns the current editing canvas device type. 7363 * 7364 * @deprecated 7365 * 7366 * @param {Object} state Global application state. 7367 * 7368 * @return {string} Device type. 7369 */ 7370 const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7371 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { 7372 since: '6.5', 7373 version: '6.7', 7374 alternative: `select( 'core/editor' ).getDeviceType` 7375 }); 7376 return select(external_wp_editor_namespaceObject.store).getDeviceType(); 7377 }); 7378 7379 /** 7380 * Returns whether the current user can create media or not. 7381 * 7382 * @param {Object} state Global application state. 7383 * 7384 * @return {Object} Whether the current user can create media or not. 7385 */ 7386 const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7387 external_wp_deprecated_default()(`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, { 7388 since: '6.7', 7389 alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )` 7390 }); 7391 return select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'); 7392 }); 7393 7394 /** 7395 * Returns any available Reusable blocks. 7396 * 7397 * @param {Object} state Global application state. 7398 * 7399 * @return {Array} The available reusable blocks. 7400 */ 7401 const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7402 external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, { 7403 since: '6.5', 7404 version: '6.8', 7405 alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )` 7406 }); 7407 const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; 7408 return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { 7409 per_page: -1 7410 }) : []; 7411 }); 7412 7413 /** 7414 * Returns the site editor settings. 7415 * 7416 * @param {Object} state Global application state. 7417 * 7418 * @return {Object} Settings. 7419 */ 7420 function getSettings(state) { 7421 // It is important that we don't inject anything into these settings locally. 7422 // The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings. 7423 // If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected. 7424 return state.settings; 7425 } 7426 7427 /** 7428 * @deprecated 7429 */ 7430 function getHomeTemplateId() { 7431 external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", { 7432 since: '6.2', 7433 version: '6.4' 7434 }); 7435 } 7436 7437 /** 7438 * Returns the current edited post type (wp_template or wp_template_part). 7439 * 7440 * @param {Object} state Global application state. 7441 * 7442 * @return {?TemplateType} Template type. 7443 */ 7444 function getEditedPostType(state) { 7445 return state.editedPost.postType; 7446 } 7447 7448 /** 7449 * Returns the ID of the currently edited template or template part. 7450 * 7451 * @param {Object} state Global application state. 7452 * 7453 * @return {?string} Post ID. 7454 */ 7455 function getEditedPostId(state) { 7456 return state.editedPost.id; 7457 } 7458 7459 /** 7460 * Returns the edited post's context object. 7461 * 7462 * @deprecated 7463 * @param {Object} state Global application state. 7464 * 7465 * @return {Object} Page. 7466 */ 7467 function getEditedPostContext(state) { 7468 return state.editedPost.context; 7469 } 7470 7471 /** 7472 * Returns the current page object. 7473 * 7474 * @deprecated 7475 * @param {Object} state Global application state. 7476 * 7477 * @return {Object} Page. 7478 */ 7479 function getPage(state) { 7480 return { 7481 context: state.editedPost.context 7482 }; 7483 } 7484 7485 /** 7486 * Returns true if the inserter is opened. 7487 * 7488 * @deprecated 7489 * 7490 * @param {Object} state Global application state. 7491 * 7492 * @return {boolean} Whether the inserter is opened. 7493 */ 7494 const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7495 external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, { 7496 since: '6.5', 7497 alternative: `select( 'core/editor' ).isInserterOpened` 7498 }); 7499 return select(external_wp_editor_namespaceObject.store).isInserterOpened(); 7500 }); 7501 7502 /** 7503 * Get the insertion point for the inserter. 7504 * 7505 * @deprecated 7506 * 7507 * @param {Object} state Global application state. 7508 * 7509 * @return {Object} The root client ID, index to insert at and starting filter value. 7510 */ 7511 const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7512 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetInsertionPoint`, { 7513 since: '6.5', 7514 version: '6.7' 7515 }); 7516 return unlock(select(external_wp_editor_namespaceObject.store)).getInsertionPoint(); 7517 }); 7518 7519 /** 7520 * Returns true if the list view is opened. 7521 * 7522 * @param {Object} state Global application state. 7523 * 7524 * @return {boolean} Whether the list view is opened. 7525 */ 7526 const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7527 external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, { 7528 since: '6.5', 7529 alternative: `select( 'core/editor' ).isListViewOpened` 7530 }); 7531 return select(external_wp_editor_namespaceObject.store).isListViewOpened(); 7532 }); 7533 7534 /** 7535 * Returns the current opened/closed state of the save panel. 7536 * 7537 * @param {Object} state Global application state. 7538 * 7539 * @return {boolean} True if the save panel should be open; false if closed. 7540 */ 7541 function isSaveViewOpened(state) { 7542 return state.saveViewPanel; 7543 } 7544 function getBlocksAndTemplateParts(select) { 7545 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 7546 per_page: -1 7547 }); 7548 const { 7549 getBlocksByName, 7550 getBlocksByClientId 7551 } = select(external_wp_blockEditor_namespaceObject.store); 7552 const clientIds = getBlocksByName('core/template-part'); 7553 const blocks = getBlocksByClientId(clientIds); 7554 return [blocks, templateParts]; 7555 } 7556 7557 /** 7558 * Returns the template parts and their blocks for the current edited template. 7559 * 7560 * @deprecated 7561 * @param {Object} state Global application state. 7562 * @return {Array} Template parts and their blocks in an array. 7563 */ 7564 const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { 7565 external_wp_deprecated_default()(`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, { 7566 since: '6.7', 7567 version: '6.9', 7568 alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )` 7569 }); 7570 return getFilteredTemplatePartBlocks(...getBlocksAndTemplateParts(select)); 7571 }, () => getBlocksAndTemplateParts(select))); 7572 7573 /** 7574 * Returns the current editing mode. 7575 * 7576 * @param {Object} state Global application state. 7577 * 7578 * @return {string} Editing mode. 7579 */ 7580 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7581 return select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode'); 7582 }); 7583 7584 /** 7585 * @deprecated 7586 */ 7587 function getCurrentTemplateNavigationPanelSubMenu() { 7588 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", { 7589 since: '6.2', 7590 version: '6.4' 7591 }); 7592 } 7593 7594 /** 7595 * @deprecated 7596 */ 7597 function getNavigationPanelActiveMenu() { 7598 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", { 7599 since: '6.2', 7600 version: '6.4' 7601 }); 7602 } 7603 7604 /** 7605 * @deprecated 7606 */ 7607 function isNavigationOpened() { 7608 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", { 7609 since: '6.2', 7610 version: '6.4' 7611 }); 7612 } 7613 7614 /** 7615 * Whether or not the editor has a page loaded into it. 7616 * 7617 * @see setPage 7618 * 7619 * @param {Object} state Global application state. 7620 * 7621 * @return {boolean} Whether or not the editor has a page loaded into it. 7622 */ 7623 function isPage(state) { 7624 return !!state.editedPost.context?.postId; 7625 } 7626 7627 /** 7628 * Whether or not the editor allows only page content to be edited. 7629 * 7630 * @deprecated 7631 * 7632 * @return {boolean} Whether or not focus is on editing page content. 7633 */ 7634 function hasPageContentFocus() { 7635 external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, { 7636 since: '6.5' 7637 }); 7638 return false; 7639 } 7640 7641 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 7642 /** 7643 * Returns the current canvas mode. 7644 * 7645 * @param {Object} state Global application state. 7646 * 7647 * @return {string} Canvas mode. 7648 */ 7649 function getCanvasMode(state) { 7650 return state.canvasMode; 7651 } 7652 7653 /** 7654 * Returns the editor canvas container view. 7655 * 7656 * @param {Object} state Global application state. 7657 * 7658 * @return {string} Editor canvas container view. 7659 */ 7660 function getEditorCanvasContainerView(state) { 7661 return state.editorCanvasContainerView; 7662 } 7663 7664 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/constants.js 7665 /** 7666 * The identifier for the data store. 7667 * 7668 * @type {string} 7669 */ 7670 const STORE_NAME = 'core/edit-site'; 7671 7672 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/index.js 7673 /** 7674 * WordPress dependencies 7675 */ 7676 7677 7678 /** 7679 * Internal dependencies 7680 */ 7681 7682 7683 7684 7685 7686 7687 7688 const storeConfig = { 7689 reducer: reducer, 7690 actions: actions_namespaceObject, 7691 selectors: selectors_namespaceObject 7692 }; 7693 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); 7694 (0,external_wp_data_namespaceObject.register)(store); 7695 unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); 7696 unlock(store).registerPrivateActions(private_actions_namespaceObject); 7697 7698 ;// CONCATENATED MODULE: external ["wp","plugins"] 7699 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 7700 ;// CONCATENATED MODULE: external ["wp","router"] 7701 const external_wp_router_namespaceObject = window["wp"]["router"]; 7702 ;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs 7703 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); 7704 ;// CONCATENATED MODULE: external ["wp","commands"] 7705 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 7706 ;// CONCATENATED MODULE: external ["wp","coreCommands"] 7707 const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; 7708 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/warning.js 7709 /** 7710 * WordPress dependencies 7711 */ 7712 7713 7714 7715 7716 7717 function CopyButton({ 7718 text, 7719 children 7720 }) { 7721 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); 7722 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7723 __next40pxDefaultSize: true, 7724 variant: "secondary", 7725 ref: ref, 7726 children: children 7727 }); 7728 } 7729 function ErrorBoundaryWarning({ 7730 message, 7731 error 7732 }) { 7733 const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { 7734 text: error.stack, 7735 children: (0,external_wp_i18n_namespaceObject.__)('Copy Error') 7736 }, "copy-error")]; 7737 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { 7738 className: "editor-error-boundary", 7739 actions: actions, 7740 children: message 7741 }); 7742 } 7743 7744 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/index.js 7745 /** 7746 * WordPress dependencies 7747 */ 7748 7749 7750 7751 7752 /** 7753 * Internal dependencies 7754 */ 7755 7756 7757 class ErrorBoundary extends external_wp_element_namespaceObject.Component { 7758 constructor() { 7759 super(...arguments); 7760 this.state = { 7761 error: null 7762 }; 7763 } 7764 componentDidCatch(error) { 7765 (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error); 7766 } 7767 static getDerivedStateFromError(error) { 7768 return { 7769 error 7770 }; 7771 } 7772 render() { 7773 if (!this.state.error) { 7774 return this.props.children; 7775 } 7776 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundaryWarning, { 7777 message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'), 7778 error: this.state.error 7779 }); 7780 } 7781 } 7782 7783 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] 7784 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 7785 ;// CONCATENATED MODULE: external ["wp","primitives"] 7786 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 7787 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js 7788 /** 7789 * WordPress dependencies 7790 */ 7791 7792 7793 const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7794 xmlns: "http://www.w3.org/2000/svg", 7795 viewBox: "0 0 24 24", 7796 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7797 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" 7798 }) 7799 }); 7800 /* harmony default export */ const library_search = (search); 7801 7802 ;// CONCATENATED MODULE: external ["wp","keycodes"] 7803 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 7804 ;// CONCATENATED MODULE: external ["wp","url"] 7805 const external_wp_url_namespaceObject = window["wp"]["url"]; 7806 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js 7807 /** 7808 * WordPress dependencies 7809 */ 7810 7811 7812 const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7813 xmlns: "http://www.w3.org/2000/svg", 7814 viewBox: "-2 -2 24 24", 7815 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7816 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" 7817 }) 7818 }); 7819 /* harmony default export */ const library_wordpress = (wordpress); 7820 7821 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js 7822 /** 7823 * External dependencies 7824 */ 7825 7826 7827 /** 7828 * WordPress dependencies 7829 */ 7830 7831 7832 7833 7834 7835 7836 function SiteIcon({ 7837 className 7838 }) { 7839 const { 7840 isRequestingSite, 7841 siteIconUrl 7842 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7843 const { 7844 getEntityRecord 7845 } = select(external_wp_coreData_namespaceObject.store); 7846 const siteData = getEntityRecord('root', '__unstableBase', undefined); 7847 return { 7848 isRequestingSite: !siteData, 7849 siteIconUrl: siteData?.site_icon_url 7850 }; 7851 }, []); 7852 if (isRequestingSite && !siteIconUrl) { 7853 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7854 className: "edit-site-site-icon__image" 7855 }); 7856 } 7857 const icon = siteIconUrl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 7858 className: "edit-site-site-icon__image", 7859 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 7860 src: siteIconUrl 7861 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 7862 className: "edit-site-site-icon__icon", 7863 icon: library_wordpress, 7864 size: 48 7865 }); 7866 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7867 className: dist_clsx(className, 'edit-site-site-icon'), 7868 children: icon 7869 }); 7870 } 7871 /* harmony default export */ const site_icon = (SiteIcon); 7872 7873 ;// CONCATENATED MODULE: external ["wp","dom"] 7874 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 7875 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js 7876 /** 7877 * External dependencies 7878 */ 7879 7880 7881 /** 7882 * WordPress dependencies 7883 */ 7884 7885 7886 7887 const SidebarNavigationContext = (0,external_wp_element_namespaceObject.createContext)(() => {}); 7888 // Focus a sidebar element after a navigation. The element to focus is either 7889 // specified by `focusSelector` (when navigating back) or it is the first 7890 // tabbable element (usually the "Back" button). 7891 function focusSidebarElement(el, direction, focusSelector) { 7892 let elementToFocus; 7893 if (direction === 'back' && focusSelector) { 7894 elementToFocus = el.querySelector(focusSelector); 7895 } 7896 if (direction !== null && !elementToFocus) { 7897 const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el); 7898 elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : el; 7899 } 7900 elementToFocus?.focus(); 7901 } 7902 7903 // Navigation state that is updated when navigating back or forward. Helps us 7904 // manage the animations and also focus. 7905 function createNavState() { 7906 let state = { 7907 direction: null, 7908 focusSelector: null 7909 }; 7910 return { 7911 get() { 7912 return state; 7913 }, 7914 navigate(direction, focusSelector = null) { 7915 state = { 7916 direction, 7917 focusSelector: direction === 'forward' && focusSelector ? focusSelector : state.focusSelector 7918 }; 7919 } 7920 }; 7921 } 7922 function SidebarContentWrapper({ 7923 children 7924 }) { 7925 const navState = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 7926 const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(); 7927 const [navAnimation, setNavAnimation] = (0,external_wp_element_namespaceObject.useState)(null); 7928 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 7929 const { 7930 direction, 7931 focusSelector 7932 } = navState.get(); 7933 focusSidebarElement(wrapperRef.current, direction, focusSelector); 7934 setNavAnimation(direction); 7935 }, [navState]); 7936 const wrapperCls = dist_clsx('edit-site-sidebar__screen-wrapper', { 7937 'slide-from-left': navAnimation === 'back', 7938 'slide-from-right': navAnimation === 'forward' 7939 }); 7940 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7941 ref: wrapperRef, 7942 className: wrapperCls, 7943 children: children 7944 }); 7945 } 7946 function SidebarContent({ 7947 routeKey, 7948 children 7949 }) { 7950 const [navState] = (0,external_wp_element_namespaceObject.useState)(createNavState); 7951 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { 7952 value: navState, 7953 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7954 className: "edit-site-sidebar__content", 7955 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContentWrapper, { 7956 children: children 7957 }, routeKey) 7958 }) 7959 }); 7960 } 7961 7962 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js 7963 /** 7964 * External dependencies 7965 */ 7966 7967 7968 /** 7969 * WordPress dependencies 7970 */ 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 /** 7984 * Internal dependencies 7985 */ 7986 7987 7988 7989 const { 7990 useHistory 7991 } = unlock(external_wp_router_namespaceObject.privateApis); 7992 7993 7994 7995 const SiteHub = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ 7996 isTransparent 7997 }, ref) => { 7998 const { 7999 dashboardLink, 8000 homeUrl, 8001 siteTitle 8002 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8003 const { 8004 getSettings 8005 } = unlock(select(store)); 8006 const { 8007 getEntityRecord 8008 } = select(external_wp_coreData_namespaceObject.store); 8009 const _site = getEntityRecord('root', 'site'); 8010 return { 8011 dashboardLink: getSettings().__experimentalDashboardLink || 'index.php', 8012 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 8013 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title 8014 }; 8015 }, []); 8016 const { 8017 open: openCommandCenter 8018 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 8019 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8020 className: "edit-site-site-hub", 8021 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8022 justify: "flex-start", 8023 spacing: "0", 8024 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8025 className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 8026 'has-transparent-background': isTransparent 8027 }), 8028 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8029 __next40pxDefaultSize: true, 8030 ref: ref, 8031 href: dashboardLink, 8032 label: (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 8033 className: "edit-site-layout__view-mode-toggle", 8034 style: { 8035 transform: 'scale(0.5333) translateX(-4px)', 8036 // Offset to position the icon 12px from viewport edge 8037 borderRadius: 4 8038 }, 8039 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 8040 className: "edit-site-layout__view-mode-toggle-icon" 8041 }) 8042 }) 8043 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8044 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8045 className: "edit-site-site-hub__title", 8046 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 8047 __next40pxDefaultSize: true, 8048 variant: "link", 8049 href: homeUrl, 8050 target: "_blank", 8051 children: [(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 8052 as: "span", 8053 children: /* translators: accessibility text */ 8054 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 8055 })] 8056 }) 8057 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8058 spacing: 0, 8059 expanded: false, 8060 className: "edit-site-site-hub__actions", 8061 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8062 size: "compact", 8063 className: "edit-site-site-hub_toggle-command-center", 8064 icon: library_search, 8065 onClick: () => openCommandCenter(), 8066 label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), 8067 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 8068 }) 8069 })] 8070 })] 8071 }) 8072 }); 8073 })); 8074 /* harmony default export */ const site_hub = (SiteHub); 8075 const SiteHubMobile = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ 8076 isTransparent 8077 }, ref) => { 8078 const history = useHistory(); 8079 const { 8080 navigate 8081 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 8082 const { 8083 homeUrl, 8084 siteTitle 8085 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8086 const { 8087 getEntityRecord 8088 } = select(external_wp_coreData_namespaceObject.store); 8089 const _site = getEntityRecord('root', 'site'); 8090 return { 8091 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 8092 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title 8093 }; 8094 }, []); 8095 const { 8096 open: openCommandCenter 8097 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 8098 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8099 className: "edit-site-site-hub", 8100 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8101 justify: "flex-start", 8102 spacing: "0", 8103 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8104 className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 8105 'has-transparent-background': isTransparent 8106 }), 8107 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8108 __next40pxDefaultSize: true, 8109 ref: ref, 8110 label: (0,external_wp_i18n_namespaceObject.__)('Go to Site Editor'), 8111 className: "edit-site-layout__view-mode-toggle", 8112 style: { 8113 transform: 'scale(0.5)', 8114 borderRadius: 4 8115 }, 8116 onClick: () => { 8117 history.push({}); 8118 navigate('back'); 8119 }, 8120 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 8121 className: "edit-site-layout__view-mode-toggle-icon" 8122 }) 8123 }) 8124 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8125 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8126 className: "edit-site-site-hub__title", 8127 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8128 __next40pxDefaultSize: true, 8129 variant: "link", 8130 href: homeUrl, 8131 target: "_blank", 8132 label: (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'), 8133 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) 8134 }) 8135 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8136 spacing: 0, 8137 expanded: false, 8138 className: "edit-site-site-hub__actions", 8139 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8140 __next40pxDefaultSize: true, 8141 className: "edit-site-site-hub_toggle-command-center", 8142 icon: library_search, 8143 onClick: () => openCommandCenter(), 8144 label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), 8145 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 8146 }) 8147 })] 8148 })] 8149 }) 8150 }); 8151 })); 8152 8153 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js 8154 /** 8155 * External dependencies 8156 */ 8157 8158 8159 /** 8160 * WordPress dependencies 8161 */ 8162 8163 8164 8165 8166 8167 8168 /** 8169 * Internal dependencies 8170 */ 8171 8172 8173 8174 // Removes the inline styles in the drag handles. 8175 8176 8177 8178 const HANDLE_STYLES_OVERRIDE = { 8179 position: undefined, 8180 userSelect: undefined, 8181 cursor: undefined, 8182 width: undefined, 8183 height: undefined, 8184 top: undefined, 8185 right: undefined, 8186 bottom: undefined, 8187 left: undefined 8188 }; 8189 8190 // The minimum width of the frame (in px) while resizing. 8191 const FRAME_MIN_WIDTH = 320; 8192 // The reference width of the frame (in px) used to calculate the aspect ratio. 8193 const FRAME_REFERENCE_WIDTH = 1300; 8194 // 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing. 8195 const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; 8196 // The minimum distance (in px) between the frame resize handle and the 8197 // viewport's edge. If the frame is resized to be closer to the viewport's edge 8198 // than this distance, then "canvas mode" will be enabled. 8199 const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; 8200 // Default size for the `frameSize` state. 8201 const INITIAL_FRAME_SIZE = { 8202 width: '100%', 8203 height: '100%' 8204 }; 8205 function calculateNewHeight(width, initialAspectRatio) { 8206 const lerp = (a, b, amount) => { 8207 return a + (b - a) * amount; 8208 }; 8209 8210 // Calculate the intermediate aspect ratio based on the current width. 8211 const lerpFactor = 1 - Math.max(0, Math.min(1, (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH))); 8212 8213 // Calculate the height based on the intermediate aspect ratio 8214 // ensuring the frame arrives at the target aspect ratio. 8215 const intermediateAspectRatio = lerp(initialAspectRatio, FRAME_TARGET_ASPECT_RATIO, lerpFactor); 8216 return width / intermediateAspectRatio; 8217 } 8218 function ResizableFrame({ 8219 isFullWidth, 8220 isOversized, 8221 setIsOversized, 8222 isReady, 8223 children, 8224 /** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */ 8225 defaultSize, 8226 innerContentStyle 8227 }) { 8228 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 8229 const [frameSize, setFrameSize] = (0,external_wp_element_namespaceObject.useState)(INITIAL_FRAME_SIZE); 8230 // The width of the resizable frame when a new resize gesture starts. 8231 const [startingWidth, setStartingWidth] = (0,external_wp_element_namespaceObject.useState)(); 8232 const [isResizing, setIsResizing] = (0,external_wp_element_namespaceObject.useState)(false); 8233 const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_namespaceObject.useState)(false); 8234 const [resizeRatio, setResizeRatio] = (0,external_wp_element_namespaceObject.useState)(1); 8235 const canvasMode = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getCanvasMode(), []); 8236 const { 8237 setCanvasMode 8238 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 8239 const FRAME_TRANSITION = { 8240 type: 'tween', 8241 duration: isResizing ? 0 : 0.5 8242 }; 8243 const frameRef = (0,external_wp_element_namespaceObject.useRef)(null); 8244 const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResizableFrame, 'edit-site-resizable-frame-handle-help'); 8245 const defaultAspectRatio = defaultSize.width / defaultSize.height; 8246 const handleResizeStart = (_event, _direction, ref) => { 8247 // Remember the starting width so we don't have to get `ref.offsetWidth` on 8248 // every resize event thereafter, which will cause layout thrashing. 8249 setStartingWidth(ref.offsetWidth); 8250 setIsResizing(true); 8251 }; 8252 8253 // Calculate the frame size based on the window width as its resized. 8254 const handleResize = (_event, _direction, _ref, delta) => { 8255 const normalizedDelta = delta.width / resizeRatio; 8256 const deltaAbs = Math.abs(normalizedDelta); 8257 const maxDoubledDelta = delta.width < 0 // is shrinking 8258 ? deltaAbs : (defaultSize.width - startingWidth) / 2; 8259 const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta); 8260 const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs; 8261 const singleSegment = 1 - doubleSegment; 8262 setResizeRatio(singleSegment + doubleSegment * 2); 8263 const updatedWidth = startingWidth + delta.width; 8264 setIsOversized(updatedWidth > defaultSize.width); 8265 8266 // Width will be controlled by the library (via `resizeRatio`), 8267 // so we only need to update the height. 8268 setFrameSize({ 8269 height: isOversized ? '100%' : calculateNewHeight(updatedWidth, defaultAspectRatio) 8270 }); 8271 }; 8272 const handleResizeStop = (_event, _direction, ref) => { 8273 setIsResizing(false); 8274 if (!isOversized) { 8275 return; 8276 } 8277 setIsOversized(false); 8278 const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth; 8279 if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD) { 8280 // Reset the initial aspect ratio if the frame is resized slightly 8281 // above the sidebar but not far enough to trigger full screen. 8282 setFrameSize(INITIAL_FRAME_SIZE); 8283 } else { 8284 // Trigger full screen if the frame is resized far enough to the left. 8285 setCanvasMode('edit'); 8286 } 8287 }; 8288 8289 // Handle resize by arrow keys 8290 const handleResizableHandleKeyDown = event => { 8291 if (!['ArrowLeft', 'ArrowRight'].includes(event.key)) { 8292 return; 8293 } 8294 event.preventDefault(); 8295 const step = 20 * (event.shiftKey ? 5 : 1); 8296 const delta = step * (event.key === 'ArrowLeft' ? 1 : -1); 8297 const newWidth = Math.min(Math.max(FRAME_MIN_WIDTH, frameRef.current.resizable.offsetWidth + delta), defaultSize.width); 8298 setFrameSize({ 8299 width: newWidth, 8300 height: calculateNewHeight(newWidth, defaultAspectRatio) 8301 }); 8302 }; 8303 const frameAnimationVariants = { 8304 default: { 8305 flexGrow: 0, 8306 height: frameSize.height 8307 }, 8308 fullWidth: { 8309 flexGrow: 1, 8310 height: frameSize.height 8311 } 8312 }; 8313 const resizeHandleVariants = { 8314 hidden: { 8315 opacity: 0, 8316 left: 0 8317 }, 8318 visible: { 8319 opacity: 1, 8320 left: -14 // Account for the handle's width. 8321 }, 8322 active: { 8323 opacity: 1, 8324 left: -14, 8325 // Account for the handle's width. 8326 scaleY: 1.3 8327 } 8328 }; 8329 const currentResizeHandleVariant = (() => { 8330 if (isResizing) { 8331 return 'active'; 8332 } 8333 return shouldShowHandle ? 'visible' : 'hidden'; 8334 })(); 8335 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { 8336 as: external_wp_components_namespaceObject.__unstableMotion.div, 8337 ref: frameRef, 8338 initial: false, 8339 variants: frameAnimationVariants, 8340 animate: isFullWidth ? 'fullWidth' : 'default', 8341 onAnimationComplete: definition => { 8342 if (definition === 'fullWidth') { 8343 setFrameSize({ 8344 width: '100%', 8345 height: '100%' 8346 }); 8347 } 8348 }, 8349 whileHover: canvasMode === 'view' ? { 8350 scale: 1.005, 8351 transition: { 8352 duration: disableMotion ? 0 : 0.5, 8353 ease: 'easeOut' 8354 } 8355 } : {}, 8356 transition: FRAME_TRANSITION, 8357 size: frameSize, 8358 enable: { 8359 top: false, 8360 right: false, 8361 bottom: false, 8362 // Resizing will be disabled until the editor content is loaded. 8363 left: isReady, 8364 topRight: false, 8365 bottomRight: false, 8366 bottomLeft: false, 8367 topLeft: false 8368 }, 8369 resizeRatio: resizeRatio, 8370 handleClasses: undefined, 8371 handleStyles: { 8372 left: HANDLE_STYLES_OVERRIDE, 8373 right: HANDLE_STYLES_OVERRIDE 8374 }, 8375 minWidth: FRAME_MIN_WIDTH, 8376 maxWidth: isFullWidth ? '100%' : '150%', 8377 maxHeight: "100%", 8378 onFocus: () => setShouldShowHandle(true), 8379 onBlur: () => setShouldShowHandle(false), 8380 onMouseOver: () => setShouldShowHandle(true), 8381 onMouseOut: () => setShouldShowHandle(false), 8382 handleComponent: { 8383 left: canvasMode === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8384 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 8385 text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 8386 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, { 8387 role: "separator", 8388 "aria-orientation": "vertical", 8389 className: dist_clsx('edit-site-resizable-frame__handle', { 8390 'is-resizing': isResizing 8391 }), 8392 variants: resizeHandleVariants, 8393 animate: currentResizeHandleVariant, 8394 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 8395 "aria-describedby": resizableHandleHelpId, 8396 "aria-valuenow": frameRef.current?.resizable?.offsetWidth || undefined, 8397 "aria-valuemin": FRAME_MIN_WIDTH, 8398 "aria-valuemax": defaultSize.width, 8399 onKeyDown: handleResizableHandleKeyDown, 8400 initial: "hidden", 8401 exit: "hidden", 8402 whileFocus: "active", 8403 whileHover: "active" 8404 }, "handle") 8405 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8406 hidden: true, 8407 id: resizableHandleHelpId, 8408 children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.') 8409 })] 8410 }) 8411 }, 8412 onResizeStart: handleResizeStart, 8413 onResize: handleResize, 8414 onResizeStop: handleResizeStop, 8415 className: dist_clsx('edit-site-resizable-frame__inner', { 8416 'is-resizing': isResizing 8417 }), 8418 showHandle: false // Do not show the default handle, as we're using a custom one. 8419 , 8420 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8421 className: "edit-site-resizable-frame__inner-content", 8422 style: innerContentStyle, 8423 children: children 8424 }) 8425 }); 8426 } 8427 /* harmony default export */ const resizable_frame = (ResizableFrame); 8428 8429 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] 8430 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 8431 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/register.js 8432 /** 8433 * WordPress dependencies 8434 */ 8435 8436 8437 8438 8439 function KeyboardShortcutsRegister() { 8440 // Registering the shortcuts. 8441 const { 8442 registerShortcut 8443 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 8444 (0,external_wp_element_namespaceObject.useEffect)(() => { 8445 registerShortcut({ 8446 name: 'core/edit-site/save', 8447 category: 'global', 8448 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 8449 keyCombination: { 8450 modifier: 'primary', 8451 character: 's' 8452 } 8453 }); 8454 }, [registerShortcut]); 8455 return null; 8456 } 8457 /* harmony default export */ const register = (KeyboardShortcutsRegister); 8458 8459 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/global.js 8460 /** 8461 * WordPress dependencies 8462 */ 8463 8464 8465 8466 8467 8468 /** 8469 * Internal dependencies 8470 */ 8471 8472 8473 function KeyboardShortcutsGlobal() { 8474 const { 8475 __experimentalGetDirtyEntityRecords, 8476 isSavingEntityRecord 8477 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 8478 const { 8479 hasNonPostEntityChanges 8480 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); 8481 const { 8482 getCanvasMode 8483 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 8484 const { 8485 setIsSaveViewOpened 8486 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 8487 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => { 8488 event.preventDefault(); 8489 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8490 const hasDirtyEntities = !!dirtyEntityRecords.length; 8491 const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); 8492 const _hasNonPostEntityChanges = hasNonPostEntityChanges(); 8493 const isViewMode = getCanvasMode() === 'view'; 8494 if ((!hasDirtyEntities || !_hasNonPostEntityChanges || isSaving) && !isViewMode) { 8495 return; 8496 } 8497 // At this point, we know that there are dirty entities, other than 8498 // the edited post, and we're not in the process of saving, so open 8499 // save view. 8500 setIsSaveViewOpened(true); 8501 }); 8502 return null; 8503 } 8504 /* harmony default export */ const global = (KeyboardShortcutsGlobal); 8505 8506 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/use-edited-entity-record/index.js 8507 /** 8508 * WordPress dependencies 8509 */ 8510 8511 8512 8513 8514 8515 /** 8516 * Internal dependencies 8517 */ 8518 8519 function useEditedEntityRecord(postType, postId) { 8520 const { 8521 record, 8522 title, 8523 description, 8524 isLoaded, 8525 icon 8526 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8527 const { 8528 getEditedPostType, 8529 getEditedPostId 8530 } = select(store); 8531 const { 8532 getEditedEntityRecord, 8533 hasFinishedResolution 8534 } = select(external_wp_coreData_namespaceObject.store); 8535 const { 8536 __experimentalGetTemplateInfo: getTemplateInfo 8537 } = select(external_wp_editor_namespaceObject.store); 8538 const usedPostType = postType !== null && postType !== void 0 ? postType : getEditedPostType(); 8539 const usedPostId = postId !== null && postId !== void 0 ? postId : getEditedPostId(); 8540 const _record = getEditedEntityRecord('postType', usedPostType, usedPostId); 8541 const _isLoaded = usedPostId && hasFinishedResolution('getEditedEntityRecord', ['postType', usedPostType, usedPostId]); 8542 const templateInfo = getTemplateInfo(_record); 8543 return { 8544 record: _record, 8545 title: templateInfo.title, 8546 description: templateInfo.description, 8547 isLoaded: _isLoaded, 8548 icon: templateInfo.icon 8549 }; 8550 }, [postType, postId]); 8551 return { 8552 isLoaded, 8553 icon, 8554 record, 8555 getTitle: () => title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : null, 8556 getDescription: () => description ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description) : null 8557 }; 8558 } 8559 8560 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js 8561 /** 8562 * WordPress dependencies 8563 */ 8564 8565 8566 8567 8568 /** 8569 * Internal dependencies 8570 */ 8571 8572 const MAX_LOADING_TIME = 10000; // 10 seconds 8573 8574 function useIsSiteEditorLoading() { 8575 const { 8576 isLoaded: hasLoadedPost 8577 } = useEditedEntityRecord(); 8578 const [loaded, setLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 8579 const inLoadingPause = (0,external_wp_data_namespaceObject.useSelect)(select => { 8580 const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors(); 8581 return !loaded && !hasResolvingSelectors; 8582 }, [loaded]); 8583 8584 /* 8585 * If the maximum expected loading time has passed, we're marking the 8586 * editor as loaded, in order to prevent any failed requests from blocking 8587 * the editor canvas from appearing. 8588 */ 8589 (0,external_wp_element_namespaceObject.useEffect)(() => { 8590 let timeout; 8591 if (!loaded) { 8592 timeout = setTimeout(() => { 8593 setLoaded(true); 8594 }, MAX_LOADING_TIME); 8595 } 8596 return () => { 8597 clearTimeout(timeout); 8598 }; 8599 }, [loaded]); 8600 (0,external_wp_element_namespaceObject.useEffect)(() => { 8601 if (inLoadingPause) { 8602 /* 8603 * We're using an arbitrary 100ms timeout here to catch brief 8604 * moments without any resolving selectors that would result in 8605 * displaying brief flickers of loading state and loaded state. 8606 * 8607 * It's worth experimenting with different values, since this also 8608 * adds 100ms of artificial delay after loading has finished. 8609 */ 8610 const ARTIFICIAL_DELAY = 100; 8611 const timeout = setTimeout(() => { 8612 setLoaded(true); 8613 }, ARTIFICIAL_DELAY); 8614 return () => { 8615 clearTimeout(timeout); 8616 }; 8617 } 8618 }, [inLoadingPause]); 8619 return !loaded || !hasLoadedPost; 8620 } 8621 8622 ;// CONCATENATED MODULE: ./node_modules/@react-spring/rafz/dist/esm/index.js 8623 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}}; 8624 8625 // EXTERNAL MODULE: external "React" 8626 var external_React_ = __webpack_require__(1609); 8627 var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2); 8628 ;// CONCATENATED MODULE: ./node_modules/@react-spring/shared/dist/esm/index.js 8629 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}; 8630 8631 ;// CONCATENATED MODULE: ./node_modules/@react-spring/animated/dist/esm/index.js 8632 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; 8633 8634 ;// CONCATENATED MODULE: ./node_modules/@react-spring/core/dist/esm/index.js 8635 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; 8636 8637 ;// CONCATENATED MODULE: external "ReactDOM" 8638 const external_ReactDOM_namespaceObject = window["ReactDOM"]; 8639 ;// CONCATENATED MODULE: ./node_modules/@react-spring/web/dist/esm/index.js 8640 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; 8641 8642 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js 8643 /** 8644 * External dependencies 8645 */ 8646 8647 8648 /** 8649 * WordPress dependencies 8650 */ 8651 8652 function getAbsolutePosition(element) { 8653 return { 8654 top: element.offsetTop, 8655 left: element.offsetLeft 8656 }; 8657 } 8658 const ANIMATION_DURATION = 400; 8659 8660 /** 8661 * Hook used to compute the styles required to move a div into a new position. 8662 * 8663 * The way this animation works is the following: 8664 * - It first renders the element as if there was no animation. 8665 * - It takes a snapshot of the position of the block to use it 8666 * as a destination point for the animation. 8667 * - It restores the element to the previous position using a CSS transform 8668 * - It uses the "resetAnimation" flag to reset the animation 8669 * from the beginning in order to animate to the new destination point. 8670 * 8671 * @param {Object} $1 Options 8672 * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes. 8673 */ 8674 function useMovingAnimation({ 8675 triggerAnimationOnChange 8676 }) { 8677 const ref = (0,external_wp_element_namespaceObject.useRef)(); 8678 8679 // Whenever the trigger changes, we need to take a snapshot of the current 8680 // position of the block to use it as a destination point for the animation. 8681 const { 8682 previous, 8683 prevRect 8684 } = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 8685 previous: ref.current && getAbsolutePosition(ref.current), 8686 prevRect: ref.current && ref.current.getBoundingClientRect() 8687 }), 8688 // eslint-disable-next-line react-hooks/exhaustive-deps 8689 [triggerAnimationOnChange]); 8690 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 8691 if (!previous || !ref.current) { 8692 return; 8693 } 8694 8695 // We disable the animation if the user has a preference for reduced 8696 // motion. 8697 const disableAnimation = window.matchMedia('(prefers-reduced-motion: reduce)').matches; 8698 if (disableAnimation) { 8699 return; 8700 } 8701 const controller = new esm_le({ 8702 x: 0, 8703 y: 0, 8704 width: prevRect.width, 8705 height: prevRect.height, 8706 config: { 8707 duration: ANIMATION_DURATION, 8708 easing: Lt.easeInOutQuint 8709 }, 8710 onChange({ 8711 value 8712 }) { 8713 if (!ref.current) { 8714 return; 8715 } 8716 let { 8717 x, 8718 y, 8719 width, 8720 height 8721 } = value; 8722 x = Math.round(x); 8723 y = Math.round(y); 8724 width = Math.round(width); 8725 height = Math.round(height); 8726 const finishedMoving = x === 0 && y === 0; 8727 ref.current.style.transformOrigin = 'center center'; 8728 ref.current.style.transform = finishedMoving ? null // Set to `null` to explicitly remove the transform. 8729 : `translate3d($x}px,$y}px,0)`; 8730 ref.current.style.width = finishedMoving ? null : `$width}px`; 8731 ref.current.style.height = finishedMoving ? null : `$height}px`; 8732 } 8733 }); 8734 ref.current.style.transform = undefined; 8735 const destination = ref.current.getBoundingClientRect(); 8736 const x = Math.round(prevRect.left - destination.left); 8737 const y = Math.round(prevRect.top - destination.top); 8738 const width = destination.width; 8739 const height = destination.height; 8740 controller.start({ 8741 x: 0, 8742 y: 0, 8743 width, 8744 height, 8745 from: { 8746 x, 8747 y, 8748 width: prevRect.width, 8749 height: prevRect.height 8750 } 8751 }); 8752 return () => { 8753 controller.stop(); 8754 controller.set({ 8755 x: 0, 8756 y: 0, 8757 width: prevRect.width, 8758 height: prevRect.height 8759 }); 8760 }; 8761 }, [previous, prevRect]); 8762 return ref; 8763 } 8764 /* harmony default export */ const animation = (useMovingAnimation); 8765 8766 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js 8767 /** 8768 * WordPress dependencies 8769 */ 8770 8771 8772 const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8773 xmlns: "http://www.w3.org/2000/svg", 8774 viewBox: "0 0 24 24", 8775 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8776 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 8777 }) 8778 }); 8779 /* harmony default export */ const library_check = (check); 8780 8781 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js 8782 /** 8783 * WordPress dependencies 8784 */ 8785 8786 function isPreviewingTheme() { 8787 return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview') !== undefined; 8788 } 8789 function currentlyPreviewingTheme() { 8790 if (isPreviewingTheme()) { 8791 return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview'); 8792 } 8793 return null; 8794 } 8795 8796 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js 8797 /** 8798 * WordPress dependencies 8799 */ 8800 8801 8802 8803 8804 8805 8806 8807 8808 /** 8809 * Internal dependencies 8810 */ 8811 8812 8813 8814 8815 const { 8816 useLocation 8817 } = unlock(external_wp_router_namespaceObject.privateApis); 8818 function SaveButton({ 8819 className = 'edit-site-save-button__button', 8820 variant = 'primary', 8821 showTooltip = true, 8822 showReviewMessage, 8823 icon, 8824 size, 8825 __next40pxDefaultSize = false 8826 }) { 8827 const { 8828 params 8829 } = useLocation(); 8830 const { 8831 setIsSaveViewOpened 8832 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 8833 const { 8834 saveDirtyEntities 8835 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store)); 8836 const { 8837 dirtyEntityRecords 8838 } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 8839 const { 8840 isSaving, 8841 isSaveViewOpen, 8842 previewingThemeName 8843 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8844 const { 8845 isSavingEntityRecord, 8846 isResolving 8847 } = select(external_wp_coreData_namespaceObject.store); 8848 const { 8849 isSaveViewOpened 8850 } = select(store); 8851 const isActivatingTheme = isResolving('activateTheme'); 8852 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 8853 return { 8854 isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme, 8855 isSaveViewOpen: isSaveViewOpened(), 8856 // Do not call `getTheme` with null, it will cause a request to 8857 // the server. 8858 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined 8859 }; 8860 }, [dirtyEntityRecords]); 8861 const hasDirtyEntities = !!dirtyEntityRecords.length; 8862 let isOnlyCurrentEntityDirty; 8863 // Check if the current entity is the only entity with changes. 8864 // We have some extra logic for `wp_global_styles` for now, that 8865 // is used in navigation sidebar. 8866 if (dirtyEntityRecords.length === 1) { 8867 if (params.postId) { 8868 isOnlyCurrentEntityDirty = `$dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType; 8869 } else if (params.path?.includes('wp_global_styles')) { 8870 isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === 'globalStyles'; 8871 } 8872 } 8873 const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme(); 8874 const getLabel = () => { 8875 if (isPreviewingTheme()) { 8876 if (isSaving) { 8877 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */ 8878 (0,external_wp_i18n_namespaceObject.__)('Activating %s'), previewingThemeName); 8879 } else if (disabled) { 8880 return (0,external_wp_i18n_namespaceObject.__)('Saved'); 8881 } else if (hasDirtyEntities) { 8882 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */ 8883 (0,external_wp_i18n_namespaceObject.__)('Activate %s & Save'), previewingThemeName); 8884 } 8885 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */ 8886 (0,external_wp_i18n_namespaceObject.__)('Activate %s'), previewingThemeName); 8887 } 8888 if (isSaving) { 8889 return (0,external_wp_i18n_namespaceObject.__)('Saving'); 8890 } 8891 if (disabled) { 8892 return (0,external_wp_i18n_namespaceObject.__)('Saved'); 8893 } 8894 if (!isOnlyCurrentEntityDirty && showReviewMessage) { 8895 return (0,external_wp_i18n_namespaceObject.sprintf)( 8896 // translators: %d: number of unsaved changes (number). 8897 (0,external_wp_i18n_namespaceObject._n)('Review %d change…', 'Review %d changes…', dirtyEntityRecords.length), dirtyEntityRecords.length); 8898 } 8899 return (0,external_wp_i18n_namespaceObject.__)('Save'); 8900 }; 8901 const label = getLabel(); 8902 const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ 8903 dirtyEntityRecords 8904 }) : () => setIsSaveViewOpened(true); 8905 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8906 variant: variant, 8907 className: className, 8908 "aria-disabled": disabled, 8909 "aria-expanded": isSaveViewOpen, 8910 isBusy: isSaving, 8911 onClick: disabled ? undefined : onClick, 8912 label: label 8913 /* 8914 * We want the tooltip to show the keyboard shortcut only when the 8915 * button does something, i.e. when it's not disabled. 8916 */, 8917 shortcut: disabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s') 8918 /* 8919 * Displaying the keyboard shortcut conditionally makes the tooltip 8920 * itself show conditionally. This would trigger a full-rerendering 8921 * of the button that we want to avoid. By setting `showTooltip`, 8922 * the tooltip is always rendered even when there's no keyboard shortcut. 8923 */, 8924 showTooltip: showTooltip, 8925 icon: icon, 8926 __next40pxDefaultSize: __next40pxDefaultSize, 8927 size: size, 8928 children: label 8929 }); 8930 } 8931 8932 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js 8933 /** 8934 * WordPress dependencies 8935 */ 8936 8937 8938 8939 8940 8941 /** 8942 * Internal dependencies 8943 */ 8944 8945 8946 8947 function SaveHub() { 8948 const { 8949 isDisabled, 8950 isSaving 8951 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8952 const { 8953 __experimentalGetDirtyEntityRecords, 8954 isSavingEntityRecord 8955 } = select(external_wp_coreData_namespaceObject.store); 8956 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8957 const _isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); 8958 return { 8959 isSaving: _isSaving, 8960 isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme() 8961 }; 8962 }, []); 8963 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8964 className: "edit-site-save-hub", 8965 alignment: "right", 8966 spacing: 4, 8967 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { 8968 className: "edit-site-save-hub__button", 8969 variant: isDisabled ? null : 'primary', 8970 showTooltip: false, 8971 icon: isDisabled && !isSaving ? library_check : null, 8972 showReviewMessage: true, 8973 __next40pxDefaultSize: true 8974 }) 8975 }); 8976 } 8977 8978 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js 8979 /** 8980 * WordPress dependencies 8981 */ 8982 8983 8984 8985 8986 /** 8987 * Internal dependencies 8988 */ 8989 8990 8991 const { 8992 useHistory: use_activate_theme_useHistory 8993 } = unlock(external_wp_router_namespaceObject.privateApis); 8994 8995 /** 8996 * This should be refactored to use the REST API, once the REST API can activate themes. 8997 * 8998 * @return {Function} A function that activates the theme. 8999 */ 9000 function useActivateTheme() { 9001 const history = use_activate_theme_useHistory(); 9002 const { 9003 startResolution, 9004 finishResolution 9005 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 9006 return async () => { 9007 if (isPreviewingTheme()) { 9008 const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE; 9009 startResolution('activateTheme'); 9010 await window.fetch(activationURL); 9011 finishResolution('activateTheme'); 9012 // Remove the wp_theme_preview query param: we've finished activating 9013 // the queue and are switching to normal Site Editor. 9014 const { 9015 params 9016 } = history.getLocationWithParams(); 9017 history.replace({ 9018 ...params, 9019 wp_theme_preview: undefined 9020 }); 9021 } 9022 }; 9023 } 9024 9025 ;// CONCATENATED MODULE: external ["wp","apiFetch"] 9026 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 9027 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 9028 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js 9029 /** 9030 * WordPress dependencies 9031 */ 9032 9033 9034 9035 const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active'; 9036 function useActualCurrentTheme() { 9037 const [currentTheme, setCurrentTheme] = (0,external_wp_element_namespaceObject.useState)(); 9038 (0,external_wp_element_namespaceObject.useEffect)(() => { 9039 // Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware. 9040 const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, { 9041 context: 'edit', 9042 wp_theme_preview: '' 9043 }); 9044 external_wp_apiFetch_default()({ 9045 path 9046 }).then(activeThemes => setCurrentTheme(activeThemes[0])) 9047 // Do nothing 9048 .catch(() => {}); 9049 }, []); 9050 return currentTheme; 9051 } 9052 9053 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js 9054 /** 9055 * External dependencies 9056 */ 9057 9058 9059 /** 9060 * WordPress dependencies 9061 */ 9062 9063 9064 9065 9066 9067 9068 /** 9069 * Internal dependencies 9070 */ 9071 9072 9073 9074 9075 9076 9077 9078 const { 9079 EntitiesSavedStatesExtensible, 9080 NavigableRegion 9081 } = unlock(external_wp_editor_namespaceObject.privateApis); 9082 const EntitiesSavedStatesForPreview = ({ 9083 onClose 9084 }) => { 9085 var _currentTheme$name$re, _previewingTheme$name; 9086 const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 9087 let activateSaveLabel; 9088 if (isDirtyProps.isDirty) { 9089 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate & Save'); 9090 } else { 9091 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate'); 9092 } 9093 const currentTheme = useActualCurrentTheme(); 9094 const previewingTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), []); 9095 const additionalPrompt = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 9096 children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: The name of active theme, %2$s: The name of theme to be activated. */ 9097 (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 : '...') 9098 }); 9099 const activateTheme = useActivateTheme(); 9100 const onSave = async values => { 9101 await activateTheme(); 9102 return values; 9103 }; 9104 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, { 9105 ...isDirtyProps, 9106 additionalPrompt, 9107 close: onClose, 9108 onSave, 9109 saveEnabled: true, 9110 saveLabel: activateSaveLabel 9111 }); 9112 }; 9113 const _EntitiesSavedStates = ({ 9114 onClose, 9115 renderDialog = undefined 9116 }) => { 9117 if (isPreviewingTheme()) { 9118 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesForPreview, { 9119 onClose: onClose 9120 }); 9121 } 9122 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EntitiesSavedStates, { 9123 close: onClose, 9124 renderDialog: renderDialog 9125 }); 9126 }; 9127 function SavePanel() { 9128 const { 9129 isSaveViewOpen, 9130 canvasMode, 9131 isDirty, 9132 isSaving 9133 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9134 const { 9135 __experimentalGetDirtyEntityRecords, 9136 isSavingEntityRecord, 9137 isResolving 9138 } = select(external_wp_coreData_namespaceObject.store); 9139 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 9140 const isActivatingTheme = isResolving('activateTheme'); 9141 const { 9142 isSaveViewOpened, 9143 getCanvasMode 9144 } = unlock(select(store)); 9145 9146 // The currently selected entity to display. 9147 // Typically template or template part in the site editor. 9148 return { 9149 isSaveViewOpen: isSaveViewOpened(), 9150 canvasMode: getCanvasMode(), 9151 isDirty: dirtyEntityRecords.length > 0, 9152 isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme 9153 }; 9154 }, []); 9155 const { 9156 setIsSaveViewOpened 9157 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9158 const onClose = () => setIsSaveViewOpened(false); 9159 if (canvasMode === 'view') { 9160 return isSaveViewOpen ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 9161 className: "edit-site-save-panel__modal", 9162 onRequestClose: onClose, 9163 __experimentalHideHeader: true, 9164 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Save site, content, and template changes'), 9165 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { 9166 onClose: onClose 9167 }) 9168 }) : null; 9169 } 9170 const activateSaveEnabled = isPreviewingTheme() || isDirty; 9171 const disabled = isSaving || !activateSaveEnabled; 9172 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(NavigableRegion, { 9173 className: dist_clsx('edit-site-layout__actions', { 9174 'is-entity-save-view-open': isSaveViewOpen 9175 }), 9176 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Save panel'), 9177 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9178 className: dist_clsx('edit-site-editor__toggle-save-panel', { 9179 'screen-reader-text': isSaveViewOpen 9180 }), 9181 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9182 __next40pxDefaultSize: true, 9183 variant: "secondary", 9184 className: "edit-site-editor__toggle-save-panel-button", 9185 onClick: () => setIsSaveViewOpened(true), 9186 "aria-haspopup": "dialog", 9187 disabled: disabled, 9188 accessibleWhenDisabled: true, 9189 children: (0,external_wp_i18n_namespaceObject.__)('Open save panel') 9190 }) 9191 }), isSaveViewOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { 9192 onClose: onClose, 9193 renderDialog: true 9194 })] 9195 }); 9196 } 9197 9198 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js 9199 /** 9200 * WordPress dependencies 9201 */ 9202 9203 9204 9205 9206 /** 9207 * Internal dependencies 9208 */ 9209 9210 9211 const { 9212 useLocation: use_sync_canvas_mode_with_url_useLocation, 9213 useHistory: use_sync_canvas_mode_with_url_useHistory 9214 } = unlock(external_wp_router_namespaceObject.privateApis); 9215 function useSyncCanvasModeWithURL() { 9216 const history = use_sync_canvas_mode_with_url_useHistory(); 9217 const { 9218 params 9219 } = use_sync_canvas_mode_with_url_useLocation(); 9220 const canvasMode = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getCanvasMode(), []); 9221 const { 9222 setCanvasMode 9223 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9224 const currentCanvasModeRef = (0,external_wp_element_namespaceObject.useRef)(canvasMode); 9225 const { 9226 canvas: canvasInUrl 9227 } = params; 9228 const currentCanvasInUrlRef = (0,external_wp_element_namespaceObject.useRef)(canvasInUrl); 9229 const currentUrlParamsRef = (0,external_wp_element_namespaceObject.useRef)(params); 9230 (0,external_wp_element_namespaceObject.useEffect)(() => { 9231 currentUrlParamsRef.current = params; 9232 }, [params]); 9233 (0,external_wp_element_namespaceObject.useEffect)(() => { 9234 currentCanvasModeRef.current = canvasMode; 9235 if (canvasMode === 'init') { 9236 return; 9237 } 9238 if (canvasMode === 'edit' && currentCanvasInUrlRef.current !== canvasMode) { 9239 history.push({ 9240 ...currentUrlParamsRef.current, 9241 canvas: 'edit' 9242 }); 9243 } 9244 if (canvasMode === 'view' && currentCanvasInUrlRef.current !== undefined) { 9245 history.push({ 9246 ...currentUrlParamsRef.current, 9247 canvas: undefined 9248 }); 9249 } 9250 }, [canvasMode, history]); 9251 (0,external_wp_element_namespaceObject.useEffect)(() => { 9252 currentCanvasInUrlRef.current = canvasInUrl; 9253 if (canvasInUrl !== 'edit' && currentCanvasModeRef.current !== 'view') { 9254 setCanvasMode('view'); 9255 } else if (canvasInUrl === 'edit' && currentCanvasModeRef.current !== 'edit') { 9256 setCanvasMode('edit'); 9257 } 9258 }, [canvasInUrl, setCanvasMode]); 9259 } 9260 9261 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js 9262 /** 9263 * External dependencies 9264 */ 9265 9266 9267 /** 9268 * WordPress dependencies 9269 */ 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 /** 9281 * Internal dependencies 9282 */ 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 const { 9300 useCommands 9301 } = unlock(external_wp_coreCommands_namespaceObject.privateApis); 9302 const { 9303 useGlobalStyle: layout_useGlobalStyle 9304 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9305 const { 9306 NavigableRegion: layout_NavigableRegion 9307 } = unlock(external_wp_editor_namespaceObject.privateApis); 9308 const layout_ANIMATION_DURATION = 0.3; 9309 function Layout({ 9310 route 9311 }) { 9312 useSyncCanvasModeWithURL(); 9313 useCommands(); 9314 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 9315 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(); 9316 const { 9317 canvasMode 9318 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9319 const { 9320 getCanvasMode 9321 } = unlock(select(store)); 9322 return { 9323 canvasMode: getCanvasMode() 9324 }; 9325 }, []); 9326 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); 9327 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 9328 const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 9329 const isEditorLoading = useIsSiteEditorLoading(); 9330 const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_namespaceObject.useState)(false); 9331 const { 9332 key: routeKey, 9333 areas, 9334 widths 9335 } = route; 9336 const animationRef = animation({ 9337 triggerAnimationOnChange: canvasMode + '__' + routeKey 9338 }); 9339 const [backgroundColor] = layout_useGlobalStyle('color.background'); 9340 const [gradientValue] = layout_useGlobalStyle('color.gradient'); 9341 const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvasMode); 9342 (0,external_wp_element_namespaceObject.useEffect)(() => { 9343 if (previousCanvaMode === 'edit') { 9344 toggleRef.current?.focus(); 9345 } 9346 // Should not depend on the previous canvas mode value but the next. 9347 // eslint-disable-next-line react-hooks/exhaustive-deps 9348 }, [canvasMode]); 9349 9350 // Synchronizing the URL with the store value of canvasMode happens in an effect 9351 // This condition ensures the component is only rendered after the synchronization happens 9352 // which prevents any animations due to potential canvasMode value change. 9353 if (canvasMode === 'init') { 9354 return null; 9355 } 9356 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9357 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(register, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9358 ...navigateRegionsProps, 9359 ref: navigateRegionsProps.ref, 9360 className: dist_clsx('edit-site-layout', navigateRegionsProps.className, { 9361 'is-full-canvas': canvasMode === 'edit' 9362 }), 9363 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9364 className: "edit-site-layout__content", 9365 children: [(!isMobileViewport || !areas.mobile) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout_NavigableRegion, { 9366 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'), 9367 className: "edit-site-layout__sidebar-region", 9368 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 9369 children: canvasMode === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 9370 initial: { 9371 opacity: 0 9372 }, 9373 animate: { 9374 opacity: 1 9375 }, 9376 exit: { 9377 opacity: 0 9378 }, 9379 transition: { 9380 type: 'tween', 9381 duration: 9382 // Disable transition in mobile to emulate a full page transition. 9383 disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION, 9384 ease: 'easeOut' 9385 }, 9386 className: "edit-site-layout__sidebar", 9387 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_hub, { 9388 ref: toggleRef, 9389 isTransparent: isResizableFrameOversized 9390 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 9391 routeKey: routeKey, 9392 children: areas.sidebar 9393 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})] 9394 }) 9395 }) 9396 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), isMobileViewport && areas.mobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9397 className: "edit-site-layout__mobile", 9398 children: [canvasMode !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 9399 routeKey: routeKey, 9400 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteHubMobile, { 9401 ref: toggleRef, 9402 isTransparent: isResizableFrameOversized 9403 }) 9404 }), areas.mobile] 9405 }), !isMobileViewport && areas.content && canvasMode !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9406 className: "edit-site-layout__area", 9407 style: { 9408 maxWidth: widths?.content 9409 }, 9410 children: areas.content 9411 }), !isMobileViewport && areas.edit && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9412 className: "edit-site-layout__area", 9413 style: { 9414 maxWidth: widths?.edit 9415 }, 9416 children: areas.edit 9417 }), !isMobileViewport && areas.preview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9418 className: "edit-site-layout__canvas-container", 9419 children: [canvasResizer, !!canvasSize.width && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9420 className: dist_clsx('edit-site-layout__canvas', { 9421 'is-right-aligned': isResizableFrameOversized 9422 }), 9423 ref: animationRef, 9424 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundary, { 9425 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_frame, { 9426 isReady: !isEditorLoading, 9427 isFullWidth: canvasMode === 'edit', 9428 defaultSize: { 9429 width: canvasSize.width - 24 /* $canvas-padding */, 9430 height: canvasSize.height 9431 }, 9432 isOversized: isResizableFrameOversized, 9433 setIsOversized: setIsResizableFrameOversized, 9434 innerContentStyle: { 9435 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor 9436 }, 9437 children: areas.preview 9438 }) 9439 }) 9440 })] 9441 })] 9442 }) 9443 })] 9444 }); 9445 } 9446 9447 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js 9448 /** 9449 * WordPress dependencies 9450 */ 9451 9452 9453 const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9454 viewBox: "0 0 24 24", 9455 xmlns: "http://www.w3.org/2000/svg", 9456 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9457 fillRule: "evenodd", 9458 clipRule: "evenodd", 9459 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" 9460 }) 9461 }); 9462 /* harmony default export */ const library_styles = (styles); 9463 9464 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/help.js 9465 /** 9466 * WordPress dependencies 9467 */ 9468 9469 9470 const help = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9471 xmlns: "http://www.w3.org/2000/svg", 9472 viewBox: "0 0 24 24", 9473 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9474 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" 9475 }) 9476 }); 9477 /* harmony default export */ const library_help = (help); 9478 9479 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-right.js 9480 /** 9481 * WordPress dependencies 9482 */ 9483 9484 9485 const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9486 xmlns: "http://www.w3.org/2000/svg", 9487 viewBox: "0 0 24 24", 9488 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9489 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" 9490 }) 9491 }); 9492 /* harmony default export */ const rotate_right = (rotateRight); 9493 9494 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-left.js 9495 /** 9496 * WordPress dependencies 9497 */ 9498 9499 9500 const rotateLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9501 xmlns: "http://www.w3.org/2000/svg", 9502 viewBox: "0 0 24 24", 9503 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9504 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" 9505 }) 9506 }); 9507 /* harmony default export */ const rotate_left = (rotateLeft); 9508 9509 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/brush.js 9510 /** 9511 * WordPress dependencies 9512 */ 9513 9514 9515 const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9516 xmlns: "http://www.w3.org/2000/svg", 9517 viewBox: "0 0 24 24", 9518 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9519 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" 9520 }) 9521 }); 9522 /* harmony default export */ const library_brush = (brush); 9523 9524 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js 9525 /** 9526 * WordPress dependencies 9527 */ 9528 9529 9530 const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9531 xmlns: "http://www.w3.org/2000/svg", 9532 viewBox: "0 0 24 24", 9533 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9534 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" 9535 }) 9536 }); 9537 /* harmony default export */ const library_backup = (backup); 9538 9539 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js 9540 /** 9541 * WordPress dependencies 9542 */ 9543 9544 9545 const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9546 xmlns: "http://www.w3.org/2000/svg", 9547 viewBox: "0 0 24 24", 9548 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9549 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" 9550 }) 9551 }); 9552 /* harmony default export */ const library_external = (external); 9553 9554 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js 9555 /** 9556 * WordPress dependencies 9557 */ 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 /** 9569 * Internal dependencies 9570 */ 9571 9572 9573 const { 9574 useGlobalStylesReset 9575 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9576 const { 9577 useHistory: use_common_commands_useHistory, 9578 useLocation: use_common_commands_useLocation 9579 } = unlock(external_wp_router_namespaceObject.privateApis); 9580 function useGlobalStylesOpenStylesCommands() { 9581 const { 9582 openGeneralSidebar, 9583 setCanvasMode 9584 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9585 const { 9586 params 9587 } = use_common_commands_useLocation(); 9588 const { 9589 getCanvasMode 9590 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 9591 const history = use_common_commands_useHistory(); 9592 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 9593 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 9594 }, []); 9595 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9596 if (!isBlockBasedTheme) { 9597 return []; 9598 } 9599 return [{ 9600 name: 'core/edit-site/open-styles', 9601 label: (0,external_wp_i18n_namespaceObject.__)('Open styles'), 9602 callback: ({ 9603 close 9604 }) => { 9605 close(); 9606 if (!params.postId) { 9607 history.push({ 9608 path: '/wp_global_styles', 9609 canvas: 'edit' 9610 }); 9611 } 9612 if (params.postId && getCanvasMode() !== 'edit') { 9613 setCanvasMode('edit'); 9614 } 9615 openGeneralSidebar('edit-site/global-styles'); 9616 }, 9617 icon: library_styles 9618 }]; 9619 }, [history, openGeneralSidebar, setCanvasMode, getCanvasMode, isBlockBasedTheme, params.postId]); 9620 return { 9621 isLoading: false, 9622 commands 9623 }; 9624 } 9625 function useGlobalStylesToggleWelcomeGuideCommands() { 9626 const { 9627 openGeneralSidebar, 9628 setCanvasMode 9629 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9630 const { 9631 params 9632 } = use_common_commands_useLocation(); 9633 const { 9634 getCanvasMode 9635 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 9636 const { 9637 set 9638 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 9639 const history = use_common_commands_useHistory(); 9640 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 9641 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 9642 }, []); 9643 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9644 if (!isBlockBasedTheme) { 9645 return []; 9646 } 9647 return [{ 9648 name: 'core/edit-site/toggle-styles-welcome-guide', 9649 label: (0,external_wp_i18n_namespaceObject.__)('Learn about styles'), 9650 callback: ({ 9651 close 9652 }) => { 9653 close(); 9654 if (!params.postId) { 9655 history.push({ 9656 path: '/wp_global_styles', 9657 canvas: 'edit' 9658 }); 9659 } 9660 if (params.postId && getCanvasMode() !== 'edit') { 9661 setCanvasMode('edit'); 9662 } 9663 openGeneralSidebar('edit-site/global-styles'); 9664 set('core/edit-site', 'welcomeGuideStyles', true); 9665 // sometimes there's a focus loss that happens after some time 9666 // that closes the modal, we need to force reopening it. 9667 setTimeout(() => { 9668 set('core/edit-site', 'welcomeGuideStyles', true); 9669 }, 500); 9670 }, 9671 icon: library_help 9672 }]; 9673 }, [history, openGeneralSidebar, setCanvasMode, getCanvasMode, isBlockBasedTheme, set, params.postId]); 9674 return { 9675 isLoading: false, 9676 commands 9677 }; 9678 } 9679 function useGlobalStylesResetCommands() { 9680 const [canReset, onReset] = useGlobalStylesReset(); 9681 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9682 if (!canReset) { 9683 return []; 9684 } 9685 return [{ 9686 name: 'core/edit-site/reset-global-styles', 9687 label: (0,external_wp_i18n_namespaceObject.__)('Reset styles'), 9688 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right : rotate_left, 9689 callback: ({ 9690 close 9691 }) => { 9692 close(); 9693 onReset(); 9694 } 9695 }]; 9696 }, [canReset, onReset]); 9697 return { 9698 isLoading: false, 9699 commands 9700 }; 9701 } 9702 function useGlobalStylesOpenCssCommands() { 9703 const { 9704 openGeneralSidebar, 9705 setEditorCanvasContainerView, 9706 setCanvasMode 9707 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9708 const { 9709 params 9710 } = use_common_commands_useLocation(); 9711 const history = use_common_commands_useHistory(); 9712 const { 9713 canEditCSS 9714 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9715 const { 9716 getEntityRecord, 9717 __experimentalGetCurrentGlobalStylesId 9718 } = select(external_wp_coreData_namespaceObject.store); 9719 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9720 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 9721 return { 9722 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 9723 }; 9724 }, []); 9725 const { 9726 getCanvasMode 9727 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 9728 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9729 if (!canEditCSS) { 9730 return []; 9731 } 9732 return [{ 9733 name: 'core/edit-site/open-styles-css', 9734 label: (0,external_wp_i18n_namespaceObject.__)('Customize CSS'), 9735 icon: library_brush, 9736 callback: ({ 9737 close 9738 }) => { 9739 close(); 9740 if (!params.postId) { 9741 history.push({ 9742 path: '/wp_global_styles', 9743 canvas: 'edit' 9744 }); 9745 } 9746 if (params.postId && getCanvasMode() !== 'edit') { 9747 setCanvasMode('edit'); 9748 } 9749 openGeneralSidebar('edit-site/global-styles'); 9750 setEditorCanvasContainerView('global-styles-css'); 9751 } 9752 }]; 9753 }, [history, openGeneralSidebar, setEditorCanvasContainerView, canEditCSS, getCanvasMode, setCanvasMode, params.postId]); 9754 return { 9755 isLoading: false, 9756 commands 9757 }; 9758 } 9759 function useGlobalStylesOpenRevisionsCommands() { 9760 const { 9761 openGeneralSidebar, 9762 setEditorCanvasContainerView, 9763 setCanvasMode 9764 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9765 const { 9766 getCanvasMode 9767 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 9768 const { 9769 params 9770 } = use_common_commands_useLocation(); 9771 const history = use_common_commands_useHistory(); 9772 const hasRevisions = (0,external_wp_data_namespaceObject.useSelect)(select => { 9773 const { 9774 getEntityRecord, 9775 __experimentalGetCurrentGlobalStylesId 9776 } = select(external_wp_coreData_namespaceObject.store); 9777 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9778 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 9779 return !!globalStyles?._links?.['version-history']?.[0]?.count; 9780 }, []); 9781 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9782 if (!hasRevisions) { 9783 return []; 9784 } 9785 return [{ 9786 name: 'core/edit-site/open-global-styles-revisions', 9787 label: (0,external_wp_i18n_namespaceObject.__)('Style revisions'), 9788 icon: library_backup, 9789 callback: ({ 9790 close 9791 }) => { 9792 close(); 9793 if (!params.postId) { 9794 history.push({ 9795 path: '/wp_global_styles', 9796 canvas: 'edit' 9797 }); 9798 } 9799 if (params.postId && getCanvasMode() !== 'edit') { 9800 setCanvasMode('edit'); 9801 } 9802 openGeneralSidebar('edit-site/global-styles'); 9803 setEditorCanvasContainerView('global-styles-revisions'); 9804 } 9805 }]; 9806 }, [hasRevisions, history, openGeneralSidebar, setEditorCanvasContainerView, getCanvasMode, setCanvasMode, params.postId]); 9807 return { 9808 isLoading: false, 9809 commands 9810 }; 9811 } 9812 function useCommonCommands() { 9813 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 9814 // Site index. 9815 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 9816 }, []); 9817 (0,external_wp_commands_namespaceObject.useCommand)({ 9818 name: 'core/edit-site/view-site', 9819 label: (0,external_wp_i18n_namespaceObject.__)('View site'), 9820 callback: ({ 9821 close 9822 }) => { 9823 close(); 9824 window.open(homeUrl, '_blank'); 9825 }, 9826 icon: library_external 9827 }); 9828 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9829 name: 'core/edit-site/open-styles', 9830 hook: useGlobalStylesOpenStylesCommands 9831 }); 9832 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9833 name: 'core/edit-site/toggle-styles-welcome-guide', 9834 hook: useGlobalStylesToggleWelcomeGuideCommands 9835 }); 9836 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9837 name: 'core/edit-site/reset-global-styles', 9838 hook: useGlobalStylesResetCommands 9839 }); 9840 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9841 name: 'core/edit-site/open-styles-css', 9842 hook: useGlobalStylesOpenCssCommands 9843 }); 9844 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9845 name: 'core/edit-site/open-styles-revisions', 9846 hook: useGlobalStylesOpenRevisionsCommands 9847 }); 9848 } 9849 9850 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js 9851 /** 9852 * WordPress dependencies 9853 */ 9854 9855 9856 const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9857 xmlns: "http://www.w3.org/2000/svg", 9858 viewBox: "0 0 24 24", 9859 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9860 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" 9861 }) 9862 }); 9863 /* harmony default export */ const library_layout = (layout); 9864 9865 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js 9866 /** 9867 * WordPress dependencies 9868 */ 9869 9870 9871 9872 const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 9873 xmlns: "http://www.w3.org/2000/svg", 9874 viewBox: "0 0 24 24", 9875 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9876 d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" 9877 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9878 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" 9879 })] 9880 }); 9881 /* harmony default export */ const library_page = (page); 9882 9883 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js 9884 /** 9885 * WordPress dependencies 9886 */ 9887 9888 9889 const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9890 xmlns: "http://www.w3.org/2000/svg", 9891 viewBox: "0 0 24 24", 9892 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9893 fillRule: "evenodd", 9894 clipRule: "evenodd", 9895 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" 9896 }) 9897 }); 9898 /* harmony default export */ const library_trash = (trash); 9899 9900 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-removable.js 9901 /** 9902 * Internal dependencies 9903 */ 9904 9905 9906 /** 9907 * Check if a template is removable. 9908 * 9909 * @param {Object} template The template entity to check. 9910 * @return {boolean} Whether the template is removable. 9911 */ 9912 function isTemplateRemovable(template) { 9913 if (!template) { 9914 return false; 9915 } 9916 return template.source === TEMPLATE_ORIGINS.custom && !Boolean(template.plugin) && !template.has_theme_file; 9917 } 9918 9919 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-revertable.js 9920 /** 9921 * Internal dependencies 9922 */ 9923 9924 9925 /** 9926 * Check if a template is revertable to its original theme-provided template file. 9927 * 9928 * @param {Object} template The template entity to check. 9929 * @return {boolean} Whether the template is revertable. 9930 */ 9931 function isTemplateRevertable(template) { 9932 if (!template) { 9933 return false; 9934 } 9935 /* eslint-disable camelcase */ 9936 return template?.source === TEMPLATE_ORIGINS.custom && (Boolean(template?.plugin) || template?.has_theme_file); 9937 /* eslint-enable camelcase */ 9938 } 9939 9940 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/link.js 9941 /** 9942 * WordPress dependencies 9943 */ 9944 9945 9946 9947 /** 9948 * Internal dependencies 9949 */ 9950 9951 9952 9953 const { 9954 useHistory: link_useHistory 9955 } = unlock(external_wp_router_namespaceObject.privateApis); 9956 function useLink(params, state, shouldReplace = false) { 9957 const history = link_useHistory(); 9958 function onClick(event) { 9959 event?.preventDefault(); 9960 if (shouldReplace) { 9961 history.replace(params, state); 9962 } else { 9963 history.push(params, state); 9964 } 9965 } 9966 const currentArgs = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href); 9967 const currentUrlWithoutArgs = (0,external_wp_url_namespaceObject.removeQueryArgs)(window.location.href, ...Object.keys(currentArgs)); 9968 if (isPreviewingTheme()) { 9969 params = { 9970 ...params, 9971 wp_theme_preview: currentlyPreviewingTheme() 9972 }; 9973 } 9974 const newUrl = (0,external_wp_url_namespaceObject.addQueryArgs)(currentUrlWithoutArgs, params); 9975 return { 9976 href: newUrl, 9977 onClick 9978 }; 9979 } 9980 function Link({ 9981 params = {}, 9982 state, 9983 replace: shouldReplace = false, 9984 children, 9985 ...props 9986 }) { 9987 const { 9988 href, 9989 onClick 9990 } = useLink(params, state, shouldReplace); 9991 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { 9992 href: href, 9993 onClick: onClick, 9994 ...props, 9995 children: children 9996 }); 9997 } 9998 9999 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-edit-mode-commands.js 10000 /** 10001 * WordPress dependencies 10002 */ 10003 10004 10005 10006 10007 10008 10009 10010 10011 /** 10012 * Internal dependencies 10013 */ 10014 10015 10016 10017 10018 10019 10020 10021 const { 10022 useHistory: use_edit_mode_commands_useHistory 10023 } = unlock(external_wp_router_namespaceObject.privateApis); 10024 function usePageContentFocusCommands() { 10025 const { 10026 record: template 10027 } = useEditedEntityRecord(); 10028 const { 10029 isPage, 10030 canvasMode, 10031 templateId, 10032 currentPostType 10033 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10034 const { 10035 isPage: _isPage, 10036 getCanvasMode 10037 } = unlock(select(store)); 10038 const { 10039 getCurrentPostType, 10040 getCurrentTemplateId 10041 } = select(external_wp_editor_namespaceObject.store); 10042 return { 10043 isPage: _isPage(), 10044 canvasMode: getCanvasMode(), 10045 templateId: getCurrentTemplateId(), 10046 currentPostType: getCurrentPostType() 10047 }; 10048 }, []); 10049 const { 10050 onClick: editTemplate 10051 } = useLink({ 10052 postType: 'wp_template', 10053 postId: templateId 10054 }); 10055 const { 10056 setRenderingMode 10057 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 10058 if (!isPage || canvasMode !== 'edit') { 10059 return { 10060 isLoading: false, 10061 commands: [] 10062 }; 10063 } 10064 const commands = []; 10065 if (currentPostType !== 'wp_template') { 10066 commands.push({ 10067 name: 'core/switch-to-template-focus', 10068 label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */ 10069 (0,external_wp_i18n_namespaceObject.__)('Edit template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)), 10070 icon: library_layout, 10071 callback: ({ 10072 close 10073 }) => { 10074 editTemplate(); 10075 close(); 10076 } 10077 }); 10078 } else { 10079 commands.push({ 10080 name: 'core/switch-to-page-focus', 10081 label: (0,external_wp_i18n_namespaceObject.__)('Back to page'), 10082 icon: library_page, 10083 callback: ({ 10084 close 10085 }) => { 10086 setRenderingMode('template-locked'); 10087 close(); 10088 } 10089 }); 10090 } 10091 return { 10092 isLoading: false, 10093 commands 10094 }; 10095 } 10096 function useManipulateDocumentCommands() { 10097 const { 10098 isLoaded, 10099 record: template 10100 } = useEditedEntityRecord(); 10101 const { 10102 removeTemplate, 10103 revertTemplate 10104 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10105 const history = use_edit_mode_commands_useHistory(); 10106 const isEditingPage = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isPage() && select(external_wp_editor_namespaceObject.store).getCurrentPostType() !== 'wp_template', []); 10107 if (!isLoaded) { 10108 return { 10109 isLoading: true, 10110 commands: [] 10111 }; 10112 } 10113 const commands = []; 10114 if (isTemplateRevertable(template) && !isEditingPage) { 10115 const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */ 10116 (0,external_wp_i18n_namespaceObject.__)('Reset template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template part title */ 10117 (0,external_wp_i18n_namespaceObject.__)('Reset template part: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)); 10118 commands.push({ 10119 name: 'core/reset-template', 10120 label, 10121 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right : rotate_left, 10122 callback: ({ 10123 close 10124 }) => { 10125 revertTemplate(template); 10126 close(); 10127 } 10128 }); 10129 } 10130 if (isTemplateRemovable(template) && !isEditingPage) { 10131 const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */ 10132 (0,external_wp_i18n_namespaceObject.__)('Delete template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template part title */ 10133 (0,external_wp_i18n_namespaceObject.__)('Delete template part: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)); 10134 commands.push({ 10135 name: 'core/remove-template', 10136 label, 10137 icon: library_trash, 10138 callback: ({ 10139 close 10140 }) => { 10141 removeTemplate(template); 10142 // Navigate to the template list 10143 history.push({ 10144 postType: template.type 10145 }); 10146 close(); 10147 } 10148 }); 10149 } 10150 return { 10151 isLoading: !isLoaded, 10152 commands 10153 }; 10154 } 10155 function useEditModeCommands() { 10156 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 10157 name: 'core/edit-site/page-content-focus', 10158 hook: usePageContentFocusCommands, 10159 context: 'entity-edit' 10160 }); 10161 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 10162 name: 'core/edit-site/manipulate-document', 10163 hook: useManipulateDocumentCommands 10164 }); 10165 } 10166 10167 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js 10168 /** 10169 * WordPress dependencies 10170 */ 10171 10172 10173 10174 10175 10176 10177 /** 10178 * Internal dependencies 10179 */ 10180 10181 10182 10183 const { 10184 useLocation: use_init_edited_entity_from_url_useLocation 10185 } = unlock(external_wp_router_namespaceObject.privateApis); 10186 const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; 10187 const authorizedPostTypes = ['page', 'post']; 10188 function useResolveEditedEntityAndContext({ 10189 postId, 10190 postType 10191 }) { 10192 const { 10193 hasLoadedAllDependencies, 10194 homepageId, 10195 postsPageId, 10196 url, 10197 frontPageTemplateId 10198 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10199 const { 10200 getEntityRecord, 10201 getEntityRecords 10202 } = select(external_wp_coreData_namespaceObject.store); 10203 const siteData = getEntityRecord('root', 'site'); 10204 const base = getEntityRecord('root', '__unstableBase'); 10205 const templates = getEntityRecords('postType', TEMPLATE_POST_TYPE, { 10206 per_page: -1 10207 }); 10208 const _homepageId = siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_on_front) && !!+siteData.page_on_front // We also need to check if it's not zero(`0`). 10209 ? siteData.page_on_front.toString() : null; 10210 const _postsPageId = siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_for_posts) ? siteData.page_for_posts.toString() : null; 10211 let _frontPageTemplateId; 10212 if (templates) { 10213 const frontPageTemplate = templates.find(t => t.slug === 'front-page'); 10214 _frontPageTemplateId = frontPageTemplate ? frontPageTemplate.id : false; 10215 } 10216 return { 10217 hasLoadedAllDependencies: !!base && !!siteData, 10218 homepageId: _homepageId, 10219 postsPageId: _postsPageId, 10220 url: base?.home, 10221 frontPageTemplateId: _frontPageTemplateId 10222 }; 10223 }, []); 10224 10225 /** 10226 * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId 10227 * in order to match the frontend as closely as possible in the site editor. 10228 * 10229 * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution. 10230 */ 10231 const resolvedTemplateId = (0,external_wp_data_namespaceObject.useSelect)(select => { 10232 // If we're rendering a post type that doesn't have a template 10233 // no need to resolve its template. 10234 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 10235 return undefined; 10236 } 10237 10238 // Don't trigger resolution for multi-selected posts. 10239 if (postId && postId.includes(',')) { 10240 return undefined; 10241 } 10242 const { 10243 getEditedEntityRecord, 10244 getEntityRecords, 10245 getDefaultTemplateId, 10246 __experimentalGetTemplateForLink 10247 } = select(external_wp_coreData_namespaceObject.store); 10248 function resolveTemplateForPostTypeAndId(postTypeToResolve, postIdToResolve) { 10249 // For the front page, we always use the front page template if existing. 10250 if (postTypeToResolve === 'page' && homepageId === postIdToResolve) { 10251 // We're still checking whether the front page template exists. 10252 // Don't resolve the template yet. 10253 if (frontPageTemplateId === undefined) { 10254 return undefined; 10255 } 10256 if (!!frontPageTemplateId) { 10257 return frontPageTemplateId; 10258 } 10259 } 10260 const editedEntity = getEditedEntityRecord('postType', postTypeToResolve, postIdToResolve); 10261 if (!editedEntity) { 10262 return undefined; 10263 } 10264 // Check if the current page is the posts page. 10265 if (postTypeToResolve === 'page' && postsPageId === postIdToResolve) { 10266 return __experimentalGetTemplateForLink(editedEntity.link)?.id; 10267 } 10268 // First see if the post/page has an assigned template and fetch it. 10269 const currentTemplateSlug = editedEntity.template; 10270 if (currentTemplateSlug) { 10271 const currentTemplate = getEntityRecords('postType', TEMPLATE_POST_TYPE, { 10272 per_page: -1 10273 })?.find(({ 10274 slug 10275 }) => slug === currentTemplateSlug); 10276 if (currentTemplate) { 10277 return currentTemplate.id; 10278 } 10279 } 10280 // If no template is assigned, use the default template. 10281 let slugToCheck; 10282 // In `draft` status we might not have a slug available, so we use the `single` 10283 // post type templates slug(ex page, single-post, single-product etc..). 10284 // Pages do not need the `single` prefix in the slug to be prioritized 10285 // through template hierarchy. 10286 if (editedEntity.slug) { 10287 slugToCheck = postTypeToResolve === 'page' ? `$postTypeToResolve}-$editedEntity.slug}` : `single-$postTypeToResolve}-$editedEntity.slug}`; 10288 } else { 10289 slugToCheck = postTypeToResolve === 'page' ? 'page' : `single-$postTypeToResolve}`; 10290 } 10291 return getDefaultTemplateId({ 10292 slug: slugToCheck 10293 }); 10294 } 10295 if (!hasLoadedAllDependencies) { 10296 return undefined; 10297 } 10298 10299 // If we're rendering a specific page, we need to resolve its template. 10300 // The site editor only supports pages for now, not other CPTs. 10301 if (postType && postId && authorizedPostTypes.includes(postType)) { 10302 return resolveTemplateForPostTypeAndId(postType, postId); 10303 } 10304 10305 // If we're rendering the home page, and we have a static home page, resolve its template. 10306 if (homepageId) { 10307 return resolveTemplateForPostTypeAndId('page', homepageId); 10308 } 10309 10310 // If we're not rendering a specific page, use the front page template. 10311 if (url) { 10312 const template = __experimentalGetTemplateForLink(url); 10313 return template?.id; 10314 } 10315 }, [homepageId, postsPageId, hasLoadedAllDependencies, url, postId, postType, frontPageTemplateId]); 10316 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 10317 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 10318 return {}; 10319 } 10320 if (postType && postId && authorizedPostTypes.includes(postType)) { 10321 return { 10322 postType, 10323 postId 10324 }; 10325 } 10326 // TODO: for post types lists we should probably not render the front page, but maybe a placeholder 10327 // with a message like "Select a page" or something similar. 10328 if (homepageId) { 10329 return { 10330 postType: 'page', 10331 postId: homepageId 10332 }; 10333 } 10334 return {}; 10335 }, [homepageId, postType, postId]); 10336 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 10337 return { 10338 isReady: true, 10339 postType, 10340 postId, 10341 context 10342 }; 10343 } 10344 if (hasLoadedAllDependencies) { 10345 return { 10346 isReady: resolvedTemplateId !== undefined, 10347 postType: TEMPLATE_POST_TYPE, 10348 postId: resolvedTemplateId, 10349 context 10350 }; 10351 } 10352 return { 10353 isReady: false 10354 }; 10355 } 10356 function useInitEditedEntityFromURL() { 10357 const { 10358 params = {} 10359 } = use_init_edited_entity_from_url_useLocation(); 10360 const { 10361 postType, 10362 postId, 10363 context, 10364 isReady 10365 } = useResolveEditedEntityAndContext(params); 10366 const { 10367 setEditedEntity 10368 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10369 const { 10370 __unstableSetEditorMode, 10371 resetZoomLevel 10372 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 10373 (0,external_wp_element_namespaceObject.useEffect)(() => { 10374 if (isReady) { 10375 __unstableSetEditorMode('edit'); 10376 resetZoomLevel(); 10377 setEditedEntity(postType, postId, context); 10378 } 10379 }, [isReady, postType, postId, context, setEditedEntity]); 10380 } 10381 10382 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js 10383 /** 10384 * WordPress dependencies 10385 */ 10386 10387 10388 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 10389 10390 /** 10391 * Return an SVG icon. 10392 * 10393 * @param {IconProps} props icon is the SVG component to render 10394 * size is a number specifiying the icon size in pixels 10395 * Other props will be passed to wrapped SVG component 10396 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. 10397 * 10398 * @return {JSX.Element} Icon component 10399 */ 10400 function Icon({ 10401 icon, 10402 size = 24, 10403 ...props 10404 }, ref) { 10405 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 10406 width: size, 10407 height: size, 10408 ...props, 10409 ref 10410 }); 10411 } 10412 /* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); 10413 10414 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js 10415 /** 10416 * WordPress dependencies 10417 */ 10418 10419 10420 const arrowUpLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10421 width: "24", 10422 height: "24", 10423 fill: "none", 10424 xmlns: "http://www.w3.org/2000/svg", 10425 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10426 d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" 10427 }) 10428 }); 10429 /* harmony default export */ const arrow_up_left = (arrowUpLeft); 10430 10431 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js 10432 10433 10434 function WelcomeGuideImage({ 10435 nonAnimatedSrc, 10436 animatedSrc 10437 }) { 10438 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { 10439 className: "edit-site-welcome-guide__image", 10440 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10441 srcSet: nonAnimatedSrc, 10442 media: "(prefers-reduced-motion: reduce)" 10443 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 10444 src: animatedSrc, 10445 width: "312", 10446 height: "240", 10447 alt: "" 10448 })] 10449 }); 10450 } 10451 10452 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js 10453 /** 10454 * WordPress dependencies 10455 */ 10456 10457 10458 10459 10460 10461 10462 10463 /** 10464 * Internal dependencies 10465 */ 10466 10467 10468 10469 10470 function WelcomeGuideEditor() { 10471 const { 10472 toggle 10473 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10474 const { 10475 isActive, 10476 isBlockBasedTheme 10477 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10478 return { 10479 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), 10480 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme 10481 }; 10482 }, []); 10483 if (!isActive || !isBlockBasedTheme) { 10484 return null; 10485 } 10486 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10487 className: "edit-site-welcome-guide guide-editor", 10488 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'), 10489 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 10490 onFinish: () => toggle('core/edit-site', 'welcomeGuide'), 10491 pages: [{ 10492 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10493 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", 10494 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" 10495 }), 10496 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10497 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10498 className: "edit-site-welcome-guide__heading", 10499 children: (0,external_wp_i18n_namespaceObject.__)('Edit your site') 10500 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10501 className: "edit-site-welcome-guide__text", 10502 children: (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.') 10503 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10504 className: "edit-site-welcome-guide__text", 10505 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.'), { 10506 StylesIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 10507 alt: (0,external_wp_i18n_namespaceObject.__)('styles'), 10508 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" 10509 }) 10510 }) 10511 })] 10512 }) 10513 }] 10514 }); 10515 } 10516 10517 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js 10518 /** 10519 * WordPress dependencies 10520 */ 10521 10522 10523 10524 10525 10526 10527 /** 10528 * Internal dependencies 10529 */ 10530 10531 10532 10533 10534 10535 const { 10536 interfaceStore: styles_interfaceStore 10537 } = unlock(external_wp_editor_namespaceObject.privateApis); 10538 function WelcomeGuideStyles() { 10539 const { 10540 toggle 10541 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10542 const { 10543 isActive, 10544 isStylesOpen 10545 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10546 const sidebar = select(styles_interfaceStore).getActiveComplementaryArea('core'); 10547 return { 10548 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'), 10549 isStylesOpen: sidebar === 'edit-site/global-styles' 10550 }; 10551 }, []); 10552 if (!isActive || !isStylesOpen) { 10553 return null; 10554 } 10555 const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles'); 10556 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10557 className: "edit-site-welcome-guide guide-styles", 10558 contentLabel: welcomeLabel, 10559 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 10560 onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'), 10561 pages: [{ 10562 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10563 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", 10564 animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" 10565 }), 10566 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10567 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10568 className: "edit-site-welcome-guide__heading", 10569 children: welcomeLabel 10570 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10571 className: "edit-site-welcome-guide__text", 10572 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.') 10573 })] 10574 }) 10575 }, { 10576 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10577 nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", 10578 animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" 10579 }), 10580 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10581 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10582 className: "edit-site-welcome-guide__heading", 10583 children: (0,external_wp_i18n_namespaceObject.__)('Set the design') 10584 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10585 className: "edit-site-welcome-guide__text", 10586 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!') 10587 })] 10588 }) 10589 }, { 10590 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10591 nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", 10592 animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" 10593 }), 10594 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10595 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10596 className: "edit-site-welcome-guide__heading", 10597 children: (0,external_wp_i18n_namespaceObject.__)('Personalize blocks') 10598 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10599 className: "edit-site-welcome-guide__text", 10600 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.') 10601 })] 10602 }) 10603 }, { 10604 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10605 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 10606 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 10607 }), 10608 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10609 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10610 className: "edit-site-welcome-guide__heading", 10611 children: (0,external_wp_i18n_namespaceObject.__)('Learn more') 10612 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { 10613 className: "edit-site-welcome-guide__text", 10614 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, { 10615 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/styles-overview/'), 10616 children: (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.') 10617 })] 10618 })] 10619 }) 10620 }] 10621 }); 10622 } 10623 10624 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js 10625 /** 10626 * WordPress dependencies 10627 */ 10628 10629 10630 10631 10632 10633 /** 10634 * Internal dependencies 10635 */ 10636 10637 10638 10639 10640 function WelcomeGuidePage() { 10641 const { 10642 toggle 10643 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10644 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { 10645 const isPageActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuidePage'); 10646 const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'); 10647 const { 10648 isPage 10649 } = select(store); 10650 return isPageActive && !isEditorActive && isPage(); 10651 }, []); 10652 if (!isVisible) { 10653 return null; 10654 } 10655 const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a page'); 10656 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10657 className: "edit-site-welcome-guide guide-page", 10658 contentLabel: heading, 10659 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), 10660 onFinish: () => toggle('core/edit-site', 'welcomeGuidePage'), 10661 pages: [{ 10662 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { 10663 className: "edit-site-welcome-guide__video", 10664 autoPlay: true, 10665 loop: true, 10666 muted: true, 10667 width: "312", 10668 height: "240", 10669 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10670 src: "https://s.w.org/images/block-editor/editing-your-page.mp4", 10671 type: "video/mp4" 10672 }) 10673 }), 10674 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10675 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10676 className: "edit-site-welcome-guide__heading", 10677 children: heading 10678 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10679 className: "edit-site-welcome-guide__text", 10680 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.') 10681 })] 10682 }) 10683 }] 10684 }); 10685 } 10686 10687 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js 10688 /** 10689 * WordPress dependencies 10690 */ 10691 10692 10693 10694 10695 10696 10697 /** 10698 * Internal dependencies 10699 */ 10700 10701 10702 10703 10704 function WelcomeGuideTemplate() { 10705 const { 10706 toggle 10707 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10708 const { 10709 isLoaded, 10710 record 10711 } = useEditedEntityRecord(); 10712 const isPostTypeTemplate = isLoaded && record.type === 'wp_template'; 10713 const { 10714 isActive, 10715 hasPreviousEntity 10716 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10717 const { 10718 getEditorSettings 10719 } = select(external_wp_editor_namespaceObject.store); 10720 const { 10721 get 10722 } = select(external_wp_preferences_namespaceObject.store); 10723 return { 10724 isActive: get('core/edit-site', 'welcomeGuideTemplate'), 10725 hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord 10726 }; 10727 }, []); 10728 const isVisible = isActive && isPostTypeTemplate && hasPreviousEntity; 10729 if (!isVisible) { 10730 return null; 10731 } 10732 const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a template'); 10733 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10734 className: "edit-site-welcome-guide guide-template", 10735 contentLabel: heading, 10736 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), 10737 onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'), 10738 pages: [{ 10739 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { 10740 className: "edit-site-welcome-guide__video", 10741 autoPlay: true, 10742 loop: true, 10743 muted: true, 10744 width: "312", 10745 height: "240", 10746 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10747 src: "https://s.w.org/images/block-editor/editing-your-template.mp4", 10748 type: "video/mp4" 10749 }) 10750 }), 10751 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10752 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10753 className: "edit-site-welcome-guide__heading", 10754 children: heading 10755 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10756 className: "edit-site-welcome-guide__text", 10757 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.') 10758 })] 10759 }) 10760 }] 10761 }); 10762 } 10763 10764 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js 10765 /** 10766 * Internal dependencies 10767 */ 10768 10769 10770 10771 10772 10773 10774 10775 function WelcomeGuide() { 10776 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10777 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {})] 10778 }); 10779 } 10780 10781 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js 10782 /** 10783 * WordPress dependencies 10784 */ 10785 10786 10787 10788 10789 /** 10790 * Internal dependencies 10791 */ 10792 10793 10794 10795 const { 10796 useGlobalStylesOutput 10797 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10798 function useGlobalStylesRenderer() { 10799 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { 10800 return select(store).getEditedPostType(); 10801 }); 10802 const [styles, settings] = useGlobalStylesOutput(postType !== TEMPLATE_POST_TYPE); 10803 const { 10804 getSettings 10805 } = (0,external_wp_data_namespaceObject.useSelect)(store); 10806 const { 10807 updateSettings 10808 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10809 (0,external_wp_element_namespaceObject.useEffect)(() => { 10810 var _currentStoreSettings; 10811 if (!styles || !settings) { 10812 return; 10813 } 10814 const currentStoreSettings = getSettings(); 10815 const nonGlobalStyles = Object.values((_currentStoreSettings = currentStoreSettings.styles) !== null && _currentStoreSettings !== void 0 ? _currentStoreSettings : []).filter(style => !style.isGlobalStyles); 10816 updateSettings({ 10817 ...currentStoreSettings, 10818 styles: [...nonGlobalStyles, ...styles], 10819 __experimentalFeatures: settings 10820 }); 10821 }, [styles, settings, updateSettings, getSettings]); 10822 } 10823 function GlobalStylesRenderer() { 10824 useGlobalStylesRenderer(); 10825 return null; 10826 } 10827 10828 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js 10829 /** 10830 * WordPress dependencies 10831 */ 10832 10833 10834 10835 10836 10837 /** 10838 * Internal dependencies 10839 */ 10840 10841 10842 10843 const { 10844 Theme 10845 } = unlock(external_wp_components_namespaceObject.privateApis); 10846 const { 10847 useGlobalStyle: canvas_loader_useGlobalStyle 10848 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10849 function CanvasLoader({ 10850 id 10851 }) { 10852 var _highlightedColors$0$; 10853 const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle('color.text'); 10854 const [backgroundColor] = canvas_loader_useGlobalStyle('color.background'); 10855 const { 10856 highlightedColors 10857 } = useStylesPreviewColors(); 10858 const indicatorColor = (_highlightedColors$0$ = highlightedColors[0]?.color) !== null && _highlightedColors$0$ !== void 0 ? _highlightedColors$0$ : fallbackIndicatorColor; 10859 const { 10860 elapsed, 10861 total 10862 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10863 var _selectorsByStatus$re, _selectorsByStatus$fi; 10864 const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus(); 10865 const resolving = (_selectorsByStatus$re = selectorsByStatus.resolving) !== null && _selectorsByStatus$re !== void 0 ? _selectorsByStatus$re : 0; 10866 const finished = (_selectorsByStatus$fi = selectorsByStatus.finished) !== null && _selectorsByStatus$fi !== void 0 ? _selectorsByStatus$fi : 0; 10867 return { 10868 elapsed: finished, 10869 total: finished + resolving 10870 }; 10871 }, []); 10872 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10873 className: "edit-site-canvas-loader", 10874 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, { 10875 accent: indicatorColor, 10876 background: backgroundColor, 10877 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, { 10878 id: id, 10879 max: total, 10880 value: elapsed 10881 }) 10882 }) 10883 }); 10884 } 10885 10886 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js 10887 /** 10888 * WordPress dependencies 10889 */ 10890 10891 10892 10893 /** 10894 * Internal dependencies 10895 */ 10896 10897 const { 10898 useHistory: use_navigate_to_entity_record_useHistory 10899 } = unlock(external_wp_router_namespaceObject.privateApis); 10900 function useNavigateToEntityRecord() { 10901 const history = use_navigate_to_entity_record_useHistory(); 10902 const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { 10903 history.push({ 10904 ...params, 10905 focusMode: true, 10906 canvas: 'edit' 10907 }); 10908 }, [history]); 10909 return onNavigateToEntityRecord; 10910 } 10911 10912 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js 10913 /** 10914 * WordPress dependencies 10915 */ 10916 10917 10918 10919 10920 10921 /** 10922 * Internal dependencies 10923 */ 10924 10925 10926 10927 10928 const { 10929 useLocation: use_site_editor_settings_useLocation, 10930 useHistory: use_site_editor_settings_useHistory 10931 } = unlock(external_wp_router_namespaceObject.privateApis); 10932 function useNavigateToPreviousEntityRecord() { 10933 const location = use_site_editor_settings_useLocation(); 10934 const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location); 10935 const history = use_site_editor_settings_useHistory(); 10936 const goBack = (0,external_wp_element_namespaceObject.useMemo)(() => { 10937 const isFocusMode = location.params.focusMode || location.params.postId && FOCUSABLE_ENTITIES.includes(location.params.postType); 10938 const didComeFromEditorCanvas = previousLocation?.params.canvas === 'edit'; 10939 const showBackButton = isFocusMode && didComeFromEditorCanvas; 10940 return showBackButton ? () => history.back() : undefined; 10941 // Disable reason: previousLocation changes when the component updates for any reason, not 10942 // just when location changes. Until this is fixed we can't add it to deps. See 10943 // https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465. 10944 // eslint-disable-next-line react-hooks/exhaustive-deps 10945 }, [location, history]); 10946 return goBack; 10947 } 10948 function useSpecificEditorSettings() { 10949 const onNavigateToEntityRecord = useNavigateToEntityRecord(); 10950 const { 10951 canvasMode, 10952 settings, 10953 shouldUseTemplateAsDefaultRenderingMode 10954 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10955 const { 10956 getEditedPostContext, 10957 getCanvasMode, 10958 getSettings 10959 } = unlock(select(store)); 10960 const _context = getEditedPostContext(); 10961 return { 10962 canvasMode: getCanvasMode(), 10963 settings: getSettings(), 10964 // TODO: The `postType` check should be removed when the default rendering mode per post type is merged. 10965 // @see https://github.com/WordPress/gutenberg/pull/62304/ 10966 shouldUseTemplateAsDefaultRenderingMode: _context?.postId && _context?.postType !== 'post' 10967 }; 10968 }, []); 10969 const defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode ? 'template-locked' : 'post-only'; 10970 const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); 10971 const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { 10972 return { 10973 ...settings, 10974 richEditingEnabled: true, 10975 supportsTemplateMode: true, 10976 focusMode: canvasMode !== 'view', 10977 defaultRenderingMode, 10978 onNavigateToEntityRecord, 10979 onNavigateToPreviousEntityRecord, 10980 __unstableIsPreviewMode: canvasMode === 'view' 10981 }; 10982 }, [settings, canvasMode, defaultRenderingMode, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); 10983 return defaultEditorSettings; 10984 } 10985 10986 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js 10987 /** 10988 * Defines an extensibility slot for the Template sidebar. 10989 */ 10990 10991 /** 10992 * WordPress dependencies 10993 */ 10994 10995 10996 10997 10998 10999 const { 11000 Fill, 11001 Slot 11002 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginTemplateSettingPanel'); 11003 const PluginTemplateSettingPanel = ({ 11004 children 11005 }) => { 11006 external_wp_deprecated_default()('wp.editSite.PluginTemplateSettingPanel', { 11007 since: '6.6', 11008 version: '6.8', 11009 alternative: 'wp.editor.PluginDocumentSettingPanel' 11010 }); 11011 const isCurrentEntityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); 11012 if (!isCurrentEntityTemplate) { 11013 return null; 11014 } 11015 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { 11016 children: children 11017 }); 11018 }; 11019 PluginTemplateSettingPanel.Slot = Slot; 11020 11021 /** 11022 * Renders items in the Template Sidebar below the main information 11023 * like the Template Card. 11024 * 11025 * @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead. 11026 * 11027 * @example 11028 * ```jsx 11029 * // Using ESNext syntax 11030 * import { PluginTemplateSettingPanel } from '@wordpress/edit-site'; 11031 * 11032 * const MyTemplateSettingTest = () => ( 11033 * <PluginTemplateSettingPanel> 11034 * <p>Hello, World!</p> 11035 * </PluginTemplateSettingPanel> 11036 * ); 11037 * ``` 11038 * 11039 * @return {Component} The component to be rendered. 11040 */ 11041 /* harmony default export */ const plugin_template_setting_panel = (PluginTemplateSettingPanel); 11042 11043 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/seen.js 11044 /** 11045 * WordPress dependencies 11046 */ 11047 11048 11049 const seen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11050 viewBox: "0 0 24 24", 11051 xmlns: "http://www.w3.org/2000/svg", 11052 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11053 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" 11054 }) 11055 }); 11056 /* harmony default export */ const library_seen = (seen); 11057 11058 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 11059 /** 11060 * WordPress dependencies 11061 */ 11062 11063 11064 const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11065 xmlns: "http://www.w3.org/2000/svg", 11066 viewBox: "0 0 24 24", 11067 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11068 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 11069 }) 11070 }); 11071 /* harmony default export */ const more_vertical = (moreVertical); 11072 11073 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js 11074 /** 11075 * WordPress dependencies 11076 */ 11077 11078 11079 const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11080 xmlns: "http://www.w3.org/2000/svg", 11081 viewBox: "0 0 24 24", 11082 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11083 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" 11084 }) 11085 }); 11086 /* harmony default export */ const chevron_left = (chevronLeft); 11087 11088 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js 11089 /** 11090 * WordPress dependencies 11091 */ 11092 11093 11094 const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11095 xmlns: "http://www.w3.org/2000/svg", 11096 viewBox: "0 0 24 24", 11097 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11098 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" 11099 }) 11100 }); 11101 /* harmony default export */ const chevron_right = (chevronRight); 11102 11103 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js 11104 /** 11105 * External dependencies 11106 */ 11107 11108 11109 /** 11110 * WordPress dependencies 11111 */ 11112 11113 11114 function IconWithCurrentColor({ 11115 className, 11116 ...props 11117 }) { 11118 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 11119 className: dist_clsx(className, 'edit-site-global-styles-icon-with-current-color'), 11120 ...props 11121 }); 11122 } 11123 11124 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js 11125 /** 11126 * WordPress dependencies 11127 */ 11128 11129 11130 /** 11131 * Internal dependencies 11132 */ 11133 11134 11135 11136 function GenericNavigationButton({ 11137 icon, 11138 children, 11139 ...props 11140 }) { 11141 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { 11142 ...props, 11143 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 11144 justify: "flex-start", 11145 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 11146 icon: icon, 11147 size: 24 11148 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 11149 children: children 11150 })] 11151 }), !icon && children] 11152 }); 11153 } 11154 function NavigationButtonAsItem(props) { 11155 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorButton, { 11156 as: GenericNavigationButton, 11157 ...props 11158 }); 11159 } 11160 function NavigationBackButtonAsItem(props) { 11161 return /*#__PURE__*/_jsx(NavigatorBackButton, { 11162 as: GenericNavigationButton, 11163 ...props 11164 }); 11165 } 11166 11167 11168 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/typography.js 11169 /** 11170 * WordPress dependencies 11171 */ 11172 11173 11174 const typography = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11175 xmlns: "http://www.w3.org/2000/svg", 11176 viewBox: "0 0 24 24", 11177 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11178 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" 11179 }) 11180 }); 11181 /* harmony default export */ const library_typography = (typography); 11182 11183 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js 11184 /** 11185 * WordPress dependencies 11186 */ 11187 11188 11189 const color = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11190 viewBox: "0 0 24 24", 11191 xmlns: "http://www.w3.org/2000/svg", 11192 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11193 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" 11194 }) 11195 }); 11196 /* harmony default export */ const library_color = (color); 11197 11198 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/background.js 11199 /** 11200 * WordPress dependencies 11201 */ 11202 11203 11204 const background = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11205 width: "24", 11206 height: "24", 11207 fill: "none", 11208 xmlns: "http://www.w3.org/2000/svg", 11209 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11210 fillRule: "evenodd", 11211 clipRule: "evenodd", 11212 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" 11213 }) 11214 }); 11215 /* harmony default export */ const library_background = (background); 11216 11217 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shadow.js 11218 /** 11219 * WordPress dependencies 11220 */ 11221 11222 11223 const shadow = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11224 viewBox: "0 0 24 24", 11225 xmlns: "http://www.w3.org/2000/svg", 11226 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11227 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" 11228 }) 11229 }); 11230 /* harmony default export */ const library_shadow = (shadow); 11231 11232 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js 11233 /** 11234 * WordPress dependencies 11235 */ 11236 11237 11238 11239 11240 11241 /** 11242 * Internal dependencies 11243 */ 11244 11245 11246 11247 11248 11249 const { 11250 useHasDimensionsPanel, 11251 useHasTypographyPanel, 11252 useHasColorPanel, 11253 useGlobalSetting: root_menu_useGlobalSetting, 11254 useSettingsForBlockElement, 11255 useHasBackgroundPanel 11256 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11257 function RootMenu() { 11258 const [rawSettings] = root_menu_useGlobalSetting(''); 11259 const settings = useSettingsForBlockElement(rawSettings); 11260 /* 11261 * Use the raw settings to determine if the background panel should be displayed, 11262 * as the background panel is not dependent on the block element settings. 11263 */ 11264 const hasBackgroundPanel = useHasBackgroundPanel(rawSettings); 11265 const hasTypographyPanel = useHasTypographyPanel(settings); 11266 const hasColorPanel = useHasColorPanel(settings); 11267 const hasShadowPanel = true; // useHasShadowPanel( settings ); 11268 const hasDimensionsPanel = useHasDimensionsPanel(settings); 11269 const hasLayoutPanel = hasDimensionsPanel; 11270 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11271 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 11272 children: [hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11273 icon: library_typography, 11274 path: "/typography", 11275 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Typography styles'), 11276 children: (0,external_wp_i18n_namespaceObject.__)('Typography') 11277 }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11278 icon: library_color, 11279 path: "/colors", 11280 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors styles'), 11281 children: (0,external_wp_i18n_namespaceObject.__)('Colors') 11282 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11283 icon: library_background, 11284 path: "/background", 11285 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Background styles'), 11286 children: (0,external_wp_i18n_namespaceObject.__)('Background') 11287 }), hasShadowPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11288 icon: library_shadow, 11289 path: "/shadows", 11290 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Shadow styles'), 11291 children: (0,external_wp_i18n_namespaceObject.__)('Shadows') 11292 }), hasLayoutPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11293 icon: library_layout, 11294 path: "/layout", 11295 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Layout styles'), 11296 children: (0,external_wp_i18n_namespaceObject.__)('Layout') 11297 })] 11298 }) 11299 }); 11300 } 11301 /* harmony default export */ const root_menu = (RootMenu); 11302 11303 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js 11304 function findNearest(input, numbers) { 11305 // If the numbers array is empty, return null 11306 if (numbers.length === 0) { 11307 return null; 11308 } 11309 // Sort the array based on the absolute difference with the input 11310 numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b)); 11311 // Return the first element (which will be the nearest) from the sorted array 11312 return numbers[0]; 11313 } 11314 function extractFontWeights(fontFaces) { 11315 const result = []; 11316 fontFaces.forEach(face => { 11317 const weights = String(face.fontWeight).split(' '); 11318 if (weights.length === 2) { 11319 const start = parseInt(weights[0]); 11320 const end = parseInt(weights[1]); 11321 for (let i = start; i <= end; i += 100) { 11322 result.push(i); 11323 } 11324 } else if (weights.length === 1) { 11325 result.push(parseInt(weights[0])); 11326 } 11327 }); 11328 return result; 11329 } 11330 11331 /* 11332 * Format the font family to use in the CSS font-family property of a CSS rule. 11333 * 11334 * The input can be a string with the font family name or a string with multiple font family names separated by commas. 11335 * It follows the recommendations from the CSS Fonts Module Level 4. 11336 * https://www.w3.org/TR/css-fonts-4/#font-family-prop 11337 * 11338 * @param {string} input - The font family. 11339 * @return {string} The formatted font family. 11340 * 11341 * Example: 11342 * formatFontFamily( "Open Sans, Font+Name, sans-serif" ) => '"Open Sans", "Font+Name", sans-serif' 11343 * formatFontFamily( "'Open Sans', generic(kai), sans-serif" ) => '"Open Sans", sans-serif' 11344 * formatFontFamily( "DotGothic16, Slabo 27px, serif" ) => '"DotGothic16","Slabo 27px",serif' 11345 * formatFontFamily( "Mine's, Moe's Typography" ) => `"mine's","Moe's Typography"` 11346 */ 11347 function formatFontFamily(input) { 11348 // Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens). 11349 const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; 11350 const output = input.trim(); 11351 const formatItem = item => { 11352 item = item.trim(); 11353 if (item.match(regex)) { 11354 // removes leading and trailing quotes. 11355 item = item.replace(/^["']|["']$/g, ''); 11356 return `"$item}"`; 11357 } 11358 return item; 11359 }; 11360 if (output.includes(',')) { 11361 return output.split(',').map(formatItem).filter(item => item !== '').join(', '); 11362 } 11363 return formatItem(output); 11364 } 11365 11366 /* 11367 * Format the font face name to use in the font-family property of a font face. 11368 * 11369 * The input can be a string with the font face name or a string with multiple font face names separated by commas. 11370 * It removes the leading and trailing quotes from the font face name. 11371 * 11372 * @param {string} input - The font face name. 11373 * @return {string} The formatted font face name. 11374 * 11375 * Example: 11376 * formatFontFaceName("Open Sans") => "Open Sans" 11377 * formatFontFaceName("'Open Sans', sans-serif") => "Open Sans" 11378 * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans" 11379 */ 11380 function formatFontFaceName(input) { 11381 if (!input) { 11382 return ''; 11383 } 11384 let output = input.trim(); 11385 if (output.includes(',')) { 11386 output = output.split(',') 11387 // finds the first item that is not an empty string. 11388 .find(item => item.trim() !== '').trim(); 11389 } 11390 // removes leading and trailing quotes. 11391 output = output.replace(/^["']|["']$/g, ''); 11392 11393 // Firefox needs the font name to be wrapped in double quotes meanwhile other browsers don't. 11394 if (window.navigator.userAgent.toLowerCase().includes('firefox')) { 11395 output = `"$output}"`; 11396 } 11397 return output; 11398 } 11399 function getFamilyPreviewStyle(family) { 11400 const style = { 11401 fontFamily: formatFontFamily(family.fontFamily) 11402 }; 11403 if (!Array.isArray(family.fontFace)) { 11404 style.fontWeight = '400'; 11405 style.fontStyle = 'normal'; 11406 return style; 11407 } 11408 if (family.fontFace) { 11409 //get all the font faces with normal style 11410 const normalFaces = family.fontFace.filter(face => face?.fontStyle && face.fontStyle.toLowerCase() === 'normal'); 11411 if (normalFaces.length > 0) { 11412 style.fontStyle = 'normal'; 11413 const normalWeights = extractFontWeights(normalFaces); 11414 const nearestWeight = findNearest(400, normalWeights); 11415 style.fontWeight = String(nearestWeight) || '400'; 11416 } else { 11417 style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || 'normal'; 11418 style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || '400'; 11419 } 11420 } 11421 return style; 11422 } 11423 function getFacePreviewStyle(face) { 11424 return { 11425 fontFamily: formatFontFamily(face.fontFamily), 11426 fontStyle: face.fontStyle || 'normal', 11427 fontWeight: face.fontWeight || '400' 11428 }; 11429 } 11430 11431 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js 11432 /** 11433 * 11434 * @param {string} variation The variation name. 11435 * 11436 * @return {string} The variation class name. 11437 */ 11438 function getVariationClassName(variation) { 11439 if (!variation) { 11440 return ''; 11441 } 11442 return `is-style-$variation}`; 11443 } 11444 11445 /** 11446 * Iterates through the presets array and searches for slugs that start with the specified 11447 * slugPrefix followed by a numerical suffix. It identifies the highest numerical suffix found 11448 * and returns one greater than the highest found suffix, ensuring that the new index is unique. 11449 * 11450 * @param {Array} presets The array of preset objects, each potentially containing a slug property. 11451 * @param {string} slugPrefix The prefix to look for in the preset slugs. 11452 * 11453 * @return {number} The next available index for a preset with the specified slug prefix, or 1 if no matching slugs are found. 11454 */ 11455 function getNewIndexFromPresets(presets, slugPrefix) { 11456 const nameRegex = new RegExp(`^$slugPrefix}([\\d]+)$`); 11457 const highestPresetValue = presets.reduce((currentHighest, preset) => { 11458 if (typeof preset?.slug === 'string') { 11459 const matches = preset?.slug.match(nameRegex); 11460 if (matches) { 11461 const id = parseInt(matches[1], 10); 11462 if (id > currentHighest) { 11463 return id; 11464 } 11465 } 11466 } 11467 return currentHighest; 11468 }, 0); 11469 return highestPresetValue + 1; 11470 } 11471 function getFontFamilyFromSetting(fontFamilies, setting) { 11472 if (!Array.isArray(fontFamilies) || !setting) { 11473 return null; 11474 } 11475 const fontFamilyVariable = setting.replace('var(', '').replace(')', ''); 11476 const fontFamilySlug = fontFamilyVariable?.split('--').slice(-1)[0]; 11477 return fontFamilies.find(fontFamily => fontFamily.slug === fontFamilySlug); 11478 } 11479 function getFontFamilies(themeJson) { 11480 const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; 11481 const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; 11482 let fontFamilies = []; 11483 if (themeFontFamilies && customFontFamilies) { 11484 fontFamilies = [...themeFontFamilies, ...customFontFamilies]; 11485 } else if (themeFontFamilies) { 11486 fontFamilies = themeFontFamilies; 11487 } else if (customFontFamilies) { 11488 fontFamilies = customFontFamilies; 11489 } 11490 const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; 11491 const bodyFontFamily = getFontFamilyFromSetting(fontFamilies, bodyFontFamilySetting); 11492 const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; 11493 let headingFontFamily; 11494 if (!headingFontFamilySetting) { 11495 headingFontFamily = bodyFontFamily; 11496 } else { 11497 headingFontFamily = getFontFamilyFromSetting(fontFamilies, themeJson?.styles?.elements?.heading?.typography?.fontFamily); 11498 } 11499 return [bodyFontFamily, headingFontFamily]; 11500 } 11501 11502 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js 11503 /** 11504 * WordPress dependencies 11505 */ 11506 11507 11508 11509 11510 11511 11512 /** 11513 * Internal dependencies 11514 */ 11515 11516 11517 11518 11519 11520 const { 11521 GlobalStylesContext: typography_example_GlobalStylesContext 11522 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11523 const { 11524 mergeBaseAndUserConfigs 11525 } = unlock(external_wp_editor_namespaceObject.privateApis); 11526 function PreviewTypography({ 11527 fontSize, 11528 variation 11529 }) { 11530 const { 11531 base 11532 } = (0,external_wp_element_namespaceObject.useContext)(typography_example_GlobalStylesContext); 11533 let config = base; 11534 if (variation) { 11535 config = mergeBaseAndUserConfigs(base, variation); 11536 } 11537 const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config); 11538 const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; 11539 const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; 11540 if (fontSize) { 11541 bodyPreviewStyle.fontSize = fontSize; 11542 headingPreviewStyle.fontSize = fontSize; 11543 } 11544 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 11545 animate: { 11546 scale: 1, 11547 opacity: 1 11548 }, 11549 initial: { 11550 scale: 0.1, 11551 opacity: 0 11552 }, 11553 transition: { 11554 delay: 0.3, 11555 type: 'tween' 11556 }, 11557 style: { 11558 textAlign: 'center' 11559 }, 11560 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 11561 style: headingPreviewStyle, 11562 children: (0,external_wp_i18n_namespaceObject._x)('A', 'Uppercase letter A') 11563 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 11564 style: bodyPreviewStyle, 11565 children: (0,external_wp_i18n_namespaceObject._x)('a', 'Lowercase letter A') 11566 })] 11567 }); 11568 } 11569 11570 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js 11571 /** 11572 * WordPress dependencies 11573 */ 11574 11575 11576 /** 11577 * Internal dependencies 11578 */ 11579 11580 11581 function HighlightedColors({ 11582 normalizedColorSwatchSize, 11583 ratio 11584 }) { 11585 const { 11586 highlightedColors 11587 } = useStylesPreviewColors(); 11588 const scaledSwatchSize = normalizedColorSwatchSize * ratio; 11589 return highlightedColors.map(({ 11590 slug, 11591 color 11592 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11593 style: { 11594 height: scaledSwatchSize, 11595 width: scaledSwatchSize, 11596 background: color, 11597 borderRadius: scaledSwatchSize / 2 11598 }, 11599 animate: { 11600 scale: 1, 11601 opacity: 1 11602 }, 11603 initial: { 11604 scale: 0.1, 11605 opacity: 0 11606 }, 11607 transition: { 11608 delay: index === 1 ? 0.2 : 0.1 11609 } 11610 }, `$slug}-$index}`)); 11611 } 11612 11613 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-iframe.js 11614 /** 11615 * WordPress dependencies 11616 */ 11617 11618 11619 11620 11621 11622 /** 11623 * Internal dependencies 11624 */ 11625 11626 11627 11628 11629 const { 11630 useGlobalStyle: preview_iframe_useGlobalStyle, 11631 useGlobalStylesOutput: preview_iframe_useGlobalStylesOutput 11632 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11633 const normalizedWidth = 248; 11634 const normalizedHeight = 152; 11635 11636 // Throttle options for useThrottle. Must be defined outside of the component, 11637 // so that the object reference is the same on each render. 11638 const THROTTLE_OPTIONS = { 11639 leading: true, 11640 trailing: true 11641 }; 11642 function PreviewIframe({ 11643 children, 11644 label, 11645 isFocused, 11646 withHoverView 11647 }) { 11648 const [backgroundColor = 'white'] = preview_iframe_useGlobalStyle('color.background'); 11649 const [gradientValue] = preview_iframe_useGlobalStyle('color.gradient'); 11650 const [styles] = preview_iframe_useGlobalStylesOutput(); 11651 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 11652 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 11653 const [containerResizeListener, { 11654 width 11655 }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 11656 const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_namespaceObject.useState)(width); 11657 const [ratioState, setRatioState] = (0,external_wp_element_namespaceObject.useState)(); 11658 const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(setThrottledWidthState, 250, THROTTLE_OPTIONS); 11659 11660 // Must use useLayoutEffect to avoid a flash of the iframe at the wrong 11661 // size before the width is set. 11662 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11663 if (width) { 11664 setThrottledWidth(width); 11665 } 11666 }, [width, setThrottledWidth]); 11667 11668 // Must use useLayoutEffect to avoid a flash of the iframe at the wrong 11669 // size before the width is set. 11670 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11671 const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; 11672 const ratioDiff = newRatio - (ratioState || 0); 11673 11674 // Only update the ratio state if the difference is big enough 11675 // or if the ratio state is not yet set. This is to avoid an 11676 // endless loop of updates at particular viewport heights when the 11677 // presence of a scrollbar causes the width to change slightly. 11678 const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; 11679 if (isRatioDiffBigEnough || !ratioState) { 11680 setRatioState(newRatio); 11681 } 11682 }, [throttledWidth, ratioState]); 11683 11684 // Set a fallbackRatio to use before the throttled ratio has been set. 11685 const fallbackRatio = width ? width / normalizedWidth : 1; 11686 /* 11687 * Use the throttled ratio if it has been calculated, otherwise 11688 * use the fallback ratio. The throttled ratio is used to avoid 11689 * an endless loop of updates at particular viewport heights. 11690 * See: https://github.com/WordPress/gutenberg/issues/55112 11691 */ 11692 const ratio = ratioState ? ratioState : fallbackRatio; 11693 11694 /* 11695 * Reset leaked styles from WP common.css and remove main content layout padding and border. 11696 * Add pointer cursor to the body to indicate the iframe is interactive, 11697 * similar to Typography variation previews. 11698 */ 11699 const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { 11700 if (styles) { 11701 return [...styles, { 11702 css: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;cursor: pointer;}', 11703 isGlobalStyles: true 11704 }]; 11705 } 11706 return styles; 11707 }, [styles]); 11708 const isReady = !!width; 11709 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11710 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11711 style: { 11712 position: 'relative' 11713 }, 11714 children: containerResizeListener 11715 }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 11716 className: "edit-site-global-styles-preview__iframe", 11717 style: { 11718 height: normalizedHeight * ratio 11719 }, 11720 onMouseEnter: () => setIsHovered(true), 11721 onMouseLeave: () => setIsHovered(false), 11722 tabIndex: -1, 11723 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 11724 styles: editorStyles 11725 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11726 style: { 11727 height: normalizedHeight * ratio, 11728 width: '100%', 11729 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, 11730 cursor: withHoverView ? 'pointer' : undefined 11731 }, 11732 initial: "start", 11733 animate: (isHovered || isFocused) && !disableMotion && label ? 'hover' : 'start', 11734 children: [].concat(children) // This makes sure children is always an array. 11735 .map((child, key) => child({ 11736 ratio, 11737 key 11738 })) 11739 })] 11740 })] 11741 }); 11742 } 11743 11744 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js 11745 /** 11746 * WordPress dependencies 11747 */ 11748 11749 11750 11751 /** 11752 * Internal dependencies 11753 */ 11754 11755 11756 11757 11758 11759 11760 11761 const { 11762 useGlobalStyle: preview_styles_useGlobalStyle 11763 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11764 const firstFrameVariants = { 11765 start: { 11766 scale: 1, 11767 opacity: 1 11768 }, 11769 hover: { 11770 scale: 0, 11771 opacity: 0 11772 } 11773 }; 11774 const midFrameVariants = { 11775 hover: { 11776 opacity: 1 11777 }, 11778 start: { 11779 opacity: 0.5 11780 } 11781 }; 11782 const secondFrameVariants = { 11783 hover: { 11784 scale: 1, 11785 opacity: 1 11786 }, 11787 start: { 11788 scale: 0, 11789 opacity: 0 11790 } 11791 }; 11792 const PreviewStyles = ({ 11793 label, 11794 isFocused, 11795 withHoverView, 11796 variation 11797 }) => { 11798 const [fontWeight] = preview_styles_useGlobalStyle('typography.fontWeight'); 11799 const [fontFamily = 'serif'] = preview_styles_useGlobalStyle('typography.fontFamily'); 11800 const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle('elements.h1.typography.fontFamily'); 11801 const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle('elements.h1.typography.fontWeight'); 11802 const [textColor = 'black'] = preview_styles_useGlobalStyle('color.text'); 11803 const [headingColor = textColor] = preview_styles_useGlobalStyle('elements.h1.color.text'); 11804 const { 11805 paletteColors 11806 } = useStylesPreviewColors(); 11807 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewIframe, { 11808 label: label, 11809 isFocused: isFocused, 11810 withHoverView: withHoverView, 11811 children: [({ 11812 ratio, 11813 key 11814 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11815 variants: firstFrameVariants, 11816 style: { 11817 height: '100%', 11818 overflow: 'hidden' 11819 }, 11820 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 11821 spacing: 10 * ratio, 11822 justify: "center", 11823 style: { 11824 height: '100%', 11825 overflow: 'hidden' 11826 }, 11827 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { 11828 fontSize: 65 * ratio, 11829 variation: variation 11830 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 11831 spacing: 4 * ratio, 11832 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HighlightedColors, { 11833 normalizedColorSwatchSize: 32, 11834 ratio: ratio 11835 }) 11836 })] 11837 }) 11838 }, key), ({ 11839 key 11840 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11841 variants: withHoverView && midFrameVariants, 11842 style: { 11843 height: '100%', 11844 width: '100%', 11845 position: 'absolute', 11846 top: 0, 11847 overflow: 'hidden', 11848 filter: 'blur(60px)', 11849 opacity: 0.1 11850 }, 11851 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 11852 spacing: 0, 11853 justify: "flex-start", 11854 style: { 11855 height: '100%', 11856 overflow: 'hidden' 11857 }, 11858 children: paletteColors.slice(0, 4).map(({ 11859 color 11860 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11861 style: { 11862 height: '100%', 11863 background: color, 11864 flexGrow: 1 11865 } 11866 }, index)) 11867 }) 11868 }, key), ({ 11869 ratio, 11870 key 11871 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11872 variants: secondFrameVariants, 11873 style: { 11874 height: '100%', 11875 width: '100%', 11876 overflow: 'hidden', 11877 position: 'absolute', 11878 top: 0 11879 }, 11880 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 11881 spacing: 3 * ratio, 11882 justify: "center", 11883 style: { 11884 height: '100%', 11885 overflow: 'hidden', 11886 padding: 10 * ratio, 11887 boxSizing: 'border-box' 11888 }, 11889 children: label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11890 style: { 11891 fontSize: 40 * ratio, 11892 fontFamily: headingFontFamily, 11893 color: headingColor, 11894 fontWeight: headingFontWeight, 11895 lineHeight: '1em', 11896 textAlign: 'center' 11897 }, 11898 children: label 11899 }) 11900 }) 11901 }, key)] 11902 }); 11903 }; 11904 /* harmony default export */ const preview_styles = (PreviewStyles); 11905 11906 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js 11907 /** 11908 * WordPress dependencies 11909 */ 11910 11911 11912 11913 11914 11915 11916 11917 /** 11918 * Internal dependencies 11919 */ 11920 11921 11922 11923 11924 11925 11926 11927 11928 const { 11929 useGlobalStyle: screen_root_useGlobalStyle 11930 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11931 function ScreenRoot() { 11932 const [customCSS] = screen_root_useGlobalStyle('css'); 11933 const { 11934 hasVariations, 11935 canEditCSS 11936 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11937 const { 11938 getEntityRecord, 11939 __experimentalGetCurrentGlobalStylesId, 11940 __experimentalGetCurrentThemeGlobalStylesVariations 11941 } = select(external_wp_coreData_namespaceObject.store); 11942 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 11943 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 11944 return { 11945 hasVariations: !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length, 11946 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 11947 }; 11948 }, []); 11949 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { 11950 size: "small", 11951 className: "edit-site-global-styles-screen-root", 11952 isRounded: false, 11953 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { 11954 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 11955 spacing: 4, 11956 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 11957 className: "edit-site-global-styles-screen-root__active-style-tile", 11958 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, { 11959 className: "edit-site-global-styles-screen-root__active-style-tile-preview", 11960 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, {}) 11961 }) 11962 }), hasVariations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 11963 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11964 path: "/variations", 11965 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse styles'), 11966 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 11967 justify: "space-between", 11968 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 11969 children: (0,external_wp_i18n_namespaceObject.__)('Browse styles') 11970 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 11971 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 11972 })] 11973 }) 11974 }) 11975 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu, {})] 11976 }) 11977 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 11978 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 11979 as: "p", 11980 paddingTop: 2 11981 /* 11982 * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border). 11983 * This is an ad hoc override for this instance and the Addtional CSS option below. Other options for matching the 11984 * the nav button inset should be looked at before reusing further. 11985 */, 11986 paddingX: "13px", 11987 marginBottom: 4, 11988 children: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.') 11989 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 11990 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11991 path: "/blocks", 11992 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks styles'), 11993 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 11994 justify: "space-between", 11995 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 11996 children: (0,external_wp_i18n_namespaceObject.__)('Blocks') 11997 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 11998 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 11999 })] 12000 }) 12001 }) 12002 })] 12003 }), canEditCSS && !!customCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12004 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 12005 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12006 as: "p", 12007 paddingTop: 2, 12008 paddingX: "13px", 12009 marginBottom: 4, 12010 children: (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.') 12011 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12012 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12013 path: "/css", 12014 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Additional CSS'), 12015 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12016 justify: "space-between", 12017 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12018 children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') 12019 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 12020 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 12021 })] 12022 }) 12023 }) 12024 })] 12025 })] 12026 })] 12027 }); 12028 } 12029 /* harmony default export */ const screen_root = (ScreenRoot); 12030 12031 ;// CONCATENATED MODULE: external ["wp","a11y"] 12032 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 12033 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js 12034 /** 12035 * WordPress dependencies 12036 */ 12037 12038 12039 12040 12041 12042 /** 12043 * Internal dependencies 12044 */ 12045 12046 12047 12048 const { 12049 useGlobalStyle: variations_panel_useGlobalStyle 12050 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12051 12052 // Only core block styles (source === block) or block styles with a matching 12053 // theme.json style variation will be configurable via Global Styles. 12054 function getFilteredBlockStyles(blockStyles, variations) { 12055 return blockStyles?.filter(style => style.source === 'block' || variations.includes(style.name)); 12056 } 12057 function useBlockVariations(name) { 12058 const blockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { 12059 const { 12060 getBlockStyles 12061 } = select(external_wp_blocks_namespaceObject.store); 12062 return getBlockStyles(name); 12063 }, [name]); 12064 const [variations] = variations_panel_useGlobalStyle('variations', name); 12065 const variationNames = Object.keys(variations !== null && variations !== void 0 ? variations : {}); 12066 return getFilteredBlockStyles(blockStyles, variationNames); 12067 } 12068 function VariationsPanel({ 12069 name 12070 }) { 12071 const coreBlockStyles = useBlockVariations(name); 12072 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12073 isBordered: true, 12074 isSeparated: true, 12075 children: coreBlockStyles.map((style, index) => { 12076 if (style?.isDefault) { 12077 return null; 12078 } 12079 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12080 path: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(style.name), 12081 "aria-label": style.label, 12082 children: style.label 12083 }, index); 12084 }) 12085 }); 12086 } 12087 12088 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js 12089 /** 12090 * WordPress dependencies 12091 */ 12092 12093 12094 12095 12096 12097 function ScreenHeader({ 12098 title, 12099 description, 12100 onBack 12101 }) { 12102 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12103 spacing: 0, 12104 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 12105 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12106 marginBottom: 0, 12107 paddingX: 4, 12108 paddingY: 3, 12109 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12110 spacing: 2, 12111 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { 12112 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 12113 size: "small", 12114 label: (0,external_wp_i18n_namespaceObject.__)('Back'), 12115 onClick: onBack 12116 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12117 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 12118 className: "edit-site-global-styles-header", 12119 level: 2, 12120 size: 13, 12121 children: title 12122 }) 12123 })] 12124 }) 12125 }) 12126 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12127 className: "edit-site-global-styles-header__description", 12128 children: description 12129 })] 12130 }); 12131 } 12132 /* harmony default export */ const header = (ScreenHeader); 12133 12134 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js 12135 /** 12136 * WordPress dependencies 12137 */ 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 /** 12148 * Internal dependencies 12149 */ 12150 12151 12152 12153 12154 12155 12156 12157 const { 12158 useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel, 12159 useHasTypographyPanel: screen_block_list_useHasTypographyPanel, 12160 useHasBorderPanel, 12161 useGlobalSetting: screen_block_list_useGlobalSetting, 12162 useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement, 12163 useHasColorPanel: screen_block_list_useHasColorPanel 12164 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12165 function useSortedBlockTypes() { 12166 const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); 12167 // Ensure core blocks are prioritized in the returned results, 12168 // because third party blocks can be registered earlier than 12169 // the core blocks (usually by using the `init` action), 12170 // thus affecting the display order. 12171 // We don't sort reusable blocks as they are handled differently. 12172 const groupByType = (blocks, block) => { 12173 const { 12174 core, 12175 noncore 12176 } = blocks; 12177 const type = block.name.startsWith('core/') ? core : noncore; 12178 type.push(block); 12179 return blocks; 12180 }; 12181 const { 12182 core: coreItems, 12183 noncore: nonCoreItems 12184 } = blockItems.reduce(groupByType, { 12185 core: [], 12186 noncore: [] 12187 }); 12188 return [...coreItems, ...nonCoreItems]; 12189 } 12190 function useBlockHasGlobalStyles(blockName) { 12191 const [rawSettings] = screen_block_list_useGlobalSetting('', blockName); 12192 const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName); 12193 const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings); 12194 const hasColorPanel = screen_block_list_useHasColorPanel(settings); 12195 const hasBorderPanel = useHasBorderPanel(settings); 12196 const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings); 12197 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 12198 const hasVariationsPanel = !!useBlockVariations(blockName)?.length; 12199 const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel; 12200 return hasGlobalStyles; 12201 } 12202 function BlockMenuItem({ 12203 block 12204 }) { 12205 const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); 12206 if (!hasBlockMenuItem) { 12207 return null; 12208 } 12209 const navigationButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 12210 // translators: %s: is the name of a block e.g., 'Image' or 'Table'. 12211 (0,external_wp_i18n_namespaceObject.__)('%s block styles'), block.title); 12212 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12213 path: '/blocks/' + encodeURIComponent(block.name), 12214 "aria-label": navigationButtonLabel, 12215 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12216 justify: "flex-start", 12217 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 12218 icon: block.icon 12219 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12220 children: block.title 12221 })] 12222 }) 12223 }); 12224 } 12225 function BlockList({ 12226 filterValue 12227 }) { 12228 const sortedBlockTypes = useSortedBlockTypes(); 12229 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 12230 const { 12231 isMatchingSearchTerm 12232 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 12233 const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue)); 12234 const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); 12235 12236 // Announce search results on change 12237 (0,external_wp_element_namespaceObject.useEffect)(() => { 12238 if (!filterValue) { 12239 return; 12240 } 12241 // We extract the results from the wrapper div's `ref` because 12242 // filtered items can contain items that will eventually not 12243 // render and there is no reliable way to detect when a child 12244 // will return `null`. 12245 // TODO: We should find a better way of handling this as it's 12246 // fragile and depends on the number of rendered elements of `BlockMenuItem`, 12247 // which is now one. 12248 // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116 12249 const count = blockTypesListRef.current.childElementCount; 12250 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ 12251 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); 12252 debouncedSpeak(resultsFoundMessage, count); 12253 }, [filterValue, debouncedSpeak]); 12254 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12255 ref: blockTypesListRef, 12256 className: "edit-site-block-types-item-list", 12257 children: filteredBlockTypes.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMenuItem, { 12258 block: block 12259 }, 'menu-itemblock-' + block.name)) 12260 }); 12261 } 12262 const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList); 12263 function ScreenBlockList() { 12264 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); 12265 const deferredFilterValue = (0,external_wp_element_namespaceObject.useDeferredValue)(filterValue); 12266 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12267 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 12268 title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), 12269 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.') 12270 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 12271 __nextHasNoMarginBottom: true, 12272 className: "edit-site-block-types-search", 12273 onChange: setFilterValue, 12274 value: filterValue, 12275 label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks'), 12276 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') 12277 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { 12278 filterValue: deferredFilterValue 12279 })] 12280 }); 12281 } 12282 /* harmony default export */ const screen_block_list = (ScreenBlockList); 12283 12284 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js 12285 /** 12286 * WordPress dependencies 12287 */ 12288 12289 12290 12291 12292 12293 /** 12294 * Internal dependencies 12295 */ 12296 12297 12298 const BlockPreviewPanel = ({ 12299 name, 12300 variation = '' 12301 }) => { 12302 var _blockExample$viewpor; 12303 const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example; 12304 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 12305 if (!blockExample) { 12306 return null; 12307 } 12308 let example = blockExample; 12309 if (variation) { 12310 example = { 12311 ...example, 12312 attributes: { 12313 ...example.attributes, 12314 className: getVariationClassName(variation) 12315 } 12316 }; 12317 } 12318 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example); 12319 }, [name, blockExample, variation]); 12320 const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : 500; 12321 // Same as height of InserterPreviewPanel. 12322 const previewHeight = 144; 12323 const sidebarWidth = 235; 12324 const scale = sidebarWidth / viewportWidth; 12325 const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; 12326 if (!blockExample) { 12327 return null; 12328 } 12329 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12330 marginX: 4, 12331 marginBottom: 4, 12332 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12333 className: "edit-site-global-styles__block-preview-panel", 12334 style: { 12335 maxHeight: previewHeight, 12336 boxSizing: 'initial' 12337 }, 12338 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 12339 blocks: blocks, 12340 viewportWidth: viewportWidth, 12341 minHeight: previewHeight, 12342 additionalStyles: 12343 //We want this CSS to be in sync with the one in InserterPreviewPanel. 12344 [{ 12345 css: ` 12346 body{ 12347 padding: 24px; 12348 min-height:$Math.round(minHeight)}px; 12349 display:flex; 12350 align-items:center; 12351 } 12352 .is-root-container { width: 100%; } 12353 ` 12354 }] 12355 }) 12356 }) 12357 }); 12358 }; 12359 /* harmony default export */ const block_preview_panel = (BlockPreviewPanel); 12360 12361 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js 12362 /** 12363 * WordPress dependencies 12364 */ 12365 12366 12367 function Subtitle({ 12368 children, 12369 level 12370 }) { 12371 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 12372 className: "edit-site-global-styles-subtitle", 12373 level: level !== null && level !== void 0 ? level : 2, 12374 children: children 12375 }); 12376 } 12377 /* harmony default export */ const subtitle = (Subtitle); 12378 12379 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js 12380 /** 12381 * WordPress dependencies 12382 */ 12383 12384 12385 12386 12387 12388 12389 12390 12391 /** 12392 * Internal dependencies 12393 */ 12394 12395 12396 12397 12398 12399 12400 // Initial control values. 12401 12402 12403 12404 const BACKGROUND_BLOCK_DEFAULT_VALUES = { 12405 backgroundSize: 'cover', 12406 backgroundPosition: '50% 50%' // used only when backgroundSize is 'contain'. 12407 }; 12408 function applyFallbackStyle(border) { 12409 if (!border) { 12410 return border; 12411 } 12412 const hasColorOrWidth = border.color || border.width; 12413 if (!border.style && hasColorOrWidth) { 12414 return { 12415 ...border, 12416 style: 'solid' 12417 }; 12418 } 12419 if (border.style && !hasColorOrWidth) { 12420 return undefined; 12421 } 12422 return border; 12423 } 12424 function applyAllFallbackStyles(border) { 12425 if (!border) { 12426 return border; 12427 } 12428 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) { 12429 return { 12430 top: applyFallbackStyle(border.top), 12431 right: applyFallbackStyle(border.right), 12432 bottom: applyFallbackStyle(border.bottom), 12433 left: applyFallbackStyle(border.left) 12434 }; 12435 } 12436 return applyFallbackStyle(border); 12437 } 12438 const { 12439 useHasDimensionsPanel: screen_block_useHasDimensionsPanel, 12440 useHasTypographyPanel: screen_block_useHasTypographyPanel, 12441 useHasBorderPanel: screen_block_useHasBorderPanel, 12442 useGlobalSetting: screen_block_useGlobalSetting, 12443 useSettingsForBlockElement: screen_block_useSettingsForBlockElement, 12444 useHasColorPanel: screen_block_useHasColorPanel, 12445 useHasFiltersPanel, 12446 useHasImageSettingsPanel, 12447 useGlobalStyle: screen_block_useGlobalStyle, 12448 useHasBackgroundPanel: screen_block_useHasBackgroundPanel, 12449 BackgroundPanel: StylesBackgroundPanel, 12450 BorderPanel: StylesBorderPanel, 12451 ColorPanel: StylesColorPanel, 12452 TypographyPanel: StylesTypographyPanel, 12453 DimensionsPanel: StylesDimensionsPanel, 12454 FiltersPanel: StylesFiltersPanel, 12455 ImageSettingsPanel, 12456 AdvancedPanel: StylesAdvancedPanel 12457 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12458 function ScreenBlock({ 12459 name, 12460 variation 12461 }) { 12462 let prefixParts = []; 12463 if (variation) { 12464 prefixParts = ['variations', variation].concat(prefixParts); 12465 } 12466 const prefix = prefixParts.join('.'); 12467 const [style] = screen_block_useGlobalStyle(prefix, name, 'user', { 12468 shouldDecodeEncode: false 12469 }); 12470 const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, 'all', { 12471 shouldDecodeEncode: false 12472 }); 12473 const [userSettings] = screen_block_useGlobalSetting('', name, 'user'); 12474 const [rawSettings, setSettings] = screen_block_useGlobalSetting('', name); 12475 const settings = screen_block_useSettingsForBlockElement(rawSettings, name); 12476 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 12477 12478 // Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied. 12479 if (settings?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) { 12480 settings.spacing.blockGap = false; 12481 } 12482 12483 // Only allow `aspectRatio` support if the block is not the grouping block. 12484 // The grouping block allows the user to use Group, Row and Stack variations, 12485 // and it is highly likely that the user will not want to set an aspect ratio 12486 // for all three at once. Until there is the ability to set a different aspect 12487 // ratio for each variation, we disable the aspect ratio controls for the 12488 // grouping block in global styles. 12489 if (settings?.dimensions?.aspectRatio && name === 'core/group') { 12490 settings.dimensions.aspectRatio = false; 12491 } 12492 const blockVariations = useBlockVariations(name); 12493 const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings); 12494 const hasTypographyPanel = screen_block_useHasTypographyPanel(settings); 12495 const hasColorPanel = screen_block_useHasColorPanel(settings); 12496 const hasBorderPanel = screen_block_useHasBorderPanel(settings); 12497 const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings); 12498 const hasFiltersPanel = useHasFiltersPanel(settings); 12499 const hasImageSettingsPanel = useHasImageSettingsPanel(name, userSettings, settings); 12500 const hasVariationsPanel = !!blockVariations?.length && !variation; 12501 const { 12502 canEditCSS 12503 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12504 const { 12505 getEntityRecord, 12506 __experimentalGetCurrentGlobalStylesId 12507 } = select(external_wp_coreData_namespaceObject.store); 12508 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 12509 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 12510 return { 12511 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 12512 }; 12513 }, []); 12514 const currentBlockStyle = variation ? blockVariations.find(s => s.name === variation) : null; 12515 12516 // These intermediary objects are needed because the "layout" property is stored 12517 // in settings rather than styles. 12518 const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 12519 return { 12520 ...inheritedStyle, 12521 layout: settings.layout 12522 }; 12523 }, [inheritedStyle, settings.layout]); 12524 const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 12525 return { 12526 ...style, 12527 layout: userSettings.layout 12528 }; 12529 }, [style, userSettings.layout]); 12530 const onChangeDimensions = newStyle => { 12531 const updatedStyle = { 12532 ...newStyle 12533 }; 12534 delete updatedStyle.layout; 12535 setStyle(updatedStyle); 12536 if (newStyle.layout !== userSettings.layout) { 12537 setSettings({ 12538 ...userSettings, 12539 layout: newStyle.layout 12540 }); 12541 } 12542 }; 12543 const onChangeLightbox = newSetting => { 12544 // If the newSetting is undefined, this means that the user has deselected 12545 // (reset) the lightbox setting. 12546 if (newSetting === undefined) { 12547 setSettings({ 12548 ...rawSettings, 12549 lightbox: undefined 12550 }); 12551 12552 // Otherwise, we simply set the lightbox setting to the new value but 12553 // taking care of not overriding the other lightbox settings. 12554 } else { 12555 setSettings({ 12556 ...rawSettings, 12557 lightbox: { 12558 ...rawSettings.lightbox, 12559 ...newSetting 12560 } 12561 }); 12562 } 12563 }; 12564 const onChangeBorders = newStyle => { 12565 if (!newStyle?.border) { 12566 setStyle(newStyle); 12567 return; 12568 } 12569 12570 // As Global Styles can't conditionally generate styles based on if 12571 // other style properties have been set, we need to force split 12572 // border definitions for user set global border styles. Border 12573 // radius is derived from the same property i.e. `border.radius` if 12574 // it is a string that is used. The longhand border radii styles are 12575 // only generated if that property is an object. 12576 // 12577 // For borders (color, style, and width) those are all properties on 12578 // the `border` style property. This means if the theme.json defined 12579 // split borders and the user condenses them into a flat border or 12580 // vice-versa we'd get both sets of styles which would conflict. 12581 const { 12582 radius, 12583 ...newBorder 12584 } = newStyle.border; 12585 const border = applyAllFallbackStyles(newBorder); 12586 const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? { 12587 top: border, 12588 right: border, 12589 bottom: border, 12590 left: border 12591 } : { 12592 color: null, 12593 style: null, 12594 width: null, 12595 ...border 12596 }; 12597 setStyle({ 12598 ...newStyle, 12599 border: { 12600 ...updatedBorder, 12601 radius 12602 } 12603 }); 12604 }; 12605 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12606 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 12607 title: variation ? currentBlockStyle?.label : blockType.title 12608 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel, { 12609 name: name, 12610 variation: variation 12611 }), hasVariationsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12612 className: "edit-site-global-styles-screen-variations", 12613 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12614 spacing: 3, 12615 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 12616 children: (0,external_wp_i18n_namespaceObject.__)('Style Variations') 12617 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { 12618 name: name 12619 })] 12620 }) 12621 }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesColorPanel, { 12622 inheritedValue: inheritedStyle, 12623 value: style, 12624 onChange: setStyle, 12625 settings: settings 12626 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBackgroundPanel, { 12627 inheritedValue: inheritedStyle, 12628 value: style, 12629 onChange: setStyle, 12630 settings: settings, 12631 defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES 12632 }), hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesTypographyPanel, { 12633 inheritedValue: inheritedStyle, 12634 value: style, 12635 onChange: setStyle, 12636 settings: settings 12637 }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesDimensionsPanel, { 12638 inheritedValue: inheritedStyleWithLayout, 12639 value: styleWithLayout, 12640 onChange: onChangeDimensions, 12641 settings: settings, 12642 includeLayoutControls: true 12643 }), hasBorderPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBorderPanel, { 12644 inheritedValue: inheritedStyle, 12645 value: style, 12646 onChange: onChangeBorders, 12647 settings: settings 12648 }), hasFiltersPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesFiltersPanel, { 12649 inheritedValue: inheritedStyleWithLayout, 12650 value: styleWithLayout, 12651 onChange: setStyle, 12652 settings: settings, 12653 includeLayoutControls: true 12654 }), hasImageSettingsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageSettingsPanel, { 12655 onChange: onChangeLightbox, 12656 value: userSettings, 12657 inheritedValue: settings 12658 }), canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 12659 title: (0,external_wp_i18n_namespaceObject.__)('Advanced'), 12660 initialOpen: false, 12661 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12662 children: (0,external_wp_i18n_namespaceObject.sprintf)( 12663 // translators: %s: is the name of a block e.g., 'Image' or 'Table'. 12664 (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) 12665 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesAdvancedPanel, { 12666 value: style, 12667 onChange: setStyle, 12668 inheritedValue: inheritedStyle 12669 })] 12670 })] 12671 }); 12672 } 12673 /* harmony default export */ const screen_block = (ScreenBlock); 12674 12675 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js 12676 /** 12677 * WordPress dependencies 12678 */ 12679 12680 12681 12682 12683 /** 12684 * Internal dependencies 12685 */ 12686 12687 12688 12689 12690 12691 const { 12692 useGlobalStyle: typography_elements_useGlobalStyle 12693 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12694 function ElementItem({ 12695 parentMenu, 12696 element, 12697 label 12698 }) { 12699 var _ref; 12700 const prefix = element === 'text' || !element ? '' : `elements.$element}.`; 12701 const extraStyles = element === 'link' ? { 12702 textDecoration: 'underline' 12703 } : {}; 12704 const [fontFamily] = typography_elements_useGlobalStyle(prefix + 'typography.fontFamily'); 12705 const [fontStyle] = typography_elements_useGlobalStyle(prefix + 'typography.fontStyle'); 12706 const [fontWeight] = typography_elements_useGlobalStyle(prefix + 'typography.fontWeight'); 12707 const [backgroundColor] = typography_elements_useGlobalStyle(prefix + 'color.background'); 12708 const [fallbackBackgroundColor] = typography_elements_useGlobalStyle('color.background'); 12709 const [gradientValue] = typography_elements_useGlobalStyle(prefix + 'color.gradient'); 12710 const [color] = typography_elements_useGlobalStyle(prefix + 'color.text'); 12711 const navigationButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 12712 // translators: %s: is a subset of Typography, e.g., 'text' or 'links'. 12713 (0,external_wp_i18n_namespaceObject.__)('Typography %s styles'), label); 12714 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12715 path: parentMenu + '/typography/' + element, 12716 "aria-label": navigationButtonLabel, 12717 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12718 justify: "flex-start", 12719 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12720 className: "edit-site-global-styles-screen-typography__indicator", 12721 style: { 12722 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 12723 background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, 12724 color, 12725 fontStyle, 12726 fontWeight, 12727 ...extraStyles 12728 }, 12729 children: (0,external_wp_i18n_namespaceObject.__)('Aa') 12730 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12731 children: label 12732 })] 12733 }) 12734 }); 12735 } 12736 function TypographyElements() { 12737 const parentMenu = ''; 12738 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12739 spacing: 3, 12740 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 12741 level: 3, 12742 children: (0,external_wp_i18n_namespaceObject.__)('Elements') 12743 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12744 isBordered: true, 12745 isSeparated: true, 12746 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12747 parentMenu: parentMenu, 12748 element: "text", 12749 label: (0,external_wp_i18n_namespaceObject.__)('Text') 12750 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12751 parentMenu: parentMenu, 12752 element: "link", 12753 label: (0,external_wp_i18n_namespaceObject.__)('Links') 12754 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12755 parentMenu: parentMenu, 12756 element: "heading", 12757 label: (0,external_wp_i18n_namespaceObject.__)('Headings') 12758 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12759 parentMenu: parentMenu, 12760 element: "caption", 12761 label: (0,external_wp_i18n_namespaceObject.__)('Captions') 12762 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12763 parentMenu: parentMenu, 12764 element: "button", 12765 label: (0,external_wp_i18n_namespaceObject.__)('Buttons') 12766 })] 12767 })] 12768 }); 12769 } 12770 /* harmony default export */ const typography_elements = (TypographyElements); 12771 12772 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js 12773 /** 12774 * WordPress dependencies 12775 */ 12776 12777 12778 /** 12779 * Internal dependencies 12780 */ 12781 12782 12783 12784 const StylesPreviewTypography = ({ 12785 variation, 12786 isFocused, 12787 withHoverView 12788 }) => { 12789 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewIframe, { 12790 label: variation.title, 12791 isFocused: isFocused, 12792 withHoverView: withHoverView, 12793 children: ({ 12794 ratio, 12795 key 12796 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 12797 spacing: 10 * ratio, 12798 justify: "center", 12799 style: { 12800 height: '100%', 12801 overflow: 'hidden' 12802 }, 12803 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { 12804 variation: variation, 12805 fontSize: 85 * ratio 12806 }) 12807 }, key) 12808 }); 12809 }; 12810 /* harmony default export */ const preview_typography = (StylesPreviewTypography); 12811 12812 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js 12813 /* wp:polyfill */ 12814 /** 12815 * WordPress dependencies 12816 */ 12817 12818 12819 12820 12821 12822 12823 12824 /** 12825 * Internal dependencies 12826 */ 12827 12828 const { 12829 GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, 12830 areGlobalStyleConfigsEqual 12831 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12832 const { 12833 mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs 12834 } = unlock(external_wp_editor_namespaceObject.privateApis); 12835 12836 /** 12837 * Removes all instances of properties from an object. 12838 * 12839 * @param {Object} object The object to remove the properties from. 12840 * @param {string[]} properties The properties to remove. 12841 * @return {Object} The modified object. 12842 */ 12843 function removePropertiesFromObject(object, properties) { 12844 if (!properties?.length) { 12845 return object; 12846 } 12847 if (typeof object !== 'object' || !object || !Object.keys(object).length) { 12848 return object; 12849 } 12850 for (const key in object) { 12851 if (properties.includes(key)) { 12852 delete object[key]; 12853 } else if (typeof object[key] === 'object') { 12854 removePropertiesFromObject(object[key], properties); 12855 } 12856 } 12857 return object; 12858 } 12859 12860 /** 12861 * Checks whether a style variation is empty. 12862 * 12863 * @param {Object} variation A style variation object. 12864 * @param {string} variation.title The title of the variation. 12865 * @param {Object} variation.settings The settings of the variation. 12866 * @param {Object} variation.styles The styles of the variation. 12867 * @return {boolean} Whether the variation is empty. 12868 */ 12869 function hasThemeVariation({ 12870 title, 12871 settings, 12872 styles 12873 }) { 12874 return title === (0,external_wp_i18n_namespaceObject.__)('Default') || 12875 // Always preserve the default variation. 12876 Object.keys(settings).length > 0 || Object.keys(styles).length > 0; 12877 } 12878 12879 /** 12880 * Fetches the current theme style variations that contain only the specified properties 12881 * and merges them with the user config. 12882 * 12883 * @param {string[]} properties The properties to filter by. 12884 * @return {Object[]|*} The merged object. 12885 */ 12886 function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { 12887 const { 12888 variationsFromTheme 12889 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12890 const _variationsFromTheme = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); 12891 return { 12892 variationsFromTheme: _variationsFromTheme || [] 12893 }; 12894 }, []); 12895 const { 12896 user: userVariation 12897 } = (0,external_wp_element_namespaceObject.useContext)(use_theme_style_variations_by_property_GlobalStylesContext); 12898 const propertiesAsString = properties.toString(); 12899 return (0,external_wp_element_namespaceObject.useMemo)(() => { 12900 const clonedUserVariation = structuredClone(userVariation); 12901 12902 // Get user variation and remove the settings for the given property. 12903 const userVariationWithoutProperties = removePropertiesFromObject(clonedUserVariation, properties); 12904 userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)('Default'); 12905 const variationsWithPropertiesAndBase = variationsFromTheme.filter(variation => { 12906 return isVariationWithProperties(variation, properties); 12907 }).map(variation => { 12908 return use_theme_style_variations_by_property_mergeBaseAndUserConfigs(userVariationWithoutProperties, variation); 12909 }); 12910 const variationsByProperties = [userVariationWithoutProperties, ...variationsWithPropertiesAndBase]; 12911 12912 /* 12913 * Filter out variations with no settings or styles. 12914 */ 12915 return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; 12916 }, [propertiesAsString, userVariation, variationsFromTheme]); 12917 } 12918 12919 /** 12920 * Returns a new object, with properties specified in `properties` array., 12921 * maintain the original object tree structure. 12922 * The function is recursive, so it will perform a deep search for the given properties. 12923 * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`. 12924 * 12925 * @param {Object} object The object to filter 12926 * @param {string[]} properties The properties to filter by 12927 * @return {Object} The merged object. 12928 */ 12929 const filterObjectByProperties = (object, properties) => { 12930 if (!object || !properties?.length) { 12931 return {}; 12932 } 12933 const newObject = {}; 12934 Object.keys(object).forEach(key => { 12935 if (properties.includes(key)) { 12936 newObject[key] = object[key]; 12937 } else if (typeof object[key] === 'object') { 12938 const newFilter = filterObjectByProperties(object[key], properties); 12939 if (Object.keys(newFilter).length) { 12940 newObject[key] = newFilter; 12941 } 12942 } 12943 }); 12944 return newObject; 12945 }; 12946 12947 /** 12948 * Compares a style variation to the same variation filtered by the specified properties. 12949 * Returns true if the variation contains only the properties specified. 12950 * 12951 * @param {Object} variation The variation to compare. 12952 * @param {string[]} properties The properties to compare. 12953 * @return {boolean} Whether the variation contains only the specified properties. 12954 */ 12955 function isVariationWithProperties(variation, properties) { 12956 const variationWithProperties = filterObjectByProperties(structuredClone(variation), properties); 12957 return areGlobalStyleConfigsEqual(variationWithProperties, variation); 12958 } 12959 12960 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js 12961 /** 12962 * External dependencies 12963 */ 12964 12965 12966 /** 12967 * WordPress dependencies 12968 */ 12969 12970 12971 12972 12973 12974 12975 12976 /** 12977 * Internal dependencies 12978 */ 12979 12980 12981 12982 const { 12983 mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs 12984 } = unlock(external_wp_editor_namespaceObject.privateApis); 12985 const { 12986 GlobalStylesContext: variation_GlobalStylesContext, 12987 areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual 12988 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12989 function Variation({ 12990 variation, 12991 children, 12992 isPill, 12993 properties, 12994 showTooltip 12995 }) { 12996 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 12997 const { 12998 base, 12999 user, 13000 setUserConfig 13001 } = (0,external_wp_element_namespaceObject.useContext)(variation_GlobalStylesContext); 13002 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 13003 let merged = variation_mergeBaseAndUserConfigs(base, variation); 13004 if (properties) { 13005 merged = filterObjectByProperties(merged, properties); 13006 } 13007 return { 13008 user: variation, 13009 base, 13010 merged, 13011 setUserConfig: () => {} 13012 }; 13013 }, [variation, base, properties]); 13014 const selectVariation = () => setUserConfig(variation); 13015 const selectOnEnter = event => { 13016 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 13017 event.preventDefault(); 13018 selectVariation(); 13019 } 13020 }; 13021 const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => variation_areGlobalStyleConfigsEqual(user, variation), [user, variation]); 13022 let label = variation?.title; 13023 if (variation?.description) { 13024 label = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: variation title. %2$s variation description. */ 13025 (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), variation?.title, variation?.description); 13026 } 13027 const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13028 className: dist_clsx('edit-site-global-styles-variations_item', { 13029 'is-active': isActive 13030 }), 13031 role: "button", 13032 onClick: selectVariation, 13033 onKeyDown: selectOnEnter, 13034 tabIndex: "0", 13035 "aria-label": label, 13036 "aria-current": isActive, 13037 onFocus: () => setIsFocused(true), 13038 onBlur: () => setIsFocused(false), 13039 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13040 className: dist_clsx('edit-site-global-styles-variations_item-preview', { 13041 'is-pill': isPill 13042 }), 13043 children: children(isFocused) 13044 }) 13045 }); 13046 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, { 13047 value: context, 13048 children: showTooltip ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 13049 text: variation?.title, 13050 children: content 13051 }) : content 13052 }); 13053 } 13054 13055 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js 13056 /** 13057 * WordPress dependencies 13058 */ 13059 13060 13061 /** 13062 * Internal dependencies 13063 */ 13064 13065 13066 13067 13068 13069 13070 function TypographyVariations({ 13071 title, 13072 gap = 2 13073 }) { 13074 const propertiesToFilter = ['typography']; 13075 const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 13076 13077 // Return null if there is only one variation (the default). 13078 if (typographyVariations?.length <= 1) { 13079 return null; 13080 } 13081 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 13082 spacing: 3, 13083 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 13084 level: 3, 13085 children: title 13086 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 13087 columns: 3, 13088 gap: gap, 13089 className: "edit-site-global-styles-style-variations-container", 13090 children: typographyVariations.map((variation, index) => { 13091 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 13092 variation: variation, 13093 properties: propertiesToFilter, 13094 showTooltip: true, 13095 children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_typography, { 13096 variation: variation 13097 }) 13098 }, index); 13099 }) 13100 })] 13101 }); 13102 } 13103 13104 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js 13105 /** 13106 * WordPress dependencies 13107 */ 13108 13109 13110 13111 13112 /** 13113 * Internal dependencies 13114 */ 13115 13116 13117 13118 13119 function FontSizes() { 13120 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 13121 spacing: 2, 13122 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 13123 justify: "space-between", 13124 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 13125 level: 3, 13126 children: (0,external_wp_i18n_namespaceObject.__)('Font Sizes') 13127 }) 13128 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 13129 isBordered: true, 13130 isSeparated: true, 13131 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 13132 path: "/typography/font-sizes/", 13133 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Edit font size presets'), 13134 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 13135 direction: "row", 13136 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 13137 children: (0,external_wp_i18n_namespaceObject.__)('Font size presets') 13138 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 13139 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 13140 })] 13141 }) 13142 }) 13143 })] 13144 }); 13145 } 13146 /* harmony default export */ const font_sizes_count = (FontSizes); 13147 13148 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js 13149 /** 13150 * WordPress dependencies 13151 */ 13152 13153 13154 13155 const settings_settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 13156 xmlns: "http://www.w3.org/2000/svg", 13157 viewBox: "0 0 24 24", 13158 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 13159 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" 13160 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 13161 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" 13162 })] 13163 }); 13164 /* harmony default export */ const library_settings = (settings_settings); 13165 13166 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js 13167 /** 13168 * WordPress dependencies 13169 */ 13170 13171 const FONT_FAMILIES_URL = '/wp/v2/font-families'; 13172 const FONT_COLLECTIONS_URL = '/wp/v2/font-collections'; 13173 async function fetchInstallFontFamily(data) { 13174 const config = { 13175 path: FONT_FAMILIES_URL, 13176 method: 'POST', 13177 body: data 13178 }; 13179 const response = await external_wp_apiFetch_default()(config); 13180 return { 13181 id: response.id, 13182 ...response.font_family_settings, 13183 fontFace: [] 13184 }; 13185 } 13186 async function fetchInstallFontFace(fontFamilyId, data) { 13187 const config = { 13188 path: `$FONT_FAMILIES_URL}/$fontFamilyId}/font-faces`, 13189 method: 'POST', 13190 body: data 13191 }; 13192 const response = await external_wp_apiFetch_default()(config); 13193 return { 13194 id: response.id, 13195 ...response.font_face_settings 13196 }; 13197 } 13198 async function fetchGetFontFamilyBySlug(slug) { 13199 const config = { 13200 path: `$FONT_FAMILIES_URL}?slug=$slug}&_embed=true`, 13201 method: 'GET' 13202 }; 13203 const response = await external_wp_apiFetch_default()(config); 13204 if (!response || response.length === 0) { 13205 return null; 13206 } 13207 const fontFamilyPost = response[0]; 13208 return { 13209 id: fontFamilyPost.id, 13210 ...fontFamilyPost.font_family_settings, 13211 fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] 13212 }; 13213 } 13214 async function fetchUninstallFontFamily(fontFamilyId) { 13215 const config = { 13216 path: `$FONT_FAMILIES_URL}/$fontFamilyId}?force=true`, 13217 method: 'DELETE' 13218 }; 13219 return await external_wp_apiFetch_default()(config); 13220 } 13221 async function fetchFontCollections() { 13222 const config = { 13223 path: `$FONT_COLLECTIONS_URL}?_fields=slug,name,description`, 13224 method: 'GET' 13225 }; 13226 return await external_wp_apiFetch_default()(config); 13227 } 13228 async function fetchFontCollection(id) { 13229 const config = { 13230 path: `$FONT_COLLECTIONS_URL}/$id}`, 13231 method: 'GET' 13232 }; 13233 return await external_wp_apiFetch_default()(config); 13234 } 13235 13236 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js 13237 /** 13238 * WordPress dependencies 13239 */ 13240 13241 const ALLOWED_FILE_EXTENSIONS = ['otf', 'ttf', 'woff', 'woff2']; 13242 const FONT_WEIGHTS = { 13243 100: (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'), 13244 200: (0,external_wp_i18n_namespaceObject._x)('Extra-light', 'font weight'), 13245 300: (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'), 13246 400: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font weight'), 13247 500: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'), 13248 600: (0,external_wp_i18n_namespaceObject._x)('Semi-bold', 'font weight'), 13249 700: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'), 13250 800: (0,external_wp_i18n_namespaceObject._x)('Extra-bold', 'font weight'), 13251 900: (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight') 13252 }; 13253 const FONT_STYLES = { 13254 normal: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font style'), 13255 italic: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style') 13256 }; 13257 13258 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js 13259 /** 13260 * WordPress dependencies 13261 */ 13262 13263 13264 /** 13265 * Internal dependencies 13266 */ 13267 13268 13269 13270 13271 13272 /** 13273 * Browser dependencies 13274 */ 13275 const { 13276 File 13277 } = window; 13278 const { 13279 kebabCase 13280 } = unlock(external_wp_components_namespaceObject.privateApis); 13281 function setUIValuesNeeded(font, extraValues = {}) { 13282 if (!font.name && (font.fontFamily || font.slug)) { 13283 font.name = font.fontFamily || font.slug; 13284 } 13285 return { 13286 ...font, 13287 ...extraValues 13288 }; 13289 } 13290 function isUrlEncoded(url) { 13291 if (typeof url !== 'string') { 13292 return false; 13293 } 13294 return url !== decodeURIComponent(url); 13295 } 13296 function getFontFaceVariantName(face) { 13297 const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight; 13298 const styleName = face.fontStyle === 'normal' ? '' : FONT_STYLES[face.fontStyle] || face.fontStyle; 13299 return `$weightName} $styleName}`; 13300 } 13301 function mergeFontFaces(existing = [], incoming = []) { 13302 const map = new Map(); 13303 for (const face of existing) { 13304 map.set(`$face.fontWeight}$face.fontStyle}`, face); 13305 } 13306 for (const face of incoming) { 13307 // This will overwrite if the src already exists, keeping it unique. 13308 map.set(`$face.fontWeight}$face.fontStyle}`, face); 13309 } 13310 return Array.from(map.values()); 13311 } 13312 function mergeFontFamilies(existing = [], incoming = []) { 13313 const map = new Map(); 13314 // Add the existing array to the map. 13315 for (const font of existing) { 13316 map.set(font.slug, { 13317 ...font 13318 }); 13319 } 13320 // Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged. 13321 for (const font of incoming) { 13322 if (map.has(font.slug)) { 13323 const { 13324 fontFace: incomingFontFaces, 13325 ...restIncoming 13326 } = font; 13327 const existingFont = map.get(font.slug); 13328 // Merge the fontFaces existing with the incoming fontFaces. 13329 const mergedFontFaces = mergeFontFaces(existingFont.fontFace, incomingFontFaces); 13330 // Except for the fontFace key all the other keys are overwritten with the incoming values. 13331 map.set(font.slug, { 13332 ...restIncoming, 13333 fontFace: mergedFontFaces 13334 }); 13335 } else { 13336 map.set(font.slug, { 13337 ...font 13338 }); 13339 } 13340 } 13341 return Array.from(map.values()); 13342 } 13343 13344 /* 13345 * Loads the font face from a URL and adds it to the browser. 13346 * It also adds it to the iframe document. 13347 */ 13348 async function loadFontFaceInBrowser(fontFace, source, addTo = 'all') { 13349 let dataSource; 13350 if (typeof source === 'string') { 13351 dataSource = `url($source})`; 13352 // eslint-disable-next-line no-undef 13353 } else if (source instanceof File) { 13354 dataSource = await source.arrayBuffer(); 13355 } else { 13356 return; 13357 } 13358 const newFont = new window.FontFace(formatFontFaceName(fontFace.fontFamily), dataSource, { 13359 style: fontFace.fontStyle, 13360 weight: fontFace.fontWeight 13361 }); 13362 const loadedFace = await newFont.load(); 13363 if (addTo === 'document' || addTo === 'all') { 13364 document.fonts.add(loadedFace); 13365 } 13366 if (addTo === 'iframe' || addTo === 'all') { 13367 const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; 13368 iframeDocument.fonts.add(loadedFace); 13369 } 13370 } 13371 13372 /* 13373 * Unloads the font face and remove it from the browser. 13374 * It also removes it from the iframe document. 13375 * 13376 * Note that Font faces that were added to the set using the CSS @font-face rule 13377 * remain connected to the corresponding CSS, and cannot be deleted. 13378 * 13379 * @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete. 13380 */ 13381 function unloadFontFaceInBrowser(fontFace, removeFrom = 'all') { 13382 const unloadFontFace = fonts => { 13383 fonts.forEach(f => { 13384 if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) { 13385 fonts.delete(f); 13386 } 13387 }); 13388 }; 13389 if (removeFrom === 'document' || removeFrom === 'all') { 13390 unloadFontFace(document.fonts); 13391 } 13392 if (removeFrom === 'iframe' || removeFrom === 'all') { 13393 const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; 13394 unloadFontFace(iframeDocument.fonts); 13395 } 13396 } 13397 13398 /** 13399 * Retrieves the display source from a font face src. 13400 * 13401 * @param {string|string[]} input - The font face src. 13402 * @return {string|undefined} The display source or undefined if the input is invalid. 13403 */ 13404 function getDisplaySrcFromFontFace(input) { 13405 if (!input) { 13406 return; 13407 } 13408 let src; 13409 if (Array.isArray(input)) { 13410 src = input[0]; 13411 } else { 13412 src = input; 13413 } 13414 // It's expected theme fonts will already be loaded in the browser. 13415 if (src.startsWith('file:.')) { 13416 return; 13417 } 13418 if (!isUrlEncoded(src)) { 13419 src = encodeURI(src); 13420 } 13421 return src; 13422 } 13423 function makeFontFamilyFormData(fontFamily) { 13424 const formData = new FormData(); 13425 const { 13426 fontFace, 13427 category, 13428 ...familyWithValidParameters 13429 } = fontFamily; 13430 const fontFamilySettings = { 13431 ...familyWithValidParameters, 13432 slug: kebabCase(fontFamily.slug) 13433 }; 13434 formData.append('font_family_settings', JSON.stringify(fontFamilySettings)); 13435 return formData; 13436 } 13437 function makeFontFacesFormData(font) { 13438 if (font?.fontFace) { 13439 const fontFacesFormData = font.fontFace.map((item, faceIndex) => { 13440 const face = { 13441 ...item 13442 }; 13443 const formData = new FormData(); 13444 if (face.file) { 13445 // Normalize to an array, since face.file may be a single file or an array of files. 13446 const files = Array.isArray(face.file) ? face.file : [face.file]; 13447 const src = []; 13448 files.forEach((file, key) => { 13449 // Slugified file name because the it might contain spaces or characters treated differently on the server. 13450 const fileId = `file-$faceIndex}-$key}`; 13451 // Add the files to the formData 13452 formData.append(fileId, file, file.name); 13453 src.push(fileId); 13454 }); 13455 face.src = src.length === 1 ? src[0] : src; 13456 delete face.file; 13457 formData.append('font_face_settings', JSON.stringify(face)); 13458 } else { 13459 formData.append('font_face_settings', JSON.stringify(face)); 13460 } 13461 return formData; 13462 }); 13463 return fontFacesFormData; 13464 } 13465 } 13466 async function batchInstallFontFaces(fontFamilyId, fontFacesData) { 13467 const responses = []; 13468 13469 /* 13470 * Uses the same response format as Promise.allSettled, but executes requests in sequence to work 13471 * around a race condition that can cause an error when the fonts directory doesn't exist yet. 13472 */ 13473 for (const faceData of fontFacesData) { 13474 try { 13475 const response = await fetchInstallFontFace(fontFamilyId, faceData); 13476 responses.push({ 13477 status: 'fulfilled', 13478 value: response 13479 }); 13480 } catch (error) { 13481 responses.push({ 13482 status: 'rejected', 13483 reason: error 13484 }); 13485 } 13486 } 13487 const results = { 13488 errors: [], 13489 successes: [] 13490 }; 13491 responses.forEach((result, index) => { 13492 if (result.status === 'fulfilled') { 13493 const response = result.value; 13494 if (response.id) { 13495 results.successes.push(response); 13496 } else { 13497 results.errors.push({ 13498 data: fontFacesData[index], 13499 message: `Error: $response.message}` 13500 }); 13501 } 13502 } else { 13503 // Handle network errors or other fetch-related errors 13504 results.errors.push({ 13505 data: fontFacesData[index], 13506 message: result.reason.message 13507 }); 13508 } 13509 }); 13510 return results; 13511 } 13512 13513 /* 13514 * Downloads a font face asset from a URL to the client and returns a File object. 13515 */ 13516 async function downloadFontFaceAssets(src) { 13517 // Normalize to an array, since `src` could be a string or array. 13518 src = Array.isArray(src) ? src : [src]; 13519 const files = await Promise.all(src.map(async url => { 13520 return fetch(new Request(url)).then(response => { 13521 if (!response.ok) { 13522 throw new Error(`Error downloading font face asset from $url}. Server responded with status: $response.status}`); 13523 } 13524 return response.blob(); 13525 }).then(blob => { 13526 const filename = url.split('/').pop(); 13527 const file = new File([blob], filename, { 13528 type: blob.type 13529 }); 13530 return file; 13531 }); 13532 })); 13533 13534 // If we only have one file return it (not the array). Otherwise return all of them in the array. 13535 return files.length === 1 ? files[0] : files; 13536 } 13537 13538 /* 13539 * Determine if a given Font Face is present in a given collection. 13540 * We determine that a font face has been installed by comparing the fontWeight and fontStyle 13541 * 13542 * @param {Object} fontFace The Font Face to seek 13543 * @param {Array} collection The Collection to seek in 13544 * @returns True if the font face is found in the collection. Otherwise False. 13545 */ 13546 function checkFontFaceInstalled(fontFace, collection) { 13547 return -1 !== collection.findIndex(collectionFontFace => { 13548 return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle; 13549 }); 13550 } 13551 13552 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js 13553 /** 13554 * Toggles the activation of a given font or font variant within a list of custom fonts. 13555 * 13556 * - If only the font is provided (without face), the entire font family's activation is toggled. 13557 * - If both font and face are provided, the activation of the specific font variant is toggled. 13558 * 13559 * @param {Object} font - The font to be toggled. 13560 * @param {string} font.slug - The unique identifier for the font. 13561 * @param {Array} [font.fontFace] - The list of font variants (faces) associated with the font. 13562 * 13563 * @param {Object} [face] - The specific font variant to be toggled. 13564 * @param {string} face.fontWeight - The weight of the font variant. 13565 * @param {string} face.fontStyle - The style of the font variant. 13566 * 13567 * @param {Array} initialfonts - The initial list of custom fonts. 13568 * 13569 * @return {Array} - The updated list of custom fonts with the font/font variant toggled. 13570 * 13571 * @example 13572 * const customFonts = [ 13573 * { slug: 'roboto', fontFace: [{ fontWeight: '400', fontStyle: 'normal' }] } 13574 * ]; 13575 * 13576 * toggleFont({ slug: 'roboto' }, null, customFonts); 13577 * // This will remove 'roboto' from customFonts 13578 * 13579 * toggleFont({ slug: 'roboto' }, { fontWeight: '400', fontStyle: 'normal' }, customFonts); 13580 * // This will remove the specified face from 'roboto' in customFonts 13581 * 13582 * toggleFont({ slug: 'roboto' }, { fontWeight: '500', fontStyle: 'normal' }, customFonts); 13583 * // This will add the specified face to 'roboto' in customFonts 13584 */ 13585 function toggleFont(font, face, initialfonts) { 13586 // Helper to check if a font is activated based on its slug 13587 const isFontActivated = f => f.slug === font.slug; 13588 13589 // Helper to get the activated font from a list of fonts 13590 const getActivatedFont = fonts => fonts.find(isFontActivated); 13591 13592 // Toggle the activation status of an entire font family 13593 const toggleEntireFontFamily = activatedFont => { 13594 if (!activatedFont) { 13595 // If the font is not active, activate the entire font family 13596 return [...initialfonts, font]; 13597 } 13598 // If the font is already active, deactivate the entire font family 13599 return initialfonts.filter(f => !isFontActivated(f)); 13600 }; 13601 13602 // Toggle the activation status of a specific font variant 13603 const toggleFontVariant = activatedFont => { 13604 const isFaceActivated = f => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle; 13605 if (!activatedFont) { 13606 // If the font family is not active, activate the font family with the font variant 13607 return [...initialfonts, { 13608 ...font, 13609 fontFace: [face] 13610 }]; 13611 } 13612 let newFontFaces = activatedFont.fontFace || []; 13613 if (newFontFaces.find(isFaceActivated)) { 13614 // If the font variant is active, deactivate it 13615 newFontFaces = newFontFaces.filter(f => !isFaceActivated(f)); 13616 } else { 13617 // If the font variant is not active, activate it 13618 newFontFaces = [...newFontFaces, face]; 13619 } 13620 13621 // If there are no more font faces, deactivate the font family 13622 if (newFontFaces.length === 0) { 13623 return initialfonts.filter(f => !isFontActivated(f)); 13624 } 13625 13626 // Return updated fonts list with toggled font variant 13627 return initialfonts.map(f => isFontActivated(f) ? { 13628 ...f, 13629 fontFace: newFontFaces 13630 } : f); 13631 }; 13632 const activatedFont = getActivatedFont(initialfonts); 13633 if (!face) { 13634 return toggleEntireFontFamily(activatedFont); 13635 } 13636 return toggleFontVariant(activatedFont); 13637 } 13638 13639 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js 13640 /** 13641 * WordPress dependencies 13642 */ 13643 13644 13645 13646 13647 13648 13649 /** 13650 * Internal dependencies 13651 */ 13652 13653 13654 const { 13655 useGlobalSetting: context_useGlobalSetting 13656 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13657 13658 13659 13660 13661 const FontLibraryContext = (0,external_wp_element_namespaceObject.createContext)({}); 13662 function FontLibraryProvider({ 13663 children 13664 }) { 13665 const { 13666 saveEntityRecord 13667 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 13668 const { 13669 globalStylesId 13670 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13671 const { 13672 __experimentalGetCurrentGlobalStylesId 13673 } = select(external_wp_coreData_namespaceObject.store); 13674 return { 13675 globalStylesId: __experimentalGetCurrentGlobalStylesId() 13676 }; 13677 }); 13678 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); 13679 const [isInstalling, setIsInstalling] = (0,external_wp_element_namespaceObject.useState)(false); 13680 const [refreshKey, setRefreshKey] = (0,external_wp_element_namespaceObject.useState)(0); 13681 const refreshLibrary = () => { 13682 setRefreshKey(Date.now()); 13683 }; 13684 const { 13685 records: libraryPosts = [], 13686 isResolving: isResolvingLibrary 13687 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'wp_font_family', { 13688 refreshKey, 13689 _embed: true 13690 }); 13691 const libraryFonts = (libraryPosts || []).map(fontFamilyPost => { 13692 return { 13693 id: fontFamilyPost.id, 13694 ...fontFamilyPost.font_family_settings, 13695 fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] 13696 }; 13697 }) || []; 13698 13699 // Global Styles (settings) font families 13700 const [fontFamilies, setFontFamilies] = context_useGlobalSetting('typography.fontFamilies'); 13701 13702 /* 13703 * Save the font families to the database. 13704 * This function is called when the user activates or deactivates a font family. 13705 * It only updates the global styles post content in the database for new font families. 13706 * This avoids saving other styles/settings changed by the user using other parts of the editor. 13707 * 13708 * It uses the font families from the param to avoid using the font families from an outdated state. 13709 * 13710 * @param {Array} fonts - The font families that will be saved to the database. 13711 */ 13712 const saveFontFamilies = async fonts => { 13713 // Gets the global styles database post content. 13714 const updatedGlobalStyles = globalStyles.record; 13715 13716 // Updates the database version of global styles with the edited font families in the client. 13717 setNestedValue(updatedGlobalStyles, ['settings', 'typography', 'fontFamilies'], fonts); 13718 13719 // Saves a new version of the global styles in the database. 13720 await saveEntityRecord('root', 'globalStyles', updatedGlobalStyles); 13721 }; 13722 13723 // Library Fonts 13724 const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_namespaceObject.useState)(false); 13725 const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_namespaceObject.useState)(null); 13726 13727 // Themes Fonts are the fonts defined in the global styles (database persisted theme.json data). 13728 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { 13729 source: 'theme' 13730 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13731 const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => setUIValuesNeeded(f, { 13732 source: 'custom' 13733 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13734 const baseCustomFonts = libraryFonts ? libraryFonts.map(f => setUIValuesNeeded(f, { 13735 source: 'custom' 13736 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13737 (0,external_wp_element_namespaceObject.useEffect)(() => { 13738 if (!modalTabOpen) { 13739 setLibraryFontSelected(null); 13740 } 13741 }, [modalTabOpen]); 13742 const handleSetLibraryFontSelected = font => { 13743 // If font is null, reset the selected font 13744 if (!font) { 13745 setLibraryFontSelected(null); 13746 return; 13747 } 13748 const fonts = font.source === 'theme' ? themeFonts : baseCustomFonts; 13749 13750 // Tries to find the font in the installed fonts 13751 const fontSelected = fonts.find(f => f.slug === font.slug); 13752 // If the font is not found (it is only defined in custom styles), use the font from custom styles 13753 setLibraryFontSelected({ 13754 ...(fontSelected || font), 13755 source: font.source 13756 }); 13757 }; 13758 13759 // Demo 13760 const [loadedFontUrls] = (0,external_wp_element_namespaceObject.useState)(new Set()); 13761 const getAvailableFontsOutline = availableFontFamilies => { 13762 const outline = availableFontFamilies.reduce((acc, font) => { 13763 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 13764 13765 acc[font.slug] = availableFontFaces; 13766 return acc; 13767 }, {}); 13768 return outline; 13769 }; 13770 const getActivatedFontsOutline = source => { 13771 switch (source) { 13772 case 'theme': 13773 return getAvailableFontsOutline(themeFonts); 13774 case 'custom': 13775 default: 13776 return getAvailableFontsOutline(customFonts); 13777 } 13778 }; 13779 const isFontActivated = (slug, style, weight, source) => { 13780 if (!style && !weight) { 13781 return !!getActivatedFontsOutline(source)[slug]; 13782 } 13783 return !!getActivatedFontsOutline(source)[slug]?.includes(style + weight); 13784 }; 13785 const getFontFacesActivated = (slug, source) => { 13786 return getActivatedFontsOutline(source)[slug] || []; 13787 }; 13788 async function installFonts(fontFamiliesToInstall) { 13789 setIsInstalling(true); 13790 try { 13791 const fontFamiliesToActivate = []; 13792 let installationErrors = []; 13793 for (const fontFamilyToInstall of fontFamiliesToInstall) { 13794 let isANewFontFamily = false; 13795 13796 // Get the font family if it already exists. 13797 let installedFontFamily = await fetchGetFontFamilyBySlug(fontFamilyToInstall.slug); 13798 13799 // Otherwise create it. 13800 if (!installedFontFamily) { 13801 isANewFontFamily = true; 13802 // Prepare font family form data to install. 13803 installedFontFamily = await fetchInstallFontFamily(makeFontFamilyFormData(fontFamilyToInstall)); 13804 } 13805 13806 // Collect font faces that have already been installed (to be activated later) 13807 const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter(fontFaceToInstall => checkFontFaceInstalled(fontFaceToInstall, fontFamilyToInstall.fontFace)) : []; 13808 13809 // Filter out Font Faces that have already been installed (so that they are not re-installed) 13810 if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) { 13811 fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter(fontFaceToInstall => !checkFontFaceInstalled(fontFaceToInstall, installedFontFamily.fontFace)); 13812 } 13813 13814 // Install the fonts (upload the font files to the server and create the post in the database). 13815 let successfullyInstalledFontFaces = []; 13816 let unsuccessfullyInstalledFontFaces = []; 13817 if (fontFamilyToInstall?.fontFace?.length > 0) { 13818 const response = await batchInstallFontFaces(installedFontFamily.id, makeFontFacesFormData(fontFamilyToInstall)); 13819 successfullyInstalledFontFaces = response?.successes; 13820 unsuccessfullyInstalledFontFaces = response?.errors; 13821 } 13822 13823 // Use the successfully installed font faces 13824 // As well as any font faces that were already installed (those will be activated) 13825 if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) { 13826 // Use font data from REST API not from client to ensure 13827 // correct font information is used. 13828 installedFontFamily.fontFace = [...successfullyInstalledFontFaces]; 13829 fontFamiliesToActivate.push(installedFontFamily); 13830 } 13831 13832 // If it's a system font but was installed successfully, activate it. 13833 if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) { 13834 fontFamiliesToActivate.push(installedFontFamily); 13835 } 13836 13837 // If the font family is new and is not a system font, delete it to avoid having font families without font faces. 13838 if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) { 13839 await fetchUninstallFontFamily(installedFontFamily.id); 13840 } 13841 installationErrors = installationErrors.concat(unsuccessfullyInstalledFontFaces); 13842 } 13843 installationErrors = installationErrors.reduce((unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], []); 13844 if (fontFamiliesToActivate.length > 0) { 13845 // Activate the font family (add the font family to the global styles). 13846 const activeFonts = activateCustomFontFamilies(fontFamiliesToActivate); 13847 // Save the global styles to the database. 13848 await saveFontFamilies(activeFonts); 13849 refreshLibrary(); 13850 } 13851 if (installationErrors.length > 0) { 13852 const installError = new Error((0,external_wp_i18n_namespaceObject.__)('There was an error installing fonts.')); 13853 installError.installationErrors = installationErrors; 13854 throw installError; 13855 } 13856 } finally { 13857 setIsInstalling(false); 13858 } 13859 } 13860 async function uninstallFontFamily(fontFamilyToUninstall) { 13861 try { 13862 // Uninstall the font family. 13863 // (Removes the font files from the server and the posts from the database). 13864 const uninstalledFontFamily = await fetchUninstallFontFamily(fontFamilyToUninstall.id); 13865 13866 // Deactivate the font family if delete request is successful 13867 // (Removes the font family from the global styles). 13868 if (uninstalledFontFamily.deleted) { 13869 const activeFonts = deactivateFontFamily(fontFamilyToUninstall); 13870 // Save the global styles to the database. 13871 await saveFontFamilies(activeFonts); 13872 } 13873 13874 // Refresh the library (the library font families from database). 13875 refreshLibrary(); 13876 return uninstalledFontFamily; 13877 } catch (error) { 13878 // eslint-disable-next-line no-console 13879 console.error(`There was an error uninstalling the font family:`, error); 13880 throw error; 13881 } 13882 } 13883 const deactivateFontFamily = font => { 13884 var _fontFamilies$font$so; 13885 // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts 13886 // We want to save as active all the theme fonts at the beginning 13887 const initialCustomFonts = (_fontFamilies$font$so = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so !== void 0 ? _fontFamilies$font$so : []; 13888 const newCustomFonts = initialCustomFonts.filter(f => f.slug !== font.slug); 13889 const activeFonts = { 13890 ...fontFamilies, 13891 [font.source]: newCustomFonts 13892 }; 13893 setFontFamilies(activeFonts); 13894 if (font.fontFace) { 13895 font.fontFace.forEach(face => { 13896 unloadFontFaceInBrowser(face, 'all'); 13897 }); 13898 } 13899 return activeFonts; 13900 }; 13901 const activateCustomFontFamilies = fontsToAdd => { 13902 const fontsToActivate = cleanFontsForSave(fontsToAdd); 13903 const activeFonts = { 13904 ...fontFamilies, 13905 // Merge the existing custom fonts with the new fonts. 13906 custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate) 13907 }; 13908 13909 // Activate the fonts by set the new custom fonts array. 13910 setFontFamilies(activeFonts); 13911 loadFontsInBrowser(fontsToActivate); 13912 return activeFonts; 13913 }; 13914 13915 // Removes the id from the families and faces to avoid saving that to global styles post content. 13916 const cleanFontsForSave = fonts => { 13917 return fonts.map(({ 13918 id: _familyDbId, 13919 fontFace, 13920 ...font 13921 }) => ({ 13922 ...font, 13923 ...(fontFace && fontFace.length > 0 ? { 13924 fontFace: fontFace.map(({ 13925 id: _faceDbId, 13926 ...face 13927 }) => face) 13928 } : {}) 13929 })); 13930 }; 13931 const loadFontsInBrowser = fonts => { 13932 // Add custom fonts to the browser. 13933 fonts.forEach(font => { 13934 if (font.fontFace) { 13935 font.fontFace.forEach(face => { 13936 // Load font faces just in the iframe because they already are in the document. 13937 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face.src), 'all'); 13938 }); 13939 } 13940 }); 13941 }; 13942 const toggleActivateFont = (font, face) => { 13943 var _fontFamilies$font$so2; 13944 // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts 13945 // We want to save as active all the theme fonts at the beginning 13946 const initialFonts = (_fontFamilies$font$so2 = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so2 !== void 0 ? _fontFamilies$font$so2 : []; 13947 // Toggles the received font family or font face 13948 const newFonts = toggleFont(font, face, initialFonts); 13949 // Updates the font families activated in global settings: 13950 setFontFamilies({ 13951 ...fontFamilies, 13952 [font.source]: newFonts 13953 }); 13954 const isFaceActivated = isFontActivated(font.slug, face?.fontStyle, face?.fontWeight, font.source); 13955 if (isFaceActivated) { 13956 unloadFontFaceInBrowser(face, 'all'); 13957 } else { 13958 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); 13959 } 13960 }; 13961 const loadFontFaceAsset = async fontFace => { 13962 // If the font doesn't have a src, don't load it. 13963 if (!fontFace.src) { 13964 return; 13965 } 13966 // Get the src of the font. 13967 const src = getDisplaySrcFromFontFace(fontFace.src); 13968 // If the font is already loaded, don't load it again. 13969 if (!src || loadedFontUrls.has(src)) { 13970 return; 13971 } 13972 // Load the font in the browser. 13973 loadFontFaceInBrowser(fontFace, src, 'document'); 13974 // Add the font to the loaded fonts list. 13975 loadedFontUrls.add(src); 13976 }; 13977 13978 // Font Collections 13979 const [collections, setFontCollections] = (0,external_wp_element_namespaceObject.useState)([]); 13980 const getFontCollections = async () => { 13981 const response = await fetchFontCollections(); 13982 setFontCollections(response); 13983 }; 13984 const getFontCollection = async slug => { 13985 try { 13986 const hasData = !!collections.find(collection => collection.slug === slug)?.font_families; 13987 if (hasData) { 13988 return; 13989 } 13990 const response = await fetchFontCollection(slug); 13991 const updatedCollections = collections.map(collection => collection.slug === slug ? { 13992 ...collection, 13993 ...response 13994 } : collection); 13995 setFontCollections(updatedCollections); 13996 } catch (e) { 13997 // eslint-disable-next-line no-console 13998 console.error(e); 13999 throw e; 14000 } 14001 }; 14002 (0,external_wp_element_namespaceObject.useEffect)(() => { 14003 getFontCollections(); 14004 }, []); 14005 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontLibraryContext.Provider, { 14006 value: { 14007 libraryFontSelected, 14008 handleSetLibraryFontSelected, 14009 fontFamilies, 14010 baseCustomFonts, 14011 isFontActivated, 14012 getFontFacesActivated, 14013 loadFontFaceAsset, 14014 installFonts, 14015 uninstallFontFamily, 14016 toggleActivateFont, 14017 getAvailableFontsOutline, 14018 modalTabOpen, 14019 setModalTabOpen, 14020 refreshLibrary, 14021 saveFontFamilies, 14022 isResolvingLibrary, 14023 isInstalling, 14024 collections, 14025 getFontCollection 14026 }, 14027 children: children 14028 }); 14029 } 14030 /* harmony default export */ const context = (FontLibraryProvider); 14031 14032 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js 14033 /** 14034 * WordPress dependencies 14035 */ 14036 14037 14038 14039 /** 14040 * Internal dependencies 14041 */ 14042 14043 14044 14045 function getPreviewUrl(fontFace) { 14046 if (fontFace.preview) { 14047 return fontFace.preview; 14048 } 14049 if (fontFace.src) { 14050 return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src; 14051 } 14052 } 14053 function getDisplayFontFace(font) { 14054 // if this IS a font face return it 14055 if (font.fontStyle || font.fontWeight) { 14056 return font; 14057 } 14058 // if this is a font family with a collection of font faces 14059 // return the first one that is normal and 400 OR just the first one 14060 if (font.fontFace && font.fontFace.length) { 14061 return font.fontFace.find(face => face.fontStyle === 'normal' && face.fontWeight === '400') || font.fontFace[0]; 14062 } 14063 // This must be a font family with no font faces 14064 // return a fake font face 14065 return { 14066 fontStyle: 'normal', 14067 fontWeight: '400', 14068 fontFamily: font.fontFamily, 14069 fake: true 14070 }; 14071 } 14072 function FontDemo({ 14073 font, 14074 text 14075 }) { 14076 const ref = (0,external_wp_element_namespaceObject.useRef)(null); 14077 const fontFace = getDisplayFontFace(font); 14078 const style = getFamilyPreviewStyle(font); 14079 text = text || font.name; 14080 const customPreviewUrl = font.preview; 14081 const [isIntersecting, setIsIntersecting] = (0,external_wp_element_namespaceObject.useState)(false); 14082 const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 14083 const { 14084 loadFontFaceAsset 14085 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14086 const previewUrl = customPreviewUrl !== null && customPreviewUrl !== void 0 ? customPreviewUrl : getPreviewUrl(fontFace); 14087 const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i); 14088 const faceStyles = getFacePreviewStyle(fontFace); 14089 const textDemoStyle = { 14090 fontSize: '18px', 14091 lineHeight: 1, 14092 opacity: isAssetLoaded ? '1' : '0', 14093 ...style, 14094 ...faceStyles 14095 }; 14096 (0,external_wp_element_namespaceObject.useEffect)(() => { 14097 const observer = new window.IntersectionObserver(([entry]) => { 14098 setIsIntersecting(entry.isIntersecting); 14099 }, {}); 14100 observer.observe(ref.current); 14101 return () => observer.disconnect(); 14102 }, [ref]); 14103 (0,external_wp_element_namespaceObject.useEffect)(() => { 14104 const loadAsset = async () => { 14105 if (isIntersecting) { 14106 if (!isPreviewImage && fontFace.src) { 14107 await loadFontFaceAsset(fontFace); 14108 } 14109 setIsAssetLoaded(true); 14110 } 14111 }; 14112 loadAsset(); 14113 }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]); 14114 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14115 ref: ref, 14116 children: isPreviewImage ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 14117 src: previewUrl, 14118 loading: "lazy", 14119 alt: text, 14120 className: "font-library-modal__font-variant_demo-image" 14121 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14122 style: textDemoStyle, 14123 className: "font-library-modal__font-variant_demo-text", 14124 children: text 14125 }) 14126 }); 14127 } 14128 /* harmony default export */ const font_demo = (FontDemo); 14129 14130 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js 14131 /** 14132 * WordPress dependencies 14133 */ 14134 14135 14136 14137 /** 14138 * Internal dependencies 14139 */ 14140 14141 14142 14143 14144 function FontCard({ 14145 font, 14146 onClick, 14147 variantsText, 14148 navigatorPath 14149 }) { 14150 const variantsCount = font.fontFace?.length || 1; 14151 const style = { 14152 cursor: !!onClick ? 'pointer' : 'default' 14153 }; 14154 const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 14155 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14156 __next40pxDefaultSize: true, 14157 onClick: () => { 14158 onClick(); 14159 if (navigatorPath) { 14160 navigator.goTo(navigatorPath); 14161 } 14162 }, 14163 style: style, 14164 className: "font-library-modal__font-card", 14165 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14166 justify: "space-between", 14167 wrap: false, 14168 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14169 font: font 14170 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14171 justify: "flex-end", 14172 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 14173 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14174 className: "font-library-modal__font-card__count", 14175 children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of font variants. */ 14176 (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) 14177 }) 14178 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 14179 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 14180 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 14181 }) 14182 })] 14183 })] 14184 }) 14185 }); 14186 } 14187 /* harmony default export */ const font_card = (FontCard); 14188 14189 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js 14190 /** 14191 * WordPress dependencies 14192 */ 14193 14194 14195 14196 /** 14197 * Internal dependencies 14198 */ 14199 14200 14201 14202 14203 14204 14205 const { 14206 kebabCase: library_font_variant_kebabCase 14207 } = unlock(external_wp_components_namespaceObject.privateApis); 14208 function LibraryFontVariant({ 14209 face, 14210 font 14211 }) { 14212 const { 14213 isFontActivated, 14214 toggleActivateFont 14215 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14216 const isInstalled = font?.fontFace?.length > 0 ? isFontActivated(font.slug, face.fontStyle, face.fontWeight, font.source) : isFontActivated(font.slug, null, null, font.source); 14217 const handleToggleActivation = () => { 14218 if (font?.fontFace?.length > 0) { 14219 toggleActivateFont(font, face); 14220 return; 14221 } 14222 toggleActivateFont(font); 14223 }; 14224 const displayName = font.name + ' ' + getFontFaceVariantName(face); 14225 const checkboxId = library_font_variant_kebabCase(`$font.slug}-$getFontFaceVariantName(face)}`); 14226 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14227 className: "font-library-modal__font-card", 14228 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14229 justify: "flex-start", 14230 align: "center", 14231 gap: "1rem", 14232 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14233 checked: isInstalled, 14234 onChange: handleToggleActivation, 14235 __nextHasNoMarginBottom: true, 14236 id: checkboxId 14237 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 14238 htmlFor: checkboxId, 14239 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14240 font: face, 14241 text: displayName, 14242 onClick: handleToggleActivation 14243 }) 14244 })] 14245 }) 14246 }); 14247 } 14248 /* harmony default export */ const library_font_variant = (LibraryFontVariant); 14249 14250 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js 14251 function getNumericFontWeight(value) { 14252 switch (value) { 14253 case 'normal': 14254 return 400; 14255 case 'bold': 14256 return 700; 14257 case 'bolder': 14258 return 500; 14259 case 'lighter': 14260 return 300; 14261 default: 14262 return parseInt(value, 10); 14263 } 14264 } 14265 function sortFontFaces(faces) { 14266 return faces.sort((a, b) => { 14267 // Ensure 'normal' fontStyle is always first 14268 if (a.fontStyle === 'normal' && b.fontStyle !== 'normal') { 14269 return -1; 14270 } 14271 if (b.fontStyle === 'normal' && a.fontStyle !== 'normal') { 14272 return 1; 14273 } 14274 14275 // If both fontStyles are the same, sort by fontWeight 14276 if (a.fontStyle === b.fontStyle) { 14277 return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight); 14278 } 14279 14280 // Sort other fontStyles alphabetically 14281 return a.fontStyle.localeCompare(b.fontStyle); 14282 }); 14283 } 14284 14285 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js 14286 /** 14287 * WordPress dependencies 14288 */ 14289 14290 14291 14292 14293 14294 14295 14296 14297 /** 14298 * Internal dependencies 14299 */ 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 const { 14310 useGlobalSetting: installed_fonts_useGlobalSetting 14311 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 14312 function InstalledFonts() { 14313 var _libraryFontSelected$; 14314 const { 14315 baseCustomFonts, 14316 libraryFontSelected, 14317 handleSetLibraryFontSelected, 14318 refreshLibrary, 14319 uninstallFontFamily, 14320 isResolvingLibrary, 14321 isInstalling, 14322 saveFontFamilies, 14323 getFontFacesActivated 14324 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14325 const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies'); 14326 const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_namespaceObject.useState)(false); 14327 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 14328 const [baseFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies', undefined, 'base'); 14329 const globalStylesId = (0,external_wp_data_namespaceObject.useSelect)(select => { 14330 const { 14331 __experimentalGetCurrentGlobalStylesId 14332 } = select(external_wp_coreData_namespaceObject.store); 14333 return __experimentalGetCurrentGlobalStylesId(); 14334 }); 14335 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); 14336 const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies; 14337 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { 14338 source: 'theme' 14339 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 14340 const themeFontsSlugs = new Set(themeFonts.map(f => f.slug)); 14341 const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => setUIValuesNeeded(f, { 14342 source: 'theme' 14343 })).sort((a, b) => a.name.localeCompare(b.name))) : []; 14344 const customFontFamilyId = libraryFontSelected?.source === 'custom' && libraryFontSelected?.id; 14345 const canUserDelete = (0,external_wp_data_namespaceObject.useSelect)(select => { 14346 const { 14347 canUser 14348 } = select(external_wp_coreData_namespaceObject.store); 14349 return customFontFamilyId && canUser('delete', { 14350 kind: 'postType', 14351 name: 'wp_font_family', 14352 id: customFontFamilyId 14353 }); 14354 }, [customFontFamilyId]); 14355 const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== 'theme' && canUserDelete; 14356 const handleUninstallClick = () => { 14357 setIsConfirmDeleteOpen(true); 14358 }; 14359 const handleUpdate = async () => { 14360 setNotice(null); 14361 try { 14362 await saveFontFamilies(fontFamilies); 14363 setNotice({ 14364 type: 'success', 14365 message: (0,external_wp_i18n_namespaceObject.__)('Font family updated successfully.') 14366 }); 14367 } catch (error) { 14368 setNotice({ 14369 type: 'error', 14370 message: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message */ 14371 (0,external_wp_i18n_namespaceObject.__)('There was an error updating the font family. %s'), error.message) 14372 }); 14373 } 14374 }; 14375 const getFontFacesToDisplay = font => { 14376 if (!font) { 14377 return []; 14378 } 14379 if (!font.fontFace || !font.fontFace.length) { 14380 return [{ 14381 fontFamily: font.fontFamily, 14382 fontStyle: 'normal', 14383 fontWeight: '400' 14384 }]; 14385 } 14386 return sortFontFaces(font.fontFace); 14387 }; 14388 const getFontCardVariantsText = font => { 14389 const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1; 14390 const variantsActive = getFontFacesActivated(font.slug, font.source).length; 14391 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Active font variants, 2: Total font variants. */ 14392 (0,external_wp_i18n_namespaceObject.__)('%1$s/%2$s variants active'), variantsActive, variantsInstalled); 14393 }; 14394 (0,external_wp_element_namespaceObject.useEffect)(() => { 14395 handleSetLibraryFontSelected(libraryFontSelected); 14396 refreshLibrary(); 14397 }, []); 14398 14399 // Get activated fonts count. 14400 const activeFontsCount = libraryFontSelected ? getFontFacesActivated(libraryFontSelected.slug, libraryFontSelected.source).length : 0; 14401 const selectedFontsCount = (_libraryFontSelected$ = libraryFontSelected?.fontFace?.length) !== null && _libraryFontSelected$ !== void 0 ? _libraryFontSelected$ : libraryFontSelected?.fontFamily ? 1 : 0; 14402 14403 // Check if any fonts are selected. 14404 const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount; 14405 14406 // Check if all fonts are selected. 14407 const isSelectAllChecked = activeFontsCount === selectedFontsCount; 14408 14409 // Toggle select all fonts. 14410 const toggleSelectAll = () => { 14411 var _fontFamilies$library; 14412 const initialFonts = (_fontFamilies$library = fontFamilies?.[libraryFontSelected.source]?.filter(f => f.slug !== libraryFontSelected.slug)) !== null && _fontFamilies$library !== void 0 ? _fontFamilies$library : []; 14413 const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected]; 14414 setFontFamilies({ 14415 ...fontFamilies, 14416 [libraryFontSelected.source]: newFonts 14417 }); 14418 if (libraryFontSelected.fontFace) { 14419 libraryFontSelected.fontFace.forEach(face => { 14420 if (isSelectAllChecked) { 14421 unloadFontFaceInBrowser(face, 'all'); 14422 } else { 14423 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); 14424 } 14425 }); 14426 } 14427 }; 14428 const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; 14429 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 14430 className: "font-library-modal__tabpanel-layout", 14431 children: [isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14432 className: "font-library-modal__loading", 14433 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 14434 }), !isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14435 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { 14436 initialPath: libraryFontSelected ? '/fontFamily' : '/', 14437 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 14438 path: "/", 14439 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14440 spacing: "8", 14441 children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 14442 status: notice.type, 14443 onRemove: () => setNotice(null), 14444 children: notice.message 14445 }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14446 as: "p", 14447 children: (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') 14448 }), baseThemeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14449 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 14450 className: "font-library-modal__fonts-title", 14451 children: /* translators: Heading for a list of fonts provided by the theme. */ 14452 (0,external_wp_i18n_namespaceObject._x)('Theme', 'font source') 14453 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14454 role: "list", 14455 className: "font-library-modal__fonts-list", 14456 children: baseThemeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14457 className: "font-library-modal__fonts-list-item", 14458 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 14459 font: font, 14460 navigatorPath: "/fontFamily", 14461 variantsText: getFontCardVariantsText(font), 14462 onClick: () => { 14463 setNotice(null); 14464 handleSetLibraryFontSelected(font); 14465 } 14466 }) 14467 }, font.slug)) 14468 })] 14469 }), baseCustomFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14470 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 14471 className: "font-library-modal__fonts-title", 14472 children: /* translators: Heading for a list of fonts installed by the user. */ 14473 (0,external_wp_i18n_namespaceObject._x)('Custom', 'font source') 14474 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14475 role: "list", 14476 className: "font-library-modal__fonts-list", 14477 children: baseCustomFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14478 className: "font-library-modal__fonts-list-item", 14479 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 14480 font: font, 14481 navigatorPath: "/fontFamily", 14482 variantsText: getFontCardVariantsText(font), 14483 onClick: () => { 14484 setNotice(null); 14485 handleSetLibraryFontSelected(font); 14486 } 14487 }) 14488 }, font.slug)) 14489 })] 14490 })] 14491 }) 14492 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 14493 path: "/fontFamily", 14494 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConfirmDeleteDialog, { 14495 font: libraryFontSelected, 14496 isOpen: isConfirmDeleteOpen, 14497 setIsOpen: setIsConfirmDeleteOpen, 14498 setNotice: setNotice, 14499 uninstallFontFamily: uninstallFontFamily, 14500 handleSetLibraryFontSelected: handleSetLibraryFontSelected 14501 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14502 justify: "flex-start", 14503 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { 14504 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 14505 size: "small", 14506 onClick: () => { 14507 handleSetLibraryFontSelected(null); 14508 setNotice(null); 14509 }, 14510 label: (0,external_wp_i18n_namespaceObject.__)('Back') 14511 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 14512 level: 2, 14513 size: 13, 14514 className: "edit-site-global-styles-header", 14515 children: libraryFontSelected?.name 14516 })] 14517 }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14518 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14519 margin: 1 14520 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 14521 status: notice.type, 14522 onRemove: () => setNotice(null), 14523 children: notice.message 14524 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14525 margin: 1 14526 })] 14527 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14528 margin: 4 14529 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14530 children: (0,external_wp_i18n_namespaceObject.__)('Choose font variants. Keep in mind that too many variants could make your site slower.') 14531 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14532 margin: 4 14533 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14534 spacing: 0, 14535 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14536 className: "font-library-modal__select-all", 14537 label: (0,external_wp_i18n_namespaceObject.__)('Select all'), 14538 checked: isSelectAllChecked, 14539 onChange: toggleSelectAll, 14540 indeterminate: isIndeterminate, 14541 __nextHasNoMarginBottom: true 14542 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14543 margin: 8 14544 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14545 role: "list", 14546 className: "font-library-modal__fonts-list", 14547 children: getFontFacesToDisplay(libraryFontSelected).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14548 className: "font-library-modal__fonts-list-item", 14549 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(library_font_variant, { 14550 font: libraryFontSelected, 14551 face: face 14552 }, `face$i}`) 14553 }, `face$i}`)) 14554 })] 14555 })] 14556 })] 14557 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 14558 justify: "flex-end", 14559 className: "font-library-modal__footer", 14560 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, { 14561 __next40pxDefaultSize: true, 14562 isDestructive: true, 14563 variant: "tertiary", 14564 onClick: handleUninstallClick, 14565 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 14566 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14567 __next40pxDefaultSize: true, 14568 variant: "primary", 14569 onClick: handleUpdate, 14570 disabled: !fontFamiliesHasChanges, 14571 accessibleWhenDisabled: true, 14572 children: (0,external_wp_i18n_namespaceObject.__)('Update') 14573 })] 14574 })] 14575 })] 14576 }); 14577 } 14578 function ConfirmDeleteDialog({ 14579 font, 14580 isOpen, 14581 setIsOpen, 14582 setNotice, 14583 uninstallFontFamily, 14584 handleSetLibraryFontSelected 14585 }) { 14586 const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 14587 const handleConfirmUninstall = async () => { 14588 setNotice(null); 14589 setIsOpen(false); 14590 try { 14591 await uninstallFontFamily(font); 14592 navigator.goBack(); 14593 handleSetLibraryFontSelected(null); 14594 setNotice({ 14595 type: 'success', 14596 message: (0,external_wp_i18n_namespaceObject.__)('Font family uninstalled successfully.') 14597 }); 14598 } catch (error) { 14599 setNotice({ 14600 type: 'error', 14601 message: (0,external_wp_i18n_namespaceObject.__)('There was an error uninstalling the font family.') + error.message 14602 }); 14603 } 14604 }; 14605 const handleCancelUninstall = () => { 14606 setIsOpen(false); 14607 }; 14608 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 14609 isOpen: isOpen, 14610 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 14611 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 14612 onCancel: handleCancelUninstall, 14613 onConfirm: handleConfirmUninstall, 14614 size: "medium", 14615 children: font && (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the font. */ 14616 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name) 14617 }); 14618 } 14619 /* harmony default export */ const installed_fonts = (InstalledFonts); 14620 14621 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js 14622 /** 14623 * Filters a list of fonts based on the specified filters. 14624 * 14625 * This function filters a given array of fonts based on the criteria provided in the filters object. 14626 * It supports filtering by category and a search term. If the category is provided and not equal to 'all', 14627 * the function filters the fonts array to include only those fonts that belong to the specified category. 14628 * Additionally, if a search term is provided, it filters the fonts array to include only those fonts 14629 * whose name includes the search term, case-insensitively. 14630 * 14631 * @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. 14632 * @param {Object} filters Object containing the filter criteria. It should have a 'category' key and/or a 'search' key. 14633 * The 'category' key is a string representing the category to filter by. 14634 * The 'search' key is a string representing the search term to filter by. 14635 * @return {Array} Array of filtered font objects based on the provided criteria. 14636 */ 14637 function filterFonts(fonts, filters) { 14638 const { 14639 category, 14640 search 14641 } = filters; 14642 let filteredFonts = fonts || []; 14643 if (category && category !== 'all') { 14644 filteredFonts = filteredFonts.filter(font => font.categories.indexOf(category) !== -1); 14645 } 14646 if (search) { 14647 filteredFonts = filteredFonts.filter(font => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase())); 14648 } 14649 return filteredFonts; 14650 } 14651 14652 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js 14653 function getFontsOutline(fonts) { 14654 return fonts.reduce((acc, font) => ({ 14655 ...acc, 14656 [font.slug]: (font?.fontFace || []).reduce((faces, face) => ({ 14657 ...faces, 14658 [`$face.fontStyle}-$face.fontWeight}`]: true 14659 }), {}) 14660 }), {}); 14661 } 14662 function isFontFontFaceInOutline(slug, face, outline) { 14663 if (!face) { 14664 return !!outline[slug]; 14665 } 14666 return !!outline[slug]?.[`$face.fontStyle}-$face.fontWeight}`]; 14667 } 14668 14669 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js 14670 /** 14671 * WordPress dependencies 14672 */ 14673 14674 14675 14676 14677 function GoogleFontsConfirmDialog() { 14678 const handleConfirm = () => { 14679 // eslint-disable-next-line no-undef 14680 window.localStorage.setItem('wp-font-library-google-fonts-permission', 'true'); 14681 window.dispatchEvent(new Event('storage')); 14682 }; 14683 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14684 className: "font-library__google-fonts-confirm", 14685 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 14686 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 14687 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 14688 level: 2, 14689 children: (0,external_wp_i18n_namespaceObject.__)('Connect to Google Fonts') 14690 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14691 margin: 6 14692 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14693 as: "p", 14694 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.') 14695 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14696 margin: 3 14697 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14698 as: "p", 14699 children: (0,external_wp_i18n_namespaceObject.__)('You can alternatively upload files directly on the Upload tab.') 14700 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14701 margin: 6 14702 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14703 __next40pxDefaultSize: true, 14704 variant: "primary", 14705 onClick: handleConfirm, 14706 children: (0,external_wp_i18n_namespaceObject.__)('Allow access to Google Fonts') 14707 })] 14708 }) 14709 }) 14710 }); 14711 } 14712 /* harmony default export */ const google_fonts_confirm_dialog = (GoogleFontsConfirmDialog); 14713 14714 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js 14715 /** 14716 * WordPress dependencies 14717 */ 14718 14719 14720 /** 14721 * Internal dependencies 14722 */ 14723 14724 14725 14726 14727 14728 const { 14729 kebabCase: collection_font_variant_kebabCase 14730 } = unlock(external_wp_components_namespaceObject.privateApis); 14731 function CollectionFontVariant({ 14732 face, 14733 font, 14734 handleToggleVariant, 14735 selected 14736 }) { 14737 const handleToggleActivation = () => { 14738 if (font?.fontFace) { 14739 handleToggleVariant(font, face); 14740 return; 14741 } 14742 handleToggleVariant(font); 14743 }; 14744 const displayName = font.name + ' ' + getFontFaceVariantName(face); 14745 const checkboxId = collection_font_variant_kebabCase(`$font.slug}-$getFontFaceVariantName(face)}`); 14746 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14747 className: "font-library-modal__font-card", 14748 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14749 justify: "flex-start", 14750 align: "center", 14751 gap: "1rem", 14752 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14753 checked: selected, 14754 onChange: handleToggleActivation, 14755 __nextHasNoMarginBottom: true, 14756 id: checkboxId 14757 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 14758 htmlFor: checkboxId, 14759 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14760 font: face, 14761 text: displayName, 14762 onClick: handleToggleActivation 14763 }) 14764 })] 14765 }) 14766 }); 14767 } 14768 /* harmony default export */ const collection_font_variant = (CollectionFontVariant); 14769 14770 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js 14771 /** 14772 * WordPress dependencies 14773 */ 14774 14775 14776 14777 14778 14779 14780 /** 14781 * Internal dependencies 14782 */ 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 const DEFAULT_CATEGORY = { 14796 slug: 'all', 14797 name: (0,external_wp_i18n_namespaceObject._x)('All', 'font categories') 14798 }; 14799 const LOCAL_STORAGE_ITEM = 'wp-font-library-google-fonts-permission'; 14800 const MIN_WINDOW_HEIGHT = 500; 14801 function FontCollection({ 14802 slug 14803 }) { 14804 var _selectedCollection$c; 14805 const requiresPermission = slug === 'google-fonts'; 14806 const getGoogleFontsPermissionFromStorage = () => { 14807 return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === 'true'; 14808 }; 14809 const [selectedFont, setSelectedFont] = (0,external_wp_element_namespaceObject.useState)(null); 14810 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 14811 const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_namespaceObject.useState)([]); 14812 const [page, setPage] = (0,external_wp_element_namespaceObject.useState)(1); 14813 const [filters, setFilters] = (0,external_wp_element_namespaceObject.useState)({}); 14814 const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(requiresPermission && !getGoogleFontsPermissionFromStorage()); 14815 const { 14816 collections, 14817 getFontCollection, 14818 installFonts, 14819 isInstalling 14820 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14821 const selectedCollection = collections.find(collection => collection.slug === slug); 14822 (0,external_wp_element_namespaceObject.useEffect)(() => { 14823 const handleStorage = () => { 14824 setRenderConfirmDialog(requiresPermission && !getGoogleFontsPermissionFromStorage()); 14825 }; 14826 handleStorage(); 14827 window.addEventListener('storage', handleStorage); 14828 return () => window.removeEventListener('storage', handleStorage); 14829 }, [slug, requiresPermission]); 14830 const revokeAccess = () => { 14831 window.localStorage.setItem(LOCAL_STORAGE_ITEM, 'false'); 14832 window.dispatchEvent(new Event('storage')); 14833 }; 14834 (0,external_wp_element_namespaceObject.useEffect)(() => { 14835 const fetchFontCollection = async () => { 14836 try { 14837 await getFontCollection(slug); 14838 resetFilters(); 14839 } catch (e) { 14840 if (!notice) { 14841 setNotice({ 14842 type: 'error', 14843 message: e?.message 14844 }); 14845 } 14846 } 14847 }; 14848 fetchFontCollection(); 14849 }, [slug, getFontCollection, setNotice, notice]); 14850 (0,external_wp_element_namespaceObject.useEffect)(() => { 14851 setSelectedFont(null); 14852 }, [slug]); 14853 (0,external_wp_element_namespaceObject.useEffect)(() => { 14854 // If the selected fonts change, reset the selected fonts to install 14855 setFontsToInstall([]); 14856 }, [selectedFont]); 14857 const collectionFonts = (0,external_wp_element_namespaceObject.useMemo)(() => { 14858 var _selectedCollection$f; 14859 return (_selectedCollection$f = selectedCollection?.font_families) !== null && _selectedCollection$f !== void 0 ? _selectedCollection$f : []; 14860 }, [selectedCollection]); 14861 const collectionCategories = (_selectedCollection$c = selectedCollection?.categories) !== null && _selectedCollection$c !== void 0 ? _selectedCollection$c : []; 14862 const categories = [DEFAULT_CATEGORY, ...collectionCategories]; 14863 const fonts = (0,external_wp_element_namespaceObject.useMemo)(() => filterFonts(collectionFonts, filters), [collectionFonts, filters]); 14864 const isLoading = !selectedCollection?.font_families && !notice; 14865 14866 // NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px 14867 // The height of each font family item is 61px. 14868 const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT); 14869 const pageSize = Math.floor((windowHeight - 417) / 61); 14870 const totalPages = Math.ceil(fonts.length / pageSize); 14871 const itemsStart = (page - 1) * pageSize; 14872 const itemsLimit = page * pageSize; 14873 const items = fonts.slice(itemsStart, itemsLimit); 14874 const handleCategoryFilter = category => { 14875 setFilters({ 14876 ...filters, 14877 category 14878 }); 14879 setPage(1); 14880 }; 14881 const handleUpdateSearchInput = value => { 14882 setFilters({ 14883 ...filters, 14884 search: value 14885 }); 14886 setPage(1); 14887 }; 14888 const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300); 14889 const resetFilters = () => { 14890 setFilters({}); 14891 setPage(1); 14892 }; 14893 const handleToggleVariant = (font, face) => { 14894 const newFontsToInstall = toggleFont(font, face, fontsToInstall); 14895 setFontsToInstall(newFontsToInstall); 14896 }; 14897 const fontToInstallOutline = getFontsOutline(fontsToInstall); 14898 const resetFontsToInstall = () => { 14899 setFontsToInstall([]); 14900 }; 14901 const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0; 14902 14903 // Check if any fonts are selected. 14904 const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length; 14905 14906 // Check if all fonts are selected. 14907 const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length; 14908 14909 // Toggle select all fonts. 14910 const toggleSelectAll = () => { 14911 const newFonts = isSelectAllChecked ? [] : [selectedFont]; 14912 setFontsToInstall(newFonts); 14913 }; 14914 const handleInstall = async () => { 14915 setNotice(null); 14916 const fontFamily = fontsToInstall[0]; 14917 try { 14918 if (fontFamily?.fontFace) { 14919 await Promise.all(fontFamily.fontFace.map(async fontFace => { 14920 if (fontFace.src) { 14921 fontFace.file = await downloadFontFaceAssets(fontFace.src); 14922 } 14923 })); 14924 } 14925 } catch (error) { 14926 // If any of the fonts fail to download, 14927 // show an error notice and stop the request from being sent. 14928 setNotice({ 14929 type: 'error', 14930 message: (0,external_wp_i18n_namespaceObject.__)('Error installing the fonts, could not be downloaded.') 14931 }); 14932 return; 14933 } 14934 try { 14935 await installFonts([fontFamily]); 14936 setNotice({ 14937 type: 'success', 14938 message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') 14939 }); 14940 } catch (error) { 14941 setNotice({ 14942 type: 'error', 14943 message: error.message 14944 }); 14945 } 14946 resetFontsToInstall(); 14947 }; 14948 const getSortedFontFaces = fontFamily => { 14949 if (!fontFamily) { 14950 return []; 14951 } 14952 if (!fontFamily.fontFace || !fontFamily.fontFace.length) { 14953 return [{ 14954 fontFamily: fontFamily.fontFamily, 14955 fontStyle: 'normal', 14956 fontWeight: '400' 14957 }]; 14958 } 14959 return sortFontFaces(fontFamily.fontFace); 14960 }; 14961 if (renderConfirmDialog) { 14962 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog, {}); 14963 } 14964 const ActionsComponent = () => { 14965 if (slug !== 'google-fonts' || renderConfirmDialog || selectedFont) { 14966 return null; 14967 } 14968 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 14969 icon: more_vertical, 14970 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 14971 popoverProps: { 14972 position: 'bottom left' 14973 }, 14974 controls: [{ 14975 title: (0,external_wp_i18n_namespaceObject.__)('Revoke access to Google Fonts'), 14976 onClick: revokeAccess 14977 }] 14978 }); 14979 }; 14980 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 14981 className: "font-library-modal__tabpanel-layout", 14982 children: [isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14983 className: "font-library-modal__loading", 14984 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 14985 }), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14986 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { 14987 initialPath: "/", 14988 className: "font-library-modal__tabpanel-layout", 14989 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 14990 path: "/", 14991 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 14992 justify: "space-between", 14993 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14994 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 14995 level: 2, 14996 size: 13, 14997 children: selectedCollection.name 14998 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14999 children: selectedCollection.description 15000 })] 15001 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {})] 15002 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15003 margin: 4 15004 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 15005 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 15006 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 15007 className: "font-library-modal__search", 15008 value: filters.search, 15009 placeholder: (0,external_wp_i18n_namespaceObject.__)('Font name…'), 15010 label: (0,external_wp_i18n_namespaceObject.__)('Search'), 15011 onChange: debouncedUpdateSearchInput, 15012 __nextHasNoMarginBottom: true, 15013 hideLabelFromVision: false 15014 }) 15015 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 15016 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 15017 __nextHasNoMarginBottom: true, 15018 __next40pxDefaultSize: true, 15019 label: (0,external_wp_i18n_namespaceObject.__)('Category'), 15020 value: filters.category, 15021 onChange: handleCategoryFilter, 15022 children: categories && categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { 15023 value: category.slug, 15024 children: category.name 15025 }, category.slug)) 15026 }) 15027 })] 15028 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15029 margin: 4 15030 }), !!selectedCollection?.font_families?.length && !fonts.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15031 children: (0,external_wp_i18n_namespaceObject.__)('No fonts found. Try with a different search term') 15032 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 15033 className: "font-library-modal__fonts-grid__main", 15034 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 15035 role: "list", 15036 className: "font-library-modal__fonts-list", 15037 children: items.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 15038 className: "font-library-modal__fonts-list-item", 15039 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 15040 font: font.font_family_settings, 15041 navigatorPath: "/fontFamily", 15042 onClick: () => { 15043 setSelectedFont(font.font_family_settings); 15044 } 15045 }) 15046 }, font.font_family_settings.slug)) 15047 }) 15048 })] 15049 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 15050 path: "/fontFamily", 15051 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 15052 justify: "flex-start", 15053 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { 15054 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 15055 size: "small", 15056 onClick: () => { 15057 setSelectedFont(null); 15058 setNotice(null); 15059 }, 15060 label: (0,external_wp_i18n_namespaceObject.__)('Back') 15061 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 15062 level: 2, 15063 size: 13, 15064 className: "edit-site-global-styles-header", 15065 children: selectedFont?.name 15066 })] 15067 }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15068 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15069 margin: 1 15070 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 15071 status: notice.type, 15072 onRemove: () => setNotice(null), 15073 children: notice.message 15074 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15075 margin: 1 15076 })] 15077 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15078 margin: 4 15079 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15080 children: (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.') 15081 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15082 margin: 4 15083 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 15084 className: "font-library-modal__select-all", 15085 label: (0,external_wp_i18n_namespaceObject.__)('Select all'), 15086 checked: isSelectAllChecked, 15087 onChange: toggleSelectAll, 15088 indeterminate: isIndeterminate, 15089 __nextHasNoMarginBottom: true 15090 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 15091 spacing: 0, 15092 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 15093 role: "list", 15094 className: "font-library-modal__fonts-list", 15095 children: getSortedFontFaces(selectedFont).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 15096 className: "font-library-modal__fonts-list-item", 15097 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(collection_font_variant, { 15098 font: selectedFont, 15099 face: face, 15100 handleToggleVariant: handleToggleVariant, 15101 selected: isFontFontFaceInOutline(selectedFont.slug, selectedFont.fontFace ? face : null, 15102 // If the font has no fontFace, we want to check if the font is in the outline 15103 fontToInstallOutline) 15104 }) 15105 }, `face$i}`)) 15106 }) 15107 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15108 margin: 16 15109 })] 15110 })] 15111 }), selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 15112 justify: "flex-end", 15113 className: "font-library-modal__footer", 15114 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15115 __next40pxDefaultSize: true, 15116 variant: "primary", 15117 onClick: handleInstall, 15118 isBusy: isInstalling, 15119 disabled: fontsToInstall.length === 0 || isInstalling, 15120 accessibleWhenDisabled: true, 15121 children: (0,external_wp_i18n_namespaceObject.__)('Install') 15122 }) 15123 }), !selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15124 spacing: 4, 15125 justify: "center", 15126 className: "font-library-modal__footer", 15127 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15128 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 15129 size: "compact", 15130 onClick: () => setPage(page - 1), 15131 disabled: page === 1, 15132 showTooltip: true, 15133 accessibleWhenDisabled: true, 15134 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 15135 tooltipPosition: "top" 15136 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 15137 justify: "flex-start", 15138 expanded: false, 15139 spacing: 2, 15140 className: "font-library-modal__page-selection", 15141 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( 15142 // translators: %s: Total number of pages. 15143 (0,external_wp_i18n_namespaceObject._x)('Page <CurrentPageControl /> of %s', 'paging'), totalPages), { 15144 CurrentPageControl: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 15145 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), 15146 value: page, 15147 options: [...Array(totalPages)].map((e, i) => { 15148 return { 15149 label: i + 1, 15150 value: i + 1 15151 }; 15152 }), 15153 onChange: newPage => setPage(parseInt(newPage)), 15154 size: "compact", 15155 __nextHasNoMarginBottom: true 15156 }) 15157 }) 15158 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15159 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 15160 size: "compact", 15161 onClick: () => setPage(page + 1), 15162 disabled: page === totalPages, 15163 accessibleWhenDisabled: true, 15164 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, 15165 tooltipPosition: "top" 15166 })] 15167 })] 15168 })] 15169 }); 15170 } 15171 /* harmony default export */ const font_collection = (FontCollection); 15172 15173 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js 15174 var unbrotli = __webpack_require__(8572); 15175 var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli); 15176 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js 15177 var inflate = __webpack_require__(4660); 15178 var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate); 15179 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js 15180 /** 15181 * Credits: 15182 * 15183 * lib-font 15184 * https://github.com/Pomax/lib-font 15185 * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js 15186 * 15187 * The MIT License (MIT) 15188 * 15189 * Copyright (c) 2020 pomax@nihongoresources.com 15190 * 15191 * Permission is hereby granted, free of charge, to any person obtaining a copy 15192 * of this software and associated documentation files (the "Software"), to deal 15193 * in the Software without restriction, including without limitation the rights 15194 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15195 * copies of the Software, and to permit persons to whom the Software is 15196 * furnished to do so, subject to the following conditions: 15197 * 15198 * The above copyright notice and this permission notice shall be included in all 15199 * copies or substantial portions of the Software. 15200 * 15201 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15202 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15203 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15204 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15205 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15206 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 15207 * SOFTWARE. 15208 */ 15209 15210 /* eslint eslint-comments/no-unlimited-disable: 0 */ 15211 /* eslint-disable */ 15212 // import pako from 'pako'; 15213 15214 15215 15216 let fetchFunction = globalThis.fetch; 15217 // if ( ! fetchFunction ) { 15218 // let backlog = []; 15219 // fetchFunction = globalThis.fetch = ( ...args ) => 15220 // new Promise( ( resolve, reject ) => { 15221 // backlog.push( { args: args, resolve: resolve, reject: reject } ); 15222 // } ); 15223 // import( 'fs' ) 15224 // .then( ( fs ) => { 15225 // fetchFunction = globalThis.fetch = async function ( path ) { 15226 // return new Promise( ( resolve, reject ) => { 15227 // fs.readFile( path, ( err, data ) => { 15228 // if ( err ) return reject( err ); 15229 // resolve( { ok: true, arrayBuffer: () => data.buffer } ); 15230 // } ); 15231 // } ); 15232 // }; 15233 // while ( backlog.length ) { 15234 // let instruction = backlog.shift(); 15235 // fetchFunction( ...instruction.args ) 15236 // .then( ( data ) => instruction.resolve( data ) ) 15237 // .catch( ( err ) => instruction.reject( err ) ); 15238 // } 15239 // } ) 15240 // .catch( ( err ) => { 15241 // console.error( err ); 15242 // throw new Error( 15243 // `lib-font cannot run unless either the Fetch API or Node's filesystem module is available.` 15244 // ); 15245 // } ); 15246 // } 15247 class lib_font_browser_Event { 15248 constructor( type, detail = {}, msg ) { 15249 this.type = type; 15250 this.detail = detail; 15251 this.msg = msg; 15252 Object.defineProperty( this, `__mayPropagate`, { 15253 enumerable: false, 15254 writable: true, 15255 } ); 15256 this.__mayPropagate = true; 15257 } 15258 preventDefault() {} 15259 stopPropagation() { 15260 this.__mayPropagate = false; 15261 } 15262 valueOf() { 15263 return this; 15264 } 15265 toString() { 15266 return this.msg 15267 ? `[${ this.type } event]: ${ this.msg }` 15268 : `[${ this.type } event]`; 15269 } 15270 } 15271 class EventManager { 15272 constructor() { 15273 this.listeners = {}; 15274 } 15275 addEventListener( type, listener, useCapture ) { 15276 let bin = this.listeners[ type ] || []; 15277 if ( useCapture ) bin.unshift( listener ); 15278 else bin.push( listener ); 15279 this.listeners[ type ] = bin; 15280 } 15281 removeEventListener( type, listener ) { 15282 let bin = this.listeners[ type ] || []; 15283 let pos = bin.findIndex( ( e ) => e === listener ); 15284 if ( pos > -1 ) { 15285 bin.splice( pos, 1 ); 15286 this.listeners[ type ] = bin; 15287 } 15288 } 15289 dispatch( event ) { 15290 let bin = this.listeners[ event.type ]; 15291 if ( bin ) { 15292 for ( let l = 0, e = bin.length; l < e; l++ ) { 15293 if ( ! event.__mayPropagate ) break; 15294 bin[ l ]( event ); 15295 } 15296 } 15297 } 15298 } 15299 const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime(); 15300 function asText( data ) { 15301 return Array.from( data ) 15302 .map( ( v ) => String.fromCharCode( v ) ) 15303 .join( `` ); 15304 } 15305 class Parser { 15306 constructor( dict, dataview, name ) { 15307 this.name = ( name || dict.tag || `` ).trim(); 15308 this.length = dict.length; 15309 this.start = dict.offset; 15310 this.offset = 0; 15311 this.data = dataview; 15312 [ 15313 `getInt8`, 15314 `getUint8`, 15315 `getInt16`, 15316 `getUint16`, 15317 `getInt32`, 15318 `getUint32`, 15319 `getBigInt64`, 15320 `getBigUint64`, 15321 ].forEach( ( name ) => { 15322 let fn = name.replace( /get(Big)?/, '' ).toLowerCase(); 15323 let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8; 15324 Object.defineProperty( this, fn, { 15325 get: () => this.getValue( name, increment ), 15326 } ); 15327 } ); 15328 } 15329 get currentPosition() { 15330 return this.start + this.offset; 15331 } 15332 set currentPosition( position ) { 15333 this.start = position; 15334 this.offset = 0; 15335 } 15336 skip( n = 0, bits = 8 ) { 15337 this.offset += ( n * bits ) / 8; 15338 } 15339 getValue( type, increment ) { 15340 let pos = this.start + this.offset; 15341 this.offset += increment; 15342 try { 15343 return this.data[ type ]( pos ); 15344 } catch ( e ) { 15345 console.error( `parser`, type, increment, this ); 15346 console.error( `parser`, this.start, this.offset ); 15347 throw e; 15348 } 15349 } 15350 flags( n ) { 15351 if ( n === 8 || n === 16 || n === 32 || n === 64 ) { 15352 return this[ `uint${ n }` ] 15353 .toString( 2 ) 15354 .padStart( n, 0 ) 15355 .split( `` ) 15356 .map( ( v ) => v === '1' ); 15357 } 15358 console.error( 15359 `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` 15360 ); 15361 console.trace(); 15362 } 15363 get tag() { 15364 const t = this.uint32; 15365 return asText( [ 15366 ( t >> 24 ) & 255, 15367 ( t >> 16 ) & 255, 15368 ( t >> 8 ) & 255, 15369 t & 255, 15370 ] ); 15371 } 15372 get fixed() { 15373 let major = this.int16; 15374 let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 ); 15375 return major + minor / 1e3; 15376 } 15377 get legacyFixed() { 15378 let major = this.uint16; 15379 let minor = this.uint16.toString( 16 ).padStart( 4, 0 ); 15380 return parseFloat( `${ major }.${ minor }` ); 15381 } 15382 get uint24() { 15383 return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8; 15384 } 15385 get uint128() { 15386 let value = 0; 15387 for ( let i = 0; i < 5; i++ ) { 15388 let byte = this.uint8; 15389 value = value * 128 + ( byte & 127 ); 15390 if ( byte < 128 ) break; 15391 } 15392 return value; 15393 } 15394 get longdatetime() { 15395 return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) ); 15396 } 15397 get fword() { 15398 return this.int16; 15399 } 15400 get ufword() { 15401 return this.uint16; 15402 } 15403 get Offset16() { 15404 return this.uint16; 15405 } 15406 get Offset32() { 15407 return this.uint32; 15408 } 15409 get F2DOT14() { 15410 const bits = p.uint16; 15411 const integer = [ 0, 1, -2, -1 ][ bits >> 14 ]; 15412 const fraction = bits & 16383; 15413 return integer + fraction / 16384; 15414 } 15415 verifyLength() { 15416 if ( this.offset != this.length ) { 15417 console.error( 15418 `unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })` 15419 ); 15420 } 15421 } 15422 readBytes( n = 0, position = 0, bits = 8, signed = false ) { 15423 n = n || this.length; 15424 if ( n === 0 ) return []; 15425 if ( position ) this.currentPosition = position; 15426 const fn = `${ signed ? `` : `u` }int${ bits }`, 15427 slice = []; 15428 while ( n-- ) slice.push( this[ fn ] ); 15429 return slice; 15430 } 15431 } 15432 class ParsedData { 15433 constructor( parser ) { 15434 const pGetter = { enumerable: false, get: () => parser }; 15435 Object.defineProperty( this, `parser`, pGetter ); 15436 const start = parser.currentPosition; 15437 const startGetter = { enumerable: false, get: () => start }; 15438 Object.defineProperty( this, `start`, startGetter ); 15439 } 15440 load( struct ) { 15441 Object.keys( struct ).forEach( ( p ) => { 15442 let props = Object.getOwnPropertyDescriptor( struct, p ); 15443 if ( props.get ) { 15444 this[ p ] = props.get.bind( this ); 15445 } else if ( props.value !== undefined ) { 15446 this[ p ] = props.value; 15447 } 15448 } ); 15449 if ( this.parser.length ) { 15450 this.parser.verifyLength(); 15451 } 15452 } 15453 } 15454 class SimpleTable extends ParsedData { 15455 constructor( dict, dataview, name ) { 15456 const { parser: parser, start: start } = super( 15457 new Parser( dict, dataview, name ) 15458 ); 15459 const pGetter = { enumerable: false, get: () => parser }; 15460 Object.defineProperty( this, `p`, pGetter ); 15461 const startGetter = { enumerable: false, get: () => start }; 15462 Object.defineProperty( this, `tableStart`, startGetter ); 15463 } 15464 } 15465 function lazy$1( object, property, getter ) { 15466 let val; 15467 Object.defineProperty( object, property, { 15468 get: () => { 15469 if ( val ) return val; 15470 val = getter(); 15471 return val; 15472 }, 15473 enumerable: true, 15474 } ); 15475 } 15476 class SFNT extends SimpleTable { 15477 constructor( font, dataview, createTable ) { 15478 const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` ); 15479 this.version = p.uint32; 15480 this.numTables = p.uint16; 15481 this.searchRange = p.uint16; 15482 this.entrySelector = p.uint16; 15483 this.rangeShift = p.uint16; 15484 p.verifyLength(); 15485 this.directory = [ ...new Array( this.numTables ) ].map( 15486 ( _ ) => new TableRecord( p ) 15487 ); 15488 this.tables = {}; 15489 this.directory.forEach( ( entry ) => { 15490 const getter = () => 15491 createTable( 15492 this.tables, 15493 { 15494 tag: entry.tag, 15495 offset: entry.offset, 15496 length: entry.length, 15497 }, 15498 dataview 15499 ); 15500 lazy$1( this.tables, entry.tag.trim(), getter ); 15501 } ); 15502 } 15503 } 15504 class TableRecord { 15505 constructor( p ) { 15506 this.tag = p.tag; 15507 this.checksum = p.uint32; 15508 this.offset = p.uint32; 15509 this.length = p.uint32; 15510 } 15511 } 15512 const gzipDecode = (inflate_default()).inflate || undefined; 15513 let nativeGzipDecode = undefined; 15514 // if ( ! gzipDecode ) { 15515 // import( 'zlib' ).then( ( zlib ) => { 15516 // nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer ); 15517 // } ); 15518 // } 15519 class WOFF$1 extends SimpleTable { 15520 constructor( font, dataview, createTable ) { 15521 const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` ); 15522 this.signature = p.tag; 15523 this.flavor = p.uint32; 15524 this.length = p.uint32; 15525 this.numTables = p.uint16; 15526 p.uint16; 15527 this.totalSfntSize = p.uint32; 15528 this.majorVersion = p.uint16; 15529 this.minorVersion = p.uint16; 15530 this.metaOffset = p.uint32; 15531 this.metaLength = p.uint32; 15532 this.metaOrigLength = p.uint32; 15533 this.privOffset = p.uint32; 15534 this.privLength = p.uint32; 15535 p.verifyLength(); 15536 this.directory = [ ...new Array( this.numTables ) ].map( 15537 ( _ ) => new WoffTableDirectoryEntry( p ) 15538 ); 15539 buildWoffLazyLookups( this, dataview, createTable ); 15540 } 15541 } 15542 class WoffTableDirectoryEntry { 15543 constructor( p ) { 15544 this.tag = p.tag; 15545 this.offset = p.uint32; 15546 this.compLength = p.uint32; 15547 this.origLength = p.uint32; 15548 this.origChecksum = p.uint32; 15549 } 15550 } 15551 function buildWoffLazyLookups( woff, dataview, createTable ) { 15552 woff.tables = {}; 15553 woff.directory.forEach( ( entry ) => { 15554 lazy$1( woff.tables, entry.tag.trim(), () => { 15555 let offset = 0; 15556 let view = dataview; 15557 if ( entry.compLength !== entry.origLength ) { 15558 const data = dataview.buffer.slice( 15559 entry.offset, 15560 entry.offset + entry.compLength 15561 ); 15562 let unpacked; 15563 if ( gzipDecode ) { 15564 unpacked = gzipDecode( new Uint8Array( data ) ); 15565 } else if ( nativeGzipDecode ) { 15566 unpacked = nativeGzipDecode( new Uint8Array( data ) ); 15567 } else { 15568 const msg = `no brotli decoder available to decode WOFF2 font`; 15569 if ( font.onerror ) font.onerror( msg ); 15570 throw new Error( msg ); 15571 } 15572 view = new DataView( unpacked.buffer ); 15573 } else { 15574 offset = entry.offset; 15575 } 15576 return createTable( 15577 woff.tables, 15578 { tag: entry.tag, offset: offset, length: entry.origLength }, 15579 view 15580 ); 15581 } ); 15582 } ); 15583 } 15584 const brotliDecode = (unbrotli_default()); 15585 let nativeBrotliDecode = undefined; 15586 // if ( ! brotliDecode ) { 15587 // import( 'zlib' ).then( ( zlib ) => { 15588 // nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer ); 15589 // } ); 15590 // } 15591 class WOFF2$1 extends SimpleTable { 15592 constructor( font, dataview, createTable ) { 15593 const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` ); 15594 this.signature = p.tag; 15595 this.flavor = p.uint32; 15596 this.length = p.uint32; 15597 this.numTables = p.uint16; 15598 p.uint16; 15599 this.totalSfntSize = p.uint32; 15600 this.totalCompressedSize = p.uint32; 15601 this.majorVersion = p.uint16; 15602 this.minorVersion = p.uint16; 15603 this.metaOffset = p.uint32; 15604 this.metaLength = p.uint32; 15605 this.metaOrigLength = p.uint32; 15606 this.privOffset = p.uint32; 15607 this.privLength = p.uint32; 15608 p.verifyLength(); 15609 this.directory = [ ...new Array( this.numTables ) ].map( 15610 ( _ ) => new Woff2TableDirectoryEntry( p ) 15611 ); 15612 let dictOffset = p.currentPosition; 15613 this.directory[ 0 ].offset = 0; 15614 this.directory.forEach( ( e, i ) => { 15615 let next = this.directory[ i + 1 ]; 15616 if ( next ) { 15617 next.offset = 15618 e.offset + 15619 ( e.transformLength !== undefined 15620 ? e.transformLength 15621 : e.origLength ); 15622 } 15623 } ); 15624 let decoded; 15625 let buffer = dataview.buffer.slice( dictOffset ); 15626 if ( brotliDecode ) { 15627 decoded = brotliDecode( new Uint8Array( buffer ) ); 15628 } else if ( nativeBrotliDecode ) { 15629 decoded = new Uint8Array( nativeBrotliDecode( buffer ) ); 15630 } else { 15631 const msg = `no brotli decoder available to decode WOFF2 font`; 15632 if ( font.onerror ) font.onerror( msg ); 15633 throw new Error( msg ); 15634 } 15635 buildWoff2LazyLookups( this, decoded, createTable ); 15636 } 15637 } 15638 class Woff2TableDirectoryEntry { 15639 constructor( p ) { 15640 this.flags = p.uint8; 15641 const tagNumber = ( this.tagNumber = this.flags & 63 ); 15642 if ( tagNumber === 63 ) { 15643 this.tag = p.tag; 15644 } else { 15645 this.tag = getWOFF2Tag( tagNumber ); 15646 } 15647 const transformVersion = ( this.transformVersion = 15648 ( this.flags & 192 ) >> 6 ); 15649 let hasTransforms = transformVersion !== 0; 15650 if ( this.tag === `glyf` || this.tag === `loca` ) { 15651 hasTransforms = this.transformVersion !== 3; 15652 } 15653 this.origLength = p.uint128; 15654 if ( hasTransforms ) { 15655 this.transformLength = p.uint128; 15656 } 15657 } 15658 } 15659 function buildWoff2LazyLookups( woff2, decoded, createTable ) { 15660 woff2.tables = {}; 15661 woff2.directory.forEach( ( entry ) => { 15662 lazy$1( woff2.tables, entry.tag.trim(), () => { 15663 const start = entry.offset; 15664 const end = 15665 start + 15666 ( entry.transformLength 15667 ? entry.transformLength 15668 : entry.origLength ); 15669 const data = new DataView( decoded.slice( start, end ).buffer ); 15670 try { 15671 return createTable( 15672 woff2.tables, 15673 { tag: entry.tag, offset: 0, length: entry.origLength }, 15674 data 15675 ); 15676 } catch ( e ) { 15677 console.error( e ); 15678 } 15679 } ); 15680 } ); 15681 } 15682 function getWOFF2Tag( flag ) { 15683 return [ 15684 `cmap`, 15685 `head`, 15686 `hhea`, 15687 `hmtx`, 15688 `maxp`, 15689 `name`, 15690 `OS/2`, 15691 `post`, 15692 `cvt `, 15693 `fpgm`, 15694 `glyf`, 15695 `loca`, 15696 `prep`, 15697 `CFF `, 15698 `VORG`, 15699 `EBDT`, 15700 `EBLC`, 15701 `gasp`, 15702 `hdmx`, 15703 `kern`, 15704 `LTSH`, 15705 `PCLT`, 15706 `VDMX`, 15707 `vhea`, 15708 `vmtx`, 15709 `BASE`, 15710 `GDEF`, 15711 `GPOS`, 15712 `GSUB`, 15713 `EBSC`, 15714 `JSTF`, 15715 `MATH`, 15716 `CBDT`, 15717 `CBLC`, 15718 `COLR`, 15719 `CPAL`, 15720 `SVG `, 15721 `sbix`, 15722 `acnt`, 15723 `avar`, 15724 `bdat`, 15725 `bloc`, 15726 `bsln`, 15727 `cvar`, 15728 `fdsc`, 15729 `feat`, 15730 `fmtx`, 15731 `fvar`, 15732 `gvar`, 15733 `hsty`, 15734 `just`, 15735 `lcar`, 15736 `mort`, 15737 `morx`, 15738 `opbd`, 15739 `prop`, 15740 `trak`, 15741 `Zapf`, 15742 `Silf`, 15743 `Glat`, 15744 `Gloc`, 15745 `Feat`, 15746 `Sill`, 15747 ][ flag & 63 ]; 15748 } 15749 const tableClasses = {}; 15750 let tableClassesLoaded = false; 15751 Promise.all( [ 15752 Promise.resolve().then( function () { 15753 return cmap$1; 15754 } ), 15755 Promise.resolve().then( function () { 15756 return head$1; 15757 } ), 15758 Promise.resolve().then( function () { 15759 return hhea$1; 15760 } ), 15761 Promise.resolve().then( function () { 15762 return hmtx$1; 15763 } ), 15764 Promise.resolve().then( function () { 15765 return maxp$1; 15766 } ), 15767 Promise.resolve().then( function () { 15768 return name$1; 15769 } ), 15770 Promise.resolve().then( function () { 15771 return OS2$1; 15772 } ), 15773 Promise.resolve().then( function () { 15774 return post$1; 15775 } ), 15776 Promise.resolve().then( function () { 15777 return BASE$1; 15778 } ), 15779 Promise.resolve().then( function () { 15780 return GDEF$1; 15781 } ), 15782 Promise.resolve().then( function () { 15783 return GSUB$1; 15784 } ), 15785 Promise.resolve().then( function () { 15786 return GPOS$1; 15787 } ), 15788 Promise.resolve().then( function () { 15789 return SVG$1; 15790 } ), 15791 Promise.resolve().then( function () { 15792 return fvar$1; 15793 } ), 15794 Promise.resolve().then( function () { 15795 return cvt$1; 15796 } ), 15797 Promise.resolve().then( function () { 15798 return fpgm$1; 15799 } ), 15800 Promise.resolve().then( function () { 15801 return gasp$1; 15802 } ), 15803 Promise.resolve().then( function () { 15804 return glyf$1; 15805 } ), 15806 Promise.resolve().then( function () { 15807 return loca$1; 15808 } ), 15809 Promise.resolve().then( function () { 15810 return prep$1; 15811 } ), 15812 Promise.resolve().then( function () { 15813 return CFF$1; 15814 } ), 15815 Promise.resolve().then( function () { 15816 return CFF2$1; 15817 } ), 15818 Promise.resolve().then( function () { 15819 return VORG$1; 15820 } ), 15821 Promise.resolve().then( function () { 15822 return EBLC$1; 15823 } ), 15824 Promise.resolve().then( function () { 15825 return EBDT$1; 15826 } ), 15827 Promise.resolve().then( function () { 15828 return EBSC$1; 15829 } ), 15830 Promise.resolve().then( function () { 15831 return CBLC$1; 15832 } ), 15833 Promise.resolve().then( function () { 15834 return CBDT$1; 15835 } ), 15836 Promise.resolve().then( function () { 15837 return sbix$1; 15838 } ), 15839 Promise.resolve().then( function () { 15840 return COLR$1; 15841 } ), 15842 Promise.resolve().then( function () { 15843 return CPAL$1; 15844 } ), 15845 Promise.resolve().then( function () { 15846 return DSIG$1; 15847 } ), 15848 Promise.resolve().then( function () { 15849 return hdmx$1; 15850 } ), 15851 Promise.resolve().then( function () { 15852 return kern$1; 15853 } ), 15854 Promise.resolve().then( function () { 15855 return LTSH$1; 15856 } ), 15857 Promise.resolve().then( function () { 15858 return MERG$1; 15859 } ), 15860 Promise.resolve().then( function () { 15861 return meta$1; 15862 } ), 15863 Promise.resolve().then( function () { 15864 return PCLT$1; 15865 } ), 15866 Promise.resolve().then( function () { 15867 return VDMX$1; 15868 } ), 15869 Promise.resolve().then( function () { 15870 return vhea$1; 15871 } ), 15872 Promise.resolve().then( function () { 15873 return vmtx$1; 15874 } ), 15875 ] ).then( ( data ) => { 15876 data.forEach( ( e ) => { 15877 let name = Object.keys( e )[ 0 ]; 15878 tableClasses[ name ] = e[ name ]; 15879 } ); 15880 tableClassesLoaded = true; 15881 } ); 15882 function createTable( tables, dict, dataview ) { 15883 let name = dict.tag.replace( /[^\w\d]/g, `` ); 15884 let Type = tableClasses[ name ]; 15885 if ( Type ) return new Type( dict, dataview, tables ); 15886 console.warn( 15887 `lib-font has no definition for ${ name }. The table was skipped.` 15888 ); 15889 return {}; 15890 } 15891 function loadTableClasses() { 15892 let count = 0; 15893 function checkLoaded( resolve, reject ) { 15894 if ( ! tableClassesLoaded ) { 15895 if ( count > 10 ) { 15896 return reject( new Error( `loading took too long` ) ); 15897 } 15898 count++; 15899 return setTimeout( () => checkLoaded( resolve ), 250 ); 15900 } 15901 resolve( createTable ); 15902 } 15903 return new Promise( ( resolve, reject ) => checkLoaded( resolve ) ); 15904 } 15905 function getFontCSSFormat( path, errorOnStyle ) { 15906 let pos = path.lastIndexOf( `.` ); 15907 let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase(); 15908 let format = { 15909 ttf: `truetype`, 15910 otf: `opentype`, 15911 woff: `woff`, 15912 woff2: `woff2`, 15913 }[ ext ]; 15914 if ( format ) return format; 15915 let msg = { 15916 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.`, 15917 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.`, 15918 fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, 15919 ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`, 15920 }[ ext ]; 15921 if ( ! msg ) msg = `${ path } is not a known webfont format.`; 15922 if ( errorOnStyle ) { 15923 throw new Error( msg ); 15924 } else { 15925 console.warn( `Could not load font: ${ msg }` ); 15926 } 15927 } 15928 async function setupFontFace( name, url, options = {} ) { 15929 if ( ! globalThis.document ) return; 15930 let format = getFontCSSFormat( url, options.errorOnStyle ); 15931 if ( ! format ) return; 15932 let style = document.createElement( `style` ); 15933 style.className = `injected-by-Font-js`; 15934 let rules = []; 15935 if ( options.styleRules ) { 15936 rules = Object.entries( options.styleRules ).map( 15937 ( [ key, value ] ) => `${ key }: ${ value };` 15938 ); 15939 } 15940 style.textContent = `\n@font-face {\n font-family: "${ name }";\n ${ rules.join( 15941 `\n\t` 15942 ) }\n src: url("${ url }") format("${ format }");\n}`; 15943 globalThis.document.head.appendChild( style ); 15944 return style; 15945 } 15946 const TTF = [ 0, 1, 0, 0 ]; 15947 const OTF = [ 79, 84, 84, 79 ]; 15948 const WOFF = [ 119, 79, 70, 70 ]; 15949 const WOFF2 = [ 119, 79, 70, 50 ]; 15950 function match( ar1, ar2 ) { 15951 if ( ar1.length !== ar2.length ) return; 15952 for ( let i = 0; i < ar1.length; i++ ) { 15953 if ( ar1[ i ] !== ar2[ i ] ) return; 15954 } 15955 return true; 15956 } 15957 function validFontFormat( dataview ) { 15958 const LEAD_BYTES = [ 15959 dataview.getUint8( 0 ), 15960 dataview.getUint8( 1 ), 15961 dataview.getUint8( 2 ), 15962 dataview.getUint8( 3 ), 15963 ]; 15964 if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`; 15965 if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`; 15966 if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`; 15967 } 15968 function checkFetchResponseStatus( response ) { 15969 if ( ! response.ok ) { 15970 throw new Error( 15971 `HTTP ${ response.status } - ${ response.statusText }` 15972 ); 15973 } 15974 return response; 15975 } 15976 class Font extends EventManager { 15977 constructor( name, options = {} ) { 15978 super(); 15979 this.name = name; 15980 this.options = options; 15981 this.metrics = false; 15982 } 15983 get src() { 15984 return this.__src; 15985 } 15986 set src( src ) { 15987 this.__src = src; 15988 ( async () => { 15989 if ( globalThis.document && ! this.options.skipStyleSheet ) { 15990 await setupFontFace( this.name, src, this.options ); 15991 } 15992 this.loadFont( src ); 15993 } )(); 15994 } 15995 async loadFont( url, filename ) { 15996 fetch( url ) 15997 .then( 15998 ( response ) => 15999 checkFetchResponseStatus( response ) && 16000 response.arrayBuffer() 16001 ) 16002 .then( ( buffer ) => 16003 this.fromDataBuffer( buffer, filename || url ) 16004 ) 16005 .catch( ( err ) => { 16006 const evt = new lib_font_browser_Event( 16007 `error`, 16008 err, 16009 `Failed to load font at ${ filename || url }` 16010 ); 16011 this.dispatch( evt ); 16012 if ( this.onerror ) this.onerror( evt ); 16013 } ); 16014 } 16015 async fromDataBuffer( buffer, filenameOrUrL ) { 16016 this.fontData = new DataView( buffer ); 16017 let type = validFontFormat( this.fontData ); 16018 if ( ! type ) { 16019 throw new Error( 16020 `${ filenameOrUrL } is either an unsupported font format, or not a font at all.` 16021 ); 16022 } 16023 await this.parseBasicData( type ); 16024 const evt = new lib_font_browser_Event( 'load', { font: this } ); 16025 this.dispatch( evt ); 16026 if ( this.onload ) this.onload( evt ); 16027 } 16028 async parseBasicData( type ) { 16029 return loadTableClasses().then( ( createTable ) => { 16030 if ( type === `SFNT` ) { 16031 this.opentype = new SFNT( this, this.fontData, createTable ); 16032 } 16033 if ( type === `WOFF` ) { 16034 this.opentype = new WOFF$1( this, this.fontData, createTable ); 16035 } 16036 if ( type === `WOFF2` ) { 16037 this.opentype = new WOFF2$1( this, this.fontData, createTable ); 16038 } 16039 return this.opentype; 16040 } ); 16041 } 16042 getGlyphId( char ) { 16043 return this.opentype.tables.cmap.getGlyphId( char ); 16044 } 16045 reverse( glyphid ) { 16046 return this.opentype.tables.cmap.reverse( glyphid ); 16047 } 16048 supports( char ) { 16049 return this.getGlyphId( char ) !== 0; 16050 } 16051 supportsVariation( variation ) { 16052 return ( 16053 this.opentype.tables.cmap.supportsVariation( variation ) !== false 16054 ); 16055 } 16056 measureText( text, size = 16 ) { 16057 if ( this.__unloaded ) 16058 throw new Error( 16059 'Cannot measure text: font was unloaded. Please reload before calling measureText()' 16060 ); 16061 let d = document.createElement( 'div' ); 16062 d.textContent = text; 16063 d.style.fontFamily = this.name; 16064 d.style.fontSize = `${ size }px`; 16065 d.style.color = `transparent`; 16066 d.style.background = `transparent`; 16067 d.style.top = `0`; 16068 d.style.left = `0`; 16069 d.style.position = `absolute`; 16070 document.body.appendChild( d ); 16071 let bbox = d.getBoundingClientRect(); 16072 document.body.removeChild( d ); 16073 const OS2 = this.opentype.tables[ 'OS/2' ]; 16074 bbox.fontSize = size; 16075 bbox.ascender = OS2.sTypoAscender; 16076 bbox.descender = OS2.sTypoDescender; 16077 return bbox; 16078 } 16079 unload() { 16080 if ( this.styleElement.parentNode ) { 16081 this.styleElement.parentNode.removeElement( this.styleElement ); 16082 const evt = new lib_font_browser_Event( 'unload', { font: this } ); 16083 this.dispatch( evt ); 16084 if ( this.onunload ) this.onunload( evt ); 16085 } 16086 this._unloaded = true; 16087 } 16088 load() { 16089 if ( this.__unloaded ) { 16090 delete this.__unloaded; 16091 document.head.appendChild( this.styleElement ); 16092 const evt = new lib_font_browser_Event( 'load', { font: this } ); 16093 this.dispatch( evt ); 16094 if ( this.onload ) this.onload( evt ); 16095 } 16096 } 16097 } 16098 globalThis.Font = Font; 16099 class Subtable extends ParsedData { 16100 constructor( p, plaformID, encodingID ) { 16101 super( p ); 16102 this.plaformID = plaformID; 16103 this.encodingID = encodingID; 16104 } 16105 } 16106 class Format0 extends Subtable { 16107 constructor( p, platformID, encodingID ) { 16108 super( p, platformID, encodingID ); 16109 this.format = 0; 16110 this.length = p.uint16; 16111 this.language = p.uint16; 16112 this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 ); 16113 } 16114 supports( charCode ) { 16115 if ( charCode.charCodeAt ) { 16116 charCode = -1; 16117 console.warn( 16118 `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` 16119 ); 16120 } 16121 return 0 <= charCode && charCode <= 255; 16122 } 16123 reverse( glyphID ) { 16124 console.warn( `reverse not implemented for cmap subtable format 0` ); 16125 return {}; 16126 } 16127 getSupportedCharCodes() { 16128 return [ { start: 1, end: 256 } ]; 16129 } 16130 } 16131 class Format2 extends Subtable { 16132 constructor( p, platformID, encodingID ) { 16133 super( p, platformID, encodingID ); 16134 this.format = 2; 16135 this.length = p.uint16; 16136 this.language = p.uint16; 16137 this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 ); 16138 const subHeaderCount = Math.max( ...this.subHeaderKeys ); 16139 const subHeaderOffset = p.currentPosition; 16140 lazy$1( this, `subHeaders`, () => { 16141 p.currentPosition = subHeaderOffset; 16142 return [ ...new Array( subHeaderCount ) ].map( 16143 ( _ ) => new SubHeader( p ) 16144 ); 16145 } ); 16146 const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; 16147 lazy$1( this, `glyphIndexArray`, () => { 16148 p.currentPosition = glyphIndexOffset; 16149 return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 ); 16150 } ); 16151 } 16152 supports( charCode ) { 16153 if ( charCode.charCodeAt ) { 16154 charCode = -1; 16155 console.warn( 16156 `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` 16157 ); 16158 } 16159 const low = charCode && 255; 16160 const high = charCode && 65280; 16161 const subHeaderKey = this.subHeaders[ high ]; 16162 const subheader = this.subHeaders[ subHeaderKey ]; 16163 const first = subheader.firstCode; 16164 const last = first + subheader.entryCount; 16165 return first <= low && low <= last; 16166 } 16167 reverse( glyphID ) { 16168 console.warn( `reverse not implemented for cmap subtable format 2` ); 16169 return {}; 16170 } 16171 getSupportedCharCodes( preservePropNames = false ) { 16172 if ( preservePropNames ) { 16173 return this.subHeaders.map( ( h ) => ( { 16174 firstCode: h.firstCode, 16175 lastCode: h.lastCode, 16176 } ) ); 16177 } 16178 return this.subHeaders.map( ( h ) => ( { 16179 start: h.firstCode, 16180 end: h.lastCode, 16181 } ) ); 16182 } 16183 } 16184 class SubHeader { 16185 constructor( p ) { 16186 this.firstCode = p.uint16; 16187 this.entryCount = p.uint16; 16188 this.lastCode = this.first + this.entryCount; 16189 this.idDelta = p.int16; 16190 this.idRangeOffset = p.uint16; 16191 } 16192 } 16193 class Format4 extends Subtable { 16194 constructor( p, platformID, encodingID ) { 16195 super( p, platformID, encodingID ); 16196 this.format = 4; 16197 this.length = p.uint16; 16198 this.language = p.uint16; 16199 this.segCountX2 = p.uint16; 16200 this.segCount = this.segCountX2 / 2; 16201 this.searchRange = p.uint16; 16202 this.entrySelector = p.uint16; 16203 this.rangeShift = p.uint16; 16204 const endCodePosition = p.currentPosition; 16205 lazy$1( this, `endCode`, () => 16206 p.readBytes( this.segCount, endCodePosition, 16 ) 16207 ); 16208 const startCodePosition = endCodePosition + 2 + this.segCountX2; 16209 lazy$1( this, `startCode`, () => 16210 p.readBytes( this.segCount, startCodePosition, 16 ) 16211 ); 16212 const idDeltaPosition = startCodePosition + this.segCountX2; 16213 lazy$1( this, `idDelta`, () => 16214 p.readBytes( this.segCount, idDeltaPosition, 16, true ) 16215 ); 16216 const idRangePosition = idDeltaPosition + this.segCountX2; 16217 lazy$1( this, `idRangeOffset`, () => 16218 p.readBytes( this.segCount, idRangePosition, 16 ) 16219 ); 16220 const glyphIdArrayPosition = idRangePosition + this.segCountX2; 16221 const glyphIdArrayLength = 16222 this.length - ( glyphIdArrayPosition - this.tableStart ); 16223 lazy$1( this, `glyphIdArray`, () => 16224 p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 ) 16225 ); 16226 lazy$1( this, `segments`, () => 16227 this.buildSegments( idRangePosition, glyphIdArrayPosition, p ) 16228 ); 16229 } 16230 buildSegments( idRangePosition, glyphIdArrayPosition, p ) { 16231 const build = ( _, i ) => { 16232 let startCode = this.startCode[ i ], 16233 endCode = this.endCode[ i ], 16234 idDelta = this.idDelta[ i ], 16235 idRangeOffset = this.idRangeOffset[ i ], 16236 idRangeOffsetPointer = idRangePosition + 2 * i, 16237 glyphIDs = []; 16238 if ( idRangeOffset === 0 ) { 16239 for ( 16240 let i = startCode + idDelta, e = endCode + idDelta; 16241 i <= e; 16242 i++ 16243 ) { 16244 glyphIDs.push( i ); 16245 } 16246 } else { 16247 for ( let i = 0, e = endCode - startCode; i <= e; i++ ) { 16248 p.currentPosition = 16249 idRangeOffsetPointer + idRangeOffset + i * 2; 16250 glyphIDs.push( p.uint16 ); 16251 } 16252 } 16253 return { 16254 startCode: startCode, 16255 endCode: endCode, 16256 idDelta: idDelta, 16257 idRangeOffset: idRangeOffset, 16258 glyphIDs: glyphIDs, 16259 }; 16260 }; 16261 return [ ...new Array( this.segCount ) ].map( build ); 16262 } 16263 reverse( glyphID ) { 16264 let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) ); 16265 if ( ! s ) return {}; 16266 const code = s.startCode + s.glyphIDs.indexOf( glyphID ); 16267 return { code: code, unicode: String.fromCodePoint( code ) }; 16268 } 16269 getGlyphId( charCode ) { 16270 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16271 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 16272 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 16273 return 0; 16274 let segment = this.segments.find( 16275 ( s ) => s.startCode <= charCode && charCode <= s.endCode 16276 ); 16277 if ( ! segment ) return 0; 16278 return segment.glyphIDs[ charCode - segment.startCode ]; 16279 } 16280 supports( charCode ) { 16281 return this.getGlyphId( charCode ) !== 0; 16282 } 16283 getSupportedCharCodes( preservePropNames = false ) { 16284 if ( preservePropNames ) return this.segments; 16285 return this.segments.map( ( v ) => ( { 16286 start: v.startCode, 16287 end: v.endCode, 16288 } ) ); 16289 } 16290 } 16291 class Format6 extends Subtable { 16292 constructor( p, platformID, encodingID ) { 16293 super( p, platformID, encodingID ); 16294 this.format = 6; 16295 this.length = p.uint16; 16296 this.language = p.uint16; 16297 this.firstCode = p.uint16; 16298 this.entryCount = p.uint16; 16299 this.lastCode = this.firstCode + this.entryCount - 1; 16300 const getter = () => 16301 [ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 ); 16302 lazy$1( this, `glyphIdArray`, getter ); 16303 } 16304 supports( charCode ) { 16305 if ( charCode.charCodeAt ) { 16306 charCode = -1; 16307 console.warn( 16308 `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` 16309 ); 16310 } 16311 if ( charCode < this.firstCode ) return {}; 16312 if ( charCode > this.firstCode + this.entryCount ) return {}; 16313 const code = charCode - this.firstCode; 16314 return { code: code, unicode: String.fromCodePoint( code ) }; 16315 } 16316 reverse( glyphID ) { 16317 let pos = this.glyphIdArray.indexOf( glyphID ); 16318 if ( pos > -1 ) return this.firstCode + pos; 16319 } 16320 getSupportedCharCodes( preservePropNames = false ) { 16321 if ( preservePropNames ) { 16322 return [ { firstCode: this.firstCode, lastCode: this.lastCode } ]; 16323 } 16324 return [ { start: this.firstCode, end: this.lastCode } ]; 16325 } 16326 } 16327 class Format8 extends Subtable { 16328 constructor( p, platformID, encodingID ) { 16329 super( p, platformID, encodingID ); 16330 this.format = 8; 16331 p.uint16; 16332 this.length = p.uint32; 16333 this.language = p.uint32; 16334 this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 ); 16335 this.numGroups = p.uint32; 16336 const getter = () => 16337 [ ...new Array( this.numGroups ) ].map( 16338 ( _ ) => new SequentialMapGroup$1( p ) 16339 ); 16340 lazy$1( this, `groups`, getter ); 16341 } 16342 supports( charCode ) { 16343 if ( charCode.charCodeAt ) { 16344 charCode = -1; 16345 console.warn( 16346 `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` 16347 ); 16348 } 16349 return ( 16350 this.groups.findIndex( 16351 ( s ) => 16352 s.startcharCode <= charCode && charCode <= s.endcharCode 16353 ) !== -1 16354 ); 16355 } 16356 reverse( glyphID ) { 16357 console.warn( `reverse not implemented for cmap subtable format 8` ); 16358 return {}; 16359 } 16360 getSupportedCharCodes( preservePropNames = false ) { 16361 if ( preservePropNames ) return this.groups; 16362 return this.groups.map( ( v ) => ( { 16363 start: v.startcharCode, 16364 end: v.endcharCode, 16365 } ) ); 16366 } 16367 } 16368 class SequentialMapGroup$1 { 16369 constructor( p ) { 16370 this.startcharCode = p.uint32; 16371 this.endcharCode = p.uint32; 16372 this.startGlyphID = p.uint32; 16373 } 16374 } 16375 class Format10 extends Subtable { 16376 constructor( p, platformID, encodingID ) { 16377 super( p, platformID, encodingID ); 16378 this.format = 10; 16379 p.uint16; 16380 this.length = p.uint32; 16381 this.language = p.uint32; 16382 this.startCharCode = p.uint32; 16383 this.numChars = p.uint32; 16384 this.endCharCode = this.startCharCode + this.numChars; 16385 const getter = () => 16386 [ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 ); 16387 lazy$1( this, `glyphs`, getter ); 16388 } 16389 supports( charCode ) { 16390 if ( charCode.charCodeAt ) { 16391 charCode = -1; 16392 console.warn( 16393 `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` 16394 ); 16395 } 16396 if ( charCode < this.startCharCode ) return false; 16397 if ( charCode > this.startCharCode + this.numChars ) return false; 16398 return charCode - this.startCharCode; 16399 } 16400 reverse( glyphID ) { 16401 console.warn( `reverse not implemented for cmap subtable format 10` ); 16402 return {}; 16403 } 16404 getSupportedCharCodes( preservePropNames = false ) { 16405 if ( preservePropNames ) { 16406 return [ 16407 { 16408 startCharCode: this.startCharCode, 16409 endCharCode: this.endCharCode, 16410 }, 16411 ]; 16412 } 16413 return [ { start: this.startCharCode, end: this.endCharCode } ]; 16414 } 16415 } 16416 class Format12 extends Subtable { 16417 constructor( p, platformID, encodingID ) { 16418 super( p, platformID, encodingID ); 16419 this.format = 12; 16420 p.uint16; 16421 this.length = p.uint32; 16422 this.language = p.uint32; 16423 this.numGroups = p.uint32; 16424 const getter = () => 16425 [ ...new Array( this.numGroups ) ].map( 16426 ( _ ) => new SequentialMapGroup( p ) 16427 ); 16428 lazy$1( this, `groups`, getter ); 16429 } 16430 supports( charCode ) { 16431 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16432 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 16433 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 16434 return 0; 16435 return ( 16436 this.groups.findIndex( 16437 ( s ) => 16438 s.startCharCode <= charCode && charCode <= s.endCharCode 16439 ) !== -1 16440 ); 16441 } 16442 reverse( glyphID ) { 16443 for ( let group of this.groups ) { 16444 let start = group.startGlyphID; 16445 if ( start > glyphID ) continue; 16446 if ( start === glyphID ) return group.startCharCode; 16447 let end = start + ( group.endCharCode - group.startCharCode ); 16448 if ( end < glyphID ) continue; 16449 const code = group.startCharCode + ( glyphID - start ); 16450 return { code: code, unicode: String.fromCodePoint( code ) }; 16451 } 16452 return {}; 16453 } 16454 getSupportedCharCodes( preservePropNames = false ) { 16455 if ( preservePropNames ) return this.groups; 16456 return this.groups.map( ( v ) => ( { 16457 start: v.startCharCode, 16458 end: v.endCharCode, 16459 } ) ); 16460 } 16461 } 16462 class SequentialMapGroup { 16463 constructor( p ) { 16464 this.startCharCode = p.uint32; 16465 this.endCharCode = p.uint32; 16466 this.startGlyphID = p.uint32; 16467 } 16468 } 16469 class Format13 extends Subtable { 16470 constructor( p, platformID, encodingID ) { 16471 super( p, platformID, encodingID ); 16472 this.format = 13; 16473 p.uint16; 16474 this.length = p.uint32; 16475 this.language = p.uint32; 16476 this.numGroups = p.uint32; 16477 const getter = [ ...new Array( this.numGroups ) ].map( 16478 ( _ ) => new ConstantMapGroup( p ) 16479 ); 16480 lazy$1( this, `groups`, getter ); 16481 } 16482 supports( charCode ) { 16483 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16484 return ( 16485 this.groups.findIndex( 16486 ( s ) => 16487 s.startCharCode <= charCode && charCode <= s.endCharCode 16488 ) !== -1 16489 ); 16490 } 16491 reverse( glyphID ) { 16492 console.warn( `reverse not implemented for cmap subtable format 13` ); 16493 return {}; 16494 } 16495 getSupportedCharCodes( preservePropNames = false ) { 16496 if ( preservePropNames ) return this.groups; 16497 return this.groups.map( ( v ) => ( { 16498 start: v.startCharCode, 16499 end: v.endCharCode, 16500 } ) ); 16501 } 16502 } 16503 class ConstantMapGroup { 16504 constructor( p ) { 16505 this.startCharCode = p.uint32; 16506 this.endCharCode = p.uint32; 16507 this.glyphID = p.uint32; 16508 } 16509 } 16510 class Format14 extends Subtable { 16511 constructor( p, platformID, encodingID ) { 16512 super( p, platformID, encodingID ); 16513 this.subTableStart = p.currentPosition; 16514 this.format = 14; 16515 this.length = p.uint32; 16516 this.numVarSelectorRecords = p.uint32; 16517 lazy$1( this, `varSelectors`, () => 16518 [ ...new Array( this.numVarSelectorRecords ) ].map( 16519 ( _ ) => new VariationSelector( p ) 16520 ) 16521 ); 16522 } 16523 supports() { 16524 console.warn( `supports not implemented for cmap subtable format 14` ); 16525 return 0; 16526 } 16527 getSupportedCharCodes() { 16528 console.warn( 16529 `getSupportedCharCodes not implemented for cmap subtable format 14` 16530 ); 16531 return []; 16532 } 16533 reverse( glyphID ) { 16534 console.warn( `reverse not implemented for cmap subtable format 14` ); 16535 return {}; 16536 } 16537 supportsVariation( variation ) { 16538 let v = this.varSelector.find( 16539 ( uvs ) => uvs.varSelector === variation 16540 ); 16541 return v ? v : false; 16542 } 16543 getSupportedVariations() { 16544 return this.varSelectors.map( ( v ) => v.varSelector ); 16545 } 16546 } 16547 class VariationSelector { 16548 constructor( p ) { 16549 this.varSelector = p.uint24; 16550 this.defaultUVSOffset = p.Offset32; 16551 this.nonDefaultUVSOffset = p.Offset32; 16552 } 16553 } 16554 function createSubTable( parser, platformID, encodingID ) { 16555 const format = parser.uint16; 16556 if ( format === 0 ) return new Format0( parser, platformID, encodingID ); 16557 if ( format === 2 ) return new Format2( parser, platformID, encodingID ); 16558 if ( format === 4 ) return new Format4( parser, platformID, encodingID ); 16559 if ( format === 6 ) return new Format6( parser, platformID, encodingID ); 16560 if ( format === 8 ) return new Format8( parser, platformID, encodingID ); 16561 if ( format === 10 ) return new Format10( parser, platformID, encodingID ); 16562 if ( format === 12 ) return new Format12( parser, platformID, encodingID ); 16563 if ( format === 13 ) return new Format13( parser, platformID, encodingID ); 16564 if ( format === 14 ) return new Format14( parser, platformID, encodingID ); 16565 return {}; 16566 } 16567 class cmap extends SimpleTable { 16568 constructor( dict, dataview ) { 16569 const { p: p } = super( dict, dataview ); 16570 this.version = p.uint16; 16571 this.numTables = p.uint16; 16572 this.encodingRecords = [ ...new Array( this.numTables ) ].map( 16573 ( _ ) => new EncodingRecord( p, this.tableStart ) 16574 ); 16575 } 16576 getSubTable( tableID ) { 16577 return this.encodingRecords[ tableID ].table; 16578 } 16579 getSupportedEncodings() { 16580 return this.encodingRecords.map( ( r ) => ( { 16581 platformID: r.platformID, 16582 encodingId: r.encodingID, 16583 } ) ); 16584 } 16585 getSupportedCharCodes( platformID, encodingID ) { 16586 const recordID = this.encodingRecords.findIndex( 16587 ( r ) => r.platformID === platformID && r.encodingID === encodingID 16588 ); 16589 if ( recordID === -1 ) return false; 16590 const subtable = this.getSubTable( recordID ); 16591 return subtable.getSupportedCharCodes(); 16592 } 16593 reverse( glyphid ) { 16594 for ( let i = 0; i < this.numTables; i++ ) { 16595 let code = this.getSubTable( i ).reverse( glyphid ); 16596 if ( code ) return code; 16597 } 16598 } 16599 getGlyphId( char ) { 16600 let last = 0; 16601 this.encodingRecords.some( ( _, tableID ) => { 16602 let t = this.getSubTable( tableID ); 16603 if ( ! t.getGlyphId ) return false; 16604 last = t.getGlyphId( char ); 16605 return last !== 0; 16606 } ); 16607 return last; 16608 } 16609 supports( char ) { 16610 return this.encodingRecords.some( ( _, tableID ) => { 16611 const t = this.getSubTable( tableID ); 16612 return t.supports && t.supports( char ) !== false; 16613 } ); 16614 } 16615 supportsVariation( variation ) { 16616 return this.encodingRecords.some( ( _, tableID ) => { 16617 const t = this.getSubTable( tableID ); 16618 return ( 16619 t.supportsVariation && 16620 t.supportsVariation( variation ) !== false 16621 ); 16622 } ); 16623 } 16624 } 16625 class EncodingRecord { 16626 constructor( p, tableStart ) { 16627 const platformID = ( this.platformID = p.uint16 ); 16628 const encodingID = ( this.encodingID = p.uint16 ); 16629 const offset = ( this.offset = p.Offset32 ); 16630 lazy$1( this, `table`, () => { 16631 p.currentPosition = tableStart + offset; 16632 return createSubTable( p, platformID, encodingID ); 16633 } ); 16634 } 16635 } 16636 var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } ); 16637 class head extends SimpleTable { 16638 constructor( dict, dataview ) { 16639 const { p: p } = super( dict, dataview ); 16640 this.load( { 16641 majorVersion: p.uint16, 16642 minorVersion: p.uint16, 16643 fontRevision: p.fixed, 16644 checkSumAdjustment: p.uint32, 16645 magicNumber: p.uint32, 16646 flags: p.flags( 16 ), 16647 unitsPerEm: p.uint16, 16648 created: p.longdatetime, 16649 modified: p.longdatetime, 16650 xMin: p.int16, 16651 yMin: p.int16, 16652 xMax: p.int16, 16653 yMax: p.int16, 16654 macStyle: p.flags( 16 ), 16655 lowestRecPPEM: p.uint16, 16656 fontDirectionHint: p.uint16, 16657 indexToLocFormat: p.uint16, 16658 glyphDataFormat: p.uint16, 16659 } ); 16660 } 16661 } 16662 var head$1 = Object.freeze( { __proto__: null, head: head } ); 16663 class hhea extends SimpleTable { 16664 constructor( dict, dataview ) { 16665 const { p: p } = super( dict, dataview ); 16666 this.majorVersion = p.uint16; 16667 this.minorVersion = p.uint16; 16668 this.ascender = p.fword; 16669 this.descender = p.fword; 16670 this.lineGap = p.fword; 16671 this.advanceWidthMax = p.ufword; 16672 this.minLeftSideBearing = p.fword; 16673 this.minRightSideBearing = p.fword; 16674 this.xMaxExtent = p.fword; 16675 this.caretSlopeRise = p.int16; 16676 this.caretSlopeRun = p.int16; 16677 this.caretOffset = p.int16; 16678 p.int16; 16679 p.int16; 16680 p.int16; 16681 p.int16; 16682 this.metricDataFormat = p.int16; 16683 this.numberOfHMetrics = p.uint16; 16684 p.verifyLength(); 16685 } 16686 } 16687 var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } ); 16688 class hmtx extends SimpleTable { 16689 constructor( dict, dataview, tables ) { 16690 const { p: p } = super( dict, dataview ); 16691 const numberOfHMetrics = tables.hhea.numberOfHMetrics; 16692 const numGlyphs = tables.maxp.numGlyphs; 16693 const metricsStart = p.currentPosition; 16694 lazy$1( this, `hMetrics`, () => { 16695 p.currentPosition = metricsStart; 16696 return [ ...new Array( numberOfHMetrics ) ].map( 16697 ( _ ) => new LongHorMetric( p.uint16, p.int16 ) 16698 ); 16699 } ); 16700 if ( numberOfHMetrics < numGlyphs ) { 16701 const lsbStart = metricsStart + numberOfHMetrics * 4; 16702 lazy$1( this, `leftSideBearings`, () => { 16703 p.currentPosition = lsbStart; 16704 return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map( 16705 ( _ ) => p.int16 16706 ); 16707 } ); 16708 } 16709 } 16710 } 16711 class LongHorMetric { 16712 constructor( w, b ) { 16713 this.advanceWidth = w; 16714 this.lsb = b; 16715 } 16716 } 16717 var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } ); 16718 class maxp extends SimpleTable { 16719 constructor( dict, dataview ) { 16720 const { p: p } = super( dict, dataview ); 16721 this.version = p.legacyFixed; 16722 this.numGlyphs = p.uint16; 16723 if ( this.version === 1 ) { 16724 this.maxPoints = p.uint16; 16725 this.maxContours = p.uint16; 16726 this.maxCompositePoints = p.uint16; 16727 this.maxCompositeContours = p.uint16; 16728 this.maxZones = p.uint16; 16729 this.maxTwilightPoints = p.uint16; 16730 this.maxStorage = p.uint16; 16731 this.maxFunctionDefs = p.uint16; 16732 this.maxInstructionDefs = p.uint16; 16733 this.maxStackElements = p.uint16; 16734 this.maxSizeOfInstructions = p.uint16; 16735 this.maxComponentElements = p.uint16; 16736 this.maxComponentDepth = p.uint16; 16737 } 16738 p.verifyLength(); 16739 } 16740 } 16741 var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } ); 16742 class lib_font_browser_name extends SimpleTable { 16743 constructor( dict, dataview ) { 16744 const { p: p } = super( dict, dataview ); 16745 this.format = p.uint16; 16746 this.count = p.uint16; 16747 this.stringOffset = p.Offset16; 16748 this.nameRecords = [ ...new Array( this.count ) ].map( 16749 ( _ ) => new NameRecord( p, this ) 16750 ); 16751 if ( this.format === 1 ) { 16752 this.langTagCount = p.uint16; 16753 this.langTagRecords = [ ...new Array( this.langTagCount ) ].map( 16754 ( _ ) => new LangTagRecord( p.uint16, p.Offset16 ) 16755 ); 16756 } 16757 this.stringStart = this.tableStart + this.stringOffset; 16758 } 16759 get( nameID ) { 16760 let record = this.nameRecords.find( 16761 ( record ) => record.nameID === nameID 16762 ); 16763 if ( record ) return record.string; 16764 } 16765 } 16766 class LangTagRecord { 16767 constructor( length, offset ) { 16768 this.length = length; 16769 this.offset = offset; 16770 } 16771 } 16772 class NameRecord { 16773 constructor( p, nameTable ) { 16774 this.platformID = p.uint16; 16775 this.encodingID = p.uint16; 16776 this.languageID = p.uint16; 16777 this.nameID = p.uint16; 16778 this.length = p.uint16; 16779 this.offset = p.Offset16; 16780 lazy$1( this, `string`, () => { 16781 p.currentPosition = nameTable.stringStart + this.offset; 16782 return decodeString( p, this ); 16783 } ); 16784 } 16785 } 16786 function decodeString( p, record ) { 16787 const { platformID: platformID, length: length } = record; 16788 if ( length === 0 ) return ``; 16789 if ( platformID === 0 || platformID === 3 ) { 16790 const str = []; 16791 for ( let i = 0, e = length / 2; i < e; i++ ) 16792 str[ i ] = String.fromCharCode( p.uint16 ); 16793 return str.join( `` ); 16794 } 16795 const bytes = p.readBytes( length ); 16796 const str = []; 16797 bytes.forEach( function ( b, i ) { 16798 str[ i ] = String.fromCharCode( b ); 16799 } ); 16800 return str.join( `` ); 16801 } 16802 var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } ); 16803 class OS2 extends SimpleTable { 16804 constructor( dict, dataview ) { 16805 const { p: p } = super( dict, dataview ); 16806 this.version = p.uint16; 16807 this.xAvgCharWidth = p.int16; 16808 this.usWeightClass = p.uint16; 16809 this.usWidthClass = p.uint16; 16810 this.fsType = p.uint16; 16811 this.ySubscriptXSize = p.int16; 16812 this.ySubscriptYSize = p.int16; 16813 this.ySubscriptXOffset = p.int16; 16814 this.ySubscriptYOffset = p.int16; 16815 this.ySuperscriptXSize = p.int16; 16816 this.ySuperscriptYSize = p.int16; 16817 this.ySuperscriptXOffset = p.int16; 16818 this.ySuperscriptYOffset = p.int16; 16819 this.yStrikeoutSize = p.int16; 16820 this.yStrikeoutPosition = p.int16; 16821 this.sFamilyClass = p.int16; 16822 this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 ); 16823 this.ulUnicodeRange1 = p.flags( 32 ); 16824 this.ulUnicodeRange2 = p.flags( 32 ); 16825 this.ulUnicodeRange3 = p.flags( 32 ); 16826 this.ulUnicodeRange4 = p.flags( 32 ); 16827 this.achVendID = p.tag; 16828 this.fsSelection = p.uint16; 16829 this.usFirstCharIndex = p.uint16; 16830 this.usLastCharIndex = p.uint16; 16831 this.sTypoAscender = p.int16; 16832 this.sTypoDescender = p.int16; 16833 this.sTypoLineGap = p.int16; 16834 this.usWinAscent = p.uint16; 16835 this.usWinDescent = p.uint16; 16836 if ( this.version === 0 ) return p.verifyLength(); 16837 this.ulCodePageRange1 = p.flags( 32 ); 16838 this.ulCodePageRange2 = p.flags( 32 ); 16839 if ( this.version === 1 ) return p.verifyLength(); 16840 this.sxHeight = p.int16; 16841 this.sCapHeight = p.int16; 16842 this.usDefaultChar = p.uint16; 16843 this.usBreakChar = p.uint16; 16844 this.usMaxContext = p.uint16; 16845 if ( this.version <= 4 ) return p.verifyLength(); 16846 this.usLowerOpticalPointSize = p.uint16; 16847 this.usUpperOpticalPointSize = p.uint16; 16848 if ( this.version === 5 ) return p.verifyLength(); 16849 } 16850 } 16851 var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } ); 16852 class post extends SimpleTable { 16853 constructor( dict, dataview ) { 16854 const { p: p } = super( dict, dataview ); 16855 this.version = p.legacyFixed; 16856 this.italicAngle = p.fixed; 16857 this.underlinePosition = p.fword; 16858 this.underlineThickness = p.fword; 16859 this.isFixedPitch = p.uint32; 16860 this.minMemType42 = p.uint32; 16861 this.maxMemType42 = p.uint32; 16862 this.minMemType1 = p.uint32; 16863 this.maxMemType1 = p.uint32; 16864 if ( this.version === 1 || this.version === 3 ) return p.verifyLength(); 16865 this.numGlyphs = p.uint16; 16866 if ( this.version === 2 ) { 16867 this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map( 16868 ( _ ) => p.uint16 16869 ); 16870 this.namesOffset = p.currentPosition; 16871 this.glyphNameOffsets = [ 1 ]; 16872 for ( let i = 0; i < this.numGlyphs; i++ ) { 16873 let index = this.glyphNameIndex[ i ]; 16874 if ( index < macStrings.length ) { 16875 this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] ); 16876 continue; 16877 } 16878 let bytelength = p.int8; 16879 p.skip( bytelength ); 16880 this.glyphNameOffsets.push( 16881 this.glyphNameOffsets[ i ] + bytelength + 1 16882 ); 16883 } 16884 } 16885 if ( this.version === 2.5 ) { 16886 this.offset = [ ...new Array( this.numGlyphs ) ].map( 16887 ( _ ) => p.int8 16888 ); 16889 } 16890 } 16891 getGlyphName( glyphid ) { 16892 if ( this.version !== 2 ) { 16893 console.warn( 16894 `post table version ${ this.version } does not support glyph name lookups` 16895 ); 16896 return ``; 16897 } 16898 let index = this.glyphNameIndex[ glyphid ]; 16899 if ( index < 258 ) return macStrings[ index ]; 16900 let offset = this.glyphNameOffsets[ glyphid ]; 16901 let next = this.glyphNameOffsets[ glyphid + 1 ]; 16902 let len = next - offset - 1; 16903 if ( len === 0 ) return `.notdef.`; 16904 this.parser.currentPosition = this.namesOffset + offset; 16905 const data = this.parser.readBytes( 16906 len, 16907 this.namesOffset + offset, 16908 8, 16909 true 16910 ); 16911 return data.map( ( b ) => String.fromCharCode( b ) ).join( `` ); 16912 } 16913 } 16914 const macStrings = [ 16915 `.notdef`, 16916 `.null`, 16917 `nonmarkingreturn`, 16918 `space`, 16919 `exclam`, 16920 `quotedbl`, 16921 `numbersign`, 16922 `dollar`, 16923 `percent`, 16924 `ampersand`, 16925 `quotesingle`, 16926 `parenleft`, 16927 `parenright`, 16928 `asterisk`, 16929 `plus`, 16930 `comma`, 16931 `hyphen`, 16932 `period`, 16933 `slash`, 16934 `zero`, 16935 `one`, 16936 `two`, 16937 `three`, 16938 `four`, 16939 `five`, 16940 `six`, 16941 `seven`, 16942 `eight`, 16943 `nine`, 16944 `colon`, 16945 `semicolon`, 16946 `less`, 16947 `equal`, 16948 `greater`, 16949 `question`, 16950 `at`, 16951 `A`, 16952 `B`, 16953 `C`, 16954 `D`, 16955 `E`, 16956 `F`, 16957 `G`, 16958 `H`, 16959 `I`, 16960 `J`, 16961 `K`, 16962 `L`, 16963 `M`, 16964 `N`, 16965 `O`, 16966 `P`, 16967 `Q`, 16968 `R`, 16969 `S`, 16970 `T`, 16971 `U`, 16972 `V`, 16973 `W`, 16974 `X`, 16975 `Y`, 16976 `Z`, 16977 `bracketleft`, 16978 `backslash`, 16979 `bracketright`, 16980 `asciicircum`, 16981 `underscore`, 16982 `grave`, 16983 `a`, 16984 `b`, 16985 `c`, 16986 `d`, 16987 `e`, 16988 `f`, 16989 `g`, 16990 `h`, 16991 `i`, 16992 `j`, 16993 `k`, 16994 `l`, 16995 `m`, 16996 `n`, 16997 `o`, 16998 `p`, 16999 `q`, 17000 `r`, 17001 `s`, 17002 `t`, 17003 `u`, 17004 `v`, 17005 `w`, 17006 `x`, 17007 `y`, 17008 `z`, 17009 `braceleft`, 17010 `bar`, 17011 `braceright`, 17012 `asciitilde`, 17013 `Adieresis`, 17014 `Aring`, 17015 `Ccedilla`, 17016 `Eacute`, 17017 `Ntilde`, 17018 `Odieresis`, 17019 `Udieresis`, 17020 `aacute`, 17021 `agrave`, 17022 `acircumflex`, 17023 `adieresis`, 17024 `atilde`, 17025 `aring`, 17026 `ccedilla`, 17027 `eacute`, 17028 `egrave`, 17029 `ecircumflex`, 17030 `edieresis`, 17031 `iacute`, 17032 `igrave`, 17033 `icircumflex`, 17034 `idieresis`, 17035 `ntilde`, 17036 `oacute`, 17037 `ograve`, 17038 `ocircumflex`, 17039 `odieresis`, 17040 `otilde`, 17041 `uacute`, 17042 `ugrave`, 17043 `ucircumflex`, 17044 `udieresis`, 17045 `dagger`, 17046 `degree`, 17047 `cent`, 17048 `sterling`, 17049 `section`, 17050 `bullet`, 17051 `paragraph`, 17052 `germandbls`, 17053 `registered`, 17054 `copyright`, 17055 `trademark`, 17056 `acute`, 17057 `dieresis`, 17058 `notequal`, 17059 `AE`, 17060 `Oslash`, 17061 `infinity`, 17062 `plusminus`, 17063 `lessequal`, 17064 `greaterequal`, 17065 `yen`, 17066 `mu`, 17067 `partialdiff`, 17068 `summation`, 17069 `product`, 17070 `pi`, 17071 `integral`, 17072 `ordfeminine`, 17073 `ordmasculine`, 17074 `Omega`, 17075 `ae`, 17076 `oslash`, 17077 `questiondown`, 17078 `exclamdown`, 17079 `logicalnot`, 17080 `radical`, 17081 `florin`, 17082 `approxequal`, 17083 `Delta`, 17084 `guillemotleft`, 17085 `guillemotright`, 17086 `ellipsis`, 17087 `nonbreakingspace`, 17088 `Agrave`, 17089 `Atilde`, 17090 `Otilde`, 17091 `OE`, 17092 `oe`, 17093 `endash`, 17094 `emdash`, 17095 `quotedblleft`, 17096 `quotedblright`, 17097 `quoteleft`, 17098 `quoteright`, 17099 `divide`, 17100 `lozenge`, 17101 `ydieresis`, 17102 `Ydieresis`, 17103 `fraction`, 17104 `currency`, 17105 `guilsinglleft`, 17106 `guilsinglright`, 17107 `fi`, 17108 `fl`, 17109 `daggerdbl`, 17110 `periodcentered`, 17111 `quotesinglbase`, 17112 `quotedblbase`, 17113 `perthousand`, 17114 `Acircumflex`, 17115 `Ecircumflex`, 17116 `Aacute`, 17117 `Edieresis`, 17118 `Egrave`, 17119 `Iacute`, 17120 `Icircumflex`, 17121 `Idieresis`, 17122 `Igrave`, 17123 `Oacute`, 17124 `Ocircumflex`, 17125 `apple`, 17126 `Ograve`, 17127 `Uacute`, 17128 `Ucircumflex`, 17129 `Ugrave`, 17130 `dotlessi`, 17131 `circumflex`, 17132 `tilde`, 17133 `macron`, 17134 `breve`, 17135 `dotaccent`, 17136 `ring`, 17137 `cedilla`, 17138 `hungarumlaut`, 17139 `ogonek`, 17140 `caron`, 17141 `Lslash`, 17142 `lslash`, 17143 `Scaron`, 17144 `scaron`, 17145 `Zcaron`, 17146 `zcaron`, 17147 `brokenbar`, 17148 `Eth`, 17149 `eth`, 17150 `Yacute`, 17151 `yacute`, 17152 `Thorn`, 17153 `thorn`, 17154 `minus`, 17155 `multiply`, 17156 `onesuperior`, 17157 `twosuperior`, 17158 `threesuperior`, 17159 `onehalf`, 17160 `onequarter`, 17161 `threequarters`, 17162 `franc`, 17163 `Gbreve`, 17164 `gbreve`, 17165 `Idotaccent`, 17166 `Scedilla`, 17167 `scedilla`, 17168 `Cacute`, 17169 `cacute`, 17170 `Ccaron`, 17171 `ccaron`, 17172 `dcroat`, 17173 ]; 17174 var post$1 = Object.freeze( { __proto__: null, post: post } ); 17175 class BASE extends SimpleTable { 17176 constructor( dict, dataview ) { 17177 const { p: p } = super( dict, dataview ); 17178 this.majorVersion = p.uint16; 17179 this.minorVersion = p.uint16; 17180 this.horizAxisOffset = p.Offset16; 17181 this.vertAxisOffset = p.Offset16; 17182 lazy$1( 17183 this, 17184 `horizAxis`, 17185 () => 17186 new AxisTable( 17187 { offset: dict.offset + this.horizAxisOffset }, 17188 dataview 17189 ) 17190 ); 17191 lazy$1( 17192 this, 17193 `vertAxis`, 17194 () => 17195 new AxisTable( 17196 { offset: dict.offset + this.vertAxisOffset }, 17197 dataview 17198 ) 17199 ); 17200 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 17201 this.itemVarStoreOffset = p.Offset32; 17202 lazy$1( 17203 this, 17204 `itemVarStore`, 17205 () => 17206 new AxisTable( 17207 { offset: dict.offset + this.itemVarStoreOffset }, 17208 dataview 17209 ) 17210 ); 17211 } 17212 } 17213 } 17214 class AxisTable extends SimpleTable { 17215 constructor( dict, dataview ) { 17216 const { p: p } = super( dict, dataview, `AxisTable` ); 17217 this.baseTagListOffset = p.Offset16; 17218 this.baseScriptListOffset = p.Offset16; 17219 lazy$1( 17220 this, 17221 `baseTagList`, 17222 () => 17223 new BaseTagListTable( 17224 { offset: dict.offset + this.baseTagListOffset }, 17225 dataview 17226 ) 17227 ); 17228 lazy$1( 17229 this, 17230 `baseScriptList`, 17231 () => 17232 new BaseScriptListTable( 17233 { offset: dict.offset + this.baseScriptListOffset }, 17234 dataview 17235 ) 17236 ); 17237 } 17238 } 17239 class BaseTagListTable extends SimpleTable { 17240 constructor( dict, dataview ) { 17241 const { p: p } = super( dict, dataview, `BaseTagListTable` ); 17242 this.baseTagCount = p.uint16; 17243 this.baselineTags = [ ...new Array( this.baseTagCount ) ].map( 17244 ( _ ) => p.tag 17245 ); 17246 } 17247 } 17248 class BaseScriptListTable extends SimpleTable { 17249 constructor( dict, dataview ) { 17250 const { p: p } = super( dict, dataview, `BaseScriptListTable` ); 17251 this.baseScriptCount = p.uint16; 17252 const recordStart = p.currentPosition; 17253 lazy$1( this, `baseScriptRecords`, () => { 17254 p.currentPosition = recordStart; 17255 return [ ...new Array( this.baseScriptCount ) ].map( 17256 ( _ ) => new BaseScriptRecord( this.start, p ) 17257 ); 17258 } ); 17259 } 17260 } 17261 class BaseScriptRecord { 17262 constructor( baseScriptListTableStart, p ) { 17263 this.baseScriptTag = p.tag; 17264 this.baseScriptOffset = p.Offset16; 17265 lazy$1( this, `baseScriptTable`, () => { 17266 p.currentPosition = 17267 baseScriptListTableStart + this.baseScriptOffset; 17268 return new BaseScriptTable( p ); 17269 } ); 17270 } 17271 } 17272 class BaseScriptTable { 17273 constructor( p ) { 17274 this.start = p.currentPosition; 17275 this.baseValuesOffset = p.Offset16; 17276 this.defaultMinMaxOffset = p.Offset16; 17277 this.baseLangSysCount = p.uint16; 17278 this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map( 17279 ( _ ) => new BaseLangSysRecord( this.start, p ) 17280 ); 17281 lazy$1( this, `baseValues`, () => { 17282 p.currentPosition = this.start + this.baseValuesOffset; 17283 return new BaseValuesTable( p ); 17284 } ); 17285 lazy$1( this, `defaultMinMax`, () => { 17286 p.currentPosition = this.start + this.defaultMinMaxOffset; 17287 return new MinMaxTable( p ); 17288 } ); 17289 } 17290 } 17291 class BaseLangSysRecord { 17292 constructor( baseScriptTableStart, p ) { 17293 this.baseLangSysTag = p.tag; 17294 this.minMaxOffset = p.Offset16; 17295 lazy$1( this, `minMax`, () => { 17296 p.currentPosition = baseScriptTableStart + this.minMaxOffset; 17297 return new MinMaxTable( p ); 17298 } ); 17299 } 17300 } 17301 class BaseValuesTable { 17302 constructor( p ) { 17303 this.parser = p; 17304 this.start = p.currentPosition; 17305 this.defaultBaselineIndex = p.uint16; 17306 this.baseCoordCount = p.uint16; 17307 this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map( 17308 ( _ ) => p.Offset16 17309 ); 17310 } 17311 getTable( id ) { 17312 this.parser.currentPosition = this.start + this.baseCoords[ id ]; 17313 return new BaseCoordTable( this.parser ); 17314 } 17315 } 17316 class MinMaxTable { 17317 constructor( p ) { 17318 this.minCoord = p.Offset16; 17319 this.maxCoord = p.Offset16; 17320 this.featMinMaxCount = p.uint16; 17321 const recordStart = p.currentPosition; 17322 lazy$1( this, `featMinMaxRecords`, () => { 17323 p.currentPosition = recordStart; 17324 return [ ...new Array( this.featMinMaxCount ) ].map( 17325 ( _ ) => new FeatMinMaxRecord( p ) 17326 ); 17327 } ); 17328 } 17329 } 17330 class FeatMinMaxRecord { 17331 constructor( p ) { 17332 this.featureTableTag = p.tag; 17333 this.minCoord = p.Offset16; 17334 this.maxCoord = p.Offset16; 17335 } 17336 } 17337 class BaseCoordTable { 17338 constructor( p ) { 17339 this.baseCoordFormat = p.uint16; 17340 this.coordinate = p.int16; 17341 if ( this.baseCoordFormat === 2 ) { 17342 this.referenceGlyph = p.uint16; 17343 this.baseCoordPoint = p.uint16; 17344 } 17345 if ( this.baseCoordFormat === 3 ) { 17346 this.deviceTable = p.Offset16; 17347 } 17348 } 17349 } 17350 var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } ); 17351 class ClassDefinition { 17352 constructor( p ) { 17353 this.classFormat = p.uint16; 17354 if ( this.classFormat === 1 ) { 17355 this.startGlyphID = p.uint16; 17356 this.glyphCount = p.uint16; 17357 this.classValueArray = [ ...new Array( this.glyphCount ) ].map( 17358 ( _ ) => p.uint16 17359 ); 17360 } 17361 if ( this.classFormat === 2 ) { 17362 this.classRangeCount = p.uint16; 17363 this.classRangeRecords = [ 17364 ...new Array( this.classRangeCount ), 17365 ].map( ( _ ) => new ClassRangeRecord( p ) ); 17366 } 17367 } 17368 } 17369 class ClassRangeRecord { 17370 constructor( p ) { 17371 this.startGlyphID = p.uint16; 17372 this.endGlyphID = p.uint16; 17373 this.class = p.uint16; 17374 } 17375 } 17376 class CoverageTable extends ParsedData { 17377 constructor( p ) { 17378 super( p ); 17379 this.coverageFormat = p.uint16; 17380 if ( this.coverageFormat === 1 ) { 17381 this.glyphCount = p.uint16; 17382 this.glyphArray = [ ...new Array( this.glyphCount ) ].map( 17383 ( _ ) => p.uint16 17384 ); 17385 } 17386 if ( this.coverageFormat === 2 ) { 17387 this.rangeCount = p.uint16; 17388 this.rangeRecords = [ ...new Array( this.rangeCount ) ].map( 17389 ( _ ) => new CoverageRangeRecord( p ) 17390 ); 17391 } 17392 } 17393 } 17394 class CoverageRangeRecord { 17395 constructor( p ) { 17396 this.startGlyphID = p.uint16; 17397 this.endGlyphID = p.uint16; 17398 this.startCoverageIndex = p.uint16; 17399 } 17400 } 17401 class ItemVariationStoreTable { 17402 constructor( table, p ) { 17403 this.table = table; 17404 this.parser = p; 17405 this.start = p.currentPosition; 17406 this.format = p.uint16; 17407 this.variationRegionListOffset = p.Offset32; 17408 this.itemVariationDataCount = p.uint16; 17409 this.itemVariationDataOffsets = [ 17410 ...new Array( this.itemVariationDataCount ), 17411 ].map( ( _ ) => p.Offset32 ); 17412 } 17413 } 17414 class GDEF extends SimpleTable { 17415 constructor( dict, dataview ) { 17416 const { p: p } = super( dict, dataview ); 17417 this.majorVersion = p.uint16; 17418 this.minorVersion = p.uint16; 17419 this.glyphClassDefOffset = p.Offset16; 17420 lazy$1( this, `glyphClassDefs`, () => { 17421 if ( this.glyphClassDefOffset === 0 ) return undefined; 17422 p.currentPosition = this.tableStart + this.glyphClassDefOffset; 17423 return new ClassDefinition( p ); 17424 } ); 17425 this.attachListOffset = p.Offset16; 17426 lazy$1( this, `attachList`, () => { 17427 if ( this.attachListOffset === 0 ) return undefined; 17428 p.currentPosition = this.tableStart + this.attachListOffset; 17429 return new AttachList( p ); 17430 } ); 17431 this.ligCaretListOffset = p.Offset16; 17432 lazy$1( this, `ligCaretList`, () => { 17433 if ( this.ligCaretListOffset === 0 ) return undefined; 17434 p.currentPosition = this.tableStart + this.ligCaretListOffset; 17435 return new LigCaretList( p ); 17436 } ); 17437 this.markAttachClassDefOffset = p.Offset16; 17438 lazy$1( this, `markAttachClassDef`, () => { 17439 if ( this.markAttachClassDefOffset === 0 ) return undefined; 17440 p.currentPosition = this.tableStart + this.markAttachClassDefOffset; 17441 return new ClassDefinition( p ); 17442 } ); 17443 if ( this.minorVersion >= 2 ) { 17444 this.markGlyphSetsDefOffset = p.Offset16; 17445 lazy$1( this, `markGlyphSetsDef`, () => { 17446 if ( this.markGlyphSetsDefOffset === 0 ) return undefined; 17447 p.currentPosition = 17448 this.tableStart + this.markGlyphSetsDefOffset; 17449 return new MarkGlyphSetsTable( p ); 17450 } ); 17451 } 17452 if ( this.minorVersion === 3 ) { 17453 this.itemVarStoreOffset = p.Offset32; 17454 lazy$1( this, `itemVarStore`, () => { 17455 if ( this.itemVarStoreOffset === 0 ) return undefined; 17456 p.currentPosition = this.tableStart + this.itemVarStoreOffset; 17457 return new ItemVariationStoreTable( p ); 17458 } ); 17459 } 17460 } 17461 } 17462 class AttachList extends ParsedData { 17463 constructor( p ) { 17464 super( p ); 17465 this.coverageOffset = p.Offset16; 17466 this.glyphCount = p.uint16; 17467 this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map( 17468 ( _ ) => p.Offset16 17469 ); 17470 } 17471 getPoint( pointID ) { 17472 this.parser.currentPosition = 17473 this.start + this.attachPointOffsets[ pointID ]; 17474 return new AttachPoint( this.parser ); 17475 } 17476 } 17477 class AttachPoint { 17478 constructor( p ) { 17479 this.pointCount = p.uint16; 17480 this.pointIndices = [ ...new Array( this.pointCount ) ].map( 17481 ( _ ) => p.uint16 17482 ); 17483 } 17484 } 17485 class LigCaretList extends ParsedData { 17486 constructor( p ) { 17487 super( p ); 17488 this.coverageOffset = p.Offset16; 17489 lazy$1( this, `coverage`, () => { 17490 p.currentPosition = this.start + this.coverageOffset; 17491 return new CoverageTable( p ); 17492 } ); 17493 this.ligGlyphCount = p.uint16; 17494 this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map( 17495 ( _ ) => p.Offset16 17496 ); 17497 } 17498 getLigGlyph( ligGlyphID ) { 17499 this.parser.currentPosition = 17500 this.start + this.ligGlyphOffsets[ ligGlyphID ]; 17501 return new LigGlyph( this.parser ); 17502 } 17503 } 17504 class LigGlyph extends ParsedData { 17505 constructor( p ) { 17506 super( p ); 17507 this.caretCount = p.uint16; 17508 this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map( 17509 ( _ ) => p.Offset16 17510 ); 17511 } 17512 getCaretValue( caretID ) { 17513 this.parser.currentPosition = 17514 this.start + this.caretValueOffsets[ caretID ]; 17515 return new CaretValue( this.parser ); 17516 } 17517 } 17518 class CaretValue { 17519 constructor( p ) { 17520 this.caretValueFormat = p.uint16; 17521 if ( this.caretValueFormat === 1 ) { 17522 this.coordinate = p.int16; 17523 } 17524 if ( this.caretValueFormat === 2 ) { 17525 this.caretValuePointIndex = p.uint16; 17526 } 17527 if ( this.caretValueFormat === 3 ) { 17528 this.coordinate = p.int16; 17529 this.deviceOffset = p.Offset16; 17530 } 17531 } 17532 } 17533 class MarkGlyphSetsTable extends ParsedData { 17534 constructor( p ) { 17535 super( p ); 17536 this.markGlyphSetTableFormat = p.uint16; 17537 this.markGlyphSetCount = p.uint16; 17538 this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map( 17539 ( _ ) => p.Offset32 17540 ); 17541 } 17542 getMarkGlyphSet( markGlyphSetID ) { 17543 this.parser.currentPosition = 17544 this.start + this.coverageOffsets[ markGlyphSetID ]; 17545 return new CoverageTable( this.parser ); 17546 } 17547 } 17548 var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } ); 17549 class ScriptList extends ParsedData { 17550 static EMPTY = { scriptCount: 0, scriptRecords: [] }; 17551 constructor( p ) { 17552 super( p ); 17553 this.scriptCount = p.uint16; 17554 this.scriptRecords = [ ...new Array( this.scriptCount ) ].map( 17555 ( _ ) => new ScriptRecord( p ) 17556 ); 17557 } 17558 } 17559 class ScriptRecord { 17560 constructor( p ) { 17561 this.scriptTag = p.tag; 17562 this.scriptOffset = p.Offset16; 17563 } 17564 } 17565 class ScriptTable extends ParsedData { 17566 constructor( p ) { 17567 super( p ); 17568 this.defaultLangSys = p.Offset16; 17569 this.langSysCount = p.uint16; 17570 this.langSysRecords = [ ...new Array( this.langSysCount ) ].map( 17571 ( _ ) => new LangSysRecord( p ) 17572 ); 17573 } 17574 } 17575 class LangSysRecord { 17576 constructor( p ) { 17577 this.langSysTag = p.tag; 17578 this.langSysOffset = p.Offset16; 17579 } 17580 } 17581 class LangSysTable { 17582 constructor( p ) { 17583 this.lookupOrder = p.Offset16; 17584 this.requiredFeatureIndex = p.uint16; 17585 this.featureIndexCount = p.uint16; 17586 this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map( 17587 ( _ ) => p.uint16 17588 ); 17589 } 17590 } 17591 class FeatureList extends ParsedData { 17592 static EMPTY = { featureCount: 0, featureRecords: [] }; 17593 constructor( p ) { 17594 super( p ); 17595 this.featureCount = p.uint16; 17596 this.featureRecords = [ ...new Array( this.featureCount ) ].map( 17597 ( _ ) => new FeatureRecord( p ) 17598 ); 17599 } 17600 } 17601 class FeatureRecord { 17602 constructor( p ) { 17603 this.featureTag = p.tag; 17604 this.featureOffset = p.Offset16; 17605 } 17606 } 17607 class FeatureTable extends ParsedData { 17608 constructor( p ) { 17609 super( p ); 17610 this.featureParams = p.Offset16; 17611 this.lookupIndexCount = p.uint16; 17612 this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map( 17613 ( _ ) => p.uint16 17614 ); 17615 } 17616 getFeatureParams() { 17617 if ( this.featureParams > 0 ) { 17618 const p = this.parser; 17619 p.currentPosition = this.start + this.featureParams; 17620 const tag = this.featureTag; 17621 if ( tag === `size` ) return new Size( p ); 17622 if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p ); 17623 if ( tag.startsWith( `ss` ) ) return new StylisticSet( p ); 17624 } 17625 } 17626 } 17627 class CharacterVariant { 17628 constructor( p ) { 17629 this.format = p.uint16; 17630 this.featUiLabelNameId = p.uint16; 17631 this.featUiTooltipTextNameId = p.uint16; 17632 this.sampleTextNameId = p.uint16; 17633 this.numNamedParameters = p.uint16; 17634 this.firstParamUiLabelNameId = p.uint16; 17635 this.charCount = p.uint16; 17636 this.character = [ ...new Array( this.charCount ) ].map( 17637 ( _ ) => p.uint24 17638 ); 17639 } 17640 } 17641 class Size { 17642 constructor( p ) { 17643 this.designSize = p.uint16; 17644 this.subfamilyIdentifier = p.uint16; 17645 this.subfamilyNameID = p.uint16; 17646 this.smallEnd = p.uint16; 17647 this.largeEnd = p.uint16; 17648 } 17649 } 17650 class StylisticSet { 17651 constructor( p ) { 17652 this.version = p.uint16; 17653 this.UINameID = p.uint16; 17654 } 17655 } 17656 function undoCoverageOffsetParsing( instance ) { 17657 instance.parser.currentPosition -= 2; 17658 delete instance.coverageOffset; 17659 delete instance.getCoverageTable; 17660 } 17661 class LookupType$1 extends ParsedData { 17662 constructor( p ) { 17663 super( p ); 17664 this.substFormat = p.uint16; 17665 this.coverageOffset = p.Offset16; 17666 } 17667 getCoverageTable() { 17668 let p = this.parser; 17669 p.currentPosition = this.start + this.coverageOffset; 17670 return new CoverageTable( p ); 17671 } 17672 } 17673 class SubstLookupRecord { 17674 constructor( p ) { 17675 this.glyphSequenceIndex = p.uint16; 17676 this.lookupListIndex = p.uint16; 17677 } 17678 } 17679 class LookupType1$1 extends LookupType$1 { 17680 constructor( p ) { 17681 super( p ); 17682 this.deltaGlyphID = p.int16; 17683 } 17684 } 17685 class LookupType2$1 extends LookupType$1 { 17686 constructor( p ) { 17687 super( p ); 17688 this.sequenceCount = p.uint16; 17689 this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map( 17690 ( _ ) => p.Offset16 17691 ); 17692 } 17693 getSequence( index ) { 17694 let p = this.parser; 17695 p.currentPosition = this.start + this.sequenceOffsets[ index ]; 17696 return new SequenceTable( p ); 17697 } 17698 } 17699 class SequenceTable { 17700 constructor( p ) { 17701 this.glyphCount = p.uint16; 17702 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 17703 ( _ ) => p.uint16 17704 ); 17705 } 17706 } 17707 class LookupType3$1 extends LookupType$1 { 17708 constructor( p ) { 17709 super( p ); 17710 this.alternateSetCount = p.uint16; 17711 this.alternateSetOffsets = [ 17712 ...new Array( this.alternateSetCount ), 17713 ].map( ( _ ) => p.Offset16 ); 17714 } 17715 getAlternateSet( index ) { 17716 let p = this.parser; 17717 p.currentPosition = this.start + this.alternateSetOffsets[ index ]; 17718 return new AlternateSetTable( p ); 17719 } 17720 } 17721 class AlternateSetTable { 17722 constructor( p ) { 17723 this.glyphCount = p.uint16; 17724 this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 17725 ( _ ) => p.uint16 17726 ); 17727 } 17728 } 17729 class LookupType4$1 extends LookupType$1 { 17730 constructor( p ) { 17731 super( p ); 17732 this.ligatureSetCount = p.uint16; 17733 this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map( 17734 ( _ ) => p.Offset16 17735 ); 17736 } 17737 getLigatureSet( index ) { 17738 let p = this.parser; 17739 p.currentPosition = this.start + this.ligatureSetOffsets[ index ]; 17740 return new LigatureSetTable( p ); 17741 } 17742 } 17743 class LigatureSetTable extends ParsedData { 17744 constructor( p ) { 17745 super( p ); 17746 this.ligatureCount = p.uint16; 17747 this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map( 17748 ( _ ) => p.Offset16 17749 ); 17750 } 17751 getLigature( index ) { 17752 let p = this.parser; 17753 p.currentPosition = this.start + this.ligatureOffsets[ index ]; 17754 return new LigatureTable( p ); 17755 } 17756 } 17757 class LigatureTable { 17758 constructor( p ) { 17759 this.ligatureGlyph = p.uint16; 17760 this.componentCount = p.uint16; 17761 this.componentGlyphIDs = [ 17762 ...new Array( this.componentCount - 1 ), 17763 ].map( ( _ ) => p.uint16 ); 17764 } 17765 } 17766 class LookupType5$1 extends LookupType$1 { 17767 constructor( p ) { 17768 super( p ); 17769 if ( this.substFormat === 1 ) { 17770 this.subRuleSetCount = p.uint16; 17771 this.subRuleSetOffsets = [ 17772 ...new Array( this.subRuleSetCount ), 17773 ].map( ( _ ) => p.Offset16 ); 17774 } 17775 if ( this.substFormat === 2 ) { 17776 this.classDefOffset = p.Offset16; 17777 this.subClassSetCount = p.uint16; 17778 this.subClassSetOffsets = [ 17779 ...new Array( this.subClassSetCount ), 17780 ].map( ( _ ) => p.Offset16 ); 17781 } 17782 if ( this.substFormat === 3 ) { 17783 undoCoverageOffsetParsing( this ); 17784 this.glyphCount = p.uint16; 17785 this.substitutionCount = p.uint16; 17786 this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map( 17787 ( _ ) => p.Offset16 17788 ); 17789 this.substLookupRecords = [ 17790 ...new Array( this.substitutionCount ), 17791 ].map( ( _ ) => new SubstLookupRecord( p ) ); 17792 } 17793 } 17794 getSubRuleSet( index ) { 17795 if ( this.substFormat !== 1 ) 17796 throw new Error( 17797 `lookup type 5.${ this.substFormat } has no subrule sets.` 17798 ); 17799 let p = this.parser; 17800 p.currentPosition = this.start + this.subRuleSetOffsets[ index ]; 17801 return new SubRuleSetTable( p ); 17802 } 17803 getSubClassSet( index ) { 17804 if ( this.substFormat !== 2 ) 17805 throw new Error( 17806 `lookup type 5.${ this.substFormat } has no subclass sets.` 17807 ); 17808 let p = this.parser; 17809 p.currentPosition = this.start + this.subClassSetOffsets[ index ]; 17810 return new SubClassSetTable( p ); 17811 } 17812 getCoverageTable( index ) { 17813 if ( this.substFormat !== 3 && ! index ) 17814 return super.getCoverageTable(); 17815 if ( ! index ) 17816 throw new Error( 17817 `lookup type 5.${ this.substFormat } requires an coverage table index.` 17818 ); 17819 let p = this.parser; 17820 p.currentPosition = this.start + this.coverageOffsets[ index ]; 17821 return new CoverageTable( p ); 17822 } 17823 } 17824 class SubRuleSetTable extends ParsedData { 17825 constructor( p ) { 17826 super( p ); 17827 this.subRuleCount = p.uint16; 17828 this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map( 17829 ( _ ) => p.Offset16 17830 ); 17831 } 17832 getSubRule( index ) { 17833 let p = this.parser; 17834 p.currentPosition = this.start + this.subRuleOffsets[ index ]; 17835 return new SubRuleTable( p ); 17836 } 17837 } 17838 class SubRuleTable { 17839 constructor( p ) { 17840 this.glyphCount = p.uint16; 17841 this.substitutionCount = p.uint16; 17842 this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map( 17843 ( _ ) => p.uint16 17844 ); 17845 this.substLookupRecords = [ 17846 ...new Array( this.substitutionCount ), 17847 ].map( ( _ ) => new SubstLookupRecord( p ) ); 17848 } 17849 } 17850 class SubClassSetTable extends ParsedData { 17851 constructor( p ) { 17852 super( p ); 17853 this.subClassRuleCount = p.uint16; 17854 this.subClassRuleOffsets = [ 17855 ...new Array( this.subClassRuleCount ), 17856 ].map( ( _ ) => p.Offset16 ); 17857 } 17858 getSubClass( index ) { 17859 let p = this.parser; 17860 p.currentPosition = this.start + this.subClassRuleOffsets[ index ]; 17861 return new SubClassRuleTable( p ); 17862 } 17863 } 17864 class SubClassRuleTable extends SubRuleTable { 17865 constructor( p ) { 17866 super( p ); 17867 } 17868 } 17869 class LookupType6$1 extends LookupType$1 { 17870 constructor( p ) { 17871 super( p ); 17872 if ( this.substFormat === 1 ) { 17873 this.chainSubRuleSetCount = p.uint16; 17874 this.chainSubRuleSetOffsets = [ 17875 ...new Array( this.chainSubRuleSetCount ), 17876 ].map( ( _ ) => p.Offset16 ); 17877 } 17878 if ( this.substFormat === 2 ) { 17879 this.backtrackClassDefOffset = p.Offset16; 17880 this.inputClassDefOffset = p.Offset16; 17881 this.lookaheadClassDefOffset = p.Offset16; 17882 this.chainSubClassSetCount = p.uint16; 17883 this.chainSubClassSetOffsets = [ 17884 ...new Array( this.chainSubClassSetCount ), 17885 ].map( ( _ ) => p.Offset16 ); 17886 } 17887 if ( this.substFormat === 3 ) { 17888 undoCoverageOffsetParsing( this ); 17889 this.backtrackGlyphCount = p.uint16; 17890 this.backtrackCoverageOffsets = [ 17891 ...new Array( this.backtrackGlyphCount ), 17892 ].map( ( _ ) => p.Offset16 ); 17893 this.inputGlyphCount = p.uint16; 17894 this.inputCoverageOffsets = [ 17895 ...new Array( this.inputGlyphCount ), 17896 ].map( ( _ ) => p.Offset16 ); 17897 this.lookaheadGlyphCount = p.uint16; 17898 this.lookaheadCoverageOffsets = [ 17899 ...new Array( this.lookaheadGlyphCount ), 17900 ].map( ( _ ) => p.Offset16 ); 17901 this.seqLookupCount = p.uint16; 17902 this.seqLookupRecords = [ 17903 ...new Array( this.substitutionCount ), 17904 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 17905 } 17906 } 17907 getChainSubRuleSet( index ) { 17908 if ( this.substFormat !== 1 ) 17909 throw new Error( 17910 `lookup type 6.${ this.substFormat } has no chainsubrule sets.` 17911 ); 17912 let p = this.parser; 17913 p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ]; 17914 return new ChainSubRuleSetTable( p ); 17915 } 17916 getChainSubClassSet( index ) { 17917 if ( this.substFormat !== 2 ) 17918 throw new Error( 17919 `lookup type 6.${ this.substFormat } has no chainsubclass sets.` 17920 ); 17921 let p = this.parser; 17922 p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ]; 17923 return new ChainSubClassSetTable( p ); 17924 } 17925 getCoverageFromOffset( offset ) { 17926 if ( this.substFormat !== 3 ) 17927 throw new Error( 17928 `lookup type 6.${ this.substFormat } does not use contextual coverage offsets.` 17929 ); 17930 let p = this.parser; 17931 p.currentPosition = this.start + offset; 17932 return new CoverageTable( p ); 17933 } 17934 } 17935 class ChainSubRuleSetTable extends ParsedData { 17936 constructor( p ) { 17937 super( p ); 17938 this.chainSubRuleCount = p.uint16; 17939 this.chainSubRuleOffsets = [ 17940 ...new Array( this.chainSubRuleCount ), 17941 ].map( ( _ ) => p.Offset16 ); 17942 } 17943 getSubRule( index ) { 17944 let p = this.parser; 17945 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 17946 return new ChainSubRuleTable( p ); 17947 } 17948 } 17949 class ChainSubRuleTable { 17950 constructor( p ) { 17951 this.backtrackGlyphCount = p.uint16; 17952 this.backtrackSequence = [ 17953 ...new Array( this.backtrackGlyphCount ), 17954 ].map( ( _ ) => p.uint16 ); 17955 this.inputGlyphCount = p.uint16; 17956 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 17957 ( _ ) => p.uint16 17958 ); 17959 this.lookaheadGlyphCount = p.uint16; 17960 this.lookAheadSequence = [ 17961 ...new Array( this.lookAheadGlyphCount ), 17962 ].map( ( _ ) => p.uint16 ); 17963 this.substitutionCount = p.uint16; 17964 this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map( 17965 ( _ ) => new SubstLookupRecord( p ) 17966 ); 17967 } 17968 } 17969 class ChainSubClassSetTable extends ParsedData { 17970 constructor( p ) { 17971 super( p ); 17972 this.chainSubClassRuleCount = p.uint16; 17973 this.chainSubClassRuleOffsets = [ 17974 ...new Array( this.chainSubClassRuleCount ), 17975 ].map( ( _ ) => p.Offset16 ); 17976 } 17977 getSubClass( index ) { 17978 let p = this.parser; 17979 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 17980 return new ChainSubClassRuleTable( p ); 17981 } 17982 } 17983 class ChainSubClassRuleTable { 17984 constructor( p ) { 17985 this.backtrackGlyphCount = p.uint16; 17986 this.backtrackSequence = [ 17987 ...new Array( this.backtrackGlyphCount ), 17988 ].map( ( _ ) => p.uint16 ); 17989 this.inputGlyphCount = p.uint16; 17990 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 17991 ( _ ) => p.uint16 17992 ); 17993 this.lookaheadGlyphCount = p.uint16; 17994 this.lookAheadSequence = [ 17995 ...new Array( this.lookAheadGlyphCount ), 17996 ].map( ( _ ) => p.uint16 ); 17997 this.substitutionCount = p.uint16; 17998 this.substLookupRecords = [ 17999 ...new Array( this.substitutionCount ), 18000 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 18001 } 18002 } 18003 class SequenceLookupRecord extends ParsedData { 18004 constructor( p ) { 18005 super( p ); 18006 this.sequenceIndex = p.uint16; 18007 this.lookupListIndex = p.uint16; 18008 } 18009 } 18010 class LookupType7$1 extends ParsedData { 18011 constructor( p ) { 18012 super( p ); 18013 this.substFormat = p.uint16; 18014 this.extensionLookupType = p.uint16; 18015 this.extensionOffset = p.Offset32; 18016 } 18017 } 18018 class LookupType8$1 extends LookupType$1 { 18019 constructor( p ) { 18020 super( p ); 18021 this.backtrackGlyphCount = p.uint16; 18022 this.backtrackCoverageOffsets = [ 18023 ...new Array( this.backtrackGlyphCount ), 18024 ].map( ( _ ) => p.Offset16 ); 18025 this.lookaheadGlyphCount = p.uint16; 18026 this.lookaheadCoverageOffsets = [ 18027 new Array( this.lookaheadGlyphCount ), 18028 ].map( ( _ ) => p.Offset16 ); 18029 this.glyphCount = p.uint16; 18030 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 18031 ( _ ) => p.uint16 18032 ); 18033 } 18034 } 18035 var GSUBtables = { 18036 buildSubtable: function ( type, p ) { 18037 const subtable = new [ 18038 undefined, 18039 LookupType1$1, 18040 LookupType2$1, 18041 LookupType3$1, 18042 LookupType4$1, 18043 LookupType5$1, 18044 LookupType6$1, 18045 LookupType7$1, 18046 LookupType8$1, 18047 ][ type ]( p ); 18048 subtable.type = type; 18049 return subtable; 18050 }, 18051 }; 18052 class LookupType extends ParsedData { 18053 constructor( p ) { 18054 super( p ); 18055 } 18056 } 18057 class LookupType1 extends LookupType { 18058 constructor( p ) { 18059 super( p ); 18060 console.log( `lookup type 1` ); 18061 } 18062 } 18063 class LookupType2 extends LookupType { 18064 constructor( p ) { 18065 super( p ); 18066 console.log( `lookup type 2` ); 18067 } 18068 } 18069 class LookupType3 extends LookupType { 18070 constructor( p ) { 18071 super( p ); 18072 console.log( `lookup type 3` ); 18073 } 18074 } 18075 class LookupType4 extends LookupType { 18076 constructor( p ) { 18077 super( p ); 18078 console.log( `lookup type 4` ); 18079 } 18080 } 18081 class LookupType5 extends LookupType { 18082 constructor( p ) { 18083 super( p ); 18084 console.log( `lookup type 5` ); 18085 } 18086 } 18087 class LookupType6 extends LookupType { 18088 constructor( p ) { 18089 super( p ); 18090 console.log( `lookup type 6` ); 18091 } 18092 } 18093 class LookupType7 extends LookupType { 18094 constructor( p ) { 18095 super( p ); 18096 console.log( `lookup type 7` ); 18097 } 18098 } 18099 class LookupType8 extends LookupType { 18100 constructor( p ) { 18101 super( p ); 18102 console.log( `lookup type 8` ); 18103 } 18104 } 18105 class LookupType9 extends LookupType { 18106 constructor( p ) { 18107 super( p ); 18108 console.log( `lookup type 9` ); 18109 } 18110 } 18111 var GPOStables = { 18112 buildSubtable: function ( type, p ) { 18113 const subtable = new [ 18114 undefined, 18115 LookupType1, 18116 LookupType2, 18117 LookupType3, 18118 LookupType4, 18119 LookupType5, 18120 LookupType6, 18121 LookupType7, 18122 LookupType8, 18123 LookupType9, 18124 ][ type ]( p ); 18125 subtable.type = type; 18126 return subtable; 18127 }, 18128 }; 18129 class LookupList extends ParsedData { 18130 static EMPTY = { lookupCount: 0, lookups: [] }; 18131 constructor( p ) { 18132 super( p ); 18133 this.lookupCount = p.uint16; 18134 this.lookups = [ ...new Array( this.lookupCount ) ].map( 18135 ( _ ) => p.Offset16 18136 ); 18137 } 18138 } 18139 class LookupTable extends ParsedData { 18140 constructor( p, type ) { 18141 super( p ); 18142 this.ctType = type; 18143 this.lookupType = p.uint16; 18144 this.lookupFlag = p.uint16; 18145 this.subTableCount = p.uint16; 18146 this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map( 18147 ( _ ) => p.Offset16 18148 ); 18149 this.markFilteringSet = p.uint16; 18150 } 18151 get rightToLeft() { 18152 return this.lookupFlag & ( 1 === 1 ); 18153 } 18154 get ignoreBaseGlyphs() { 18155 return this.lookupFlag & ( 2 === 2 ); 18156 } 18157 get ignoreLigatures() { 18158 return this.lookupFlag & ( 4 === 4 ); 18159 } 18160 get ignoreMarks() { 18161 return this.lookupFlag & ( 8 === 8 ); 18162 } 18163 get useMarkFilteringSet() { 18164 return this.lookupFlag & ( 16 === 16 ); 18165 } 18166 get markAttachmentType() { 18167 return this.lookupFlag & ( 65280 === 65280 ); 18168 } 18169 getSubTable( index ) { 18170 const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; 18171 this.parser.currentPosition = 18172 this.start + this.subtableOffsets[ index ]; 18173 return builder.buildSubtable( this.lookupType, this.parser ); 18174 } 18175 } 18176 class CommonLayoutTable extends SimpleTable { 18177 constructor( dict, dataview, name ) { 18178 const { p: p, tableStart: tableStart } = super( dict, dataview, name ); 18179 this.majorVersion = p.uint16; 18180 this.minorVersion = p.uint16; 18181 this.scriptListOffset = p.Offset16; 18182 this.featureListOffset = p.Offset16; 18183 this.lookupListOffset = p.Offset16; 18184 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 18185 this.featureVariationsOffset = p.Offset32; 18186 } 18187 const no_content = ! ( 18188 this.scriptListOffset || 18189 this.featureListOffset || 18190 this.lookupListOffset 18191 ); 18192 lazy$1( this, `scriptList`, () => { 18193 if ( no_content ) return ScriptList.EMPTY; 18194 p.currentPosition = tableStart + this.scriptListOffset; 18195 return new ScriptList( p ); 18196 } ); 18197 lazy$1( this, `featureList`, () => { 18198 if ( no_content ) return FeatureList.EMPTY; 18199 p.currentPosition = tableStart + this.featureListOffset; 18200 return new FeatureList( p ); 18201 } ); 18202 lazy$1( this, `lookupList`, () => { 18203 if ( no_content ) return LookupList.EMPTY; 18204 p.currentPosition = tableStart + this.lookupListOffset; 18205 return new LookupList( p ); 18206 } ); 18207 if ( this.featureVariationsOffset ) { 18208 lazy$1( this, `featureVariations`, () => { 18209 if ( no_content ) return FeatureVariations.EMPTY; 18210 p.currentPosition = tableStart + this.featureVariationsOffset; 18211 return new FeatureVariations( p ); 18212 } ); 18213 } 18214 } 18215 getSupportedScripts() { 18216 return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag ); 18217 } 18218 getScriptTable( scriptTag ) { 18219 let record = this.scriptList.scriptRecords.find( 18220 ( r ) => r.scriptTag === scriptTag 18221 ); 18222 this.parser.currentPosition = 18223 this.scriptList.start + record.scriptOffset; 18224 let table = new ScriptTable( this.parser ); 18225 table.scriptTag = scriptTag; 18226 return table; 18227 } 18228 ensureScriptTable( arg ) { 18229 if ( typeof arg === 'string' ) { 18230 return this.getScriptTable( arg ); 18231 } 18232 return arg; 18233 } 18234 getSupportedLangSys( scriptTable ) { 18235 scriptTable = this.ensureScriptTable( scriptTable ); 18236 const hasDefault = scriptTable.defaultLangSys !== 0; 18237 const supported = scriptTable.langSysRecords.map( 18238 ( l ) => l.langSysTag 18239 ); 18240 if ( hasDefault ) supported.unshift( `dflt` ); 18241 return supported; 18242 } 18243 getDefaultLangSysTable( scriptTable ) { 18244 scriptTable = this.ensureScriptTable( scriptTable ); 18245 let offset = scriptTable.defaultLangSys; 18246 if ( offset !== 0 ) { 18247 this.parser.currentPosition = scriptTable.start + offset; 18248 let table = new LangSysTable( this.parser ); 18249 table.langSysTag = ``; 18250 table.defaultForScript = scriptTable.scriptTag; 18251 return table; 18252 } 18253 } 18254 getLangSysTable( scriptTable, langSysTag = `dflt` ) { 18255 if ( langSysTag === `dflt` ) 18256 return this.getDefaultLangSysTable( scriptTable ); 18257 scriptTable = this.ensureScriptTable( scriptTable ); 18258 let record = scriptTable.langSysRecords.find( 18259 ( l ) => l.langSysTag === langSysTag 18260 ); 18261 this.parser.currentPosition = scriptTable.start + record.langSysOffset; 18262 let table = new LangSysTable( this.parser ); 18263 table.langSysTag = langSysTag; 18264 return table; 18265 } 18266 getFeatures( langSysTable ) { 18267 return langSysTable.featureIndices.map( ( index ) => 18268 this.getFeature( index ) 18269 ); 18270 } 18271 getFeature( indexOrTag ) { 18272 let record; 18273 if ( parseInt( indexOrTag ) == indexOrTag ) { 18274 record = this.featureList.featureRecords[ indexOrTag ]; 18275 } else { 18276 record = this.featureList.featureRecords.find( 18277 ( f ) => f.featureTag === indexOrTag 18278 ); 18279 } 18280 if ( ! record ) return; 18281 this.parser.currentPosition = 18282 this.featureList.start + record.featureOffset; 18283 let table = new FeatureTable( this.parser ); 18284 table.featureTag = record.featureTag; 18285 return table; 18286 } 18287 getLookups( featureTable ) { 18288 return featureTable.lookupListIndices.map( ( index ) => 18289 this.getLookup( index ) 18290 ); 18291 } 18292 getLookup( lookupIndex, type ) { 18293 let lookupOffset = this.lookupList.lookups[ lookupIndex ]; 18294 this.parser.currentPosition = this.lookupList.start + lookupOffset; 18295 return new LookupTable( this.parser, type ); 18296 } 18297 } 18298 class GSUB extends CommonLayoutTable { 18299 constructor( dict, dataview ) { 18300 super( dict, dataview, `GSUB` ); 18301 } 18302 getLookup( lookupIndex ) { 18303 return super.getLookup( lookupIndex, `GSUB` ); 18304 } 18305 } 18306 var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } ); 18307 class GPOS extends CommonLayoutTable { 18308 constructor( dict, dataview ) { 18309 super( dict, dataview, `GPOS` ); 18310 } 18311 getLookup( lookupIndex ) { 18312 return super.getLookup( lookupIndex, `GPOS` ); 18313 } 18314 } 18315 var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } ); 18316 class SVG extends SimpleTable { 18317 constructor( dict, dataview ) { 18318 const { p: p } = super( dict, dataview ); 18319 this.version = p.uint16; 18320 this.offsetToSVGDocumentList = p.Offset32; 18321 p.currentPosition = this.tableStart + this.offsetToSVGDocumentList; 18322 this.documentList = new SVGDocumentList( p ); 18323 } 18324 } 18325 class SVGDocumentList extends ParsedData { 18326 constructor( p ) { 18327 super( p ); 18328 this.numEntries = p.uint16; 18329 this.documentRecords = [ ...new Array( this.numEntries ) ].map( 18330 ( _ ) => new SVGDocumentRecord( p ) 18331 ); 18332 } 18333 getDocument( documentID ) { 18334 let record = this.documentRecords[ documentID ]; 18335 if ( ! record ) return ''; 18336 let offset = this.start + record.svgDocOffset; 18337 this.parser.currentPosition = offset; 18338 return this.parser.readBytes( record.svgDocLength ); 18339 } 18340 getDocumentForGlyph( glyphID ) { 18341 let id = this.documentRecords.findIndex( 18342 ( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID 18343 ); 18344 if ( id === -1 ) return ''; 18345 return this.getDocument( id ); 18346 } 18347 } 18348 class SVGDocumentRecord { 18349 constructor( p ) { 18350 this.startGlyphID = p.uint16; 18351 this.endGlyphID = p.uint16; 18352 this.svgDocOffset = p.Offset32; 18353 this.svgDocLength = p.uint32; 18354 } 18355 } 18356 var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } ); 18357 class fvar extends SimpleTable { 18358 constructor( dict, dataview ) { 18359 const { p: p } = super( dict, dataview ); 18360 this.majorVersion = p.uint16; 18361 this.minorVersion = p.uint16; 18362 this.axesArrayOffset = p.Offset16; 18363 p.uint16; 18364 this.axisCount = p.uint16; 18365 this.axisSize = p.uint16; 18366 this.instanceCount = p.uint16; 18367 this.instanceSize = p.uint16; 18368 const axisStart = this.tableStart + this.axesArrayOffset; 18369 lazy$1( this, `axes`, () => { 18370 p.currentPosition = axisStart; 18371 return [ ...new Array( this.axisCount ) ].map( 18372 ( _ ) => new VariationAxisRecord( p ) 18373 ); 18374 } ); 18375 const instanceStart = axisStart + this.axisCount * this.axisSize; 18376 lazy$1( this, `instances`, () => { 18377 let instances = []; 18378 for ( let i = 0; i < this.instanceCount; i++ ) { 18379 p.currentPosition = instanceStart + i * this.instanceSize; 18380 instances.push( 18381 new InstanceRecord( p, this.axisCount, this.instanceSize ) 18382 ); 18383 } 18384 return instances; 18385 } ); 18386 } 18387 getSupportedAxes() { 18388 return this.axes.map( ( a ) => a.tag ); 18389 } 18390 getAxis( name ) { 18391 return this.axes.find( ( a ) => a.tag === name ); 18392 } 18393 } 18394 class VariationAxisRecord { 18395 constructor( p ) { 18396 this.tag = p.tag; 18397 this.minValue = p.fixed; 18398 this.defaultValue = p.fixed; 18399 this.maxValue = p.fixed; 18400 this.flags = p.flags( 16 ); 18401 this.axisNameID = p.uint16; 18402 } 18403 } 18404 class InstanceRecord { 18405 constructor( p, axisCount, size ) { 18406 let start = p.currentPosition; 18407 this.subfamilyNameID = p.uint16; 18408 p.uint16; 18409 this.coordinates = [ ...new Array( axisCount ) ].map( 18410 ( _ ) => p.fixed 18411 ); 18412 if ( p.currentPosition - start < size ) { 18413 this.postScriptNameID = p.uint16; 18414 } 18415 } 18416 } 18417 var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } ); 18418 class cvt extends SimpleTable { 18419 constructor( dict, dataview ) { 18420 const { p: p } = super( dict, dataview ); 18421 const n = dict.length / 2; 18422 lazy$1( this, `items`, () => 18423 [ ...new Array( n ) ].map( ( _ ) => p.fword ) 18424 ); 18425 } 18426 } 18427 var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } ); 18428 class fpgm extends SimpleTable { 18429 constructor( dict, dataview ) { 18430 const { p: p } = super( dict, dataview ); 18431 lazy$1( this, `instructions`, () => 18432 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 18433 ); 18434 } 18435 } 18436 var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } ); 18437 class gasp extends SimpleTable { 18438 constructor( dict, dataview ) { 18439 const { p: p } = super( dict, dataview ); 18440 this.version = p.uint16; 18441 this.numRanges = p.uint16; 18442 const getter = () => 18443 [ ...new Array( this.numRanges ) ].map( 18444 ( _ ) => new GASPRange( p ) 18445 ); 18446 lazy$1( this, `gaspRanges`, getter ); 18447 } 18448 } 18449 class GASPRange { 18450 constructor( p ) { 18451 this.rangeMaxPPEM = p.uint16; 18452 this.rangeGaspBehavior = p.uint16; 18453 } 18454 } 18455 var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } ); 18456 class glyf extends SimpleTable { 18457 constructor( dict, dataview ) { 18458 super( dict, dataview ); 18459 } 18460 getGlyphData( offset, length ) { 18461 this.parser.currentPosition = this.tableStart + offset; 18462 return this.parser.readBytes( length ); 18463 } 18464 } 18465 var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } ); 18466 class loca extends SimpleTable { 18467 constructor( dict, dataview, tables ) { 18468 const { p: p } = super( dict, dataview ); 18469 const n = tables.maxp.numGlyphs + 1; 18470 if ( tables.head.indexToLocFormat === 0 ) { 18471 this.x2 = true; 18472 lazy$1( this, `offsets`, () => 18473 [ ...new Array( n ) ].map( ( _ ) => p.Offset16 ) 18474 ); 18475 } else { 18476 lazy$1( this, `offsets`, () => 18477 [ ...new Array( n ) ].map( ( _ ) => p.Offset32 ) 18478 ); 18479 } 18480 } 18481 getGlyphDataOffsetAndLength( glyphID ) { 18482 let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1; 18483 let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1; 18484 return { offset: offset, length: nextOffset - offset }; 18485 } 18486 } 18487 var loca$1 = Object.freeze( { __proto__: null, loca: loca } ); 18488 class prep extends SimpleTable { 18489 constructor( dict, dataview ) { 18490 const { p: p } = super( dict, dataview ); 18491 lazy$1( this, `instructions`, () => 18492 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 18493 ); 18494 } 18495 } 18496 var prep$1 = Object.freeze( { __proto__: null, prep: prep } ); 18497 class CFF extends SimpleTable { 18498 constructor( dict, dataview ) { 18499 const { p: p } = super( dict, dataview ); 18500 lazy$1( this, `data`, () => p.readBytes() ); 18501 } 18502 } 18503 var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } ); 18504 class CFF2 extends SimpleTable { 18505 constructor( dict, dataview ) { 18506 const { p: p } = super( dict, dataview ); 18507 lazy$1( this, `data`, () => p.readBytes() ); 18508 } 18509 } 18510 var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } ); 18511 class VORG extends SimpleTable { 18512 constructor( dict, dataview ) { 18513 const { p: p } = super( dict, dataview ); 18514 this.majorVersion = p.uint16; 18515 this.minorVersion = p.uint16; 18516 this.defaultVertOriginY = p.int16; 18517 this.numVertOriginYMetrics = p.uint16; 18518 lazy$1( this, `vertORiginYMetrics`, () => 18519 [ ...new Array( this.numVertOriginYMetrics ) ].map( 18520 ( _ ) => new VertOriginYMetric( p ) 18521 ) 18522 ); 18523 } 18524 } 18525 class VertOriginYMetric { 18526 constructor( p ) { 18527 this.glyphIndex = p.uint16; 18528 this.vertOriginY = p.int16; 18529 } 18530 } 18531 var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } ); 18532 class BitmapSize { 18533 constructor( p ) { 18534 this.indexSubTableArrayOffset = p.Offset32; 18535 this.indexTablesSize = p.uint32; 18536 this.numberofIndexSubTables = p.uint32; 18537 this.colorRef = p.uint32; 18538 this.hori = new SbitLineMetrics( p ); 18539 this.vert = new SbitLineMetrics( p ); 18540 this.startGlyphIndex = p.uint16; 18541 this.endGlyphIndex = p.uint16; 18542 this.ppemX = p.uint8; 18543 this.ppemY = p.uint8; 18544 this.bitDepth = p.uint8; 18545 this.flags = p.int8; 18546 } 18547 } 18548 class BitmapScale { 18549 constructor( p ) { 18550 this.hori = new SbitLineMetrics( p ); 18551 this.vert = new SbitLineMetrics( p ); 18552 this.ppemX = p.uint8; 18553 this.ppemY = p.uint8; 18554 this.substitutePpemX = p.uint8; 18555 this.substitutePpemY = p.uint8; 18556 } 18557 } 18558 class SbitLineMetrics { 18559 constructor( p ) { 18560 this.ascender = p.int8; 18561 this.descender = p.int8; 18562 this.widthMax = p.uint8; 18563 this.caretSlopeNumerator = p.int8; 18564 this.caretSlopeDenominator = p.int8; 18565 this.caretOffset = p.int8; 18566 this.minOriginSB = p.int8; 18567 this.minAdvanceSB = p.int8; 18568 this.maxBeforeBL = p.int8; 18569 this.minAfterBL = p.int8; 18570 this.pad1 = p.int8; 18571 this.pad2 = p.int8; 18572 } 18573 } 18574 class EBLC extends SimpleTable { 18575 constructor( dict, dataview, name ) { 18576 const { p: p } = super( dict, dataview, name ); 18577 this.majorVersion = p.uint16; 18578 this.minorVersion = p.uint16; 18579 this.numSizes = p.uint32; 18580 lazy$1( this, `bitMapSizes`, () => 18581 [ ...new Array( this.numSizes ) ].map( 18582 ( _ ) => new BitmapSize( p ) 18583 ) 18584 ); 18585 } 18586 } 18587 var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } ); 18588 class EBDT extends SimpleTable { 18589 constructor( dict, dataview, name ) { 18590 const { p: p } = super( dict, dataview, name ); 18591 this.majorVersion = p.uint16; 18592 this.minorVersion = p.uint16; 18593 } 18594 } 18595 var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } ); 18596 class EBSC extends SimpleTable { 18597 constructor( dict, dataview ) { 18598 const { p: p } = super( dict, dataview ); 18599 this.majorVersion = p.uint16; 18600 this.minorVersion = p.uint16; 18601 this.numSizes = p.uint32; 18602 lazy$1( this, `bitmapScales`, () => 18603 [ ...new Array( this.numSizes ) ].map( 18604 ( _ ) => new BitmapScale( p ) 18605 ) 18606 ); 18607 } 18608 } 18609 var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } ); 18610 class CBLC extends EBLC { 18611 constructor( dict, dataview ) { 18612 super( dict, dataview, `CBLC` ); 18613 } 18614 } 18615 var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } ); 18616 class CBDT extends EBDT { 18617 constructor( dict, dataview ) { 18618 super( dict, dataview, `CBDT` ); 18619 } 18620 } 18621 var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } ); 18622 class sbix extends SimpleTable { 18623 constructor( dict, dataview ) { 18624 const { p: p } = super( dict, dataview ); 18625 this.version = p.uint16; 18626 this.flags = p.flags( 16 ); 18627 this.numStrikes = p.uint32; 18628 lazy$1( this, `strikeOffsets`, () => 18629 [ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 ) 18630 ); 18631 } 18632 } 18633 var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } ); 18634 class COLR extends SimpleTable { 18635 constructor( dict, dataview ) { 18636 const { p: p } = super( dict, dataview ); 18637 this.version = p.uint16; 18638 this.numBaseGlyphRecords = p.uint16; 18639 this.baseGlyphRecordsOffset = p.Offset32; 18640 this.layerRecordsOffset = p.Offset32; 18641 this.numLayerRecords = p.uint16; 18642 } 18643 getBaseGlyphRecord( glyphID ) { 18644 let start = this.tableStart + this.baseGlyphRecordsOffset; 18645 this.parser.currentPosition = start; 18646 let first = new BaseGlyphRecord( this.parser ); 18647 let firstID = first.gID; 18648 let end = this.tableStart + this.layerRecordsOffset - 6; 18649 this.parser.currentPosition = end; 18650 let last = new BaseGlyphRecord( this.parser ); 18651 let lastID = last.gID; 18652 if ( firstID === glyphID ) return first; 18653 if ( lastID === glyphID ) return last; 18654 while ( true ) { 18655 if ( start === end ) break; 18656 let mid = start + ( end - start ) / 12; 18657 this.parser.currentPosition = mid; 18658 let middle = new BaseGlyphRecord( this.parser ); 18659 let midID = middle.gID; 18660 if ( midID === glyphID ) return middle; 18661 else if ( midID > glyphID ) { 18662 end = mid; 18663 } else if ( midID < glyphID ) { 18664 start = mid; 18665 } 18666 } 18667 return false; 18668 } 18669 getLayers( glyphID ) { 18670 let record = this.getBaseGlyphRecord( glyphID ); 18671 this.parser.currentPosition = 18672 this.tableStart + 18673 this.layerRecordsOffset + 18674 4 * record.firstLayerIndex; 18675 return [ ...new Array( record.numLayers ) ].map( 18676 ( _ ) => new LayerRecord( p ) 18677 ); 18678 } 18679 } 18680 class BaseGlyphRecord { 18681 constructor( p ) { 18682 this.gID = p.uint16; 18683 this.firstLayerIndex = p.uint16; 18684 this.numLayers = p.uint16; 18685 } 18686 } 18687 class LayerRecord { 18688 constructor( p ) { 18689 this.gID = p.uint16; 18690 this.paletteIndex = p.uint16; 18691 } 18692 } 18693 var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } ); 18694 class CPAL extends SimpleTable { 18695 constructor( dict, dataview ) { 18696 const { p: p } = super( dict, dataview ); 18697 this.version = p.uint16; 18698 this.numPaletteEntries = p.uint16; 18699 const numPalettes = ( this.numPalettes = p.uint16 ); 18700 this.numColorRecords = p.uint16; 18701 this.offsetFirstColorRecord = p.Offset32; 18702 this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map( 18703 ( _ ) => p.uint16 18704 ); 18705 lazy$1( this, `colorRecords`, () => { 18706 p.currentPosition = this.tableStart + this.offsetFirstColorRecord; 18707 return [ ...new Array( this.numColorRecords ) ].map( 18708 ( _ ) => new ColorRecord( p ) 18709 ); 18710 } ); 18711 if ( this.version === 1 ) { 18712 this.offsetPaletteTypeArray = p.Offset32; 18713 this.offsetPaletteLabelArray = p.Offset32; 18714 this.offsetPaletteEntryLabelArray = p.Offset32; 18715 lazy$1( this, `paletteTypeArray`, () => { 18716 p.currentPosition = 18717 this.tableStart + this.offsetPaletteTypeArray; 18718 return new PaletteTypeArray( p, numPalettes ); 18719 } ); 18720 lazy$1( this, `paletteLabelArray`, () => { 18721 p.currentPosition = 18722 this.tableStart + this.offsetPaletteLabelArray; 18723 return new PaletteLabelsArray( p, numPalettes ); 18724 } ); 18725 lazy$1( this, `paletteEntryLabelArray`, () => { 18726 p.currentPosition = 18727 this.tableStart + this.offsetPaletteEntryLabelArray; 18728 return new PaletteEntryLabelArray( p, numPalettes ); 18729 } ); 18730 } 18731 } 18732 } 18733 class ColorRecord { 18734 constructor( p ) { 18735 this.blue = p.uint8; 18736 this.green = p.uint8; 18737 this.red = p.uint8; 18738 this.alpha = p.uint8; 18739 } 18740 } 18741 class PaletteTypeArray { 18742 constructor( p, numPalettes ) { 18743 this.paletteTypes = [ ...new Array( numPalettes ) ].map( 18744 ( _ ) => p.uint32 18745 ); 18746 } 18747 } 18748 class PaletteLabelsArray { 18749 constructor( p, numPalettes ) { 18750 this.paletteLabels = [ ...new Array( numPalettes ) ].map( 18751 ( _ ) => p.uint16 18752 ); 18753 } 18754 } 18755 class PaletteEntryLabelArray { 18756 constructor( p, numPalettes ) { 18757 this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map( 18758 ( _ ) => p.uint16 18759 ); 18760 } 18761 } 18762 var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } ); 18763 class DSIG extends SimpleTable { 18764 constructor( dict, dataview ) { 18765 const { p: p } = super( dict, dataview ); 18766 this.version = p.uint32; 18767 this.numSignatures = p.uint16; 18768 this.flags = p.uint16; 18769 this.signatureRecords = [ ...new Array( this.numSignatures ) ].map( 18770 ( _ ) => new SignatureRecord( p ) 18771 ); 18772 } 18773 getData( signatureID ) { 18774 const record = this.signatureRecords[ signatureID ]; 18775 this.parser.currentPosition = this.tableStart + record.offset; 18776 return new SignatureBlockFormat1( this.parser ); 18777 } 18778 } 18779 class SignatureRecord { 18780 constructor( p ) { 18781 this.format = p.uint32; 18782 this.length = p.uint32; 18783 this.offset = p.Offset32; 18784 } 18785 } 18786 class SignatureBlockFormat1 { 18787 constructor( p ) { 18788 p.uint16; 18789 p.uint16; 18790 this.signatureLength = p.uint32; 18791 this.signature = p.readBytes( this.signatureLength ); 18792 } 18793 } 18794 var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } ); 18795 class hdmx extends SimpleTable { 18796 constructor( dict, dataview, tables ) { 18797 const { p: p } = super( dict, dataview ); 18798 const numGlyphs = tables.hmtx.numGlyphs; 18799 this.version = p.uint16; 18800 this.numRecords = p.int16; 18801 this.sizeDeviceRecord = p.int32; 18802 this.records = [ ...new Array( numRecords ) ].map( 18803 ( _ ) => new DeviceRecord( p, numGlyphs ) 18804 ); 18805 } 18806 } 18807 class DeviceRecord { 18808 constructor( p, numGlyphs ) { 18809 this.pixelSize = p.uint8; 18810 this.maxWidth = p.uint8; 18811 this.widths = p.readBytes( numGlyphs ); 18812 } 18813 } 18814 var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } ); 18815 class kern extends SimpleTable { 18816 constructor( dict, dataview ) { 18817 const { p: p } = super( dict, dataview ); 18818 this.version = p.uint16; 18819 this.nTables = p.uint16; 18820 lazy$1( this, `tables`, () => { 18821 let offset = this.tableStart + 4; 18822 const tables = []; 18823 for ( let i = 0; i < this.nTables; i++ ) { 18824 p.currentPosition = offset; 18825 let subtable = new KernSubTable( p ); 18826 tables.push( subtable ); 18827 offset += subtable; 18828 } 18829 return tables; 18830 } ); 18831 } 18832 } 18833 class KernSubTable { 18834 constructor( p ) { 18835 this.version = p.uint16; 18836 this.length = p.uint16; 18837 this.coverage = p.flags( 8 ); 18838 this.format = p.uint8; 18839 if ( this.format === 0 ) { 18840 this.nPairs = p.uint16; 18841 this.searchRange = p.uint16; 18842 this.entrySelector = p.uint16; 18843 this.rangeShift = p.uint16; 18844 lazy$1( this, `pairs`, () => 18845 [ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) ) 18846 ); 18847 } 18848 if ( this.format === 2 ) { 18849 console.warn( 18850 `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` 18851 ); 18852 } 18853 } 18854 get horizontal() { 18855 return this.coverage[ 0 ]; 18856 } 18857 get minimum() { 18858 return this.coverage[ 1 ]; 18859 } 18860 get crossstream() { 18861 return this.coverage[ 2 ]; 18862 } 18863 get override() { 18864 return this.coverage[ 3 ]; 18865 } 18866 } 18867 class Pair { 18868 constructor( p ) { 18869 this.left = p.uint16; 18870 this.right = p.uint16; 18871 this.value = p.fword; 18872 } 18873 } 18874 var kern$1 = Object.freeze( { __proto__: null, kern: kern } ); 18875 class LTSH extends SimpleTable { 18876 constructor( dict, dataview ) { 18877 const { p: p } = super( dict, dataview ); 18878 this.version = p.uint16; 18879 this.numGlyphs = p.uint16; 18880 this.yPels = p.readBytes( this.numGlyphs ); 18881 } 18882 } 18883 var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } ); 18884 class MERG extends SimpleTable { 18885 constructor( dict, dataview ) { 18886 const { p: p } = super( dict, dataview ); 18887 this.version = p.uint16; 18888 this.mergeClassCount = p.uint16; 18889 this.mergeDataOffset = p.Offset16; 18890 this.classDefCount = p.uint16; 18891 this.offsetToClassDefOffsets = p.Offset16; 18892 lazy$1( this, `mergeEntryMatrix`, () => 18893 [ ...new Array( this.mergeClassCount ) ].map( ( _ ) => 18894 p.readBytes( this.mergeClassCount ) 18895 ) 18896 ); 18897 console.warn( `Full MERG parsing is currently not supported.` ); 18898 console.warn( 18899 `If you need this table parsed, please file an issue, or better yet, a PR.` 18900 ); 18901 } 18902 } 18903 var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } ); 18904 class meta extends SimpleTable { 18905 constructor( dict, dataview ) { 18906 const { p: p } = super( dict, dataview ); 18907 this.version = p.uint32; 18908 this.flags = p.uint32; 18909 p.uint32; 18910 this.dataMapsCount = p.uint32; 18911 this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map( 18912 ( _ ) => new DataMap( this.tableStart, p ) 18913 ); 18914 } 18915 } 18916 class DataMap { 18917 constructor( tableStart, p ) { 18918 this.tableStart = tableStart; 18919 this.parser = p; 18920 this.tag = p.tag; 18921 this.dataOffset = p.Offset32; 18922 this.dataLength = p.uint32; 18923 } 18924 getData() { 18925 this.parser.currentField = this.tableStart + this.dataOffset; 18926 return this.parser.readBytes( this.dataLength ); 18927 } 18928 } 18929 var meta$1 = Object.freeze( { __proto__: null, meta: meta } ); 18930 class PCLT extends SimpleTable { 18931 constructor( dict, dataview ) { 18932 super( dict, dataview ); 18933 console.warn( 18934 `This font uses a PCLT table, which is currently not supported by this parser.` 18935 ); 18936 console.warn( 18937 `If you need this table parsed, please file an issue, or better yet, a PR.` 18938 ); 18939 } 18940 } 18941 var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } ); 18942 class VDMX extends SimpleTable { 18943 constructor( dict, dataview ) { 18944 const { p: p } = super( dict, dataview ); 18945 this.version = p.uint16; 18946 this.numRecs = p.uint16; 18947 this.numRatios = p.uint16; 18948 this.ratRanges = [ ...new Array( this.numRatios ) ].map( 18949 ( _ ) => new RatioRange( p ) 18950 ); 18951 this.offsets = [ ...new Array( this.numRatios ) ].map( 18952 ( _ ) => p.Offset16 18953 ); 18954 this.VDMXGroups = [ ...new Array( this.numRecs ) ].map( 18955 ( _ ) => new VDMXGroup( p ) 18956 ); 18957 } 18958 } 18959 class RatioRange { 18960 constructor( p ) { 18961 this.bCharSet = p.uint8; 18962 this.xRatio = p.uint8; 18963 this.yStartRatio = p.uint8; 18964 this.yEndRatio = p.uint8; 18965 } 18966 } 18967 class VDMXGroup { 18968 constructor( p ) { 18969 this.recs = p.uint16; 18970 this.startsz = p.uint8; 18971 this.endsz = p.uint8; 18972 this.records = [ ...new Array( this.recs ) ].map( 18973 ( _ ) => new vTable( p ) 18974 ); 18975 } 18976 } 18977 class vTable { 18978 constructor( p ) { 18979 this.yPelHeight = p.uint16; 18980 this.yMax = p.int16; 18981 this.yMin = p.int16; 18982 } 18983 } 18984 var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } ); 18985 class vhea extends SimpleTable { 18986 constructor( dict, dataview ) { 18987 const { p: p } = super( dict, dataview ); 18988 this.version = p.fixed; 18989 this.ascent = this.vertTypoAscender = p.int16; 18990 this.descent = this.vertTypoDescender = p.int16; 18991 this.lineGap = this.vertTypoLineGap = p.int16; 18992 this.advanceHeightMax = p.int16; 18993 this.minTopSideBearing = p.int16; 18994 this.minBottomSideBearing = p.int16; 18995 this.yMaxExtent = p.int16; 18996 this.caretSlopeRise = p.int16; 18997 this.caretSlopeRun = p.int16; 18998 this.caretOffset = p.int16; 18999 this.reserved = p.int16; 19000 this.reserved = p.int16; 19001 this.reserved = p.int16; 19002 this.reserved = p.int16; 19003 this.metricDataFormat = p.int16; 19004 this.numOfLongVerMetrics = p.uint16; 19005 p.verifyLength(); 19006 } 19007 } 19008 var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } ); 19009 class vmtx extends SimpleTable { 19010 constructor( dict, dataview, tables ) { 19011 super( dict, dataview ); 19012 const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; 19013 const numGlyphs = tables.maxp.numGlyphs; 19014 const metricsStart = p.currentPosition; 19015 lazy( this, `vMetrics`, () => { 19016 p.currentPosition = metricsStart; 19017 return [ ...new Array( numOfLongVerMetrics ) ].map( 19018 ( _ ) => new LongVertMetric( p.uint16, p.int16 ) 19019 ); 19020 } ); 19021 if ( numOfLongVerMetrics < numGlyphs ) { 19022 const tsbStart = metricsStart + numOfLongVerMetrics * 4; 19023 lazy( this, `topSideBearings`, () => { 19024 p.currentPosition = tsbStart; 19025 return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map( 19026 ( _ ) => p.int16 19027 ); 19028 } ); 19029 } 19030 } 19031 } 19032 class LongVertMetric { 19033 constructor( h, b ) { 19034 this.advanceHeight = h; 19035 this.topSideBearing = b; 19036 } 19037 } 19038 var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } ); 19039 19040 /* eslint-enable */ 19041 19042 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js 19043 /** 19044 * WordPress dependencies 19045 */ 19046 19047 19048 /** 19049 * Internal dependencies 19050 */ 19051 19052 const { 19053 kebabCase: make_families_from_faces_kebabCase 19054 } = unlock(external_wp_components_namespaceObject.privateApis); 19055 function makeFamiliesFromFaces(fontFaces) { 19056 const fontFamiliesObject = fontFaces.reduce((acc, item) => { 19057 if (!acc[item.fontFamily]) { 19058 acc[item.fontFamily] = { 19059 name: item.fontFamily, 19060 fontFamily: item.fontFamily, 19061 slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()), 19062 fontFace: [] 19063 }; 19064 } 19065 acc[item.fontFamily].fontFace.push(item); 19066 return acc; 19067 }, {}); 19068 return Object.values(fontFamiliesObject); 19069 } 19070 19071 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js 19072 /** 19073 * WordPress dependencies 19074 */ 19075 19076 19077 19078 19079 /** 19080 * Internal dependencies 19081 */ 19082 19083 19084 19085 19086 19087 19088 19089 function UploadFonts() { 19090 const { 19091 installFonts 19092 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19093 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); 19094 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 19095 const handleDropZone = files => { 19096 handleFilesUpload(files); 19097 }; 19098 const onFilesUpload = event => { 19099 handleFilesUpload(event.target.files); 19100 }; 19101 19102 /** 19103 * Filters the selected files to only allow the ones with the allowed extensions 19104 * 19105 * @param {Array} files The files to be filtered 19106 * @return {void} 19107 */ 19108 const handleFilesUpload = async files => { 19109 setNotice(null); 19110 setIsUploading(true); 19111 const uniqueFilenames = new Set(); 19112 const selectedFiles = [...files]; 19113 let hasInvalidFiles = false; 19114 19115 // Use map to create a promise for each file check, then filter with Promise.all. 19116 const checkFilesPromises = selectedFiles.map(async file => { 19117 const isFont = await isFontFile(file); 19118 if (!isFont) { 19119 hasInvalidFiles = true; 19120 return null; // Return null for invalid files. 19121 } 19122 // Check for duplicates 19123 if (uniqueFilenames.has(file.name)) { 19124 return null; // Return null for duplicates. 19125 } 19126 // Check if the file extension is allowed. 19127 const fileExtension = file.name.split('.').pop().toLowerCase(); 19128 if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) { 19129 uniqueFilenames.add(file.name); 19130 return file; // Return the file if it passes all checks. 19131 } 19132 return null; // Return null for disallowed file extensions. 19133 }); 19134 19135 // Filter out the nulls after all promises have resolved. 19136 const allowedFiles = (await Promise.all(checkFilesPromises)).filter(file => null !== file); 19137 if (allowedFiles.length > 0) { 19138 loadFiles(allowedFiles); 19139 } else { 19140 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.'); 19141 setNotice({ 19142 type: 'error', 19143 message 19144 }); 19145 setIsUploading(false); 19146 } 19147 }; 19148 19149 /** 19150 * Loads the selected files and reads the font metadata 19151 * 19152 * @param {Array} files The files to be loaded 19153 * @return {void} 19154 */ 19155 const loadFiles = async files => { 19156 const fontFacesLoaded = await Promise.all(files.map(async fontFile => { 19157 const fontFaceData = await getFontFaceMetadata(fontFile); 19158 await loadFontFaceInBrowser(fontFaceData, fontFaceData.file, 'all'); 19159 return fontFaceData; 19160 })); 19161 handleInstall(fontFacesLoaded); 19162 }; 19163 19164 /** 19165 * Checks if a file is a valid Font file. 19166 * 19167 * @param {File} file The file to be checked. 19168 * @return {boolean} Whether the file is a valid font file. 19169 */ 19170 async function isFontFile(file) { 19171 const font = new Font('Uploaded Font'); 19172 try { 19173 const buffer = await readFileAsArrayBuffer(file); 19174 await font.fromDataBuffer(buffer, 'font'); 19175 return true; 19176 } catch (error) { 19177 return false; 19178 } 19179 } 19180 19181 // Create a function to read the file as array buffer 19182 async function readFileAsArrayBuffer(file) { 19183 return new Promise((resolve, reject) => { 19184 const reader = new window.FileReader(); 19185 reader.readAsArrayBuffer(file); 19186 reader.onload = () => resolve(reader.result); 19187 reader.onerror = reject; 19188 }); 19189 } 19190 const getFontFaceMetadata = async fontFile => { 19191 const buffer = await readFileAsArrayBuffer(fontFile); 19192 const fontObj = new Font('Uploaded Font'); 19193 fontObj.fromDataBuffer(buffer, fontFile.name); 19194 // Assuming that fromDataBuffer triggers onload event and returning a Promise 19195 const onloadEvent = await new Promise(resolve => fontObj.onload = resolve); 19196 const font = onloadEvent.detail.font; 19197 const { 19198 name 19199 } = font.opentype.tables; 19200 const fontName = name.get(16) || name.get(1); 19201 const isItalic = name.get(2).toLowerCase().includes('italic'); 19202 const fontWeight = font.opentype.tables['OS/2'].usWeightClass || 'normal'; 19203 const isVariable = !!font.opentype.tables.fvar; 19204 const weightAxis = isVariable && font.opentype.tables.fvar.axes.find(({ 19205 tag 19206 }) => tag === 'wght'); 19207 const weightRange = weightAxis ? `$weightAxis.minValue} $weightAxis.maxValue}` : null; 19208 return { 19209 file: fontFile, 19210 fontFamily: fontName, 19211 fontStyle: isItalic ? 'italic' : 'normal', 19212 fontWeight: weightRange || fontWeight 19213 }; 19214 }; 19215 19216 /** 19217 * Creates the font family definition and sends it to the server 19218 * 19219 * @param {Array} fontFaces The font faces to be installed 19220 * @return {void} 19221 */ 19222 const handleInstall = async fontFaces => { 19223 const fontFamilies = makeFamiliesFromFaces(fontFaces); 19224 try { 19225 await installFonts(fontFamilies); 19226 setNotice({ 19227 type: 'success', 19228 message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') 19229 }); 19230 } catch (error) { 19231 setNotice({ 19232 type: 'error', 19233 message: error.message, 19234 errors: error?.installationErrors 19235 }); 19236 } 19237 setIsUploading(false); 19238 }; 19239 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19240 className: "font-library-modal__tabpanel-layout", 19241 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { 19242 onFilesDrop: handleDropZone 19243 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19244 className: "font-library-modal__local-fonts", 19245 children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Notice, { 19246 status: notice.type, 19247 __unstableHTML: true, 19248 onRemove: () => setNotice(null), 19249 children: [notice.message, notice.errors && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 19250 children: notice.errors.map((error, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 19251 children: error 19252 }, index)) 19253 })] 19254 }), isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19255 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19256 className: "font-library-modal__upload-area", 19257 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 19258 }) 19259 }), !isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { 19260 accept: ALLOWED_FILE_EXTENSIONS.map(ext => `.$ext}`).join(','), 19261 multiple: true, 19262 onChange: onFilesUpload, 19263 render: ({ 19264 openFileDialog 19265 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19266 __next40pxDefaultSize: true, 19267 className: "font-library-modal__upload-area", 19268 onClick: openFileDialog, 19269 children: (0,external_wp_i18n_namespaceObject.__)('Upload font') 19270 }) 19271 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19272 margin: 2 19273 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 19274 className: "font-library-modal__upload-area__text", 19275 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.') 19276 })] 19277 })] 19278 }); 19279 } 19280 /* harmony default export */ const upload_fonts = (UploadFonts); 19281 19282 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js 19283 /** 19284 * WordPress dependencies 19285 */ 19286 19287 19288 19289 19290 19291 19292 /** 19293 * Internal dependencies 19294 */ 19295 19296 19297 19298 19299 19300 19301 19302 const { 19303 Tabs 19304 } = unlock(external_wp_components_namespaceObject.privateApis); 19305 const DEFAULT_TAB = { 19306 id: 'installed-fonts', 19307 title: (0,external_wp_i18n_namespaceObject._x)('Library', 'Font library') 19308 }; 19309 const UPLOAD_TAB = { 19310 id: 'upload-fonts', 19311 title: (0,external_wp_i18n_namespaceObject.__)('Upload') 19312 }; 19313 const tabsFromCollections = collections => collections.map(({ 19314 slug, 19315 name 19316 }) => ({ 19317 id: slug, 19318 title: collections.length === 1 && slug === 'google-fonts' ? (0,external_wp_i18n_namespaceObject.__)('Install Fonts') : name 19319 })); 19320 function FontLibraryModal({ 19321 onRequestClose, 19322 defaultTabId = 'installed-fonts' 19323 }) { 19324 const { 19325 collections 19326 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19327 const canUserCreate = (0,external_wp_data_namespaceObject.useSelect)(select => { 19328 return select(external_wp_coreData_namespaceObject.store).canUser('create', { 19329 kind: 'postType', 19330 name: 'wp_font_family' 19331 }); 19332 }, []); 19333 const tabs = [DEFAULT_TAB]; 19334 if (canUserCreate) { 19335 tabs.push(UPLOAD_TAB); 19336 tabs.push(...tabsFromCollections(collections || [])); 19337 } 19338 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 19339 title: (0,external_wp_i18n_namespaceObject.__)('Fonts'), 19340 onRequestClose: onRequestClose, 19341 isFullScreen: true, 19342 className: "font-library-modal", 19343 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { 19344 defaultTabId: defaultTabId, 19345 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19346 className: "font-library-modal__tablist", 19347 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { 19348 children: tabs.map(({ 19349 id, 19350 title 19351 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 19352 tabId: id, 19353 children: title 19354 }, id)) 19355 }) 19356 }), tabs.map(({ 19357 id 19358 }) => { 19359 let contents; 19360 switch (id) { 19361 case 'upload-fonts': 19362 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts, {}); 19363 break; 19364 case 'installed-fonts': 19365 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts, {}); 19366 break; 19367 default: 19368 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection, { 19369 slug: id 19370 }); 19371 } 19372 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { 19373 tabId: id, 19374 focusable: false, 19375 children: contents 19376 }, id); 19377 })] 19378 }) 19379 }); 19380 } 19381 /* harmony default export */ const font_library_modal = (FontLibraryModal); 19382 19383 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js 19384 /** 19385 * WordPress dependencies 19386 */ 19387 19388 19389 19390 19391 /** 19392 * Internal dependencies 19393 */ 19394 19395 19396 19397 19398 function FontFamilyItem({ 19399 font 19400 }) { 19401 const { 19402 handleSetLibraryFontSelected, 19403 setModalTabOpen 19404 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19405 const variantsCount = font?.fontFace?.length || 1; 19406 const handleClick = () => { 19407 handleSetLibraryFontSelected(font); 19408 setModalTabOpen('installed-fonts'); 19409 }; 19410 const previewStyle = getFamilyPreviewStyle(font); 19411 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 19412 onClick: handleClick, 19413 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 19414 justify: "space-between", 19415 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19416 style: previewStyle, 19417 children: font.name 19418 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19419 className: "edit-site-global-styles-screen-typography__font-variants-count", 19420 children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of font variants. */ 19421 (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) 19422 })] 19423 }) 19424 }); 19425 } 19426 /* harmony default export */ const font_family_item = (FontFamilyItem); 19427 19428 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js 19429 /** 19430 * WordPress dependencies 19431 */ 19432 19433 19434 19435 19436 19437 19438 /** 19439 * Internal dependencies 19440 */ 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 const { 19451 useGlobalSetting: font_families_useGlobalSetting 19452 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19453 19454 /** 19455 * Maps the fonts with the source, if available. 19456 * 19457 * @param {Array} fonts The fonts to map. 19458 * @param {string} source The source of the fonts. 19459 * @return {Array} The mapped fonts. 19460 */ 19461 function mapFontsWithSource(fonts, source) { 19462 return fonts ? fonts.map(f => setUIValuesNeeded(f, { 19463 source 19464 })) : []; 19465 } 19466 function FontFamilies() { 19467 const { 19468 baseCustomFonts, 19469 modalTabOpen, 19470 setModalTabOpen 19471 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19472 const [fontFamilies] = font_families_useGlobalSetting('typography.fontFamilies'); 19473 const [baseFontFamilies] = font_families_useGlobalSetting('typography.fontFamilies', undefined, 'base'); 19474 const themeFonts = mapFontsWithSource(fontFamilies?.theme, 'theme'); 19475 const customFonts = mapFontsWithSource(fontFamilies?.custom, 'custom'); 19476 const activeFonts = [...themeFonts, ...customFonts].sort((a, b) => a.name.localeCompare(b.name)); 19477 const hasFonts = 0 < activeFonts.length; 19478 const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0; 19479 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19480 children: [!!modalTabOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_library_modal, { 19481 onRequestClose: () => setModalTabOpen(null), 19482 defaultTabId: modalTabOpen 19483 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19484 spacing: 2, 19485 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 19486 justify: "space-between", 19487 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 19488 level: 3, 19489 children: (0,external_wp_i18n_namespaceObject.__)('Fonts') 19490 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19491 onClick: () => setModalTabOpen('installed-fonts'), 19492 label: (0,external_wp_i18n_namespaceObject.__)('Manage fonts'), 19493 icon: library_settings, 19494 size: "small" 19495 })] 19496 }), activeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19497 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 19498 size: "large", 19499 isBordered: true, 19500 isSeparated: true, 19501 children: activeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_family_item, { 19502 font: font 19503 }, font.slug)) 19504 }) 19505 }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19506 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 19507 as: "p", 19508 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('No fonts activated.') : (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') 19509 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19510 className: "edit-site-global-styles-font-families__manage-fonts", 19511 variant: "secondary", 19512 __next40pxDefaultSize: true, 19513 onClick: () => { 19514 setModalTabOpen(hasInstalledFonts ? 'installed-fonts' : 'upload-fonts'); 19515 }, 19516 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('Manage fonts') : (0,external_wp_i18n_namespaceObject.__)('Add fonts') 19517 })] 19518 })] 19519 })] 19520 }); 19521 } 19522 /* harmony default export */ const font_families = (({ 19523 ...props 19524 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context, { 19525 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { 19526 ...props 19527 }) 19528 })); 19529 19530 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js 19531 /** 19532 * WordPress dependencies 19533 */ 19534 19535 19536 19537 19538 19539 /** 19540 * Internal dependencies 19541 */ 19542 19543 19544 19545 19546 19547 19548 19549 19550 function ScreenTypography() { 19551 const fontLibraryEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled, []); 19552 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19553 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 19554 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 19555 description: (0,external_wp_i18n_namespaceObject.__)('Available fonts, typographic styles, and the application of those styles.') 19556 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19557 className: "edit-site-global-styles-screen", 19558 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19559 spacing: 7, 19560 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { 19561 title: (0,external_wp_i18n_namespaceObject.__)('Typesets') 19562 }), 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, {})] 19563 }) 19564 })] 19565 }); 19566 } 19567 /* harmony default export */ const screen_typography = (ScreenTypography); 19568 19569 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js 19570 /** 19571 * WordPress dependencies 19572 */ 19573 19574 19575 /** 19576 * Internal dependencies 19577 */ 19578 19579 19580 const { 19581 useGlobalStyle: typography_panel_useGlobalStyle, 19582 useGlobalSetting: typography_panel_useGlobalSetting, 19583 useSettingsForBlockElement: typography_panel_useSettingsForBlockElement, 19584 TypographyPanel: typography_panel_StylesTypographyPanel 19585 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19586 function TypographyPanel({ 19587 element, 19588 headingLevel 19589 }) { 19590 let prefixParts = []; 19591 if (element === 'heading') { 19592 prefixParts = prefixParts.concat(['elements', headingLevel]); 19593 } else if (element && element !== 'text') { 19594 prefixParts = prefixParts.concat(['elements', element]); 19595 } 19596 const prefix = prefixParts.join('.'); 19597 const [style] = typography_panel_useGlobalStyle(prefix, undefined, 'user', { 19598 shouldDecodeEncode: false 19599 }); 19600 const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle(prefix, undefined, 'all', { 19601 shouldDecodeEncode: false 19602 }); 19603 const [rawSettings] = typography_panel_useGlobalSetting(''); 19604 const usedElement = element === 'heading' ? headingLevel : element; 19605 const settings = typography_panel_useSettingsForBlockElement(rawSettings, undefined, usedElement); 19606 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_panel_StylesTypographyPanel, { 19607 inheritedValue: inheritedStyle, 19608 value: style, 19609 onChange: setStyle, 19610 settings: settings 19611 }); 19612 } 19613 19614 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js 19615 /** 19616 * WordPress dependencies 19617 */ 19618 19619 19620 /** 19621 * Internal dependencies 19622 */ 19623 19624 19625 const { 19626 useGlobalStyle: typography_preview_useGlobalStyle 19627 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19628 function TypographyPreview({ 19629 name, 19630 element, 19631 headingLevel 19632 }) { 19633 var _ref; 19634 let prefix = ''; 19635 if (element === 'heading') { 19636 prefix = `elements.$headingLevel}.`; 19637 } else if (element && element !== 'text') { 19638 prefix = `elements.$element}.`; 19639 } 19640 const [fontFamily] = typography_preview_useGlobalStyle(prefix + 'typography.fontFamily', name); 19641 const [gradientValue] = typography_preview_useGlobalStyle(prefix + 'color.gradient', name); 19642 const [backgroundColor] = typography_preview_useGlobalStyle(prefix + 'color.background', name); 19643 const [fallbackBackgroundColor] = typography_preview_useGlobalStyle('color.background'); 19644 const [color] = typography_preview_useGlobalStyle(prefix + 'color.text', name); 19645 const [fontSize] = typography_preview_useGlobalStyle(prefix + 'typography.fontSize', name); 19646 const [fontStyle] = typography_preview_useGlobalStyle(prefix + 'typography.fontStyle', name); 19647 const [fontWeight] = typography_preview_useGlobalStyle(prefix + 'typography.fontWeight', name); 19648 const [letterSpacing] = typography_preview_useGlobalStyle(prefix + 'typography.letterSpacing', name); 19649 const extraStyles = element === 'link' ? { 19650 textDecoration: 'underline' 19651 } : {}; 19652 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19653 className: "edit-site-typography-preview", 19654 style: { 19655 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 19656 background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, 19657 color, 19658 fontSize, 19659 fontStyle, 19660 fontWeight, 19661 letterSpacing, 19662 ...extraStyles 19663 }, 19664 children: "Aa" 19665 }); 19666 } 19667 19668 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js 19669 /** 19670 * WordPress dependencies 19671 */ 19672 19673 19674 19675 19676 /** 19677 * Internal dependencies 19678 */ 19679 19680 19681 19682 19683 19684 19685 const screen_typography_element_elements = { 19686 text: { 19687 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'), 19688 title: (0,external_wp_i18n_namespaceObject.__)('Text') 19689 }, 19690 link: { 19691 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'), 19692 title: (0,external_wp_i18n_namespaceObject.__)('Links') 19693 }, 19694 heading: { 19695 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on headings.'), 19696 title: (0,external_wp_i18n_namespaceObject.__)('Headings') 19697 }, 19698 caption: { 19699 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on captions.'), 19700 title: (0,external_wp_i18n_namespaceObject.__)('Captions') 19701 }, 19702 button: { 19703 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on buttons.'), 19704 title: (0,external_wp_i18n_namespaceObject.__)('Buttons') 19705 } 19706 }; 19707 function ScreenTypographyElement({ 19708 element 19709 }) { 19710 const [headingLevel, setHeadingLevel] = (0,external_wp_element_namespaceObject.useState)('heading'); 19711 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19712 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 19713 title: screen_typography_element_elements[element].title, 19714 description: screen_typography_element_elements[element].description 19715 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19716 marginX: 4, 19717 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPreview, { 19718 element: element, 19719 headingLevel: headingLevel 19720 }) 19721 }), element === 'heading' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19722 marginX: 4, 19723 marginBottom: "1em", 19724 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 19725 label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'), 19726 hideLabelFromVision: true, 19727 value: headingLevel, 19728 onChange: setHeadingLevel, 19729 isBlock: true, 19730 size: "__unstable-large", 19731 __nextHasNoMarginBottom: true, 19732 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19733 value: "heading", 19734 showTooltip: true, 19735 "aria-label": (0,external_wp_i18n_namespaceObject.__)('All headings'), 19736 label: (0,external_wp_i18n_namespaceObject._x)('All', 'heading levels') 19737 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19738 value: "h1", 19739 showTooltip: true, 19740 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 1'), 19741 label: (0,external_wp_i18n_namespaceObject.__)('H1') 19742 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19743 value: "h2", 19744 showTooltip: true, 19745 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 2'), 19746 label: (0,external_wp_i18n_namespaceObject.__)('H2') 19747 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19748 value: "h3", 19749 showTooltip: true, 19750 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 3'), 19751 label: (0,external_wp_i18n_namespaceObject.__)('H3') 19752 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19753 value: "h4", 19754 showTooltip: true, 19755 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 4'), 19756 label: (0,external_wp_i18n_namespaceObject.__)('H4') 19757 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19758 value: "h5", 19759 showTooltip: true, 19760 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 5'), 19761 label: (0,external_wp_i18n_namespaceObject.__)('H5') 19762 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19763 value: "h6", 19764 showTooltip: true, 19765 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 6'), 19766 label: (0,external_wp_i18n_namespaceObject.__)('H6') 19767 })] 19768 }) 19769 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPanel, { 19770 element: element, 19771 headingLevel: headingLevel 19772 })] 19773 }); 19774 } 19775 /* harmony default export */ const screen_typography_element = (ScreenTypographyElement); 19776 19777 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js 19778 /** 19779 * WordPress dependencies 19780 */ 19781 19782 19783 19784 /** 19785 * Internal dependencies 19786 */ 19787 19788 19789 const { 19790 useGlobalStyle: font_size_preview_useGlobalStyle 19791 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19792 function FontSizePreview({ 19793 fontSize 19794 }) { 19795 var _font$fontFamily; 19796 const [font] = font_size_preview_useGlobalStyle('typography'); 19797 const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? { 19798 minimumFontSize: fontSize.fluid.min, 19799 maximumFontSize: fontSize.fluid.max 19800 } : { 19801 fontSize: fontSize.size 19802 }; 19803 const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input); 19804 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19805 className: "edit-site-typography-preview", 19806 style: { 19807 fontSize: computedFontSize, 19808 fontFamily: (_font$fontFamily = font?.fontFamily) !== null && _font$fontFamily !== void 0 ? _font$fontFamily : 'serif' 19809 }, 19810 children: (0,external_wp_i18n_namespaceObject.__)('Aa') 19811 }); 19812 } 19813 /* harmony default export */ const font_size_preview = (FontSizePreview); 19814 19815 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js 19816 /** 19817 * WordPress dependencies 19818 */ 19819 19820 19821 19822 function ConfirmDeleteFontSizeDialog({ 19823 fontSize, 19824 isOpen, 19825 toggleOpen, 19826 handleRemoveFontSize 19827 }) { 19828 const handleConfirm = async () => { 19829 toggleOpen(); 19830 handleRemoveFontSize(fontSize); 19831 }; 19832 const handleCancel = () => { 19833 toggleOpen(); 19834 }; 19835 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 19836 isOpen: isOpen, 19837 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 19838 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 19839 onCancel: handleCancel, 19840 onConfirm: handleConfirm, 19841 size: "medium", 19842 children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the font size preset. */ 19843 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font size preset?'), fontSize.name) 19844 }); 19845 } 19846 /* harmony default export */ const confirm_delete_font_size_dialog = (ConfirmDeleteFontSizeDialog); 19847 19848 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js 19849 /** 19850 * WordPress dependencies 19851 */ 19852 19853 19854 19855 19856 19857 function RenameFontSizeDialog({ 19858 fontSize, 19859 toggleOpen, 19860 handleRename 19861 }) { 19862 const [newName, setNewName] = (0,external_wp_element_namespaceObject.useState)(fontSize.name); 19863 const handleConfirm = () => { 19864 // If the new name is not empty, call the handleRename function 19865 if (newName.trim()) { 19866 handleRename(newName); 19867 } 19868 toggleOpen(); 19869 }; 19870 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 19871 onRequestClose: toggleOpen, 19872 focusOnMount: "firstContentElement", 19873 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 19874 size: "small", 19875 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 19876 onSubmit: event => { 19877 event.preventDefault(); 19878 handleConfirm(); 19879 toggleOpen(); 19880 }, 19881 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19882 spacing: "3", 19883 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 19884 __next40pxDefaultSize: true, 19885 autoComplete: "off", 19886 value: newName, 19887 onChange: setNewName, 19888 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 19889 placeholder: (0,external_wp_i18n_namespaceObject.__)('Font size preset name') 19890 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 19891 justify: "right", 19892 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19893 __next40pxDefaultSize: true, 19894 variant: "tertiary", 19895 onClick: toggleOpen, 19896 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 19897 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19898 __next40pxDefaultSize: true, 19899 variant: "primary", 19900 type: "submit", 19901 children: (0,external_wp_i18n_namespaceObject.__)('Save') 19902 })] 19903 })] 19904 }) 19905 }) 19906 }); 19907 } 19908 /* harmony default export */ const rename_font_size_dialog = (RenameFontSizeDialog); 19909 19910 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js 19911 /** 19912 * WordPress dependencies 19913 */ 19914 19915 /** 19916 * Internal dependencies 19917 */ 19918 19919 19920 19921 const DEFAULT_UNITS = ['px', 'em', 'rem', 'vw', 'vh']; 19922 function SizeControl({ 19923 // Do not allow manipulation of margin bottom 19924 __nextHasNoMarginBottom, 19925 ...props 19926 }) { 19927 const { 19928 baseControlProps 19929 } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props); 19930 const { 19931 value, 19932 onChange, 19933 fallbackValue, 19934 disabled, 19935 label 19936 } = props; 19937 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 19938 availableUnits: DEFAULT_UNITS 19939 }); 19940 const [valueQuantity, valueUnit = 'px'] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units); 19941 const isValueUnitRelative = !!valueUnit && ['em', 'rem', 'vw', 'vh'].includes(valueUnit); 19942 19943 // Receives the new value from the UnitControl component as a string containing the value and unit. 19944 const handleUnitControlChange = newValue => { 19945 onChange(newValue); 19946 }; 19947 19948 // Receives the new value from the RangeControl component as a number. 19949 const handleRangeControlChange = newValue => { 19950 onChange?.(newValue + valueUnit); 19951 }; 19952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { 19953 ...baseControlProps, 19954 __nextHasNoMarginBottom: true, 19955 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 19956 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19957 isBlock: true, 19958 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { 19959 __next40pxDefaultSize: true, 19960 __nextHasNoMarginBottom: true, 19961 label: label, 19962 hideLabelFromVision: true, 19963 value: value, 19964 onChange: handleUnitControlChange, 19965 units: units, 19966 min: 0, 19967 disabled: disabled 19968 }) 19969 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19970 isBlock: true, 19971 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19972 marginX: 2, 19973 marginBottom: 0, 19974 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { 19975 __next40pxDefaultSize: true, 19976 __nextHasNoMarginBottom: true, 19977 label: label, 19978 hideLabelFromVision: true, 19979 value: valueQuantity, 19980 initialPosition: fallbackValue, 19981 withInputField: false, 19982 onChange: handleRangeControlChange, 19983 min: 0, 19984 max: isValueUnitRelative ? 10 : 100, 19985 step: isValueUnitRelative ? 0.1 : 1, 19986 disabled: disabled 19987 }) 19988 }) 19989 })] 19990 }) 19991 }); 19992 } 19993 /* harmony default export */ const size_control = (SizeControl); 19994 19995 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js 19996 /** 19997 * WordPress dependencies 19998 */ 19999 20000 20001 20002 20003 20004 20005 /** 20006 * Internal dependencies 20007 */ 20008 20009 20010 20011 20012 20013 20014 20015 20016 20017 const { 20018 DropdownMenuV2 20019 } = unlock(external_wp_components_namespaceObject.privateApis); 20020 const { 20021 useGlobalSetting: font_size_useGlobalSetting 20022 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20023 function FontSize() { 20024 var _fontSizes$origin; 20025 const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20026 const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20027 const { 20028 params: { 20029 origin, 20030 slug 20031 }, 20032 goTo 20033 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 20034 const [fontSizes, setFontSizes] = font_size_useGlobalSetting('typography.fontSizes'); 20035 const [globalFluid] = font_size_useGlobalSetting('typography.fluid'); 20036 20037 // Get the font sizes from the origin, default to empty array. 20038 const sizes = (_fontSizes$origin = fontSizes[origin]) !== null && _fontSizes$origin !== void 0 ? _fontSizes$origin : []; 20039 20040 // Get the font size by slug. 20041 const fontSize = sizes.find(size => size.slug === slug); 20042 20043 // Whether the font size is fluid. If not defined, use the global fluid value of the theme. 20044 const isFluid = fontSize?.fluid !== undefined ? !!fontSize.fluid : !!globalFluid; 20045 20046 // Whether custom fluid values are used. 20047 const isCustomFluid = typeof fontSize?.fluid === 'object'; 20048 const handleNameChange = value => { 20049 updateFontSize('name', value); 20050 }; 20051 const handleFontSizeChange = value => { 20052 updateFontSize('size', value); 20053 }; 20054 const handleFluidChange = value => { 20055 updateFontSize('fluid', value); 20056 }; 20057 const handleCustomFluidValues = value => { 20058 if (value) { 20059 // If custom values are used, init the values with the current ones. 20060 updateFontSize('fluid', { 20061 min: fontSize.size, 20062 max: fontSize.size 20063 }); 20064 } else { 20065 // If custom fluid values are disabled, set fluid to true. 20066 updateFontSize('fluid', true); 20067 } 20068 }; 20069 const handleMinChange = value => { 20070 updateFontSize('fluid', { 20071 ...fontSize.fluid, 20072 min: value 20073 }); 20074 }; 20075 const handleMaxChange = value => { 20076 updateFontSize('fluid', { 20077 ...fontSize.fluid, 20078 max: value 20079 }); 20080 }; 20081 const updateFontSize = (key, value) => { 20082 const newFontSizes = sizes.map(size => { 20083 if (size.slug === slug) { 20084 return { 20085 ...size, 20086 [key]: value 20087 }; // Create a new object with updated key 20088 } 20089 return size; 20090 }); 20091 setFontSizes({ 20092 ...fontSizes, 20093 [origin]: newFontSizes 20094 }); 20095 }; 20096 const handleRemoveFontSize = () => { 20097 const newFontSizes = sizes.filter(size => size.slug !== slug); 20098 setFontSizes({ 20099 ...fontSizes, 20100 [origin]: newFontSizes 20101 }); 20102 }; 20103 const toggleDeleteConfirm = () => { 20104 setIsDeleteConfirmOpen(!isDeleteConfirmOpen); 20105 }; 20106 const toggleRenameDialog = () => { 20107 setIsRenameDialogOpen(!isRenameDialogOpen); 20108 }; 20109 20110 // Navigate to the font sizes list if the font size is not available. 20111 (0,external_wp_element_namespaceObject.useEffect)(() => { 20112 if (!fontSize) { 20113 goTo('/typography/font-sizes/', { 20114 isBack: true 20115 }); 20116 } 20117 }, [fontSize, goTo]); 20118 20119 // Avoid rendering if the font size is not available. 20120 if (!fontSize) { 20121 return null; 20122 } 20123 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20124 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_delete_font_size_dialog, { 20125 fontSize: fontSize, 20126 isOpen: isDeleteConfirmOpen, 20127 toggleOpen: toggleDeleteConfirm, 20128 handleRemoveFontSize: handleRemoveFontSize 20129 }), isRenameDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_font_size_dialog, { 20130 fontSize: fontSize, 20131 toggleOpen: toggleRenameDialog, 20132 handleRename: handleNameChange 20133 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20134 spacing: 4, 20135 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20136 justify: "space-between", 20137 align: "flex-start", 20138 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20139 title: fontSize.name, 20140 description: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: font size preset name. */ 20141 (0,external_wp_i18n_namespaceObject.__)('Manage the font size %s.'), fontSize.name), 20142 onBack: () => goTo('/typography/font-sizes/') 20143 }), origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20144 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20145 marginTop: 3, 20146 marginBottom: 0, 20147 paddingX: 4, 20148 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(DropdownMenuV2, { 20149 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20150 size: "small", 20151 icon: more_vertical, 20152 label: (0,external_wp_i18n_namespaceObject.__)('Font size options') 20153 }), 20154 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2.Item, { 20155 onClick: toggleRenameDialog, 20156 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2.ItemLabel, { 20157 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 20158 }) 20159 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2.Item, { 20160 onClick: toggleDeleteConfirm, 20161 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2.ItemLabel, { 20162 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 20163 }) 20164 })] 20165 }) 20166 }) 20167 })] 20168 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 20169 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20170 paddingX: 4, 20171 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20172 spacing: 4, 20173 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20174 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview, { 20175 fontSize: fontSize 20176 }) 20177 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20178 label: (0,external_wp_i18n_namespaceObject.__)('Size'), 20179 value: !isCustomFluid ? fontSize.size : '', 20180 onChange: handleFontSizeChange, 20181 disabled: isCustomFluid 20182 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { 20183 label: (0,external_wp_i18n_namespaceObject.__)('Fluid typography'), 20184 help: (0,external_wp_i18n_namespaceObject.__)('Scale the font size dynamically to fit the screen or viewport.'), 20185 checked: isFluid, 20186 onChange: handleFluidChange, 20187 __nextHasNoMarginBottom: true 20188 }), isFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { 20189 label: (0,external_wp_i18n_namespaceObject.__)('Custom fluid values'), 20190 help: (0,external_wp_i18n_namespaceObject.__)('Set custom min and max values for the fluid font size.'), 20191 checked: isCustomFluid, 20192 onChange: handleCustomFluidValues, 20193 __nextHasNoMarginBottom: true 20194 }), isCustomFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20195 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20196 label: (0,external_wp_i18n_namespaceObject.__)('Minimum'), 20197 value: fontSize.fluid?.min, 20198 onChange: handleMinChange 20199 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20200 label: (0,external_wp_i18n_namespaceObject.__)('Maximum'), 20201 value: fontSize.fluid?.max, 20202 onChange: handleMaxChange 20203 })] 20204 })] 20205 }) 20206 }) 20207 })] 20208 })] 20209 }); 20210 } 20211 /* harmony default export */ const font_size = (FontSize); 20212 20213 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js 20214 /** 20215 * WordPress dependencies 20216 */ 20217 20218 20219 const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 20220 xmlns: "http://www.w3.org/2000/svg", 20221 viewBox: "0 0 24 24", 20222 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 20223 d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" 20224 }) 20225 }); 20226 /* harmony default export */ const library_plus = (plus); 20227 20228 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js 20229 /** 20230 * WordPress dependencies 20231 */ 20232 20233 20234 20235 function ConfirmResetFontSizesDialog({ 20236 text, 20237 confirmButtonText, 20238 isOpen, 20239 toggleOpen, 20240 onConfirm 20241 }) { 20242 const handleConfirm = async () => { 20243 toggleOpen(); 20244 onConfirm(); 20245 }; 20246 const handleCancel = () => { 20247 toggleOpen(); 20248 }; 20249 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 20250 isOpen: isOpen, 20251 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 20252 confirmButtonText: confirmButtonText, 20253 onCancel: handleCancel, 20254 onConfirm: handleConfirm, 20255 size: "medium", 20256 children: text 20257 }); 20258 } 20259 /* harmony default export */ const confirm_reset_font_sizes_dialog = (ConfirmResetFontSizesDialog); 20260 20261 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js 20262 /** 20263 * WordPress dependencies 20264 */ 20265 20266 20267 20268 20269 20270 20271 /** 20272 * Internal dependencies 20273 */ 20274 20275 const { 20276 DropdownMenuV2: font_sizes_DropdownMenuV2 20277 } = unlock(external_wp_components_namespaceObject.privateApis); 20278 const { 20279 useGlobalSetting: font_sizes_useGlobalSetting 20280 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20281 20282 20283 20284 20285 20286 20287 20288 20289 function FontSizeGroup({ 20290 label, 20291 origin, 20292 sizes, 20293 handleAddFontSize, 20294 handleResetFontSizes 20295 }) { 20296 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20297 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); 20298 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?'); 20299 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20300 children: [isResetDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_reset_font_sizes_dialog, { 20301 text: resetDialogText, 20302 confirmButtonText: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove') : (0,external_wp_i18n_namespaceObject.__)('Reset'), 20303 isOpen: isResetDialogOpen, 20304 toggleOpen: toggleResetDialog, 20305 onConfirm: handleResetFontSizes 20306 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20307 spacing: 4, 20308 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20309 justify: "space-between", 20310 align: "center", 20311 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20312 level: 3, 20313 children: label 20314 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 20315 children: [origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20316 label: (0,external_wp_i18n_namespaceObject.__)('Add font size'), 20317 icon: library_plus, 20318 size: "small", 20319 onClick: handleAddFontSize 20320 }), !!handleResetFontSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_DropdownMenuV2, { 20321 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20322 size: "small", 20323 icon: more_vertical, 20324 label: (0,external_wp_i18n_namespaceObject.__)('Font size presets options') 20325 }), 20326 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_DropdownMenuV2.Item, { 20327 onClick: toggleResetDialog, 20328 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_DropdownMenuV2.ItemLabel, { 20329 children: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove font size presets') : (0,external_wp_i18n_namespaceObject.__)('Reset font size presets') 20330 }) 20331 }) 20332 })] 20333 })] 20334 }), !!sizes.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 20335 isBordered: true, 20336 isSeparated: true, 20337 children: sizes.map(size => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 20338 path: `/typography/font-sizes/$origin}/$size.slug}`, 20339 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20340 direction: "row", 20341 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20342 className: "edit-site-font-size__item", 20343 children: size.name 20344 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20345 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20346 justify: "flex-end", 20347 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 20348 className: "edit-site-font-size__item edit-site-font-size__item-value", 20349 children: size.size 20350 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 20351 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 20352 })] 20353 }) 20354 })] 20355 }) 20356 }, size.slug)) 20357 })] 20358 })] 20359 }); 20360 } 20361 function font_sizes_FontSizes() { 20362 const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme'); 20363 const [baseThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme', null, 'base'); 20364 const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default'); 20365 const [baseDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default', null, 'base'); 20366 const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.custom'); 20367 const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting('typography.defaultFontSizes'); 20368 const handleAddFontSize = () => { 20369 const index = getNewIndexFromPresets(customFontSizes, 'custom-'); 20370 const newFontSize = { 20371 /* translators: %d: font size index */ 20372 name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('New Font Size %d'), index), 20373 size: '16px', 20374 slug: `custom-$index}` 20375 }; 20376 setCustomFontSizes([...customFontSizes, newFontSize]); 20377 }; 20378 const hasSameSizeValues = (arr1, arr2) => arr1.map(item => item.size).join('') === arr2.map(item => item.size).join(''); 20379 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20380 spacing: 2, 20381 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20382 title: (0,external_wp_i18n_namespaceObject.__)('Font size presets'), 20383 description: (0,external_wp_i18n_namespaceObject.__)('Create and edit the presets used for font sizes across the site.') 20384 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 20385 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20386 paddingX: 4, 20387 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20388 spacing: 8, 20389 children: [!!themeFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20390 label: (0,external_wp_i18n_namespaceObject.__)('Theme'), 20391 origin: "theme", 20392 sizes: themeFontSizes, 20393 baseSizes: baseThemeFontSizes, 20394 handleAddFontSize: handleAddFontSize, 20395 handleResetFontSizes: hasSameSizeValues(themeFontSizes, baseThemeFontSizes) ? null : () => setThemeFontSizes(baseThemeFontSizes) 20396 }), defaultFontSizesEnabled && !!defaultFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20397 label: (0,external_wp_i18n_namespaceObject.__)('Default'), 20398 origin: "default", 20399 sizes: defaultFontSizes, 20400 baseSizes: baseDefaultFontSizes, 20401 handleAddFontSize: handleAddFontSize, 20402 handleResetFontSizes: hasSameSizeValues(defaultFontSizes, baseDefaultFontSizes) ? null : () => setDefaultFontSizes(baseDefaultFontSizes) 20403 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20404 label: (0,external_wp_i18n_namespaceObject.__)('Custom'), 20405 origin: "custom", 20406 sizes: customFontSizes, 20407 handleAddFontSize: handleAddFontSize, 20408 handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null 20409 })] 20410 }) 20411 }) 20412 })] 20413 }); 20414 } 20415 /* harmony default export */ const font_sizes = (font_sizes_FontSizes); 20416 20417 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shuffle.js 20418 /** 20419 * WordPress dependencies 20420 */ 20421 20422 20423 const shuffle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 20424 viewBox: "0 0 24 24", 20425 xmlns: "http://www.w3.org/2000/SVG", 20426 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 20427 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" 20428 }) 20429 }); 20430 /* harmony default export */ const library_shuffle = (shuffle); 20431 20432 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js 20433 /** 20434 * External dependencies 20435 */ 20436 20437 20438 /** 20439 * WordPress dependencies 20440 */ 20441 20442 20443 function ColorIndicatorWrapper({ 20444 className, 20445 ...props 20446 }) { 20447 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 20448 className: dist_clsx('edit-site-global-styles__color-indicator-wrapper', className), 20449 ...props 20450 }); 20451 } 20452 /* harmony default export */ const color_indicator_wrapper = (ColorIndicatorWrapper); 20453 20454 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js 20455 /** 20456 * WordPress dependencies 20457 */ 20458 20459 20460 20461 20462 20463 20464 /** 20465 * Internal dependencies 20466 */ 20467 20468 20469 20470 20471 20472 20473 20474 const { 20475 useGlobalSetting: palette_useGlobalSetting 20476 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20477 const EMPTY_COLORS = []; 20478 function Palette({ 20479 name 20480 }) { 20481 const [customColors] = palette_useGlobalSetting('color.palette.custom'); 20482 const [themeColors] = palette_useGlobalSetting('color.palette.theme'); 20483 const [defaultColors] = palette_useGlobalSetting('color.palette.default'); 20484 const [defaultPaletteEnabled] = palette_useGlobalSetting('color.defaultPalette', name); 20485 const [randomizeThemeColors] = useColorRandomizer(); 20486 const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]); 20487 const screenPath = !name ? '/colors/palette' : '/blocks/' + encodeURIComponent(name) + '/colors/palette'; 20488 const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.__)('Edit palette') : (0,external_wp_i18n_namespaceObject.__)('Add colors'); 20489 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20490 spacing: 3, 20491 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20492 level: 3, 20493 children: (0,external_wp_i18n_namespaceObject.__)('Palette') 20494 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 20495 isBordered: true, 20496 isSeparated: true, 20497 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 20498 path: screenPath, 20499 "aria-label": paletteButtonText, 20500 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20501 direction: "row", 20502 children: [colors.length <= 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20503 children: (0,external_wp_i18n_namespaceObject.__)('Add colors') 20504 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { 20505 isLayered: false, 20506 offset: -8, 20507 children: colors.slice(0, 5).map(({ 20508 color 20509 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator_wrapper, { 20510 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { 20511 colorValue: color 20512 }) 20513 }, `$color}-$index}`)) 20514 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 20515 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 20516 })] 20517 }) 20518 }) 20519 }), window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20520 __next40pxDefaultSize: true, 20521 variant: "secondary", 20522 icon: library_shuffle, 20523 onClick: randomizeThemeColors, 20524 children: (0,external_wp_i18n_namespaceObject.__)('Randomize colors') 20525 })] 20526 }); 20527 } 20528 /* harmony default export */ const palette = (Palette); 20529 20530 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js 20531 /** 20532 * WordPress dependencies 20533 */ 20534 20535 20536 20537 20538 /** 20539 * Internal dependencies 20540 */ 20541 20542 20543 20544 20545 20546 20547 const { 20548 useGlobalStyle: screen_colors_useGlobalStyle, 20549 useGlobalSetting: screen_colors_useGlobalSetting, 20550 useSettingsForBlockElement: screen_colors_useSettingsForBlockElement, 20551 ColorPanel: screen_colors_StylesColorPanel 20552 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20553 function ScreenColors() { 20554 const [style] = screen_colors_useGlobalStyle('', undefined, 'user', { 20555 shouldDecodeEncode: false 20556 }); 20557 const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle('', undefined, 'all', { 20558 shouldDecodeEncode: false 20559 }); 20560 const [rawSettings] = screen_colors_useGlobalSetting(''); 20561 const settings = screen_colors_useSettingsForBlockElement(rawSettings); 20562 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20563 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20564 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 20565 description: (0,external_wp_i18n_namespaceObject.__)('Palette colors and the application of those colors on site elements.') 20566 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20567 className: "edit-site-global-styles-screen", 20568 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20569 spacing: 7, 20570 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(palette, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_StylesColorPanel, { 20571 inheritedValue: inheritedStyle, 20572 value: style, 20573 onChange: setStyle, 20574 settings: settings 20575 })] 20576 }) 20577 })] 20578 }); 20579 } 20580 /* harmony default export */ const screen_colors = (ScreenColors); 20581 20582 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js 20583 /** 20584 * Internal dependencies 20585 */ 20586 20587 20588 function PresetColors() { 20589 const { 20590 paletteColors 20591 } = useStylesPreviewColors(); 20592 return paletteColors.slice(0, 4).map(({ 20593 slug, 20594 color 20595 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20596 style: { 20597 flexGrow: 1, 20598 height: '100%', 20599 background: color 20600 } 20601 }, `$slug}-$index}`)); 20602 } 20603 20604 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js 20605 /** 20606 * WordPress dependencies 20607 */ 20608 20609 20610 /** 20611 * Internal dependencies 20612 */ 20613 20614 20615 20616 const preview_colors_firstFrameVariants = { 20617 start: { 20618 scale: 1, 20619 opacity: 1 20620 }, 20621 hover: { 20622 scale: 0, 20623 opacity: 0 20624 } 20625 }; 20626 const StylesPreviewColors = ({ 20627 label, 20628 isFocused, 20629 withHoverView 20630 }) => { 20631 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewIframe, { 20632 label: label, 20633 isFocused: isFocused, 20634 withHoverView: withHoverView, 20635 children: ({ 20636 key 20637 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 20638 variants: preview_colors_firstFrameVariants, 20639 style: { 20640 height: '100%', 20641 overflow: 'hidden' 20642 }, 20643 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 20644 spacing: 0, 20645 justify: "center", 20646 style: { 20647 height: '100%', 20648 overflow: 'hidden' 20649 }, 20650 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {}) 20651 }) 20652 }, key) 20653 }); 20654 }; 20655 /* harmony default export */ const preview_colors = (StylesPreviewColors); 20656 20657 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js 20658 /** 20659 * WordPress dependencies 20660 */ 20661 20662 20663 /** 20664 * Internal dependencies 20665 */ 20666 20667 20668 20669 20670 20671 20672 function ColorVariations({ 20673 title, 20674 gap = 2 20675 }) { 20676 const propertiesToFilter = ['color']; 20677 const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 20678 20679 // Return null if there is only one variation (the default). 20680 if (colorVariations?.length <= 1) { 20681 return null; 20682 } 20683 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20684 spacing: 3, 20685 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20686 level: 3, 20687 children: title 20688 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 20689 spacing: gap, 20690 children: colorVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 20691 variation: variation, 20692 isPill: true, 20693 properties: propertiesToFilter, 20694 showTooltip: true, 20695 children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors, {}) 20696 }, index)) 20697 })] 20698 }); 20699 } 20700 20701 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js 20702 /** 20703 * WordPress dependencies 20704 */ 20705 20706 20707 20708 20709 20710 /** 20711 * Internal dependencies 20712 */ 20713 20714 20715 20716 20717 const { 20718 useGlobalSetting: color_palette_panel_useGlobalSetting 20719 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20720 const mobilePopoverProps = { 20721 placement: 'bottom-start', 20722 offset: 8 20723 }; 20724 function ColorPalettePanel({ 20725 name 20726 }) { 20727 const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name); 20728 const [baseThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name, 'base'); 20729 const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name); 20730 const [baseDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name, 'base'); 20731 const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting('color.palette.custom', name); 20732 const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting('color.defaultPalette', name); 20733 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 20734 const popoverProps = isMobileViewport ? mobilePopoverProps : undefined; 20735 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20736 className: "edit-site-global-styles-color-palette-panel", 20737 spacing: 8, 20738 children: [!!themeColors && !!themeColors.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20739 canReset: themeColors !== baseThemeColors, 20740 canOnlyChangeValues: true, 20741 colors: themeColors, 20742 onChange: setThemeColors, 20743 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), 20744 paletteLabelHeadingLevel: 3, 20745 popoverProps: popoverProps 20746 }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20747 canReset: defaultColors !== baseDefaultColors, 20748 canOnlyChangeValues: true, 20749 colors: defaultColors, 20750 onChange: setDefaultColors, 20751 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), 20752 paletteLabelHeadingLevel: 3, 20753 popoverProps: popoverProps 20754 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20755 colors: customColors, 20756 onChange: setCustomColors, 20757 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 20758 paletteLabelHeadingLevel: 3, 20759 slugPrefix: "custom-", 20760 popoverProps: popoverProps 20761 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { 20762 title: (0,external_wp_i18n_namespaceObject.__)('Palettes') 20763 })] 20764 }); 20765 } 20766 20767 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js 20768 /** 20769 * WordPress dependencies 20770 */ 20771 20772 20773 20774 20775 20776 /** 20777 * Internal dependencies 20778 */ 20779 20780 20781 20782 20783 const { 20784 useGlobalSetting: gradients_palette_panel_useGlobalSetting 20785 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20786 const gradients_palette_panel_mobilePopoverProps = { 20787 placement: 'bottom-start', 20788 offset: 8 20789 }; 20790 const noop = () => {}; 20791 function GradientPalettePanel({ 20792 name 20793 }) { 20794 const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name); 20795 const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name, 'base'); 20796 const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name); 20797 const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name, 'base'); 20798 const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.custom', name); 20799 const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultGradients', name); 20800 const [customDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.custom') || []; 20801 const [defaultDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.default') || []; 20802 const [themeDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.theme') || []; 20803 const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultDuotone'); 20804 const duotonePalette = [...(customDuotone || []), ...(themeDuotone || []), ...(defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [])]; 20805 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 20806 const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : undefined; 20807 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20808 className: "edit-site-global-styles-gradient-palette-panel", 20809 spacing: 8, 20810 children: [!!themeGradients && !!themeGradients.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20811 canReset: themeGradients !== baseThemeGradients, 20812 canOnlyChangeValues: true, 20813 gradients: themeGradients, 20814 onChange: setThemeGradients, 20815 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), 20816 paletteLabelHeadingLevel: 3, 20817 popoverProps: popoverProps 20818 }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20819 canReset: defaultGradients !== baseDefaultGradients, 20820 canOnlyChangeValues: true, 20821 gradients: defaultGradients, 20822 onChange: setDefaultGradients, 20823 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), 20824 paletteLabelLevel: 3, 20825 popoverProps: popoverProps 20826 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20827 gradients: customGradients, 20828 onChange: setCustomGradients, 20829 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 20830 paletteLabelLevel: 3, 20831 slugPrefix: "custom-", 20832 popoverProps: popoverProps 20833 }), !!duotonePalette && !!duotonePalette.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 20834 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20835 level: 3, 20836 children: (0,external_wp_i18n_namespaceObject.__)('Duotone') 20837 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20838 margin: 3 20839 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { 20840 duotonePalette: duotonePalette, 20841 disableCustomDuotone: true, 20842 disableCustomColors: true, 20843 clearable: false, 20844 onChange: noop 20845 })] 20846 })] 20847 }); 20848 } 20849 20850 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js 20851 /** 20852 * WordPress dependencies 20853 */ 20854 20855 20856 20857 /** 20858 * Internal dependencies 20859 */ 20860 20861 20862 20863 20864 20865 20866 20867 const { 20868 Tabs: screen_color_palette_Tabs 20869 } = unlock(external_wp_components_namespaceObject.privateApis); 20870 function ScreenColorPalette({ 20871 name 20872 }) { 20873 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20874 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20875 title: (0,external_wp_i18n_namespaceObject.__)('Edit palette'), 20876 description: (0,external_wp_i18n_namespaceObject.__)('The combination of colors used across the site and in color pickers.') 20877 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { 20878 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { 20879 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { 20880 tabId: "color", 20881 children: (0,external_wp_i18n_namespaceObject.__)('Color') 20882 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { 20883 tabId: "gradient", 20884 children: (0,external_wp_i18n_namespaceObject.__)('Gradient') 20885 })] 20886 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { 20887 tabId: "color", 20888 focusable: false, 20889 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { 20890 name: name 20891 }) 20892 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { 20893 tabId: "gradient", 20894 focusable: false, 20895 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { 20896 name: name 20897 }) 20898 })] 20899 })] 20900 }); 20901 } 20902 /* harmony default export */ const screen_color_palette = (ScreenColorPalette); 20903 20904 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js 20905 /** 20906 * WordPress dependencies 20907 */ 20908 20909 20910 /** 20911 * Internal dependencies 20912 */ 20913 20914 20915 // Initial control values where no block style is set. 20916 20917 const BACKGROUND_DEFAULT_VALUES = { 20918 backgroundSize: 'auto' 20919 }; 20920 const { 20921 useGlobalStyle: background_panel_useGlobalStyle, 20922 useGlobalSetting: background_panel_useGlobalSetting, 20923 BackgroundPanel: background_panel_StylesBackgroundPanel 20924 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20925 20926 /** 20927 * Checks if there is a current value in the background image block support 20928 * attributes. 20929 * 20930 * @param {Object} style Style attribute. 20931 * @return {boolean} Whether the block has a background image value set. 20932 */ 20933 function hasBackgroundImageValue(style) { 20934 return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === 'string'; 20935 } 20936 function BackgroundPanel() { 20937 const [style] = background_panel_useGlobalStyle('', undefined, 'user', { 20938 shouldDecodeEncode: false 20939 }); 20940 const [inheritedStyle, setStyle] = background_panel_useGlobalStyle('', undefined, 'all', { 20941 shouldDecodeEncode: false 20942 }); 20943 const [settings] = background_panel_useGlobalSetting(''); 20944 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(background_panel_StylesBackgroundPanel, { 20945 inheritedValue: inheritedStyle, 20946 value: style, 20947 onChange: setStyle, 20948 settings: settings, 20949 defaultValues: BACKGROUND_DEFAULT_VALUES 20950 }); 20951 } 20952 20953 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js 20954 /** 20955 * WordPress dependencies 20956 */ 20957 20958 20959 20960 20961 /** 20962 * Internal dependencies 20963 */ 20964 20965 20966 20967 20968 20969 20970 const { 20971 useHasBackgroundPanel: screen_background_useHasBackgroundPanel, 20972 useGlobalSetting: screen_background_useGlobalSetting 20973 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20974 function ScreenBackground() { 20975 const [settings] = screen_background_useGlobalSetting(''); 20976 const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings); 20977 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20978 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20979 title: (0,external_wp_i18n_namespaceObject.__)('Background'), 20980 description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 20981 children: (0,external_wp_i18n_namespaceObject.__)('Set styles for the site’s background.') 20982 }) 20983 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {})] 20984 }); 20985 } 20986 /* harmony default export */ const screen_background = (ScreenBackground); 20987 20988 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js 20989 /** 20990 * WordPress dependencies 20991 */ 20992 20993 20994 20995 20996 20997 /** 20998 * Internal dependencies 20999 */ 21000 21001 21002 21003 21004 21005 21006 21007 21008 const { 21009 useGlobalSetting: shadows_panel_useGlobalSetting 21010 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21011 const defaultShadow = '6px 6px 9px rgba(0, 0, 0, 0.2)'; 21012 function ShadowsPanel() { 21013 const [defaultShadows] = shadows_panel_useGlobalSetting('shadow.presets.default'); 21014 const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting('shadow.defaultPresets'); 21015 const [themeShadows] = shadows_panel_useGlobalSetting('shadow.presets.theme'); 21016 const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting('shadow.presets.custom'); 21017 const onCreateShadow = shadow => { 21018 setCustomShadows([...(customShadows || []), shadow]); 21019 }; 21020 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21021 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21022 title: (0,external_wp_i18n_namespaceObject.__)('Shadows'), 21023 description: (0,external_wp_i18n_namespaceObject.__)('Manage and create shadow styles for use across the site.') 21024 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21025 className: "edit-site-global-styles-screen", 21026 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21027 className: "edit-site-global-styles__shadows-panel", 21028 spacing: 7, 21029 children: [defaultShadowsEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21030 label: (0,external_wp_i18n_namespaceObject.__)('Default'), 21031 shadows: defaultShadows || [], 21032 category: "default" 21033 }), themeShadows && themeShadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21034 label: (0,external_wp_i18n_namespaceObject.__)('Theme'), 21035 shadows: themeShadows || [], 21036 category: "theme" 21037 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21038 label: (0,external_wp_i18n_namespaceObject.__)('Custom'), 21039 shadows: customShadows || [], 21040 category: "custom", 21041 canCreate: true, 21042 onCreate: onCreateShadow 21043 })] 21044 }) 21045 })] 21046 }); 21047 } 21048 function ShadowList({ 21049 label, 21050 shadows, 21051 category, 21052 canCreate, 21053 onCreate 21054 }) { 21055 const handleAddShadow = () => { 21056 const newIndex = getNewIndexFromPresets(shadows, 'shadow-'); 21057 onCreate({ 21058 name: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is an index for a preset */ 21059 (0,external_wp_i18n_namespaceObject.__)('Shadow %s'), newIndex), 21060 shadow: defaultShadow, 21061 slug: `shadow-$newIndex}` 21062 }); 21063 }; 21064 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21065 spacing: 2, 21066 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21067 justify: "space-between", 21068 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 21069 align: "center", 21070 className: "edit-site-global-styles__shadows-panel__title", 21071 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21072 level: 3, 21073 children: label 21074 }) 21075 }), canCreate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21076 className: "edit-site-global-styles__shadows-panel__options-container", 21077 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21078 size: "small", 21079 icon: library_plus, 21080 label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), 21081 onClick: () => { 21082 handleAddShadow(); 21083 } 21084 }) 21085 })] 21086 }), shadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 21087 isBordered: true, 21088 isSeparated: true, 21089 children: shadows.map(shadow => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowItem, { 21090 shadow: shadow, 21091 category: category 21092 }, shadow.slug)) 21093 })] 21094 }); 21095 } 21096 function ShadowItem({ 21097 shadow, 21098 category 21099 }) { 21100 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 21101 path: `/shadows/edit/$category}/$shadow.slug}`, 21102 "aria-label": 21103 // translators: %s: name of the shadow 21104 (0,external_wp_i18n_namespaceObject.sprintf)('Edit shadow %s', shadow.name), 21105 icon: library_shadow, 21106 children: shadow.name 21107 }); 21108 } 21109 21110 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js 21111 /** 21112 * WordPress dependencies 21113 */ 21114 21115 21116 const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 21117 xmlns: "http://www.w3.org/2000/svg", 21118 viewBox: "0 0 24 24", 21119 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 21120 d: "M7 11.5h10V13H7z" 21121 }) 21122 }); 21123 /* harmony default export */ const library_reset = (reset_reset); 21124 21125 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js 21126 const CUSTOM_VALUE_SETTINGS = { 21127 px: { 21128 max: 20, 21129 step: 1 21130 }, 21131 '%': { 21132 max: 100, 21133 step: 1 21134 }, 21135 vw: { 21136 max: 100, 21137 step: 1 21138 }, 21139 vh: { 21140 max: 100, 21141 step: 1 21142 }, 21143 em: { 21144 max: 10, 21145 step: 0.1 21146 }, 21147 rm: { 21148 max: 10, 21149 step: 0.1 21150 }, 21151 svw: { 21152 max: 100, 21153 step: 1 21154 }, 21155 lvw: { 21156 max: 100, 21157 step: 1 21158 }, 21159 dvw: { 21160 max: 100, 21161 step: 1 21162 }, 21163 svh: { 21164 max: 100, 21165 step: 1 21166 }, 21167 lvh: { 21168 max: 100, 21169 step: 1 21170 }, 21171 dvh: { 21172 max: 100, 21173 step: 1 21174 }, 21175 vi: { 21176 max: 100, 21177 step: 1 21178 }, 21179 svi: { 21180 max: 100, 21181 step: 1 21182 }, 21183 lvi: { 21184 max: 100, 21185 step: 1 21186 }, 21187 dvi: { 21188 max: 100, 21189 step: 1 21190 }, 21191 vb: { 21192 max: 100, 21193 step: 1 21194 }, 21195 svb: { 21196 max: 100, 21197 step: 1 21198 }, 21199 lvb: { 21200 max: 100, 21201 step: 1 21202 }, 21203 dvb: { 21204 max: 100, 21205 step: 1 21206 }, 21207 vmin: { 21208 max: 100, 21209 step: 1 21210 }, 21211 svmin: { 21212 max: 100, 21213 step: 1 21214 }, 21215 lvmin: { 21216 max: 100, 21217 step: 1 21218 }, 21219 dvmin: { 21220 max: 100, 21221 step: 1 21222 }, 21223 vmax: { 21224 max: 100, 21225 step: 1 21226 }, 21227 svmax: { 21228 max: 100, 21229 step: 1 21230 }, 21231 lvmax: { 21232 max: 100, 21233 step: 1 21234 }, 21235 dvmax: { 21236 max: 100, 21237 step: 1 21238 } 21239 }; 21240 function getShadowParts(shadow) { 21241 const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || []; 21242 return shadowValues.map(value => value.trim()); 21243 } 21244 function shadowStringToObject(shadowValue) { 21245 /* 21246 * Shadow spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow 21247 * Shadow string format: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> [inset] 21248 * 21249 * A shadow to be valid it must satisfy the following. 21250 * 21251 * 1. Should not contain "none" keyword. 21252 * 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. 21253 * 3. Should not contain more than one set of x, y, blur, spread values. 21254 * 4. Should contain at least x and y values. Others are optional. 21255 * 5. Should not contain more than one "inset" (case insensitive) keyword. 21256 * 6. Should not contain more than one color value. 21257 */ 21258 21259 const defaultShadow = { 21260 x: '0', 21261 y: '0', 21262 blur: '0', 21263 spread: '0', 21264 color: '#000', 21265 inset: false 21266 }; 21267 if (!shadowValue) { 21268 return defaultShadow; 21269 } 21270 21271 // Rule 1: Should not contain "none" keyword. 21272 // if the shadow has "none" keyword, it is not a valid shadow string 21273 if (shadowValue.includes('none')) { 21274 return defaultShadow; 21275 } 21276 21277 // Rule 2: Values x, y, blur, spread should be in the order. 21278 // Color and inset can be anywhere in the string except in between x, y, blur, spread values. 21279 // Extract length values (x, y, blur, spread) from shadow string 21280 // Regex match groups of 1 to 4 length values. 21281 const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g; 21282 const matches = shadowValue.match(lengthsRegex) || []; 21283 21284 // Rule 3: Should not contain more than one set of x, y, blur, spread values. 21285 // if the string doesn't contain exactly 1 set of x, y, blur, spread values, 21286 // it is not a valid shadow string 21287 if (matches.length !== 1) { 21288 return defaultShadow; 21289 } 21290 21291 // Extract length values (x, y, blur, spread) from shadow string 21292 const lengths = matches[0].split(' ').map(value => value.trim()).filter(value => value); 21293 21294 // Rule 4: Should contain at least x and y values. Others are optional. 21295 if (lengths.length < 2) { 21296 return defaultShadow; 21297 } 21298 21299 // Rule 5: Should not contain more than one "inset" (case insensitive) keyword. 21300 // check if the shadow string contains "inset" keyword 21301 const insets = shadowValue.match(/inset/gi) || []; 21302 if (insets.length > 1) { 21303 return defaultShadow; 21304 } 21305 21306 // Strip lengths and inset from shadow string, leaving just color. 21307 const hasInset = insets.length === 1; 21308 let colorString = shadowValue.replace(lengthsRegex, '').trim(); 21309 if (hasInset) { 21310 colorString = colorString.replace('inset', '').replace('INSET', '').trim(); 21311 } 21312 21313 // Rule 6: Should not contain more than one color value. 21314 // validate color string with regular expression 21315 // check if color has matching hex, rgb or hsl values 21316 const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi; 21317 let colorMatches = (colorString.match(colorRegex) || []).map(value => value?.trim()).filter(value => value); 21318 21319 // If color string has more than one color values, it is not a valid 21320 if (colorMatches.length > 1) { 21321 return defaultShadow; 21322 } else if (colorMatches.length === 0) { 21323 // check if color string has multiple named color values separated by space 21324 colorMatches = colorString.trim().split(' ').filter(value => value); 21325 // If color string has more than one color values, it is not a valid 21326 if (colorMatches.length > 1) { 21327 return defaultShadow; 21328 } 21329 } 21330 21331 // Return parsed shadow object. 21332 const [x, y, blur, spread] = lengths; 21333 return { 21334 x, 21335 y, 21336 blur: blur || defaultShadow.blur, 21337 spread: spread || defaultShadow.spread, 21338 inset: hasInset, 21339 color: colorString || defaultShadow.color 21340 }; 21341 } 21342 function shadowObjectToString(shadowObj) { 21343 const shadowString = `$shadowObj.x || '0px'} $shadowObj.y || '0px'} $shadowObj.blur || '0px'} $shadowObj.spread || '0px'}`; 21344 return `$shadowObj.inset ? 'inset' : ''} $shadowString} $shadowObj.color || ''}`.trim(); 21345 } 21346 21347 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js 21348 /** 21349 * External dependencies 21350 */ 21351 21352 21353 /** 21354 * WordPress dependencies 21355 */ 21356 21357 21358 21359 21360 21361 21362 /** 21363 * Internal dependencies 21364 */ 21365 21366 21367 21368 21369 21370 21371 21372 21373 const { 21374 useGlobalSetting: shadows_edit_panel_useGlobalSetting 21375 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21376 const { 21377 DropdownMenuV2: shadows_edit_panel_DropdownMenuV2 21378 } = unlock(external_wp_components_namespaceObject.privateApis); 21379 const customShadowMenuItems = [{ 21380 label: (0,external_wp_i18n_namespaceObject.__)('Rename'), 21381 action: 'rename' 21382 }, { 21383 label: (0,external_wp_i18n_namespaceObject.__)('Delete'), 21384 action: 'delete' 21385 }]; 21386 const presetShadowMenuItems = [{ 21387 label: (0,external_wp_i18n_namespaceObject.__)('Reset'), 21388 action: 'reset' 21389 }]; 21390 function ShadowsEditPanel() { 21391 const { 21392 goBack, 21393 params: { 21394 category, 21395 slug 21396 } 21397 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 21398 const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.$category}`); 21399 (0,external_wp_element_namespaceObject.useEffect)(() => { 21400 const hasCurrentShadow = shadows?.some(shadow => shadow.slug === slug); 21401 // If the shadow being edited doesn't exist anymore in the global styles setting, navigate back 21402 // to prevent the user from editing a non-existent shadow entry. 21403 // This can happen, for example: 21404 // - when the user deletes the shadow 21405 // - when the user resets the styles while editing a custom shadow 21406 // 21407 // The check on the slug is necessary to prevent a double back navigation when the user triggers 21408 // a backward navigation by interacting with the screen's UI. 21409 if (!!slug && !hasCurrentShadow) { 21410 goBack(); 21411 } 21412 }, [shadows, slug, goBack]); 21413 const [baseShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.$category}`, undefined, 'base'); 21414 const [selectedShadow, setSelectedShadow] = (0,external_wp_element_namespaceObject.useState)(() => (shadows || []).find(shadow => shadow.slug === slug)); 21415 const baseSelectedShadow = (0,external_wp_element_namespaceObject.useMemo)(() => (baseShadows || []).find(b => b.slug === slug), [baseShadows, slug]); 21416 const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_namespaceObject.useState)(false); 21417 const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); 21418 const [shadowName, setShadowName] = (0,external_wp_element_namespaceObject.useState)(selectedShadow.name); 21419 const onShadowChange = shadow => { 21420 setSelectedShadow({ 21421 ...selectedShadow, 21422 shadow 21423 }); 21424 const updatedShadows = shadows.map(s => s.slug === slug ? { 21425 ...selectedShadow, 21426 shadow 21427 } : s); 21428 setShadows(updatedShadows); 21429 }; 21430 const onMenuClick = action => { 21431 if (action === 'reset') { 21432 const updatedShadows = shadows.map(s => s.slug === slug ? baseSelectedShadow : s); 21433 setSelectedShadow(baseSelectedShadow); 21434 setShadows(updatedShadows); 21435 } else if (action === 'delete') { 21436 setIsConfirmDialogVisible(true); 21437 } else if (action === 'rename') { 21438 setIsRenameModalVisible(true); 21439 } 21440 }; 21441 const handleShadowDelete = () => { 21442 setShadows(shadows.filter(s => s.slug !== slug)); 21443 }; 21444 const handleShadowRename = newName => { 21445 if (!newName) { 21446 return; 21447 } 21448 const updatedShadows = shadows.map(s => s.slug === slug ? { 21449 ...selectedShadow, 21450 name: newName 21451 } : s); 21452 setSelectedShadow({ 21453 ...selectedShadow, 21454 name: newName 21455 }); 21456 setShadows(updatedShadows); 21457 }; 21458 return !selectedShadow ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21459 title: "" 21460 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21461 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21462 justify: "space-between", 21463 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21464 title: selectedShadow.name 21465 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21466 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21467 marginTop: 2, 21468 marginBottom: 0, 21469 paddingX: 4, 21470 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_DropdownMenuV2, { 21471 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21472 size: "small", 21473 icon: more_vertical, 21474 label: (0,external_wp_i18n_namespaceObject.__)('Menu') 21475 }), 21476 children: (category === 'custom' ? customShadowMenuItems : presetShadowMenuItems).map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_DropdownMenuV2.Item, { 21477 onClick: () => onMenuClick(item.action), 21478 disabled: item.action === 'reset' && selectedShadow.shadow === baseSelectedShadow.shadow, 21479 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_DropdownMenuV2.ItemLabel, { 21480 children: item.label 21481 }) 21482 }, item.action)) 21483 }) 21484 }) 21485 })] 21486 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21487 className: "edit-site-global-styles-screen", 21488 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { 21489 shadow: selectedShadow.shadow 21490 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowEditor, { 21491 shadow: selectedShadow.shadow, 21492 onChange: onShadowChange 21493 })] 21494 }), isConfirmDialogVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 21495 isOpen: true, 21496 onConfirm: () => { 21497 handleShadowDelete(); 21498 setIsConfirmDialogVisible(false); 21499 }, 21500 onCancel: () => { 21501 setIsConfirmDialogVisible(false); 21502 }, 21503 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 21504 size: "medium", 21505 children: (0,external_wp_i18n_namespaceObject.sprintf)( 21506 // translators: %s: name of the shadow 21507 'Are you sure you want to delete "%s"?', selectedShadow.name) 21508 }), isRenameModalVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 21509 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 21510 onRequestClose: () => setIsRenameModalVisible(false), 21511 size: "small", 21512 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { 21513 onSubmit: event => { 21514 event.preventDefault(); 21515 handleShadowRename(shadowName); 21516 setIsRenameModalVisible(false); 21517 }, 21518 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 21519 __next40pxDefaultSize: true, 21520 autoComplete: "off", 21521 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 21522 placeholder: (0,external_wp_i18n_namespaceObject.__)('Shadow name'), 21523 value: shadowName, 21524 onChange: value => setShadowName(value) 21525 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21526 marginBottom: 6 21527 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 21528 className: "block-editor-shadow-edit-modal__actions", 21529 justify: "flex-end", 21530 expanded: false, 21531 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21532 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21533 __next40pxDefaultSize: true, 21534 variant: "tertiary", 21535 onClick: () => setIsRenameModalVisible(false), 21536 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 21537 }) 21538 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21539 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21540 __next40pxDefaultSize: true, 21541 variant: "primary", 21542 type: "submit", 21543 children: (0,external_wp_i18n_namespaceObject.__)('Save') 21544 }) 21545 })] 21546 })] 21547 }) 21548 })] 21549 }); 21550 } 21551 function ShadowsPreview({ 21552 shadow 21553 }) { 21554 const shadowStyle = { 21555 boxShadow: shadow 21556 }; 21557 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21558 marginBottom: 4, 21559 marginTop: -2, 21560 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 21561 align: "center", 21562 justify: "center", 21563 className: "edit-site-global-styles__shadow-preview-panel", 21564 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21565 className: "edit-site-global-styles__shadow-preview-block", 21566 style: shadowStyle 21567 }) 21568 }) 21569 }); 21570 } 21571 function ShadowEditor({ 21572 shadow, 21573 onChange 21574 }) { 21575 const shadowParts = (0,external_wp_element_namespaceObject.useMemo)(() => getShadowParts(shadow), [shadow]); 21576 const onChangeShadowPart = (index, part) => { 21577 shadowParts[index] = part; 21578 onChange(shadowParts.join(', ')); 21579 }; 21580 const onAddShadowPart = () => { 21581 shadowParts.push(defaultShadow); 21582 onChange(shadowParts.join(', ')); 21583 }; 21584 const onRemoveShadowPart = index => { 21585 shadowParts.splice(index, 1); 21586 onChange(shadowParts.join(', ')); 21587 }; 21588 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21589 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 21590 spacing: 2, 21591 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21592 justify: "space-between", 21593 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 21594 align: "center", 21595 className: "edit-site-global-styles__shadows-panel__title", 21596 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21597 level: 3, 21598 children: (0,external_wp_i18n_namespaceObject.__)('Shadows') 21599 }) 21600 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21601 className: "edit-site-global-styles__shadows-panel__options-container", 21602 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21603 size: "small", 21604 icon: library_plus, 21605 label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), 21606 onClick: () => { 21607 onAddShadowPart(); 21608 } 21609 }) 21610 })] 21611 }) 21612 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 21613 isBordered: true, 21614 isSeparated: true, 21615 children: shadowParts.map((part, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_ShadowItem, { 21616 shadow: part, 21617 onChange: value => onChangeShadowPart(index, value), 21618 canRemove: shadowParts.length > 1, 21619 onRemove: () => onRemoveShadowPart(index) 21620 }, index)) 21621 })] 21622 }); 21623 } 21624 function shadows_edit_panel_ShadowItem({ 21625 shadow, 21626 onChange, 21627 canRemove, 21628 onRemove 21629 }) { 21630 const popoverProps = { 21631 placement: 'left-start', 21632 offset: 36, 21633 shift: true 21634 }; 21635 const shadowObj = (0,external_wp_element_namespaceObject.useMemo)(() => shadowStringToObject(shadow), [shadow]); 21636 const onShadowChange = newShadow => { 21637 onChange(shadowObjectToString(newShadow)); 21638 }; 21639 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 21640 popoverProps: popoverProps, 21641 className: "edit-site-global-styles__shadow-editor__dropdown", 21642 renderToggle: ({ 21643 onToggle, 21644 isOpen 21645 }) => { 21646 const toggleProps = { 21647 onClick: onToggle, 21648 className: dist_clsx('edit-site-global-styles__shadow-editor__dropdown-toggle', { 21649 'is-open': isOpen 21650 }), 21651 'aria-expanded': isOpen 21652 }; 21653 const removeButtonProps = { 21654 onClick: onRemove, 21655 className: dist_clsx('edit-site-global-styles__shadow-editor__remove-button', { 21656 'is-open': isOpen 21657 }), 21658 label: (0,external_wp_i18n_namespaceObject.__)('Remove shadow') 21659 }; 21660 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21661 align: "center", 21662 justify: "flex-start", 21663 spacing: 0, 21664 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21665 style: { 21666 flexGrow: 1 21667 }, 21668 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21669 __next40pxDefaultSize: true, 21670 icon: library_shadow, 21671 ...toggleProps, 21672 children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)('Inner shadow') : (0,external_wp_i18n_namespaceObject.__)('Drop shadow') 21673 }) 21674 }), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21675 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21676 __next40pxDefaultSize: true, 21677 icon: library_reset, 21678 ...removeButtonProps 21679 }) 21680 })] 21681 }); 21682 }, 21683 renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { 21684 paddingSize: "medium", 21685 className: "edit-site-global-styles__shadow-editor__dropdown-content", 21686 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopover, { 21687 shadowObj: shadowObj, 21688 onChange: onShadowChange 21689 }) 21690 }) 21691 }); 21692 } 21693 function ShadowPopover({ 21694 shadowObj, 21695 onChange 21696 }) { 21697 const __experimentalIsRenderedInSidebar = true; 21698 const enableAlpha = true; 21699 const onShadowChange = (key, value) => { 21700 const newShadow = { 21701 ...shadowObj, 21702 [key]: value 21703 }; 21704 onChange(newShadow); 21705 }; 21706 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21707 spacing: 4, 21708 className: "edit-site-global-styles__shadow-editor-panel", 21709 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorPalette, { 21710 clearable: false, 21711 enableAlpha: enableAlpha, 21712 __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, 21713 value: shadowObj.color, 21714 onChange: value => onShadowChange('color', value) 21715 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 21716 __nextHasNoMarginBottom: true, 21717 value: shadowObj.inset ? 'inset' : 'outset', 21718 isBlock: true, 21719 onChange: value => onShadowChange('inset', value === 'inset'), 21720 hideLabelFromVision: true, 21721 __next40pxDefaultSize: true, 21722 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 21723 value: "outset", 21724 label: (0,external_wp_i18n_namespaceObject.__)('Outset') 21725 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 21726 value: "inset", 21727 label: (0,external_wp_i18n_namespaceObject.__)('Inset') 21728 })] 21729 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 21730 columns: 2, 21731 gap: 4, 21732 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 21733 label: (0,external_wp_i18n_namespaceObject.__)('X Position'), 21734 value: shadowObj.x, 21735 onChange: value => onShadowChange('x', value) 21736 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 21737 label: (0,external_wp_i18n_namespaceObject.__)('Y Position'), 21738 value: shadowObj.y, 21739 onChange: value => onShadowChange('y', value) 21740 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 21741 label: (0,external_wp_i18n_namespaceObject.__)('Blur'), 21742 value: shadowObj.blur, 21743 onChange: value => onShadowChange('blur', value) 21744 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 21745 label: (0,external_wp_i18n_namespaceObject.__)('Spread'), 21746 value: shadowObj.spread, 21747 onChange: value => onShadowChange('spread', value) 21748 })] 21749 })] 21750 }); 21751 } 21752 function ShadowInputControl({ 21753 label, 21754 value, 21755 onChange 21756 }) { 21757 const onValueChange = next => { 21758 const isNumeric = next !== undefined && !isNaN(parseFloat(next)); 21759 const nextValue = isNumeric ? next : '0px'; 21760 onChange(nextValue); 21761 }; 21762 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { 21763 label: label, 21764 __next40pxDefaultSize: true, 21765 value: value, 21766 onChange: onValueChange 21767 }); 21768 } 21769 21770 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js 21771 /** 21772 * Internal dependencies 21773 */ 21774 21775 21776 21777 function ScreenShadows() { 21778 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {}); 21779 } 21780 function ScreenShadowsEdit() { 21781 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {}); 21782 } 21783 21784 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js 21785 /** 21786 * WordPress dependencies 21787 */ 21788 21789 21790 21791 /** 21792 * Internal dependencies 21793 */ 21794 21795 21796 const { 21797 useGlobalStyle: dimensions_panel_useGlobalStyle, 21798 useGlobalSetting: dimensions_panel_useGlobalSetting, 21799 useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement, 21800 DimensionsPanel: dimensions_panel_StylesDimensionsPanel 21801 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21802 const DEFAULT_CONTROLS = { 21803 contentSize: true, 21804 wideSize: true, 21805 padding: true, 21806 margin: true, 21807 blockGap: true, 21808 minHeight: true, 21809 childLayout: false 21810 }; 21811 function DimensionsPanel() { 21812 const [style] = dimensions_panel_useGlobalStyle('', undefined, 'user', { 21813 shouldDecodeEncode: false 21814 }); 21815 const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle('', undefined, 'all', { 21816 shouldDecodeEncode: false 21817 }); 21818 const [userSettings] = dimensions_panel_useGlobalSetting('', undefined, 'user'); 21819 const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting(''); 21820 const settings = dimensions_panel_useSettingsForBlockElement(rawSettings); 21821 21822 // These intermediary objects are needed because the "layout" property is stored 21823 // in settings rather than styles. 21824 const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 21825 return { 21826 ...inheritedStyle, 21827 layout: settings.layout 21828 }; 21829 }, [inheritedStyle, settings.layout]); 21830 const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 21831 return { 21832 ...style, 21833 layout: userSettings.layout 21834 }; 21835 }, [style, userSettings.layout]); 21836 const onChange = newStyle => { 21837 const updatedStyle = { 21838 ...newStyle 21839 }; 21840 delete updatedStyle.layout; 21841 setStyle(updatedStyle); 21842 if (newStyle.layout !== userSettings.layout) { 21843 const updatedSettings = { 21844 ...userSettings, 21845 layout: newStyle.layout 21846 }; 21847 21848 // Ensure any changes to layout definitions are not persisted. 21849 if (updatedSettings.layout?.definitions) { 21850 delete updatedSettings.layout.definitions; 21851 } 21852 setSettings(updatedSettings); 21853 } 21854 }; 21855 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_panel_StylesDimensionsPanel, { 21856 inheritedValue: inheritedStyleWithLayout, 21857 value: styleWithLayout, 21858 onChange: onChange, 21859 settings: settings, 21860 includeLayoutControls: true, 21861 defaultControls: DEFAULT_CONTROLS 21862 }); 21863 } 21864 21865 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js 21866 /** 21867 * WordPress dependencies 21868 */ 21869 21870 21871 21872 /** 21873 * Internal dependencies 21874 */ 21875 21876 21877 21878 21879 21880 21881 const { 21882 useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, 21883 useGlobalSetting: screen_layout_useGlobalSetting, 21884 useSettingsForBlockElement: screen_layout_useSettingsForBlockElement 21885 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21886 function ScreenLayout() { 21887 const [rawSettings] = screen_layout_useGlobalSetting(''); 21888 const settings = screen_layout_useSettingsForBlockElement(rawSettings); 21889 const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings); 21890 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21891 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21892 title: (0,external_wp_i18n_namespaceObject.__)('Layout') 21893 }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {})] 21894 }); 21895 } 21896 /* harmony default export */ const screen_layout = (ScreenLayout); 21897 21898 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js 21899 /** 21900 * WordPress dependencies 21901 */ 21902 21903 21904 21905 21906 21907 21908 21909 /** 21910 * Internal dependencies 21911 */ 21912 21913 21914 21915 21916 21917 const { 21918 GlobalStylesContext: style_variations_container_GlobalStylesContext 21919 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21920 function StyleVariationsContainer({ 21921 gap = 2 21922 }) { 21923 const { 21924 user 21925 } = (0,external_wp_element_namespaceObject.useContext)(style_variations_container_GlobalStylesContext); 21926 const [currentUserStyles, setCurrentUserStyles] = (0,external_wp_element_namespaceObject.useState)(user); 21927 const userStyles = currentUserStyles?.styles; 21928 (0,external_wp_element_namespaceObject.useEffect)(() => { 21929 setCurrentUserStyles(user); 21930 }, [user]); 21931 const variations = (0,external_wp_data_namespaceObject.useSelect)(select => { 21932 return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); 21933 }, []); 21934 21935 // Filter out variations that are color or typography variations. 21936 const fullStyleVariations = variations?.filter(variation => { 21937 return !isVariationWithProperties(variation, ['color']) && !isVariationWithProperties(variation, ['typography', 'spacing']); 21938 }); 21939 const themeVariations = (0,external_wp_element_namespaceObject.useMemo)(() => { 21940 const withEmptyVariation = [{ 21941 title: (0,external_wp_i18n_namespaceObject.__)('Default'), 21942 settings: {}, 21943 styles: {} 21944 }, ...(fullStyleVariations !== null && fullStyleVariations !== void 0 ? fullStyleVariations : [])]; 21945 return [...withEmptyVariation.map(variation => { 21946 var _variation$settings; 21947 const blockStyles = { 21948 ...variation?.styles?.blocks 21949 } || {}; 21950 21951 // We need to copy any user custom CSS to the variation to prevent it being lost 21952 // when switching variations. 21953 if (userStyles?.blocks) { 21954 Object.keys(userStyles.blocks).forEach(blockName => { 21955 // First get any block specific custom CSS from the current user styles and merge with any custom CSS for 21956 // that block in the variation. 21957 if (userStyles.blocks[blockName].css) { 21958 const variationBlockStyles = blockStyles[blockName] || {}; 21959 const customCSS = { 21960 css: `$blockStyles[blockName]?.css || ''} $userStyles.blocks[blockName].css.trim() || ''}` 21961 }; 21962 blockStyles[blockName] = { 21963 ...variationBlockStyles, 21964 ...customCSS 21965 }; 21966 } 21967 }); 21968 } 21969 // Now merge any global custom CSS from current user styles with global custom CSS in the variation. 21970 const css = userStyles?.css || variation.styles?.css ? { 21971 css: `$variation.styles?.css || ''} $userStyles?.css || ''}` 21972 } : {}; 21973 const blocks = Object.keys(blockStyles).length > 0 ? { 21974 blocks: blockStyles 21975 } : {}; 21976 const styles = { 21977 ...variation.styles, 21978 ...css, 21979 ...blocks 21980 }; 21981 return { 21982 ...variation, 21983 settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {}, 21984 styles 21985 }; 21986 })]; 21987 }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); 21988 if (!fullStyleVariations || fullStyleVariations?.length < 1) { 21989 return null; 21990 } 21991 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 21992 columns: 2, 21993 className: "edit-site-global-styles-style-variations-container", 21994 gap: gap, 21995 children: themeVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 21996 variation: variation, 21997 children: isFocused => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, { 21998 label: variation?.title, 21999 withHoverView: true, 22000 isFocused: isFocused, 22001 variation: variation 22002 }) 22003 }, index)) 22004 }); 22005 } 22006 22007 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js 22008 /** 22009 * WordPress dependencies 22010 */ 22011 22012 22013 22014 22015 22016 /** 22017 * Internal dependencies 22018 */ 22019 22020 22021 22022 22023 22024 22025 22026 const content_noop = () => {}; 22027 function SidebarNavigationScreenGlobalStylesContent() { 22028 const { 22029 storedSettings 22030 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22031 const { 22032 getSettings 22033 } = unlock(select(store)); 22034 return { 22035 storedSettings: getSettings() 22036 }; 22037 }, []); 22038 const gap = 3; 22039 22040 // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are 22041 // loaded. This is necessary because the Iframe component waits until 22042 // the block editor store's `__internalIsInitialized` is true before 22043 // rendering the iframe. Without this, the iframe previews will not render 22044 // in mobile viewport sizes, where the editor canvas is hidden. 22045 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 22046 settings: storedSettings, 22047 onChange: content_noop, 22048 onInput: content_noop, 22049 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 22050 spacing: 10, 22051 className: "edit-site-global-styles-variation-container", 22052 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { 22053 gap: gap 22054 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { 22055 title: (0,external_wp_i18n_namespaceObject.__)('Palettes'), 22056 gap: gap 22057 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { 22058 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 22059 gap: gap 22060 })] 22061 }) 22062 }); 22063 } 22064 22065 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js 22066 /** 22067 * WordPress dependencies 22068 */ 22069 22070 22071 22072 22073 22074 22075 /** 22076 * Internal dependencies 22077 */ 22078 22079 22080 22081 22082 22083 function ScreenStyleVariations() { 22084 // Style Variations should only be previewed in with 22085 // - a "zoomed out" editor 22086 // - "Desktop" device preview 22087 const { 22088 setDeviceType 22089 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 22090 (0,external_wp_blockEditor_namespaceObject.useZoomOut)(); 22091 setDeviceType('desktop'); 22092 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22093 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22094 title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'), 22095 description: (0,external_wp_i18n_namespaceObject.__)('Choose a variation to change the look of the site.') 22096 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 22097 size: "small", 22098 isBorderless: true, 22099 className: "edit-site-global-styles-screen-style-variations", 22100 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { 22101 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) 22102 }) 22103 })] 22104 }); 22105 } 22106 /* harmony default export */ const screen_style_variations = (ScreenStyleVariations); 22107 22108 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 22109 /** 22110 * WordPress dependencies 22111 */ 22112 22113 22114 const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22115 xmlns: "http://www.w3.org/2000/svg", 22116 viewBox: "0 0 24 24", 22117 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22118 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" 22119 }) 22120 }); 22121 /* harmony default export */ const close_small = (closeSmall); 22122 22123 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js 22124 /** 22125 * WordPress dependencies 22126 */ 22127 22128 22129 22130 22131 22132 22133 22134 22135 22136 22137 /** 22138 * Internal dependencies 22139 */ 22140 22141 22142 22143 22144 const { 22145 EditorContentSlotFill, 22146 ResizableEditor 22147 } = unlock(external_wp_editor_namespaceObject.privateApis); 22148 22149 /** 22150 * Returns a translated string for the title of the editor canvas container. 22151 * 22152 * @param {string} view Editor canvas container view. 22153 * 22154 * @return {Object} Translated string for the view title and associated icon, both defaulting to ''. 22155 */ 22156 function getEditorCanvasContainerTitle(view) { 22157 switch (view) { 22158 case 'style-book': 22159 return (0,external_wp_i18n_namespaceObject.__)('Style Book'); 22160 case 'global-styles-revisions': 22161 case 'global-styles-revisions:style-book': 22162 return (0,external_wp_i18n_namespaceObject.__)('Style Revisions'); 22163 default: 22164 return ''; 22165 } 22166 } 22167 function EditorCanvasContainer({ 22168 children, 22169 closeButtonLabel, 22170 onClose, 22171 enableResizing = false 22172 }) { 22173 const { 22174 editorCanvasContainerView, 22175 showListViewByDefault 22176 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22177 const _editorCanvasContainerView = unlock(select(store)).getEditorCanvasContainerView(); 22178 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 22179 return { 22180 editorCanvasContainerView: _editorCanvasContainerView, 22181 showListViewByDefault: _showListViewByDefault 22182 }; 22183 }, []); 22184 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 22185 const { 22186 setEditorCanvasContainerView 22187 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 22188 const { 22189 setIsListViewOpened 22190 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 22191 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); 22192 const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); 22193 function onCloseContainer() { 22194 setIsListViewOpened(showListViewByDefault); 22195 setEditorCanvasContainerView(undefined); 22196 setIsClosed(true); 22197 if (typeof onClose === 'function') { 22198 onClose(); 22199 } 22200 } 22201 function closeOnEscape(event) { 22202 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 22203 event.preventDefault(); 22204 onCloseContainer(); 22205 } 22206 } 22207 const childrenWithProps = Array.isArray(children) ? external_wp_element_namespaceObject.Children.map(children, (child, index) => index === 0 ? (0,external_wp_element_namespaceObject.cloneElement)(child, { 22208 ref: sectionFocusReturnRef 22209 }) : child) : (0,external_wp_element_namespaceObject.cloneElement)(children, { 22210 ref: sectionFocusReturnRef 22211 }); 22212 if (isClosed) { 22213 return null; 22214 } 22215 const title = getEditorCanvasContainerTitle(editorCanvasContainerView); 22216 const shouldShowCloseButton = onClose || closeButtonLabel; 22217 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { 22218 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22219 className: "edit-site-editor-canvas-container", 22220 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { 22221 enableResizing: enableResizing, 22222 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { 22223 className: "edit-site-editor-canvas-container__section", 22224 ref: shouldShowCloseButton ? focusOnMountRef : null, 22225 onKeyDown: closeOnEscape, 22226 "aria-label": title, 22227 children: [shouldShowCloseButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 22228 __next40pxDefaultSize: true, 22229 className: "edit-site-editor-canvas-container__close-button", 22230 icon: close_small, 22231 label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close'), 22232 onClick: onCloseContainer 22233 }), childrenWithProps] 22234 }) 22235 }) 22236 }) 22237 }); 22238 } 22239 function useHasEditorCanvasContainer() { 22240 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.privateKey); 22241 return !!fills?.length; 22242 } 22243 /* harmony default export */ const editor_canvas_container = (EditorCanvasContainer); 22244 22245 22246 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js 22247 /** 22248 * External dependencies 22249 */ 22250 22251 22252 /** 22253 * WordPress dependencies 22254 */ 22255 22256 22257 22258 22259 22260 22261 22262 22263 22264 22265 /** 22266 * Internal dependencies 22267 */ 22268 22269 22270 22271 22272 const { 22273 ExperimentalBlockEditorProvider, 22274 useGlobalStyle: style_book_useGlobalStyle, 22275 GlobalStylesContext: style_book_GlobalStylesContext, 22276 useGlobalStylesOutputWithConfig 22277 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22278 const { 22279 mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs 22280 } = unlock(external_wp_editor_namespaceObject.privateApis); 22281 const { 22282 Tabs: style_book_Tabs 22283 } = unlock(external_wp_components_namespaceObject.privateApis); 22284 22285 // The content area of the Style Book is rendered within an iframe so that global styles 22286 // are applied to elements within the entire content area. To support elements that are 22287 // not part of the block previews, such as headings and layout for the block previews, 22288 // additional CSS rules need to be passed into the iframe. These are hard-coded below. 22289 // Note that button styles are unset, and then focus rules from the `Button` component are 22290 // applied to the `button` element, targeted via `.edit-site-style-book__example`. 22291 // This is to ensure that browser default styles for buttons are not applied to the previews. 22292 const STYLE_BOOK_IFRAME_STYLES = ` 22293 .edit-site-style-book__examples { 22294 max-width: 900px; 22295 margin: 0 auto; 22296 } 22297 22298 .edit-site-style-book__example { 22299 border-radius: 2px; 22300 cursor: pointer; 22301 display: flex; 22302 flex-direction: column; 22303 gap: 40px; 22304 margin-bottom: 40px; 22305 padding: 16px; 22306 width: 100%; 22307 box-sizing: border-box; 22308 scroll-margin-top: 32px; 22309 scroll-margin-bottom: 32px; 22310 } 22311 22312 .edit-site-style-book__example.is-selected { 22313 box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22314 } 22315 22316 .edit-site-style-book__example:focus:not(:disabled) { 22317 box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22318 outline: 3px solid transparent; 22319 } 22320 22321 .edit-site-style-book__examples.is-wide .edit-site-style-book__example { 22322 flex-direction: row; 22323 } 22324 22325 .edit-site-style-book__example-title { 22326 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 22327 font-size: 11px; 22328 font-weight: 500; 22329 line-height: normal; 22330 margin: 0; 22331 text-align: left; 22332 text-transform: uppercase; 22333 } 22334 22335 .edit-site-style-book__examples.is-wide .edit-site-style-book__example-title { 22336 text-align: right; 22337 width: 120px; 22338 } 22339 22340 .edit-site-style-book__example-preview { 22341 width: 100%; 22342 } 22343 22344 .edit-site-style-book__example-preview .block-editor-block-list__insertion-point, 22345 .edit-site-style-book__example-preview .block-list-appender { 22346 display: none; 22347 } 22348 22349 .edit-site-style-book__example-preview .is-root-container > .wp-block:first-child { 22350 margin-top: 0; 22351 } 22352 .edit-site-style-book__example-preview .is-root-container > .wp-block:last-child { 22353 margin-bottom: 0; 22354 } 22355 `; 22356 function isObjectEmpty(object) { 22357 return !object || Object.keys(object).length === 0; 22358 } 22359 function getExamples() { 22360 const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => { 22361 const { 22362 name, 22363 example, 22364 supports 22365 } = blockType; 22366 return name !== 'core/heading' && !!example && supports.inserter !== false; 22367 }).map(blockType => ({ 22368 name: blockType.name, 22369 title: blockType.title, 22370 category: blockType.category, 22371 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, blockType.example) 22372 })); 22373 const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/heading'); 22374 if (!isHeadingBlockRegistered) { 22375 return nonHeadingBlockExamples; 22376 } 22377 22378 // Use our own example for the Heading block so that we can show multiple 22379 // heading levels. 22380 const headingsExample = { 22381 name: 'core/heading', 22382 title: (0,external_wp_i18n_namespaceObject.__)('Headings'), 22383 category: 'text', 22384 blocks: [1, 2, 3, 4, 5, 6].map(level => { 22385 return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { 22386 content: (0,external_wp_i18n_namespaceObject.sprintf)( 22387 // translators: %d: heading level e.g: "1", "2", "3" 22388 (0,external_wp_i18n_namespaceObject.__)('Heading %d'), level), 22389 level 22390 }); 22391 }) 22392 }; 22393 return [headingsExample, ...nonHeadingBlockExamples]; 22394 } 22395 function StyleBook({ 22396 enableResizing = true, 22397 isSelected, 22398 onClick, 22399 onSelect, 22400 showCloseButton = true, 22401 onClose, 22402 showTabs = true, 22403 userConfig = {} 22404 }) { 22405 const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 22406 const [textColor] = style_book_useGlobalStyle('color.text'); 22407 const [backgroundColor] = style_book_useGlobalStyle('color.background'); 22408 const [examples] = (0,external_wp_element_namespaceObject.useState)(getExamples); 22409 const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_blocks_namespaceObject.getCategories)().filter(category => examples.some(example => example.category === category.slug)).map(category => ({ 22410 name: category.slug, 22411 title: category.title, 22412 icon: category.icon 22413 })), [examples]); 22414 const { 22415 base: baseConfig 22416 } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); 22417 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 22418 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 22419 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 22420 } 22421 return {}; 22422 }, [baseConfig, userConfig]); 22423 22424 // Copied from packages/edit-site/src/components/revisions/index.js 22425 // could we create a shared hook? 22426 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 22427 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 22428 ...originalSettings, 22429 __unstableIsPreviewMode: true 22430 }), [originalSettings]); 22431 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 22432 settings.styles = !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : settings.styles; 22433 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 22434 onClose: onClose, 22435 enableResizing: enableResizing, 22436 closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)('Close') : null, 22437 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 22438 className: dist_clsx('edit-site-style-book', { 22439 'is-wide': sizes.width > 600, 22440 'is-button': !!onClick 22441 }), 22442 style: { 22443 color: textColor, 22444 background: backgroundColor 22445 }, 22446 children: [resizeObserver, showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22447 className: "edit-site-style-book__tabs", 22448 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { 22449 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { 22450 children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.Tab, { 22451 tabId: tab.name, 22452 children: tab.title 22453 }, tab.name)) 22454 }), tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabPanel, { 22455 tabId: tab.name, 22456 focusable: false, 22457 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 22458 category: tab.name, 22459 examples: examples, 22460 isSelected: isSelected, 22461 onSelect: onSelect, 22462 settings: settings, 22463 sizes: sizes, 22464 title: tab.title 22465 }) 22466 }, tab.name))] 22467 }) 22468 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 22469 examples: examples, 22470 isSelected: isSelected, 22471 onClick: onClick, 22472 onSelect: onSelect, 22473 settings: settings, 22474 sizes: sizes 22475 })] 22476 }) 22477 }); 22478 } 22479 const StyleBookBody = ({ 22480 category, 22481 examples, 22482 isSelected, 22483 onClick, 22484 onSelect, 22485 settings, 22486 sizes, 22487 title 22488 }) => { 22489 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 22490 22491 // The presence of an `onClick` prop indicates that the Style Book is being used as a button. 22492 // In this case, add additional props to the iframe to make it behave like a button. 22493 const buttonModeProps = { 22494 role: 'button', 22495 onFocus: () => setIsFocused(true), 22496 onBlur: () => setIsFocused(false), 22497 onKeyDown: event => { 22498 if (event.defaultPrevented) { 22499 return; 22500 } 22501 const { 22502 keyCode 22503 } = event; 22504 if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) { 22505 event.preventDefault(); 22506 onClick(event); 22507 } 22508 }, 22509 onClick: event => { 22510 if (event.defaultPrevented) { 22511 return; 22512 } 22513 if (onClick) { 22514 event.preventDefault(); 22515 onClick(event); 22516 } 22517 }, 22518 readonly: true 22519 }; 22520 const buttonModeStyles = onClick ? 'body { cursor: pointer; } body * { pointer-events: none; }' : ''; 22521 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 22522 className: dist_clsx('edit-site-style-book__iframe', { 22523 'is-focused': isFocused && !!onClick, 22524 'is-button': !!onClick 22525 }), 22526 name: "style-book-canvas", 22527 tabIndex: 0, 22528 ...(onClick ? buttonModeProps : {}), 22529 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 22530 styles: settings.styles 22531 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { 22532 children: 22533 // Forming a "block formatting context" to prevent margin collapsing. 22534 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 22535 `.is-root-container { display: flow-root; } 22536 body { position: relative; padding: 32px !important; }` + STYLE_BOOK_IFRAME_STYLES + buttonModeStyles 22537 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Examples, { 22538 className: dist_clsx('edit-site-style-book__examples', { 22539 'is-wide': sizes.width > 600 22540 }), 22541 examples: examples, 22542 category: category, 22543 label: title ? (0,external_wp_i18n_namespaceObject.sprintf)( 22544 // translators: %s: Category of blocks, e.g. Text. 22545 (0,external_wp_i18n_namespaceObject.__)('Examples of blocks in the %s category'), title) : (0,external_wp_i18n_namespaceObject.__)('Examples of blocks'), 22546 isSelected: isSelected, 22547 onSelect: onSelect 22548 }, category)] 22549 }); 22550 }; 22551 const Examples = (0,external_wp_element_namespaceObject.memo)(({ 22552 className, 22553 examples, 22554 category, 22555 label, 22556 isSelected, 22557 onSelect 22558 }) => { 22559 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 22560 orientation: "vertical", 22561 className: className, 22562 "aria-label": label, 22563 role: "grid", 22564 children: examples.filter(example => category ? example.category === category : true).map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { 22565 id: `example-$example.name}`, 22566 title: example.title, 22567 blocks: example.blocks, 22568 isSelected: isSelected(example.name), 22569 onClick: () => { 22570 onSelect?.(example.name); 22571 } 22572 }, example.name)) 22573 }); 22574 }); 22575 const Example = ({ 22576 id, 22577 title, 22578 blocks, 22579 isSelected, 22580 onClick 22581 }) => { 22582 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 22583 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 22584 ...originalSettings, 22585 focusMode: false, 22586 // Disable "Spotlight mode". 22587 __unstableIsPreviewMode: true 22588 }), [originalSettings]); 22589 22590 // Cache the list of blocks to avoid additional processing when the component is re-rendered. 22591 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 22592 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22593 role: "row", 22594 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22595 role: "gridcell", 22596 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 22597 className: dist_clsx('edit-site-style-book__example', { 22598 'is-selected': isSelected 22599 }), 22600 id: id, 22601 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 22602 // translators: %s: Title of a block, e.g. Heading. 22603 (0,external_wp_i18n_namespaceObject.__)('Open %s styles in Styles panel'), title), 22604 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 22605 role: "button", 22606 onClick: onClick, 22607 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 22608 className: "edit-site-style-book__example-title", 22609 children: title 22610 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22611 className: "edit-site-style-book__example-preview", 22612 "aria-hidden": true, 22613 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 22614 className: "edit-site-style-book__example-preview__content", 22615 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { 22616 value: renderedBlocks, 22617 settings: settings, 22618 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 22619 renderAppender: false 22620 }) 22621 }) 22622 }) 22623 })] 22624 }) 22625 }) 22626 }); 22627 }; 22628 /* harmony default export */ const style_book = (StyleBook); 22629 22630 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js 22631 /** 22632 * WordPress dependencies 22633 */ 22634 22635 22636 22637 22638 /** 22639 * Internal dependencies 22640 */ 22641 22642 22643 22644 22645 22646 const { 22647 useGlobalStyle: screen_css_useGlobalStyle, 22648 AdvancedPanel: screen_css_StylesAdvancedPanel 22649 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22650 function ScreenCSS() { 22651 const description = (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.'); 22652 const [style] = screen_css_useGlobalStyle('', undefined, 'user', { 22653 shouldDecodeEncode: false 22654 }); 22655 const [inheritedStyle, setStyle] = screen_css_useGlobalStyle('', undefined, 'all', { 22656 shouldDecodeEncode: false 22657 }); 22658 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22659 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22660 title: (0,external_wp_i18n_namespaceObject.__)('CSS'), 22661 description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22662 children: [description, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 22663 href: (0,external_wp_i18n_namespaceObject.__)('https://developer.wordpress.org/advanced-administration/wordpress/css/'), 22664 className: "edit-site-global-styles-screen-css-help-link", 22665 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about CSS') 22666 })] 22667 }) 22668 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22669 className: "edit-site-global-styles-screen-css", 22670 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_StylesAdvancedPanel, { 22671 value: style, 22672 onChange: setStyle, 22673 inheritedValue: inheritedStyle 22674 }) 22675 })] 22676 }); 22677 } 22678 /* harmony default export */ const screen_css = (ScreenCSS); 22679 22680 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js 22681 /** 22682 * WordPress dependencies 22683 */ 22684 22685 22686 22687 22688 22689 22690 22691 /** 22692 * Internal dependencies 22693 */ 22694 22695 22696 22697 22698 22699 const { 22700 ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider, 22701 GlobalStylesContext: revisions_GlobalStylesContext, 22702 useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig, 22703 __unstableBlockStyleVariationOverridesWithConfig 22704 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22705 const { 22706 mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs 22707 } = unlock(external_wp_editor_namespaceObject.privateApis); 22708 function revisions_isObjectEmpty(object) { 22709 return !object || Object.keys(object).length === 0; 22710 } 22711 function Revisions({ 22712 userConfig, 22713 blocks 22714 }) { 22715 const { 22716 base: baseConfig 22717 } = (0,external_wp_element_namespaceObject.useContext)(revisions_GlobalStylesContext); 22718 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 22719 if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) { 22720 return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig); 22721 } 22722 return {}; 22723 }, [baseConfig, userConfig]); 22724 const renderedBlocksArray = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 22725 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 22726 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 22727 ...originalSettings, 22728 __unstableIsPreviewMode: true 22729 }), [originalSettings]); 22730 const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig); 22731 const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles; 22732 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 22733 title: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 22734 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions'), 22735 enableResizing: true, 22736 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 22737 className: "edit-site-revisions__iframe", 22738 name: "revisions", 22739 tabIndex: 0, 22740 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { 22741 children: 22742 // Forming a "block formatting context" to prevent margin collapsing. 22743 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 22744 `.is-root-container { display: flow-root; }` 22745 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 22746 className: "edit-site-revisions__example-preview__content", 22747 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(revisions_ExperimentalBlockEditorProvider, { 22748 value: renderedBlocksArray, 22749 settings: settings, 22750 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 22751 renderAppender: false 22752 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 22753 styles: editorStyles 22754 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(__unstableBlockStyleVariationOverridesWithConfig, { 22755 config: mergedConfig 22756 })] 22757 }) 22758 })] 22759 }) 22760 }); 22761 } 22762 /* harmony default export */ const components_revisions = (Revisions); 22763 22764 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js 22765 /** 22766 * WordPress dependencies 22767 */ 22768 22769 22770 22771 22772 22773 /** 22774 * Internal dependencies 22775 */ 22776 22777 const SITE_EDITOR_AUTHORS_QUERY = { 22778 per_page: -1, 22779 _fields: 'id,name,avatar_urls', 22780 context: 'view', 22781 capabilities: ['edit_theme_options'] 22782 }; 22783 const DEFAULT_QUERY = { 22784 per_page: 100, 22785 page: 1 22786 }; 22787 const use_global_styles_revisions_EMPTY_ARRAY = []; 22788 const { 22789 GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext 22790 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22791 function useGlobalStylesRevisions({ 22792 query 22793 } = {}) { 22794 const { 22795 user: userConfig 22796 } = (0,external_wp_element_namespaceObject.useContext)(use_global_styles_revisions_GlobalStylesContext); 22797 const _query = { 22798 ...DEFAULT_QUERY, 22799 ...query 22800 }; 22801 const { 22802 authors, 22803 currentUser, 22804 isDirty, 22805 revisions, 22806 isLoadingGlobalStylesRevisions, 22807 revisionsCount 22808 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22809 var _globalStyles$_links$; 22810 const { 22811 __experimentalGetDirtyEntityRecords, 22812 getCurrentUser, 22813 getUsers, 22814 getRevisions, 22815 __experimentalGetCurrentGlobalStylesId, 22816 getEntityRecord, 22817 isResolving 22818 } = select(external_wp_coreData_namespaceObject.store); 22819 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 22820 const _currentUser = getCurrentUser(); 22821 const _isDirty = dirtyEntityRecords.length > 0; 22822 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 22823 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 22824 const _revisionsCount = (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0; 22825 const globalStylesRevisions = getRevisions('root', 'globalStyles', globalStylesId, _query) || use_global_styles_revisions_EMPTY_ARRAY; 22826 const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY; 22827 const _isResolving = isResolving('getRevisions', ['root', 'globalStyles', globalStylesId, _query]); 22828 return { 22829 authors: _authors, 22830 currentUser: _currentUser, 22831 isDirty: _isDirty, 22832 revisions: globalStylesRevisions, 22833 isLoadingGlobalStylesRevisions: _isResolving, 22834 revisionsCount: _revisionsCount 22835 }; 22836 }, [query]); 22837 return (0,external_wp_element_namespaceObject.useMemo)(() => { 22838 if (!authors.length || isLoadingGlobalStylesRevisions) { 22839 return { 22840 revisions: use_global_styles_revisions_EMPTY_ARRAY, 22841 hasUnsavedChanges: isDirty, 22842 isLoading: true, 22843 revisionsCount 22844 }; 22845 } 22846 22847 // Adds author details to each revision. 22848 const _modifiedRevisions = revisions.map(revision => { 22849 return { 22850 ...revision, 22851 author: authors.find(author => author.id === revision.author) 22852 }; 22853 }); 22854 const fetchedRevisionsCount = revisions.length; 22855 if (fetchedRevisionsCount) { 22856 // Flags the most current saved revision. 22857 if (_modifiedRevisions[0].id !== 'unsaved' && _query.page === 1) { 22858 _modifiedRevisions[0].isLatest = true; 22859 } 22860 22861 // Adds an item for unsaved changes. 22862 if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { 22863 const unsavedRevision = { 22864 id: 'unsaved', 22865 styles: userConfig?.styles, 22866 settings: userConfig?.settings, 22867 _links: userConfig?._links, 22868 author: { 22869 name: currentUser?.name, 22870 avatar_urls: currentUser?.avatar_urls 22871 }, 22872 modified: new Date() 22873 }; 22874 _modifiedRevisions.unshift(unsavedRevision); 22875 } 22876 if (_query.page === Math.ceil(revisionsCount / _query.per_page)) { 22877 // Adds an item for the default theme styles. 22878 _modifiedRevisions.push({ 22879 id: 'parent', 22880 styles: {}, 22881 settings: {} 22882 }); 22883 } 22884 } 22885 return { 22886 revisions: _modifiedRevisions, 22887 hasUnsavedChanges: isDirty, 22888 isLoading: false, 22889 revisionsCount 22890 }; 22891 }, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]); 22892 } 22893 22894 ;// CONCATENATED MODULE: external ["wp","date"] 22895 const external_wp_date_namespaceObject = window["wp"]["date"]; 22896 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js 22897 /** 22898 * External dependencies 22899 */ 22900 22901 22902 /** 22903 * WordPress dependencies 22904 */ 22905 22906 22907 22908 22909 22910 22911 22912 /** 22913 * Internal dependencies 22914 */ 22915 22916 22917 22918 const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24; 22919 const { 22920 getGlobalStylesChanges 22921 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22922 function ChangesSummary({ 22923 revision, 22924 previousRevision 22925 }) { 22926 const changes = getGlobalStylesChanges(revision, previousRevision, { 22927 maxResults: 7 22928 }); 22929 if (!changes.length) { 22930 return null; 22931 } 22932 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 22933 "data-testid": "global-styles-revision-changes", 22934 className: "edit-site-global-styles-screen-revisions__changes", 22935 children: changes.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 22936 children: change 22937 }, change)) 22938 }); 22939 } 22940 22941 /** 22942 * Returns a button label for the revision. 22943 * 22944 * @param {string|number} id A revision object. 22945 * @param {string} authorDisplayName Author name. 22946 * @param {string} formattedModifiedDate Revision modified date formatted. 22947 * @param {boolean} areStylesEqual Whether the revision matches the current editor styles. 22948 * @return {string} Translated label. 22949 */ 22950 function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) { 22951 if ('parent' === id) { 22952 return (0,external_wp_i18n_namespaceObject.__)('Reset the styles to the theme defaults'); 22953 } 22954 if ('unsaved' === id) { 22955 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: author display name */ 22956 (0,external_wp_i18n_namespaceObject.__)('Unsaved changes by %s'), authorDisplayName); 22957 } 22958 return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)( 22959 // translators: %1$s: author display name, %2$s: revision creation date. 22960 (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)( 22961 // translators: %1$s: author display name, %2$s: revision creation date. 22962 (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s'), authorDisplayName, formattedModifiedDate); 22963 } 22964 22965 /** 22966 * Returns a rendered list of revisions buttons. 22967 * 22968 * @typedef {Object} props 22969 * @property {Array<Object>} userRevisions A collection of user revisions. 22970 * @property {number} selectedRevisionId The id of the currently-selected revision. 22971 * @property {Function} onChange Callback fired when a revision is selected. 22972 * 22973 * @param {props} Component props. 22974 * @return {JSX.Element} The modal component. 22975 */ 22976 function RevisionsButtons({ 22977 userRevisions, 22978 selectedRevisionId, 22979 onChange, 22980 canApplyRevision, 22981 onApplyRevision 22982 }) { 22983 const { 22984 currentThemeName, 22985 currentUser 22986 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22987 const { 22988 getCurrentTheme, 22989 getCurrentUser 22990 } = select(external_wp_coreData_namespaceObject.store); 22991 const currentTheme = getCurrentTheme(); 22992 return { 22993 currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet, 22994 currentUser: getCurrentUser() 22995 }; 22996 }, []); 22997 const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime(); 22998 const { 22999 datetimeAbbreviated 23000 } = (0,external_wp_date_namespaceObject.getSettings)().formats; 23001 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ol", { 23002 className: "edit-site-global-styles-screen-revisions__revisions-list", 23003 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Global styles revisions list'), 23004 role: "group", 23005 children: userRevisions.map((revision, index) => { 23006 const { 23007 id, 23008 author, 23009 modified 23010 } = revision; 23011 const isUnsaved = 'unsaved' === id; 23012 // Unsaved changes are created by the current user. 23013 const revisionAuthor = isUnsaved ? currentUser : author; 23014 const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)('User'); 23015 const authorAvatar = revisionAuthor?.avatar_urls?.['48']; 23016 const isFirstItem = index === 0; 23017 const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem; 23018 const areStylesEqual = !canApplyRevision && isSelected; 23019 const isReset = 'parent' === id; 23020 const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified); 23021 const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified); 23022 const revisionLabel = getRevisionLabel(id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual); 23023 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 23024 className: dist_clsx('edit-site-global-styles-screen-revisions__revision-item', { 23025 'is-selected': isSelected, 23026 'is-active': areStylesEqual, 23027 'is-reset': isReset 23028 }), 23029 "aria-current": isSelected, 23030 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23031 __next40pxDefaultSize: true, 23032 className: "edit-site-global-styles-screen-revisions__revision-button", 23033 accessibleWhenDisabled: true, 23034 disabled: isSelected, 23035 onClick: () => { 23036 onChange(revision); 23037 }, 23038 "aria-label": revisionLabel, 23039 children: isReset ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23040 className: "edit-site-global-styles-screen-revisions__description", 23041 children: [(0,external_wp_i18n_namespaceObject.__)('Default styles'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23042 className: "edit-site-global-styles-screen-revisions__meta", 23043 children: currentThemeName 23044 })] 23045 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23046 className: "edit-site-global-styles-screen-revisions__description", 23047 children: [isUnsaved ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23048 className: "edit-site-global-styles-screen-revisions__date", 23049 children: (0,external_wp_i18n_namespaceObject.__)('(Unsaved)') 23050 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 23051 className: "edit-site-global-styles-screen-revisions__date", 23052 dateTime: modified, 23053 children: displayDate 23054 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23055 className: "edit-site-global-styles-screen-revisions__meta", 23056 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 23057 alt: authorDisplayName, 23058 src: authorAvatar 23059 }), authorDisplayName] 23060 }), isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangesSummary, { 23061 revision: revision, 23062 previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {} 23063 })] 23064 }) 23065 }), isSelected && (areStylesEqual ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 23066 className: "edit-site-global-styles-screen-revisions__applied-text", 23067 children: (0,external_wp_i18n_namespaceObject.__)('These styles are already applied to your site.') 23068 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23069 size: "compact", 23070 variant: "primary", 23071 className: "edit-site-global-styles-screen-revisions__apply-button", 23072 onClick: onApplyRevision, 23073 children: isReset ? (0,external_wp_i18n_namespaceObject.__)('Reset to defaults') : (0,external_wp_i18n_namespaceObject.__)('Apply') 23074 }))] 23075 }, id); 23076 }) 23077 }); 23078 } 23079 /* harmony default export */ const revisions_buttons = (RevisionsButtons); 23080 23081 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js 23082 /** 23083 * WordPress dependencies 23084 */ 23085 23086 23087 const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 23088 xmlns: "http://www.w3.org/2000/svg", 23089 viewBox: "0 0 24 24", 23090 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 23091 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" 23092 }) 23093 }); 23094 /* harmony default export */ const library_next = (next); 23095 23096 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js 23097 /** 23098 * WordPress dependencies 23099 */ 23100 23101 23102 const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 23103 xmlns: "http://www.w3.org/2000/svg", 23104 viewBox: "0 0 24 24", 23105 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 23106 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" 23107 }) 23108 }); 23109 /* harmony default export */ const library_previous = (previous); 23110 23111 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js 23112 /** 23113 * External dependencies 23114 */ 23115 23116 23117 /** 23118 * WordPress dependencies 23119 */ 23120 23121 23122 23123 23124 23125 function Pagination({ 23126 currentPage, 23127 numPages, 23128 changePage, 23129 totalItems, 23130 className, 23131 disabled = false, 23132 buttonVariant = 'tertiary', 23133 label = (0,external_wp_i18n_namespaceObject.__)('Pagination Navigation') 23134 }) { 23135 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 23136 expanded: false, 23137 as: "nav", 23138 "aria-label": label, 23139 spacing: 3, 23140 justify: "flex-start", 23141 className: dist_clsx('edit-site-pagination', className), 23142 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 23143 variant: "muted", 23144 className: "edit-site-pagination__total", 23145 children: 23146 // translators: %s: Total number of patterns. 23147 (0,external_wp_i18n_namespaceObject.sprintf)( 23148 // translators: %s: Total number of patterns. 23149 (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems) 23150 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 23151 expanded: false, 23152 spacing: 1, 23153 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23154 variant: buttonVariant, 23155 onClick: () => changePage(1), 23156 accessibleWhenDisabled: true, 23157 disabled: disabled || currentPage === 1, 23158 label: (0,external_wp_i18n_namespaceObject.__)('First page'), 23159 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 23160 size: "compact" 23161 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23162 variant: buttonVariant, 23163 onClick: () => changePage(currentPage - 1), 23164 accessibleWhenDisabled: true, 23165 disabled: disabled || currentPage === 1, 23166 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 23167 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 23168 size: "compact" 23169 })] 23170 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 23171 variant: "muted", 23172 children: (0,external_wp_i18n_namespaceObject.sprintf)( 23173 // translators: %1$s: Current page number, %2$s: Total number of pages. 23174 (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages) 23175 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 23176 expanded: false, 23177 spacing: 1, 23178 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23179 variant: buttonVariant, 23180 onClick: () => changePage(currentPage + 1), 23181 accessibleWhenDisabled: true, 23182 disabled: disabled || currentPage === numPages, 23183 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 23184 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, 23185 size: "compact" 23186 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23187 variant: buttonVariant, 23188 onClick: () => changePage(numPages), 23189 accessibleWhenDisabled: true, 23190 disabled: disabled || currentPage === numPages, 23191 label: (0,external_wp_i18n_namespaceObject.__)('Last page'), 23192 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 23193 size: "compact" 23194 })] 23195 })] 23196 }); 23197 } 23198 23199 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js 23200 /** 23201 * WordPress dependencies 23202 */ 23203 23204 23205 23206 23207 23208 23209 /** 23210 * Internal dependencies 23211 */ 23212 23213 23214 23215 23216 23217 23218 23219 23220 23221 23222 23223 const { 23224 GlobalStylesContext: screen_revisions_GlobalStylesContext, 23225 areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual 23226 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23227 const PAGE_SIZE = 10; 23228 function ScreenRevisions() { 23229 const { 23230 goTo 23231 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23232 const { 23233 user: currentEditorGlobalStyles, 23234 setUserConfig 23235 } = (0,external_wp_element_namespaceObject.useContext)(screen_revisions_GlobalStylesContext); 23236 const { 23237 blocks, 23238 editorCanvasContainerView 23239 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 23240 editorCanvasContainerView: unlock(select(store)).getEditorCanvasContainerView(), 23241 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() 23242 }), []); 23243 const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); 23244 const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_namespaceObject.useState)([]); 23245 const { 23246 revisions, 23247 isLoading, 23248 hasUnsavedChanges, 23249 revisionsCount 23250 } = useGlobalStylesRevisions({ 23251 query: { 23252 per_page: PAGE_SIZE, 23253 page: currentPage 23254 } 23255 }); 23256 const numPages = Math.ceil(revisionsCount / PAGE_SIZE); 23257 const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_namespaceObject.useState)(currentEditorGlobalStyles); 23258 const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = (0,external_wp_element_namespaceObject.useState)(false); 23259 const { 23260 setEditorCanvasContainerView 23261 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 23262 const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(currentlySelectedRevision, currentEditorGlobalStyles); 23263 const onCloseRevisions = () => { 23264 goTo('/'); // Return to global styles main panel. 23265 const canvasContainerView = editorCanvasContainerView === 'global-styles-revisions:style-book' ? 'style-book' : undefined; 23266 setEditorCanvasContainerView(canvasContainerView); 23267 }; 23268 const restoreRevision = revision => { 23269 setUserConfig(() => revision); 23270 setIsLoadingRevisionWithUnsavedChanges(false); 23271 onCloseRevisions(); 23272 }; 23273 (0,external_wp_element_namespaceObject.useEffect)(() => { 23274 if (!editorCanvasContainerView || !editorCanvasContainerView.startsWith('global-styles-revisions')) { 23275 goTo('/'); // Return to global styles main panel. 23276 } 23277 }, [editorCanvasContainerView]); 23278 (0,external_wp_element_namespaceObject.useEffect)(() => { 23279 if (!isLoading && revisions.length) { 23280 setCurrentRevisions(revisions); 23281 } 23282 }, [revisions, isLoading]); 23283 const firstRevision = revisions[0]; 23284 const currentlySelectedRevisionId = currentlySelectedRevision?.id; 23285 const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId; 23286 (0,external_wp_element_namespaceObject.useEffect)(() => { 23287 /* 23288 * Ensure that the first item is selected and loaded into the preview pane 23289 * when no revision is selected and the selected styles don't match the current editor styles. 23290 * This is required in case editor styles are changed outside the revisions panel, 23291 * e.g., via the reset styles function of useGlobalStylesReset(). 23292 * See: https://github.com/WordPress/gutenberg/issues/55866 23293 */ 23294 if (shouldSelectFirstItem) { 23295 setCurrentlySelectedRevision(firstRevision); 23296 } 23297 }, [shouldSelectFirstItem, firstRevision]); 23298 23299 // Only display load button if there is a revision to load, 23300 // and it is different from the current editor styles. 23301 const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== 'unsaved' && !selectedRevisionMatchesEditorStyles; 23302 const hasRevisions = !!currentRevisions.length; 23303 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23304 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 23305 title: revisionsCount && 23306 // translators: %s: number of revisions. 23307 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount), 23308 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.'), 23309 onBack: onCloseRevisions 23310 }), !hasRevisions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 23311 className: "edit-site-global-styles-screen-revisions__loading" 23312 }), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 23313 userConfig: currentlySelectedRevision, 23314 isSelected: () => {}, 23315 onClose: () => { 23316 setEditorCanvasContainerView('global-styles-revisions'); 23317 } 23318 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_revisions, { 23319 blocks: blocks, 23320 userConfig: currentlySelectedRevision, 23321 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions') 23322 })), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(revisions_buttons, { 23323 onChange: setCurrentlySelectedRevision, 23324 selectedRevisionId: currentlySelectedRevisionId, 23325 userRevisions: currentRevisions, 23326 canApplyRevision: isLoadButtonEnabled, 23327 onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision) 23328 }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23329 className: "edit-site-global-styles-screen-revisions__footer", 23330 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { 23331 className: "edit-site-global-styles-screen-revisions__pagination", 23332 currentPage: currentPage, 23333 numPages: numPages, 23334 changePage: setCurrentPage, 23335 totalItems: revisionsCount, 23336 disabled: isLoading, 23337 label: (0,external_wp_i18n_namespaceObject.__)('Global Styles pagination navigation') 23338 }) 23339 }), isLoadingRevisionWithUnsavedChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 23340 isOpen: isLoadingRevisionWithUnsavedChanges, 23341 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Apply'), 23342 onConfirm: () => restoreRevision(currentlySelectedRevision), 23343 onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false), 23344 size: "medium", 23345 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to apply this revision? Any unsaved changes will be lost.') 23346 })] 23347 }); 23348 } 23349 /* harmony default export */ const screen_revisions = (ScreenRevisions); 23350 23351 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js 23352 /** 23353 * WordPress dependencies 23354 */ 23355 23356 23357 23358 23359 23360 23361 23362 23363 23364 23365 /** 23366 * Internal dependencies 23367 */ 23368 23369 23370 23371 23372 23373 23374 23375 23376 23377 23378 23379 23380 23381 23382 23383 23384 23385 23386 23387 23388 23389 const SLOT_FILL_NAME = 'GlobalStylesMenu'; 23390 const { 23391 useGlobalStylesReset: ui_useGlobalStylesReset 23392 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23393 const { 23394 Slot: GlobalStylesMenuSlot, 23395 Fill: GlobalStylesMenuFill 23396 } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME); 23397 function GlobalStylesActionMenu() { 23398 const [canReset, onReset] = ui_useGlobalStylesReset(); 23399 const { 23400 toggle 23401 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 23402 const { 23403 canEditCSS 23404 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23405 const { 23406 getEntityRecord, 23407 __experimentalGetCurrentGlobalStylesId 23408 } = select(external_wp_coreData_namespaceObject.store); 23409 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 23410 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 23411 return { 23412 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 23413 }; 23414 }, []); 23415 const { 23416 setEditorCanvasContainerView 23417 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 23418 const { 23419 goTo 23420 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23421 const loadCustomCSS = () => { 23422 setEditorCanvasContainerView('global-styles-css'); 23423 goTo('/css'); 23424 }; 23425 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { 23426 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 23427 icon: more_vertical, 23428 label: (0,external_wp_i18n_namespaceObject.__)('More'), 23429 toggleProps: { 23430 size: 'compact' 23431 }, 23432 children: ({ 23433 onClose 23434 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23435 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 23436 children: [canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23437 onClick: loadCustomCSS, 23438 children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') 23439 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23440 onClick: () => { 23441 toggle('core/edit-site', 'welcomeGuideStyles'); 23442 onClose(); 23443 }, 23444 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 23445 })] 23446 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 23447 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23448 onClick: () => { 23449 onReset(); 23450 onClose(); 23451 }, 23452 disabled: !canReset, 23453 children: (0,external_wp_i18n_namespaceObject.__)('Reset styles') 23454 }) 23455 })] 23456 }) 23457 }) 23458 }); 23459 } 23460 function GlobalStylesNavigationScreen({ 23461 className, 23462 ...props 23463 }) { 23464 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 23465 className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' '), 23466 ...props 23467 }); 23468 } 23469 function BlockStylesNavigationScreens({ 23470 parentMenu, 23471 blockStyles, 23472 blockName 23473 }) { 23474 return blockStyles.map((style, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23475 path: parentMenu + '/variations/' + style.name, 23476 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 23477 name: blockName, 23478 variation: style.name 23479 }) 23480 }, index)); 23481 } 23482 function ContextScreens({ 23483 name, 23484 parentMenu = '' 23485 }) { 23486 const blockStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => { 23487 const { 23488 getBlockStyles 23489 } = select(external_wp_blocks_namespaceObject.store); 23490 return getBlockStyles(name); 23491 }, [name]); 23492 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23493 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23494 path: parentMenu + '/colors/palette', 23495 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette, { 23496 name: name 23497 }) 23498 }), !!blockStyleVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesNavigationScreens, { 23499 parentMenu: parentMenu, 23500 blockStyles: blockStyleVariations, 23501 blockName: name 23502 })] 23503 }); 23504 } 23505 function GlobalStylesStyleBook() { 23506 const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23507 const { 23508 path 23509 } = navigator.location; 23510 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 23511 isSelected: blockName => 23512 // Match '/blocks/core%2Fbutton' and 23513 // '/blocks/core%2Fbutton/typography', but not 23514 // '/blocks/core%2Fbuttons'. 23515 path === `/blocks/$encodeURIComponent(blockName)}` || path.startsWith(`/blocks/$encodeURIComponent(blockName)}/`), 23516 onSelect: blockName => { 23517 // Now go to the selected block. 23518 navigator.goTo('/blocks/' + encodeURIComponent(blockName)); 23519 } 23520 }); 23521 } 23522 function GlobalStylesBlockLink() { 23523 const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23524 const { 23525 selectedBlockName, 23526 selectedBlockClientId 23527 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23528 const { 23529 getSelectedBlockClientId, 23530 getBlockName 23531 } = select(external_wp_blockEditor_namespaceObject.store); 23532 const clientId = getSelectedBlockClientId(); 23533 return { 23534 selectedBlockName: getBlockName(clientId), 23535 selectedBlockClientId: clientId 23536 }; 23537 }, []); 23538 const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName); 23539 // When we're in the `Blocks` screen enable deep linking to the selected block. 23540 (0,external_wp_element_namespaceObject.useEffect)(() => { 23541 if (!selectedBlockClientId || !blockHasGlobalStyles) { 23542 return; 23543 } 23544 const currentPath = navigator.location.path; 23545 if (currentPath !== '/blocks' && !currentPath.startsWith('/blocks/')) { 23546 return; 23547 } 23548 const newPath = '/blocks/' + encodeURIComponent(selectedBlockName); 23549 // Avoid navigating to the same path. This can happen when selecting 23550 // a new block of the same type. 23551 if (newPath !== currentPath) { 23552 navigator.goTo(newPath, { 23553 skipFocus: true 23554 }); 23555 } 23556 }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]); 23557 } 23558 function GlobalStylesEditorCanvasContainerLink() { 23559 const { 23560 goTo, 23561 location 23562 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23563 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 23564 const path = location?.path; 23565 const isRevisionsOpen = path === '/revisions'; 23566 23567 // If the user switches the editor canvas container view, redirect 23568 // to the appropriate screen. This effectively allows deep linking to the 23569 // desired screens from outside the global styles navigation provider. 23570 (0,external_wp_element_namespaceObject.useEffect)(() => { 23571 switch (editorCanvasContainerView) { 23572 case 'global-styles-revisions': 23573 case 'global-styles-revisions:style-book': 23574 goTo('/revisions'); 23575 break; 23576 case 'global-styles-css': 23577 goTo('/css'); 23578 break; 23579 case 'style-book': 23580 /* 23581 * The stand-alone style book is open 23582 * and the revisions panel is open, 23583 * close the revisions panel. 23584 * Otherwise keep the style book open while 23585 * browsing global styles panel. 23586 */ 23587 if (isRevisionsOpen) { 23588 goTo('/'); 23589 } 23590 break; 23591 } 23592 }, [editorCanvasContainerView, isRevisionsOpen, goTo]); 23593 } 23594 function GlobalStylesUI() { 23595 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); 23596 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 23597 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { 23598 className: "edit-site-global-styles-sidebar__navigator-provider", 23599 initialPath: "/", 23600 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23601 path: "/", 23602 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root, {}) 23603 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23604 path: "/variations", 23605 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations, {}) 23606 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23607 path: "/blocks", 23608 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list, {}) 23609 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23610 path: "/typography", 23611 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography, {}) 23612 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23613 path: "/typography/font-sizes/", 23614 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes, {}) 23615 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23616 path: "/typography/font-sizes/:origin/:slug", 23617 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size, {}) 23618 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23619 path: "/typography/text", 23620 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23621 element: "text" 23622 }) 23623 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23624 path: "/typography/link", 23625 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23626 element: "link" 23627 }) 23628 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23629 path: "/typography/heading", 23630 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23631 element: "heading" 23632 }) 23633 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23634 path: "/typography/caption", 23635 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23636 element: "caption" 23637 }) 23638 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23639 path: "/typography/button", 23640 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23641 element: "button" 23642 }) 23643 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23644 path: "/colors", 23645 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors, {}) 23646 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23647 path: "/shadows", 23648 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) 23649 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23650 path: "/shadows/edit/:category/:slug", 23651 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) 23652 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23653 path: "/layout", 23654 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout, {}) 23655 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23656 path: "/css", 23657 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css, {}) 23658 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23659 path: "/revisions", 23660 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions, {}) 23661 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23662 path: "/background", 23663 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background, {}) 23664 }), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23665 path: '/blocks/' + encodeURIComponent(block.name), 23666 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 23667 name: block.name 23668 }) 23669 }, 'menu-block-' + block.name)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, { 23670 name: block.name, 23671 parentMenu: '/blocks/' + encodeURIComponent(block.name) 23672 }, '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, {})] 23673 }); 23674 } 23675 23676 /* harmony default export */ const global_styles_ui = (GlobalStylesUI); 23677 23678 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js 23679 23680 23681 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js 23682 /** 23683 * WordPress dependencies 23684 */ 23685 23686 23687 /** 23688 * Internal dependencies 23689 */ 23690 23691 23692 23693 23694 const { 23695 ComplementaryArea, 23696 ComplementaryAreaMoreMenuItem 23697 } = unlock(external_wp_editor_namespaceObject.privateApis); 23698 function DefaultSidebar({ 23699 className, 23700 identifier, 23701 title, 23702 icon, 23703 children, 23704 closeLabel, 23705 header, 23706 headerClassName, 23707 panelClassName, 23708 isActiveByDefault 23709 }) { 23710 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23711 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryArea, { 23712 className: className, 23713 scope: "core", 23714 identifier: identifier, 23715 title: title, 23716 smallScreenTitle: title, 23717 icon: icon, 23718 closeLabel: closeLabel, 23719 header: header, 23720 headerClassName: headerClassName, 23721 panelClassName: panelClassName, 23722 isActiveByDefault: isActiveByDefault, 23723 children: children 23724 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { 23725 scope: "core", 23726 identifier: identifier, 23727 icon: icon, 23728 children: title 23729 })] 23730 }); 23731 } 23732 23733 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js 23734 /** 23735 * WordPress dependencies 23736 */ 23737 23738 23739 23740 23741 23742 23743 23744 23745 /** 23746 * Internal dependencies 23747 */ 23748 23749 23750 23751 23752 23753 23754 23755 23756 const { 23757 interfaceStore: global_styles_sidebar_interfaceStore 23758 } = unlock(external_wp_editor_namespaceObject.privateApis); 23759 function GlobalStylesSidebar() { 23760 const { 23761 shouldClearCanvasContainerView, 23762 isStyleBookOpened, 23763 showListViewByDefault, 23764 hasRevisions, 23765 isRevisionsOpened, 23766 isRevisionsStyleBookOpened 23767 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23768 const { 23769 getActiveComplementaryArea 23770 } = select(global_styles_sidebar_interfaceStore); 23771 const { 23772 getEditorCanvasContainerView, 23773 getCanvasMode 23774 } = unlock(select(store)); 23775 const canvasContainerView = getEditorCanvasContainerView(); 23776 const _isVisualEditorMode = 'visual' === select(external_wp_editor_namespaceObject.store).getEditorMode(); 23777 const _isEditCanvasMode = 'edit' === getCanvasMode(); 23778 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 23779 const { 23780 getEntityRecord, 23781 __experimentalGetCurrentGlobalStylesId 23782 } = select(external_wp_coreData_namespaceObject.store); 23783 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 23784 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 23785 return { 23786 isStyleBookOpened: 'style-book' === canvasContainerView, 23787 shouldClearCanvasContainerView: 'edit-site/global-styles' !== getActiveComplementaryArea('core') || !_isVisualEditorMode || !_isEditCanvasMode, 23788 showListViewByDefault: _showListViewByDefault, 23789 hasRevisions: !!globalStyles?._links?.['version-history']?.[0]?.count, 23790 isRevisionsStyleBookOpened: 'global-styles-revisions:style-book' === canvasContainerView, 23791 isRevisionsOpened: 'global-styles-revisions' === canvasContainerView 23792 }; 23793 }, []); 23794 const { 23795 setEditorCanvasContainerView 23796 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 23797 (0,external_wp_element_namespaceObject.useEffect)(() => { 23798 if (shouldClearCanvasContainerView) { 23799 setEditorCanvasContainerView(undefined); 23800 } 23801 }, [shouldClearCanvasContainerView]); 23802 const { 23803 setIsListViewOpened 23804 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 23805 const { 23806 goTo 23807 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23808 const toggleRevisions = () => { 23809 setIsListViewOpened(false); 23810 if (isRevisionsStyleBookOpened) { 23811 goTo('/'); 23812 setEditorCanvasContainerView('style-book'); 23813 return; 23814 } 23815 if (isRevisionsOpened) { 23816 goTo('/'); 23817 setEditorCanvasContainerView(undefined); 23818 return; 23819 } 23820 goTo('/revisions'); 23821 if (isStyleBookOpened) { 23822 setEditorCanvasContainerView('global-styles-revisions:style-book'); 23823 } else { 23824 setEditorCanvasContainerView('global-styles-revisions'); 23825 } 23826 }; 23827 const toggleStyleBook = () => { 23828 if (isRevisionsOpened) { 23829 setEditorCanvasContainerView('global-styles-revisions:style-book'); 23830 return; 23831 } 23832 if (isRevisionsStyleBookOpened) { 23833 setEditorCanvasContainerView('global-styles-revisions'); 23834 return; 23835 } 23836 setIsListViewOpened(isStyleBookOpened && showListViewByDefault); 23837 setEditorCanvasContainerView(isStyleBookOpened ? undefined : 'style-book'); 23838 }; 23839 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultSidebar, { 23840 className: "edit-site-global-styles-sidebar", 23841 identifier: "edit-site/global-styles", 23842 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 23843 icon: library_styles, 23844 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Styles'), 23845 panelClassName: "edit-site-global-styles-sidebar__panel", 23846 header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 23847 className: "edit-site-global-styles-sidebar__header", 23848 gap: 1, 23849 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 23850 style: { 23851 minWidth: 'min-content' 23852 }, 23853 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 23854 className: "edit-site-global-styles-sidebar__header-title", 23855 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 23856 }) 23857 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 23858 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23859 icon: library_seen, 23860 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 23861 isPressed: isStyleBookOpened || isRevisionsStyleBookOpened, 23862 accessibleWhenDisabled: true, 23863 disabled: shouldClearCanvasContainerView, 23864 onClick: toggleStyleBook, 23865 size: "compact" 23866 }) 23867 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 23868 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23869 label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 23870 icon: library_backup, 23871 onClick: toggleRevisions, 23872 accessibleWhenDisabled: true, 23873 disabled: !hasRevisions, 23874 isPressed: isRevisionsOpened || isRevisionsStyleBookOpened, 23875 size: "compact" 23876 }) 23877 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})] 23878 }), 23879 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, {}) 23880 }); 23881 } 23882 23883 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js 23884 /** 23885 * WordPress dependencies 23886 */ 23887 23888 23889 const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 23890 xmlns: "http://www.w3.org/2000/svg", 23891 viewBox: "0 0 24 24", 23892 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 23893 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" 23894 }) 23895 }); 23896 /* harmony default export */ const library_download = (download); 23897 23898 ;// CONCATENATED MODULE: external ["wp","blob"] 23899 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 23900 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js 23901 /** 23902 * WordPress dependencies 23903 */ 23904 23905 23906 23907 23908 23909 23910 23911 23912 function SiteExport() { 23913 const { 23914 createErrorNotice 23915 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 23916 async function handleExport() { 23917 try { 23918 const response = await external_wp_apiFetch_default()({ 23919 path: '/wp-block-editor/v1/export', 23920 parse: false, 23921 headers: { 23922 Accept: 'application/zip' 23923 } 23924 }); 23925 const blob = await response.blob(); 23926 const contentDisposition = response.headers.get('content-disposition'); 23927 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); 23928 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export'; 23929 (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + '.zip', blob, 'application/zip'); 23930 } catch (errorResponse) { 23931 let error = {}; 23932 try { 23933 error = await errorResponse.json(); 23934 } catch (e) {} 23935 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); 23936 createErrorNotice(errorMessage, { 23937 type: 'snackbar' 23938 }); 23939 } 23940 } 23941 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23942 role: "menuitem", 23943 icon: library_download, 23944 onClick: handleExport, 23945 info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.'), 23946 children: (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item') 23947 }); 23948 } 23949 23950 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js 23951 /** 23952 * WordPress dependencies 23953 */ 23954 23955 23956 23957 23958 23959 function WelcomeGuideMenuItem() { 23960 const { 23961 toggle 23962 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 23963 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23964 onClick: () => toggle('core/edit-site', 'welcomeGuide'), 23965 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 23966 }); 23967 } 23968 23969 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js 23970 /** 23971 * WordPress dependencies 23972 */ 23973 23974 23975 23976 23977 /** 23978 * Internal dependencies 23979 */ 23980 23981 23982 23983 23984 23985 23986 const { 23987 ToolsMoreMenuGroup, 23988 PreferencesModal 23989 } = unlock(external_wp_editor_namespaceObject.privateApis); 23990 function MoreMenu() { 23991 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 23992 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 23993 }, []); 23994 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23995 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { 23996 children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})] 23997 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})] 23998 }); 23999 } 24000 24001 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js 24002 /** 24003 * External dependencies 24004 */ 24005 24006 24007 /** 24008 * WordPress dependencies 24009 */ 24010 24011 24012 24013 24014 24015 24016 /** 24017 * Internal dependencies 24018 */ 24019 24020 24021 function useEditorIframeProps() { 24022 const { 24023 canvasMode, 24024 currentPostIsTrashed 24025 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24026 const { 24027 getCanvasMode 24028 } = unlock(select(store)); 24029 return { 24030 canvasMode: getCanvasMode(), 24031 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash' 24032 }; 24033 }, []); 24034 const { 24035 setCanvasMode 24036 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24037 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 24038 (0,external_wp_element_namespaceObject.useEffect)(() => { 24039 if (canvasMode === 'edit') { 24040 setIsFocused(false); 24041 } 24042 }, [canvasMode]); 24043 24044 // In view mode, make the canvas iframe be perceived and behave as a button 24045 // to switch to edit mode, with a meaningful label and no title attribute. 24046 const viewModeIframeProps = { 24047 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Edit'), 24048 'aria-disabled': currentPostIsTrashed, 24049 title: null, 24050 role: 'button', 24051 tabIndex: 0, 24052 onFocus: () => setIsFocused(true), 24053 onBlur: () => setIsFocused(false), 24054 onKeyDown: event => { 24055 const { 24056 keyCode 24057 } = event; 24058 if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) { 24059 event.preventDefault(); 24060 setCanvasMode('edit'); 24061 } 24062 }, 24063 onClick: () => { 24064 setCanvasMode('edit'); 24065 }, 24066 onClickCapture: event => { 24067 if (currentPostIsTrashed) { 24068 event.preventDefault(); 24069 event.stopPropagation(); 24070 } 24071 }, 24072 readonly: true 24073 }; 24074 return { 24075 className: dist_clsx('edit-site-visual-editor__editor-canvas', { 24076 'is-focused': isFocused && canvasMode === 'view' 24077 }), 24078 ...(canvasMode === 'view' ? viewModeIframeProps : {}) 24079 }; 24080 } 24081 24082 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js 24083 /** 24084 * WordPress dependencies 24085 */ 24086 24087 24088 24089 24090 24091 24092 24093 24094 /** 24095 * Internal dependencies 24096 */ 24097 24098 const { 24099 useLocation: use_title_useLocation 24100 } = unlock(external_wp_router_namespaceObject.privateApis); 24101 function useTitle(title) { 24102 const location = use_title_useLocation(); 24103 const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')?.title, []); 24104 const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); 24105 (0,external_wp_element_namespaceObject.useEffect)(() => { 24106 isInitialLocationRef.current = false; 24107 }, [location]); 24108 (0,external_wp_element_namespaceObject.useEffect)(() => { 24109 // Don't update or announce the title for initial page load. 24110 if (isInitialLocationRef.current) { 24111 return; 24112 } 24113 if (title && siteTitle) { 24114 // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 24115 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ 24116 (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)); 24117 document.title = formattedTitle; 24118 24119 // Announce title on route change for screen readers. 24120 (0,external_wp_a11y_namespaceObject.speak)(title, 'assertive'); 24121 } 24122 }, [title, siteTitle, location]); 24123 } 24124 24125 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js 24126 /** 24127 * WordPress dependencies 24128 */ 24129 24130 24131 /** 24132 * Internal dependencies 24133 */ 24134 24135 24136 24137 function useEditorTitle() { 24138 const { 24139 record: editedPost, 24140 getTitle, 24141 isLoaded: hasLoadedPost 24142 } = useEditedEntityRecord(); 24143 let title; 24144 if (hasLoadedPost) { 24145 var _POST_TYPE_LABELS$edi; 24146 title = (0,external_wp_i18n_namespaceObject.sprintf)( 24147 // translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part). 24148 (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = POST_TYPE_LABELS[editedPost.type]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]); 24149 } 24150 24151 // Only announce the title once the editor is ready to prevent "Replace" 24152 // action in <URLQueryController> from double-announcing. 24153 useTitle(hasLoadedPost && title); 24154 } 24155 /* harmony default export */ const use_editor_title = (useEditorTitle); 24156 24157 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js 24158 /** 24159 * External dependencies 24160 */ 24161 24162 24163 /** 24164 * WordPress dependencies 24165 */ 24166 24167 24168 24169 24170 24171 24172 24173 24174 24175 24176 24177 24178 24179 24180 24181 /** 24182 * Internal dependencies 24183 */ 24184 24185 24186 24187 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199 24200 24201 24202 24203 24204 const { 24205 Editor, 24206 BackButton 24207 } = unlock(external_wp_editor_namespaceObject.privateApis); 24208 const { 24209 useHistory: editor_useHistory, 24210 useLocation: editor_useLocation 24211 } = unlock(external_wp_router_namespaceObject.privateApis); 24212 const { 24213 BlockKeyboardShortcuts 24214 } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); 24215 const toggleHomeIconVariants = { 24216 edit: { 24217 opacity: 0, 24218 scale: 0.2 24219 }, 24220 hover: { 24221 opacity: 1, 24222 scale: 1, 24223 clipPath: 'inset( 22% round 2px )' 24224 } 24225 }; 24226 const siteIconVariants = { 24227 edit: { 24228 clipPath: 'inset(0% round 0px)' 24229 }, 24230 hover: { 24231 clipPath: 'inset( 22% round 2px )' 24232 }, 24233 tap: { 24234 clipPath: 'inset(0% round 0px)' 24235 } 24236 }; 24237 function EditSiteEditor({ 24238 isPostsList = false 24239 }) { 24240 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 24241 const { 24242 params 24243 } = editor_useLocation(); 24244 const isLoading = useIsSiteEditorLoading(); 24245 const { 24246 editedPostType, 24247 editedPostId, 24248 contextPostType, 24249 contextPostId, 24250 canvasMode, 24251 isEditingPage, 24252 supportsGlobalStyles, 24253 showIconLabels, 24254 editorCanvasView, 24255 currentPostIsTrashed, 24256 hasSiteIcon 24257 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24258 const { 24259 getEditorCanvasContainerView, 24260 getEditedPostContext, 24261 getCanvasMode, 24262 isPage, 24263 getEditedPostType, 24264 getEditedPostId 24265 } = unlock(select(store)); 24266 const { 24267 get 24268 } = select(external_wp_preferences_namespaceObject.store); 24269 const { 24270 getCurrentTheme, 24271 getEntityRecord 24272 } = select(external_wp_coreData_namespaceObject.store); 24273 const _context = getEditedPostContext(); 24274 const siteData = getEntityRecord('root', '__unstableBase', undefined); 24275 24276 // The currently selected entity to display. 24277 // Typically template or template part in the site editor. 24278 return { 24279 editedPostType: getEditedPostType(), 24280 editedPostId: getEditedPostId(), 24281 contextPostType: _context?.postId ? _context.postType : undefined, 24282 contextPostId: _context?.postId ? _context.postId : undefined, 24283 canvasMode: getCanvasMode(), 24284 isEditingPage: isPage(), 24285 supportsGlobalStyles: getCurrentTheme()?.is_block_theme, 24286 showIconLabels: get('core', 'showIconLabels'), 24287 editorCanvasView: getEditorCanvasContainerView(), 24288 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash', 24289 hasSiteIcon: !!siteData?.site_icon_url 24290 }; 24291 }, []); 24292 use_editor_title(); 24293 const _isPreviewingTheme = isPreviewingTheme(); 24294 const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer(); 24295 const iframeProps = useEditorIframeProps(); 24296 const isEditMode = canvasMode === 'edit'; 24297 const postWithTemplate = !!contextPostId; 24298 const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(CanvasLoader, 'edit-site-editor__loading-progress'); 24299 const settings = useSpecificEditorSettings(); 24300 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...settings.styles, { 24301 // Forming a "block formatting context" to prevent margin collapsing. 24302 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 24303 css: canvasMode === 'view' ? `body{min-height: 100vh; $currentPostIsTrashed ? '' : 'cursor: pointer;'}}` : undefined 24304 }], [settings.styles, canvasMode, currentPostIsTrashed]); 24305 const { 24306 setCanvasMode 24307 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24308 const { 24309 __unstableSetEditorMode, 24310 resetZoomLevel 24311 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 24312 const { 24313 createSuccessNotice 24314 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24315 const history = editor_useHistory(); 24316 const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => { 24317 switch (actionId) { 24318 case 'move-to-trash': 24319 case 'delete-post': 24320 { 24321 history.push({ 24322 postType: items[0].type 24323 }); 24324 } 24325 break; 24326 case 'duplicate-post': 24327 { 24328 const newItem = items[0]; 24329 const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered; 24330 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 24331 // translators: %s: Title of the created post e.g: "Post 1". 24332 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title)), { 24333 type: 'snackbar', 24334 id: 'duplicate-post-action', 24335 actions: [{ 24336 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 24337 onClick: () => { 24338 history.push({ 24339 postId: newItem.id, 24340 postType: newItem.type, 24341 canvas: 'edit' 24342 }); 24343 } 24344 }] 24345 }); 24346 } 24347 break; 24348 } 24349 }, [history, createSuccessNotice]); 24350 24351 // Replace the title and icon displayed in the DocumentBar when there's an overlay visible. 24352 const title = getEditorCanvasContainerTitle(editorCanvasView); 24353 const isReady = !isLoading; 24354 const transition = { 24355 duration: disableMotion ? 0 : 0.2 24356 }; 24357 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24358 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, {}), /*#__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, { 24359 id: loadingProgressId 24360 }) : null, isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, {}), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Editor, { 24361 postType: postWithTemplate ? contextPostType : editedPostType, 24362 postId: postWithTemplate ? contextPostId : editedPostId, 24363 templateId: postWithTemplate ? editedPostId : undefined, 24364 settings: settings, 24365 className: dist_clsx('edit-site-editor__editor-interface', { 24366 'show-icon-labels': showIconLabels 24367 }), 24368 styles: styles, 24369 customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { 24370 size: "compact" 24371 }), 24372 customSavePanel: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}), 24373 forceDisableBlockTools: !hasDefaultEditorCanvasView, 24374 title: title, 24375 iframeProps: iframeProps, 24376 onActionPerformed: onActionPerformed, 24377 extraSidebarPanels: !isEditingPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel.Slot, {}), 24378 children: [isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { 24379 children: ({ 24380 length 24381 }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 24382 className: "edit-site-editor__view-mode-toggle", 24383 transition: transition, 24384 animate: "edit", 24385 initial: "edit", 24386 whileHover: "hover", 24387 whileTap: "tap", 24388 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24389 __next40pxDefaultSize: true, 24390 label: (0,external_wp_i18n_namespaceObject.__)('Open Navigation'), 24391 showTooltip: true, 24392 tooltipPosition: "middle right", 24393 onClick: () => { 24394 setCanvasMode('view'); 24395 __unstableSetEditorMode('edit'); 24396 resetZoomLevel(); 24397 24398 // TODO: this is a temporary solution to navigate to the posts list if we are 24399 // come here through `posts list` and are in focus mode editing a template, template part etc.. 24400 if (isPostsList && params?.focusMode) { 24401 history.push({ 24402 page: 'gutenberg-posts-dashboard', 24403 postType: 'post' 24404 }); 24405 } 24406 }, 24407 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 24408 variants: siteIconVariants, 24409 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 24410 className: "edit-site-editor__view-mode-toggle-icon" 24411 }) 24412 }) 24413 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 24414 className: dist_clsx('edit-site-editor__back-icon', { 24415 'has-site-icon': hasSiteIcon 24416 }), 24417 variants: toggleHomeIconVariants, 24418 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 24419 icon: arrow_up_left 24420 }) 24421 })] 24422 }) 24423 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), supportsGlobalStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})] 24424 })] 24425 }); 24426 } 24427 24428 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 24429 var remove_accents = __webpack_require__(9681); 24430 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 24431 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-up.js 24432 /** 24433 * WordPress dependencies 24434 */ 24435 24436 24437 const arrowUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 24438 xmlns: "http://www.w3.org/2000/svg", 24439 viewBox: "0 0 24 24", 24440 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 24441 d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" 24442 }) 24443 }); 24444 /* harmony default export */ const arrow_up = (arrowUp); 24445 24446 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-down.js 24447 /** 24448 * WordPress dependencies 24449 */ 24450 24451 24452 const arrowDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 24453 xmlns: "http://www.w3.org/2000/svg", 24454 viewBox: "0 0 24 24", 24455 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 24456 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" 24457 }) 24458 }); 24459 /* harmony default export */ const arrow_down = (arrowDown); 24460 24461 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/constants.js 24462 /** 24463 * WordPress dependencies 24464 */ 24465 24466 24467 24468 /** 24469 * Internal dependencies 24470 */ 24471 24472 // Filter operators. 24473 const constants_OPERATOR_IS = 'is'; 24474 const constants_OPERATOR_IS_NOT = 'isNot'; 24475 const constants_OPERATOR_IS_ANY = 'isAny'; 24476 const constants_OPERATOR_IS_NONE = 'isNone'; 24477 const OPERATOR_IS_ALL = 'isAll'; 24478 const OPERATOR_IS_NOT_ALL = 'isNotAll'; 24479 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]; 24480 const OPERATORS = { 24481 [constants_OPERATOR_IS]: { 24482 key: 'is-filter', 24483 label: (0,external_wp_i18n_namespaceObject.__)('Is') 24484 }, 24485 [constants_OPERATOR_IS_NOT]: { 24486 key: 'is-not-filter', 24487 label: (0,external_wp_i18n_namespaceObject.__)('Is not') 24488 }, 24489 [constants_OPERATOR_IS_ANY]: { 24490 key: 'is-any-filter', 24491 label: (0,external_wp_i18n_namespaceObject.__)('Is any') 24492 }, 24493 [constants_OPERATOR_IS_NONE]: { 24494 key: 'is-none-filter', 24495 label: (0,external_wp_i18n_namespaceObject.__)('Is none') 24496 }, 24497 [OPERATOR_IS_ALL]: { 24498 key: 'is-all-filter', 24499 label: (0,external_wp_i18n_namespaceObject.__)('Is all') 24500 }, 24501 [OPERATOR_IS_NOT_ALL]: { 24502 key: 'is-not-all-filter', 24503 label: (0,external_wp_i18n_namespaceObject.__)('Is not all') 24504 } 24505 }; 24506 const SORTING_DIRECTIONS = ['asc', 'desc']; 24507 const sortArrows = { 24508 asc: '↑', 24509 desc: '↓' 24510 }; 24511 const sortValues = { 24512 asc: 'ascending', 24513 desc: 'descending' 24514 }; 24515 const sortLabels = { 24516 asc: (0,external_wp_i18n_namespaceObject.__)('Sort ascending'), 24517 desc: (0,external_wp_i18n_namespaceObject.__)('Sort descending') 24518 }; 24519 const sortIcons = { 24520 asc: arrow_up, 24521 desc: arrow_down 24522 }; 24523 24524 // View layouts. 24525 const constants_LAYOUT_TABLE = 'table'; 24526 const constants_LAYOUT_GRID = 'grid'; 24527 const constants_LAYOUT_LIST = 'list'; 24528 24529 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js 24530 /** 24531 * Internal dependencies 24532 */ 24533 24534 function sort(a, b, direction) { 24535 return direction === 'asc' ? a - b : b - a; 24536 } 24537 function isValid(value, context) { 24538 // TODO: this implicitely means the value is required. 24539 if (value === '') { 24540 return false; 24541 } 24542 if (!Number.isInteger(Number(value))) { 24543 return false; 24544 } 24545 if (context?.elements) { 24546 const validValues = context?.elements.map(f => f.value); 24547 if (!validValues.includes(Number(value))) { 24548 return false; 24549 } 24550 } 24551 return true; 24552 } 24553 /* harmony default export */ const integer = ({ 24554 sort, 24555 isValid, 24556 Edit: 'integer' 24557 }); 24558 24559 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/text.js 24560 /** 24561 * Internal dependencies 24562 */ 24563 24564 function text_sort(valueA, valueB, direction) { 24565 return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 24566 } 24567 function text_isValid(value, context) { 24568 if (context?.elements) { 24569 const validValues = context?.elements?.map(f => f.value); 24570 if (!validValues.includes(value)) { 24571 return false; 24572 } 24573 } 24574 return true; 24575 } 24576 /* harmony default export */ const field_types_text = ({ 24577 sort: text_sort, 24578 isValid: text_isValid, 24579 Edit: 'text' 24580 }); 24581 24582 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js 24583 /** 24584 * Internal dependencies 24585 */ 24586 24587 function datetime_sort(a, b, direction) { 24588 const timeA = new Date(a).getTime(); 24589 const timeB = new Date(b).getTime(); 24590 return direction === 'asc' ? timeA - timeB : timeB - timeA; 24591 } 24592 function datetime_isValid(value, context) { 24593 if (context?.elements) { 24594 const validValues = context?.elements.map(f => f.value); 24595 if (!validValues.includes(value)) { 24596 return false; 24597 } 24598 } 24599 return true; 24600 } 24601 /* harmony default export */ const datetime = ({ 24602 sort: datetime_sort, 24603 isValid: datetime_isValid, 24604 Edit: 'datetime' 24605 }); 24606 24607 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/index.js 24608 /** 24609 * Internal dependencies 24610 */ 24611 24612 24613 24614 24615 24616 /** 24617 * 24618 * @param {FieldType} type The field type definition to get. 24619 * 24620 * @return A field type definition. 24621 */ 24622 function getFieldTypeDefinition(type) { 24623 if ('integer' === type) { 24624 return integer; 24625 } 24626 if ('text' === type) { 24627 return field_types_text; 24628 } 24629 if ('datetime' === type) { 24630 return datetime; 24631 } 24632 return { 24633 sort: (a, b, direction) => { 24634 if (typeof a === 'number' && typeof b === 'number') { 24635 return direction === 'asc' ? a - b : b - a; 24636 } 24637 return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); 24638 }, 24639 isValid: (value, context) => { 24640 if (context?.elements) { 24641 const validValues = context?.elements?.map(f => f.value); 24642 if (!validValues.includes(value)) { 24643 return false; 24644 } 24645 } 24646 return true; 24647 }, 24648 Edit: () => null 24649 }; 24650 } 24651 24652 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js 24653 /** 24654 * WordPress dependencies 24655 */ 24656 24657 24658 24659 /** 24660 * Internal dependencies 24661 */ 24662 24663 24664 function DateTime({ 24665 data, 24666 field, 24667 onChange, 24668 hideLabelFromVision 24669 }) { 24670 const { 24671 id, 24672 label 24673 } = field; 24674 const value = field.getValue({ 24675 item: data 24676 }); 24677 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24678 [id]: newValue 24679 }), [id, onChange]); 24680 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 24681 className: "dataviews-controls__datetime", 24682 children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 24683 as: "legend", 24684 children: label 24685 }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 24686 as: "legend", 24687 children: label 24688 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { 24689 currentTime: value, 24690 onChange: onChangeControl, 24691 hideLabelFromVision: true 24692 })] 24693 }); 24694 } 24695 24696 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js 24697 /** 24698 * WordPress dependencies 24699 */ 24700 24701 24702 24703 /** 24704 * Internal dependencies 24705 */ 24706 24707 function Integer({ 24708 data, 24709 field, 24710 onChange, 24711 hideLabelFromVision 24712 }) { 24713 var _field$getValue; 24714 const { 24715 id, 24716 label, 24717 description 24718 } = field; 24719 const value = (_field$getValue = field.getValue({ 24720 item: data 24721 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 24722 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24723 [id]: Number(newValue) 24724 }), [id, onChange]); 24725 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 24726 label: label, 24727 help: description, 24728 value: value, 24729 onChange: onChangeControl, 24730 __next40pxDefaultSize: true, 24731 hideLabelFromVision: hideLabelFromVision 24732 }); 24733 } 24734 24735 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js 24736 /** 24737 * WordPress dependencies 24738 */ 24739 24740 24741 24742 /** 24743 * Internal dependencies 24744 */ 24745 24746 function Radio({ 24747 data, 24748 field, 24749 onChange, 24750 hideLabelFromVision 24751 }) { 24752 const { 24753 id, 24754 label 24755 } = field; 24756 const value = field.getValue({ 24757 item: data 24758 }); 24759 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24760 [id]: newValue 24761 }), [id, onChange]); 24762 if (field.elements) { 24763 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 24764 label: label, 24765 onChange: onChangeControl, 24766 options: field.elements, 24767 selected: value, 24768 hideLabelFromVision: hideLabelFromVision 24769 }); 24770 } 24771 return null; 24772 } 24773 24774 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js 24775 /** 24776 * WordPress dependencies 24777 */ 24778 24779 24780 24781 24782 /** 24783 * Internal dependencies 24784 */ 24785 24786 function Select({ 24787 data, 24788 field, 24789 onChange, 24790 hideLabelFromVision 24791 }) { 24792 var _field$getValue, _field$elements; 24793 const { 24794 id, 24795 label 24796 } = field; 24797 const value = (_field$getValue = field.getValue({ 24798 item: data 24799 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 24800 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24801 [id]: newValue 24802 }), [id, onChange]); 24803 const elements = [ 24804 /* 24805 * Value can be undefined when: 24806 * 24807 * - the field is not required 24808 * - in bulk editing 24809 * 24810 */ 24811 { 24812 label: (0,external_wp_i18n_namespaceObject.__)('Select item'), 24813 value: '' 24814 }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; 24815 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 24816 label: label, 24817 value: value, 24818 options: elements, 24819 onChange: onChangeControl, 24820 __next40pxDefaultSize: true, 24821 __nextHasNoMarginBottom: true, 24822 hideLabelFromVision: hideLabelFromVision 24823 }); 24824 } 24825 24826 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js 24827 /** 24828 * WordPress dependencies 24829 */ 24830 24831 24832 24833 /** 24834 * Internal dependencies 24835 */ 24836 24837 function Text({ 24838 data, 24839 field, 24840 onChange, 24841 hideLabelFromVision 24842 }) { 24843 const { 24844 id, 24845 label, 24846 placeholder 24847 } = field; 24848 const value = field.getValue({ 24849 item: data 24850 }); 24851 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24852 [id]: newValue 24853 }), [id, onChange]); 24854 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 24855 label: label, 24856 placeholder: placeholder, 24857 value: value !== null && value !== void 0 ? value : '', 24858 onChange: onChangeControl, 24859 __next40pxDefaultSize: true, 24860 __nextHasNoMarginBottom: true, 24861 hideLabelFromVision: hideLabelFromVision 24862 }); 24863 } 24864 24865 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js 24866 /** 24867 * External dependencies 24868 */ 24869 24870 /** 24871 * Internal dependencies 24872 */ 24873 24874 24875 24876 24877 24878 24879 const FORM_CONTROLS = { 24880 datetime: DateTime, 24881 integer: Integer, 24882 radio: Radio, 24883 select: Select, 24884 text: Text 24885 }; 24886 function getControl(field, fieldTypeDefinition) { 24887 if (typeof field.Edit === 'function') { 24888 return field.Edit; 24889 } 24890 if (typeof field.Edit === 'string') { 24891 return getControlByType(field.Edit); 24892 } 24893 if (field.elements) { 24894 return getControlByType('select'); 24895 } 24896 if (typeof fieldTypeDefinition.Edit === 'string') { 24897 return getControlByType(fieldTypeDefinition.Edit); 24898 } 24899 return fieldTypeDefinition.Edit; 24900 } 24901 function getControlByType(type) { 24902 if (Object.keys(FORM_CONTROLS).includes(type)) { 24903 return FORM_CONTROLS[type]; 24904 } 24905 throw 'Control ' + type + ' not found'; 24906 } 24907 24908 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js 24909 /** 24910 * Internal dependencies 24911 */ 24912 24913 24914 24915 /** 24916 * Apply default values and normalize the fields config. 24917 * 24918 * @param fields Fields config. 24919 * @return Normalized fields config. 24920 */ 24921 function normalizeFields(fields) { 24922 return fields.map(field => { 24923 var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; 24924 const fieldTypeDefinition = getFieldTypeDefinition(field.type); 24925 const getValue = field.getValue || (({ 24926 item 24927 }) => item[field.id]); 24928 const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { 24929 return fieldTypeDefinition.sort(getValue({ 24930 item: a 24931 }), getValue({ 24932 item: b 24933 }), direction); 24934 }; 24935 const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { 24936 return fieldTypeDefinition.isValid(getValue({ 24937 item 24938 }), context); 24939 }; 24940 const Edit = getControl(field, fieldTypeDefinition); 24941 const renderFromElements = ({ 24942 item 24943 }) => { 24944 const value = getValue({ 24945 item 24946 }); 24947 return field?.elements?.find(element => element.value === value)?.label || getValue({ 24948 item 24949 }); 24950 }; 24951 const render = field.render || (field.elements ? renderFromElements : getValue); 24952 return { 24953 ...field, 24954 label: field.label || field.id, 24955 header: field.header || field.label || field.id, 24956 getValue, 24957 render, 24958 sort, 24959 isValid, 24960 Edit, 24961 enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, 24962 enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true 24963 }; 24964 }); 24965 } 24966 24967 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/filter-and-sort-data-view.js 24968 /** 24969 * External dependencies 24970 */ 24971 24972 24973 /** 24974 * Internal dependencies 24975 */ 24976 24977 24978 function normalizeSearchInput(input = '') { 24979 return remove_accents_default()(input.trim().toLowerCase()); 24980 } 24981 const filter_and_sort_data_view_EMPTY_ARRAY = []; 24982 24983 /** 24984 * Applies the filtering, sorting and pagination to the raw data based on the view configuration. 24985 * 24986 * @param data Raw data. 24987 * @param view View config. 24988 * @param fields Fields config. 24989 * 24990 * @return Filtered, sorted and paginated data. 24991 */ 24992 function filterSortAndPaginate(data, view, fields) { 24993 if (!data) { 24994 return { 24995 data: filter_and_sort_data_view_EMPTY_ARRAY, 24996 paginationInfo: { 24997 totalItems: 0, 24998 totalPages: 0 24999 } 25000 }; 25001 } 25002 const _fields = normalizeFields(fields); 25003 let filteredData = [...data]; 25004 // Handle global search. 25005 if (view.search) { 25006 const normalizedSearch = normalizeSearchInput(view.search); 25007 filteredData = filteredData.filter(item => { 25008 return _fields.filter(field => field.enableGlobalSearch).map(field => { 25009 return normalizeSearchInput(field.getValue({ 25010 item 25011 })); 25012 }).some(field => field.includes(normalizedSearch)); 25013 }); 25014 } 25015 if (view.filters && view.filters?.length > 0) { 25016 view.filters.forEach(filter => { 25017 const field = _fields.find(_field => _field.id === filter.field); 25018 if (field) { 25019 if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) { 25020 filteredData = filteredData.filter(item => { 25021 const fieldValue = field.getValue({ 25022 item 25023 }); 25024 if (Array.isArray(fieldValue)) { 25025 return filter.value.some(filterValue => fieldValue.includes(filterValue)); 25026 } else if (typeof fieldValue === 'string') { 25027 return filter.value.includes(fieldValue); 25028 } 25029 return false; 25030 }); 25031 } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) { 25032 filteredData = filteredData.filter(item => { 25033 const fieldValue = field.getValue({ 25034 item 25035 }); 25036 if (Array.isArray(fieldValue)) { 25037 return !filter.value.some(filterValue => fieldValue.includes(filterValue)); 25038 } else if (typeof fieldValue === 'string') { 25039 return !filter.value.includes(fieldValue); 25040 } 25041 return false; 25042 }); 25043 } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) { 25044 filteredData = filteredData.filter(item => { 25045 return filter.value.every(value => { 25046 return field.getValue({ 25047 item 25048 })?.includes(value); 25049 }); 25050 }); 25051 } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) { 25052 filteredData = filteredData.filter(item => { 25053 return filter.value.every(value => { 25054 return !field.getValue({ 25055 item 25056 })?.includes(value); 25057 }); 25058 }); 25059 } else if (filter.operator === constants_OPERATOR_IS) { 25060 filteredData = filteredData.filter(item => { 25061 return filter.value === field.getValue({ 25062 item 25063 }); 25064 }); 25065 } else if (filter.operator === constants_OPERATOR_IS_NOT) { 25066 filteredData = filteredData.filter(item => { 25067 return filter.value !== field.getValue({ 25068 item 25069 }); 25070 }); 25071 } 25072 } 25073 }); 25074 } 25075 25076 // Handle sorting. 25077 if (view.sort) { 25078 const fieldId = view.sort.field; 25079 const fieldToSort = _fields.find(field => { 25080 return field.id === fieldId; 25081 }); 25082 if (fieldToSort) { 25083 filteredData.sort((a, b) => { 25084 var _view$sort$direction; 25085 return fieldToSort.sort(a, b, (_view$sort$direction = view.sort?.direction) !== null && _view$sort$direction !== void 0 ? _view$sort$direction : 'desc'); 25086 }); 25087 } 25088 } 25089 25090 // Handle pagination. 25091 let totalItems = filteredData.length; 25092 let totalPages = 1; 25093 if (view.page !== undefined && view.perPage !== undefined) { 25094 const start = (view.page - 1) * view.perPage; 25095 totalItems = filteredData?.length || 0; 25096 totalPages = Math.ceil(totalItems / view.perPage); 25097 filteredData = filteredData?.slice(start, start + view.perPage); 25098 } 25099 return { 25100 data: filteredData, 25101 paginationInfo: { 25102 totalItems, 25103 totalPages 25104 } 25105 }; 25106 } 25107 25108 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js 25109 /** 25110 * WordPress dependencies 25111 */ 25112 25113 25114 /** 25115 * Internal dependencies 25116 */ 25117 25118 25119 const DataViewsContext = (0,external_wp_element_namespaceObject.createContext)({ 25120 view: { 25121 type: constants_LAYOUT_TABLE 25122 }, 25123 onChangeView: () => {}, 25124 fields: [], 25125 data: [], 25126 paginationInfo: { 25127 totalItems: 0, 25128 totalPages: 0 25129 }, 25130 selection: [], 25131 onChangeSelection: () => {}, 25132 setOpenedFilter: () => {}, 25133 openedFilter: null, 25134 getItemId: item => item.id, 25135 density: 0 25136 }); 25137 /* harmony default export */ const dataviews_context = (DataViewsContext); 25138 25139 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/funnel.js 25140 /** 25141 * WordPress dependencies 25142 */ 25143 25144 25145 const funnel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25146 viewBox: "0 0 24 24", 25147 xmlns: "http://www.w3.org/2000/svg", 25148 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25149 d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" 25150 }) 25151 }); 25152 /* harmony default export */ const library_funnel = (funnel); 25153 25154 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js 25155 "use client"; 25156 var __defProp = Object.defineProperty; 25157 var __defProps = Object.defineProperties; 25158 var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 25159 var __getOwnPropSymbols = Object.getOwnPropertySymbols; 25160 var __hasOwnProp = Object.prototype.hasOwnProperty; 25161 var __propIsEnum = Object.prototype.propertyIsEnumerable; 25162 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 25163 var _3YLGPPWQ_spreadValues = (a, b) => { 25164 for (var prop in b || (b = {})) 25165 if (__hasOwnProp.call(b, prop)) 25166 __defNormalProp(a, prop, b[prop]); 25167 if (__getOwnPropSymbols) 25168 for (var prop of __getOwnPropSymbols(b)) { 25169 if (__propIsEnum.call(b, prop)) 25170 __defNormalProp(a, prop, b[prop]); 25171 } 25172 return a; 25173 }; 25174 var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 25175 var __objRest = (source, exclude) => { 25176 var target = {}; 25177 for (var prop in source) 25178 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 25179 target[prop] = source[prop]; 25180 if (source != null && __getOwnPropSymbols) 25181 for (var prop of __getOwnPropSymbols(source)) { 25182 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) 25183 target[prop] = source[prop]; 25184 } 25185 return target; 25186 }; 25187 25188 25189 25190 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js 25191 "use client"; 25192 var _3YLGPPWQ_defProp = Object.defineProperty; 25193 var _3YLGPPWQ_defProps = Object.defineProperties; 25194 var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; 25195 var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; 25196 var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; 25197 var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; 25198 var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 25199 var _chunks_3YLGPPWQ_spreadValues = (a, b) => { 25200 for (var prop in b || (b = {})) 25201 if (_3YLGPPWQ_hasOwnProp.call(b, prop)) 25202 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 25203 if (_3YLGPPWQ_getOwnPropSymbols) 25204 for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { 25205 if (_3YLGPPWQ_propIsEnum.call(b, prop)) 25206 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 25207 } 25208 return a; 25209 }; 25210 var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); 25211 var _3YLGPPWQ_objRest = (source, exclude) => { 25212 var target = {}; 25213 for (var prop in source) 25214 if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 25215 target[prop] = source[prop]; 25216 if (source != null && _3YLGPPWQ_getOwnPropSymbols) 25217 for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { 25218 if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) 25219 target[prop] = source[prop]; 25220 } 25221 return target; 25222 }; 25223 25224 25225 25226 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js 25227 "use client"; 25228 25229 25230 // src/utils/misc.ts 25231 function PBFD2E7P_noop(..._) { 25232 } 25233 function shallowEqual(a, b) { 25234 if (a === b) return true; 25235 if (!a) return false; 25236 if (!b) return false; 25237 if (typeof a !== "object") return false; 25238 if (typeof b !== "object") return false; 25239 const aKeys = Object.keys(a); 25240 const bKeys = Object.keys(b); 25241 const { length } = aKeys; 25242 if (bKeys.length !== length) return false; 25243 for (const key of aKeys) { 25244 if (a[key] !== b[key]) { 25245 return false; 25246 } 25247 } 25248 return true; 25249 } 25250 function applyState(argument, currentValue) { 25251 if (isUpdater(argument)) { 25252 const value = isLazyValue(currentValue) ? currentValue() : currentValue; 25253 return argument(value); 25254 } 25255 return argument; 25256 } 25257 function isUpdater(argument) { 25258 return typeof argument === "function"; 25259 } 25260 function isLazyValue(value) { 25261 return typeof value === "function"; 25262 } 25263 function isObject(arg) { 25264 return typeof arg === "object" && arg != null; 25265 } 25266 function isEmpty(arg) { 25267 if (Array.isArray(arg)) return !arg.length; 25268 if (isObject(arg)) return !Object.keys(arg).length; 25269 if (arg == null) return true; 25270 if (arg === "") return true; 25271 return false; 25272 } 25273 function isInteger(arg) { 25274 if (typeof arg === "number") { 25275 return Math.floor(arg) === arg; 25276 } 25277 return String(Math.floor(Number(arg))) === arg; 25278 } 25279 function PBFD2E7P_hasOwnProperty(object, prop) { 25280 if (typeof Object.hasOwn === "function") { 25281 return Object.hasOwn(object, prop); 25282 } 25283 return Object.prototype.hasOwnProperty.call(object, prop); 25284 } 25285 function chain(...fns) { 25286 return (...args) => { 25287 for (const fn of fns) { 25288 if (typeof fn === "function") { 25289 fn(...args); 25290 } 25291 } 25292 }; 25293 } 25294 function cx(...args) { 25295 return args.filter(Boolean).join(" ") || void 0; 25296 } 25297 function normalizeString(str) { 25298 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 25299 } 25300 function omit(object, keys) { 25301 const result = _chunks_3YLGPPWQ_spreadValues({}, object); 25302 for (const key of keys) { 25303 if (PBFD2E7P_hasOwnProperty(result, key)) { 25304 delete result[key]; 25305 } 25306 } 25307 return result; 25308 } 25309 function pick(object, paths) { 25310 const result = {}; 25311 for (const key of paths) { 25312 if (PBFD2E7P_hasOwnProperty(object, key)) { 25313 result[key] = object[key]; 25314 } 25315 } 25316 return result; 25317 } 25318 function identity(value) { 25319 return value; 25320 } 25321 function beforePaint(cb = PBFD2E7P_noop) { 25322 const raf = requestAnimationFrame(cb); 25323 return () => cancelAnimationFrame(raf); 25324 } 25325 function afterPaint(cb = PBFD2E7P_noop) { 25326 let raf = requestAnimationFrame(() => { 25327 raf = requestAnimationFrame(cb); 25328 }); 25329 return () => cancelAnimationFrame(raf); 25330 } 25331 function invariant(condition, message) { 25332 if (condition) return; 25333 if (typeof message !== "string") throw new Error("Invariant failed"); 25334 throw new Error(message); 25335 } 25336 function getKeys(obj) { 25337 return Object.keys(obj); 25338 } 25339 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 25340 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 25341 if (result == null) return false; 25342 return !result; 25343 } 25344 function disabledFromProps(props) { 25345 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 25346 } 25347 function removeUndefinedValues(obj) { 25348 const result = {}; 25349 for (const key in obj) { 25350 if (obj[key] !== void 0) { 25351 result[key] = obj[key]; 25352 } 25353 } 25354 return result; 25355 } 25356 function defaultValue(...values) { 25357 for (const value of values) { 25358 if (value !== void 0) return value; 25359 } 25360 return void 0; 25361 } 25362 25363 25364 25365 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js 25366 "use client"; 25367 25368 25369 // src/utils/misc.ts 25370 25371 25372 function setRef(ref, value) { 25373 if (typeof ref === "function") { 25374 ref(value); 25375 } else if (ref) { 25376 ref.current = value; 25377 } 25378 } 25379 function isValidElementWithRef(element) { 25380 if (!element) return false; 25381 if (!(0,external_React_.isValidElement)(element)) return false; 25382 if ("ref" in element.props) return true; 25383 if ("ref" in element) return true; 25384 return false; 25385 } 25386 function getRefProperty(element) { 25387 if (!isValidElementWithRef(element)) return null; 25388 const props = _3YLGPPWQ_spreadValues({}, element.props); 25389 return props.ref || element.ref; 25390 } 25391 function mergeProps(base, overrides) { 25392 const props = _3YLGPPWQ_spreadValues({}, base); 25393 for (const key in overrides) { 25394 if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; 25395 if (key === "className") { 25396 const prop = "className"; 25397 props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop]; 25398 continue; 25399 } 25400 if (key === "style") { 25401 const prop = "style"; 25402 props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; 25403 continue; 25404 } 25405 const overrideValue = overrides[key]; 25406 if (typeof overrideValue === "function" && key.startsWith("on")) { 25407 const baseValue = base[key]; 25408 if (typeof baseValue === "function") { 25409 props[key] = (...args) => { 25410 overrideValue(...args); 25411 baseValue(...args); 25412 }; 25413 continue; 25414 } 25415 } 25416 props[key] = overrideValue; 25417 } 25418 return props; 25419 } 25420 25421 25422 25423 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js 25424 "use client"; 25425 25426 // src/utils/dom.ts 25427 var HWOIWM4O_canUseDOM = checkIsBrowser(); 25428 function checkIsBrowser() { 25429 var _a; 25430 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); 25431 } 25432 function getDocument(node) { 25433 return node ? node.ownerDocument || node : document; 25434 } 25435 function getWindow(node) { 25436 return getDocument(node).defaultView || window; 25437 } 25438 function HWOIWM4O_getActiveElement(node, activeDescendant = false) { 25439 const { activeElement } = getDocument(node); 25440 if (!(activeElement == null ? void 0 : activeElement.nodeName)) { 25441 return null; 25442 } 25443 if (HWOIWM4O_isFrame(activeElement) && activeElement.contentDocument) { 25444 return HWOIWM4O_getActiveElement( 25445 activeElement.contentDocument.body, 25446 activeDescendant 25447 ); 25448 } 25449 if (activeDescendant) { 25450 const id = activeElement.getAttribute("aria-activedescendant"); 25451 if (id) { 25452 const element = getDocument(activeElement).getElementById(id); 25453 if (element) { 25454 return element; 25455 } 25456 } 25457 } 25458 return activeElement; 25459 } 25460 function contains(parent, child) { 25461 return parent === child || parent.contains(child); 25462 } 25463 function HWOIWM4O_isFrame(element) { 25464 return element.tagName === "IFRAME"; 25465 } 25466 function isButton(element) { 25467 const tagName = element.tagName.toLowerCase(); 25468 if (tagName === "button") return true; 25469 if (tagName === "input" && element.type) { 25470 return buttonInputTypes.indexOf(element.type) !== -1; 25471 } 25472 return false; 25473 } 25474 var buttonInputTypes = [ 25475 "button", 25476 "color", 25477 "file", 25478 "image", 25479 "reset", 25480 "submit" 25481 ]; 25482 function isVisible(element) { 25483 if (typeof element.checkVisibility === "function") { 25484 return element.checkVisibility(); 25485 } 25486 const htmlElement = element; 25487 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 25488 } 25489 function isTextField(element) { 25490 try { 25491 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 25492 const isTextArea = element.tagName === "TEXTAREA"; 25493 return isTextInput || isTextArea || false; 25494 } catch (error) { 25495 return false; 25496 } 25497 } 25498 function isTextbox(element) { 25499 return element.isContentEditable || isTextField(element); 25500 } 25501 function getTextboxValue(element) { 25502 if (isTextField(element)) { 25503 return element.value; 25504 } 25505 if (element.isContentEditable) { 25506 const range = getDocument(element).createRange(); 25507 range.selectNodeContents(element); 25508 return range.toString(); 25509 } 25510 return ""; 25511 } 25512 function getTextboxSelection(element) { 25513 let start = 0; 25514 let end = 0; 25515 if (isTextField(element)) { 25516 start = element.selectionStart || 0; 25517 end = element.selectionEnd || 0; 25518 } else if (element.isContentEditable) { 25519 const selection = getDocument(element).getSelection(); 25520 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { 25521 const range = selection.getRangeAt(0); 25522 const nextRange = range.cloneRange(); 25523 nextRange.selectNodeContents(element); 25524 nextRange.setEnd(range.startContainer, range.startOffset); 25525 start = nextRange.toString().length; 25526 nextRange.setEnd(range.endContainer, range.endOffset); 25527 end = nextRange.toString().length; 25528 } 25529 } 25530 return { start, end }; 25531 } 25532 function getPopupRole(element, fallback) { 25533 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; 25534 const role = element == null ? void 0 : element.getAttribute("role"); 25535 if (role && allowedPopupRoles.indexOf(role) !== -1) { 25536 return role; 25537 } 25538 return fallback; 25539 } 25540 function getPopupItemRole(element, fallback) { 25541 var _a; 25542 const itemRoleByPopupRole = { 25543 menu: "menuitem", 25544 listbox: "option", 25545 tree: "treeitem" 25546 }; 25547 const popupRole = getPopupRole(element); 25548 if (!popupRole) return fallback; 25549 const key = popupRole; 25550 return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; 25551 } 25552 function scrollIntoViewIfNeeded(element, arg) { 25553 if (isPartiallyHidden(element) && "scrollIntoView" in element) { 25554 element.scrollIntoView(arg); 25555 } 25556 } 25557 function getScrollingElement(element) { 25558 if (!element) return null; 25559 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 25560 const { overflowY } = getComputedStyle(element); 25561 const isScrollable = overflowY !== "visible" && overflowY !== "hidden"; 25562 if (isScrollable) return element; 25563 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 25564 const { overflowX } = getComputedStyle(element); 25565 const isScrollable = overflowX !== "visible" && overflowX !== "hidden"; 25566 if (isScrollable) return element; 25567 } 25568 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; 25569 } 25570 function isPartiallyHidden(element) { 25571 const elementRect = element.getBoundingClientRect(); 25572 const scroller = getScrollingElement(element); 25573 if (!scroller) return false; 25574 const scrollerRect = scroller.getBoundingClientRect(); 25575 const isHTML = scroller.tagName === "HTML"; 25576 const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; 25577 const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; 25578 const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; 25579 const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; 25580 const top = elementRect.top < scrollerTop; 25581 const left = elementRect.left < scrollerLeft; 25582 const bottom = elementRect.bottom > scrollerBottom; 25583 const right = elementRect.right > scrollerRight; 25584 return top || left || bottom || right; 25585 } 25586 function setSelectionRange(element, ...args) { 25587 if (/text|search|password|tel|url/i.test(element.type)) { 25588 element.setSelectionRange(...args); 25589 } 25590 } 25591 25592 25593 25594 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/US4USQPI.js 25595 "use client"; 25596 25597 25598 // src/utils/platform.ts 25599 function isTouchDevice() { 25600 return HWOIWM4O_canUseDOM && !!navigator.maxTouchPoints; 25601 } 25602 function isApple() { 25603 if (!HWOIWM4O_canUseDOM) return false; 25604 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 25605 } 25606 function isSafari() { 25607 return HWOIWM4O_canUseDOM && isApple() && /apple/i.test(navigator.vendor); 25608 } 25609 function isFirefox() { 25610 return HWOIWM4O_canUseDOM && /firefox\//i.test(navigator.userAgent); 25611 } 25612 function isMac() { 25613 return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); 25614 } 25615 25616 25617 25618 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/events.js 25619 "use client"; 25620 25621 25622 25623 25624 // src/utils/events.ts 25625 function isPortalEvent(event) { 25626 return Boolean( 25627 event.currentTarget && !contains(event.currentTarget, event.target) 25628 ); 25629 } 25630 function isSelfTarget(event) { 25631 return event.target === event.currentTarget; 25632 } 25633 function isOpeningInNewTab(event) { 25634 const element = event.currentTarget; 25635 if (!element) return false; 25636 const isAppleDevice = isApple(); 25637 if (isAppleDevice && !event.metaKey) return false; 25638 if (!isAppleDevice && !event.ctrlKey) return false; 25639 const tagName = element.tagName.toLowerCase(); 25640 if (tagName === "a") return true; 25641 if (tagName === "button" && element.type === "submit") return true; 25642 if (tagName === "input" && element.type === "submit") return true; 25643 return false; 25644 } 25645 function isDownloading(event) { 25646 const element = event.currentTarget; 25647 if (!element) return false; 25648 const tagName = element.tagName.toLowerCase(); 25649 if (!event.altKey) return false; 25650 if (tagName === "a") return true; 25651 if (tagName === "button" && element.type === "submit") return true; 25652 if (tagName === "input" && element.type === "submit") return true; 25653 return false; 25654 } 25655 function fireEvent(element, type, eventInit) { 25656 const event = new Event(type, eventInit); 25657 return element.dispatchEvent(event); 25658 } 25659 function fireBlurEvent(element, eventInit) { 25660 const event = new FocusEvent("blur", eventInit); 25661 const defaultAllowed = element.dispatchEvent(event); 25662 const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); 25663 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 25664 return defaultAllowed; 25665 } 25666 function fireFocusEvent(element, eventInit) { 25667 const event = new FocusEvent("focus", eventInit); 25668 const defaultAllowed = element.dispatchEvent(event); 25669 const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); 25670 element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); 25671 return defaultAllowed; 25672 } 25673 function fireKeyboardEvent(element, type, eventInit) { 25674 const event = new KeyboardEvent(type, eventInit); 25675 return element.dispatchEvent(event); 25676 } 25677 function fireClickEvent(element, eventInit) { 25678 const event = new MouseEvent("click", eventInit); 25679 return element.dispatchEvent(event); 25680 } 25681 function isFocusEventOutside(event, container) { 25682 const containerElement = container || event.currentTarget; 25683 const relatedTarget = event.relatedTarget; 25684 return !relatedTarget || !contains(containerElement, relatedTarget); 25685 } 25686 function getInputType(event) { 25687 const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; 25688 if (!nativeEvent) return; 25689 if (!("inputType" in nativeEvent)) return; 25690 if (typeof nativeEvent.inputType !== "string") return; 25691 return nativeEvent.inputType; 25692 } 25693 function queueBeforeEvent(element, type, callback, timeout) { 25694 const createTimer = (callback2) => { 25695 if (timeout) { 25696 const timerId2 = setTimeout(callback2, timeout); 25697 return () => clearTimeout(timerId2); 25698 } 25699 const timerId = requestAnimationFrame(callback2); 25700 return () => cancelAnimationFrame(timerId); 25701 }; 25702 const cancelTimer = createTimer(() => { 25703 element.removeEventListener(type, callSync, true); 25704 callback(); 25705 }); 25706 const callSync = () => { 25707 cancelTimer(); 25708 callback(); 25709 }; 25710 element.addEventListener(type, callSync, { once: true, capture: true }); 25711 return cancelTimer; 25712 } 25713 function addGlobalEventListener(type, listener, options, scope = window) { 25714 const children = []; 25715 try { 25716 scope.document.addEventListener(type, listener, options); 25717 for (const frame of Array.from(scope.frames)) { 25718 children.push(addGlobalEventListener(type, listener, options, frame)); 25719 } 25720 } catch (e) { 25721 } 25722 const removeEventListener = () => { 25723 try { 25724 scope.document.removeEventListener(type, listener, options); 25725 } catch (e) { 25726 } 25727 for (const remove of children) { 25728 remove(); 25729 } 25730 }; 25731 return removeEventListener; 25732 } 25733 25734 25735 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js 25736 "use client"; 25737 25738 25739 25740 // src/utils/hooks.ts 25741 25742 25743 25744 25745 var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); 25746 var useReactId = _React.useId; 25747 var useReactDeferredValue = _React.useDeferredValue; 25748 var useReactInsertionEffect = _React.useInsertionEffect; 25749 var useSafeLayoutEffect = HWOIWM4O_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; 25750 function useInitialValue(value) { 25751 const [initialValue] = useState(value); 25752 return initialValue; 25753 } 25754 function useLazyValue(init) { 25755 const ref = useRef(); 25756 if (ref.current === void 0) { 25757 ref.current = init(); 25758 } 25759 return ref.current; 25760 } 25761 function useLiveRef(value) { 25762 const ref = (0,external_React_.useRef)(value); 25763 useSafeLayoutEffect(() => { 25764 ref.current = value; 25765 }); 25766 return ref; 25767 } 25768 function usePreviousValue(value) { 25769 const [previousValue, setPreviousValue] = useState(value); 25770 if (value !== previousValue) { 25771 setPreviousValue(value); 25772 } 25773 return previousValue; 25774 } 25775 function useEvent(callback) { 25776 const ref = (0,external_React_.useRef)(() => { 25777 throw new Error("Cannot call an event handler while rendering."); 25778 }); 25779 if (useReactInsertionEffect) { 25780 useReactInsertionEffect(() => { 25781 ref.current = callback; 25782 }); 25783 } else { 25784 ref.current = callback; 25785 } 25786 return (0,external_React_.useCallback)((...args) => { 25787 var _a; 25788 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); 25789 }, []); 25790 } 25791 function useTransactionState(callback) { 25792 const [state, setState] = (0,external_React_.useState)(null); 25793 useSafeLayoutEffect(() => { 25794 if (state == null) return; 25795 if (!callback) return; 25796 let prevState = null; 25797 callback((prev) => { 25798 prevState = prev; 25799 return state; 25800 }); 25801 return () => { 25802 callback(prevState); 25803 }; 25804 }, [state, callback]); 25805 return [state, setState]; 25806 } 25807 function useMergeRefs(...refs) { 25808 return (0,external_React_.useMemo)(() => { 25809 if (!refs.some(Boolean)) return; 25810 return (value) => { 25811 for (const ref of refs) { 25812 setRef(ref, value); 25813 } 25814 }; 25815 }, refs); 25816 } 25817 function useId(defaultId) { 25818 if (useReactId) { 25819 const reactId = useReactId(); 25820 if (defaultId) return defaultId; 25821 return reactId; 25822 } 25823 const [id, setId] = (0,external_React_.useState)(defaultId); 25824 useSafeLayoutEffect(() => { 25825 if (defaultId || id) return; 25826 const random = Math.random().toString(36).substr(2, 6); 25827 setId(`id-$random}`); 25828 }, [defaultId, id]); 25829 return defaultId || id; 25830 } 25831 function useDeferredValue(value) { 25832 if (useReactDeferredValue) { 25833 return useReactDeferredValue(value); 25834 } 25835 const [deferredValue, setDeferredValue] = useState(value); 25836 useEffect(() => { 25837 const raf = requestAnimationFrame(() => setDeferredValue(value)); 25838 return () => cancelAnimationFrame(raf); 25839 }, [value]); 25840 return deferredValue; 25841 } 25842 function useTagName(refOrElement, type) { 25843 const stringOrUndefined = (type2) => { 25844 if (typeof type2 !== "string") return; 25845 return type2; 25846 }; 25847 const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); 25848 useSafeLayoutEffect(() => { 25849 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 25850 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); 25851 }, [refOrElement, type]); 25852 return tagName; 25853 } 25854 function useAttribute(refOrElement, attributeName, defaultValue) { 25855 const [attribute, setAttribute] = (0,external_React_.useState)(defaultValue); 25856 useSafeLayoutEffect(() => { 25857 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 25858 if (!element) return; 25859 const callback = () => { 25860 const value = element.getAttribute(attributeName); 25861 if (value == null) return; 25862 setAttribute(value); 25863 }; 25864 const observer = new MutationObserver(callback); 25865 observer.observe(element, { attributeFilter: [attributeName] }); 25866 callback(); 25867 return () => observer.disconnect(); 25868 }, [refOrElement, attributeName]); 25869 return attribute; 25870 } 25871 function useUpdateEffect(effect, deps) { 25872 const mounted = (0,external_React_.useRef)(false); 25873 (0,external_React_.useEffect)(() => { 25874 if (mounted.current) { 25875 return effect(); 25876 } 25877 mounted.current = true; 25878 }, deps); 25879 (0,external_React_.useEffect)( 25880 () => () => { 25881 mounted.current = false; 25882 }, 25883 [] 25884 ); 25885 } 25886 function useUpdateLayoutEffect(effect, deps) { 25887 const mounted = (0,external_React_.useRef)(false); 25888 useSafeLayoutEffect(() => { 25889 if (mounted.current) { 25890 return effect(); 25891 } 25892 mounted.current = true; 25893 }, deps); 25894 useSafeLayoutEffect( 25895 () => () => { 25896 mounted.current = false; 25897 }, 25898 [] 25899 ); 25900 } 25901 function useForceUpdate() { 25902 return (0,external_React_.useReducer)(() => [], []); 25903 } 25904 function useBooleanEvent(booleanOrCallback) { 25905 return useEvent( 25906 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback 25907 ); 25908 } 25909 function useWrapElement(props, callback, deps = []) { 25910 const wrapElement = (0,external_React_.useCallback)( 25911 (element) => { 25912 if (props.wrapElement) { 25913 element = props.wrapElement(element); 25914 } 25915 return callback(element); 25916 }, 25917 [...deps, props.wrapElement] 25918 ); 25919 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); 25920 } 25921 function usePortalRef(portalProp = false, portalRefProp) { 25922 const [portalNode, setPortalNode] = useState(null); 25923 const portalRef = useMergeRefs(setPortalNode, portalRefProp); 25924 const domReady = !portalProp || portalNode; 25925 return { portalRef, portalNode, domReady }; 25926 } 25927 function useMetadataProps(props, key, value) { 25928 const parent = props.onLoadedMetadataCapture; 25929 const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { 25930 return Object.assign(() => { 25931 }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); 25932 }, [parent, key, value]); 25933 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; 25934 } 25935 function useIsMouseMoving() { 25936 (0,external_React_.useEffect)(() => { 25937 addGlobalEventListener("mousemove", setMouseMoving, true); 25938 addGlobalEventListener("mousedown", resetMouseMoving, true); 25939 addGlobalEventListener("mouseup", resetMouseMoving, true); 25940 addGlobalEventListener("keydown", resetMouseMoving, true); 25941 addGlobalEventListener("scroll", resetMouseMoving, true); 25942 }, []); 25943 const isMouseMoving = useEvent(() => mouseMoving); 25944 return isMouseMoving; 25945 } 25946 var mouseMoving = false; 25947 var previousScreenX = 0; 25948 var previousScreenY = 0; 25949 function hasMouseMovement(event) { 25950 const movementX = event.movementX || event.screenX - previousScreenX; 25951 const movementY = event.movementY || event.screenY - previousScreenY; 25952 previousScreenX = event.screenX; 25953 previousScreenY = event.screenY; 25954 return movementX || movementY || "production" === "test"; 25955 } 25956 function setMouseMoving(event) { 25957 if (!hasMouseMovement(event)) return; 25958 mouseMoving = true; 25959 } 25960 function resetMouseMoving() { 25961 mouseMoving = false; 25962 } 25963 25964 25965 25966 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js 25967 "use client"; 25968 25969 25970 25971 25972 // src/utils/system.tsx 25973 25974 25975 function forwardRef2(render) { 25976 const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); 25977 Role.displayName = render.displayName || render.name; 25978 return Role; 25979 } 25980 function memo2(Component, propsAreEqual) { 25981 return external_React_.memo(Component, propsAreEqual); 25982 } 25983 function createElement(Type, props) { 25984 const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); 25985 const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); 25986 let element; 25987 if (external_React_.isValidElement(render)) { 25988 const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); 25989 element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); 25990 } else if (render) { 25991 element = render(rest); 25992 } else { 25993 element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); 25994 } 25995 if (wrapElement) { 25996 return wrapElement(element); 25997 } 25998 return element; 25999 } 26000 function createHook(useProps) { 26001 const useRole = (props = {}) => { 26002 return useProps(props); 26003 }; 26004 useRole.displayName = useProps.name; 26005 return useRole; 26006 } 26007 function createStoreContext(providers = [], scopedProviders = []) { 26008 const context = external_React_.createContext(void 0); 26009 const scopedContext = external_React_.createContext(void 0); 26010 const useContext2 = () => external_React_.useContext(context); 26011 const useScopedContext = (onlyScoped = false) => { 26012 const scoped = external_React_.useContext(scopedContext); 26013 const store = useContext2(); 26014 if (onlyScoped) return scoped; 26015 return scoped || store; 26016 }; 26017 const useProviderContext = () => { 26018 const scoped = external_React_.useContext(scopedContext); 26019 const store = useContext2(); 26020 if (scoped && scoped === store) return; 26021 return store; 26022 }; 26023 const ContextProvider = (props) => { 26024 return providers.reduceRight( 26025 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 26026 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) 26027 ); 26028 }; 26029 const ScopedContextProvider = (props) => { 26030 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( 26031 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 26032 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) 26033 ) })); 26034 }; 26035 return { 26036 context, 26037 scopedContext, 26038 useContext: useContext2, 26039 useScopedContext, 26040 useProviderContext, 26041 ContextProvider, 26042 ScopedContextProvider 26043 }; 26044 } 26045 26046 26047 26048 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/FMYQNSCK.js 26049 "use client"; 26050 26051 26052 // src/collection/collection-context.tsx 26053 var ctx = createStoreContext(); 26054 var useCollectionContext = ctx.useContext; 26055 var useCollectionScopedContext = ctx.useScopedContext; 26056 var useCollectionProviderContext = ctx.useProviderContext; 26057 var CollectionContextProvider = ctx.ContextProvider; 26058 var CollectionScopedContextProvider = ctx.ScopedContextProvider; 26059 26060 26061 26062 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/WENSINUV.js 26063 "use client"; 26064 26065 26066 26067 // src/composite/composite-context.tsx 26068 26069 var WENSINUV_ctx = createStoreContext( 26070 [CollectionContextProvider], 26071 [CollectionScopedContextProvider] 26072 ); 26073 var useCompositeContext = WENSINUV_ctx.useContext; 26074 var useCompositeScopedContext = WENSINUV_ctx.useScopedContext; 26075 var useCompositeProviderContext = WENSINUV_ctx.useProviderContext; 26076 var CompositeContextProvider = WENSINUV_ctx.ContextProvider; 26077 var CompositeScopedContextProvider = WENSINUV_ctx.ScopedContextProvider; 26078 var CompositeItemContext = (0,external_React_.createContext)( 26079 void 0 26080 ); 26081 var CompositeRowContext = (0,external_React_.createContext)( 26082 void 0 26083 ); 26084 26085 26086 26087 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/P2OTTZSX.js 26088 "use client"; 26089 26090 26091 26092 // src/tag/tag-context.tsx 26093 26094 var TagValueContext = (0,external_React_.createContext)(null); 26095 var TagRemoveIdContext = (0,external_React_.createContext)( 26096 null 26097 ); 26098 var P2OTTZSX_ctx = createStoreContext( 26099 [CompositeContextProvider], 26100 [CompositeScopedContextProvider] 26101 ); 26102 var useTagContext = P2OTTZSX_ctx.useContext; 26103 var useTagScopedContext = P2OTTZSX_ctx.useScopedContext; 26104 var useTagProviderContext = P2OTTZSX_ctx.useProviderContext; 26105 var TagContextProvider = P2OTTZSX_ctx.ContextProvider; 26106 var TagScopedContextProvider = P2OTTZSX_ctx.ScopedContextProvider; 26107 26108 26109 26110 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js 26111 "use client"; 26112 26113 26114 26115 // src/utils/store.ts 26116 function getInternal(store, key) { 26117 const internals = store.__unstableInternals; 26118 invariant(internals, "Invalid store"); 26119 return internals[key]; 26120 } 26121 function createStore(initialState, ...stores) { 26122 let state = initialState; 26123 let prevStateBatch = state; 26124 let lastUpdate = Symbol(); 26125 let destroy = PBFD2E7P_noop; 26126 const instances = /* @__PURE__ */ new Set(); 26127 const updatedKeys = /* @__PURE__ */ new Set(); 26128 const setups = /* @__PURE__ */ new Set(); 26129 const listeners = /* @__PURE__ */ new Set(); 26130 const batchListeners = /* @__PURE__ */ new Set(); 26131 const disposables = /* @__PURE__ */ new WeakMap(); 26132 const listenerKeys = /* @__PURE__ */ new WeakMap(); 26133 const storeSetup = (callback) => { 26134 setups.add(callback); 26135 return () => setups.delete(callback); 26136 }; 26137 const storeInit = () => { 26138 const initialized = instances.size; 26139 const instance = Symbol(); 26140 instances.add(instance); 26141 const maybeDestroy = () => { 26142 instances.delete(instance); 26143 if (instances.size) return; 26144 destroy(); 26145 }; 26146 if (initialized) return maybeDestroy; 26147 const desyncs = getKeys(state).map( 26148 (key) => chain( 26149 ...stores.map((store) => { 26150 var _a; 26151 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); 26152 if (!storeState) return; 26153 if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; 26154 return sync(store, [key], (state2) => { 26155 setState( 26156 key, 26157 state2[key], 26158 // @ts-expect-error - Not public API. This is just to prevent 26159 // infinite loops. 26160 true 26161 ); 26162 }); 26163 }) 26164 ) 26165 ); 26166 const teardowns = []; 26167 for (const setup2 of setups) { 26168 teardowns.push(setup2()); 26169 } 26170 const cleanups = stores.map(init); 26171 destroy = chain(...desyncs, ...teardowns, ...cleanups); 26172 return maybeDestroy; 26173 }; 26174 const sub = (keys, listener, set = listeners) => { 26175 set.add(listener); 26176 listenerKeys.set(listener, keys); 26177 return () => { 26178 var _a; 26179 (_a = disposables.get(listener)) == null ? void 0 : _a(); 26180 disposables.delete(listener); 26181 listenerKeys.delete(listener); 26182 set.delete(listener); 26183 }; 26184 }; 26185 const storeSubscribe = (keys, listener) => sub(keys, listener); 26186 const storeSync = (keys, listener) => { 26187 disposables.set(listener, listener(state, state)); 26188 return sub(keys, listener); 26189 }; 26190 const storeBatch = (keys, listener) => { 26191 disposables.set(listener, listener(state, prevStateBatch)); 26192 return sub(keys, listener, batchListeners); 26193 }; 26194 const storePick = (keys) => createStore(pick(state, keys), finalStore); 26195 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 26196 const getState = () => state; 26197 const setState = (key, value, fromStores = false) => { 26198 var _a; 26199 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 26200 const nextValue = applyState(value, state[key]); 26201 if (nextValue === state[key]) return; 26202 if (!fromStores) { 26203 for (const store of stores) { 26204 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); 26205 } 26206 } 26207 const prevState = state; 26208 state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); 26209 const thisUpdate = Symbol(); 26210 lastUpdate = thisUpdate; 26211 updatedKeys.add(key); 26212 const run = (listener, prev, uKeys) => { 26213 var _a2; 26214 const keys = listenerKeys.get(listener); 26215 const updated = (k) => uKeys ? uKeys.has(k) : k === key; 26216 if (!keys || keys.some(updated)) { 26217 (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); 26218 disposables.set(listener, listener(state, prev)); 26219 } 26220 }; 26221 for (const listener of listeners) { 26222 run(listener, prevState); 26223 } 26224 queueMicrotask(() => { 26225 if (lastUpdate !== thisUpdate) return; 26226 const snapshot = state; 26227 for (const listener of batchListeners) { 26228 run(listener, prevStateBatch, updatedKeys); 26229 } 26230 prevStateBatch = snapshot; 26231 updatedKeys.clear(); 26232 }); 26233 }; 26234 const finalStore = { 26235 getState, 26236 setState, 26237 __unstableInternals: { 26238 setup: storeSetup, 26239 init: storeInit, 26240 subscribe: storeSubscribe, 26241 sync: storeSync, 26242 batch: storeBatch, 26243 pick: storePick, 26244 omit: storeOmit 26245 } 26246 }; 26247 return finalStore; 26248 } 26249 function setup(store, ...args) { 26250 if (!store) return; 26251 return getInternal(store, "setup")(...args); 26252 } 26253 function init(store, ...args) { 26254 if (!store) return; 26255 return getInternal(store, "init")(...args); 26256 } 26257 function subscribe(store, ...args) { 26258 if (!store) return; 26259 return getInternal(store, "subscribe")(...args); 26260 } 26261 function sync(store, ...args) { 26262 if (!store) return; 26263 return getInternal(store, "sync")(...args); 26264 } 26265 function batch(store, ...args) { 26266 if (!store) return; 26267 return getInternal(store, "batch")(...args); 26268 } 26269 function omit2(store, ...args) { 26270 if (!store) return; 26271 return getInternal(store, "omit")(...args); 26272 } 26273 function pick2(store, ...args) { 26274 if (!store) return; 26275 return getInternal(store, "pick")(...args); 26276 } 26277 function mergeStore(...stores) { 26278 const initialState = stores.reduce((state, store2) => { 26279 var _a; 26280 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); 26281 if (!nextState) return state; 26282 return Object.assign(state, nextState); 26283 }, {}); 26284 const store = createStore(initialState, ...stores); 26285 return store; 26286 } 26287 function throwOnConflictingProps(props, store) { 26288 if (true) return; 26289 if (!store) return; 26290 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 26291 var _a; 26292 const stateKey = key.replace("default", ""); 26293 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`; 26294 }); 26295 if (!defaultKeys.length) return; 26296 const storeState = store.getState(); 26297 const conflictingProps = defaultKeys.filter( 26298 (key) => PBFD2E7P_hasOwnProperty(storeState, key) 26299 ); 26300 if (!conflictingProps.length) return; 26301 throw new Error( 26302 `Passing a store prop in conjunction with a default state is not supported. 26303 26304 const store = useSelectStore(); 26305 <SelectProvider store={store} defaultValue="Apple" /> 26306 ^ ^ 26307 26308 Instead, pass the default state to the topmost store: 26309 26310 const store = useSelectStore({ defaultValue: "Apple" }); 26311 <SelectProvider store={store} /> 26312 26313 See https://github.com/ariakit/ariakit/pull/2745 for more details. 26314 26315 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 26316 ` 26317 ); 26318 } 26319 26320 26321 26322 // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js 26323 var shim = __webpack_require__(422); 26324 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js 26325 "use client"; 26326 26327 26328 26329 // src/utils/store.tsx 26330 26331 26332 26333 26334 var { useSyncExternalStore } = shim; 26335 var noopSubscribe = () => () => { 26336 }; 26337 function useStoreState(store, keyOrSelector = identity) { 26338 const storeSubscribe = external_React_.useCallback( 26339 (callback) => { 26340 if (!store) return noopSubscribe(); 26341 return subscribe(store, null, callback); 26342 }, 26343 [store] 26344 ); 26345 const getSnapshot = () => { 26346 const key = typeof keyOrSelector === "string" ? keyOrSelector : null; 26347 const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; 26348 const state = store == null ? void 0 : store.getState(); 26349 if (selector) return selector(state); 26350 if (!state) return; 26351 if (!key) return; 26352 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 26353 return state[key]; 26354 }; 26355 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 26356 } 26357 function useStoreProps(store, props, key, setKey) { 26358 const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; 26359 const setValue = setKey ? props[setKey] : void 0; 26360 const propsRef = useLiveRef({ value, setValue }); 26361 useSafeLayoutEffect(() => { 26362 return sync(store, [key], (state, prev) => { 26363 const { value: value2, setValue: setValue2 } = propsRef.current; 26364 if (!setValue2) return; 26365 if (state[key] === prev[key]) return; 26366 if (state[key] === value2) return; 26367 setValue2(state[key]); 26368 }); 26369 }, [store, key]); 26370 useSafeLayoutEffect(() => { 26371 if (value === void 0) return; 26372 store.setState(key, value); 26373 return batch(store, [key], () => { 26374 if (value === void 0) return; 26375 store.setState(key, value); 26376 }); 26377 }); 26378 } 26379 function _2GXGCHW6_useStore(createStore, props) { 26380 const [store, setStore] = external_React_.useState(() => createStore(props)); 26381 useSafeLayoutEffect(() => init(store), [store]); 26382 const useState2 = external_React_.useCallback( 26383 (keyOrSelector) => useStoreState(store, keyOrSelector), 26384 [store] 26385 ); 26386 const memoizedStore = external_React_.useMemo( 26387 () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), 26388 [store, useState2] 26389 ); 26390 const updateStore = useEvent(() => { 26391 setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); 26392 }); 26393 return [memoizedStore, updateStore]; 26394 } 26395 26396 26397 26398 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/TCAGH6BH.js 26399 "use client"; 26400 26401 26402 26403 // src/collection/collection-store.ts 26404 26405 function useCollectionStoreProps(store, update, props) { 26406 useUpdateEffect(update, [props.store]); 26407 useStoreProps(store, props, "items", "setItems"); 26408 return store; 26409 } 26410 function useCollectionStore(props = {}) { 26411 const [store, update] = useStore(Core.createCollectionStore, props); 26412 return useCollectionStoreProps(store, update, props); 26413 } 26414 26415 26416 26417 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/UVQLZ7T5.js 26418 "use client"; 26419 26420 26421 26422 // src/composite/composite-store.ts 26423 26424 function useCompositeStoreProps(store, update, props) { 26425 store = useCollectionStoreProps(store, update, props); 26426 useStoreProps(store, props, "activeId", "setActiveId"); 26427 useStoreProps(store, props, "includesBaseElement"); 26428 useStoreProps(store, props, "virtualFocus"); 26429 useStoreProps(store, props, "orientation"); 26430 useStoreProps(store, props, "rtl"); 26431 useStoreProps(store, props, "focusLoop"); 26432 useStoreProps(store, props, "focusWrap"); 26433 useStoreProps(store, props, "focusShift"); 26434 return store; 26435 } 26436 function useCompositeStore(props = {}) { 26437 const [store, update] = useStore(Core.createCompositeStore, props); 26438 return useCompositeStoreProps(store, update, props); 26439 } 26440 26441 26442 26443 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/KGK2TTFO.js 26444 "use client"; 26445 26446 26447 26448 // src/disclosure/disclosure-store.ts 26449 26450 function useDisclosureStoreProps(store, update, props) { 26451 useUpdateEffect(update, [props.store, props.disclosure]); 26452 useStoreProps(store, props, "open", "setOpen"); 26453 useStoreProps(store, props, "mounted", "setMounted"); 26454 useStoreProps(store, props, "animated"); 26455 return Object.assign(store, { disclosure: props.disclosure }); 26456 } 26457 function useDisclosureStore(props = {}) { 26458 const [store, update] = useStore(Core.createDisclosureStore, props); 26459 return useDisclosureStoreProps(store, update, props); 26460 } 26461 26462 26463 26464 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/QYS5FHDY.js 26465 "use client"; 26466 26467 26468 26469 // src/dialog/dialog-store.ts 26470 26471 function useDialogStoreProps(store, update, props) { 26472 return useDisclosureStoreProps(store, update, props); 26473 } 26474 function useDialogStore(props = {}) { 26475 const [store, update] = useStore(Core.createDialogStore, props); 26476 return useDialogStoreProps(store, update, props); 26477 } 26478 26479 26480 26481 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/CBC47ZYL.js 26482 "use client"; 26483 26484 26485 26486 26487 // src/popover/popover-store.ts 26488 26489 function usePopoverStoreProps(store, update, props) { 26490 useUpdateEffect(update, [props.popover]); 26491 useStoreProps(store, props, "placement"); 26492 return useDialogStoreProps(store, update, props); 26493 } 26494 function usePopoverStore(props = {}) { 26495 const [store, update] = useStore(Core.createPopoverStore, props); 26496 return usePopoverStoreProps(store, update, props); 26497 } 26498 26499 26500 26501 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/6DHTHWXD.js 26502 "use client"; 26503 26504 26505 26506 26507 26508 // src/collection/collection-store.ts 26509 function isElementPreceding(a, b) { 26510 return Boolean( 26511 b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING 26512 ); 26513 } 26514 function sortBasedOnDOMPosition(items) { 26515 const pairs = items.map((item, index) => [index, item]); 26516 let isOrderDifferent = false; 26517 pairs.sort(([indexA, a], [indexB, b]) => { 26518 const elementA = a.element; 26519 const elementB = b.element; 26520 if (elementA === elementB) return 0; 26521 if (!elementA || !elementB) return 0; 26522 if (isElementPreceding(elementA, elementB)) { 26523 if (indexA > indexB) { 26524 isOrderDifferent = true; 26525 } 26526 return -1; 26527 } 26528 if (indexA < indexB) { 26529 isOrderDifferent = true; 26530 } 26531 return 1; 26532 }); 26533 if (isOrderDifferent) { 26534 return pairs.map(([_, item]) => item); 26535 } 26536 return items; 26537 } 26538 function getCommonParent(items) { 26539 var _a; 26540 const firstItem = items.find((item) => !!item.element); 26541 const lastItem = [...items].reverse().find((item) => !!item.element); 26542 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; 26543 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { 26544 const parent = parentElement; 26545 if (lastItem && parent.contains(lastItem.element)) { 26546 return parentElement; 26547 } 26548 parentElement = parentElement.parentElement; 26549 } 26550 return getDocument(parentElement).body; 26551 } 26552 function getPrivateStore(store) { 26553 return store == null ? void 0 : store.__unstablePrivateStore; 26554 } 26555 function createCollectionStore(props = {}) { 26556 var _a; 26557 throwOnConflictingProps(props, props.store); 26558 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 26559 const items = defaultValue( 26560 props.items, 26561 syncState == null ? void 0 : syncState.items, 26562 props.defaultItems, 26563 [] 26564 ); 26565 const itemsMap = new Map(items.map((item) => [item.id, item])); 26566 const initialState = { 26567 items, 26568 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) 26569 }; 26570 const syncPrivateStore = getPrivateStore(props.store); 26571 const privateStore = createStore( 26572 { items, renderedItems: initialState.renderedItems }, 26573 syncPrivateStore 26574 ); 26575 const collection = createStore(initialState, props.store); 26576 const sortItems = (renderedItems) => { 26577 const sortedItems = sortBasedOnDOMPosition(renderedItems); 26578 privateStore.setState("renderedItems", sortedItems); 26579 collection.setState("renderedItems", sortedItems); 26580 }; 26581 setup(collection, () => init(privateStore)); 26582 setup(privateStore, () => { 26583 return batch(privateStore, ["items"], (state) => { 26584 collection.setState("items", state.items); 26585 }); 26586 }); 26587 setup(privateStore, () => { 26588 return batch(privateStore, ["renderedItems"], (state) => { 26589 let firstRun = true; 26590 let raf = requestAnimationFrame(() => { 26591 const { renderedItems } = collection.getState(); 26592 if (state.renderedItems === renderedItems) return; 26593 sortItems(state.renderedItems); 26594 }); 26595 if (typeof IntersectionObserver !== "function") { 26596 return () => cancelAnimationFrame(raf); 26597 } 26598 const ioCallback = () => { 26599 if (firstRun) { 26600 firstRun = false; 26601 return; 26602 } 26603 cancelAnimationFrame(raf); 26604 raf = requestAnimationFrame(() => sortItems(state.renderedItems)); 26605 }; 26606 const root = getCommonParent(state.renderedItems); 26607 const observer = new IntersectionObserver(ioCallback, { root }); 26608 for (const item of state.renderedItems) { 26609 if (!item.element) continue; 26610 observer.observe(item.element); 26611 } 26612 return () => { 26613 cancelAnimationFrame(raf); 26614 observer.disconnect(); 26615 }; 26616 }); 26617 }); 26618 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 26619 let prevItem; 26620 setItems((items2) => { 26621 const index = items2.findIndex(({ id }) => id === item.id); 26622 const nextItems = items2.slice(); 26623 if (index !== -1) { 26624 prevItem = items2[index]; 26625 const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); 26626 nextItems[index] = nextItem; 26627 itemsMap.set(item.id, nextItem); 26628 } else { 26629 nextItems.push(item); 26630 itemsMap.set(item.id, item); 26631 } 26632 return nextItems; 26633 }); 26634 const unmergeItem = () => { 26635 setItems((items2) => { 26636 if (!prevItem) { 26637 if (canDeleteFromMap) { 26638 itemsMap.delete(item.id); 26639 } 26640 return items2.filter(({ id }) => id !== item.id); 26641 } 26642 const index = items2.findIndex(({ id }) => id === item.id); 26643 if (index === -1) return items2; 26644 const nextItems = items2.slice(); 26645 nextItems[index] = prevItem; 26646 itemsMap.set(item.id, prevItem); 26647 return nextItems; 26648 }); 26649 }; 26650 return unmergeItem; 26651 }; 26652 const registerItem = (item) => mergeItem( 26653 item, 26654 (getItems) => privateStore.setState("items", getItems), 26655 true 26656 ); 26657 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { 26658 registerItem, 26659 renderItem: (item) => chain( 26660 registerItem(item), 26661 mergeItem( 26662 item, 26663 (getItems) => privateStore.setState("renderedItems", getItems) 26664 ) 26665 ), 26666 item: (id) => { 26667 if (!id) return null; 26668 let item = itemsMap.get(id); 26669 if (!item) { 26670 const { items: items2 } = collection.getState(); 26671 item = items2.find((item2) => item2.id === id); 26672 if (item) { 26673 itemsMap.set(id, item); 26674 } 26675 } 26676 return item || null; 26677 }, 26678 // @ts-expect-error Internal 26679 __unstablePrivateStore: privateStore 26680 }); 26681 } 26682 26683 26684 26685 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js 26686 "use client"; 26687 26688 // src/utils/array.ts 26689 function toArray(arg) { 26690 if (Array.isArray(arg)) { 26691 return arg; 26692 } 26693 return typeof arg !== "undefined" ? [arg] : []; 26694 } 26695 function addItemToArray(array, item, index = -1) { 26696 if (!(index in array)) { 26697 return [...array, item]; 26698 } 26699 return [...array.slice(0, index), item, ...array.slice(index)]; 26700 } 26701 function flatten2DArray(array) { 26702 const flattened = []; 26703 for (const row of array) { 26704 flattened.push(...row); 26705 } 26706 return flattened; 26707 } 26708 function reverseArray(array) { 26709 return array.slice().reverse(); 26710 } 26711 26712 26713 26714 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/D7EIQZAU.js 26715 "use client"; 26716 26717 26718 26719 26720 26721 26722 // src/composite/composite-store.ts 26723 var NULL_ITEM = { id: null }; 26724 function findFirstEnabledItem(items, excludeId) { 26725 return items.find((item) => { 26726 if (excludeId) { 26727 return !item.disabled && item.id !== excludeId; 26728 } 26729 return !item.disabled; 26730 }); 26731 } 26732 function getEnabledItems(items, excludeId) { 26733 return items.filter((item) => { 26734 if (excludeId) { 26735 return !item.disabled && item.id !== excludeId; 26736 } 26737 return !item.disabled; 26738 }); 26739 } 26740 function getOppositeOrientation(orientation) { 26741 if (orientation === "vertical") return "horizontal"; 26742 if (orientation === "horizontal") return "vertical"; 26743 return; 26744 } 26745 function getItemsInRow(items, rowId) { 26746 return items.filter((item) => item.rowId === rowId); 26747 } 26748 function flipItems(items, activeId, shouldInsertNullItem = false) { 26749 const index = items.findIndex((item) => item.id === activeId); 26750 return [ 26751 ...items.slice(index + 1), 26752 ...shouldInsertNullItem ? [NULL_ITEM] : [], 26753 ...items.slice(0, index) 26754 ]; 26755 } 26756 function groupItemsByRows(items) { 26757 const rows = []; 26758 for (const item of items) { 26759 const row = rows.find((currentRow) => { 26760 var _a; 26761 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 26762 }); 26763 if (row) { 26764 row.push(item); 26765 } else { 26766 rows.push([item]); 26767 } 26768 } 26769 return rows; 26770 } 26771 function getMaxRowLength(array) { 26772 let maxLength = 0; 26773 for (const { length } of array) { 26774 if (length > maxLength) { 26775 maxLength = length; 26776 } 26777 } 26778 return maxLength; 26779 } 26780 function createEmptyItem(rowId) { 26781 return { 26782 id: "__EMPTY_ITEM__", 26783 disabled: true, 26784 rowId 26785 }; 26786 } 26787 function normalizeRows(rows, activeId, focusShift) { 26788 const maxLength = getMaxRowLength(rows); 26789 for (const row of rows) { 26790 for (let i = 0; i < maxLength; i += 1) { 26791 const item = row[i]; 26792 if (!item || focusShift && item.disabled) { 26793 const isFirst = i === 0; 26794 const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; 26795 row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); 26796 } 26797 } 26798 } 26799 return rows; 26800 } 26801 function verticalizeItems(items) { 26802 const rows = groupItemsByRows(items); 26803 const maxLength = getMaxRowLength(rows); 26804 const verticalized = []; 26805 for (let i = 0; i < maxLength; i += 1) { 26806 for (const row of rows) { 26807 const item = row[i]; 26808 if (item) { 26809 verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { 26810 // If there's no rowId, it means that it's not a grid composite, but 26811 // a single row instead. So, instead of verticalizing it, that is, 26812 // assigning a different rowId based on the column index, we keep it 26813 // undefined so they will be part of the same row. This is useful 26814 // when using up/down on one-dimensional composites. 26815 rowId: item.rowId ? `$i}` : void 0 26816 })); 26817 } 26818 } 26819 } 26820 return verticalized; 26821 } 26822 function createCompositeStore(props = {}) { 26823 var _a; 26824 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 26825 const collection = createCollectionStore(props); 26826 const activeId = defaultValue( 26827 props.activeId, 26828 syncState == null ? void 0 : syncState.activeId, 26829 props.defaultActiveId 26830 ); 26831 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { 26832 activeId, 26833 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), 26834 includesBaseElement: defaultValue( 26835 props.includesBaseElement, 26836 syncState == null ? void 0 : syncState.includesBaseElement, 26837 activeId === null 26838 ), 26839 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), 26840 orientation: defaultValue( 26841 props.orientation, 26842 syncState == null ? void 0 : syncState.orientation, 26843 "both" 26844 ), 26845 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), 26846 virtualFocus: defaultValue( 26847 props.virtualFocus, 26848 syncState == null ? void 0 : syncState.virtualFocus, 26849 false 26850 ), 26851 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), 26852 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), 26853 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) 26854 }); 26855 const composite = createStore(initialState, collection, props.store); 26856 setup( 26857 composite, 26858 () => sync(composite, ["renderedItems", "activeId"], (state) => { 26859 composite.setState("activeId", (activeId2) => { 26860 var _a2; 26861 if (activeId2 !== void 0) return activeId2; 26862 return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; 26863 }); 26864 }) 26865 ); 26866 const getNextId = (items, orientation, hasNullItem, skip) => { 26867 var _a2, _b; 26868 const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState(); 26869 const isHorizontal = orientation !== "vertical"; 26870 const isRTL = rtl && isHorizontal; 26871 const allItems = isRTL ? reverseArray(items) : items; 26872 if (activeId2 == null) { 26873 return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id; 26874 } 26875 const activeItem = allItems.find((item) => item.id === activeId2); 26876 if (!activeItem) { 26877 return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id; 26878 } 26879 const isGrid = !!activeItem.rowId; 26880 const activeIndex = allItems.indexOf(activeItem); 26881 const nextItems = allItems.slice(activeIndex + 1); 26882 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 26883 if (skip !== void 0) { 26884 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 26885 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. 26886 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; 26887 return nextItem2 == null ? void 0 : nextItem2.id; 26888 } 26889 const oppositeOrientation = getOppositeOrientation( 26890 // If it's a grid and orientation is not set, it's a next/previous call, 26891 // which is inherently horizontal. up/down will call next with orientation 26892 // set to vertical by default (see below on up/down methods). 26893 isGrid ? orientation || "horizontal" : orientation 26894 ); 26895 const canLoop = focusLoop && focusLoop !== oppositeOrientation; 26896 const canWrap = isGrid && focusWrap && focusWrap !== oppositeOrientation; 26897 hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement; 26898 if (canLoop) { 26899 const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId); 26900 const sortedItems = flipItems(loopItems, activeId2, hasNullItem); 26901 const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); 26902 return nextItem2 == null ? void 0 : nextItem2.id; 26903 } 26904 if (canWrap) { 26905 const nextItem2 = findFirstEnabledItem( 26906 // We can use nextItems, which contains all the next items, including 26907 // items from other rows, to wrap between rows. However, if there is a 26908 // null item (the composite container), we'll only use the next items in 26909 // the row. So moving next from the last item will focus on the 26910 // composite container. On grid composites, horizontal navigation never 26911 // focuses on the composite container, only vertical. 26912 hasNullItem ? nextItemsInRow : nextItems, 26913 activeId2 26914 ); 26915 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; 26916 return nextId; 26917 } 26918 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); 26919 if (!nextItem && hasNullItem) { 26920 return null; 26921 } 26922 return nextItem == null ? void 0 : nextItem.id; 26923 }; 26924 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { 26925 setBaseElement: (element) => composite.setState("baseElement", element), 26926 setActiveId: (id) => composite.setState("activeId", id), 26927 move: (id) => { 26928 if (id === void 0) return; 26929 composite.setState("activeId", id); 26930 composite.setState("moves", (moves) => moves + 1); 26931 }, 26932 first: () => { 26933 var _a2; 26934 return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; 26935 }, 26936 last: () => { 26937 var _a2; 26938 return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; 26939 }, 26940 next: (skip) => { 26941 const { renderedItems, orientation } = composite.getState(); 26942 return getNextId(renderedItems, orientation, false, skip); 26943 }, 26944 previous: (skip) => { 26945 var _a2; 26946 const { renderedItems, orientation, includesBaseElement } = composite.getState(); 26947 const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId); 26948 const hasNullItem = !isGrid && includesBaseElement; 26949 return getNextId( 26950 reverseArray(renderedItems), 26951 orientation, 26952 hasNullItem, 26953 skip 26954 ); 26955 }, 26956 down: (skip) => { 26957 const { 26958 activeId: activeId2, 26959 renderedItems, 26960 focusShift, 26961 focusLoop, 26962 includesBaseElement 26963 } = composite.getState(); 26964 const shouldShift = focusShift && !skip; 26965 const verticalItems = verticalizeItems( 26966 flatten2DArray( 26967 normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift) 26968 ) 26969 ); 26970 const canLoop = focusLoop && focusLoop !== "horizontal"; 26971 const hasNullItem = canLoop && includesBaseElement; 26972 return getNextId(verticalItems, "vertical", hasNullItem, skip); 26973 }, 26974 up: (skip) => { 26975 const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState(); 26976 const shouldShift = focusShift && !skip; 26977 const verticalItems = verticalizeItems( 26978 reverseArray( 26979 flatten2DArray( 26980 normalizeRows( 26981 groupItemsByRows(renderedItems), 26982 activeId2, 26983 shouldShift 26984 ) 26985 ) 26986 ) 26987 ); 26988 const hasNullItem = includesBaseElement; 26989 return getNextId(verticalItems, "vertical", hasNullItem, skip); 26990 } 26991 }); 26992 } 26993 26994 26995 26996 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/6E4KKOSB.js 26997 "use client"; 26998 26999 27000 27001 27002 // src/disclosure/disclosure-store.ts 27003 function createDisclosureStore(props = {}) { 27004 const store = mergeStore( 27005 props.store, 27006 omit2(props.disclosure, ["contentElement", "disclosureElement"]) 27007 ); 27008 throwOnConflictingProps(props, store); 27009 const syncState = store == null ? void 0 : store.getState(); 27010 const open = defaultValue( 27011 props.open, 27012 syncState == null ? void 0 : syncState.open, 27013 props.defaultOpen, 27014 false 27015 ); 27016 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); 27017 const initialState = { 27018 open, 27019 animated, 27020 animating: !!animated && open, 27021 mounted: open, 27022 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), 27023 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) 27024 }; 27025 const disclosure = createStore(initialState, store); 27026 setup( 27027 disclosure, 27028 () => sync(disclosure, ["animated", "animating"], (state) => { 27029 if (state.animated) return; 27030 disclosure.setState("animating", false); 27031 }) 27032 ); 27033 setup( 27034 disclosure, 27035 () => subscribe(disclosure, ["open"], () => { 27036 if (!disclosure.getState().animated) return; 27037 disclosure.setState("animating", true); 27038 }) 27039 ); 27040 setup( 27041 disclosure, 27042 () => sync(disclosure, ["open", "animating"], (state) => { 27043 disclosure.setState("mounted", state.open || state.animating); 27044 }) 27045 ); 27046 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { 27047 disclosure: props.disclosure, 27048 setOpen: (value) => disclosure.setState("open", value), 27049 show: () => disclosure.setState("open", true), 27050 hide: () => disclosure.setState("open", false), 27051 toggle: () => disclosure.setState("open", (open2) => !open2), 27052 stopAnimation: () => disclosure.setState("animating", false), 27053 setContentElement: (value) => disclosure.setState("contentElement", value), 27054 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 27055 }); 27056 } 27057 27058 27059 27060 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/YOHCVXJB.js 27061 "use client"; 27062 27063 27064 // src/dialog/dialog-store.ts 27065 function createDialogStore(props = {}) { 27066 return createDisclosureStore(props); 27067 } 27068 27069 27070 27071 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/3UYWTADI.js 27072 "use client"; 27073 27074 27075 27076 27077 27078 // src/popover/popover-store.ts 27079 function createPopoverStore(_a = {}) { 27080 var _b = _a, { 27081 popover: otherPopover 27082 } = _b, props = _3YLGPPWQ_objRest(_b, [ 27083 "popover" 27084 ]); 27085 const store = mergeStore( 27086 props.store, 27087 omit2(otherPopover, [ 27088 "arrowElement", 27089 "anchorElement", 27090 "contentElement", 27091 "popoverElement", 27092 "disclosureElement" 27093 ]) 27094 ); 27095 throwOnConflictingProps(props, store); 27096 const syncState = store == null ? void 0 : store.getState(); 27097 const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); 27098 const placement = defaultValue( 27099 props.placement, 27100 syncState == null ? void 0 : syncState.placement, 27101 "bottom" 27102 ); 27103 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { 27104 placement, 27105 currentPlacement: placement, 27106 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), 27107 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), 27108 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), 27109 rendered: Symbol("rendered") 27110 }); 27111 const popover = createStore(initialState, dialog, store); 27112 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { 27113 setAnchorElement: (element) => popover.setState("anchorElement", element), 27114 setPopoverElement: (element) => popover.setState("popoverElement", element), 27115 setArrowElement: (element) => popover.setState("arrowElement", element), 27116 render: () => popover.setState("rendered", Symbol("rendered")) 27117 }); 27118 } 27119 27120 27121 27122 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/combobox/combobox-store.js 27123 "use client"; 27124 27125 27126 27127 27128 27129 27130 27131 27132 27133 27134 27135 27136 // src/combobox/combobox-store.ts 27137 var isTouchSafari = isSafari() && isTouchDevice(); 27138 function createComboboxStore(_a = {}) { 27139 var _b = _a, { 27140 tag 27141 } = _b, props = _3YLGPPWQ_objRest(_b, [ 27142 "tag" 27143 ]); 27144 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 27145 throwOnConflictingProps(props, store); 27146 const tagState = tag == null ? void 0 : tag.getState(); 27147 const syncState = store == null ? void 0 : store.getState(); 27148 const activeId = defaultValue( 27149 props.activeId, 27150 syncState == null ? void 0 : syncState.activeId, 27151 props.defaultActiveId, 27152 null 27153 ); 27154 const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 27155 activeId, 27156 includesBaseElement: defaultValue( 27157 props.includesBaseElement, 27158 syncState == null ? void 0 : syncState.includesBaseElement, 27159 true 27160 ), 27161 orientation: defaultValue( 27162 props.orientation, 27163 syncState == null ? void 0 : syncState.orientation, 27164 "vertical" 27165 ), 27166 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), 27167 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), 27168 virtualFocus: defaultValue( 27169 props.virtualFocus, 27170 syncState == null ? void 0 : syncState.virtualFocus, 27171 true 27172 ) 27173 })); 27174 const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 27175 placement: defaultValue( 27176 props.placement, 27177 syncState == null ? void 0 : syncState.placement, 27178 "bottom-start" 27179 ) 27180 })); 27181 const value = defaultValue( 27182 props.value, 27183 syncState == null ? void 0 : syncState.value, 27184 props.defaultValue, 27185 "" 27186 ); 27187 const selectedValue = defaultValue( 27188 props.selectedValue, 27189 syncState == null ? void 0 : syncState.selectedValue, 27190 tagState == null ? void 0 : tagState.values, 27191 props.defaultSelectedValue, 27192 "" 27193 ); 27194 const multiSelectable = Array.isArray(selectedValue); 27195 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { 27196 value, 27197 selectedValue, 27198 resetValueOnSelect: defaultValue( 27199 props.resetValueOnSelect, 27200 syncState == null ? void 0 : syncState.resetValueOnSelect, 27201 multiSelectable 27202 ), 27203 resetValueOnHide: defaultValue( 27204 props.resetValueOnHide, 27205 syncState == null ? void 0 : syncState.resetValueOnHide, 27206 multiSelectable && !tag 27207 ), 27208 activeValue: syncState == null ? void 0 : syncState.activeValue 27209 }); 27210 const combobox = createStore(initialState, composite, popover, store); 27211 if (isTouchSafari) { 27212 setup( 27213 combobox, 27214 () => sync(combobox, ["virtualFocus"], () => { 27215 combobox.setState("virtualFocus", false); 27216 }) 27217 ); 27218 } 27219 setup(combobox, () => { 27220 if (!tag) return; 27221 return chain( 27222 sync(combobox, ["selectedValue"], (state) => { 27223 if (!Array.isArray(state.selectedValue)) return; 27224 tag.setValues(state.selectedValue); 27225 }), 27226 sync(tag, ["values"], (state) => { 27227 combobox.setState("selectedValue", state.values); 27228 }) 27229 ); 27230 }); 27231 setup( 27232 combobox, 27233 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { 27234 if (!state.resetValueOnHide) return; 27235 if (state.mounted) return; 27236 combobox.setState("value", value); 27237 }) 27238 ); 27239 setup( 27240 combobox, 27241 () => sync(combobox, ["open"], (state) => { 27242 if (state.open) return; 27243 combobox.setState("activeId", activeId); 27244 combobox.setState("moves", 0); 27245 }) 27246 ); 27247 setup( 27248 combobox, 27249 () => sync(combobox, ["moves", "activeId"], (state, prevState) => { 27250 if (state.moves === prevState.moves) { 27251 combobox.setState("activeValue", void 0); 27252 } 27253 }) 27254 ); 27255 setup( 27256 combobox, 27257 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 27258 if (state.moves === prev.moves) return; 27259 const { activeId: activeId2 } = combobox.getState(); 27260 const activeItem = composite.item(activeId2); 27261 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); 27262 }) 27263 ); 27264 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), { 27265 tag, 27266 setValue: (value2) => combobox.setState("value", value2), 27267 resetValue: () => combobox.setState("value", initialState.value), 27268 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 27269 }); 27270 } 27271 27272 27273 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7BSNT25J.js 27274 "use client"; 27275 27276 27277 27278 27279 27280 27281 27282 // src/combobox/combobox-store.ts 27283 27284 function useComboboxStoreProps(store, update, props) { 27285 useUpdateEffect(update, [props.tag]); 27286 useStoreProps(store, props, "value", "setValue"); 27287 useStoreProps(store, props, "selectedValue", "setSelectedValue"); 27288 useStoreProps(store, props, "resetValueOnHide"); 27289 useStoreProps(store, props, "resetValueOnSelect"); 27290 return Object.assign( 27291 useCompositeStoreProps( 27292 usePopoverStoreProps(store, update, props), 27293 update, 27294 props 27295 ), 27296 { tag: props.tag } 27297 ); 27298 } 27299 function useComboboxStore(props = {}) { 27300 const tag = useTagContext(); 27301 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 27302 tag: props.tag !== void 0 ? props.tag : tag 27303 }); 27304 const [store, update] = _2GXGCHW6_useStore(createComboboxStore, props); 27305 return useComboboxStoreProps(store, update, props); 27306 } 27307 27308 27309 27310 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/RGUP62TM.js 27311 "use client"; 27312 27313 27314 // src/disclosure/disclosure-context.tsx 27315 var RGUP62TM_ctx = createStoreContext(); 27316 var useDisclosureContext = RGUP62TM_ctx.useContext; 27317 var useDisclosureScopedContext = RGUP62TM_ctx.useScopedContext; 27318 var useDisclosureProviderContext = RGUP62TM_ctx.useProviderContext; 27319 var DisclosureContextProvider = RGUP62TM_ctx.ContextProvider; 27320 var DisclosureScopedContextProvider = RGUP62TM_ctx.ScopedContextProvider; 27321 27322 27323 27324 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/DU4D3UCJ.js 27325 "use client"; 27326 27327 27328 27329 // src/dialog/dialog-context.tsx 27330 27331 var DU4D3UCJ_ctx = createStoreContext( 27332 [DisclosureContextProvider], 27333 [DisclosureScopedContextProvider] 27334 ); 27335 var useDialogContext = DU4D3UCJ_ctx.useContext; 27336 var useDialogScopedContext = DU4D3UCJ_ctx.useScopedContext; 27337 var useDialogProviderContext = DU4D3UCJ_ctx.useProviderContext; 27338 var DialogContextProvider = DU4D3UCJ_ctx.ContextProvider; 27339 var DialogScopedContextProvider = DU4D3UCJ_ctx.ScopedContextProvider; 27340 var DialogHeadingContext = (0,external_React_.createContext)(void 0); 27341 var DialogDescriptionContext = (0,external_React_.createContext)(void 0); 27342 27343 27344 27345 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/54MGSIOI.js 27346 "use client"; 27347 27348 27349 27350 // src/popover/popover-context.tsx 27351 var _54MGSIOI_ctx = createStoreContext( 27352 [DialogContextProvider], 27353 [DialogScopedContextProvider] 27354 ); 27355 var usePopoverContext = _54MGSIOI_ctx.useContext; 27356 var usePopoverScopedContext = _54MGSIOI_ctx.useScopedContext; 27357 var usePopoverProviderContext = _54MGSIOI_ctx.useProviderContext; 27358 var PopoverContextProvider = _54MGSIOI_ctx.ContextProvider; 27359 var PopoverScopedContextProvider = _54MGSIOI_ctx.ScopedContextProvider; 27360 27361 27362 27363 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/DWZ7E5TJ.js 27364 "use client"; 27365 27366 27367 27368 27369 // src/combobox/combobox-context.tsx 27370 27371 var ComboboxListRoleContext = (0,external_React_.createContext)( 27372 void 0 27373 ); 27374 var DWZ7E5TJ_ctx = createStoreContext( 27375 [PopoverContextProvider, CompositeContextProvider], 27376 [PopoverScopedContextProvider, CompositeScopedContextProvider] 27377 ); 27378 var useComboboxContext = DWZ7E5TJ_ctx.useContext; 27379 var useComboboxScopedContext = DWZ7E5TJ_ctx.useScopedContext; 27380 var useComboboxProviderContext = DWZ7E5TJ_ctx.useProviderContext; 27381 var ComboboxContextProvider = DWZ7E5TJ_ctx.ContextProvider; 27382 var ComboboxScopedContextProvider = DWZ7E5TJ_ctx.ScopedContextProvider; 27383 var ComboboxItemValueContext = (0,external_React_.createContext)( 27384 void 0 27385 ); 27386 var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); 27387 27388 27389 27390 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js 27391 "use client"; 27392 27393 27394 27395 27396 27397 27398 27399 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 // src/combobox/combobox-provider.tsx 27412 27413 function ComboboxProvider(props = {}) { 27414 const store = useComboboxStore(props); 27415 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children }); 27416 } 27417 27418 27419 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js 27420 "use client"; 27421 27422 27423 27424 27425 27426 27427 27428 27429 27430 27431 27432 // src/combobox/combobox-label.tsx 27433 27434 var TagName = "label"; 27435 var useComboboxLabel = createHook( 27436 function useComboboxLabel2(_a) { 27437 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 27438 const context = useComboboxProviderContext(); 27439 store = store || context; 27440 invariant( 27441 store, 27442 false && 0 27443 ); 27444 const comboboxId = store.useState((state) => { 27445 var _a2; 27446 return (_a2 = state.baseElement) == null ? void 0 : _a2.id; 27447 }); 27448 props = _3YLGPPWQ_spreadValues({ 27449 htmlFor: comboboxId 27450 }, props); 27451 return removeUndefinedValues(props); 27452 } 27453 ); 27454 var ComboboxLabel = memo2( 27455 forwardRef2(function ComboboxLabel2(props) { 27456 const htmlProps = useComboboxLabel(props); 27457 return createElement(TagName, htmlProps); 27458 }) 27459 ); 27460 27461 27462 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/74NFH3UH.js 27463 "use client"; 27464 27465 27466 27467 27468 27469 // src/popover/popover-anchor.tsx 27470 var _74NFH3UH_TagName = "div"; 27471 var usePopoverAnchor = createHook( 27472 function usePopoverAnchor2(_a) { 27473 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 27474 const context = usePopoverProviderContext(); 27475 store = store || context; 27476 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 27477 ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) 27478 }); 27479 return props; 27480 } 27481 ); 27482 var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { 27483 const htmlProps = usePopoverAnchor(props); 27484 return createElement(_74NFH3UH_TagName, htmlProps); 27485 }); 27486 27487 27488 27489 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js 27490 "use client"; 27491 27492 // src/composite/utils.ts 27493 27494 var _5VQZOHHZ_NULL_ITEM = { id: null }; 27495 function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { 27496 const index = items.findIndex((item) => item.id === activeId); 27497 return [ 27498 ...items.slice(index + 1), 27499 ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], 27500 ...items.slice(0, index) 27501 ]; 27502 } 27503 function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { 27504 return items.find((item) => { 27505 if (excludeId) { 27506 return !item.disabled && item.id !== excludeId; 27507 } 27508 return !item.disabled; 27509 }); 27510 } 27511 function getEnabledItem(store, id) { 27512 if (!id) return null; 27513 return store.item(id) || null; 27514 } 27515 function _5VQZOHHZ_groupItemsByRows(items) { 27516 const rows = []; 27517 for (const item of items) { 27518 const row = rows.find((currentRow) => { 27519 var _a; 27520 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 27521 }); 27522 if (row) { 27523 row.push(item); 27524 } else { 27525 rows.push([item]); 27526 } 27527 } 27528 return rows; 27529 } 27530 function selectTextField(element, collapseToEnd = false) { 27531 if (isTextField(element)) { 27532 element.setSelectionRange( 27533 collapseToEnd ? element.value.length : 0, 27534 element.value.length 27535 ); 27536 } else if (element.isContentEditable) { 27537 const selection = getDocument(element).getSelection(); 27538 selection == null ? void 0 : selection.selectAllChildren(element); 27539 if (collapseToEnd) { 27540 selection == null ? void 0 : selection.collapseToEnd(); 27541 } 27542 } 27543 } 27544 var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); 27545 function focusSilently(element) { 27546 element[FOCUS_SILENTLY] = true; 27547 element.focus({ preventScroll: true }); 27548 } 27549 function silentlyFocused(element) { 27550 const isSilentlyFocused = element[FOCUS_SILENTLY]; 27551 delete element[FOCUS_SILENTLY]; 27552 return isSilentlyFocused; 27553 } 27554 function isItem(store, element, exclude) { 27555 if (!element) return false; 27556 if (element === exclude) return false; 27557 const item = store.item(element.id); 27558 if (!item) return false; 27559 if (exclude && item.element === exclude) return false; 27560 return true; 27561 } 27562 27563 27564 27565 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js 27566 "use client"; 27567 27568 // src/focusable/focusable-context.tsx 27569 27570 var FocusableContext = (0,external_React_.createContext)(true); 27571 27572 27573 27574 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/focus.js 27575 "use client"; 27576 27577 27578 27579 // src/utils/focus.ts 27580 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'])"; 27581 function hasNegativeTabIndex(element) { 27582 const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); 27583 return tabIndex < 0; 27584 } 27585 function isFocusable(element) { 27586 if (!element.matches(selector)) return false; 27587 if (!isVisible(element)) return false; 27588 if (element.closest("[inert]")) return false; 27589 return true; 27590 } 27591 function isTabbable(element) { 27592 if (!isFocusable(element)) return false; 27593 if (hasNegativeTabIndex(element)) return false; 27594 if (!("form" in element)) return true; 27595 if (!element.form) return true; 27596 if (element.checked) return true; 27597 if (element.type !== "radio") return true; 27598 const radioGroup = element.form.elements.namedItem(element.name); 27599 if (!radioGroup) return true; 27600 if (!("length" in radioGroup)) return true; 27601 const activeElement = getActiveElement(element); 27602 if (!activeElement) return true; 27603 if (activeElement === element) return true; 27604 if (!("form" in activeElement)) return true; 27605 if (activeElement.form !== element.form) return true; 27606 if (activeElement.name !== element.name) return true; 27607 return false; 27608 } 27609 function getAllFocusableIn(container, includeContainer) { 27610 const elements = Array.from( 27611 container.querySelectorAll(selector) 27612 ); 27613 if (includeContainer) { 27614 elements.unshift(container); 27615 } 27616 const focusableElements = elements.filter(isFocusable); 27617 focusableElements.forEach((element, i) => { 27618 if (isFrame(element) && element.contentDocument) { 27619 const frameBody = element.contentDocument.body; 27620 focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); 27621 } 27622 }); 27623 return focusableElements; 27624 } 27625 function getAllFocusable(includeBody) { 27626 return getAllFocusableIn(document.body, includeBody); 27627 } 27628 function getFirstFocusableIn(container, includeContainer) { 27629 const [first] = getAllFocusableIn(container, includeContainer); 27630 return first || null; 27631 } 27632 function getFirstFocusable(includeBody) { 27633 return getFirstFocusableIn(document.body, includeBody); 27634 } 27635 function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { 27636 const elements = Array.from( 27637 container.querySelectorAll(selector) 27638 ); 27639 const tabbableElements = elements.filter(isTabbable); 27640 if (includeContainer && isTabbable(container)) { 27641 tabbableElements.unshift(container); 27642 } 27643 tabbableElements.forEach((element, i) => { 27644 if (isFrame(element) && element.contentDocument) { 27645 const frameBody = element.contentDocument.body; 27646 const allFrameTabbable = getAllTabbableIn( 27647 frameBody, 27648 false, 27649 fallbackToFocusable 27650 ); 27651 tabbableElements.splice(i, 1, ...allFrameTabbable); 27652 } 27653 }); 27654 if (!tabbableElements.length && fallbackToFocusable) { 27655 return elements; 27656 } 27657 return tabbableElements; 27658 } 27659 function getAllTabbable(fallbackToFocusable) { 27660 return getAllTabbableIn(document.body, false, fallbackToFocusable); 27661 } 27662 function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { 27663 const [first] = getAllTabbableIn( 27664 container, 27665 includeContainer, 27666 fallbackToFocusable 27667 ); 27668 return first || null; 27669 } 27670 function getFirstTabbable(fallbackToFocusable) { 27671 return getFirstTabbableIn(document.body, false, fallbackToFocusable); 27672 } 27673 function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { 27674 const allTabbable = getAllTabbableIn( 27675 container, 27676 includeContainer, 27677 fallbackToFocusable 27678 ); 27679 return allTabbable[allTabbable.length - 1] || null; 27680 } 27681 function getLastTabbable(fallbackToFocusable) { 27682 return getLastTabbableIn(document.body, false, fallbackToFocusable); 27683 } 27684 function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { 27685 const activeElement = getActiveElement(container); 27686 const allFocusable = getAllFocusableIn(container, includeContainer); 27687 const activeIndex = allFocusable.indexOf(activeElement); 27688 const nextFocusableElements = allFocusable.slice(activeIndex + 1); 27689 return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; 27690 } 27691 function getNextTabbable(fallbackToFirst, fallbackToFocusable) { 27692 return getNextTabbableIn( 27693 document.body, 27694 false, 27695 fallbackToFirst, 27696 fallbackToFocusable 27697 ); 27698 } 27699 function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { 27700 const activeElement = getActiveElement(container); 27701 const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); 27702 const activeIndex = allFocusable.indexOf(activeElement); 27703 const previousFocusableElements = allFocusable.slice(activeIndex + 1); 27704 return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; 27705 } 27706 function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { 27707 return getPreviousTabbableIn( 27708 document.body, 27709 false, 27710 fallbackToFirst, 27711 fallbackToFocusable 27712 ); 27713 } 27714 function getClosestFocusable(element) { 27715 while (element && !isFocusable(element)) { 27716 element = element.closest(selector); 27717 } 27718 return element || null; 27719 } 27720 function hasFocus(element) { 27721 const activeElement = HWOIWM4O_getActiveElement(element); 27722 if (!activeElement) return false; 27723 if (activeElement === element) return true; 27724 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 27725 if (!activeDescendant) return false; 27726 return activeDescendant === element.id; 27727 } 27728 function hasFocusWithin(element) { 27729 const activeElement = HWOIWM4O_getActiveElement(element); 27730 if (!activeElement) return false; 27731 if (contains(element, activeElement)) return true; 27732 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 27733 if (!activeDescendant) return false; 27734 if (!("id" in element)) return false; 27735 if (activeDescendant === element.id) return true; 27736 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 27737 } 27738 function focusIfNeeded(element) { 27739 if (!hasFocusWithin(element) && isFocusable(element)) { 27740 element.focus(); 27741 } 27742 } 27743 function disableFocus(element) { 27744 var _a; 27745 const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; 27746 element.setAttribute("data-tabindex", currentTabindex); 27747 element.setAttribute("tabindex", "-1"); 27748 } 27749 function disableFocusIn(container, includeContainer) { 27750 const tabbableElements = getAllTabbableIn(container, includeContainer); 27751 for (const element of tabbableElements) { 27752 disableFocus(element); 27753 } 27754 } 27755 function restoreFocusIn(container) { 27756 const elements = container.querySelectorAll("[data-tabindex]"); 27757 const restoreTabIndex = (element) => { 27758 const tabindex = element.getAttribute("data-tabindex"); 27759 element.removeAttribute("data-tabindex"); 27760 if (tabindex) { 27761 element.setAttribute("tabindex", tabindex); 27762 } else { 27763 element.removeAttribute("tabindex"); 27764 } 27765 }; 27766 if (container.hasAttribute("data-tabindex")) { 27767 restoreTabIndex(container); 27768 } 27769 for (const element of elements) { 27770 restoreTabIndex(element); 27771 } 27772 } 27773 function focusIntoView(element, options) { 27774 if (!("scrollIntoView" in element)) { 27775 element.focus(); 27776 } else { 27777 element.focus({ preventScroll: true }); 27778 element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); 27779 } 27780 } 27781 27782 27783 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OD7ALSX5.js 27784 "use client"; 27785 27786 27787 27788 27789 27790 // src/focusable/focusable.tsx 27791 27792 27793 27794 27795 27796 27797 var OD7ALSX5_TagName = "div"; 27798 var isSafariBrowser = isSafari(); 27799 var alwaysFocusVisibleInputTypes = [ 27800 "text", 27801 "search", 27802 "url", 27803 "tel", 27804 "email", 27805 "password", 27806 "number", 27807 "date", 27808 "month", 27809 "week", 27810 "time", 27811 "datetime", 27812 "datetime-local" 27813 ]; 27814 var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); 27815 function isSafariFocusAncestor(element) { 27816 if (!element) return false; 27817 return !!element[safariFocusAncestorSymbol]; 27818 } 27819 function markSafariFocusAncestor(element, value) { 27820 if (!element) return; 27821 element[safariFocusAncestorSymbol] = value; 27822 } 27823 function isAlwaysFocusVisible(element) { 27824 const { tagName, readOnly, type } = element; 27825 if (tagName === "TEXTAREA" && !readOnly) return true; 27826 if (tagName === "SELECT" && !readOnly) return true; 27827 if (tagName === "INPUT" && !readOnly) { 27828 return alwaysFocusVisibleInputTypes.includes(type); 27829 } 27830 if (element.isContentEditable) return true; 27831 const role = element.getAttribute("role"); 27832 if (role === "combobox" && element.dataset.name) { 27833 return true; 27834 } 27835 return false; 27836 } 27837 function getLabels(element) { 27838 if ("labels" in element) { 27839 return element.labels; 27840 } 27841 return null; 27842 } 27843 function isNativeCheckboxOrRadio(element) { 27844 const tagName = element.tagName.toLowerCase(); 27845 if (tagName === "input" && element.type) { 27846 return element.type === "radio" || element.type === "checkbox"; 27847 } 27848 return false; 27849 } 27850 function isNativeTabbable(tagName) { 27851 if (!tagName) return true; 27852 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 27853 } 27854 function supportsDisabledAttribute(tagName) { 27855 if (!tagName) return true; 27856 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 27857 } 27858 function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { 27859 if (!focusable) { 27860 return tabIndexProp; 27861 } 27862 if (trulyDisabled) { 27863 if (nativeTabbable && !supportsDisabled) { 27864 return -1; 27865 } 27866 return; 27867 } 27868 if (nativeTabbable) { 27869 return tabIndexProp; 27870 } 27871 return tabIndexProp || 0; 27872 } 27873 function useDisableEvent(onEvent, disabled) { 27874 return useEvent((event) => { 27875 onEvent == null ? void 0 : onEvent(event); 27876 if (event.defaultPrevented) return; 27877 if (disabled) { 27878 event.stopPropagation(); 27879 event.preventDefault(); 27880 } 27881 }); 27882 } 27883 var isKeyboardModality = true; 27884 function onGlobalMouseDown(event) { 27885 const target = event.target; 27886 if (target && "hasAttribute" in target) { 27887 if (!target.hasAttribute("data-focus-visible")) { 27888 isKeyboardModality = false; 27889 } 27890 } 27891 } 27892 function onGlobalKeyDown(event) { 27893 if (event.metaKey) return; 27894 if (event.ctrlKey) return; 27895 if (event.altKey) return; 27896 isKeyboardModality = true; 27897 } 27898 var useFocusable = createHook( 27899 function useFocusable2(_a) { 27900 var _b = _a, { 27901 focusable = true, 27902 accessibleWhenDisabled, 27903 autoFocus, 27904 onFocusVisible 27905 } = _b, props = __objRest(_b, [ 27906 "focusable", 27907 "accessibleWhenDisabled", 27908 "autoFocus", 27909 "onFocusVisible" 27910 ]); 27911 const ref = (0,external_React_.useRef)(null); 27912 (0,external_React_.useEffect)(() => { 27913 if (!focusable) return; 27914 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 27915 addGlobalEventListener("keydown", onGlobalKeyDown, true); 27916 }, [focusable]); 27917 if (isSafariBrowser) { 27918 (0,external_React_.useEffect)(() => { 27919 if (!focusable) return; 27920 const element = ref.current; 27921 if (!element) return; 27922 if (!isNativeCheckboxOrRadio(element)) return; 27923 const labels = getLabels(element); 27924 if (!labels) return; 27925 const onMouseUp = () => queueMicrotask(() => element.focus()); 27926 for (const label of labels) { 27927 label.addEventListener("mouseup", onMouseUp); 27928 } 27929 return () => { 27930 for (const label of labels) { 27931 label.removeEventListener("mouseup", onMouseUp); 27932 } 27933 }; 27934 }, [focusable]); 27935 } 27936 const disabled = focusable && disabledFromProps(props); 27937 const trulyDisabled = !!disabled && !accessibleWhenDisabled; 27938 const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); 27939 (0,external_React_.useEffect)(() => { 27940 if (!focusable) return; 27941 if (trulyDisabled && focusVisible) { 27942 setFocusVisible(false); 27943 } 27944 }, [focusable, trulyDisabled, focusVisible]); 27945 (0,external_React_.useEffect)(() => { 27946 if (!focusable) return; 27947 if (!focusVisible) return; 27948 const element = ref.current; 27949 if (!element) return; 27950 if (typeof IntersectionObserver === "undefined") return; 27951 const observer = new IntersectionObserver(() => { 27952 if (!isFocusable(element)) { 27953 setFocusVisible(false); 27954 } 27955 }); 27956 observer.observe(element); 27957 return () => observer.disconnect(); 27958 }, [focusable, focusVisible]); 27959 const onKeyPressCapture = useDisableEvent( 27960 props.onKeyPressCapture, 27961 disabled 27962 ); 27963 const onMouseDownCapture = useDisableEvent( 27964 props.onMouseDownCapture, 27965 disabled 27966 ); 27967 const onClickCapture = useDisableEvent(props.onClickCapture, disabled); 27968 const onMouseDownProp = props.onMouseDown; 27969 const onMouseDown = useEvent((event) => { 27970 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 27971 if (event.defaultPrevented) return; 27972 if (!focusable) return; 27973 const element = event.currentTarget; 27974 if (!isSafariBrowser) return; 27975 if (isPortalEvent(event)) return; 27976 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; 27977 let receivedFocus = false; 27978 const onFocus = () => { 27979 receivedFocus = true; 27980 }; 27981 const options = { capture: true, once: true }; 27982 element.addEventListener("focusin", onFocus, options); 27983 const focusableContainer = getClosestFocusable(element.parentElement); 27984 markSafariFocusAncestor(focusableContainer, true); 27985 queueBeforeEvent(element, "mouseup", () => { 27986 element.removeEventListener("focusin", onFocus, true); 27987 markSafariFocusAncestor(focusableContainer, false); 27988 if (receivedFocus) return; 27989 focusIfNeeded(element); 27990 }); 27991 }); 27992 const handleFocusVisible = (event, currentTarget) => { 27993 if (currentTarget) { 27994 event.currentTarget = currentTarget; 27995 } 27996 if (!focusable) return; 27997 const element = event.currentTarget; 27998 if (!element) return; 27999 if (!hasFocus(element)) return; 28000 onFocusVisible == null ? void 0 : onFocusVisible(event); 28001 if (event.defaultPrevented) return; 28002 element.dataset.focusVisible = "true"; 28003 setFocusVisible(true); 28004 }; 28005 const onKeyDownCaptureProp = props.onKeyDownCapture; 28006 const onKeyDownCapture = useEvent((event) => { 28007 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); 28008 if (event.defaultPrevented) return; 28009 if (!focusable) return; 28010 if (focusVisible) return; 28011 if (event.metaKey) return; 28012 if (event.altKey) return; 28013 if (event.ctrlKey) return; 28014 if (!isSelfTarget(event)) return; 28015 const element = event.currentTarget; 28016 const applyFocusVisible = () => handleFocusVisible(event, element); 28017 queueBeforeEvent(element, "focusout", applyFocusVisible); 28018 }); 28019 const onFocusCaptureProp = props.onFocusCapture; 28020 const onFocusCapture = useEvent((event) => { 28021 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 28022 if (event.defaultPrevented) return; 28023 if (!focusable) return; 28024 if (!isSelfTarget(event)) { 28025 setFocusVisible(false); 28026 return; 28027 } 28028 const element = event.currentTarget; 28029 const applyFocusVisible = () => handleFocusVisible(event, element); 28030 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { 28031 queueBeforeEvent(event.target, "focusout", applyFocusVisible); 28032 } else { 28033 setFocusVisible(false); 28034 } 28035 }); 28036 const onBlurProp = props.onBlur; 28037 const onBlur = useEvent((event) => { 28038 onBlurProp == null ? void 0 : onBlurProp(event); 28039 if (!focusable) return; 28040 if (!isFocusEventOutside(event)) return; 28041 setFocusVisible(false); 28042 }); 28043 const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); 28044 const autoFocusRef = useEvent((element) => { 28045 if (!focusable) return; 28046 if (!autoFocus) return; 28047 if (!element) return; 28048 if (!autoFocusOnShow) return; 28049 queueMicrotask(() => { 28050 if (hasFocus(element)) return; 28051 if (!isFocusable(element)) return; 28052 element.focus(); 28053 }); 28054 }); 28055 const tagName = useTagName(ref); 28056 const nativeTabbable = focusable && isNativeTabbable(tagName); 28057 const supportsDisabled = focusable && supportsDisabledAttribute(tagName); 28058 const styleProp = props.style; 28059 const style = (0,external_React_.useMemo)(() => { 28060 if (trulyDisabled) { 28061 return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); 28062 } 28063 return styleProp; 28064 }, [trulyDisabled, styleProp]); 28065 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28066 "data-focus-visible": focusable && focusVisible || void 0, 28067 "data-autofocus": autoFocus || void 0, 28068 "aria-disabled": disabled || void 0 28069 }, props), { 28070 ref: useMergeRefs(ref, autoFocusRef, props.ref), 28071 style, 28072 tabIndex: getTabIndex( 28073 focusable, 28074 trulyDisabled, 28075 nativeTabbable, 28076 supportsDisabled, 28077 props.tabIndex 28078 ), 28079 disabled: supportsDisabled && trulyDisabled ? true : void 0, 28080 // TODO: Test Focusable contentEditable. 28081 contentEditable: disabled ? void 0 : props.contentEditable, 28082 onKeyPressCapture, 28083 onClickCapture, 28084 onMouseDownCapture, 28085 onMouseDown, 28086 onKeyDownCapture, 28087 onFocusCapture, 28088 onBlur 28089 }); 28090 return removeUndefinedValues(props); 28091 } 28092 ); 28093 var Focusable = forwardRef2(function Focusable2(props) { 28094 const htmlProps = useFocusable(props); 28095 return createElement(OD7ALSX5_TagName, htmlProps); 28096 }); 28097 28098 28099 28100 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/2BDG6X5K.js 28101 "use client"; 28102 28103 28104 28105 28106 28107 28108 28109 // src/composite/composite.tsx 28110 28111 28112 28113 28114 28115 28116 28117 var _2BDG6X5K_TagName = "div"; 28118 function isGrid(items) { 28119 return items.some((item) => !!item.rowId); 28120 } 28121 function isPrintableKey(event) { 28122 const target = event.target; 28123 if (target && !isTextField(target)) return false; 28124 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 28125 } 28126 function isModifierKey(event) { 28127 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 28128 } 28129 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { 28130 return useEvent((event) => { 28131 var _a; 28132 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); 28133 if (event.defaultPrevented) return; 28134 if (event.isPropagationStopped()) return; 28135 if (!isSelfTarget(event)) return; 28136 if (isModifierKey(event)) return; 28137 if (isPrintableKey(event)) return; 28138 const state = store.getState(); 28139 const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; 28140 if (!activeElement) return; 28141 const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]); 28142 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; 28143 if (activeElement !== previousElement) { 28144 activeElement.focus(); 28145 } 28146 if (!fireKeyboardEvent(activeElement, event.type, eventInit)) { 28147 event.preventDefault(); 28148 } 28149 if (event.currentTarget.contains(activeElement)) { 28150 event.stopPropagation(); 28151 } 28152 }); 28153 } 28154 function findFirstEnabledItemInTheLastRow(items) { 28155 return _5VQZOHHZ_findFirstEnabledItem( 28156 flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items))) 28157 ); 28158 } 28159 function useScheduleFocus(store) { 28160 const [scheduled, setScheduled] = (0,external_React_.useState)(false); 28161 const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []); 28162 const activeItem = store.useState( 28163 (state) => getEnabledItem(store, state.activeId) 28164 ); 28165 (0,external_React_.useEffect)(() => { 28166 const activeElement = activeItem == null ? void 0 : activeItem.element; 28167 if (!scheduled) return; 28168 if (!activeElement) return; 28169 setScheduled(false); 28170 activeElement.focus({ preventScroll: true }); 28171 }, [activeItem, scheduled]); 28172 return schedule; 28173 } 28174 var useComposite = createHook( 28175 function useComposite2(_a) { 28176 var _b = _a, { 28177 store, 28178 composite = true, 28179 focusOnMove = composite, 28180 moveOnKeyPress = true 28181 } = _b, props = __objRest(_b, [ 28182 "store", 28183 "composite", 28184 "focusOnMove", 28185 "moveOnKeyPress" 28186 ]); 28187 const context = useCompositeProviderContext(); 28188 store = store || context; 28189 invariant( 28190 store, 28191 false && 0 28192 ); 28193 const ref = (0,external_React_.useRef)(null); 28194 const previousElementRef = (0,external_React_.useRef)(null); 28195 const scheduleFocus = useScheduleFocus(store); 28196 const moves = store.useState("moves"); 28197 const [, setBaseElement] = useTransactionState( 28198 composite ? store.setBaseElement : null 28199 ); 28200 (0,external_React_.useEffect)(() => { 28201 var _a2; 28202 if (!store) return; 28203 if (!moves) return; 28204 if (!composite) return; 28205 if (!focusOnMove) return; 28206 const { activeId: activeId2 } = store.getState(); 28207 const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 28208 if (!itemElement) return; 28209 focusIntoView(itemElement); 28210 }, [store, moves, composite, focusOnMove]); 28211 useSafeLayoutEffect(() => { 28212 if (!store) return; 28213 if (!moves) return; 28214 if (!composite) return; 28215 const { baseElement, activeId: activeId2 } = store.getState(); 28216 const isSelfAcive = activeId2 === null; 28217 if (!isSelfAcive) return; 28218 if (!baseElement) return; 28219 const previousElement = previousElementRef.current; 28220 previousElementRef.current = null; 28221 if (previousElement) { 28222 fireBlurEvent(previousElement, { relatedTarget: baseElement }); 28223 } 28224 if (!hasFocus(baseElement)) { 28225 baseElement.focus(); 28226 } 28227 }, [store, moves, composite]); 28228 const activeId = store.useState("activeId"); 28229 const virtualFocus = store.useState("virtualFocus"); 28230 useSafeLayoutEffect(() => { 28231 var _a2; 28232 if (!store) return; 28233 if (!composite) return; 28234 if (!virtualFocus) return; 28235 const previousElement = previousElementRef.current; 28236 previousElementRef.current = null; 28237 if (!previousElement) return; 28238 const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element; 28239 const relatedTarget = activeElement || HWOIWM4O_getActiveElement(previousElement); 28240 if (relatedTarget === previousElement) return; 28241 fireBlurEvent(previousElement, { relatedTarget }); 28242 }, [store, activeId, virtualFocus, composite]); 28243 const onKeyDownCapture = useKeyboardEventProxy( 28244 store, 28245 props.onKeyDownCapture, 28246 previousElementRef 28247 ); 28248 const onKeyUpCapture = useKeyboardEventProxy( 28249 store, 28250 props.onKeyUpCapture, 28251 previousElementRef 28252 ); 28253 const onFocusCaptureProp = props.onFocusCapture; 28254 const onFocusCapture = useEvent((event) => { 28255 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 28256 if (event.defaultPrevented) return; 28257 if (!store) return; 28258 const { virtualFocus: virtualFocus2 } = store.getState(); 28259 if (!virtualFocus2) return; 28260 const previousActiveElement = event.relatedTarget; 28261 const isSilentlyFocused = silentlyFocused(event.currentTarget); 28262 if (isSelfTarget(event) && isSilentlyFocused) { 28263 event.stopPropagation(); 28264 previousElementRef.current = previousActiveElement; 28265 } 28266 }); 28267 const onFocusProp = props.onFocus; 28268 const onFocus = useEvent((event) => { 28269 onFocusProp == null ? void 0 : onFocusProp(event); 28270 if (event.defaultPrevented) return; 28271 if (!composite) return; 28272 if (!store) return; 28273 const { relatedTarget } = event; 28274 const { virtualFocus: virtualFocus2 } = store.getState(); 28275 if (virtualFocus2) { 28276 if (isSelfTarget(event) && !isItem(store, relatedTarget)) { 28277 queueMicrotask(scheduleFocus); 28278 } 28279 } else if (isSelfTarget(event)) { 28280 store.setActiveId(null); 28281 } 28282 }); 28283 const onBlurCaptureProp = props.onBlurCapture; 28284 const onBlurCapture = useEvent((event) => { 28285 var _a2; 28286 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 28287 if (event.defaultPrevented) return; 28288 if (!store) return; 28289 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); 28290 if (!virtualFocus2) return; 28291 const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 28292 const nextActiveElement = event.relatedTarget; 28293 const nextActiveElementIsItem = isItem(store, nextActiveElement); 28294 const previousElement = previousElementRef.current; 28295 previousElementRef.current = null; 28296 if (isSelfTarget(event) && nextActiveElementIsItem) { 28297 if (nextActiveElement === activeElement) { 28298 if (previousElement && previousElement !== nextActiveElement) { 28299 fireBlurEvent(previousElement, event); 28300 } 28301 } else if (activeElement) { 28302 fireBlurEvent(activeElement, event); 28303 } else if (previousElement) { 28304 fireBlurEvent(previousElement, event); 28305 } 28306 event.stopPropagation(); 28307 } else { 28308 const targetIsItem = isItem(store, event.target); 28309 if (!targetIsItem && activeElement) { 28310 fireBlurEvent(activeElement, event); 28311 } 28312 } 28313 }); 28314 const onKeyDownProp = props.onKeyDown; 28315 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 28316 const onKeyDown = useEvent((event) => { 28317 var _a2; 28318 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 28319 if (event.defaultPrevented) return; 28320 if (!store) return; 28321 if (!isSelfTarget(event)) return; 28322 const { orientation, items, renderedItems, activeId: activeId2 } = store.getState(); 28323 const activeItem = getEnabledItem(store, activeId2); 28324 if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return; 28325 const isVertical = orientation !== "horizontal"; 28326 const isHorizontal = orientation !== "vertical"; 28327 const grid = isGrid(renderedItems); 28328 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; 28329 if (isHorizontalKey && isTextField(event.currentTarget)) return; 28330 const up = () => { 28331 if (grid) { 28332 const item = items && findFirstEnabledItemInTheLastRow(items); 28333 return item == null ? void 0 : item.id; 28334 } 28335 return store == null ? void 0 : store.last(); 28336 }; 28337 const keyMap = { 28338 ArrowUp: (grid || isVertical) && up, 28339 ArrowRight: (grid || isHorizontal) && store.first, 28340 ArrowDown: (grid || isVertical) && store.first, 28341 ArrowLeft: (grid || isHorizontal) && store.last, 28342 Home: store.first, 28343 End: store.last, 28344 PageUp: store.first, 28345 PageDown: store.last 28346 }; 28347 const action = keyMap[event.key]; 28348 if (action) { 28349 const id = action(); 28350 if (id !== void 0) { 28351 if (!moveOnKeyPressProp(event)) return; 28352 event.preventDefault(); 28353 store.move(id); 28354 } 28355 } 28356 }); 28357 props = useWrapElement( 28358 props, 28359 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }), 28360 [store] 28361 ); 28362 const activeDescendant = store.useState((state) => { 28363 var _a2; 28364 if (!store) return; 28365 if (!composite) return; 28366 if (!state.virtualFocus) return; 28367 return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id; 28368 }); 28369 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28370 "aria-activedescendant": activeDescendant 28371 }, props), { 28372 ref: useMergeRefs(ref, setBaseElement, props.ref), 28373 onKeyDownCapture, 28374 onKeyUpCapture, 28375 onFocusCapture, 28376 onFocus, 28377 onBlurCapture, 28378 onKeyDown 28379 }); 28380 const focusable = store.useState( 28381 (state) => composite && (state.virtualFocus || state.activeId === null) 28382 ); 28383 props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props)); 28384 return props; 28385 } 28386 ); 28387 var Composite = forwardRef2(function Composite2(props) { 28388 const htmlProps = useComposite(props); 28389 return createElement(_2BDG6X5K_TagName, htmlProps); 28390 }); 28391 28392 28393 28394 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox.js 28395 "use client"; 28396 28397 28398 28399 28400 28401 28402 28403 28404 28405 28406 28407 28408 28409 28410 28411 28412 // src/combobox/combobox.tsx 28413 28414 28415 28416 28417 28418 28419 var combobox_TagName = "input"; 28420 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 28421 if (!autoSelect) return false; 28422 const firstItem = items.find((item) => !item.disabled && item.value); 28423 return (firstItem == null ? void 0 : firstItem.value) === activeValue; 28424 } 28425 function hasCompletionString(value, activeValue) { 28426 if (!activeValue) return false; 28427 if (value == null) return false; 28428 value = normalizeString(value); 28429 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; 28430 } 28431 function isInputEvent(event) { 28432 return event.type === "input"; 28433 } 28434 function isAriaAutoCompleteValue(value) { 28435 return value === "inline" || value === "list" || value === "both" || value === "none"; 28436 } 28437 function getDefaultAutoSelectId(items) { 28438 const item = items.find((item2) => { 28439 var _a; 28440 if (item2.disabled) return false; 28441 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; 28442 }); 28443 return item == null ? void 0 : item.id; 28444 } 28445 var useCombobox = createHook( 28446 function useCombobox2(_a) { 28447 var _b = _a, { 28448 store, 28449 focusable = true, 28450 autoSelect: autoSelectProp = false, 28451 getAutoSelectId, 28452 setValueOnChange, 28453 showMinLength = 0, 28454 showOnChange, 28455 showOnMouseDown, 28456 showOnClick = showOnMouseDown, 28457 showOnKeyDown, 28458 showOnKeyPress = showOnKeyDown, 28459 blurActiveItemOnClick, 28460 setValueOnClick = true, 28461 moveOnKeyPress = true, 28462 autoComplete = "list" 28463 } = _b, props = __objRest(_b, [ 28464 "store", 28465 "focusable", 28466 "autoSelect", 28467 "getAutoSelectId", 28468 "setValueOnChange", 28469 "showMinLength", 28470 "showOnChange", 28471 "showOnMouseDown", 28472 "showOnClick", 28473 "showOnKeyDown", 28474 "showOnKeyPress", 28475 "blurActiveItemOnClick", 28476 "setValueOnClick", 28477 "moveOnKeyPress", 28478 "autoComplete" 28479 ]); 28480 const context = useComboboxProviderContext(); 28481 store = store || context; 28482 invariant( 28483 store, 28484 false && 0 28485 ); 28486 const ref = (0,external_React_.useRef)(null); 28487 const [valueUpdated, forceValueUpdate] = useForceUpdate(); 28488 const canAutoSelectRef = (0,external_React_.useRef)(false); 28489 const composingRef = (0,external_React_.useRef)(false); 28490 const autoSelect = store.useState( 28491 (state) => state.virtualFocus && autoSelectProp 28492 ); 28493 const inline = autoComplete === "inline" || autoComplete === "both"; 28494 const [canInline, setCanInline] = (0,external_React_.useState)(inline); 28495 useUpdateLayoutEffect(() => { 28496 if (!inline) return; 28497 setCanInline(true); 28498 }, [inline]); 28499 const storeValue = store.useState("value"); 28500 const prevSelectedValueRef = (0,external_React_.useRef)(); 28501 (0,external_React_.useEffect)(() => { 28502 return sync(store, ["selectedValue", "activeId"], (_, prev) => { 28503 prevSelectedValueRef.current = prev.selectedValue; 28504 }); 28505 }, []); 28506 const inlineActiveValue = store.useState((state) => { 28507 var _a2; 28508 if (!inline) return; 28509 if (!canInline) return; 28510 if (state.activeValue && Array.isArray(state.selectedValue)) { 28511 if (state.selectedValue.includes(state.activeValue)) return; 28512 if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return; 28513 } 28514 return state.activeValue; 28515 }); 28516 const items = store.useState("renderedItems"); 28517 const open = store.useState("open"); 28518 const contentElement = store.useState("contentElement"); 28519 const value = (0,external_React_.useMemo)(() => { 28520 if (!inline) return storeValue; 28521 if (!canInline) return storeValue; 28522 const firstItemAutoSelected = isFirstItemAutoSelected( 28523 items, 28524 inlineActiveValue, 28525 autoSelect 28526 ); 28527 if (firstItemAutoSelected) { 28528 if (hasCompletionString(storeValue, inlineActiveValue)) { 28529 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; 28530 return storeValue + slice; 28531 } 28532 return storeValue; 28533 } 28534 return inlineActiveValue || storeValue; 28535 }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]); 28536 (0,external_React_.useEffect)(() => { 28537 const element = ref.current; 28538 if (!element) return; 28539 const onCompositeItemMove = () => setCanInline(true); 28540 element.addEventListener("combobox-item-move", onCompositeItemMove); 28541 return () => { 28542 element.removeEventListener("combobox-item-move", onCompositeItemMove); 28543 }; 28544 }, []); 28545 (0,external_React_.useEffect)(() => { 28546 if (!inline) return; 28547 if (!canInline) return; 28548 if (!inlineActiveValue) return; 28549 const firstItemAutoSelected = isFirstItemAutoSelected( 28550 items, 28551 inlineActiveValue, 28552 autoSelect 28553 ); 28554 if (!firstItemAutoSelected) return; 28555 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 28556 let cleanup = PBFD2E7P_noop; 28557 queueMicrotask(() => { 28558 const element = ref.current; 28559 if (!element) return; 28560 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 28561 const nextStart = storeValue.length; 28562 const nextEnd = inlineActiveValue.length; 28563 setSelectionRange(element, nextStart, nextEnd); 28564 cleanup = () => { 28565 if (!hasFocus(element)) return; 28566 const { start, end } = getTextboxSelection(element); 28567 if (start !== nextStart) return; 28568 if (end !== nextEnd) return; 28569 setSelectionRange(element, prevStart, prevEnd); 28570 }; 28571 }); 28572 return () => cleanup(); 28573 }, [ 28574 valueUpdated, 28575 inline, 28576 canInline, 28577 inlineActiveValue, 28578 items, 28579 autoSelect, 28580 storeValue 28581 ]); 28582 const scrollingElementRef = (0,external_React_.useRef)(null); 28583 const getAutoSelectIdProp = useEvent(getAutoSelectId); 28584 const autoSelectIdRef = (0,external_React_.useRef)(null); 28585 (0,external_React_.useEffect)(() => { 28586 if (!open) return; 28587 if (!contentElement) return; 28588 const scrollingElement = getScrollingElement(contentElement); 28589 if (!scrollingElement) return; 28590 scrollingElementRef.current = scrollingElement; 28591 const onUserScroll = () => { 28592 canAutoSelectRef.current = false; 28593 }; 28594 const onScroll = () => { 28595 if (!store) return; 28596 if (!canAutoSelectRef.current) return; 28597 const { activeId } = store.getState(); 28598 if (activeId === null) return; 28599 if (activeId === autoSelectIdRef.current) return; 28600 canAutoSelectRef.current = false; 28601 }; 28602 const options = { passive: true, capture: true }; 28603 scrollingElement.addEventListener("wheel", onUserScroll, options); 28604 scrollingElement.addEventListener("touchmove", onUserScroll, options); 28605 scrollingElement.addEventListener("scroll", onScroll, options); 28606 return () => { 28607 scrollingElement.removeEventListener("wheel", onUserScroll, true); 28608 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 28609 scrollingElement.removeEventListener("scroll", onScroll, true); 28610 }; 28611 }, [open, contentElement, store]); 28612 useSafeLayoutEffect(() => { 28613 if (!storeValue) return; 28614 if (composingRef.current) return; 28615 canAutoSelectRef.current = true; 28616 }, [storeValue]); 28617 useSafeLayoutEffect(() => { 28618 if (autoSelect !== "always" && open) return; 28619 canAutoSelectRef.current = open; 28620 }, [autoSelect, open]); 28621 const resetValueOnSelect = store.useState("resetValueOnSelect"); 28622 useUpdateEffect(() => { 28623 var _a2, _b2; 28624 const canAutoSelect = canAutoSelectRef.current; 28625 if (!store) return; 28626 if (!open) return; 28627 if ((!autoSelect || !canAutoSelect) && !resetValueOnSelect) return; 28628 const { baseElement, contentElement: contentElement2, activeId } = store.getState(); 28629 if (baseElement && !hasFocus(baseElement)) return; 28630 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { 28631 const observer = new MutationObserver(forceValueUpdate); 28632 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 28633 return () => observer.disconnect(); 28634 } 28635 if (autoSelect && canAutoSelect) { 28636 const userAutoSelectId = getAutoSelectIdProp(items); 28637 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first(); 28638 autoSelectIdRef.current = autoSelectId; 28639 store.move(autoSelectId != null ? autoSelectId : null); 28640 } else { 28641 const element = (_b2 = store.item(activeId)) == null ? void 0 : _b2.element; 28642 if (element && "scrollIntoView" in element) { 28643 element.scrollIntoView({ block: "nearest", inline: "nearest" }); 28644 } 28645 } 28646 return; 28647 }, [ 28648 store, 28649 open, 28650 valueUpdated, 28651 storeValue, 28652 autoSelect, 28653 resetValueOnSelect, 28654 getAutoSelectIdProp, 28655 items 28656 ]); 28657 (0,external_React_.useEffect)(() => { 28658 if (!inline) return; 28659 const combobox = ref.current; 28660 if (!combobox) return; 28661 const elements = [combobox, contentElement].filter( 28662 (value2) => !!value2 28663 ); 28664 const onBlur2 = (event) => { 28665 if (elements.every((el) => isFocusEventOutside(event, el))) { 28666 store == null ? void 0 : store.setValue(value); 28667 } 28668 }; 28669 for (const element of elements) { 28670 element.addEventListener("focusout", onBlur2); 28671 } 28672 return () => { 28673 for (const element of elements) { 28674 element.removeEventListener("focusout", onBlur2); 28675 } 28676 }; 28677 }, [inline, contentElement, store, value]); 28678 const canShow = (event) => { 28679 const currentTarget = event.currentTarget; 28680 return currentTarget.value.length >= showMinLength; 28681 }; 28682 const onChangeProp = props.onChange; 28683 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); 28684 const setValueOnChangeProp = useBooleanEvent( 28685 // If the combobox is combined with tags, the value will be set by the tag 28686 // input component. 28687 setValueOnChange != null ? setValueOnChange : !store.tag 28688 ); 28689 const onChange = useEvent((event) => { 28690 onChangeProp == null ? void 0 : onChangeProp(event); 28691 if (event.defaultPrevented) return; 28692 if (!store) return; 28693 const currentTarget = event.currentTarget; 28694 const { value: value2, selectionStart, selectionEnd } = currentTarget; 28695 const nativeEvent = event.nativeEvent; 28696 canAutoSelectRef.current = true; 28697 if (isInputEvent(nativeEvent)) { 28698 if (nativeEvent.isComposing) { 28699 canAutoSelectRef.current = false; 28700 composingRef.current = true; 28701 } 28702 if (inline) { 28703 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 28704 const caretAtEnd = selectionStart === value2.length; 28705 setCanInline(textInserted && caretAtEnd); 28706 } 28707 } 28708 if (setValueOnChangeProp(event)) { 28709 const isSameValue = value2 === store.getState().value; 28710 store.setValue(value2); 28711 queueMicrotask(() => { 28712 setSelectionRange(currentTarget, selectionStart, selectionEnd); 28713 }); 28714 if (inline && autoSelect && isSameValue) { 28715 forceValueUpdate(); 28716 } 28717 } 28718 if (showOnChangeProp(event)) { 28719 store.show(); 28720 } 28721 if (!autoSelect || !canAutoSelectRef.current) { 28722 store.setActiveId(null); 28723 } 28724 }); 28725 const onCompositionEndProp = props.onCompositionEnd; 28726 const onCompositionEnd = useEvent((event) => { 28727 canAutoSelectRef.current = true; 28728 composingRef.current = false; 28729 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); 28730 if (event.defaultPrevented) return; 28731 if (!autoSelect) return; 28732 forceValueUpdate(); 28733 }); 28734 const onMouseDownProp = props.onMouseDown; 28735 const blurActiveItemOnClickProp = useBooleanEvent( 28736 blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement) 28737 ); 28738 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 28739 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); 28740 const onMouseDown = useEvent((event) => { 28741 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 28742 if (event.defaultPrevented) return; 28743 if (event.button) return; 28744 if (event.ctrlKey) return; 28745 if (!store) return; 28746 if (blurActiveItemOnClickProp(event)) { 28747 store.setActiveId(null); 28748 } 28749 if (setValueOnClickProp(event)) { 28750 store.setValue(value); 28751 } 28752 if (showOnClickProp(event)) { 28753 queueBeforeEvent(event.currentTarget, "mouseup", store.show); 28754 } 28755 }); 28756 const onKeyDownProp = props.onKeyDown; 28757 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); 28758 const onKeyDown = useEvent((event) => { 28759 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 28760 if (!event.repeat) { 28761 canAutoSelectRef.current = false; 28762 } 28763 if (event.defaultPrevented) return; 28764 if (event.ctrlKey) return; 28765 if (event.altKey) return; 28766 if (event.shiftKey) return; 28767 if (event.metaKey) return; 28768 if (!store) return; 28769 const { open: open2 } = store.getState(); 28770 if (open2) return; 28771 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 28772 if (showOnKeyPressProp(event)) { 28773 event.preventDefault(); 28774 store.show(); 28775 } 28776 } 28777 }); 28778 const onBlurProp = props.onBlur; 28779 const onBlur = useEvent((event) => { 28780 canAutoSelectRef.current = false; 28781 onBlurProp == null ? void 0 : onBlurProp(event); 28782 if (event.defaultPrevented) return; 28783 }); 28784 const id = useId(props.id); 28785 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 28786 const isActiveItem = store.useState((state) => state.activeId === null); 28787 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28788 id, 28789 role: "combobox", 28790 "aria-autocomplete": ariaAutoComplete, 28791 "aria-haspopup": getPopupRole(contentElement, "listbox"), 28792 "aria-expanded": open, 28793 "aria-controls": contentElement == null ? void 0 : contentElement.id, 28794 "data-active-item": isActiveItem || void 0, 28795 value 28796 }, props), { 28797 ref: useMergeRefs(ref, props.ref), 28798 onChange, 28799 onCompositionEnd, 28800 onMouseDown, 28801 onKeyDown, 28802 onBlur 28803 }); 28804 props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28805 store, 28806 focusable 28807 }, props), { 28808 // Enable inline autocomplete when the user moves from the combobox input 28809 // to an item. 28810 moveOnKeyPress: (event) => { 28811 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 28812 if (inline) setCanInline(true); 28813 return true; 28814 } 28815 })); 28816 props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props)); 28817 return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props); 28818 } 28819 ); 28820 var Combobox = forwardRef2(function Combobox2(props) { 28821 const htmlProps = useCombobox(props); 28822 return createElement(combobox_TagName, htmlProps); 28823 }); 28824 28825 28826 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/BSEL4YAF.js 28827 "use client"; 28828 28829 28830 28831 28832 28833 28834 28835 // src/disclosure/disclosure-content.tsx 28836 28837 28838 28839 28840 var BSEL4YAF_TagName = "div"; 28841 function afterTimeout(timeoutMs, cb) { 28842 const timeoutId = setTimeout(cb, timeoutMs); 28843 return () => clearTimeout(timeoutId); 28844 } 28845 function BSEL4YAF_afterPaint(cb) { 28846 let raf = requestAnimationFrame(() => { 28847 raf = requestAnimationFrame(cb); 28848 }); 28849 return () => cancelAnimationFrame(raf); 28850 } 28851 function parseCSSTime(...times) { 28852 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { 28853 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; 28854 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; 28855 if (currentTime > longestTime) return currentTime; 28856 return longestTime; 28857 }, 0); 28858 } 28859 function isHidden(mounted, hidden, alwaysVisible) { 28860 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 28861 } 28862 var useDisclosureContent = createHook(function useDisclosureContent2(_a) { 28863 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 28864 const context = useDisclosureProviderContext(); 28865 store = store || context; 28866 invariant( 28867 store, 28868 false && 0 28869 ); 28870 const ref = (0,external_React_.useRef)(null); 28871 const id = useId(props.id); 28872 const [transition, setTransition] = (0,external_React_.useState)(null); 28873 const open = store.useState("open"); 28874 const mounted = store.useState("mounted"); 28875 const animated = store.useState("animated"); 28876 const contentElement = store.useState("contentElement"); 28877 const otherElement = useStoreState(store.disclosure, "contentElement"); 28878 useSafeLayoutEffect(() => { 28879 if (!ref.current) return; 28880 store == null ? void 0 : store.setContentElement(ref.current); 28881 }, [store]); 28882 useSafeLayoutEffect(() => { 28883 let previousAnimated; 28884 store == null ? void 0 : store.setState("animated", (animated2) => { 28885 previousAnimated = animated2; 28886 return true; 28887 }); 28888 return () => { 28889 if (previousAnimated === void 0) return; 28890 store == null ? void 0 : store.setState("animated", previousAnimated); 28891 }; 28892 }, [store]); 28893 useSafeLayoutEffect(() => { 28894 if (!animated) return; 28895 if (!(contentElement == null ? void 0 : contentElement.isConnected)) { 28896 setTransition(null); 28897 return; 28898 } 28899 return BSEL4YAF_afterPaint(() => { 28900 setTransition(open ? "enter" : mounted ? "leave" : null); 28901 }); 28902 }, [animated, contentElement, open, mounted]); 28903 useSafeLayoutEffect(() => { 28904 if (!store) return; 28905 if (!animated) return; 28906 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); 28907 const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation); 28908 if (!transition || !contentElement) { 28909 stopAnimation(); 28910 return; 28911 } 28912 if (transition === "leave" && open) return; 28913 if (transition === "enter" && !open) return; 28914 if (typeof animated === "number") { 28915 const timeout2 = animated; 28916 return afterTimeout(timeout2, stopAnimationSync); 28917 } 28918 const { 28919 transitionDuration, 28920 animationDuration, 28921 transitionDelay, 28922 animationDelay 28923 } = getComputedStyle(contentElement); 28924 const { 28925 transitionDuration: transitionDuration2 = "0", 28926 animationDuration: animationDuration2 = "0", 28927 transitionDelay: transitionDelay2 = "0", 28928 animationDelay: animationDelay2 = "0" 28929 } = otherElement ? getComputedStyle(otherElement) : {}; 28930 const delay = parseCSSTime( 28931 transitionDelay, 28932 animationDelay, 28933 transitionDelay2, 28934 animationDelay2 28935 ); 28936 const duration = parseCSSTime( 28937 transitionDuration, 28938 animationDuration, 28939 transitionDuration2, 28940 animationDuration2 28941 ); 28942 const timeout = delay + duration; 28943 if (!timeout) { 28944 if (transition === "enter") { 28945 store.setState("animated", false); 28946 } 28947 stopAnimation(); 28948 return; 28949 } 28950 const frameRate = 1e3 / 60; 28951 const maxTimeout = Math.max(timeout - frameRate, 0); 28952 return afterTimeout(maxTimeout, stopAnimationSync); 28953 }, [store, animated, contentElement, otherElement, open, transition]); 28954 props = useWrapElement( 28955 props, 28956 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }), 28957 [store] 28958 ); 28959 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 28960 const styleProp = props.style; 28961 const style = (0,external_React_.useMemo)(() => { 28962 if (hidden) return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" }); 28963 return styleProp; 28964 }, [hidden, styleProp]); 28965 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28966 id, 28967 "data-open": open || void 0, 28968 "data-enter": transition === "enter" || void 0, 28969 "data-leave": transition === "leave" || void 0, 28970 hidden 28971 }, props), { 28972 ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref), 28973 style 28974 }); 28975 return removeUndefinedValues(props); 28976 }); 28977 var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) { 28978 const htmlProps = useDisclosureContent(props); 28979 return createElement(BSEL4YAF_TagName, htmlProps); 28980 }); 28981 var DisclosureContent = forwardRef2(function DisclosureContent2(_a) { 28982 var _b = _a, { 28983 unmountOnHide 28984 } = _b, props = __objRest(_b, [ 28985 "unmountOnHide" 28986 ]); 28987 const context = useDisclosureProviderContext(); 28988 const store = props.store || context; 28989 const mounted = useStoreState( 28990 store, 28991 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) 28992 ); 28993 if (mounted === false) return null; 28994 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props)); 28995 }); 28996 28997 28998 28999 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/6ZVAPMHT.js 29000 "use client"; 29001 29002 29003 29004 29005 29006 29007 // src/combobox/combobox-list.tsx 29008 29009 29010 29011 var _6ZVAPMHT_TagName = "div"; 29012 var useComboboxList = createHook( 29013 function useComboboxList2(_a) { 29014 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 29015 const scopedContext = useComboboxScopedContext(true); 29016 const context = useComboboxContext(); 29017 store = store || context; 29018 const scopedContextSameStore = !!store && store === scopedContext; 29019 invariant( 29020 store, 29021 false && 0 29022 ); 29023 const ref = (0,external_React_.useRef)(null); 29024 const id = useId(props.id); 29025 const mounted = store.useState("mounted"); 29026 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 29027 const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; 29028 const multiSelectable = store.useState( 29029 (state) => Array.isArray(state.selectedValue) 29030 ); 29031 const role = useAttribute(ref, "role", props.role); 29032 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; 29033 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; 29034 const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false); 29035 const contentElement = store.useState("contentElement"); 29036 useSafeLayoutEffect(() => { 29037 if (!mounted) return; 29038 const element = ref.current; 29039 if (!element) return; 29040 if (contentElement !== element) return; 29041 const callback = () => { 29042 setHasListboxInside(!!element.querySelector("[role='listbox']")); 29043 }; 29044 const observer = new MutationObserver(callback); 29045 observer.observe(element, { 29046 subtree: true, 29047 childList: true, 29048 attributeFilter: ["role"] 29049 }); 29050 callback(); 29051 return () => observer.disconnect(); 29052 }, [mounted, contentElement]); 29053 if (!hasListboxInside) { 29054 props = _3YLGPPWQ_spreadValues({ 29055 role: "listbox", 29056 "aria-multiselectable": ariaMultiSelectable 29057 }, props); 29058 } 29059 props = useWrapElement( 29060 props, 29061 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), 29062 [store, role] 29063 ); 29064 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; 29065 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29066 id, 29067 hidden 29068 }, props), { 29069 ref: useMergeRefs(setContentElement, ref, props.ref), 29070 style 29071 }); 29072 return removeUndefinedValues(props); 29073 } 29074 ); 29075 var ComboboxList = forwardRef2(function ComboboxList2(props) { 29076 const htmlProps = useComboboxList(props); 29077 return createElement(_6ZVAPMHT_TagName, htmlProps); 29078 }); 29079 29080 29081 29082 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OBZMLI6J.js 29083 "use client"; 29084 29085 29086 29087 29088 29089 // src/composite/composite-hover.tsx 29090 29091 29092 29093 29094 var OBZMLI6J_TagName = "div"; 29095 function getMouseDestination(event) { 29096 const relatedTarget = event.relatedTarget; 29097 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { 29098 return relatedTarget; 29099 } 29100 return null; 29101 } 29102 function hoveringInside(event) { 29103 const nextElement = getMouseDestination(event); 29104 if (!nextElement) return false; 29105 return contains(event.currentTarget, nextElement); 29106 } 29107 var symbol = Symbol("composite-hover"); 29108 function movingToAnotherItem(event) { 29109 let dest = getMouseDestination(event); 29110 if (!dest) return false; 29111 do { 29112 if (PBFD2E7P_hasOwnProperty(dest, symbol) && dest[symbol]) return true; 29113 dest = dest.parentElement; 29114 } while (dest); 29115 return false; 29116 } 29117 var useCompositeHover = createHook( 29118 function useCompositeHover2(_a) { 29119 var _b = _a, { 29120 store, 29121 focusOnHover = true, 29122 blurOnHoverEnd = !!focusOnHover 29123 } = _b, props = __objRest(_b, [ 29124 "store", 29125 "focusOnHover", 29126 "blurOnHoverEnd" 29127 ]); 29128 const context = useCompositeContext(); 29129 store = store || context; 29130 invariant( 29131 store, 29132 false && 0 29133 ); 29134 const isMouseMoving = useIsMouseMoving(); 29135 const onMouseMoveProp = props.onMouseMove; 29136 const focusOnHoverProp = useBooleanEvent(focusOnHover); 29137 const onMouseMove = useEvent((event) => { 29138 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); 29139 if (event.defaultPrevented) return; 29140 if (!isMouseMoving()) return; 29141 if (!focusOnHoverProp(event)) return; 29142 if (!hasFocusWithin(event.currentTarget)) { 29143 const baseElement = store == null ? void 0 : store.getState().baseElement; 29144 if (baseElement && !hasFocus(baseElement)) { 29145 baseElement.focus(); 29146 } 29147 } 29148 store == null ? void 0 : store.setActiveId(event.currentTarget.id); 29149 }); 29150 const onMouseLeaveProp = props.onMouseLeave; 29151 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 29152 const onMouseLeave = useEvent((event) => { 29153 var _a2; 29154 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); 29155 if (event.defaultPrevented) return; 29156 if (!isMouseMoving()) return; 29157 if (hoveringInside(event)) return; 29158 if (movingToAnotherItem(event)) return; 29159 if (!focusOnHoverProp(event)) return; 29160 if (!blurOnHoverEndProp(event)) return; 29161 store == null ? void 0 : store.setActiveId(null); 29162 (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus(); 29163 }); 29164 const ref = (0,external_React_.useCallback)((element) => { 29165 if (!element) return; 29166 element[symbol] = true; 29167 }, []); 29168 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 29169 ref: useMergeRefs(ref, props.ref), 29170 onMouseMove, 29171 onMouseLeave 29172 }); 29173 return removeUndefinedValues(props); 29174 } 29175 ); 29176 var CompositeHover = memo2( 29177 forwardRef2(function CompositeHover2(props) { 29178 const htmlProps = useCompositeHover(props); 29179 return createElement(OBZMLI6J_TagName, htmlProps); 29180 }) 29181 ); 29182 29183 29184 29185 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/PLQDTVXM.js 29186 "use client"; 29187 29188 29189 29190 29191 29192 // src/collection/collection-item.tsx 29193 29194 29195 var PLQDTVXM_TagName = "div"; 29196 var useCollectionItem = createHook( 29197 function useCollectionItem2(_a) { 29198 var _b = _a, { 29199 store, 29200 shouldRegisterItem = true, 29201 getItem = identity, 29202 element: element 29203 } = _b, props = __objRest(_b, [ 29204 "store", 29205 "shouldRegisterItem", 29206 "getItem", 29207 // @ts-expect-error This prop may come from a collection renderer. 29208 "element" 29209 ]); 29210 const context = useCollectionContext(); 29211 store = store || context; 29212 const id = useId(props.id); 29213 const ref = (0,external_React_.useRef)(element); 29214 (0,external_React_.useEffect)(() => { 29215 const element2 = ref.current; 29216 if (!id) return; 29217 if (!element2) return; 29218 if (!shouldRegisterItem) return; 29219 const item = getItem({ id, element: element2 }); 29220 return store == null ? void 0 : store.renderItem(item); 29221 }, [id, shouldRegisterItem, getItem, store]); 29222 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 29223 ref: useMergeRefs(ref, props.ref) 29224 }); 29225 return removeUndefinedValues(props); 29226 } 29227 ); 29228 var CollectionItem = forwardRef2(function CollectionItem2(props) { 29229 const htmlProps = useCollectionItem(props); 29230 return createElement(PLQDTVXM_TagName, htmlProps); 29231 }); 29232 29233 29234 29235 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HGP5L2ST.js 29236 "use client"; 29237 29238 29239 29240 29241 29242 // src/command/command.tsx 29243 29244 29245 29246 29247 29248 var HGP5L2ST_TagName = "button"; 29249 function isNativeClick(event) { 29250 if (!event.isTrusted) return false; 29251 const element = event.currentTarget; 29252 if (event.key === "Enter") { 29253 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 29254 } 29255 if (event.key === " ") { 29256 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 29257 } 29258 return false; 29259 } 29260 var HGP5L2ST_symbol = Symbol("command"); 29261 var useCommand = createHook( 29262 function useCommand2(_a) { 29263 var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]); 29264 const ref = (0,external_React_.useRef)(null); 29265 const tagName = useTagName(ref); 29266 const type = props.type; 29267 const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)( 29268 () => !!tagName && isButton({ tagName, type }) 29269 ); 29270 (0,external_React_.useEffect)(() => { 29271 if (!ref.current) return; 29272 setIsNativeButton(isButton(ref.current)); 29273 }, []); 29274 const [active, setActive] = (0,external_React_.useState)(false); 29275 const activeRef = (0,external_React_.useRef)(false); 29276 const disabled = disabledFromProps(props); 29277 const [isDuplicate, metadataProps] = useMetadataProps(props, HGP5L2ST_symbol, true); 29278 const onKeyDownProp = props.onKeyDown; 29279 const onKeyDown = useEvent((event) => { 29280 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 29281 const element = event.currentTarget; 29282 if (event.defaultPrevented) return; 29283 if (isDuplicate) return; 29284 if (disabled) return; 29285 if (!isSelfTarget(event)) return; 29286 if (isTextField(element)) return; 29287 if (element.isContentEditable) return; 29288 const isEnter = clickOnEnter && event.key === "Enter"; 29289 const isSpace = clickOnSpace && event.key === " "; 29290 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 29291 const shouldPreventSpace = event.key === " " && !clickOnSpace; 29292 if (shouldPreventEnter || shouldPreventSpace) { 29293 event.preventDefault(); 29294 return; 29295 } 29296 if (isEnter || isSpace) { 29297 const nativeClick = isNativeClick(event); 29298 if (isEnter) { 29299 if (!nativeClick) { 29300 event.preventDefault(); 29301 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 29302 const click = () => fireClickEvent(element, eventInit); 29303 if (isFirefox()) { 29304 queueBeforeEvent(element, "keyup", click); 29305 } else { 29306 queueMicrotask(click); 29307 } 29308 } 29309 } else if (isSpace) { 29310 activeRef.current = true; 29311 if (!nativeClick) { 29312 event.preventDefault(); 29313 setActive(true); 29314 } 29315 } 29316 } 29317 }); 29318 const onKeyUpProp = props.onKeyUp; 29319 const onKeyUp = useEvent((event) => { 29320 onKeyUpProp == null ? void 0 : onKeyUpProp(event); 29321 if (event.defaultPrevented) return; 29322 if (isDuplicate) return; 29323 if (disabled) return; 29324 if (event.metaKey) return; 29325 const isSpace = clickOnSpace && event.key === " "; 29326 if (activeRef.current && isSpace) { 29327 activeRef.current = false; 29328 if (!isNativeClick(event)) { 29329 event.preventDefault(); 29330 setActive(false); 29331 const element = event.currentTarget; 29332 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 29333 queueMicrotask(() => fireClickEvent(element, eventInit)); 29334 } 29335 } 29336 }); 29337 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ 29338 "data-active": active || void 0, 29339 type: isNativeButton ? "button" : void 0 29340 }, metadataProps), props), { 29341 ref: useMergeRefs(ref, props.ref), 29342 onKeyDown, 29343 onKeyUp 29344 }); 29345 props = useFocusable(props); 29346 return props; 29347 } 29348 ); 29349 var Command = forwardRef2(function Command2(props) { 29350 const htmlProps = useCommand(props); 29351 return createElement(HGP5L2ST_TagName, htmlProps); 29352 }); 29353 29354 29355 29356 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7QKWW6TW.js 29357 "use client"; 29358 29359 29360 29361 29362 29363 29364 29365 29366 29367 // src/composite/composite-item.tsx 29368 29369 29370 29371 29372 29373 29374 var _7QKWW6TW_TagName = "button"; 29375 function isEditableElement(element) { 29376 if (isTextbox(element)) return true; 29377 return element.tagName === "INPUT" && !isButton(element); 29378 } 29379 function getNextPageOffset(scrollingElement, pageUp = false) { 29380 const height = scrollingElement.clientHeight; 29381 const { top } = scrollingElement.getBoundingClientRect(); 29382 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 29383 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 29384 if (scrollingElement.tagName === "HTML") { 29385 return pageOffset + scrollingElement.scrollTop; 29386 } 29387 return pageOffset; 29388 } 29389 function getItemOffset(itemElement, pageUp = false) { 29390 const { top } = itemElement.getBoundingClientRect(); 29391 if (pageUp) { 29392 return top + itemElement.clientHeight; 29393 } 29394 return top; 29395 } 29396 function findNextPageItemId(element, store, next, pageUp = false) { 29397 var _a; 29398 if (!store) return; 29399 if (!next) return; 29400 const { renderedItems } = store.getState(); 29401 const scrollingElement = getScrollingElement(element); 29402 if (!scrollingElement) return; 29403 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 29404 let id; 29405 let prevDifference; 29406 for (let i = 0; i < renderedItems.length; i += 1) { 29407 const previousId = id; 29408 id = next(i); 29409 if (!id) break; 29410 if (id === previousId) continue; 29411 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; 29412 if (!itemElement) continue; 29413 const itemOffset = getItemOffset(itemElement, pageUp); 29414 const difference = itemOffset - nextPageOffset; 29415 const absDifference = Math.abs(difference); 29416 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 29417 if (prevDifference !== void 0 && prevDifference < absDifference) { 29418 id = previousId; 29419 } 29420 break; 29421 } 29422 prevDifference = absDifference; 29423 } 29424 return id; 29425 } 29426 function targetIsAnotherItem(event, store) { 29427 if (isSelfTarget(event)) return false; 29428 return isItem(store, event.target); 29429 } 29430 var useCompositeItem = createHook( 29431 function useCompositeItem2(_a) { 29432 var _b = _a, { 29433 store, 29434 rowId: rowIdProp, 29435 preventScrollOnKeyDown = false, 29436 moveOnKeyPress = true, 29437 tabbable = false, 29438 getItem: getItemProp, 29439 "aria-setsize": ariaSetSizeProp, 29440 "aria-posinset": ariaPosInSetProp 29441 } = _b, props = __objRest(_b, [ 29442 "store", 29443 "rowId", 29444 "preventScrollOnKeyDown", 29445 "moveOnKeyPress", 29446 "tabbable", 29447 "getItem", 29448 "aria-setsize", 29449 "aria-posinset" 29450 ]); 29451 const context = useCompositeContext(); 29452 store = store || context; 29453 const id = useId(props.id); 29454 const ref = (0,external_React_.useRef)(null); 29455 const row = (0,external_React_.useContext)(CompositeRowContext); 29456 const rowId = useStoreState(store, (state) => { 29457 if (rowIdProp) return rowIdProp; 29458 if (!state) return; 29459 if (!(row == null ? void 0 : row.baseElement)) return; 29460 if (row.baseElement !== state.baseElement) return; 29461 return row.id; 29462 }); 29463 const disabled = disabledFromProps(props); 29464 const trulyDisabled = disabled && !props.accessibleWhenDisabled; 29465 const getItem = (0,external_React_.useCallback)( 29466 (item) => { 29467 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { 29468 id: id || item.id, 29469 rowId, 29470 disabled: !!trulyDisabled 29471 }); 29472 if (getItemProp) { 29473 return getItemProp(nextItem); 29474 } 29475 return nextItem; 29476 }, 29477 [id, rowId, trulyDisabled, getItemProp] 29478 ); 29479 const onFocusProp = props.onFocus; 29480 const hasFocusedComposite = (0,external_React_.useRef)(false); 29481 const onFocus = useEvent((event) => { 29482 onFocusProp == null ? void 0 : onFocusProp(event); 29483 if (event.defaultPrevented) return; 29484 if (isPortalEvent(event)) return; 29485 if (!id) return; 29486 if (!store) return; 29487 if (targetIsAnotherItem(event, store)) return; 29488 const { virtualFocus, baseElement: baseElement2 } = store.getState(); 29489 store.setActiveId(id); 29490 if (isTextbox(event.currentTarget)) { 29491 selectTextField(event.currentTarget); 29492 } 29493 if (!virtualFocus) return; 29494 if (!isSelfTarget(event)) return; 29495 if (isEditableElement(event.currentTarget)) return; 29496 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; 29497 if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) { 29498 event.currentTarget.scrollIntoView({ 29499 block: "nearest", 29500 inline: "nearest" 29501 }); 29502 } 29503 hasFocusedComposite.current = true; 29504 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); 29505 if (fromComposite) { 29506 focusSilently(baseElement2); 29507 } else { 29508 baseElement2.focus(); 29509 } 29510 }); 29511 const onBlurCaptureProp = props.onBlurCapture; 29512 const onBlurCapture = useEvent((event) => { 29513 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 29514 if (event.defaultPrevented) return; 29515 const state = store == null ? void 0 : store.getState(); 29516 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { 29517 hasFocusedComposite.current = false; 29518 event.preventDefault(); 29519 event.stopPropagation(); 29520 } 29521 }); 29522 const onKeyDownProp = props.onKeyDown; 29523 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 29524 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 29525 const onKeyDown = useEvent((event) => { 29526 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 29527 if (event.defaultPrevented) return; 29528 if (!isSelfTarget(event)) return; 29529 if (!store) return; 29530 const { currentTarget } = event; 29531 const state = store.getState(); 29532 const item = store.item(id); 29533 const isGrid = !!(item == null ? void 0 : item.rowId); 29534 const isVertical = state.orientation !== "horizontal"; 29535 const isHorizontal = state.orientation !== "vertical"; 29536 const canHomeEnd = () => { 29537 if (isGrid) return true; 29538 if (isHorizontal) return true; 29539 if (!state.baseElement) return true; 29540 if (!isTextField(state.baseElement)) return true; 29541 return false; 29542 }; 29543 const keyMap = { 29544 ArrowUp: (isGrid || isVertical) && store.up, 29545 ArrowRight: (isGrid || isHorizontal) && store.next, 29546 ArrowDown: (isGrid || isVertical) && store.down, 29547 ArrowLeft: (isGrid || isHorizontal) && store.previous, 29548 Home: () => { 29549 if (!canHomeEnd()) return; 29550 if (!isGrid || event.ctrlKey) { 29551 return store == null ? void 0 : store.first(); 29552 } 29553 return store == null ? void 0 : store.previous(-1); 29554 }, 29555 End: () => { 29556 if (!canHomeEnd()) return; 29557 if (!isGrid || event.ctrlKey) { 29558 return store == null ? void 0 : store.last(); 29559 } 29560 return store == null ? void 0 : store.next(-1); 29561 }, 29562 PageUp: () => { 29563 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); 29564 }, 29565 PageDown: () => { 29566 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); 29567 } 29568 }; 29569 const action = keyMap[event.key]; 29570 if (action) { 29571 if (isTextbox(currentTarget)) { 29572 const selection = getTextboxSelection(currentTarget); 29573 const isLeft = isHorizontal && event.key === "ArrowLeft"; 29574 const isRight = isHorizontal && event.key === "ArrowRight"; 29575 const isUp = isVertical && event.key === "ArrowUp"; 29576 const isDown = isVertical && event.key === "ArrowDown"; 29577 if (isRight || isDown) { 29578 const { length: valueLength } = getTextboxValue(currentTarget); 29579 if (selection.end !== valueLength) return; 29580 } else if ((isLeft || isUp) && selection.start !== 0) return; 29581 } 29582 const nextId = action(); 29583 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { 29584 if (!moveOnKeyPressProp(event)) return; 29585 event.preventDefault(); 29586 store.move(nextId); 29587 } 29588 } 29589 }); 29590 const baseElement = useStoreState( 29591 store, 29592 (state) => (state == null ? void 0 : state.baseElement) || void 0 29593 ); 29594 const providerValue = (0,external_React_.useMemo)( 29595 () => ({ id, baseElement }), 29596 [id, baseElement] 29597 ); 29598 props = useWrapElement( 29599 props, 29600 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), 29601 [providerValue] 29602 ); 29603 const isActiveItem = useStoreState( 29604 store, 29605 (state) => !!state && state.activeId === id 29606 ); 29607 const ariaSetSize = useStoreState(store, (state) => { 29608 if (ariaSetSizeProp != null) return ariaSetSizeProp; 29609 if (!state) return; 29610 if (!(row == null ? void 0 : row.ariaSetSize)) return; 29611 if (row.baseElement !== state.baseElement) return; 29612 return row.ariaSetSize; 29613 }); 29614 const ariaPosInSet = useStoreState(store, (state) => { 29615 if (ariaPosInSetProp != null) return ariaPosInSetProp; 29616 if (!state) return; 29617 if (!(row == null ? void 0 : row.ariaPosInSet)) return; 29618 if (row.baseElement !== state.baseElement) return; 29619 const itemsInRow = state.renderedItems.filter( 29620 (item) => item.rowId === rowId 29621 ); 29622 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 29623 }); 29624 const isTabbable = useStoreState(store, (state) => { 29625 if (!(state == null ? void 0 : state.renderedItems.length)) return true; 29626 if (state.virtualFocus) return false; 29627 if (tabbable) return true; 29628 return state.activeId === id; 29629 }); 29630 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29631 id, 29632 "data-active-item": isActiveItem || void 0 29633 }, props), { 29634 ref: useMergeRefs(ref, props.ref), 29635 tabIndex: isTabbable ? props.tabIndex : -1, 29636 onFocus, 29637 onBlurCapture, 29638 onKeyDown 29639 }); 29640 props = useCommand(props); 29641 props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29642 store 29643 }, props), { 29644 getItem, 29645 shouldRegisterItem: id ? props.shouldRegisterItem : false 29646 })); 29647 return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 29648 "aria-setsize": ariaSetSize, 29649 "aria-posinset": ariaPosInSet 29650 })); 29651 } 29652 ); 29653 var CompositeItem = memo2( 29654 forwardRef2(function CompositeItem2(props) { 29655 const htmlProps = useCompositeItem(props); 29656 return createElement(_7QKWW6TW_TagName, htmlProps); 29657 }) 29658 ); 29659 29660 29661 29662 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-item.js 29663 "use client"; 29664 29665 29666 29667 29668 29669 29670 29671 29672 29673 29674 29675 29676 29677 29678 29679 29680 29681 29682 29683 // src/combobox/combobox-item.tsx 29684 29685 29686 29687 29688 29689 29690 var combobox_item_TagName = "div"; 29691 function isSelected(storeValue, itemValue) { 29692 if (itemValue == null) return; 29693 if (storeValue == null) return false; 29694 if (Array.isArray(storeValue)) { 29695 return storeValue.includes(itemValue); 29696 } 29697 return storeValue === itemValue; 29698 } 29699 function getItemRole(popupRole) { 29700 var _a; 29701 const itemRoleByPopupRole = { 29702 menu: "menuitem", 29703 listbox: "option", 29704 tree: "treeitem" 29705 }; 29706 const key = popupRole; 29707 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option"; 29708 } 29709 var useComboboxItem = createHook( 29710 function useComboboxItem2(_a) { 29711 var _b = _a, { 29712 store, 29713 value, 29714 hideOnClick, 29715 setValueOnClick, 29716 selectValueOnClick = true, 29717 resetValueOnSelect, 29718 focusOnHover = false, 29719 moveOnKeyPress = true, 29720 getItem: getItemProp 29721 } = _b, props = __objRest(_b, [ 29722 "store", 29723 "value", 29724 "hideOnClick", 29725 "setValueOnClick", 29726 "selectValueOnClick", 29727 "resetValueOnSelect", 29728 "focusOnHover", 29729 "moveOnKeyPress", 29730 "getItem" 29731 ]); 29732 var _a2; 29733 const context = useComboboxScopedContext(); 29734 store = store || context; 29735 invariant( 29736 store, 29737 false && 0 29738 ); 29739 const getItem = (0,external_React_.useCallback)( 29740 (item) => { 29741 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value }); 29742 if (getItemProp) { 29743 return getItemProp(nextItem); 29744 } 29745 return nextItem; 29746 }, 29747 [value, getItemProp] 29748 ); 29749 const multiSelectable = store.useState( 29750 (state) => Array.isArray(state.selectedValue) 29751 ); 29752 const selected = store.useState( 29753 (state) => isSelected(state.selectedValue, value) 29754 ); 29755 const resetValueOnSelectState = store.useState("resetValueOnSelect"); 29756 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; 29757 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; 29758 const onClickProp = props.onClick; 29759 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 29760 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 29761 const resetValueOnSelectProp = useBooleanEvent( 29762 (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable 29763 ); 29764 const hideOnClickProp = useBooleanEvent(hideOnClick); 29765 const onClick = useEvent((event) => { 29766 onClickProp == null ? void 0 : onClickProp(event); 29767 if (event.defaultPrevented) return; 29768 if (isDownloading(event)) return; 29769 if (isOpeningInNewTab(event)) return; 29770 if (value != null) { 29771 if (selectValueOnClickProp(event)) { 29772 if (resetValueOnSelectProp(event)) { 29773 store == null ? void 0 : store.resetValue(); 29774 } 29775 store == null ? void 0 : store.setSelectedValue((prevValue) => { 29776 if (!Array.isArray(prevValue)) return value; 29777 if (prevValue.includes(value)) { 29778 return prevValue.filter((v) => v !== value); 29779 } 29780 return [...prevValue, value]; 29781 }); 29782 } 29783 if (setValueOnClickProp(event)) { 29784 store == null ? void 0 : store.setValue(value); 29785 } 29786 } 29787 if (hideOnClickProp(event)) { 29788 store == null ? void 0 : store.hide(); 29789 } 29790 }); 29791 const onKeyDownProp = props.onKeyDown; 29792 const onKeyDown = useEvent((event) => { 29793 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 29794 if (event.defaultPrevented) return; 29795 const baseElement = store == null ? void 0 : store.getState().baseElement; 29796 if (!baseElement) return; 29797 if (hasFocus(baseElement)) return; 29798 const printable = event.key.length === 1; 29799 if (printable || event.key === "Backspace" || event.key === "Delete") { 29800 queueMicrotask(() => baseElement.focus()); 29801 if (isTextField(baseElement)) { 29802 store == null ? void 0 : store.setValue(baseElement.value); 29803 } 29804 } 29805 }); 29806 if (multiSelectable && selected != null) { 29807 props = _3YLGPPWQ_spreadValues({ 29808 "aria-selected": selected 29809 }, props); 29810 } 29811 props = useWrapElement( 29812 props, 29813 (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 }) }), 29814 [value, selected] 29815 ); 29816 const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext); 29817 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29818 role: getItemRole(popupRole), 29819 children: value 29820 }, props), { 29821 onClick, 29822 onKeyDown 29823 }); 29824 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 29825 props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29826 store 29827 }, props), { 29828 getItem, 29829 // Dispatch a custom event on the combobox input when moving to an item 29830 // with the keyboard so the Combobox component can enable inline 29831 // autocompletion. 29832 moveOnKeyPress: (event) => { 29833 if (!moveOnKeyPressProp(event)) return false; 29834 const moveEvent = new Event("combobox-item-move"); 29835 const baseElement = store == null ? void 0 : store.getState().baseElement; 29836 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); 29837 return true; 29838 } 29839 })); 29840 props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props)); 29841 return props; 29842 } 29843 ); 29844 var ComboboxItem = memo2( 29845 forwardRef2(function ComboboxItem2(props) { 29846 const htmlProps = useComboboxItem(props); 29847 return createElement(combobox_item_TagName, htmlProps); 29848 }) 29849 ); 29850 29851 29852 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js 29853 "use client"; 29854 29855 29856 29857 29858 29859 29860 29861 29862 29863 29864 29865 29866 // src/combobox/combobox-item-value.tsx 29867 29868 29869 29870 29871 var combobox_item_value_TagName = "span"; 29872 function normalizeValue(value) { 29873 return normalizeString(value).toLowerCase(); 29874 } 29875 function getOffsets(string, values) { 29876 const offsets = []; 29877 for (const value of values) { 29878 let pos = 0; 29879 const length = value.length; 29880 while (string.indexOf(value, pos) !== -1) { 29881 const index = string.indexOf(value, pos); 29882 if (index !== -1) { 29883 offsets.push([index, length]); 29884 } 29885 pos = index + 1; 29886 } 29887 } 29888 return offsets; 29889 } 29890 function filterOverlappingOffsets(offsets) { 29891 return offsets.filter(([offset, length], i, arr) => { 29892 return !arr.some( 29893 ([o, l], j) => j !== i && o <= offset && o + l >= offset + length 29894 ); 29895 }); 29896 } 29897 function sortOffsets(offsets) { 29898 return offsets.sort(([a], [b]) => a - b); 29899 } 29900 function splitValue(itemValue, userValue) { 29901 if (!itemValue) return itemValue; 29902 if (!userValue) return itemValue; 29903 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue); 29904 const parts = []; 29905 const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29906 "span", 29907 { 29908 "data-autocomplete-value": autocomplete ? "" : void 0, 29909 "data-user-value": autocomplete ? void 0 : "", 29910 children: value 29911 }, 29912 parts.length 29913 ); 29914 const offsets = sortOffsets( 29915 filterOverlappingOffsets( 29916 // Convert userValues into a set to avoid duplicates 29917 getOffsets(normalizeValue(itemValue), new Set(userValues)) 29918 ) 29919 ); 29920 if (!offsets.length) { 29921 parts.push(span(itemValue, true)); 29922 return parts; 29923 } 29924 const [firstOffset] = offsets[0]; 29925 const values = [ 29926 itemValue.slice(0, firstOffset), 29927 ...offsets.flatMap(([offset, length], i) => { 29928 var _a; 29929 const value = itemValue.slice(offset, offset + length); 29930 const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0]; 29931 const nextValue = itemValue.slice(offset + length, nextOffset); 29932 return [value, nextValue]; 29933 }) 29934 ]; 29935 values.forEach((value, i) => { 29936 if (!value) return; 29937 parts.push(span(value, i % 2 === 0)); 29938 }); 29939 return parts; 29940 } 29941 var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) { 29942 var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]); 29943 const context = useComboboxScopedContext(); 29944 store = store || context; 29945 const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext); 29946 const itemValue = value != null ? value : itemContext; 29947 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); 29948 const children = (0,external_React_.useMemo)(() => { 29949 if (!itemValue) return; 29950 if (!inputValue) return itemValue; 29951 return splitValue(itemValue, inputValue); 29952 }, [itemValue, inputValue]); 29953 props = _3YLGPPWQ_spreadValues({ 29954 children 29955 }, props); 29956 return removeUndefinedValues(props); 29957 }); 29958 var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) { 29959 const htmlProps = useComboboxItemValue(props); 29960 return createElement(combobox_item_value_TagName, htmlProps); 29961 }); 29962 29963 29964 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js 29965 /** 29966 * External dependencies 29967 */ 29968 // eslint-disable-next-line no-restricted-imports 29969 29970 29971 29972 /** 29973 * WordPress dependencies 29974 */ 29975 29976 29977 29978 29979 29980 29981 29982 /** 29983 * Internal dependencies 29984 */ 29985 29986 29987 const radioCheck = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 29988 xmlns: "http://www.w3.org/2000/svg", 29989 viewBox: "0 0 24 24", 29990 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, { 29991 cx: 12, 29992 cy: 12, 29993 r: 3 29994 }) 29995 }); 29996 function search_widget_normalizeSearchInput(input = '') { 29997 return remove_accents_default()(input.trim().toLowerCase()); 29998 } 29999 const search_widget_EMPTY_ARRAY = []; 30000 const getCurrentValue = (filterDefinition, currentFilter) => { 30001 if (filterDefinition.singleSelection) { 30002 return currentFilter?.value; 30003 } 30004 if (Array.isArray(currentFilter?.value)) { 30005 return currentFilter.value; 30006 } 30007 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 30008 return [currentFilter.value]; 30009 } 30010 return search_widget_EMPTY_ARRAY; 30011 }; 30012 const getNewValue = (filterDefinition, currentFilter, value) => { 30013 if (filterDefinition.singleSelection) { 30014 return value; 30015 } 30016 if (Array.isArray(currentFilter?.value)) { 30017 return currentFilter.value.includes(value) ? currentFilter.value.filter(v => v !== value) : [...currentFilter.value, value]; 30018 } 30019 return [value]; 30020 }; 30021 function generateFilterElementCompositeItemId(prefix, filterElementValue) { 30022 return `$prefix}-$filterElementValue}`; 30023 } 30024 function ListBox({ 30025 view, 30026 filter, 30027 onChangeView 30028 }) { 30029 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, 'dataviews-filter-list-box'); 30030 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)( 30031 // When there are one or less operators, the first item is set as active 30032 // (by setting the initial `activeId` to `undefined`). 30033 // With 2 or more operators, the focus is moved on the operators control 30034 // (by setting the initial `activeId` to `null`), meaning that there won't 30035 // be an active item initially. Focus is then managed via the 30036 // `onFocusVisible` callback. 30037 filter.operators?.length === 1 ? undefined : null); 30038 const currentFilter = view.filters?.find(f => f.field === filter.field); 30039 const currentValue = getCurrentValue(filter, currentFilter); 30040 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 30041 virtualFocus: true, 30042 focusLoop: true, 30043 activeId: activeCompositeId, 30044 setActiveId: setActiveCompositeId, 30045 role: "listbox", 30046 className: "dataviews-filters__search-widget-listbox", 30047 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 30048 (0,external_wp_i18n_namespaceObject.__)('List of: %1$s'), filter.name), 30049 onFocusVisible: () => { 30050 // `onFocusVisible` needs the `Composite` component to be focusable, 30051 // which is implicitly achieved via the `virtualFocus` prop. 30052 if (!activeCompositeId && filter.elements.length) { 30053 setActiveCompositeId(generateFilterElementCompositeItemId(baseId, filter.elements[0].value)); 30054 } 30055 }, 30056 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}), 30057 children: filter.elements.map(element => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Hover, { 30058 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 30059 id: generateFilterElementCompositeItemId(baseId, element.value), 30060 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30061 "aria-label": element.label, 30062 role: "option", 30063 className: "dataviews-filters__search-widget-listitem" 30064 }), 30065 onClick: () => { 30066 var _view$filters, _view$filters2; 30067 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 30068 if (_filter.field === filter.field) { 30069 return { 30070 ..._filter, 30071 operator: currentFilter.operator || filter.operators[0], 30072 value: getNewValue(filter, currentFilter, element.value) 30073 }; 30074 } 30075 return _filter; 30076 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 30077 field: filter.field, 30078 operator: filter.operators[0], 30079 value: getNewValue(filter, currentFilter, element.value) 30080 }]; 30081 onChangeView({ 30082 ...view, 30083 page: 1, 30084 filters: newFilters 30085 }); 30086 } 30087 }), 30088 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 30089 className: "dataviews-filters__search-widget-listitem-check", 30090 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30091 icon: radioCheck 30092 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30093 icon: library_check 30094 })] 30095 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30096 children: element.label 30097 })] 30098 }, element.value)) 30099 }); 30100 } 30101 function search_widget_ComboboxList({ 30102 view, 30103 filter, 30104 onChangeView 30105 }) { 30106 const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(''); 30107 const deferredSearchValue = (0,external_wp_element_namespaceObject.useDeferredValue)(searchValue); 30108 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 30109 const currentValue = getCurrentValue(filter, currentFilter); 30110 const matches = (0,external_wp_element_namespaceObject.useMemo)(() => { 30111 const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue); 30112 return filter.elements.filter(item => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch)); 30113 }, [filter.elements, deferredSearchValue]); 30114 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxProvider, { 30115 selectedValue: currentValue, 30116 setSelectedValue: value => { 30117 var _view$filters3, _view$filters4; 30118 const newFilters = currentFilter ? [...((_view$filters3 = view.filters) !== null && _view$filters3 !== void 0 ? _view$filters3 : []).map(_filter => { 30119 if (_filter.field === filter.field) { 30120 return { 30121 ..._filter, 30122 operator: currentFilter.operator || filter.operators[0], 30123 value 30124 }; 30125 } 30126 return _filter; 30127 })] : [...((_view$filters4 = view.filters) !== null && _view$filters4 !== void 0 ? _view$filters4 : []), { 30128 field: filter.field, 30129 operator: filter.operators[0], 30130 value 30131 }]; 30132 onChangeView({ 30133 ...view, 30134 page: 1, 30135 filters: newFilters 30136 }); 30137 }, 30138 setValue: setSearchValue, 30139 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30140 className: "dataviews-filters__search-widget-filter-combobox__wrapper", 30141 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxLabel, { 30142 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 30143 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 30144 }), 30145 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 30146 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Combobox, { 30147 autoSelect: "always", 30148 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'), 30149 className: "dataviews-filters__search-widget-filter-combobox__input" 30150 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30151 className: "dataviews-filters__search-widget-filter-combobox__icon", 30152 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30153 icon: library_search 30154 }) 30155 })] 30156 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxList, { 30157 className: "dataviews-filters__search-widget-filter-combobox-list", 30158 alwaysVisible: true, 30159 children: [matches.map(element => { 30160 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxItem, { 30161 resetValueOnSelect: false, 30162 value: element.value, 30163 className: "dataviews-filters__search-widget-listitem", 30164 hideOnClick: false, 30165 setValueOnClick: false, 30166 focusOnHover: true, 30167 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 30168 className: "dataviews-filters__search-widget-listitem-check", 30169 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30170 icon: radioCheck 30171 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30172 icon: library_check 30173 })] 30174 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 30175 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValue, { 30176 className: "dataviews-filters__search-widget-filter-combobox-item-value", 30177 value: element.label 30178 }), !!element.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30179 className: "dataviews-filters__search-widget-listitem-description", 30180 children: element.description 30181 })] 30182 })] 30183 }, element.value); 30184 }), !matches.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 30185 children: (0,external_wp_i18n_namespaceObject.__)('No results found') 30186 })] 30187 })] 30188 }); 30189 } 30190 function SearchWidget(props) { 30191 const Widget = props.filter.elements.length > 10 ? search_widget_ComboboxList : ListBox; 30192 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { 30193 ...props 30194 }); 30195 } 30196 30197 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter-summary.js 30198 /** 30199 * External dependencies 30200 */ 30201 30202 /** 30203 * WordPress dependencies 30204 */ 30205 30206 30207 30208 30209 const ENTER = 'Enter'; 30210 const SPACE = ' '; 30211 30212 /** 30213 * Internal dependencies 30214 */ 30215 30216 30217 30218 30219 const FilterText = ({ 30220 activeElements, 30221 filterInView, 30222 filter 30223 }) => { 30224 if (activeElements === undefined || activeElements.length === 0) { 30225 return filter.name; 30226 } 30227 const filterTextWrappers = { 30228 Name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30229 className: "dataviews-filters__summary-filter-text-name" 30230 }), 30231 Value: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30232 className: "dataviews-filters__summary-filter-text-value" 30233 }) 30234 }; 30235 if (filterInView?.operator === constants_OPERATOR_IS_ANY) { 30236 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". */ 30237 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is any: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 30238 } 30239 if (filterInView?.operator === constants_OPERATOR_IS_NONE) { 30240 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". */ 30241 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is none: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 30242 } 30243 if (filterInView?.operator === OPERATOR_IS_ALL) { 30244 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". */ 30245 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 30246 } 30247 if (filterInView?.operator === OPERATOR_IS_NOT_ALL) { 30248 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". */ 30249 (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); 30250 } 30251 if (filterInView?.operator === constants_OPERATOR_IS) { 30252 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". */ 30253 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 30254 } 30255 if (filterInView?.operator === constants_OPERATOR_IS_NOT) { 30256 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". */ 30257 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 30258 } 30259 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name e.g.: "Unknown status for Author". */ 30260 (0,external_wp_i18n_namespaceObject.__)('Unknown status for %1$s'), filter.name); 30261 }; 30262 function OperatorSelector({ 30263 filter, 30264 view, 30265 onChangeView 30266 }) { 30267 const operatorOptions = filter.operators?.map(operator => ({ 30268 value: operator, 30269 label: OPERATORS[operator]?.label 30270 })); 30271 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 30272 const value = currentFilter?.operator || filter.operators[0]; 30273 return operatorOptions.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 30274 spacing: 2, 30275 justify: "flex-start", 30276 className: "dataviews-filters__summary-operators-container", 30277 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 30278 className: "dataviews-filters__summary-operators-filter-name", 30279 children: filter.name 30280 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 30281 label: (0,external_wp_i18n_namespaceObject.__)('Conditions'), 30282 value: value, 30283 options: operatorOptions, 30284 onChange: newValue => { 30285 var _view$filters, _view$filters2; 30286 const operator = newValue; 30287 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 30288 if (_filter.field === filter.field) { 30289 return { 30290 ..._filter, 30291 operator 30292 }; 30293 } 30294 return _filter; 30295 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 30296 field: filter.field, 30297 operator, 30298 value: undefined 30299 }]; 30300 onChangeView({ 30301 ...view, 30302 page: 1, 30303 filters: newFilters 30304 }); 30305 }, 30306 size: "small", 30307 __nextHasNoMarginBottom: true, 30308 hideLabelFromVision: true 30309 })] 30310 }); 30311 } 30312 function FilterSummary({ 30313 addFilterRef, 30314 openedFilter, 30315 ...commonProps 30316 }) { 30317 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(null); 30318 const { 30319 filter, 30320 view, 30321 onChangeView 30322 } = commonProps; 30323 const filterInView = view.filters?.find(f => f.field === filter.field); 30324 const activeElements = filter.elements.filter(element => { 30325 if (filter.singleSelection) { 30326 return element.value === filterInView?.value; 30327 } 30328 return filterInView?.value?.includes(element.value); 30329 }); 30330 const isPrimary = filter.isPrimary; 30331 const hasValues = filterInView?.value !== undefined; 30332 const canResetOrRemove = !isPrimary || hasValues; 30333 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 30334 defaultOpen: openedFilter === filter.field, 30335 contentClassName: "dataviews-filters__summary-popover", 30336 popoverProps: { 30337 placement: 'bottom-start', 30338 role: 'dialog' 30339 }, 30340 onClose: () => { 30341 toggleRef.current?.focus(); 30342 }, 30343 renderToggle: ({ 30344 isOpen, 30345 onToggle 30346 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30347 className: "dataviews-filters__summary-chip-container", 30348 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 30349 text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. */ 30350 (0,external_wp_i18n_namespaceObject.__)('Filter by: %1$s'), filter.name.toLowerCase()), 30351 placement: "top", 30352 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30353 className: dist_clsx('dataviews-filters__summary-chip', { 30354 'has-reset': canResetOrRemove, 30355 'has-values': hasValues 30356 }), 30357 role: "button", 30358 tabIndex: 0, 30359 onClick: onToggle, 30360 onKeyDown: event => { 30361 if ([ENTER, SPACE].includes(event.key)) { 30362 onToggle(); 30363 event.preventDefault(); 30364 } 30365 }, 30366 "aria-pressed": isOpen, 30367 "aria-expanded": isOpen, 30368 ref: toggleRef, 30369 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterText, { 30370 activeElements: activeElements, 30371 filterInView: filterInView, 30372 filter: filter 30373 }) 30374 }) 30375 }), canResetOrRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 30376 text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove'), 30377 placement: "top", 30378 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 30379 className: dist_clsx('dataviews-filters__summary-chip-remove', { 30380 'has-values': hasValues 30381 }), 30382 onClick: () => { 30383 onChangeView({ 30384 ...view, 30385 page: 1, 30386 filters: view.filters?.filter(_filter => _filter.field !== filter.field) 30387 }); 30388 // If the filter is not primary and can be removed, it will be added 30389 // back to the available filters from `Add filter` component. 30390 if (!isPrimary) { 30391 addFilterRef.current?.focus(); 30392 } else { 30393 // If is primary, focus the toggle button. 30394 toggleRef.current?.focus(); 30395 } 30396 }, 30397 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30398 icon: close_small 30399 }) 30400 }) 30401 })] 30402 }), 30403 renderContent: () => { 30404 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 30405 spacing: 0, 30406 justify: "flex-start", 30407 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { 30408 ...commonProps 30409 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchWidget, { 30410 ...commonProps 30411 })] 30412 }); 30413 } 30414 }); 30415 } 30416 30417 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js 30418 /** 30419 * WordPress dependencies 30420 */ 30421 30422 const { 30423 lock: lock_unlock_lock, 30424 unlock: lock_unlock_unlock 30425 } = (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'); 30426 30427 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js 30428 /** 30429 * External dependencies 30430 */ 30431 30432 /** 30433 * WordPress dependencies 30434 */ 30435 30436 30437 30438 30439 /** 30440 * Internal dependencies 30441 */ 30442 30443 30444 const { 30445 DropdownMenuV2: add_filter_DropdownMenuV2 30446 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 30447 function AddFilterDropdownMenu({ 30448 filters, 30449 view, 30450 onChangeView, 30451 setOpenedFilter, 30452 trigger 30453 }) { 30454 const inactiveFilters = filters.filter(filter => !filter.isVisible); 30455 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuV2, { 30456 trigger: trigger, 30457 children: inactiveFilters.map(filter => { 30458 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuV2.Item, { 30459 onClick: () => { 30460 setOpenedFilter(filter.field); 30461 onChangeView({ 30462 ...view, 30463 page: 1, 30464 filters: [...(view.filters || []), { 30465 field: filter.field, 30466 value: undefined, 30467 operator: filter.operators[0] 30468 }] 30469 }); 30470 }, 30471 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuV2.ItemLabel, { 30472 children: filter.name 30473 }) 30474 }, filter.field); 30475 }) 30476 }); 30477 } 30478 function AddFilter({ 30479 filters, 30480 view, 30481 onChangeView, 30482 setOpenedFilter 30483 }, ref) { 30484 if (!filters.length || filters.every(({ 30485 isPrimary 30486 }) => isPrimary)) { 30487 return null; 30488 } 30489 const inactiveFilters = filters.filter(filter => !filter.isVisible); 30490 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterDropdownMenu, { 30491 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30492 accessibleWhenDisabled: true, 30493 size: "compact", 30494 className: "dataviews-filters-button", 30495 variant: "tertiary", 30496 disabled: !inactiveFilters.length, 30497 ref: ref, 30498 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 30499 }), 30500 filters, 30501 view, 30502 onChangeView, 30503 setOpenedFilter 30504 }); 30505 } 30506 /* harmony default export */ const add_filter = ((0,external_wp_element_namespaceObject.forwardRef)(AddFilter)); 30507 30508 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js 30509 /** 30510 * WordPress dependencies 30511 */ 30512 30513 30514 30515 /** 30516 * Internal dependencies 30517 */ 30518 30519 function ResetFilter({ 30520 filters, 30521 view, 30522 onChangeView 30523 }) { 30524 const isPrimary = field => filters.some(_filter => _filter.field === field && _filter.isPrimary); 30525 const isDisabled = !view.search && !view.filters?.some(_filter => _filter.value !== undefined || !isPrimary(_filter.field)); 30526 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30527 disabled: isDisabled, 30528 accessibleWhenDisabled: true, 30529 size: "compact", 30530 variant: "tertiary", 30531 className: "dataviews-filters__reset-button", 30532 onClick: () => { 30533 onChangeView({ 30534 ...view, 30535 page: 1, 30536 search: '', 30537 filters: [] 30538 }); 30539 }, 30540 children: (0,external_wp_i18n_namespaceObject.__)('Reset') 30541 }); 30542 } 30543 30544 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/utils.js 30545 /** 30546 * Internal dependencies 30547 */ 30548 30549 function sanitizeOperators(field) { 30550 let operators = field.filterBy?.operators; 30551 30552 // Assign default values. 30553 if (!operators || !Array.isArray(operators)) { 30554 operators = [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE]; 30555 } 30556 30557 // Make sure only valid operators are used. 30558 operators = operators.filter(operator => ALL_OPERATORS.includes(operator)); 30559 30560 // Do not allow mixing single & multiselection operators. 30561 // Remove multiselection operators if any of the single selection ones is present. 30562 if (operators.includes(constants_OPERATOR_IS) || operators.includes(constants_OPERATOR_IS_NOT)) { 30563 operators = operators.filter(operator => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(operator)); 30564 } 30565 return operators; 30566 } 30567 30568 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/index.js 30569 /** 30570 * WordPress dependencies 30571 */ 30572 30573 30574 30575 30576 30577 /** 30578 * Internal dependencies 30579 */ 30580 30581 30582 30583 30584 30585 30586 30587 30588 function useFilters(fields, view) { 30589 return (0,external_wp_element_namespaceObject.useMemo)(() => { 30590 const filters = []; 30591 fields.forEach(field => { 30592 if (!field.elements?.length) { 30593 return; 30594 } 30595 const operators = sanitizeOperators(field); 30596 if (operators.length === 0) { 30597 return; 30598 } 30599 const isPrimary = !!field.filterBy?.isPrimary; 30600 filters.push({ 30601 field: field.id, 30602 name: field.label, 30603 elements: field.elements, 30604 singleSelection: operators.some(op => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(op)), 30605 operators, 30606 isVisible: isPrimary || !!view.filters?.some(f => f.field === field.id && ALL_OPERATORS.includes(f.operator)), 30607 isPrimary 30608 }); 30609 }); 30610 // Sort filters by primary property. We need the primary filters to be first. 30611 // Then we sort by name. 30612 filters.sort((a, b) => { 30613 if (a.isPrimary && !b.isPrimary) { 30614 return -1; 30615 } 30616 if (!a.isPrimary && b.isPrimary) { 30617 return 1; 30618 } 30619 return a.name.localeCompare(b.name); 30620 }); 30621 return filters; 30622 }, [fields, view]); 30623 } 30624 function FilterVisibilityToggle({ 30625 filters, 30626 view, 30627 onChangeView, 30628 setOpenedFilter, 30629 isShowingFilter, 30630 setIsShowingFilter 30631 }) { 30632 const onChangeViewWithFilterVisibility = (0,external_wp_element_namespaceObject.useCallback)(_view => { 30633 onChangeView(_view); 30634 setIsShowingFilter(true); 30635 }, [onChangeView, setIsShowingFilter]); 30636 const visibleFilters = filters.filter(filter => filter.isVisible); 30637 const hasVisibleFilters = !!visibleFilters.length; 30638 if (filters.length === 0) { 30639 return null; 30640 } 30641 if (!hasVisibleFilters) { 30642 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterDropdownMenu, { 30643 filters: filters, 30644 view: view, 30645 onChangeView: onChangeViewWithFilterVisibility, 30646 setOpenedFilter: setOpenedFilter, 30647 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30648 className: "dataviews-filters__visibility-toggle", 30649 size: "compact", 30650 icon: library_funnel, 30651 label: (0,external_wp_i18n_namespaceObject.__)('Add filter'), 30652 isPressed: false, 30653 "aria-expanded": false 30654 }) 30655 }); 30656 } 30657 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30658 className: "dataviews-filters__container-visibility-toggle", 30659 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30660 className: "dataviews-filters__visibility-toggle", 30661 size: "compact", 30662 icon: library_funnel, 30663 label: (0,external_wp_i18n_namespaceObject.__)('Toggle filter display'), 30664 onClick: () => { 30665 if (!isShowingFilter) { 30666 setOpenedFilter(null); 30667 } 30668 setIsShowingFilter(!isShowingFilter); 30669 }, 30670 isPressed: isShowingFilter, 30671 "aria-expanded": isShowingFilter 30672 }), hasVisibleFilters && !!view.filters?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30673 className: "dataviews-filters-toggle__count", 30674 children: view.filters?.length 30675 })] 30676 }); 30677 } 30678 function Filters() { 30679 const { 30680 fields, 30681 view, 30682 onChangeView, 30683 openedFilter, 30684 setOpenedFilter 30685 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 30686 const addFilterRef = (0,external_wp_element_namespaceObject.useRef)(null); 30687 const filters = useFilters(fields, view); 30688 const addFilter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter, { 30689 filters: filters, 30690 view: view, 30691 onChangeView: onChangeView, 30692 ref: addFilterRef, 30693 setOpenedFilter: setOpenedFilter 30694 }, "add-filter"); 30695 const visibleFilters = filters.filter(filter => filter.isVisible); 30696 if (visibleFilters.length === 0) { 30697 return null; 30698 } 30699 const filterComponents = [...visibleFilters.map(filter => { 30700 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterSummary, { 30701 filter: filter, 30702 view: view, 30703 onChangeView: onChangeView, 30704 addFilterRef: addFilterRef, 30705 openedFilter: openedFilter 30706 }, filter.field); 30707 }), addFilter]; 30708 filterComponents.push( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetFilter, { 30709 filters: filters, 30710 view: view, 30711 onChangeView: onChangeView 30712 }, "reset-filters")); 30713 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 30714 justify: "flex-start", 30715 style: { 30716 width: 'fit-content' 30717 }, 30718 className: "dataviews-filters__container", 30719 wrap: true, 30720 children: filterComponents 30721 }); 30722 } 30723 /* harmony default export */ const dataviews_filters = ((0,external_wp_element_namespaceObject.memo)(Filters)); 30724 30725 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-table.js 30726 /** 30727 * WordPress dependencies 30728 */ 30729 30730 30731 const blockTable = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30732 viewBox: "0 0 24 24", 30733 xmlns: "http://www.w3.org/2000/svg", 30734 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30735 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" 30736 }) 30737 }); 30738 /* harmony default export */ const block_table = (blockTable); 30739 30740 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js 30741 /** 30742 * WordPress dependencies 30743 */ 30744 30745 30746 const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30747 viewBox: "0 0 24 24", 30748 xmlns: "http://www.w3.org/2000/svg", 30749 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30750 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", 30751 fillRule: "evenodd", 30752 clipRule: "evenodd" 30753 }) 30754 }); 30755 /* harmony default export */ const library_category = (category); 30756 30757 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js 30758 /** 30759 * WordPress dependencies 30760 */ 30761 30762 30763 const formatListBulletsRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30764 xmlns: "http://www.w3.org/2000/svg", 30765 viewBox: "0 0 24 24", 30766 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30767 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" 30768 }) 30769 }); 30770 /* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL); 30771 30772 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 30773 /** 30774 * WordPress dependencies 30775 */ 30776 30777 30778 const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30779 xmlns: "http://www.w3.org/2000/svg", 30780 viewBox: "0 0 24 24", 30781 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30782 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" 30783 }) 30784 }); 30785 /* harmony default export */ const format_list_bullets = (formatListBullets); 30786 30787 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js 30788 /** 30789 * WordPress dependencies 30790 */ 30791 30792 30793 30794 /** 30795 * Internal dependencies 30796 */ 30797 30798 function DataViewsSelectionCheckbox({ 30799 selection, 30800 onChangeSelection, 30801 item, 30802 getItemId, 30803 primaryField, 30804 disabled 30805 }) { 30806 const id = getItemId(item); 30807 const checked = !disabled && selection.includes(id); 30808 let selectionLabel; 30809 if (primaryField?.getValue && item) { 30810 // eslint-disable-next-line @wordpress/valid-sprintf 30811 selectionLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: item title. */ 30812 checked ? (0,external_wp_i18n_namespaceObject.__)('Deselect item: %s') : (0,external_wp_i18n_namespaceObject.__)('Select item: %s'), primaryField.getValue({ 30813 item 30814 })); 30815 } else { 30816 selectionLabel = checked ? (0,external_wp_i18n_namespaceObject.__)('Select a new item') : (0,external_wp_i18n_namespaceObject.__)('Deselect item'); 30817 } 30818 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 30819 className: "dataviews-selection-checkbox", 30820 __nextHasNoMarginBottom: true, 30821 "aria-label": selectionLabel, 30822 "aria-disabled": disabled, 30823 checked: checked, 30824 onChange: () => { 30825 if (disabled) { 30826 return; 30827 } 30828 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 30829 } 30830 }); 30831 } 30832 30833 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js 30834 /** 30835 * External dependencies 30836 */ 30837 30838 /** 30839 * WordPress dependencies 30840 */ 30841 30842 30843 30844 30845 30846 30847 /** 30848 * Internal dependencies 30849 */ 30850 30851 30852 30853 30854 const { 30855 DropdownMenuV2: dataviews_item_actions_DropdownMenuV2, 30856 kebabCase: dataviews_item_actions_kebabCase 30857 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 30858 function ButtonTrigger({ 30859 action, 30860 onClick, 30861 items 30862 }) { 30863 const label = typeof action.label === 'string' ? action.label : action.label(items); 30864 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30865 label: label, 30866 icon: action.icon, 30867 isDestructive: action.isDestructive, 30868 size: "compact", 30869 onClick: onClick 30870 }); 30871 } 30872 function DropdownMenuItemTrigger({ 30873 action, 30874 onClick, 30875 items 30876 }) { 30877 const label = typeof action.label === 'string' ? action.label : action.label(items); 30878 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2.Item, { 30879 onClick: onClick, 30880 hideOnClick: !('RenderModal' in action), 30881 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2.ItemLabel, { 30882 children: label 30883 }) 30884 }); 30885 } 30886 function ActionModal({ 30887 action, 30888 items, 30889 closeModal 30890 }) { 30891 const label = typeof action.label === 'string' ? action.label : action.label(items); 30892 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 30893 title: action.modalHeader || label, 30894 __experimentalHideHeader: !!action.hideModalHeader, 30895 onRequestClose: closeModal !== null && closeModal !== void 0 ? closeModal : () => {}, 30896 focusOnMount: "firstContentElement", 30897 size: "small", 30898 overlayClassName: `dataviews-action-modal dataviews-action-modal__$dataviews_item_actions_kebabCase(action.id)}`, 30899 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { 30900 items: items, 30901 closeModal: closeModal 30902 }) 30903 }); 30904 } 30905 function ActionWithModal({ 30906 action, 30907 items, 30908 ActionTrigger, 30909 isBusy 30910 }) { 30911 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 30912 const actionTriggerProps = { 30913 action, 30914 onClick: () => { 30915 setIsModalOpen(true); 30916 }, 30917 items, 30918 isBusy 30919 }; 30920 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 30921 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { 30922 ...actionTriggerProps 30923 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 30924 action: action, 30925 items: items, 30926 closeModal: () => setIsModalOpen(false) 30927 })] 30928 }); 30929 } 30930 function ActionsDropdownMenuGroup({ 30931 actions, 30932 item 30933 }) { 30934 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 30935 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2.Group, { 30936 children: actions.map(action => { 30937 if ('RenderModal' in action) { 30938 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 30939 action: action, 30940 items: [item], 30941 ActionTrigger: DropdownMenuItemTrigger 30942 }, action.id); 30943 } 30944 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemTrigger, { 30945 action: action, 30946 onClick: () => { 30947 action.callback([item], { 30948 registry 30949 }); 30950 }, 30951 items: [item] 30952 }, action.id); 30953 }) 30954 }); 30955 } 30956 function ItemActions({ 30957 item, 30958 actions, 30959 isCompact 30960 }) { 30961 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 30962 const { 30963 primaryActions, 30964 eligibleActions 30965 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 30966 // If an action is eligible for all items, doesn't need 30967 // to provide the `isEligible` function. 30968 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 30969 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 30970 return { 30971 primaryActions: _primaryActions, 30972 eligibleActions: _eligibleActions 30973 }; 30974 }, [actions, item]); 30975 if (isCompact) { 30976 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 30977 item: item, 30978 actions: eligibleActions 30979 }); 30980 } 30981 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 30982 spacing: 1, 30983 justify: "flex-end", 30984 className: "dataviews-item-actions", 30985 style: { 30986 flexShrink: '0', 30987 width: 'auto' 30988 }, 30989 children: [!!primaryActions.length && primaryActions.map(action => { 30990 if ('RenderModal' in action) { 30991 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 30992 action: action, 30993 items: [item], 30994 ActionTrigger: ButtonTrigger 30995 }, action.id); 30996 } 30997 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ButtonTrigger, { 30998 action: action, 30999 onClick: () => { 31000 action.callback([item], { 31001 registry 31002 }); 31003 }, 31004 items: [item] 31005 }, action.id); 31006 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 31007 item: item, 31008 actions: eligibleActions 31009 })] 31010 }); 31011 } 31012 function CompactItemActions({ 31013 item, 31014 actions 31015 }) { 31016 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2, { 31017 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31018 size: "compact", 31019 icon: more_vertical, 31020 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 31021 accessibleWhenDisabled: true, 31022 disabled: !actions.length, 31023 className: "dataviews-all-actions-button" 31024 }), 31025 placement: "bottom-end", 31026 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, { 31027 actions: actions, 31028 item: item 31029 }) 31030 }); 31031 } 31032 31033 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js 31034 /** 31035 * WordPress dependencies 31036 */ 31037 31038 31039 31040 31041 31042 31043 /** 31044 * Internal dependencies 31045 */ 31046 31047 31048 31049 31050 function useHasAPossibleBulkAction(actions, item) { 31051 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31052 return actions.some(action => { 31053 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 31054 }); 31055 }, [actions, item]); 31056 } 31057 function useSomeItemHasAPossibleBulkAction(actions, data) { 31058 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31059 return data.some(item => { 31060 return actions.some(action => { 31061 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 31062 }); 31063 }); 31064 }, [actions, data]); 31065 } 31066 function BulkSelectionCheckbox({ 31067 selection, 31068 onChangeSelection, 31069 data, 31070 actions, 31071 getItemId 31072 }) { 31073 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31074 return data.filter(item => { 31075 return actions.some(action => action.supportsBulk && (!action.isEligible || action.isEligible(item))); 31076 }); 31077 }, [data, actions]); 31078 const selectedItems = data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 31079 const areAllSelected = selectedItems.length === selectableItems.length; 31080 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 31081 className: "dataviews-view-table-selection-checkbox", 31082 __nextHasNoMarginBottom: true, 31083 checked: areAllSelected, 31084 indeterminate: !areAllSelected && !!selectedItems.length, 31085 onChange: () => { 31086 if (areAllSelected) { 31087 onChangeSelection([]); 31088 } else { 31089 onChangeSelection(selectableItems.map(item => getItemId(item))); 31090 } 31091 }, 31092 "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect all') : (0,external_wp_i18n_namespaceObject.__)('Select all') 31093 }); 31094 } 31095 function ActionTrigger({ 31096 action, 31097 onClick, 31098 isBusy, 31099 items 31100 }) { 31101 const label = typeof action.label === 'string' ? action.label : action.label(items); 31102 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31103 disabled: isBusy, 31104 accessibleWhenDisabled: true, 31105 label: label, 31106 icon: action.icon, 31107 isDestructive: action.isDestructive, 31108 size: "compact", 31109 onClick: onClick, 31110 isBusy: isBusy, 31111 tooltipPosition: "top" 31112 }); 31113 } 31114 const dataviews_bulk_actions_EMPTY_ARRAY = []; 31115 function ActionButton({ 31116 action, 31117 selectedItems, 31118 actionInProgress, 31119 setActionInProgress 31120 }) { 31121 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 31122 const selectedEligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31123 return selectedItems.filter(item => { 31124 return !action.isEligible || action.isEligible(item); 31125 }); 31126 }, [action, selectedItems]); 31127 if ('RenderModal' in action) { 31128 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 31129 action: action, 31130 items: selectedEligibleItems, 31131 ActionTrigger: ActionTrigger 31132 }, action.id); 31133 } 31134 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { 31135 action: action, 31136 onClick: async () => { 31137 setActionInProgress(action.id); 31138 await action.callback(selectedItems, { 31139 registry 31140 }); 31141 setActionInProgress(null); 31142 }, 31143 items: selectedEligibleItems, 31144 isBusy: actionInProgress === action.id 31145 }, action.id); 31146 } 31147 function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) { 31148 const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of items. */ 31149 (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. */ 31150 (0,external_wp_i18n_namespaceObject._n)('%d Item', '%d Items', data.length), data.length); 31151 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31152 expanded: false, 31153 className: "dataviews-bulk-actions-footer__container", 31154 spacing: 3, 31155 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 31156 selection: selection, 31157 onChangeSelection: onChangeSelection, 31158 data: data, 31159 actions: actions, 31160 getItemId: getItemId 31161 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 31162 className: "dataviews-bulk-actions-footer__item-count", 31163 children: message 31164 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31165 className: "dataviews-bulk-actions-footer__action-buttons", 31166 expanded: false, 31167 spacing: 1, 31168 children: [actionsToShow.map(action => { 31169 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionButton, { 31170 action: action, 31171 selectedItems: selectedItems, 31172 actionInProgress: actionInProgress, 31173 setActionInProgress: setActionInProgress 31174 }, action.id); 31175 }), selectedItems.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31176 icon: close_small, 31177 showTooltip: true, 31178 tooltipPosition: "top", 31179 size: "compact", 31180 label: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 31181 disabled: !!actionInProgress, 31182 accessibleWhenDisabled: false, 31183 onClick: () => { 31184 onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY); 31185 } 31186 })] 31187 })] 31188 }); 31189 } 31190 function FooterContent({ 31191 selection, 31192 actions, 31193 onChangeSelection, 31194 data, 31195 getItemId 31196 }) { 31197 const [actionInProgress, setActionInProgress] = (0,external_wp_element_namespaceObject.useState)(null); 31198 const footerContent = (0,external_wp_element_namespaceObject.useRef)(null); 31199 const bulkActions = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => action.supportsBulk), [actions]); 31200 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31201 return data.filter(item => { 31202 return bulkActions.some(action => !action.isEligible || action.isEligible(item)); 31203 }); 31204 }, [data, bulkActions]); 31205 const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31206 return data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 31207 }, [selection, data, getItemId, selectableItems]); 31208 const actionsToShow = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => { 31209 return action.supportsBulk && action.icon && selectedItems.some(item => !action.isEligible || action.isEligible(item)); 31210 }), [actions, selectedItems]); 31211 if (!actionInProgress) { 31212 if (footerContent.current) { 31213 footerContent.current = null; 31214 } 31215 return renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 31216 } else if (!footerContent.current) { 31217 footerContent.current = renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 31218 } 31219 return footerContent.current; 31220 } 31221 function BulkActionsFooter() { 31222 const { 31223 data, 31224 selection, 31225 actions = dataviews_bulk_actions_EMPTY_ARRAY, 31226 onChangeSelection, 31227 getItemId 31228 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 31229 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FooterContent, { 31230 selection: selection, 31231 onChangeSelection: onChangeSelection, 31232 data: data, 31233 actions: actions, 31234 getItemId: getItemId 31235 }); 31236 } 31237 31238 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 31239 /** 31240 * WordPress dependencies 31241 */ 31242 31243 31244 const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 31245 xmlns: "http://www.w3.org/2000/svg", 31246 viewBox: "0 0 24 24", 31247 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 31248 d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" 31249 }) 31250 }); 31251 /* harmony default export */ const arrow_left = (arrowLeft); 31252 31253 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-right.js 31254 /** 31255 * WordPress dependencies 31256 */ 31257 31258 31259 const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 31260 xmlns: "http://www.w3.org/2000/svg", 31261 viewBox: "0 0 24 24", 31262 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 31263 d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" 31264 }) 31265 }); 31266 /* harmony default export */ const arrow_right = (arrowRight); 31267 31268 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/unseen.js 31269 /** 31270 * WordPress dependencies 31271 */ 31272 31273 31274 const unseen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 31275 viewBox: "0 0 24 24", 31276 xmlns: "http://www.w3.org/2000/svg", 31277 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 31278 d: "M4.67 10.664s-2.09 1.11-2.917 1.582l.494.87 1.608-.914.002.002c.343.502.86 1.17 1.563 1.84.348.33.742.663 1.185.976L5.57 16.744l.858.515 1.02-1.701a9.1 9.1 0 0 0 4.051 1.18V19h1v-2.263a9.1 9.1 0 0 0 4.05-1.18l1.021 1.7.858-.514-1.034-1.723c.442-.313.837-.646 1.184-.977.703-.669 1.22-1.337 1.563-1.839l.002-.003 1.61.914.493-.87c-1.75-.994-2.918-1.58-2.918-1.58l-.003.005a8.29 8.29 0 0 1-.422.689 10.097 10.097 0 0 1-1.36 1.598c-1.218 1.16-3.042 2.293-5.544 2.293-2.503 0-4.327-1.132-5.546-2.293a10.099 10.099 0 0 1-1.359-1.599 8.267 8.267 0 0 1-.422-.689l-.003-.005Z" 31279 }) 31280 }); 31281 /* harmony default export */ const library_unseen = (unseen); 31282 31283 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js 31284 /** 31285 * External dependencies 31286 */ 31287 31288 /** 31289 * WordPress dependencies 31290 */ 31291 31292 31293 31294 31295 31296 /** 31297 * Internal dependencies 31298 */ 31299 31300 31301 31302 31303 31304 31305 const { 31306 DropdownMenuV2: column_header_menu_DropdownMenuV2 31307 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31308 function WithDropDownMenuSeparators({ 31309 children 31310 }) { 31311 return external_wp_element_namespaceObject.Children.toArray(children).filter(Boolean).map((child, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { 31312 children: [i > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Separator, {}), child] 31313 }, i)); 31314 } 31315 const _HeaderMenu = (0,external_wp_element_namespaceObject.forwardRef)(function HeaderMenu({ 31316 fieldId, 31317 view, 31318 fields, 31319 onChangeView, 31320 onHide, 31321 setOpenedFilter 31322 }, ref) { 31323 const visibleFieldIds = getVisibleFieldIds(view, fields); 31324 const index = visibleFieldIds?.indexOf(fieldId); 31325 const isSorted = view.sort?.field === fieldId; 31326 let isHidable = false; 31327 let isSortable = false; 31328 let canAddFilter = false; 31329 let header; 31330 let operators = []; 31331 const combinedField = view.layout?.combinedFields?.find(f => f.id === fieldId); 31332 const field = fields.find(f => f.id === fieldId); 31333 if (!combinedField) { 31334 if (!field) { 31335 // No combined or regular field found. 31336 return null; 31337 } 31338 isHidable = field.enableHiding !== false; 31339 isSortable = field.enableSorting !== false; 31340 header = field.header; 31341 operators = sanitizeOperators(field); 31342 // Filter can be added: 31343 // 1. If the field is not already part of a view's filters. 31344 // 2. If the field meets the type and operator requirements. 31345 // 3. If it's not primary. If it is, it should be already visible. 31346 canAddFilter = !view.filters?.some(_filter => fieldId === _filter.field) && !!field.elements?.length && !!operators.length && !field.filterBy?.isPrimary; 31347 } else { 31348 header = combinedField.header || combinedField.label; 31349 } 31350 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2, { 31351 align: "start", 31352 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 31353 size: "compact", 31354 className: "dataviews-view-table-header-button", 31355 ref: ref, 31356 variant: "tertiary", 31357 children: [header, view.sort && isSorted && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 31358 "aria-hidden": "true", 31359 children: sortArrows[view.sort.direction] 31360 })] 31361 }), 31362 style: { 31363 minWidth: '240px' 31364 }, 31365 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithDropDownMenuSeparators, { 31366 children: [isSortable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Group, { 31367 children: SORTING_DIRECTIONS.map(direction => { 31368 const isChecked = view.sort && isSorted && view.sort.direction === direction; 31369 const value = `$fieldId}-$direction}`; 31370 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.RadioItem, { 31371 // All sorting radio items share the same name, so that 31372 // selecting a sorting option automatically deselects the 31373 // previously selected one, even if it is displayed in 31374 // another submenu. The field and direction are passed via 31375 // the `value` prop. 31376 name: "view-table-sorting", 31377 value: value, 31378 checked: isChecked, 31379 onChange: () => { 31380 onChangeView({ 31381 ...view, 31382 sort: { 31383 field: fieldId, 31384 direction 31385 } 31386 }); 31387 }, 31388 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31389 children: sortLabels[direction] 31390 }) 31391 }, value); 31392 }) 31393 }), canAddFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Group, { 31394 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31395 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31396 icon: library_funnel 31397 }), 31398 onClick: () => { 31399 setOpenedFilter(fieldId); 31400 onChangeView({ 31401 ...view, 31402 page: 1, 31403 filters: [...(view.filters || []), { 31404 field: fieldId, 31405 value: undefined, 31406 operator: operators[0] 31407 }] 31408 }); 31409 }, 31410 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31411 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 31412 }) 31413 }) 31414 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_DropdownMenuV2.Group, { 31415 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31416 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31417 icon: arrow_left 31418 }), 31419 disabled: index < 1, 31420 onClick: () => { 31421 var _visibleFieldIds$slic; 31422 onChangeView({ 31423 ...view, 31424 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), fieldId, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 31425 }); 31426 }, 31427 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31428 children: (0,external_wp_i18n_namespaceObject.__)('Move left') 31429 }) 31430 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31431 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31432 icon: arrow_right 31433 }), 31434 disabled: index >= visibleFieldIds.length - 1, 31435 onClick: () => { 31436 var _visibleFieldIds$slic2; 31437 onChangeView({ 31438 ...view, 31439 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], fieldId, ...visibleFieldIds.slice(index + 2)] 31440 }); 31441 }, 31442 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31443 children: (0,external_wp_i18n_namespaceObject.__)('Move right') 31444 }) 31445 }), isHidable && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31446 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31447 icon: library_unseen 31448 }), 31449 onClick: () => { 31450 onHide(field); 31451 onChangeView({ 31452 ...view, 31453 fields: visibleFieldIds.filter(id => id !== fieldId) 31454 }); 31455 }, 31456 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31457 children: (0,external_wp_i18n_namespaceObject.__)('Hide column') 31458 }) 31459 })] 31460 })] 31461 }) 31462 }); 31463 }); 31464 31465 // @ts-expect-error Lift the `Item` type argument through the forwardRef. 31466 const ColumnHeaderMenu = _HeaderMenu; 31467 /* harmony default export */ const column_header_menu = (ColumnHeaderMenu); 31468 31469 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js 31470 /** 31471 * External dependencies 31472 */ 31473 31474 31475 /** 31476 * WordPress dependencies 31477 */ 31478 31479 31480 31481 31482 /** 31483 * Internal dependencies 31484 */ 31485 31486 31487 31488 31489 31490 31491 31492 31493 31494 function TableColumn({ 31495 column, 31496 fields, 31497 view, 31498 ...props 31499 }) { 31500 const field = fields.find(f => f.id === column); 31501 if (!!field) { 31502 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumnField, { 31503 ...props, 31504 field: field 31505 }); 31506 } 31507 const combinedField = view.layout?.combinedFields?.find(f => f.id === column); 31508 if (!!combinedField) { 31509 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumnCombined, { 31510 ...props, 31511 fields: fields, 31512 view: view, 31513 field: combinedField 31514 }); 31515 } 31516 return null; 31517 } 31518 function TableColumnField({ 31519 primaryField, 31520 item, 31521 field 31522 }) { 31523 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31524 className: dist_clsx('dataviews-view-table__cell-content-wrapper', { 31525 'dataviews-view-table__primary-field': primaryField?.id === field.id 31526 }), 31527 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 31528 item 31529 }) 31530 }); 31531 } 31532 function TableColumnCombined({ 31533 field, 31534 ...props 31535 }) { 31536 const children = field.children.map(child => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumn, { 31537 ...props, 31538 column: child 31539 }, child)); 31540 if (field.direction === 'horizontal') { 31541 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 31542 spacing: 3, 31543 children: children 31544 }); 31545 } 31546 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 31547 spacing: 0, 31548 children: children 31549 }); 31550 } 31551 function TableRow({ 31552 hasBulkActions, 31553 item, 31554 actions, 31555 fields, 31556 id, 31557 view, 31558 primaryField, 31559 selection, 31560 getItemId, 31561 onChangeSelection 31562 }) { 31563 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 31564 const isSelected = hasPossibleBulkAction && selection.includes(id); 31565 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 31566 const handleMouseEnter = () => { 31567 setIsHovered(true); 31568 }; 31569 const handleMouseLeave = () => { 31570 setIsHovered(false); 31571 }; 31572 31573 // Will be set to true if `onTouchStart` fires. This happens before 31574 // `onClick` and can be used to exclude touchscreen devices from certain 31575 // behaviours. 31576 const isTouchDeviceRef = (0,external_wp_element_namespaceObject.useRef)(false); 31577 const columns = getVisibleFieldIds(view, fields); 31578 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 31579 className: dist_clsx('dataviews-view-table__row', { 31580 'is-selected': hasPossibleBulkAction && isSelected, 31581 'is-hovered': isHovered, 31582 'has-bulk-actions': hasPossibleBulkAction 31583 }), 31584 onMouseEnter: handleMouseEnter, 31585 onMouseLeave: handleMouseLeave, 31586 onTouchStart: () => { 31587 isTouchDeviceRef.current = true; 31588 }, 31589 onClick: () => { 31590 if (!hasPossibleBulkAction) { 31591 return; 31592 } 31593 if (!isTouchDeviceRef.current && document.getSelection()?.type !== 'Range') { 31594 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [id]); 31595 } 31596 }, 31597 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 31598 className: "dataviews-view-table__checkbox-column", 31599 style: { 31600 width: '1%' 31601 }, 31602 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31603 className: "dataviews-view-table__cell-content-wrapper", 31604 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 31605 item: item, 31606 selection: selection, 31607 onChangeSelection: onChangeSelection, 31608 getItemId: getItemId, 31609 primaryField: primaryField, 31610 disabled: !hasPossibleBulkAction 31611 }) 31612 }) 31613 }), columns.map(column => { 31614 var _view$layout$styles$c; 31615 // Explicits picks the supported styles. 31616 const { 31617 width, 31618 maxWidth, 31619 minWidth 31620 } = (_view$layout$styles$c = view.layout?.styles?.[column]) !== null && _view$layout$styles$c !== void 0 ? _view$layout$styles$c : {}; 31621 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 31622 style: { 31623 width, 31624 maxWidth, 31625 minWidth 31626 }, 31627 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumn, { 31628 primaryField: primaryField, 31629 fields: fields, 31630 item: item, 31631 column: column, 31632 view: view 31633 }) 31634 }, column); 31635 }), !!actions?.length && 31636 /*#__PURE__*/ 31637 // Disable reason: we are not making the element interactive, 31638 // but preventing any click events from bubbling up to the 31639 // table row. This allows us to add a click handler to the row 31640 // itself (to toggle row selection) without erroneously 31641 // intercepting click events from ItemActions. 31642 /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ 31643 (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 31644 className: "dataviews-view-table__actions-column", 31645 onClick: e => e.stopPropagation(), 31646 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 31647 item: item, 31648 actions: actions 31649 }) 31650 }) 31651 /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */] 31652 }); 31653 } 31654 function ViewTable({ 31655 actions, 31656 data, 31657 fields, 31658 getItemId, 31659 isLoading = false, 31660 onChangeView, 31661 onChangeSelection, 31662 selection, 31663 setOpenedFilter, 31664 view 31665 }) { 31666 const headerMenuRefs = (0,external_wp_element_namespaceObject.useRef)(new Map()); 31667 const headerMenuToFocusRef = (0,external_wp_element_namespaceObject.useRef)(); 31668 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_namespaceObject.useState)(); 31669 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 31670 (0,external_wp_element_namespaceObject.useEffect)(() => { 31671 if (headerMenuToFocusRef.current) { 31672 headerMenuToFocusRef.current.focus(); 31673 headerMenuToFocusRef.current = undefined; 31674 } 31675 }); 31676 const tableNoticeId = (0,external_wp_element_namespaceObject.useId)(); 31677 if (nextHeaderMenuToFocus) { 31678 // If we need to force focus, we short-circuit rendering here 31679 // to prevent any additional work while we handle that. 31680 // Clearing out the focus directive is necessary to make sure 31681 // future renders don't cause unexpected focus jumps. 31682 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 31683 setNextHeaderMenuToFocus(undefined); 31684 return; 31685 } 31686 const onHide = field => { 31687 const hidden = headerMenuRefs.current.get(field.id); 31688 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : undefined; 31689 setNextHeaderMenuToFocus(fallback?.node); 31690 }; 31691 const columns = getVisibleFieldIds(view, fields); 31692 const hasData = !!data?.length; 31693 const primaryField = fields.find(field => field.id === view.layout?.primaryField); 31694 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31695 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("table", { 31696 className: "dataviews-view-table", 31697 "aria-busy": isLoading, 31698 "aria-describedby": tableNoticeId, 31699 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { 31700 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 31701 className: "dataviews-view-table__row", 31702 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 31703 className: "dataviews-view-table__checkbox-column", 31704 style: { 31705 width: '1%' 31706 }, 31707 scope: "col", 31708 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 31709 selection: selection, 31710 onChangeSelection: onChangeSelection, 31711 data: data, 31712 actions: actions, 31713 getItemId: getItemId 31714 }) 31715 }), columns.map((column, index) => { 31716 var _view$layout$styles$c2; 31717 // Explicits picks the supported styles. 31718 const { 31719 width, 31720 maxWidth, 31721 minWidth 31722 } = (_view$layout$styles$c2 = view.layout?.styles?.[column]) !== null && _view$layout$styles$c2 !== void 0 ? _view$layout$styles$c2 : {}; 31723 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 31724 style: { 31725 width, 31726 maxWidth, 31727 minWidth 31728 }, 31729 "aria-sort": view.sort?.field === column ? sortValues[view.sort.direction] : undefined, 31730 scope: "col", 31731 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { 31732 ref: node => { 31733 if (node) { 31734 headerMenuRefs.current.set(column, { 31735 node, 31736 fallback: columns[index > 0 ? index - 1 : 1] 31737 }); 31738 } else { 31739 headerMenuRefs.current.delete(column); 31740 } 31741 }, 31742 fieldId: column, 31743 view: view, 31744 fields: fields, 31745 onChangeView: onChangeView, 31746 onHide: onHide, 31747 setOpenedFilter: setOpenedFilter 31748 }) 31749 }, column); 31750 }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 31751 className: "dataviews-view-table__actions-column", 31752 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 31753 className: "dataviews-view-table-header", 31754 children: (0,external_wp_i18n_namespaceObject.__)('Actions') 31755 }) 31756 })] 31757 }) 31758 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { 31759 children: hasData && data.map((item, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableRow, { 31760 item: item, 31761 hasBulkActions: hasBulkActions, 31762 actions: actions, 31763 fields: fields, 31764 id: getItemId(item) || index.toString(), 31765 view: view, 31766 primaryField: primaryField, 31767 selection: selection, 31768 getItemId: getItemId, 31769 onChangeSelection: onChangeSelection 31770 }, getItemId(item))) 31771 })] 31772 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31773 className: dist_clsx({ 31774 'dataviews-loading': isLoading, 31775 'dataviews-no-results': !hasData && !isLoading 31776 }), 31777 id: tableNoticeId, 31778 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 31779 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 31780 }) 31781 })] 31782 }); 31783 } 31784 /* harmony default export */ const table = (ViewTable); 31785 31786 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js 31787 /** 31788 * External dependencies 31789 */ 31790 31791 31792 /** 31793 * WordPress dependencies 31794 */ 31795 31796 31797 31798 /** 31799 * Internal dependencies 31800 */ 31801 31802 31803 31804 31805 31806 31807 function GridItem({ 31808 selection, 31809 onChangeSelection, 31810 getItemId, 31811 item, 31812 actions, 31813 mediaField, 31814 primaryField, 31815 visibleFields, 31816 badgeFields, 31817 columnFields 31818 }) { 31819 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 31820 const id = getItemId(item); 31821 const isSelected = selection.includes(id); 31822 const renderedMediaField = mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 31823 item: item 31824 }) : null; 31825 const renderedPrimaryField = primaryField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(primaryField.render, { 31826 item: item 31827 }) : null; 31828 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 31829 spacing: 0, 31830 className: dist_clsx('dataviews-view-grid__card', { 31831 'is-selected': hasBulkAction && isSelected 31832 }), 31833 onClickCapture: event => { 31834 if (event.ctrlKey || event.metaKey) { 31835 event.stopPropagation(); 31836 event.preventDefault(); 31837 if (!hasBulkAction) { 31838 return; 31839 } 31840 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 31841 } 31842 }, 31843 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31844 className: "dataviews-view-grid__media", 31845 children: renderedMediaField 31846 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 31847 item: item, 31848 selection: selection, 31849 onChangeSelection: onChangeSelection, 31850 getItemId: getItemId, 31851 primaryField: primaryField, 31852 disabled: !hasBulkAction 31853 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31854 justify: "space-between", 31855 className: "dataviews-view-grid__title-actions", 31856 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 31857 className: "dataviews-view-grid__primary-field", 31858 children: renderedPrimaryField 31859 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 31860 item: item, 31861 actions: actions, 31862 isCompact: true 31863 })] 31864 }), !!badgeFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 31865 className: "dataviews-view-grid__badge-fields", 31866 spacing: 2, 31867 wrap: true, 31868 alignment: "top", 31869 justify: "flex-start", 31870 children: badgeFields.map(field => { 31871 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 31872 className: "dataviews-view-grid__field-value", 31873 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 31874 item: item 31875 }) 31876 }, field.id); 31877 }) 31878 }), !!visibleFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 31879 className: "dataviews-view-grid__fields", 31880 spacing: 1, 31881 children: visibleFields.map(field => { 31882 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 31883 className: dist_clsx('dataviews-view-grid__field', columnFields?.includes(field.id) ? 'is-column' : 'is-row'), 31884 gap: 1, 31885 justify: "flex-start", 31886 expanded: true, 31887 style: { 31888 height: 'auto' 31889 }, 31890 direction: columnFields?.includes(field.id) ? 'column' : 'row', 31891 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31892 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 31893 className: "dataviews-view-grid__field-name", 31894 children: field.header 31895 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 31896 className: "dataviews-view-grid__field-value", 31897 style: { 31898 maxHeight: 'none' 31899 }, 31900 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 31901 item: item 31902 }) 31903 })] 31904 }) 31905 }, field.id); 31906 }) 31907 })] 31908 }, id); 31909 } 31910 function ViewGrid({ 31911 actions, 31912 data, 31913 fields, 31914 getItemId, 31915 isLoading, 31916 onChangeSelection, 31917 selection, 31918 view, 31919 density 31920 }) { 31921 const mediaField = fields.find(field => field.id === view.layout?.mediaField); 31922 const primaryField = fields.find(field => field.id === view.layout?.primaryField); 31923 const viewFields = view.fields || fields.map(field => field.id); 31924 const { 31925 visibleFields, 31926 badgeFields 31927 } = fields.reduce((accumulator, field) => { 31928 if (!viewFields.includes(field.id) || [view.layout?.mediaField, view?.layout?.primaryField].includes(field.id)) { 31929 return accumulator; 31930 } 31931 // If the field is a badge field, add it to the badgeFields array 31932 // otherwise add it to the rest visibleFields array. 31933 const key = view.layout?.badgeFields?.includes(field.id) ? 'badgeFields' : 'visibleFields'; 31934 accumulator[key].push(field); 31935 return accumulator; 31936 }, { 31937 visibleFields: [], 31938 badgeFields: [] 31939 }); 31940 const hasData = !!data?.length; 31941 const gridStyle = density ? { 31942 gridTemplateColumns: `repeat($density}, minmax(0, 1fr))` 31943 } : {}; 31944 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31945 children: [hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 31946 gap: 8, 31947 columns: 2, 31948 alignment: "top", 31949 className: "dataviews-view-grid", 31950 style: gridStyle, 31951 "aria-busy": isLoading, 31952 children: data.map(item => { 31953 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItem, { 31954 selection: selection, 31955 onChangeSelection: onChangeSelection, 31956 getItemId: getItemId, 31957 item: item, 31958 actions: actions, 31959 mediaField: mediaField, 31960 primaryField: primaryField, 31961 visibleFields: visibleFields, 31962 badgeFields: badgeFields, 31963 columnFields: view.layout?.columnFields 31964 }, getItemId(item)); 31965 }) 31966 }), !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31967 className: dist_clsx({ 31968 'dataviews-loading': isLoading, 31969 'dataviews-no-results': !isLoading 31970 }), 31971 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 31972 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 31973 }) 31974 })] 31975 }); 31976 } 31977 31978 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js 31979 /** 31980 * External dependencies 31981 */ 31982 31983 31984 /** 31985 * WordPress dependencies 31986 */ 31987 31988 31989 31990 31991 31992 31993 31994 /** 31995 * Internal dependencies 31996 */ 31997 31998 31999 32000 32001 const { 32002 DropdownMenuV2: DropdownMenu 32003 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 32004 function generateItemWrapperCompositeId(idPrefix) { 32005 return `$idPrefix}-item-wrapper`; 32006 } 32007 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 32008 return `$idPrefix}-primary-action-$primaryActionId}`; 32009 } 32010 function generateDropdownTriggerCompositeId(idPrefix) { 32011 return `$idPrefix}-dropdown`; 32012 } 32013 function PrimaryActionGridCell({ 32014 idPrefix, 32015 primaryAction, 32016 item 32017 }) { 32018 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 32019 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 32020 const compositeItemId = generatePrimaryActionCompositeId(idPrefix, primaryAction.id); 32021 const label = typeof primaryAction.label === 'string' ? primaryAction.label : primaryAction.label([item]); 32022 return 'RenderModal' in primaryAction ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32023 role: "gridcell", 32024 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32025 id: compositeItemId, 32026 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32027 label: label, 32028 icon: primaryAction.icon, 32029 isDestructive: primaryAction.isDestructive, 32030 size: "small", 32031 onClick: () => setIsModalOpen(true) 32032 }), 32033 children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 32034 action: primaryAction, 32035 items: [item], 32036 closeModal: () => setIsModalOpen(false) 32037 }) 32038 }) 32039 }, primaryAction.id) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32040 role: "gridcell", 32041 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32042 id: compositeItemId, 32043 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32044 label: label, 32045 icon: primaryAction.icon, 32046 isDestructive: primaryAction.isDestructive, 32047 size: "small", 32048 onClick: () => { 32049 primaryAction.callback([item], { 32050 registry 32051 }); 32052 } 32053 }) 32054 }) 32055 }, primaryAction.id); 32056 } 32057 function ListItem({ 32058 actions, 32059 idPrefix, 32060 isSelected, 32061 item, 32062 mediaField, 32063 onSelect, 32064 primaryField, 32065 visibleFields, 32066 onDropdownTriggerKeyDown 32067 }) { 32068 const itemRef = (0,external_wp_element_namespaceObject.useRef)(null); 32069 const labelId = `$idPrefix}-label`; 32070 const descriptionId = `$idPrefix}-description`; 32071 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 32072 const handleHover = ({ 32073 type 32074 }) => { 32075 const isHover = type === 'mouseenter'; 32076 setIsHovered(isHover); 32077 }; 32078 (0,external_wp_element_namespaceObject.useEffect)(() => { 32079 if (isSelected) { 32080 itemRef.current?.scrollIntoView({ 32081 behavior: 'auto', 32082 block: 'nearest', 32083 inline: 'nearest' 32084 }); 32085 } 32086 }, [isSelected]); 32087 const { 32088 primaryAction, 32089 eligibleActions 32090 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 32091 // If an action is eligible for all items, doesn't need 32092 // to provide the `isEligible` function. 32093 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 32094 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 32095 return { 32096 primaryAction: _primaryActions?.[0], 32097 eligibleActions: _eligibleActions 32098 }; 32099 }, [actions, item]); 32100 const renderedMediaField = mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 32101 item: item 32102 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32103 className: "dataviews-view-list__media-placeholder" 32104 }); 32105 const renderedPrimaryField = primaryField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(primaryField.render, { 32106 item: item 32107 }) : null; 32108 const usedActions = eligibleActions?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32109 spacing: 3, 32110 className: "dataviews-view-list__item-actions", 32111 children: [primaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActionGridCell, { 32112 idPrefix: idPrefix, 32113 primaryAction: primaryAction, 32114 item: item 32115 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32116 role: "gridcell", 32117 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenu, { 32118 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32119 id: generateDropdownTriggerCompositeId(idPrefix), 32120 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32121 size: "small", 32122 icon: more_vertical, 32123 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 32124 accessibleWhenDisabled: true, 32125 disabled: !actions.length, 32126 onKeyDown: onDropdownTriggerKeyDown 32127 }) 32128 }), 32129 placement: "bottom-end", 32130 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, { 32131 actions: eligibleActions, 32132 item: item 32133 }) 32134 }) 32135 })] 32136 }); 32137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Row, { 32138 ref: itemRef, 32139 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {}), 32140 role: "row", 32141 className: dist_clsx({ 32142 'is-selected': isSelected, 32143 'is-hovered': isHovered 32144 }), 32145 onMouseEnter: handleHover, 32146 onMouseLeave: handleHover, 32147 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32148 className: "dataviews-view-list__item-wrapper", 32149 spacing: 0, 32150 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32151 role: "gridcell", 32152 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32153 id: generateItemWrapperCompositeId(idPrefix), 32154 "aria-pressed": isSelected, 32155 "aria-labelledby": labelId, 32156 "aria-describedby": descriptionId, 32157 className: "dataviews-view-list__item", 32158 onClick: () => onSelect(item) 32159 }) 32160 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32161 spacing: 3, 32162 justify: "start", 32163 alignment: "flex-start", 32164 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32165 className: "dataviews-view-list__media-wrapper", 32166 children: renderedMediaField 32167 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32168 spacing: 1, 32169 className: "dataviews-view-list__field-wrapper", 32170 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32171 spacing: 0, 32172 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32173 className: "dataviews-view-list__primary-field", 32174 id: labelId, 32175 children: renderedPrimaryField 32176 }), usedActions] 32177 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32178 className: "dataviews-view-list__fields", 32179 id: descriptionId, 32180 children: visibleFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 32181 className: "dataviews-view-list__field", 32182 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 32183 as: "span", 32184 className: "dataviews-view-list__field-label", 32185 children: field.label 32186 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 32187 className: "dataviews-view-list__field-value", 32188 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 32189 item: item 32190 }) 32191 })] 32192 }, field.id)) 32193 })] 32194 })] 32195 })] 32196 }) 32197 }); 32198 } 32199 function ViewList(props) { 32200 const { 32201 actions, 32202 data, 32203 fields, 32204 getItemId, 32205 isLoading, 32206 onChangeSelection, 32207 selection, 32208 view 32209 } = props; 32210 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, 'view-list'); 32211 const selectedItem = data?.findLast(item => selection.includes(getItemId(item))); 32212 const mediaField = fields.find(field => field.id === view.layout?.mediaField); 32213 const primaryField = fields.find(field => field.id === view.layout?.primaryField); 32214 const viewFields = view.fields || fields.map(field => field.id); 32215 const visibleFields = fields.filter(field => viewFields.includes(field.id) && ![view.layout?.primaryField, view.layout?.mediaField].includes(field.id)); 32216 const onSelect = item => onChangeSelection([getItemId(item)]); 32217 const generateCompositeItemIdPrefix = (0,external_wp_element_namespaceObject.useCallback)(item => `$baseId}-$getItemId(item)}`, [baseId, getItemId]); 32218 const isActiveCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((item, idToCheck) => { 32219 // All composite items use the same prefix in their IDs. 32220 return idToCheck.startsWith(generateCompositeItemIdPrefix(item)); 32221 }, [generateCompositeItemIdPrefix]); 32222 32223 // Controlled state for the active composite item. 32224 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(undefined); 32225 32226 // Update the active composite item when the selected item changes. 32227 (0,external_wp_element_namespaceObject.useEffect)(() => { 32228 if (selectedItem) { 32229 setActiveCompositeId(generateItemWrapperCompositeId(generateCompositeItemIdPrefix(selectedItem))); 32230 } 32231 }, [selectedItem, generateCompositeItemIdPrefix]); 32232 const activeItemIndex = data.findIndex(item => isActiveCompositeItem(item, activeCompositeId !== null && activeCompositeId !== void 0 ? activeCompositeId : '')); 32233 const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex); 32234 const isActiveIdInList = activeItemIndex !== -1; 32235 const selectCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((targetIndex, generateCompositeId) => { 32236 // Clamping between 0 and data.length - 1 to avoid out of bounds. 32237 const clampedIndex = Math.min(data.length - 1, Math.max(0, targetIndex)); 32238 if (!data[clampedIndex]) { 32239 return; 32240 } 32241 const itemIdPrefix = generateCompositeItemIdPrefix(data[clampedIndex]); 32242 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 32243 setActiveCompositeId(targetCompositeItemId); 32244 document.getElementById(targetCompositeItemId)?.focus(); 32245 }, [data, generateCompositeItemIdPrefix]); 32246 32247 // Select a new active composite item when the current active item 32248 // is removed from the list. 32249 (0,external_wp_element_namespaceObject.useEffect)(() => { 32250 const wasActiveIdInList = previousActiveItemIndex !== undefined && previousActiveItemIndex !== -1; 32251 if (!isActiveIdInList && wasActiveIdInList) { 32252 // By picking `previousActiveItemIndex` as the next item index, we are 32253 // basically picking the item that would have been after the deleted one. 32254 // If the previously active (and removed) item was the last of the list, 32255 // we will select the item before it — which is the new last item. 32256 selectCompositeItem(previousActiveItemIndex, generateItemWrapperCompositeId); 32257 } 32258 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 32259 32260 // Prevent the default behavior (open dropdown menu) and instead select the 32261 // dropdown menu trigger on the previous/next row. 32262 // https://github.com/ariakit/ariakit/issues/3768 32263 const onDropdownTriggerKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => { 32264 if (event.key === 'ArrowDown') { 32265 // Select the dropdown menu trigger item in the next row. 32266 event.preventDefault(); 32267 selectCompositeItem(activeItemIndex + 1, generateDropdownTriggerCompositeId); 32268 } 32269 if (event.key === 'ArrowUp') { 32270 // Select the dropdown menu trigger item in the previous row. 32271 event.preventDefault(); 32272 selectCompositeItem(activeItemIndex - 1, generateDropdownTriggerCompositeId); 32273 } 32274 }, [selectCompositeItem, activeItemIndex]); 32275 const hasData = data?.length; 32276 if (!hasData) { 32277 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32278 className: dist_clsx({ 32279 'dataviews-loading': isLoading, 32280 'dataviews-no-results': !hasData && !isLoading 32281 }), 32282 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 32283 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 32284 }) 32285 }); 32286 } 32287 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 32288 id: baseId, 32289 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {}), 32290 className: "dataviews-view-list", 32291 role: "grid", 32292 activeId: activeCompositeId, 32293 setActiveId: setActiveCompositeId, 32294 children: data.map(item => { 32295 const id = generateCompositeItemIdPrefix(item); 32296 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListItem, { 32297 idPrefix: id, 32298 actions: actions, 32299 item: item, 32300 isSelected: item === selectedItem, 32301 onSelect: onSelect, 32302 mediaField: mediaField, 32303 primaryField: primaryField, 32304 visibleFields: visibleFields, 32305 onDropdownTriggerKeyDown: onDropdownTriggerKeyDown 32306 }, id); 32307 }) 32308 }); 32309 } 32310 32311 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js 32312 /** 32313 * WordPress dependencies 32314 */ 32315 32316 32317 32318 /** 32319 * Internal dependencies 32320 */ 32321 32322 32323 32324 32325 const VIEW_LAYOUTS = [{ 32326 type: constants_LAYOUT_TABLE, 32327 label: (0,external_wp_i18n_namespaceObject.__)('Table'), 32328 component: table, 32329 icon: block_table 32330 }, { 32331 type: constants_LAYOUT_GRID, 32332 label: (0,external_wp_i18n_namespaceObject.__)('Grid'), 32333 component: ViewGrid, 32334 icon: library_category 32335 }, { 32336 type: constants_LAYOUT_LIST, 32337 label: (0,external_wp_i18n_namespaceObject.__)('List'), 32338 component: ViewList, 32339 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets 32340 }]; 32341 function getNotHidableFieldIds(view) { 32342 if (view.type === 'table') { 32343 var _view$layout$combined; 32344 return [view.layout?.primaryField].concat((_view$layout$combined = view.layout?.combinedFields?.flatMap(field => field.children)) !== null && _view$layout$combined !== void 0 ? _view$layout$combined : []).filter(item => !!item); 32345 } 32346 if (view.type === 'grid') { 32347 return [view.layout?.primaryField, view.layout?.mediaField].filter(item => !!item); 32348 } 32349 if (view.type === 'list') { 32350 return [view.layout?.primaryField, view.layout?.mediaField].filter(item => !!item); 32351 } 32352 return []; 32353 } 32354 function getCombinedFieldIds(view) { 32355 const combinedFields = []; 32356 if (view.type === constants_LAYOUT_TABLE && view.layout?.combinedFields) { 32357 view.layout.combinedFields.forEach(combination => { 32358 combinedFields.push(...combination.children); 32359 }); 32360 } 32361 return combinedFields; 32362 } 32363 function getVisibleFieldIds(view, fields) { 32364 const fieldsToExclude = getCombinedFieldIds(view); 32365 if (view.fields) { 32366 return view.fields.filter(id => !fieldsToExclude.includes(id)); 32367 } 32368 const visibleFields = []; 32369 if (view.type === constants_LAYOUT_TABLE && view.layout?.combinedFields) { 32370 visibleFields.push(...view.layout.combinedFields.map(({ 32371 id 32372 }) => id)); 32373 } 32374 visibleFields.push(...fields.filter(({ 32375 id 32376 }) => !fieldsToExclude.includes(id)).map(({ 32377 id 32378 }) => id)); 32379 return visibleFields; 32380 } 32381 function getHiddenFieldIds(view, fields) { 32382 const fieldsToExclude = [...getCombinedFieldIds(view), ...getVisibleFieldIds(view, fields)]; 32383 32384 // The media field does not need to be in the view.fields to be displayed. 32385 if (view.type === constants_LAYOUT_GRID && view.layout?.mediaField) { 32386 fieldsToExclude.push(view.layout?.mediaField); 32387 } 32388 if (view.type === constants_LAYOUT_LIST && view.layout?.mediaField) { 32389 fieldsToExclude.push(view.layout?.mediaField); 32390 } 32391 return fields.filter(({ 32392 id, 32393 enableHiding 32394 }) => !fieldsToExclude.includes(id) && enableHiding).map(({ 32395 id 32396 }) => id); 32397 } 32398 32399 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js 32400 /** 32401 * External dependencies 32402 */ 32403 32404 /** 32405 * WordPress dependencies 32406 */ 32407 32408 32409 /** 32410 * Internal dependencies 32411 */ 32412 32413 32414 32415 function DataViewsLayout() { 32416 const { 32417 actions = [], 32418 data, 32419 fields, 32420 getItemId, 32421 isLoading, 32422 view, 32423 onChangeView, 32424 selection, 32425 onChangeSelection, 32426 setOpenedFilter, 32427 density 32428 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32429 const ViewComponent = VIEW_LAYOUTS.find(v => v.type === view.type)?.component; 32430 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewComponent, { 32431 actions: actions, 32432 data: data, 32433 fields: fields, 32434 getItemId: getItemId, 32435 isLoading: isLoading, 32436 onChangeView: onChangeView, 32437 onChangeSelection: onChangeSelection, 32438 selection: selection, 32439 setOpenedFilter: setOpenedFilter, 32440 view: view, 32441 density: density 32442 }); 32443 } 32444 32445 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js 32446 /** 32447 * WordPress dependencies 32448 */ 32449 32450 32451 32452 32453 32454 /** 32455 * Internal dependencies 32456 */ 32457 32458 32459 32460 function DataViewsPagination() { 32461 var _view$page; 32462 const { 32463 view, 32464 onChangeView, 32465 paginationInfo: { 32466 totalItems = 0, 32467 totalPages 32468 } 32469 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32470 if (!totalItems || !totalPages) { 32471 return null; 32472 } 32473 const currentPage = (_view$page = view.page) !== null && _view$page !== void 0 ? _view$page : 1; 32474 const pageSelectOptions = Array.from(Array(totalPages)).map((_, i) => { 32475 const page = i + 1; 32476 return { 32477 value: page.toString(), 32478 label: page.toString(), 32479 'aria-label': currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)( 32480 // translators: Current page number in total number of pages 32481 (0,external_wp_i18n_namespaceObject.__)('Page %1$s of %2$s'), currentPage, totalPages) : page.toString() 32482 }; 32483 }); 32484 return !!totalItems && totalPages !== 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32485 expanded: false, 32486 className: "dataviews-pagination", 32487 justify: "end", 32488 spacing: 6, 32489 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 32490 justify: "flex-start", 32491 expanded: false, 32492 spacing: 1, 32493 className: "dataviews-pagination__page-select", 32494 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( 32495 // translators: 1: Current page number, 2: Total number of pages. 32496 (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { 32497 div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32498 "aria-hidden": true 32499 }), 32500 CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 32501 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), 32502 value: currentPage.toString(), 32503 options: pageSelectOptions, 32504 onChange: newValue => { 32505 onChangeView({ 32506 ...view, 32507 page: +newValue 32508 }); 32509 }, 32510 size: "small", 32511 __nextHasNoMarginBottom: true, 32512 variant: "minimal" 32513 }) 32514 }) 32515 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32516 expanded: false, 32517 spacing: 1, 32518 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32519 onClick: () => onChangeView({ 32520 ...view, 32521 page: currentPage - 1 32522 }), 32523 disabled: currentPage === 1, 32524 accessibleWhenDisabled: true, 32525 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 32526 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 32527 showTooltip: true, 32528 size: "compact", 32529 tooltipPosition: "top" 32530 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32531 onClick: () => onChangeView({ 32532 ...view, 32533 page: currentPage + 1 32534 }), 32535 disabled: currentPage >= totalPages, 32536 accessibleWhenDisabled: true, 32537 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 32538 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 32539 showTooltip: true, 32540 size: "compact", 32541 tooltipPosition: "top" 32542 })] 32543 })] 32544 }); 32545 } 32546 /* harmony default export */ const dataviews_pagination = ((0,external_wp_element_namespaceObject.memo)(DataViewsPagination)); 32547 32548 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js 32549 /** 32550 * WordPress dependencies 32551 */ 32552 32553 32554 32555 /** 32556 * Internal dependencies 32557 */ 32558 32559 32560 32561 32562 32563 32564 const dataviews_footer_EMPTY_ARRAY = []; 32565 function DataViewsFooter() { 32566 const { 32567 view, 32568 paginationInfo: { 32569 totalItems = 0, 32570 totalPages 32571 }, 32572 data, 32573 actions = dataviews_footer_EMPTY_ARRAY 32574 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32575 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type); 32576 if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) { 32577 return null; 32578 } 32579 return !!totalItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32580 expanded: false, 32581 justify: "end", 32582 className: "dataviews-footer", 32583 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination, {})] 32584 }); 32585 } 32586 32587 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js 32588 /** 32589 * WordPress dependencies 32590 */ 32591 32592 32593 32594 32595 32596 /** 32597 * Internal dependencies 32598 */ 32599 32600 32601 const DataViewsSearch = (0,external_wp_element_namespaceObject.memo)(function Search({ 32602 label 32603 }) { 32604 const { 32605 view, 32606 onChangeView 32607 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32608 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(view.search); 32609 (0,external_wp_element_namespaceObject.useEffect)(() => { 32610 var _view$search; 32611 setSearch((_view$search = view.search) !== null && _view$search !== void 0 ? _view$search : ''); 32612 }, [view.search, setSearch]); 32613 const onChangeViewRef = (0,external_wp_element_namespaceObject.useRef)(onChangeView); 32614 const viewRef = (0,external_wp_element_namespaceObject.useRef)(view); 32615 (0,external_wp_element_namespaceObject.useEffect)(() => { 32616 onChangeViewRef.current = onChangeView; 32617 viewRef.current = view; 32618 }, [onChangeView, view]); 32619 (0,external_wp_element_namespaceObject.useEffect)(() => { 32620 if (debouncedSearch !== viewRef.current?.search) { 32621 onChangeViewRef.current({ 32622 ...viewRef.current, 32623 page: 1, 32624 search: debouncedSearch 32625 }); 32626 } 32627 }, [debouncedSearch]); 32628 const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)('Search'); 32629 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 32630 className: "dataviews-search", 32631 __nextHasNoMarginBottom: true, 32632 onChange: setSearch, 32633 value: search, 32634 label: searchLabel, 32635 placeholder: searchLabel, 32636 size: "compact" 32637 }); 32638 }); 32639 /* harmony default export */ const dataviews_search = (DataViewsSearch); 32640 32641 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 32642 /** 32643 * WordPress dependencies 32644 */ 32645 32646 32647 const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 32648 viewBox: "0 0 24 24", 32649 xmlns: "http://www.w3.org/2000/svg", 32650 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 32651 d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" 32652 }) 32653 }); 32654 /* harmony default export */ const chevron_up = (chevronUp); 32655 32656 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 32657 /** 32658 * WordPress dependencies 32659 */ 32660 32661 32662 const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 32663 viewBox: "0 0 24 24", 32664 xmlns: "http://www.w3.org/2000/svg", 32665 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 32666 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" 32667 }) 32668 }); 32669 /* harmony default export */ const chevron_down = (chevronDown); 32670 32671 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js 32672 /** 32673 * WordPress dependencies 32674 */ 32675 32676 32677 const cog = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 32678 xmlns: "http://www.w3.org/2000/svg", 32679 viewBox: "0 0 24 24", 32680 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 32681 fillRule: "evenodd", 32682 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", 32683 clipRule: "evenodd" 32684 }) 32685 }); 32686 /* harmony default export */ const library_cog = (cog); 32687 32688 ;// CONCATENATED MODULE: external ["wp","warning"] 32689 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 32690 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 32691 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/density-picker.js 32692 /** 32693 * WordPress dependencies 32694 */ 32695 32696 32697 32698 32699 32700 const viewportBreaks = { 32701 xhuge: { 32702 min: 3, 32703 max: 6, 32704 default: 5 32705 }, 32706 huge: { 32707 min: 2, 32708 max: 4, 32709 default: 4 32710 }, 32711 xlarge: { 32712 min: 2, 32713 max: 3, 32714 default: 3 32715 }, 32716 large: { 32717 min: 1, 32718 max: 2, 32719 default: 2 32720 }, 32721 mobile: { 32722 min: 1, 32723 max: 2, 32724 default: 2 32725 } 32726 }; 32727 function useViewPortBreakpoint() { 32728 const isXHuge = (0,external_wp_compose_namespaceObject.useViewportMatch)('xhuge', '>='); 32729 const isHuge = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>='); 32730 const isXlarge = (0,external_wp_compose_namespaceObject.useViewportMatch)('xlarge', '>='); 32731 const isLarge = (0,external_wp_compose_namespaceObject.useViewportMatch)('large', '>='); 32732 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('mobile', '>='); 32733 if (isXHuge) { 32734 return 'xhuge'; 32735 } 32736 if (isHuge) { 32737 return 'huge'; 32738 } 32739 if (isXlarge) { 32740 return 'xlarge'; 32741 } 32742 if (isLarge) { 32743 return 'large'; 32744 } 32745 if (isMobile) { 32746 return 'mobile'; 32747 } 32748 return null; 32749 } 32750 function DensityPicker({ 32751 density, 32752 setDensity 32753 }) { 32754 const viewport = useViewPortBreakpoint(); 32755 (0,external_wp_element_namespaceObject.useEffect)(() => { 32756 setDensity(_density => { 32757 if (!viewport || !_density) { 32758 return 0; 32759 } 32760 const breakValues = viewportBreaks[viewport]; 32761 if (_density < breakValues.min) { 32762 return breakValues.min; 32763 } 32764 if (_density > breakValues.max) { 32765 return breakValues.max; 32766 } 32767 return _density; 32768 }); 32769 }, [setDensity, viewport]); 32770 const breakValues = viewportBreaks[viewport || 'mobile']; 32771 const densityToUse = density || breakValues.default; 32772 const marks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.from({ 32773 length: breakValues.max - breakValues.min + 1 32774 }, (_, i) => { 32775 return { 32776 value: breakValues.min + i 32777 }; 32778 }), [breakValues]); 32779 if (!viewport) { 32780 return null; 32781 } 32782 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { 32783 __nextHasNoMarginBottom: true, 32784 __next40pxDefaultSize: true, 32785 showTooltip: false, 32786 label: (0,external_wp_i18n_namespaceObject.__)('Preview size'), 32787 value: breakValues.max + breakValues.min - densityToUse, 32788 marks: marks, 32789 min: breakValues.min, 32790 max: breakValues.max, 32791 withInputField: false, 32792 onChange: (value = 0) => { 32793 setDensity(breakValues.max + breakValues.min - value); 32794 }, 32795 step: 1 32796 }); 32797 } 32798 32799 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js 32800 /** 32801 * External dependencies 32802 */ 32803 32804 /** 32805 * WordPress dependencies 32806 */ 32807 32808 32809 32810 32811 32812 32813 /** 32814 * Internal dependencies 32815 */ 32816 32817 32818 32819 32820 32821 32822 32823 32824 const { 32825 DropdownMenuV2: dataviews_view_config_DropdownMenuV2 32826 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 32827 function ViewTypeMenu({ 32828 defaultLayouts = { 32829 list: {}, 32830 grid: {}, 32831 table: {} 32832 } 32833 }) { 32834 const { 32835 view, 32836 onChangeView 32837 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32838 const availableLayouts = Object.keys(defaultLayouts); 32839 if (availableLayouts.length <= 1) { 32840 return null; 32841 } 32842 const activeView = VIEW_LAYOUTS.find(v => view.type === v.type); 32843 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_DropdownMenuV2, { 32844 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32845 size: "compact", 32846 icon: activeView?.icon, 32847 label: (0,external_wp_i18n_namespaceObject.__)('Layout') 32848 }), 32849 children: availableLayouts.map(layout => { 32850 const config = VIEW_LAYOUTS.find(v => v.type === layout); 32851 if (!config) { 32852 return null; 32853 } 32854 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_DropdownMenuV2.RadioItem, { 32855 value: layout, 32856 name: "view-actions-available-view", 32857 checked: layout === view.type, 32858 hideOnClick: true, 32859 onChange: e => { 32860 switch (e.target.value) { 32861 case 'list': 32862 case 'grid': 32863 case 'table': 32864 return onChangeView({ 32865 ...view, 32866 type: e.target.value, 32867 ...defaultLayouts[e.target.value] 32868 }); 32869 } 32870 true ? external_wp_warning_default()('Invalid dataview') : 0; 32871 }, 32872 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_DropdownMenuV2.ItemLabel, { 32873 children: config.label 32874 }) 32875 }, layout); 32876 }) 32877 }); 32878 } 32879 function SortFieldControl() { 32880 const { 32881 view, 32882 fields, 32883 onChangeView 32884 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32885 const orderOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 32886 const sortableFields = fields.filter(field => field.enableSorting !== false); 32887 return sortableFields.map(field => { 32888 return { 32889 label: field.label, 32890 value: field.id 32891 }; 32892 }); 32893 }, [fields]); 32894 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 32895 __nextHasNoMarginBottom: true, 32896 __next40pxDefaultSize: true, 32897 label: (0,external_wp_i18n_namespaceObject.__)('Sort by'), 32898 value: view.sort?.field, 32899 options: orderOptions, 32900 onChange: value => { 32901 onChangeView({ 32902 ...view, 32903 sort: { 32904 direction: view?.sort?.direction || 'desc', 32905 field: value 32906 } 32907 }); 32908 } 32909 }); 32910 } 32911 function SortDirectionControl() { 32912 const { 32913 view, 32914 fields, 32915 onChangeView 32916 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32917 const sortableFields = fields.filter(field => field.enableSorting !== false); 32918 if (sortableFields.length === 0) { 32919 return null; 32920 } 32921 let value = view.sort?.direction; 32922 if (!value && view.sort?.field) { 32923 value = 'desc'; 32924 } 32925 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 32926 className: "dataviews-view-config__sort-direction", 32927 __nextHasNoMarginBottom: true, 32928 __next40pxDefaultSize: true, 32929 isBlock: true, 32930 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 32931 value: value, 32932 onChange: newDirection => { 32933 if (newDirection === 'asc' || newDirection === 'desc') { 32934 onChangeView({ 32935 ...view, 32936 sort: { 32937 direction: newDirection, 32938 field: view.sort?.field || 32939 // If there is no field assigned as the sorting field assign the first sortable field. 32940 fields.find(field => field.enableSorting !== false)?.id || '' 32941 } 32942 }); 32943 return; 32944 } 32945 true ? external_wp_warning_default()('Invalid direction') : 0; 32946 }, 32947 children: SORTING_DIRECTIONS.map(direction => { 32948 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { 32949 value: direction, 32950 icon: sortIcons[direction], 32951 label: sortLabels[direction] 32952 }, direction); 32953 }) 32954 }); 32955 } 32956 const PAGE_SIZE_VALUES = [10, 20, 50, 100]; 32957 function ItemsPerPageControl() { 32958 const { 32959 view, 32960 onChangeView 32961 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32962 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 32963 __nextHasNoMarginBottom: true, 32964 __next40pxDefaultSize: true, 32965 isBlock: true, 32966 label: (0,external_wp_i18n_namespaceObject.__)('Items per page'), 32967 value: view.perPage || 10, 32968 disabled: !view?.sort?.field, 32969 onChange: newItemsPerPage => { 32970 const newItemsPerPageNumber = typeof newItemsPerPage === 'number' || newItemsPerPage === undefined ? newItemsPerPage : parseInt(newItemsPerPage, 10); 32971 onChangeView({ 32972 ...view, 32973 perPage: newItemsPerPageNumber, 32974 page: 1 32975 }); 32976 }, 32977 children: PAGE_SIZE_VALUES.map(value => { 32978 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 32979 value: value, 32980 label: value.toString() 32981 }, value); 32982 }) 32983 }); 32984 } 32985 function FieldItem({ 32986 field: { 32987 id, 32988 label, 32989 index, 32990 isVisible, 32991 isHidable 32992 }, 32993 fields, 32994 view, 32995 onChangeView 32996 }) { 32997 const visibleFieldIds = getVisibleFieldIds(view, fields); 32998 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 32999 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33000 expanded: true, 33001 className: `dataviews-field-control__field dataviews-field-control__field-$id}`, 33002 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33003 children: label 33004 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33005 justify: "flex-end", 33006 expanded: false, 33007 className: "dataviews-field-control__actions", 33008 children: [view.type === constants_LAYOUT_TABLE && isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33009 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33010 disabled: index < 1, 33011 accessibleWhenDisabled: true, 33012 size: "compact", 33013 onClick: () => { 33014 var _visibleFieldIds$slic; 33015 onChangeView({ 33016 ...view, 33017 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), id, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 33018 }); 33019 }, 33020 icon: chevron_up, 33021 label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33022 (0,external_wp_i18n_namespaceObject.__)('Move %s up'), label) 33023 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33024 disabled: index >= visibleFieldIds.length - 1, 33025 accessibleWhenDisabled: true, 33026 size: "compact", 33027 onClick: () => { 33028 var _visibleFieldIds$slic2; 33029 onChangeView({ 33030 ...view, 33031 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], id, ...visibleFieldIds.slice(index + 2)] 33032 }); 33033 }, 33034 icon: chevron_down, 33035 label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33036 (0,external_wp_i18n_namespaceObject.__)('Move %s down'), label) 33037 }), ' '] 33038 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33039 className: "dataviews-field-control__field-visibility-button", 33040 disabled: !isHidable, 33041 accessibleWhenDisabled: true, 33042 size: "compact", 33043 onClick: () => { 33044 onChangeView({ 33045 ...view, 33046 fields: isVisible ? visibleFieldIds.filter(fieldId => fieldId !== id) : [...visibleFieldIds, id] 33047 }); 33048 // Focus the visibility button to avoid focus loss. 33049 // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. 33050 // eslint-disable-next-line @wordpress/react-no-unsafe-timeout 33051 setTimeout(() => { 33052 const element = document.querySelector(`.dataviews-field-control__field-$id} .dataviews-field-control__field-visibility-button`); 33053 if (element instanceof HTMLElement) { 33054 element.focus(); 33055 } 33056 }, 50); 33057 }, 33058 icon: isVisible ? library_seen : library_unseen, 33059 label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33060 (0,external_wp_i18n_namespaceObject.__)('Hide %s'), label) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33061 (0,external_wp_i18n_namespaceObject.__)('Show %s'), label) 33062 })] 33063 })] 33064 }) 33065 }, id); 33066 } 33067 function FieldControl() { 33068 const { 33069 view, 33070 fields, 33071 onChangeView 33072 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 33073 const visibleFieldIds = (0,external_wp_element_namespaceObject.useMemo)(() => getVisibleFieldIds(view, fields), [view, fields]); 33074 const hiddenFieldIds = (0,external_wp_element_namespaceObject.useMemo)(() => getHiddenFieldIds(view, fields), [view, fields]); 33075 const notHidableFieldIds = (0,external_wp_element_namespaceObject.useMemo)(() => getNotHidableFieldIds(view), [view]); 33076 const visibleFields = fields.filter(({ 33077 id 33078 }) => visibleFieldIds.includes(id)).map(({ 33079 id, 33080 label, 33081 enableHiding 33082 }) => { 33083 return { 33084 id, 33085 label, 33086 index: visibleFieldIds.indexOf(id), 33087 isVisible: true, 33088 isHidable: notHidableFieldIds.includes(id) ? false : enableHiding 33089 }; 33090 }); 33091 if (view.type === constants_LAYOUT_TABLE && view.layout?.combinedFields) { 33092 view.layout.combinedFields.forEach(({ 33093 id, 33094 label 33095 }) => { 33096 visibleFields.push({ 33097 id, 33098 label, 33099 index: visibleFieldIds.indexOf(id), 33100 isVisible: true, 33101 isHidable: notHidableFieldIds.includes(id) 33102 }); 33103 }); 33104 } 33105 visibleFields.sort((a, b) => a.index - b.index); 33106 const hiddenFields = fields.filter(({ 33107 id 33108 }) => hiddenFieldIds.includes(id)).map(({ 33109 id, 33110 label, 33111 enableHiding 33112 }, index) => { 33113 return { 33114 id, 33115 label, 33116 index, 33117 isVisible: false, 33118 isHidable: enableHiding 33119 }; 33120 }); 33121 if (!visibleFields?.length && !hiddenFields?.length) { 33122 return null; 33123 } 33124 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33125 spacing: 6, 33126 className: "dataviews-field-control", 33127 children: [!!visibleFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 33128 isBordered: true, 33129 isSeparated: true, 33130 children: visibleFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 33131 field: field, 33132 fields: fields, 33133 view: view, 33134 onChangeView: onChangeView 33135 }, field.id)) 33136 }), !!hiddenFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33137 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33138 spacing: 4, 33139 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 33140 style: { 33141 margin: 0 33142 }, 33143 children: (0,external_wp_i18n_namespaceObject.__)('Hidden') 33144 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 33145 isBordered: true, 33146 isSeparated: true, 33147 children: hiddenFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 33148 field: field, 33149 fields: fields, 33150 view: view, 33151 onChangeView: onChangeView 33152 }, field.id)) 33153 })] 33154 }) 33155 })] 33156 }); 33157 } 33158 function SettingsSection({ 33159 title, 33160 description, 33161 children 33162 }) { 33163 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 33164 columns: 12, 33165 className: "dataviews-settings-section", 33166 gap: 4, 33167 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33168 className: "dataviews-settings-section__sidebar", 33169 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 33170 level: 2, 33171 className: "dataviews-settings-section__title", 33172 children: title 33173 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 33174 variant: "muted", 33175 className: "dataviews-settings-section__description", 33176 children: description 33177 })] 33178 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 33179 columns: 8, 33180 gap: 4, 33181 className: "dataviews-settings-section__content", 33182 children: children 33183 })] 33184 }); 33185 } 33186 function DataviewsViewConfigContent({ 33187 density, 33188 setDensity 33189 }) { 33190 const { 33191 view 33192 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 33193 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33194 className: "dataviews-view-config", 33195 spacing: 6, 33196 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { 33197 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 33198 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33199 expanded: true, 33200 className: "is-divided-in-two", 33201 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {})] 33202 }), view.type === constants_LAYOUT_GRID && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DensityPicker, { 33203 density: density, 33204 setDensity: setDensity 33205 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {})] 33206 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { 33207 title: (0,external_wp_i18n_namespaceObject.__)('Properties'), 33208 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) 33209 })] 33210 }); 33211 } 33212 function _DataViewsViewConfig({ 33213 density, 33214 setDensity, 33215 defaultLayouts = { 33216 list: {}, 33217 grid: {}, 33218 table: {} 33219 } 33220 }) { 33221 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33222 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, { 33223 defaultLayouts: defaultLayouts 33224 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 33225 popoverProps: { 33226 placement: 'bottom-end', 33227 offset: 9 33228 }, 33229 contentClassName: "dataviews-view-config", 33230 renderToggle: ({ 33231 onToggle 33232 }) => { 33233 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33234 size: "compact", 33235 icon: library_cog, 33236 label: (0,external_wp_i18n_namespaceObject._x)('View options', 'View is used as a noun'), 33237 onClick: onToggle 33238 }); 33239 }, 33240 renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigContent, { 33241 density: density, 33242 setDensity: setDensity 33243 }) 33244 })] 33245 }); 33246 } 33247 const DataViewsViewConfig = (0,external_wp_element_namespaceObject.memo)(_DataViewsViewConfig); 33248 /* harmony default export */ const dataviews_view_config = (DataViewsViewConfig); 33249 33250 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js 33251 /** 33252 * External dependencies 33253 */ 33254 33255 /** 33256 * WordPress dependencies 33257 */ 33258 33259 33260 33261 /** 33262 * Internal dependencies 33263 */ 33264 33265 33266 33267 33268 33269 33270 33271 33272 33273 const defaultGetItemId = item => item.id; 33274 function DataViews({ 33275 view, 33276 onChangeView, 33277 fields, 33278 search = true, 33279 searchLabel = undefined, 33280 actions = [], 33281 data, 33282 getItemId = defaultGetItemId, 33283 isLoading = false, 33284 paginationInfo, 33285 defaultLayouts, 33286 selection: selectionProperty, 33287 onChangeSelection, 33288 header 33289 }) { 33290 const [selectionState, setSelectionState] = (0,external_wp_element_namespaceObject.useState)([]); 33291 const [density, setDensity] = (0,external_wp_element_namespaceObject.useState)(0); 33292 const isUncontrolled = selectionProperty === undefined || onChangeSelection === undefined; 33293 const selection = isUncontrolled ? selectionState : selectionProperty; 33294 const [openedFilter, setOpenedFilter] = (0,external_wp_element_namespaceObject.useState)(null); 33295 function setSelectionWithChange(value) { 33296 const newValue = typeof value === 'function' ? value(selection) : value; 33297 if (isUncontrolled) { 33298 setSelectionState(newValue); 33299 } 33300 if (onChangeSelection) { 33301 onChangeSelection(newValue); 33302 } 33303 } 33304 const _fields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); 33305 const _selection = (0,external_wp_element_namespaceObject.useMemo)(() => { 33306 return selection.filter(id => data.some(item => getItemId(item) === id)); 33307 }, [selection, data, getItemId]); 33308 const filters = useFilters(_fields, view); 33309 const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_namespaceObject.useState)(() => (filters || []).some(filter => filter.isPrimary)); 33310 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_context.Provider, { 33311 value: { 33312 view, 33313 onChangeView, 33314 fields: _fields, 33315 actions, 33316 data, 33317 isLoading, 33318 paginationInfo, 33319 selection: _selection, 33320 onChangeSelection: setSelectionWithChange, 33321 openedFilter, 33322 setOpenedFilter, 33323 getItemId, 33324 density 33325 }, 33326 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33327 className: "dataviews-wrapper", 33328 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33329 alignment: "top", 33330 justify: "space-between", 33331 className: "dataviews__view-actions", 33332 spacing: 1, 33333 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33334 justify: "start", 33335 expanded: false, 33336 className: "dataviews__search", 33337 children: [search && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search, { 33338 label: searchLabel 33339 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterVisibilityToggle, { 33340 filters: filters, 33341 view: view, 33342 onChangeView: onChangeView, 33343 setOpenedFilter: setOpenedFilter, 33344 setIsShowingFilter: setIsShowingFilter, 33345 isShowingFilter: isShowingFilter 33346 })] 33347 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33348 spacing: 1, 33349 expanded: false, 33350 style: { 33351 flexShrink: 0 33352 }, 33353 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config, { 33354 defaultLayouts: defaultLayouts, 33355 density: density, 33356 setDensity: setDensity 33357 }), header] 33358 })] 33359 }), isShowingFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_filters, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {})] 33360 }) 33361 }); 33362 } 33363 33364 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 33365 /** 33366 * WordPress dependencies 33367 */ 33368 33369 33370 const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33371 width: "24", 33372 height: "24", 33373 xmlns: "http://www.w3.org/2000/svg", 33374 viewBox: "0 0 24 24", 33375 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33376 fillRule: "evenodd", 33377 clipRule: "evenodd", 33378 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" 33379 }) 33380 }); 33381 /* harmony default export */ const drawer_right = (drawerRight); 33382 33383 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page/header.js 33384 /** 33385 * WordPress dependencies 33386 */ 33387 33388 33389 /** 33390 * Internal dependencies 33391 */ 33392 33393 33394 function Header({ 33395 title, 33396 subTitle, 33397 actions 33398 }) { 33399 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33400 className: "edit-site-page-header", 33401 as: "header", 33402 spacing: 0, 33403 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33404 className: "edit-site-page-header__page-title", 33405 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 33406 as: "h2", 33407 level: 3, 33408 weight: 500, 33409 className: "edit-site-page-header__title", 33410 truncate: true, 33411 children: title 33412 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 33413 className: "edit-site-page-header__actions", 33414 children: actions 33415 })] 33416 }), subTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 33417 variant: "muted", 33418 as: "p", 33419 className: "edit-site-page-header__sub-title", 33420 children: subTitle 33421 })] 33422 }); 33423 } 33424 33425 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page/index.js 33426 /** 33427 * External dependencies 33428 */ 33429 33430 33431 /** 33432 * WordPress dependencies 33433 */ 33434 33435 33436 /** 33437 * Internal dependencies 33438 */ 33439 33440 33441 33442 33443 const { 33444 NavigableRegion: page_NavigableRegion 33445 } = unlock(external_wp_editor_namespaceObject.privateApis); 33446 function Page({ 33447 title, 33448 subTitle, 33449 actions, 33450 children, 33451 className, 33452 hideTitleFromUI = false 33453 }) { 33454 const classes = dist_clsx('edit-site-page', className); 33455 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_NavigableRegion, { 33456 className: classes, 33457 ariaLabel: title, 33458 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33459 className: "edit-site-page-content", 33460 children: [!hideTitleFromUI && title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, { 33461 title: title, 33462 subTitle: subTitle, 33463 actions: actions 33464 }), children] 33465 }) 33466 }); 33467 } 33468 33469 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pages.js 33470 /** 33471 * WordPress dependencies 33472 */ 33473 33474 33475 33476 const pages = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 33477 xmlns: "http://www.w3.org/2000/svg", 33478 viewBox: "0 0 24 24", 33479 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33480 d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" 33481 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33482 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" 33483 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33484 d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" 33485 })] 33486 }); 33487 /* harmony default export */ const library_pages = (pages); 33488 33489 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/published.js 33490 /** 33491 * WordPress dependencies 33492 */ 33493 33494 33495 const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33496 xmlns: "http://www.w3.org/2000/svg", 33497 viewBox: "0 0 24 24", 33498 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33499 fillRule: "evenodd", 33500 clipRule: "evenodd", 33501 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" 33502 }) 33503 }); 33504 /* harmony default export */ const library_published = (published); 33505 33506 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/scheduled.js 33507 /** 33508 * WordPress dependencies 33509 */ 33510 33511 33512 const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33513 xmlns: "http://www.w3.org/2000/svg", 33514 viewBox: "0 0 24 24", 33515 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33516 fillRule: "evenodd", 33517 clipRule: "evenodd", 33518 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" 33519 }) 33520 }); 33521 /* harmony default export */ const library_scheduled = (scheduled); 33522 33523 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drafts.js 33524 /** 33525 * WordPress dependencies 33526 */ 33527 33528 33529 const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33530 xmlns: "http://www.w3.org/2000/svg", 33531 viewBox: "0 0 24 24", 33532 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33533 fillRule: "evenodd", 33534 clipRule: "evenodd", 33535 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" 33536 }) 33537 }); 33538 /* harmony default export */ const library_drafts = (drafts); 33539 33540 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pending.js 33541 /** 33542 * WordPress dependencies 33543 */ 33544 33545 33546 const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33547 xmlns: "http://www.w3.org/2000/svg", 33548 viewBox: "0 0 24 24", 33549 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33550 fillRule: "evenodd", 33551 clipRule: "evenodd", 33552 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" 33553 }) 33554 }); 33555 /* harmony default export */ const library_pending = (pending); 33556 33557 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 33558 /** 33559 * WordPress dependencies 33560 */ 33561 33562 33563 const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33564 xmlns: "http://www.w3.org/2000/svg", 33565 viewBox: "0 0 24 24", 33566 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33567 fillRule: "evenodd", 33568 clipRule: "evenodd", 33569 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" 33570 }) 33571 }); 33572 /* harmony default export */ const not_allowed = (notAllowed); 33573 33574 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/default-views.js 33575 /** 33576 * WordPress dependencies 33577 */ 33578 33579 33580 33581 33582 33583 33584 /** 33585 * Internal dependencies 33586 */ 33587 33588 const defaultLayouts = { 33589 [LAYOUT_TABLE]: { 33590 layout: { 33591 primaryField: 'title', 33592 styles: { 33593 'featured-image': { 33594 width: '1%' 33595 }, 33596 title: { 33597 maxWidth: 300 33598 } 33599 } 33600 } 33601 }, 33602 [LAYOUT_GRID]: { 33603 layout: { 33604 mediaField: 'featured-image', 33605 primaryField: 'title' 33606 } 33607 }, 33608 [LAYOUT_LIST]: { 33609 layout: { 33610 primaryField: 'title', 33611 mediaField: 'featured-image' 33612 } 33613 } 33614 }; 33615 const DEFAULT_POST_BASE = { 33616 type: LAYOUT_LIST, 33617 search: '', 33618 filters: [], 33619 page: 1, 33620 perPage: 20, 33621 sort: { 33622 field: 'date', 33623 direction: 'desc' 33624 }, 33625 fields: ['title', 'author', 'status'], 33626 layout: defaultLayouts[LAYOUT_LIST].layout 33627 }; 33628 function useDefaultViews({ 33629 postType 33630 }) { 33631 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => { 33632 const { 33633 getPostType 33634 } = select(external_wp_coreData_namespaceObject.store); 33635 return getPostType(postType)?.labels; 33636 }, [postType]); 33637 return (0,external_wp_element_namespaceObject.useMemo)(() => { 33638 return [{ 33639 title: labels?.all_items || (0,external_wp_i18n_namespaceObject.__)('All items'), 33640 slug: 'all', 33641 icon: library_pages, 33642 view: DEFAULT_POST_BASE 33643 }, { 33644 title: (0,external_wp_i18n_namespaceObject.__)('Published'), 33645 slug: 'published', 33646 icon: library_published, 33647 view: DEFAULT_POST_BASE, 33648 filters: [{ 33649 field: 'status', 33650 operator: OPERATOR_IS_ANY, 33651 value: 'publish' 33652 }] 33653 }, { 33654 title: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 33655 slug: 'future', 33656 icon: library_scheduled, 33657 view: DEFAULT_POST_BASE, 33658 filters: [{ 33659 field: 'status', 33660 operator: OPERATOR_IS_ANY, 33661 value: 'future' 33662 }] 33663 }, { 33664 title: (0,external_wp_i18n_namespaceObject.__)('Drafts'), 33665 slug: 'drafts', 33666 icon: library_drafts, 33667 view: DEFAULT_POST_BASE, 33668 filters: [{ 33669 field: 'status', 33670 operator: OPERATOR_IS_ANY, 33671 value: 'draft' 33672 }] 33673 }, { 33674 title: (0,external_wp_i18n_namespaceObject.__)('Pending'), 33675 slug: 'pending', 33676 icon: library_pending, 33677 view: DEFAULT_POST_BASE, 33678 filters: [{ 33679 field: 'status', 33680 operator: OPERATOR_IS_ANY, 33681 value: 'pending' 33682 }] 33683 }, { 33684 title: (0,external_wp_i18n_namespaceObject.__)('Private'), 33685 slug: 'private', 33686 icon: not_allowed, 33687 view: DEFAULT_POST_BASE, 33688 filters: [{ 33689 field: 'status', 33690 operator: OPERATOR_IS_ANY, 33691 value: 'private' 33692 }] 33693 }, { 33694 title: (0,external_wp_i18n_namespaceObject.__)('Trash'), 33695 slug: 'trash', 33696 icon: library_trash, 33697 view: { 33698 ...DEFAULT_POST_BASE, 33699 type: LAYOUT_TABLE, 33700 layout: defaultLayouts[LAYOUT_TABLE].layout 33701 }, 33702 filters: [{ 33703 field: 'status', 33704 operator: OPERATOR_IS_ANY, 33705 value: 'trash' 33706 }] 33707 }]; 33708 }, [labels]); 33709 } 33710 33711 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js 33712 /** 33713 * WordPress dependencies 33714 */ 33715 33716 33717 33718 33719 33720 33721 33722 33723 33724 33725 function AddNewPostModal({ 33726 postType, 33727 onSave, 33728 onClose 33729 }) { 33730 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels, [postType]); 33731 const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_namespaceObject.useState)(false); 33732 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 33733 const { 33734 saveEntityRecord 33735 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 33736 const { 33737 createErrorNotice, 33738 createSuccessNotice 33739 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 33740 const { 33741 resolveSelect 33742 } = (0,external_wp_data_namespaceObject.useRegistry)(); 33743 async function createPost(event) { 33744 event.preventDefault(); 33745 if (isCreatingPost) { 33746 return; 33747 } 33748 setIsCreatingPost(true); 33749 try { 33750 const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 33751 const newPage = await saveEntityRecord('postType', postType, { 33752 status: 'draft', 33753 title, 33754 slug: title || (0,external_wp_i18n_namespaceObject.__)('No title'), 33755 content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)((0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)([], postTypeObject.template)) : undefined 33756 }, { 33757 throwOnError: true 33758 }); 33759 onSave(newPage); 33760 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 33761 // translators: %s: Title of the created post e.g: "Hello world". 33762 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title)), { 33763 type: 'snackbar' 33764 }); 33765 } catch (error) { 33766 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the item.'); 33767 createErrorNotice(errorMessage, { 33768 type: 'snackbar' 33769 }); 33770 } finally { 33771 setIsCreatingPost(false); 33772 } 33773 } 33774 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 33775 title: 33776 // translators: %s: post type singular_name label e.g: "Page". 33777 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Draft new: %s'), labels?.singular_name), 33778 onRequestClose: onClose, 33779 focusOnMount: "firstContentElement", 33780 size: "small", 33781 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 33782 onSubmit: createPost, 33783 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33784 spacing: 4, 33785 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 33786 __next40pxDefaultSize: true, 33787 __nextHasNoMarginBottom: true, 33788 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 33789 onChange: setTitle, 33790 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 33791 value: title 33792 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33793 spacing: 2, 33794 justify: "end", 33795 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33796 __next40pxDefaultSize: true, 33797 variant: "tertiary", 33798 onClick: onClose, 33799 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 33800 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33801 __next40pxDefaultSize: true, 33802 variant: "primary", 33803 type: "submit", 33804 isBusy: isCreatingPost, 33805 "aria-disabled": isCreatingPost, 33806 children: (0,external_wp_i18n_namespaceObject.__)('Create draft') 33807 })] 33808 })] 33809 }) 33810 }) 33811 }); 33812 } 33813 33814 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js 33815 /** 33816 * WordPress dependencies 33817 */ 33818 33819 33820 const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33821 xmlns: "http://www.w3.org/2000/svg", 33822 viewBox: "0 0 24 24", 33823 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33824 d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" 33825 }) 33826 }); 33827 /* harmony default export */ const library_pencil = (pencil); 33828 33829 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js 33830 /** 33831 * Internal dependencies 33832 */ 33833 33834 33835 /* harmony default export */ const edit = (library_pencil); 33836 33837 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js 33838 /** 33839 * WordPress dependencies 33840 */ 33841 33842 33843 33844 33845 33846 /** 33847 * Internal dependencies 33848 */ 33849 33850 33851 const { 33852 useHistory: dataviews_actions_useHistory 33853 } = unlock(external_wp_router_namespaceObject.privateApis); 33854 const useEditPostAction = () => { 33855 const history = dataviews_actions_useHistory(); 33856 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ 33857 id: 'edit-post', 33858 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 33859 isPrimary: true, 33860 icon: edit, 33861 isEligible(post) { 33862 if (post.status === 'trash') { 33863 return false; 33864 } 33865 // It's eligible for all post types except theme patterns. 33866 return post.type !== PATTERN_TYPES.theme; 33867 }, 33868 callback(items) { 33869 const post = items[0]; 33870 history.push({ 33871 postId: post.id, 33872 postType: post.type, 33873 canvas: 'edit' 33874 }); 33875 } 33876 }), [history]); 33877 }; 33878 33879 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 33880 /** 33881 * WordPress dependencies 33882 */ 33883 33884 33885 const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33886 xmlns: "http://www.w3.org/2000/svg", 33887 viewBox: "0 0 24 24", 33888 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33889 fillRule: "evenodd", 33890 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", 33891 clipRule: "evenodd" 33892 }) 33893 }); 33894 /* harmony default export */ const comment_author_avatar = (commentAuthorAvatar); 33895 33896 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/media/index.js 33897 /** 33898 * WordPress dependencies 33899 */ 33900 33901 33902 function Media({ 33903 id, 33904 size = ['large', 'medium', 'thumbnail'], 33905 ...props 33906 }) { 33907 const { 33908 record: media 33909 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'media', id); 33910 const currentSize = size.find(s => !!media?.media_details?.sizes[s]); 33911 const mediaUrl = media?.media_details?.sizes[currentSize]?.source_url || media?.source_url; 33912 if (!mediaUrl) { 33913 return null; 33914 } 33915 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 33916 ...props, 33917 src: mediaUrl, 33918 alt: media.alt_text 33919 }); 33920 } 33921 /* harmony default export */ const components_media = (Media); 33922 33923 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/post-fields/index.js 33924 /** 33925 * External dependencies 33926 */ 33927 33928 33929 /** 33930 * WordPress dependencies 33931 */ 33932 33933 33934 33935 33936 33937 33938 33939 33940 33941 /** 33942 * Internal dependencies 33943 */ 33944 33945 33946 33947 33948 // See https://github.com/WordPress/gutenberg/issues/55886 33949 // We do not support custom statutes at the moment. 33950 33951 33952 const STATUSES = [{ 33953 value: 'draft', 33954 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 33955 icon: library_drafts, 33956 description: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.') 33957 }, { 33958 value: 'future', 33959 label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 33960 icon: library_scheduled, 33961 description: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.') 33962 }, { 33963 value: 'pending', 33964 label: (0,external_wp_i18n_namespaceObject.__)('Pending Review'), 33965 icon: library_pending, 33966 description: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.') 33967 }, { 33968 value: 'private', 33969 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 33970 icon: not_allowed, 33971 description: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 33972 }, { 33973 value: 'publish', 33974 label: (0,external_wp_i18n_namespaceObject.__)('Published'), 33975 icon: library_published, 33976 description: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 33977 }, { 33978 value: 'trash', 33979 label: (0,external_wp_i18n_namespaceObject.__)('Trash'), 33980 icon: library_trash 33981 }]; 33982 const getFormattedDate = dateToDisplay => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay)); 33983 function FeaturedImage({ 33984 item, 33985 viewType 33986 }) { 33987 const isDisabled = item.status === 'trash'; 33988 const { 33989 onClick 33990 } = useLink({ 33991 postId: item.id, 33992 postType: item.type, 33993 canvas: 'edit' 33994 }); 33995 const hasMedia = !!item.featured_media; 33996 const size = viewType === LAYOUT_GRID ? ['large', 'full', 'medium', 'thumbnail'] : ['thumbnail', 'medium', 'large', 'full']; 33997 const media = hasMedia ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_media, { 33998 className: "edit-site-post-list__featured-image", 33999 id: item.featured_media, 34000 size: size 34001 }) : null; 34002 const renderButton = viewType !== LAYOUT_LIST && !isDisabled; 34003 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34004 className: `edit-site-post-list__featured-image-wrapper is-layout-$viewType}`, 34005 children: renderButton ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 34006 className: "edit-site-post-list__featured-image-button", 34007 type: "button", 34008 onClick: onClick, 34009 "aria-label": item.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)'), 34010 children: media 34011 }) : media 34012 }); 34013 } 34014 function PostStatusField({ 34015 item 34016 }) { 34017 const status = STATUSES.find(({ 34018 value 34019 }) => value === item.status); 34020 const label = status?.label || item.status; 34021 const icon = status?.icon; 34022 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34023 alignment: "left", 34024 spacing: 0, 34025 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34026 className: "edit-site-post-list__status-icon", 34027 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34028 icon: icon 34029 }) 34030 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34031 children: label 34032 })] 34033 }); 34034 } 34035 function PostAuthorField({ 34036 item 34037 }) { 34038 const { 34039 text, 34040 imageUrl 34041 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 34042 const { 34043 getUser 34044 } = select(external_wp_coreData_namespaceObject.store); 34045 const user = getUser(item.author); 34046 return { 34047 imageUrl: user?.avatar_urls?.[48], 34048 text: user?.name 34049 }; 34050 }, [item]); 34051 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 34052 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34053 alignment: "left", 34054 spacing: 0, 34055 children: [!!imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34056 className: dist_clsx('page-templates-author-field__avatar', { 34057 'is-loaded': isImageLoaded 34058 }), 34059 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 34060 onLoad: () => setIsImageLoaded(true), 34061 alt: (0,external_wp_i18n_namespaceObject.__)('Author avatar'), 34062 src: imageUrl 34063 }) 34064 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34065 className: "page-templates-author-field__icon", 34066 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34067 icon: comment_author_avatar 34068 }) 34069 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34070 className: "page-templates-author-field__name", 34071 children: text 34072 })] 34073 }); 34074 } 34075 function usePostFields(viewType) { 34076 const { 34077 records: authors, 34078 isResolving: isLoadingAuthors 34079 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'user', { 34080 per_page: -1 34081 }); 34082 const { 34083 frontPageId, 34084 postsPageId 34085 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 34086 const { 34087 getEntityRecord 34088 } = select(external_wp_coreData_namespaceObject.store); 34089 const siteSettings = getEntityRecord('root', 'site'); 34090 return { 34091 frontPageId: siteSettings?.page_on_front, 34092 postsPageId: siteSettings?.page_for_posts 34093 }; 34094 }, []); 34095 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [{ 34096 id: 'featured-image', 34097 label: (0,external_wp_i18n_namespaceObject.__)('Featured Image'), 34098 getValue: ({ 34099 item 34100 }) => item.featured_media, 34101 render: ({ 34102 item 34103 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FeaturedImage, { 34104 item: item, 34105 viewType: viewType 34106 }), 34107 enableSorting: false 34108 }, { 34109 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 34110 id: 'title', 34111 type: 'text', 34112 getValue: ({ 34113 item 34114 }) => typeof item.title === 'string' ? item.title : item.title?.raw, 34115 render: ({ 34116 item 34117 }) => { 34118 const addLink = [LAYOUT_TABLE, LAYOUT_GRID].includes(viewType) && item.status !== 'trash'; 34119 const renderedTitle = typeof item.title === 'string' ? item.title : item.title?.rendered; 34120 const title = addLink ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Link, { 34121 params: { 34122 postId: item.id, 34123 postType: item.type, 34124 canvas: 'edit' 34125 }, 34126 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(renderedTitle) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 34127 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34128 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(renderedTitle) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 34129 }); 34130 let suffix = ''; 34131 if (item.id === frontPageId) { 34132 suffix = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34133 className: "edit-site-post-list__title-badge", 34134 children: (0,external_wp_i18n_namespaceObject.__)('Homepage') 34135 }); 34136 } else if (item.id === postsPageId) { 34137 suffix = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34138 className: "edit-site-post-list__title-badge", 34139 children: (0,external_wp_i18n_namespaceObject.__)('Posts Page') 34140 }); 34141 } 34142 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34143 className: "edit-site-post-list__title", 34144 alignment: "center", 34145 justify: "flex-start", 34146 children: [title, suffix] 34147 }); 34148 }, 34149 enableHiding: false 34150 }, { 34151 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 34152 id: 'author', 34153 type: 'integer', 34154 elements: authors?.map(({ 34155 id, 34156 name 34157 }) => ({ 34158 value: id, 34159 label: name 34160 })) || [], 34161 render: PostAuthorField, 34162 sort: (a, b, direction) => { 34163 const nameA = a._embedded?.author?.[0]?.name || ''; 34164 const nameB = b._embedded?.author?.[0]?.name || ''; 34165 return direction === 'asc' ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); 34166 } 34167 }, { 34168 label: (0,external_wp_i18n_namespaceObject.__)('Status'), 34169 id: 'status', 34170 type: 'text', 34171 elements: STATUSES, 34172 render: PostStatusField, 34173 Edit: 'radio', 34174 enableSorting: false, 34175 filterBy: { 34176 operators: [OPERATOR_IS_ANY] 34177 } 34178 }, { 34179 label: (0,external_wp_i18n_namespaceObject.__)('Date'), 34180 id: 'date', 34181 type: 'datetime', 34182 render: ({ 34183 item 34184 }) => { 34185 const isDraftOrPrivate = ['draft', 'private'].includes(item.status); 34186 if (isDraftOrPrivate) { 34187 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation date */ 34188 (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(item.date)), { 34189 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34190 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34191 }); 34192 } 34193 const isScheduled = item.status === 'future'; 34194 if (isScheduled) { 34195 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation date */ 34196 (0,external_wp_i18n_namespaceObject.__)('<span>Scheduled: <time>%s</time></span>'), getFormattedDate(item.date)), { 34197 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34198 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34199 }); 34200 } 34201 const isPublished = item.status === 'publish'; 34202 if (isPublished) { 34203 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation time */ 34204 (0,external_wp_i18n_namespaceObject.__)('<span>Published: <time>%s</time></span>'), getFormattedDate(item.date)), { 34205 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34206 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34207 }); 34208 } 34209 34210 // Pending posts show the modified date if it's newer. 34211 const dateToDisplay = (0,external_wp_date_namespaceObject.getDate)(item.modified) > (0,external_wp_date_namespaceObject.getDate)(item.date) ? item.modified : item.date; 34212 const isPending = item.status === 'pending'; 34213 if (isPending) { 34214 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the newest of created or modified date for the page */ 34215 (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(dateToDisplay)), { 34216 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34217 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34218 }); 34219 } 34220 34221 // Unknow status. 34222 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 34223 children: getFormattedDate(item.date) 34224 }); 34225 } 34226 }, { 34227 id: 'comment_status', 34228 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 34229 type: 'text', 34230 Edit: 'radio', 34231 enableSorting: false, 34232 filterBy: { 34233 operators: [] 34234 }, 34235 elements: [{ 34236 value: 'open', 34237 label: (0,external_wp_i18n_namespaceObject.__)('Open'), 34238 description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') 34239 }, { 34240 value: 'closed', 34241 label: (0,external_wp_i18n_namespaceObject.__)('Closed'), 34242 description: (0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies. Existing comments remain visible.') 34243 }] 34244 }], [authors, viewType, frontPageId, postsPageId]); 34245 return { 34246 isLoading: isLoadingAuthors, 34247 fields 34248 }; 34249 } 34250 /* harmony default export */ const post_fields = (usePostFields); 34251 34252 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js 34253 /** 34254 * WordPress dependencies 34255 */ 34256 34257 34258 34259 34260 34261 34262 34263 34264 34265 34266 /** 34267 * Internal dependencies 34268 */ 34269 34270 34271 34272 34273 34274 34275 34276 34277 34278 34279 34280 const { 34281 usePostActions 34282 } = unlock(external_wp_editor_namespaceObject.privateApis); 34283 const { 34284 useLocation: post_list_useLocation, 34285 useHistory: post_list_useHistory 34286 } = unlock(external_wp_router_namespaceObject.privateApis); 34287 const { 34288 useEntityRecordsWithPermissions 34289 } = unlock(external_wp_coreData_namespaceObject.privateApis); 34290 const post_list_EMPTY_ARRAY = []; 34291 const getDefaultView = (defaultViews, activeView) => { 34292 return defaultViews.find(({ 34293 slug 34294 }) => slug === activeView)?.view; 34295 }; 34296 const getCustomView = editedEntityRecord => { 34297 if (!editedEntityRecord?.content) { 34298 return undefined; 34299 } 34300 const content = JSON.parse(editedEntityRecord.content); 34301 if (!content) { 34302 return undefined; 34303 } 34304 return { 34305 ...content, 34306 layout: defaultLayouts[content.type]?.layout 34307 }; 34308 }; 34309 34310 /** 34311 * This function abstracts working with default & custom views by 34312 * providing a [ state, setState ] tuple based on the URL parameters. 34313 * 34314 * Consumers use the provided tuple to work with state 34315 * and don't have to deal with the specifics of default & custom views. 34316 * 34317 * @param {string} postType Post type to retrieve default views for. 34318 * @return {Array} The [ state, setState ] tuple. 34319 */ 34320 function useView(postType) { 34321 const { 34322 params: { 34323 activeView = 'all', 34324 isCustom = 'false', 34325 layout 34326 } 34327 } = post_list_useLocation(); 34328 const history = post_list_useHistory(); 34329 const defaultViews = useDefaultViews({ 34330 postType 34331 }); 34332 const { 34333 editEntityRecord 34334 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 34335 const editedEntityRecord = (0,external_wp_data_namespaceObject.useSelect)(select => { 34336 if (isCustom !== 'true') { 34337 return undefined; 34338 } 34339 const { 34340 getEditedEntityRecord 34341 } = select(external_wp_coreData_namespaceObject.store); 34342 return getEditedEntityRecord('postType', 'wp_dataviews', Number(activeView)); 34343 }, [activeView, isCustom]); 34344 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(() => { 34345 let initialView; 34346 if (isCustom === 'true') { 34347 var _getCustomView; 34348 initialView = (_getCustomView = getCustomView(editedEntityRecord)) !== null && _getCustomView !== void 0 ? _getCustomView : { 34349 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 34350 }; 34351 } else { 34352 var _getDefaultView; 34353 initialView = (_getDefaultView = getDefaultView(defaultViews, activeView)) !== null && _getDefaultView !== void 0 ? _getDefaultView : { 34354 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 34355 }; 34356 } 34357 const type = layout !== null && layout !== void 0 ? layout : initialView.type; 34358 return { 34359 ...initialView, 34360 type 34361 }; 34362 }); 34363 const setViewWithUrlUpdate = (0,external_wp_element_namespaceObject.useCallback)(newView => { 34364 const { 34365 params 34366 } = history.getLocationWithParams(); 34367 if (newView.type === LAYOUT_LIST && !params?.layout) { 34368 // Skip updating the layout URL param if 34369 // it is not present and the newView.type is LAYOUT_LIST. 34370 } else if (newView.type !== params?.layout) { 34371 history.push({ 34372 ...params, 34373 layout: newView.type 34374 }); 34375 } 34376 setView(newView); 34377 if (isCustom === 'true' && editedEntityRecord?.id) { 34378 editEntityRecord('postType', 'wp_dataviews', editedEntityRecord?.id, { 34379 content: JSON.stringify(newView) 34380 }); 34381 } 34382 }, [history, isCustom, editEntityRecord, editedEntityRecord?.id]); 34383 34384 // When layout URL param changes, update the view type 34385 // without affecting any other config. 34386 (0,external_wp_element_namespaceObject.useEffect)(() => { 34387 setView(prevView => ({ 34388 ...prevView, 34389 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 34390 })); 34391 }, [layout]); 34392 34393 // When activeView or isCustom URL parameters change, reset the view. 34394 (0,external_wp_element_namespaceObject.useEffect)(() => { 34395 let newView; 34396 if (isCustom === 'true') { 34397 newView = getCustomView(editedEntityRecord); 34398 } else { 34399 newView = getDefaultView(defaultViews, activeView); 34400 } 34401 if (newView) { 34402 const type = layout !== null && layout !== void 0 ? layout : newView.type; 34403 setView({ 34404 ...newView, 34405 type 34406 }); 34407 } 34408 }, [activeView, isCustom, layout, defaultViews, editedEntityRecord]); 34409 return [view, setViewWithUrlUpdate, setViewWithUrlUpdate]; 34410 } 34411 const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'. 34412 34413 function getItemId(item) { 34414 return item.id.toString(); 34415 } 34416 function PostList({ 34417 postType 34418 }) { 34419 var _postId$split, _data$map, _usePrevious; 34420 const [view, setView] = useView(postType); 34421 const defaultViews = useDefaultViews({ 34422 postType 34423 }); 34424 const history = post_list_useHistory(); 34425 const location = post_list_useLocation(); 34426 const { 34427 postId, 34428 quickEdit = false, 34429 isCustom, 34430 activeView = 'all' 34431 } = location.params; 34432 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)((_postId$split = postId?.split(',')) !== null && _postId$split !== void 0 ? _postId$split : []); 34433 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 34434 var _params$isCustom; 34435 setSelection(items); 34436 const { 34437 params 34438 } = history.getLocationWithParams(); 34439 if (((_params$isCustom = params.isCustom) !== null && _params$isCustom !== void 0 ? _params$isCustom : 'false') === 'false') { 34440 history.push({ 34441 ...params, 34442 postId: items.join(',') 34443 }); 34444 } 34445 }, [history]); 34446 const getActiveViewFilters = (views, match) => { 34447 var _found$filters; 34448 const found = views.find(({ 34449 slug 34450 }) => slug === match); 34451 return (_found$filters = found?.filters) !== null && _found$filters !== void 0 ? _found$filters : []; 34452 }; 34453 const { 34454 isLoading: isLoadingFields, 34455 fields: _fields 34456 } = post_fields(view.type); 34457 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 34458 const activeViewFilters = getActiveViewFilters(defaultViews, activeView).map(({ 34459 field 34460 }) => field); 34461 return _fields.map(field => ({ 34462 ...field, 34463 elements: activeViewFilters.includes(field.id) ? [] : field.elements 34464 })); 34465 }, [_fields, defaultViews, activeView]); 34466 const queryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => { 34467 const filters = {}; 34468 view.filters?.forEach(filter => { 34469 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 34470 filters.status = filter.value; 34471 } 34472 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 34473 filters.author = filter.value; 34474 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 34475 filters.author_exclude = filter.value; 34476 } 34477 }); 34478 34479 // The bundled views want data filtered without displaying the filter. 34480 const activeViewFilters = getActiveViewFilters(defaultViews, activeView); 34481 activeViewFilters.forEach(filter => { 34482 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 34483 filters.status = filter.value; 34484 } 34485 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 34486 filters.author = filter.value; 34487 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 34488 filters.author_exclude = filter.value; 34489 } 34490 }); 34491 34492 // We want to provide a different default item for the status filter 34493 // than the REST API provides. 34494 if (!filters.status || filters.status === '') { 34495 filters.status = DEFAULT_STATUSES; 34496 } 34497 return { 34498 per_page: view.perPage, 34499 page: view.page, 34500 _embed: 'author', 34501 order: view.sort?.direction, 34502 orderby: view.sort?.field, 34503 search: view.search, 34504 ...filters 34505 }; 34506 }, [view, activeView, defaultViews]); 34507 const { 34508 records, 34509 isResolving: isLoadingData, 34510 totalItems, 34511 totalPages 34512 } = useEntityRecordsWithPermissions('postType', postType, queryArgs); 34513 34514 // The REST API sort the authors by ID, but we want to sort them by name. 34515 const data = (0,external_wp_element_namespaceObject.useMemo)(() => { 34516 if (!isLoadingFields && view?.sort?.field === 'author') { 34517 return filterSortAndPaginate(records, { 34518 sort: { 34519 ...view.sort 34520 } 34521 }, fields).data; 34522 } 34523 return records; 34524 }, [records, fields, isLoadingFields, view?.sort]); 34525 const ids = (_data$map = data?.map(record => getItemId(record))) !== null && _data$map !== void 0 ? _data$map : []; 34526 const prevIds = (_usePrevious = (0,external_wp_compose_namespaceObject.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : []; 34527 const deletedIds = prevIds.filter(id => !ids.includes(id)); 34528 const postIdWasDeleted = deletedIds.includes(postId); 34529 (0,external_wp_element_namespaceObject.useEffect)(() => { 34530 if (postIdWasDeleted) { 34531 history.push({ 34532 ...history.getLocationWithParams().params, 34533 postId: undefined 34534 }); 34535 } 34536 }, [postIdWasDeleted, history]); 34537 const paginationInfo = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 34538 totalItems, 34539 totalPages 34540 }), [totalItems, totalPages]); 34541 const { 34542 labels, 34543 canCreateRecord 34544 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 34545 const { 34546 getPostType, 34547 canUser 34548 } = select(external_wp_coreData_namespaceObject.store); 34549 return { 34550 labels: getPostType(postType)?.labels, 34551 canCreateRecord: canUser('create', { 34552 kind: 'postType', 34553 name: postType 34554 }) 34555 }; 34556 }, [postType]); 34557 const postTypeActions = usePostActions({ 34558 postType, 34559 context: 'list' 34560 }); 34561 const editAction = useEditPostAction(); 34562 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 34563 const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_namespaceObject.useState)(false); 34564 const openModal = () => setShowAddPostModal(true); 34565 const closeModal = () => setShowAddPostModal(false); 34566 const handleNewPage = ({ 34567 type, 34568 id 34569 }) => { 34570 history.push({ 34571 postId: id, 34572 postType: type, 34573 canvas: 'edit' 34574 }); 34575 closeModal(); 34576 }; 34577 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 34578 title: labels?.name, 34579 actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34580 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34581 variant: "primary", 34582 onClick: openModal, 34583 __next40pxDefaultSize: true, 34584 children: labels.add_new_item 34585 }), showAddPostModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPostModal, { 34586 postType: postType, 34587 onSave: handleNewPage, 34588 onClose: closeModal 34589 })] 34590 }), 34591 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 34592 paginationInfo: paginationInfo, 34593 fields: fields, 34594 actions: actions, 34595 data: data || post_list_EMPTY_ARRAY, 34596 isLoading: isLoadingData || isLoadingFields, 34597 view: view, 34598 onChangeView: setView, 34599 selection: selection, 34600 onChangeSelection: onChangeSelection, 34601 getItemId: getItemId, 34602 defaultLayouts: defaultLayouts, 34603 header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34604 size: "compact", 34605 isPressed: quickEdit, 34606 icon: drawer_right, 34607 label: (0,external_wp_i18n_namespaceObject.__)('Toggle details panel'), 34608 onClick: () => { 34609 history.push({ 34610 ...location.params, 34611 quickEdit: quickEdit ? undefined : true 34612 }); 34613 } 34614 }) 34615 }, activeView + isCustom) 34616 }); 34617 } 34618 34619 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js 34620 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); 34621 34622 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js 34623 /** 34624 * WordPress dependencies 34625 */ 34626 34627 34628 34629 34630 /** 34631 * Internal dependencies 34632 */ 34633 34634 34635 34636 function usePatternSettings() { 34637 var _storedSettings$__exp; 34638 const storedSettings = (0,external_wp_data_namespaceObject.useSelect)(select => { 34639 const { 34640 getSettings 34641 } = unlock(select(store)); 34642 return getSettings(); 34643 }, []); 34644 const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : 34645 // WP 6.0 34646 storedSettings.__experimentalBlockPatterns; // WP 5.9 34647 34648 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), []); 34649 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]); 34650 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { 34651 const { 34652 __experimentalAdditionalBlockPatterns, 34653 ...restStoredSettings 34654 } = storedSettings; 34655 return { 34656 ...restStoredSettings, 34657 __experimentalBlockPatterns: blockPatterns, 34658 __unstableIsPreviewMode: true 34659 }; 34660 }, [storedSettings, blockPatterns]); 34661 return settings; 34662 } 34663 34664 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js 34665 /** 34666 * WordPress dependencies 34667 */ 34668 34669 34670 /** 34671 * Internal dependencies 34672 */ 34673 34674 const { 34675 extractWords, 34676 getNormalizedSearchTerms, 34677 normalizeString: search_items_normalizeString 34678 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 34679 34680 /** 34681 * Internal dependencies 34682 */ 34683 34684 34685 // Default search helpers. 34686 const defaultGetName = item => { 34687 if (item.type === PATTERN_TYPES.user) { 34688 return item.slug; 34689 } 34690 if (item.type === TEMPLATE_PART_POST_TYPE) { 34691 return ''; 34692 } 34693 return item.name || ''; 34694 }; 34695 const defaultGetTitle = item => { 34696 if (typeof item.title === 'string') { 34697 return item.title; 34698 } 34699 if (item.title && item.title.rendered) { 34700 return item.title.rendered; 34701 } 34702 if (item.title && item.title.raw) { 34703 return item.title.raw; 34704 } 34705 return ''; 34706 }; 34707 const defaultGetDescription = item => { 34708 if (item.type === PATTERN_TYPES.user) { 34709 return item.excerpt.raw; 34710 } 34711 return item.description || ''; 34712 }; 34713 const defaultGetKeywords = item => item.keywords || []; 34714 const defaultHasCategory = () => false; 34715 const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 34716 return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term))); 34717 }; 34718 34719 /** 34720 * Filters an item list given a search term. 34721 * 34722 * @param {Array} items Item list 34723 * @param {string} searchInput Search input. 34724 * @param {Object} config Search Config. 34725 * 34726 * @return {Array} Filtered item list. 34727 */ 34728 const searchItems = (items = [], searchInput = '', config = {}) => { 34729 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 34730 34731 // Filter patterns by category: the default category indicates that all patterns will be shown. 34732 const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; 34733 const searchRankConfig = { 34734 ...config, 34735 onlyFilterByCategory 34736 }; 34737 34738 // If we aren't filtering on search terms, matching on category is satisfactory. 34739 // If we are, then we need more than a category match. 34740 const threshold = onlyFilterByCategory ? 0 : 1; 34741 const rankedItems = items.map(item => { 34742 return [item, getItemSearchRank(item, searchInput, searchRankConfig)]; 34743 }).filter(([, rank]) => rank > threshold); 34744 34745 // If we didn't have terms to search on, there's no point sorting. 34746 if (normalizedSearchTerms.length === 0) { 34747 return rankedItems.map(([item]) => item); 34748 } 34749 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 34750 return rankedItems.map(([item]) => item); 34751 }; 34752 34753 /** 34754 * Get the search rank for a given item and a specific search term. 34755 * The better the match, the higher the rank. 34756 * If the rank equals 0, it should be excluded from the results. 34757 * 34758 * @param {Object} item Item to filter. 34759 * @param {string} searchTerm Search term. 34760 * @param {Object} config Search Config. 34761 * 34762 * @return {number} Search Rank. 34763 */ 34764 function getItemSearchRank(item, searchTerm, config) { 34765 const { 34766 categoryId, 34767 getName = defaultGetName, 34768 getTitle = defaultGetTitle, 34769 getDescription = defaultGetDescription, 34770 getKeywords = defaultGetKeywords, 34771 hasCategory = defaultHasCategory, 34772 onlyFilterByCategory 34773 } = config; 34774 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; 34775 34776 // If an item doesn't belong to the current category or we don't have 34777 // search terms to filter by, return the initial rank value. 34778 if (!rank || onlyFilterByCategory) { 34779 return rank; 34780 } 34781 const name = getName(item); 34782 const title = getTitle(item); 34783 const description = getDescription(item); 34784 const keywords = getKeywords(item); 34785 const normalizedSearchInput = search_items_normalizeString(searchTerm); 34786 const normalizedTitle = search_items_normalizeString(title); 34787 34788 // Prefers exact matches 34789 // Then prefers if the beginning of the title matches the search term 34790 // name, keywords, description matches come later. 34791 if (normalizedSearchInput === normalizedTitle) { 34792 rank += 30; 34793 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 34794 rank += 20; 34795 } else { 34796 const terms = [name, title, description, ...keywords].join(' '); 34797 const normalizedSearchTerms = extractWords(normalizedSearchInput); 34798 const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); 34799 if (unmatchedTerms.length === 0) { 34800 rank += 10; 34801 } 34802 } 34803 return rank; 34804 } 34805 34806 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js 34807 /** 34808 * WordPress dependencies 34809 */ 34810 34811 34812 34813 34814 34815 34816 /** 34817 * Internal dependencies 34818 */ 34819 34820 34821 34822 34823 34824 const EMPTY_PATTERN_LIST = []; 34825 const selectTemplateParts = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, search = '') => { 34826 var _getEntityRecords; 34827 const { 34828 getEntityRecords, 34829 isResolving: isResolvingSelector 34830 } = select(external_wp_coreData_namespaceObject.store); 34831 const { 34832 __experimentalGetDefaultTemplatePartAreas 34833 } = select(external_wp_editor_namespaceObject.store); 34834 const query = { 34835 per_page: -1 34836 }; 34837 const templateParts = (_getEntityRecords = getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST; 34838 34839 // In the case where a custom template part area has been removed we need 34840 // the current list of areas to cross check against so orphaned template 34841 // parts can be treated as uncategorized. 34842 const knownAreas = __experimentalGetDefaultTemplatePartAreas() || []; 34843 const templatePartAreas = knownAreas.map(area => area.area); 34844 const templatePartHasCategory = (item, category) => { 34845 if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { 34846 return item.area === category; 34847 } 34848 return item.area === category || !templatePartAreas.includes(item.area); 34849 }; 34850 const isResolving = isResolvingSelector('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, query]); 34851 const patterns = searchItems(templateParts, search, { 34852 categoryId, 34853 hasCategory: templatePartHasCategory 34854 }); 34855 return { 34856 patterns, 34857 isResolving 34858 }; 34859 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 34860 per_page: -1 34861 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, { 34862 per_page: -1 34863 }]), select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas()]); 34864 const selectThemePatterns = (0,external_wp_data_namespaceObject.createSelector)(select => { 34865 var _settings$__experimen; 34866 const { 34867 getSettings 34868 } = unlock(select(store)); 34869 const { 34870 isResolving: isResolvingSelector 34871 } = select(external_wp_coreData_namespaceObject.store); 34872 const settings = getSettings(); 34873 const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns; 34874 const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns(); 34875 const patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({ 34876 ...pattern, 34877 keywords: pattern.keywords || [], 34878 type: PATTERN_TYPES.theme, 34879 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 34880 __unstableSkipMigrationLogs: true 34881 }) 34882 })); 34883 return { 34884 patterns, 34885 isResolving: isResolvingSelector('getBlockPatterns') 34886 }; 34887 }, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).isResolving('getBlockPatterns'), unlock(select(store)).getSettings()]); 34888 const selectPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, syncStatus, search = '') => { 34889 const { 34890 patterns: themePatterns, 34891 isResolving: isResolvingThemePatterns 34892 } = selectThemePatterns(select); 34893 const { 34894 patterns: userPatterns, 34895 isResolving: isResolvingUserPatterns, 34896 categories: userPatternCategories 34897 } = selectUserPatterns(select); 34898 let patterns = [...(themePatterns || []), ...(userPatterns || [])]; 34899 if (syncStatus) { 34900 // User patterns can have their sync statuses checked directly 34901 // Non-user patterns are all unsynced for the time being. 34902 patterns = patterns.filter(pattern => { 34903 return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; 34904 }); 34905 } 34906 if (categoryId) { 34907 patterns = searchItems(patterns, search, { 34908 categoryId, 34909 hasCategory: (item, currentCategory) => { 34910 if (item.type === PATTERN_TYPES.user) { 34911 return item.wp_pattern_category.some(catId => userPatternCategories.find(cat => cat.id === catId)?.slug === currentCategory); 34912 } 34913 return item.categories?.includes(currentCategory); 34914 } 34915 }); 34916 } else { 34917 patterns = searchItems(patterns, search, { 34918 hasCategory: item => { 34919 if (item.type === PATTERN_TYPES.user) { 34920 return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category.some(catId => userPatternCategories.find(cat => cat.id === catId))); 34921 } 34922 return !item.hasOwnProperty('categories'); 34923 } 34924 }); 34925 } 34926 return { 34927 patterns, 34928 isResolving: isResolvingThemePatterns || isResolvingUserPatterns 34929 }; 34930 }, select => [selectThemePatterns(select), selectUserPatterns(select)]); 34931 const selectUserPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, syncStatus, search = '') => { 34932 const { 34933 getEntityRecords, 34934 isResolving: isResolvingSelector, 34935 getUserPatternCategories 34936 } = select(external_wp_coreData_namespaceObject.store); 34937 const query = { 34938 per_page: -1 34939 }; 34940 const patternPosts = getEntityRecords('postType', PATTERN_TYPES.user, query); 34941 const userPatternCategories = getUserPatternCategories(); 34942 const categories = new Map(); 34943 userPatternCategories.forEach(userCategory => categories.set(userCategory.id, userCategory)); 34944 let patterns = patternPosts !== null && patternPosts !== void 0 ? patternPosts : EMPTY_PATTERN_LIST; 34945 const isResolving = isResolvingSelector('getEntityRecords', ['postType', PATTERN_TYPES.user, query]); 34946 if (syncStatus) { 34947 patterns = patterns.filter(pattern => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus); 34948 } 34949 patterns = searchItems(patterns, search, { 34950 // We exit user pattern retrieval early if we aren't in the 34951 // catch-all category for user created patterns, so it has 34952 // to be in the category. 34953 hasCategory: () => true 34954 }); 34955 return { 34956 patterns, 34957 isResolving, 34958 categories: userPatternCategories 34959 }; 34960 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', PATTERN_TYPES.user, { 34961 per_page: -1 34962 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, { 34963 per_page: -1 34964 }]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()]); 34965 function useAugmentPatternsWithPermissions(patterns) { 34966 const idsAndTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 34967 var _patterns$filter$map; 34968 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 : []; 34969 }, [patterns]); 34970 const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => { 34971 const { 34972 getEntityRecordPermissions 34973 } = unlock(select(external_wp_coreData_namespaceObject.store)); 34974 return idsAndTypes.reduce((acc, [type, id]) => { 34975 acc[id] = getEntityRecordPermissions('postType', type, id); 34976 return acc; 34977 }, {}); 34978 }, [idsAndTypes]); 34979 return (0,external_wp_element_namespaceObject.useMemo)(() => { 34980 var _patterns$map; 34981 return (_patterns$map = patterns?.map(record => { 34982 var _permissions$record$i; 34983 return { 34984 ...record, 34985 permissions: (_permissions$record$i = permissions?.[record.id]) !== null && _permissions$record$i !== void 0 ? _permissions$record$i : {} 34986 }; 34987 })) !== null && _patterns$map !== void 0 ? _patterns$map : []; 34988 }, [patterns, permissions]); 34989 } 34990 const usePatterns = (postType, categoryId, { 34991 search = '', 34992 syncStatus 34993 } = {}) => { 34994 return (0,external_wp_data_namespaceObject.useSelect)(select => { 34995 if (postType === TEMPLATE_PART_POST_TYPE) { 34996 return selectTemplateParts(select, categoryId, search); 34997 } else if (postType === PATTERN_TYPES.user && !!categoryId) { 34998 const appliedCategory = categoryId === 'uncategorized' ? '' : categoryId; 34999 return selectPatterns(select, appliedCategory, syncStatus, search); 35000 } else if (postType === PATTERN_TYPES.user) { 35001 return selectUserPatterns(select, syncStatus, search); 35002 } 35003 return { 35004 patterns: EMPTY_PATTERN_LIST, 35005 isResolving: false 35006 }; 35007 }, [categoryId, postType, search, syncStatus]); 35008 }; 35009 /* harmony default export */ const use_patterns = (usePatterns); 35010 35011 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js 35012 /** 35013 * WordPress dependencies 35014 */ 35015 35016 35017 const symbol_symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35018 xmlns: "http://www.w3.org/2000/svg", 35019 viewBox: "0 0 24 24", 35020 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35021 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" 35022 }) 35023 }); 35024 /* harmony default export */ const library_symbol = (symbol_symbol); 35025 35026 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 35027 /** 35028 * WordPress dependencies 35029 */ 35030 35031 35032 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35033 xmlns: "http://www.w3.org/2000/svg", 35034 viewBox: "0 0 24 24", 35035 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35036 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" 35037 }) 35038 }); 35039 /* harmony default export */ const symbol_filled = (symbolFilled); 35040 35041 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js 35042 /** 35043 * WordPress dependencies 35044 */ 35045 35046 35047 const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35048 xmlns: "http://www.w3.org/2000/svg", 35049 viewBox: "0 0 24 24", 35050 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35051 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" 35052 }) 35053 }); 35054 /* harmony default export */ const library_upload = (upload); 35055 35056 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js 35057 /** 35058 * WordPress dependencies 35059 */ 35060 35061 35062 35063 35064 35065 35066 35067 35068 35069 35070 35071 /** 35072 * Internal dependencies 35073 */ 35074 35075 35076 35077 35078 35079 const { 35080 useHistory: add_new_pattern_useHistory 35081 } = unlock(external_wp_router_namespaceObject.privateApis); 35082 const { 35083 CreatePatternModal, 35084 useAddPatternCategory 35085 } = unlock(external_wp_patterns_namespaceObject.privateApis); 35086 const { 35087 CreateTemplatePartModal 35088 } = unlock(external_wp_editor_namespaceObject.privateApis); 35089 function AddNewPattern() { 35090 const history = add_new_pattern_useHistory(); 35091 const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false); 35092 const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false); 35093 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 35094 const { 35095 createPatternFromFile 35096 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store)); 35097 const { 35098 createSuccessNotice, 35099 createErrorNotice 35100 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 35101 const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)(); 35102 const { 35103 isBlockBasedTheme, 35104 addNewPatternLabel, 35105 addNewTemplatePartLabel, 35106 canCreatePattern, 35107 canCreateTemplatePart 35108 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 35109 const { 35110 getCurrentTheme, 35111 getPostType, 35112 canUser 35113 } = select(external_wp_coreData_namespaceObject.store); 35114 return { 35115 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 35116 addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, 35117 addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, 35118 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 35119 canCreatePattern: canUser('create', { 35120 kind: 'postType', 35121 name: PATTERN_TYPES.user 35122 }), 35123 canCreateTemplatePart: canUser('create', { 35124 kind: 'postType', 35125 name: TEMPLATE_PART_POST_TYPE 35126 }) 35127 }; 35128 }, []); 35129 function handleCreatePattern({ 35130 pattern 35131 }) { 35132 setShowPatternModal(false); 35133 history.push({ 35134 postId: pattern.id, 35135 postType: PATTERN_TYPES.user, 35136 canvas: 'edit' 35137 }); 35138 } 35139 function handleCreateTemplatePart(templatePart) { 35140 setShowTemplatePartModal(false); 35141 35142 // Navigate to the created template part editor. 35143 history.push({ 35144 postId: templatePart.id, 35145 postType: TEMPLATE_PART_POST_TYPE, 35146 canvas: 'edit' 35147 }); 35148 } 35149 function handleError() { 35150 setShowPatternModal(false); 35151 setShowTemplatePartModal(false); 35152 } 35153 const controls = []; 35154 if (canCreatePattern) { 35155 controls.push({ 35156 icon: library_symbol, 35157 onClick: () => setShowPatternModal(true), 35158 title: addNewPatternLabel 35159 }); 35160 } 35161 if (isBlockBasedTheme && canCreateTemplatePart) { 35162 controls.push({ 35163 icon: symbol_filled, 35164 onClick: () => setShowTemplatePartModal(true), 35165 title: addNewTemplatePartLabel 35166 }); 35167 } 35168 if (canCreatePattern) { 35169 controls.push({ 35170 icon: library_upload, 35171 onClick: () => { 35172 patternUploadInputRef.current.click(); 35173 }, 35174 title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON') 35175 }); 35176 } 35177 const { 35178 categoryMap, 35179 findOrCreateTerm 35180 } = useAddPatternCategory(); 35181 if (controls.length === 0) { 35182 return null; 35183 } 35184 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35185 children: [addNewPatternLabel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 35186 controls: controls, 35187 icon: null, 35188 toggleProps: { 35189 variant: 'primary', 35190 showTooltip: false, 35191 __next40pxDefaultSize: true 35192 }, 35193 text: addNewPatternLabel, 35194 label: addNewPatternLabel 35195 }), showPatternModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModal, { 35196 onClose: () => setShowPatternModal(false), 35197 onSuccess: handleCreatePattern, 35198 onError: handleError 35199 }), showTemplatePartModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { 35200 closeModal: () => setShowTemplatePartModal(false), 35201 blocks: [], 35202 onCreate: handleCreateTemplatePart, 35203 onError: handleError 35204 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 35205 type: "file", 35206 accept: ".json", 35207 hidden: true, 35208 ref: patternUploadInputRef, 35209 onChange: async event => { 35210 const file = event.target.files?.[0]; 35211 if (!file) { 35212 return; 35213 } 35214 try { 35215 const { 35216 params: { 35217 postType, 35218 categoryId 35219 } 35220 } = history.getLocationWithParams(); 35221 let currentCategoryId; 35222 // When we're not handling template parts, we should 35223 // add or create the proper pattern category. 35224 if (postType !== TEMPLATE_PART_POST_TYPE) { 35225 /* 35226 * categoryMap.values() returns an iterator. 35227 * Iterator.prototype.find() is not yet widely supported. 35228 * Convert to array to use the Array.prototype.find method. 35229 */ 35230 const currentCategory = Array.from(categoryMap.values()).find(term => term.name === categoryId); 35231 if (currentCategory) { 35232 currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label)); 35233 } 35234 } 35235 const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined); 35236 35237 // Navigate to the All patterns category for the newly created pattern 35238 // if we're not on that page already and if we're not in the `my-patterns` 35239 // category. 35240 if (!currentCategoryId && categoryId !== 'my-patterns') { 35241 history.push({ 35242 postType: PATTERN_TYPES.user, 35243 categoryId: PATTERN_DEFAULT_CATEGORY 35244 }); 35245 } 35246 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 35247 // translators: %s: The imported pattern's title. 35248 (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), { 35249 type: 'snackbar', 35250 id: 'import-pattern-success' 35251 }); 35252 } catch (err) { 35253 createErrorNotice(err.message, { 35254 type: 'snackbar', 35255 id: 'import-pattern-error' 35256 }); 35257 } finally { 35258 event.target.value = ''; 35259 } 35260 } 35261 })] 35262 }); 35263 } 35264 35265 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js 35266 /** 35267 * WordPress dependencies 35268 */ 35269 35270 35271 35272 /** 35273 * Internal dependencies 35274 */ 35275 35276 35277 function useDefaultPatternCategories() { 35278 const blockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => { 35279 var _settings$__experimen; 35280 const { 35281 getSettings 35282 } = unlock(select(store)); 35283 const settings = getSettings(); 35284 return (_settings$__experimen = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatternCategories; 35285 }); 35286 const restBlockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()); 35287 return [...(blockPatternCategories || []), ...(restBlockPatternCategories || [])]; 35288 } 35289 35290 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js 35291 /** 35292 * WordPress dependencies 35293 */ 35294 35295 35296 35297 35298 /** 35299 * Internal dependencies 35300 */ 35301 35302 35303 35304 35305 function useThemePatterns() { 35306 const blockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => { 35307 var _getSettings$__experi; 35308 const { 35309 getSettings 35310 } = unlock(select(store)); 35311 return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns; 35312 }); 35313 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns()); 35314 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]); 35315 return patterns; 35316 } 35317 35318 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js 35319 /** 35320 * WordPress dependencies 35321 */ 35322 35323 35324 35325 /** 35326 * Internal dependencies 35327 */ 35328 35329 35330 35331 35332 function usePatternCategories() { 35333 const defaultCategories = useDefaultPatternCategories(); 35334 defaultCategories.push({ 35335 name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, 35336 label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') 35337 }); 35338 const themePatterns = useThemePatterns(); 35339 const { 35340 patterns: userPatterns, 35341 categories: userPatternCategories 35342 } = use_patterns(PATTERN_TYPES.user); 35343 const patternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { 35344 const categoryMap = {}; 35345 const categoriesWithCounts = []; 35346 35347 // Create a map for easier counting of patterns in categories. 35348 defaultCategories.forEach(category => { 35349 if (!categoryMap[category.name]) { 35350 categoryMap[category.name] = { 35351 ...category, 35352 count: 0 35353 }; 35354 } 35355 }); 35356 userPatternCategories.forEach(category => { 35357 if (!categoryMap[category.name]) { 35358 categoryMap[category.name] = { 35359 ...category, 35360 count: 0 35361 }; 35362 } 35363 }); 35364 35365 // Update the category counts to reflect theme registered patterns. 35366 themePatterns.forEach(pattern => { 35367 pattern.categories?.forEach(category => { 35368 if (categoryMap[category]) { 35369 categoryMap[category].count += 1; 35370 } 35371 }); 35372 // If the pattern has no categories, add it to uncategorized. 35373 if (!pattern.categories?.length) { 35374 categoryMap.uncategorized.count += 1; 35375 } 35376 }); 35377 35378 // Update the category counts to reflect user registered patterns. 35379 userPatterns.forEach(pattern => { 35380 pattern.wp_pattern_category?.forEach(catId => { 35381 const category = userPatternCategories.find(cat => cat.id === catId)?.name; 35382 if (categoryMap[category]) { 35383 categoryMap[category].count += 1; 35384 } 35385 }); 35386 // If the pattern has no categories, add it to uncategorized. 35387 if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category.some(catId => userPatternCategories.find(cat => cat.id === catId))) { 35388 categoryMap.uncategorized.count += 1; 35389 } 35390 }); 35391 35392 // Filter categories so we only have those containing patterns. 35393 [...defaultCategories, ...userPatternCategories].forEach(category => { 35394 if (categoryMap[category.name].count && !categoriesWithCounts.find(cat => cat.name === category.name)) { 35395 categoriesWithCounts.push(categoryMap[category.name]); 35396 } 35397 }); 35398 const sortedCategories = categoriesWithCounts.sort((a, b) => a.label.localeCompare(b.label)); 35399 sortedCategories.unshift({ 35400 name: PATTERN_USER_CATEGORY, 35401 label: (0,external_wp_i18n_namespaceObject.__)('My patterns'), 35402 count: userPatterns.length 35403 }); 35404 sortedCategories.unshift({ 35405 name: PATTERN_DEFAULT_CATEGORY, 35406 label: (0,external_wp_i18n_namespaceObject.__)('All patterns'), 35407 description: (0,external_wp_i18n_namespaceObject.__)('A list of all patterns from all sources.'), 35408 count: themePatterns.length + userPatterns.length 35409 }); 35410 return sortedCategories; 35411 }, [defaultCategories, themePatterns, userPatternCategories, userPatterns]); 35412 return { 35413 patternCategories, 35414 hasPatterns: !!patternCategories.length 35415 }; 35416 } 35417 35418 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js 35419 /** 35420 * WordPress dependencies 35421 */ 35422 35423 35424 35425 35426 /** 35427 * Internal dependencies 35428 */ 35429 35430 35431 /** 35432 * Internal dependencies 35433 */ 35434 35435 35436 35437 35438 const { 35439 RenamePatternCategoryModal 35440 } = unlock(external_wp_patterns_namespaceObject.privateApis); 35441 function RenameCategoryMenuItem({ 35442 category, 35443 onClose 35444 }) { 35445 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 35446 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35447 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 35448 onClick: () => setIsModalOpen(true), 35449 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 35450 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameModal, { 35451 category: category, 35452 onClose: () => { 35453 setIsModalOpen(false); 35454 onClose(); 35455 } 35456 })] 35457 }); 35458 } 35459 function RenameModal({ 35460 category, 35461 onClose 35462 }) { 35463 // User created pattern categories have their properties updated when 35464 // retrieved via `getUserPatternCategories`. The rename modal expects an 35465 // object that will match the pattern category entity. 35466 const normalizedCategory = { 35467 id: category.id, 35468 slug: category.slug, 35469 name: category.label 35470 }; 35471 35472 // Optimization - only use pattern categories when the modal is open. 35473 const existingCategories = usePatternCategories(); 35474 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternCategoryModal, { 35475 category: normalizedCategory, 35476 existingCategories: existingCategories, 35477 onClose: onClose, 35478 overlayClassName: "edit-site-list__rename-modal", 35479 focusOnMount: "firstContentElement", 35480 size: "small" 35481 }); 35482 } 35483 35484 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js 35485 /** 35486 * WordPress dependencies 35487 */ 35488 35489 35490 35491 35492 35493 35494 35495 35496 35497 /** 35498 * Internal dependencies 35499 */ 35500 35501 35502 35503 35504 35505 const { 35506 useHistory: delete_category_menu_item_useHistory 35507 } = unlock(external_wp_router_namespaceObject.privateApis); 35508 function DeleteCategoryMenuItem({ 35509 category, 35510 onClose 35511 }) { 35512 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 35513 const history = delete_category_menu_item_useHistory(); 35514 const { 35515 createSuccessNotice, 35516 createErrorNotice 35517 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 35518 const { 35519 deleteEntityRecord, 35520 invalidateResolution 35521 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 35522 const onDelete = async () => { 35523 try { 35524 await deleteEntityRecord('taxonomy', 'wp_pattern_category', category.id, { 35525 force: true 35526 }, { 35527 throwOnError: true 35528 }); 35529 35530 // Prevent the need to refresh the page to get up-to-date categories 35531 // and pattern categorization. 35532 invalidateResolution('getUserPatternCategories'); 35533 invalidateResolution('getEntityRecords', ['postType', PATTERN_TYPES.user, { 35534 per_page: -1 35535 }]); 35536 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The pattern category's name */ 35537 (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), category.label), { 35538 type: 'snackbar', 35539 id: 'pattern-category-delete' 35540 }); 35541 onClose?.(); 35542 history.push({ 35543 postType: PATTERN_TYPES.user, 35544 categoryId: PATTERN_DEFAULT_CATEGORY 35545 }); 35546 } catch (error) { 35547 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the pattern category.'); 35548 createErrorNotice(errorMessage, { 35549 type: 'snackbar', 35550 id: 'pattern-category-delete' 35551 }); 35552 } 35553 }; 35554 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35555 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 35556 isDestructive: true, 35557 onClick: () => setIsModalOpen(true), 35558 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 35559 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 35560 isOpen: isModalOpen, 35561 onConfirm: onDelete, 35562 onCancel: () => setIsModalOpen(false), 35563 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 35564 className: "edit-site-patterns__delete-modal", 35565 title: (0,external_wp_i18n_namespaceObject.sprintf)( 35566 // translators: %s: The pattern category's name. 35567 (0,external_wp_i18n_namespaceObject.__)('Delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)), 35568 size: "medium", 35569 __experimentalHideHeader: false, 35570 children: (0,external_wp_i18n_namespaceObject.sprintf)( 35571 // translators: %s: The pattern category's name. 35572 (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)) 35573 })] 35574 }); 35575 } 35576 35577 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/header.js 35578 /** 35579 * WordPress dependencies 35580 */ 35581 35582 35583 35584 35585 35586 35587 /** 35588 * Internal dependencies 35589 */ 35590 35591 35592 35593 35594 35595 35596 35597 function PatternsHeader({ 35598 categoryId, 35599 type, 35600 titleId, 35601 descriptionId 35602 }) { 35603 const { 35604 patternCategories 35605 } = usePatternCategories(); 35606 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []); 35607 let title, description, patternCategory; 35608 if (type === TEMPLATE_PART_POST_TYPE) { 35609 const templatePartArea = templatePartAreas.find(area => area.area === categoryId); 35610 title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)('All Template Parts'); 35611 description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)('Includes every template part defined for any area.'); 35612 } else if (type === PATTERN_TYPES.user && !!categoryId) { 35613 patternCategory = patternCategories.find(category => category.name === categoryId); 35614 title = patternCategory?.label; 35615 description = patternCategory?.description; 35616 } 35617 if (!title) { 35618 return null; 35619 } 35620 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35621 className: "edit-site-patterns__section-header", 35622 spacing: 1, 35623 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35624 justify: "space-between", 35625 className: "edit-site-patterns__title", 35626 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 35627 as: "h2", 35628 level: 3, 35629 id: titleId, 35630 weight: 500, 35631 truncate: true, 35632 children: title 35633 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35634 expanded: false, 35635 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}), !!patternCategory?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 35636 icon: more_vertical, 35637 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 35638 toggleProps: { 35639 className: 'edit-site-patterns__button', 35640 description: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: pattern category name */ 35641 (0,external_wp_i18n_namespaceObject.__)('Action menu for %s pattern category'), title), 35642 size: 'compact' 35643 }, 35644 children: ({ 35645 onClose 35646 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 35647 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameCategoryMenuItem, { 35648 category: patternCategory, 35649 onClose: onClose 35650 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteCategoryMenuItem, { 35651 category: patternCategory, 35652 onClose: onClose 35653 })] 35654 }) 35655 })] 35656 })] 35657 }), description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 35658 variant: "muted", 35659 as: "p", 35660 id: descriptionId, 35661 className: "edit-site-patterns__sub-title", 35662 children: description 35663 }) : null] 35664 }); 35665 } 35666 35667 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-small.js 35668 /** 35669 * WordPress dependencies 35670 */ 35671 35672 35673 const lockSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35674 viewBox: "0 0 24 24", 35675 xmlns: "http://www.w3.org/2000/svg", 35676 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35677 fillRule: "evenodd", 35678 clipRule: "evenodd", 35679 d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" 35680 }) 35681 }); 35682 /* harmony default export */ const lock_small = (lockSmall); 35683 35684 ;// CONCATENATED MODULE: external ["wp","priorityQueue"] 35685 const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; 35686 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/async/index.js 35687 /** 35688 * WordPress dependencies 35689 */ 35690 35691 35692 const blockPreviewQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)(); 35693 35694 /** 35695 * Renders a component at the next idle time. 35696 * @param {*} props 35697 */ 35698 function Async({ 35699 children, 35700 placeholder 35701 }) { 35702 const [shouldRender, setShouldRender] = (0,external_wp_element_namespaceObject.useState)(false); 35703 35704 // In the future, we could try to use startTransition here, but currently 35705 // react will batch all transitions, which means all previews will be 35706 // rendered at the same time. 35707 // https://react.dev/reference/react/startTransition#caveats 35708 // > If there are multiple ongoing Transitions, React currently batches them 35709 // > together. This is a limitation that will likely be removed in a future 35710 // > release. 35711 35712 (0,external_wp_element_namespaceObject.useEffect)(() => { 35713 const context = {}; 35714 blockPreviewQueue.add(context, () => { 35715 // Synchronously run all renders so it consumes timeRemaining. 35716 // See https://github.com/WordPress/gutenberg/pull/48238 35717 (0,external_wp_element_namespaceObject.flushSync)(() => { 35718 setShouldRender(true); 35719 }); 35720 }); 35721 return () => { 35722 blockPreviewQueue.cancel(context); 35723 }; 35724 }, []); 35725 if (!shouldRender) { 35726 return placeholder; 35727 } 35728 return children; 35729 } 35730 35731 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js 35732 /** 35733 * WordPress dependencies 35734 */ 35735 35736 35737 const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35738 xmlns: "http://www.w3.org/2000/svg", 35739 viewBox: "0 0 24 24", 35740 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35741 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" 35742 }) 35743 }); 35744 /* harmony default export */ const library_plugins = (plugins); 35745 35746 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js 35747 /** 35748 * WordPress dependencies 35749 */ 35750 35751 35752 const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35753 xmlns: "http://www.w3.org/2000/svg", 35754 viewBox: "0 0 24 24", 35755 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35756 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" 35757 }) 35758 }); 35759 /* harmony default export */ const library_globe = (globe); 35760 35761 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js 35762 /** 35763 * WordPress dependencies 35764 */ 35765 35766 35767 35768 35769 /** 35770 * Internal dependencies 35771 */ 35772 35773 35774 /** @typedef {'wp_template'|'wp_template_part'} TemplateType */ 35775 35776 /** 35777 * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType 35778 * 35779 * @typedef AddedByData 35780 * @type {Object} 35781 * @property {AddedByType} type The type of the data. 35782 * @property {JSX.Element} icon The icon to display. 35783 * @property {string} [imageUrl] The optional image URL to display. 35784 * @property {string} [text] The text to display. 35785 * @property {boolean} isCustomized Whether the template has been customized. 35786 * 35787 * @param {TemplateType} postType The template post type. 35788 * @param {number} postId The template post id. 35789 * @return {AddedByData} The added by object or null. 35790 */ 35791 function useAddedBy(postType, postId) { 35792 return (0,external_wp_data_namespaceObject.useSelect)(select => { 35793 const { 35794 getEntityRecord, 35795 getMedia, 35796 getUser, 35797 getEditedEntityRecord 35798 } = select(external_wp_coreData_namespaceObject.store); 35799 const template = getEditedEntityRecord('postType', postType, postId); 35800 const originalSource = template?.original_source; 35801 const authorText = template?.author_text; 35802 switch (originalSource) { 35803 case 'theme': 35804 { 35805 return { 35806 type: originalSource, 35807 icon: library_layout, 35808 text: authorText, 35809 isCustomized: template.source === TEMPLATE_ORIGINS.custom 35810 }; 35811 } 35812 case 'plugin': 35813 { 35814 return { 35815 type: originalSource, 35816 icon: library_plugins, 35817 text: authorText, 35818 isCustomized: template.source === TEMPLATE_ORIGINS.custom 35819 }; 35820 } 35821 case 'site': 35822 { 35823 const siteData = getEntityRecord('root', '__unstableBase'); 35824 return { 35825 type: originalSource, 35826 icon: library_globe, 35827 imageUrl: siteData?.site_logo ? getMedia(siteData.site_logo)?.source_url : undefined, 35828 text: authorText, 35829 isCustomized: false 35830 }; 35831 } 35832 default: 35833 { 35834 const user = getUser(template.author); 35835 return { 35836 type: 'user', 35837 icon: comment_author_avatar, 35838 imageUrl: user?.avatar_urls?.[48], 35839 text: authorText, 35840 isCustomized: false 35841 }; 35842 } 35843 } 35844 }, [postType, postId]); 35845 } 35846 35847 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js 35848 /** 35849 * External dependencies 35850 */ 35851 35852 35853 /** 35854 * WordPress dependencies 35855 */ 35856 35857 35858 35859 35860 35861 35862 35863 35864 /** 35865 * Internal dependencies 35866 */ 35867 35868 35869 35870 35871 35872 35873 35874 35875 const { 35876 useGlobalStyle: fields_useGlobalStyle 35877 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 35878 function PreviewWrapper({ 35879 item, 35880 onClick, 35881 ariaDescribedBy, 35882 children 35883 }) { 35884 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 35885 className: "page-patterns-preview-field__button", 35886 type: "button", 35887 onClick: item.type !== PATTERN_TYPES.theme ? onClick : undefined, 35888 "aria-label": item.title, 35889 "aria-describedby": ariaDescribedBy, 35890 "aria-disabled": item.type === PATTERN_TYPES.theme, 35891 children: children 35892 }); 35893 } 35894 function PreviewField({ 35895 item 35896 }) { 35897 const descriptionId = (0,external_wp_element_namespaceObject.useId)(); 35898 const description = item.description || item?.excerpt?.raw; 35899 const isUserPattern = item.type === PATTERN_TYPES.user; 35900 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; 35901 const [backgroundColor] = fields_useGlobalStyle('color.background'); 35902 const { 35903 onClick 35904 } = useLink({ 35905 postType: item.type, 35906 postId: isUserPattern || isTemplatePart ? item.id : item.name, 35907 canvas: 'edit' 35908 }); 35909 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 35910 var _item$blocks; 35911 return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, { 35912 __unstableSkipMigrationLogs: true 35913 }); 35914 }, [item?.content?.raw, item.blocks]); 35915 const isEmpty = !blocks?.length; 35916 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 35917 className: "page-patterns-preview-field", 35918 style: { 35919 backgroundColor 35920 }, 35921 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewWrapper, { 35922 item: item, 35923 onClick: onClick, 35924 ariaDescribedBy: !!description ? descriptionId : undefined, 35925 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)(Async, { 35926 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 35927 blocks: blocks, 35928 viewportWidth: item.viewportWidth 35929 }) 35930 })] 35931 }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35932 hidden: true, 35933 id: descriptionId, 35934 children: description 35935 })] 35936 }); 35937 } 35938 const previewField = { 35939 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 35940 id: 'preview', 35941 render: PreviewField, 35942 enableSorting: false 35943 }; 35944 function TitleField({ 35945 item 35946 }) { 35947 const isUserPattern = item.type === PATTERN_TYPES.user; 35948 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; 35949 const { 35950 onClick 35951 } = useLink({ 35952 postType: item.type, 35953 postId: isUserPattern || isTemplatePart ? item.id : item.name, 35954 canvas: 'edit' 35955 }); 35956 const title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(defaultGetTitle(item)); 35957 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35958 alignment: "center", 35959 justify: "flex-start", 35960 spacing: 2, 35961 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 35962 as: "div", 35963 gap: 0, 35964 justify: "flex-start", 35965 className: "edit-site-patterns__pattern-title", 35966 children: item.type === PATTERN_TYPES.theme ? title : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35967 __next40pxDefaultSize: true, 35968 variant: "link", 35969 onClick: onClick 35970 // Required for the grid's roving tab index system. 35971 // See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243. 35972 , 35973 tabIndex: "-1", 35974 children: title 35975 }) 35976 }), item.type === PATTERN_TYPES.theme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 35977 placement: "top", 35978 text: (0,external_wp_i18n_namespaceObject.__)('This pattern cannot be edited.'), 35979 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 35980 className: "edit-site-patterns__pattern-lock-icon", 35981 icon: lock_small, 35982 size: 24 35983 }) 35984 })] 35985 }); 35986 } 35987 const titleField = { 35988 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 35989 id: 'title', 35990 getValue: ({ 35991 item 35992 }) => item.title?.raw || item.title, 35993 render: TitleField, 35994 enableHiding: false 35995 }; 35996 const SYNC_FILTERS = [{ 35997 value: PATTERN_SYNC_TYPES.full, 35998 label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), 35999 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that are kept in sync across the site.') 36000 }, { 36001 value: PATTERN_SYNC_TYPES.unsynced, 36002 label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)'), 36003 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that can be changed freely without affecting the site.') 36004 }]; 36005 const patternStatusField = { 36006 label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), 36007 id: 'sync-status', 36008 render: ({ 36009 item 36010 }) => { 36011 const syncStatus = 'wp_pattern_sync_status' in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced; 36012 // User patterns can have their sync statuses checked directly. 36013 // Non-user patterns are all unsynced for the time being. 36014 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36015 className: `edit-site-patterns__field-sync-status-$syncStatus}`, 36016 children: SYNC_FILTERS.find(({ 36017 value 36018 }) => value === syncStatus).label 36019 }); 36020 }, 36021 elements: SYNC_FILTERS, 36022 filterBy: { 36023 operators: [OPERATOR_IS], 36024 isPrimary: true 36025 }, 36026 enableSorting: false 36027 }; 36028 function AuthorField({ 36029 item 36030 }) { 36031 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 36032 const { 36033 text, 36034 icon, 36035 imageUrl 36036 } = useAddedBy(item.type, item.id); 36037 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36038 alignment: "left", 36039 spacing: 0, 36040 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 36041 className: dist_clsx('page-templates-author-field__avatar', { 36042 'is-loaded': isImageLoaded 36043 }), 36044 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 36045 onLoad: () => setIsImageLoaded(true), 36046 alt: "", 36047 src: imageUrl 36048 }) 36049 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 36050 className: "page-templates-author-field__icon", 36051 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 36052 icon: icon 36053 }) 36054 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36055 className: "page-templates-author-field__name", 36056 children: text 36057 })] 36058 }); 36059 } 36060 const templatePartAuthorField = { 36061 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 36062 id: 'author', 36063 getValue: ({ 36064 item 36065 }) => item.author_text, 36066 render: AuthorField, 36067 filterBy: { 36068 isPrimary: true 36069 } 36070 }; 36071 36072 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js 36073 /** 36074 * WordPress dependencies 36075 */ 36076 36077 36078 36079 36080 36081 36082 36083 36084 36085 /** 36086 * Internal dependencies 36087 */ 36088 36089 36090 36091 36092 36093 36094 36095 36096 36097 36098 const { 36099 ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider 36100 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 36101 const { 36102 usePostActions: page_patterns_usePostActions 36103 } = unlock(external_wp_editor_namespaceObject.privateApis); 36104 const { 36105 useLocation: page_patterns_useLocation 36106 } = unlock(external_wp_router_namespaceObject.privateApis); 36107 const page_patterns_EMPTY_ARRAY = []; 36108 const page_patterns_defaultLayouts = { 36109 [LAYOUT_TABLE]: { 36110 layout: { 36111 primaryField: 'title', 36112 styles: { 36113 preview: { 36114 width: '1%' 36115 }, 36116 author: { 36117 width: '1%' 36118 } 36119 } 36120 } 36121 }, 36122 [LAYOUT_GRID]: { 36123 layout: { 36124 mediaField: 'preview', 36125 primaryField: 'title', 36126 badgeFields: ['sync-status'] 36127 } 36128 } 36129 }; 36130 const DEFAULT_VIEW = { 36131 type: LAYOUT_GRID, 36132 search: '', 36133 page: 1, 36134 perPage: 20, 36135 layout: page_patterns_defaultLayouts[LAYOUT_GRID].layout, 36136 fields: ['title', 'sync-status'], 36137 filters: [] 36138 }; 36139 function DataviewsPatterns() { 36140 const { 36141 params: { 36142 postType, 36143 categoryId: categoryIdFromURL 36144 } 36145 } = page_patterns_useLocation(); 36146 const type = postType || PATTERN_TYPES.user; 36147 const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY; 36148 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_VIEW); 36149 const previousCategoryId = (0,external_wp_compose_namespaceObject.usePrevious)(categoryId); 36150 const previousPostType = (0,external_wp_compose_namespaceObject.usePrevious)(type); 36151 const viewSyncStatus = view.filters?.find(({ 36152 field 36153 }) => field === 'sync-status')?.value; 36154 const { 36155 patterns, 36156 isResolving 36157 } = use_patterns(type, categoryId, { 36158 search: view.search, 36159 syncStatus: viewSyncStatus 36160 }); 36161 const { 36162 records 36163 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 36164 per_page: -1 36165 }); 36166 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 36167 if (!records) { 36168 return page_patterns_EMPTY_ARRAY; 36169 } 36170 const authorsSet = new Set(); 36171 records.forEach(template => { 36172 authorsSet.add(template.author_text); 36173 }); 36174 return Array.from(authorsSet).map(author => ({ 36175 value: author, 36176 label: author 36177 })); 36178 }, [records]); 36179 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 36180 const _fields = [previewField, titleField]; 36181 if (type === PATTERN_TYPES.user) { 36182 _fields.push(patternStatusField); 36183 } else if (type === TEMPLATE_PART_POST_TYPE) { 36184 _fields.push({ 36185 ...templatePartAuthorField, 36186 elements: authors 36187 }); 36188 } 36189 return _fields; 36190 }, [type, authors]); 36191 36192 // Reset the page number when the category changes. 36193 (0,external_wp_element_namespaceObject.useEffect)(() => { 36194 if (previousCategoryId !== categoryId || previousPostType !== type) { 36195 setView(prevView => ({ 36196 ...prevView, 36197 page: 1 36198 })); 36199 } 36200 }, [categoryId, previousCategoryId, previousPostType, type]); 36201 const { 36202 data, 36203 paginationInfo 36204 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 36205 // Search is managed server-side as well as filters for patterns. 36206 // However, the author filter in template parts is done client-side. 36207 const viewWithoutFilters = { 36208 ...view 36209 }; 36210 delete viewWithoutFilters.search; 36211 if (type !== TEMPLATE_PART_POST_TYPE) { 36212 viewWithoutFilters.filters = []; 36213 } 36214 return filterSortAndPaginate(patterns, viewWithoutFilters, fields); 36215 }, [patterns, view, fields, type]); 36216 const dataWithPermissions = useAugmentPatternsWithPermissions(data); 36217 const templatePartActions = page_patterns_usePostActions({ 36218 postType: TEMPLATE_PART_POST_TYPE, 36219 context: 'list' 36220 }); 36221 const patternActions = page_patterns_usePostActions({ 36222 postType: PATTERN_TYPES.user, 36223 context: 'list' 36224 }); 36225 const editAction = useEditPostAction(); 36226 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { 36227 if (type === TEMPLATE_PART_POST_TYPE) { 36228 return [editAction, ...templatePartActions].filter(Boolean); 36229 } 36230 return [editAction, ...patternActions].filter(Boolean); 36231 }, [editAction, type, templatePartActions, patternActions]); 36232 const id = (0,external_wp_element_namespaceObject.useId)(); 36233 const settings = usePatternSettings(); 36234 // Wrap everything in a block editor provider. 36235 // This ensures 'styles' that are needed for the previews are synced 36236 // from the site editor store to the block editor store. 36237 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { 36238 settings: settings, 36239 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 36240 title: (0,external_wp_i18n_namespaceObject.__)('Patterns content'), 36241 className: "edit-site-page-patterns-dataviews", 36242 hideTitleFromUI: true, 36243 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsHeader, { 36244 categoryId: categoryId, 36245 type: type, 36246 titleId: `$id}-title`, 36247 descriptionId: `$id}-description` 36248 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 36249 paginationInfo: paginationInfo, 36250 fields: fields, 36251 actions: actions, 36252 data: dataWithPermissions || page_patterns_EMPTY_ARRAY, 36253 getItemId: item => { 36254 var _item$name; 36255 return (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id; 36256 }, 36257 isLoading: isResolving, 36258 view: view, 36259 onChangeView: setView, 36260 defaultLayouts: page_patterns_defaultLayouts 36261 }, categoryId + postType)] 36262 }) 36263 }); 36264 } 36265 36266 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js 36267 /** 36268 * WordPress dependencies 36269 */ 36270 36271 36272 const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36273 xmlns: "http://www.w3.org/2000/svg", 36274 viewBox: "0 0 24 24", 36275 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36276 d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" 36277 }) 36278 }); 36279 /* harmony default export */ const library_home = (home); 36280 36281 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js 36282 /** 36283 * WordPress dependencies 36284 */ 36285 36286 36287 const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36288 viewBox: "0 0 24 24", 36289 xmlns: "http://www.w3.org/2000/svg", 36290 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36291 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" 36292 }) 36293 }); 36294 /* harmony default export */ const library_verse = (verse); 36295 36296 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pin.js 36297 /** 36298 * WordPress dependencies 36299 */ 36300 36301 36302 const pin = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36303 xmlns: "http://www.w3.org/2000/svg", 36304 viewBox: "0 0 24 24", 36305 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36306 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" 36307 }) 36308 }); 36309 /* harmony default export */ const library_pin = (pin); 36310 36311 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js 36312 /** 36313 * WordPress dependencies 36314 */ 36315 36316 36317 const archive = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36318 viewBox: "0 0 24 24", 36319 xmlns: "http://www.w3.org/2000/svg", 36320 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36321 fillRule: "evenodd", 36322 clipRule: "evenodd", 36323 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" 36324 }) 36325 }); 36326 /* harmony default export */ const library_archive = (archive); 36327 36328 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js 36329 /** 36330 * WordPress dependencies 36331 */ 36332 36333 36334 const notFound = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36335 xmlns: "http://www.w3.org/2000/svg", 36336 viewBox: "0 0 24 24", 36337 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36338 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" 36339 }) 36340 }); 36341 /* harmony default export */ const not_found = (notFound); 36342 36343 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js 36344 /** 36345 * WordPress dependencies 36346 */ 36347 36348 36349 const list = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36350 viewBox: "0 0 24 24", 36351 xmlns: "http://www.w3.org/2000/svg", 36352 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36353 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" 36354 }) 36355 }); 36356 /* harmony default export */ const library_list = (list); 36357 36358 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js 36359 /** 36360 * WordPress dependencies 36361 */ 36362 36363 36364 const blockMeta = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36365 xmlns: "http://www.w3.org/2000/svg", 36366 viewBox: "0 0 24 24", 36367 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36368 fillRule: "evenodd", 36369 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", 36370 clipRule: "evenodd" 36371 }) 36372 }); 36373 /* harmony default export */ const block_meta = (blockMeta); 36374 36375 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/calendar.js 36376 /** 36377 * WordPress dependencies 36378 */ 36379 36380 36381 const calendar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36382 viewBox: "0 0 24 24", 36383 xmlns: "http://www.w3.org/2000/svg", 36384 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36385 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" 36386 }) 36387 }); 36388 /* harmony default export */ const library_calendar = (calendar); 36389 36390 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js 36391 /** 36392 * WordPress dependencies 36393 */ 36394 36395 36396 const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36397 xmlns: "http://www.w3.org/2000/svg", 36398 viewBox: "0 0 24 24", 36399 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36400 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" 36401 }) 36402 }); 36403 /* harmony default export */ const library_tag = (tag); 36404 36405 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js 36406 /** 36407 * WordPress dependencies 36408 */ 36409 36410 36411 36412 const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 36413 xmlns: "http://www.w3.org/2000/svg", 36414 viewBox: "0 0 24 24", 36415 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36416 d: "m7 6.5 4 2.5-4 2.5z" 36417 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36418 fillRule: "evenodd", 36419 clipRule: "evenodd", 36420 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" 36421 })] 36422 }); 36423 /* harmony default export */ const library_media = (media); 36424 36425 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js 36426 /** 36427 * WordPress dependencies 36428 */ 36429 36430 36431 const post_post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36432 xmlns: "http://www.w3.org/2000/svg", 36433 viewBox: "0 0 24 24", 36434 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36435 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" 36436 }) 36437 }); 36438 /* harmony default export */ const library_post = (post_post); 36439 36440 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js 36441 /** 36442 * WordPress dependencies 36443 */ 36444 36445 36446 36447 36448 36449 36450 36451 36452 /** 36453 * Internal dependencies 36454 */ 36455 36456 const EMPTY_OBJECT = {}; 36457 36458 /** 36459 * @typedef IHasNameAndId 36460 * @property {string|number} id The entity's id. 36461 * @property {string} name The entity's name. 36462 */ 36463 36464 const utils_getValueFromObjectPath = (object, path) => { 36465 let value = object; 36466 path.split('.').forEach(fieldName => { 36467 value = value?.[fieldName]; 36468 }); 36469 return value; 36470 }; 36471 36472 /** 36473 * Helper util to map records to add a `name` prop from a 36474 * provided path, in order to handle all entities in the same 36475 * fashion(implementing`IHasNameAndId` interface). 36476 * 36477 * @param {Object[]} entities The array of entities. 36478 * @param {string} path The path to map a `name` property from the entity. 36479 * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface. 36480 */ 36481 const mapToIHasNameAndId = (entities, path) => { 36482 return (entities || []).map(entity => ({ 36483 ...entity, 36484 name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path)) 36485 })); 36486 }; 36487 36488 /** 36489 * @typedef {Object} EntitiesInfo 36490 * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..). 36491 * @property {number[]} existingEntitiesIds An array of the existing entities ids. 36492 */ 36493 36494 const useExistingTemplates = () => { 36495 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_POST_TYPE, { 36496 per_page: -1 36497 }), []); 36498 }; 36499 const useDefaultTemplateTypes = () => { 36500 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes(), []); 36501 }; 36502 const usePublicPostTypes = () => { 36503 const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({ 36504 per_page: -1 36505 }), []); 36506 return (0,external_wp_element_namespaceObject.useMemo)(() => { 36507 const excludedPostTypes = ['attachment']; 36508 return postTypes?.filter(({ 36509 viewable, 36510 slug 36511 }) => viewable && !excludedPostTypes.includes(slug)); 36512 }, [postTypes]); 36513 }; 36514 const usePublicTaxonomies = () => { 36515 const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 36516 per_page: -1 36517 }), []); 36518 return (0,external_wp_element_namespaceObject.useMemo)(() => { 36519 return taxonomies?.filter(({ 36520 visibility 36521 }) => visibility?.publicly_queryable); 36522 }, [taxonomies]); 36523 }; 36524 function usePostTypeArchiveMenuItems() { 36525 const publicPostTypes = usePublicPostTypes(); 36526 const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]); 36527 const existingTemplates = useExistingTemplates(); 36528 // We need to keep track of naming conflicts. If a conflict 36529 // occurs, we need to add slug. 36530 const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 36531 labels 36532 }) => { 36533 const singularName = labels.singular_name.toLowerCase(); 36534 accumulator[singularName] = (accumulator[singularName] || 0) + 1; 36535 return accumulator; 36536 }, {}), [publicPostTypes]); 36537 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 36538 labels, 36539 slug 36540 }) => { 36541 const singularName = labels.singular_name.toLowerCase(); 36542 return postTypeLabels[singularName] > 1 && singularName !== slug; 36543 }, [postTypeLabels]); 36544 return (0,external_wp_element_namespaceObject.useMemo)(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => { 36545 let title; 36546 if (needsUniqueIdentifier(postType)) { 36547 title = (0,external_wp_i18n_namespaceObject.sprintf)( 36548 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 36549 (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug); 36550 } else { 36551 title = (0,external_wp_i18n_namespaceObject.sprintf)( 36552 // translators: %s: Name of the post type e.g: "Post". 36553 (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name); 36554 } 36555 return { 36556 slug: 'archive-' + postType.slug, 36557 description: (0,external_wp_i18n_namespaceObject.sprintf)( 36558 // translators: %s: Name of the post type e.g: "Post". 36559 (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name), 36560 title, 36561 // `icon` is the `menu_icon` property of a post type. We 36562 // only handle `dashicons` for now, even if the `menu_icon` 36563 // also supports urls and svg as values. 36564 icon: typeof postType.icon === 'string' && postType.icon.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive, 36565 templatePrefix: 'archive' 36566 }; 36567 }) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]); 36568 } 36569 const usePostTypeMenuItems = onClickMenuItem => { 36570 const publicPostTypes = usePublicPostTypes(); 36571 const existingTemplates = useExistingTemplates(); 36572 const defaultTemplateTypes = useDefaultTemplateTypes(); 36573 // We need to keep track of naming conflicts. If a conflict 36574 // occurs, we need to add slug. 36575 const templateLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 36576 labels 36577 }) => { 36578 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36579 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 36580 return accumulator; 36581 }, {}), [publicPostTypes]); 36582 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 36583 labels, 36584 slug 36585 }) => { 36586 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36587 return templateLabels[templateName] > 1 && templateName !== slug; 36588 }, [templateLabels]); 36589 36590 // `page`is a special case in template hierarchy. 36591 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 36592 slug 36593 }) => { 36594 let suffix = slug; 36595 if (slug !== 'page') { 36596 suffix = `single-$suffix}`; 36597 } 36598 accumulator[slug] = suffix; 36599 return accumulator; 36600 }, {}), [publicPostTypes]); 36601 const postTypesInfo = useEntitiesInfo('postType', templatePrefixes); 36602 const existingTemplateSlugs = (existingTemplates || []).map(({ 36603 slug 36604 }) => slug); 36605 const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => { 36606 const { 36607 slug, 36608 labels, 36609 icon 36610 } = postType; 36611 // We need to check if the general template is part of the 36612 // defaultTemplateTypes. If it is, just use that info and 36613 // augment it with the specific template functionality. 36614 const generalTemplateSlug = templatePrefixes[slug]; 36615 const defaultTemplateType = defaultTemplateTypes?.find(({ 36616 slug: _slug 36617 }) => _slug === generalTemplateSlug); 36618 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 36619 const _needsUniqueIdentifier = needsUniqueIdentifier(postType); 36620 let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)( 36621 // translators: %s: Name of the post type e.g: "Post". 36622 (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name); 36623 if (_needsUniqueIdentifier) { 36624 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 36625 // translators: %1s: Name of the template e.g: "Single Item: Post"; %2s: Slug of the post type e.g: "book". 36626 (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 36627 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 36628 (0,external_wp_i18n_namespaceObject.__)('Single item: %1$s (%2$s)'), labels.singular_name, slug); 36629 } 36630 const menuItem = defaultTemplateType ? { 36631 ...defaultTemplateType, 36632 templatePrefix: templatePrefixes[slug] 36633 } : { 36634 slug: generalTemplateSlug, 36635 title: menuItemTitle, 36636 description: (0,external_wp_i18n_namespaceObject.sprintf)( 36637 // translators: %s: Name of the post type e.g: "Post". 36638 (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name), 36639 // `icon` is the `menu_icon` property of a post type. We 36640 // only handle `dashicons` for now, even if the `menu_icon` 36641 // also supports urls and svg as values. 36642 icon: typeof icon === 'string' && icon.startsWith('dashicons-') ? icon.slice(10) : library_post, 36643 templatePrefix: templatePrefixes[slug] 36644 }; 36645 const hasEntities = postTypesInfo?.[slug]?.hasEntities; 36646 // We have a different template creation flow only if they have entities. 36647 if (hasEntities) { 36648 menuItem.onClick = template => { 36649 onClickMenuItem({ 36650 type: 'postType', 36651 slug, 36652 config: { 36653 recordNamePath: 'title.rendered', 36654 queryArgs: ({ 36655 search 36656 }) => { 36657 return { 36658 _fields: 'id,title,slug,link', 36659 orderBy: search ? 'relevance' : 'modified', 36660 exclude: postTypesInfo[slug].existingEntitiesIds 36661 }; 36662 }, 36663 getSpecificTemplate: suggestion => { 36664 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 36665 return { 36666 title: templateSlug, 36667 slug: templateSlug, 36668 templatePrefix: templatePrefixes[slug] 36669 }; 36670 } 36671 }, 36672 labels, 36673 hasGeneralTemplate, 36674 template 36675 }); 36676 }; 36677 } 36678 // We don't need to add the menu item if there are no 36679 // entities and the general template exists. 36680 if (!hasGeneralTemplate || hasEntities) { 36681 accumulator.push(menuItem); 36682 } 36683 return accumulator; 36684 }, []); 36685 // Split menu items into two groups: one for the default post types 36686 // and one for the rest. 36687 const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => { 36688 const { 36689 slug 36690 } = postType; 36691 let key = 'postTypesMenuItems'; 36692 if (slug === 'page') { 36693 key = 'defaultPostTypesMenuItems'; 36694 } 36695 accumulator[key].push(postType); 36696 return accumulator; 36697 }, { 36698 defaultPostTypesMenuItems: [], 36699 postTypesMenuItems: [] 36700 }), [menuItems]); 36701 return postTypesMenuItems; 36702 }; 36703 const useTaxonomiesMenuItems = onClickMenuItem => { 36704 const publicTaxonomies = usePublicTaxonomies(); 36705 const existingTemplates = useExistingTemplates(); 36706 const defaultTemplateTypes = useDefaultTemplateTypes(); 36707 // `category` and `post_tag` are special cases in template hierarchy. 36708 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies?.reduce((accumulator, { 36709 slug 36710 }) => { 36711 let suffix = slug; 36712 if (!['category', 'post_tag'].includes(slug)) { 36713 suffix = `taxonomy-$suffix}`; 36714 } 36715 if (slug === 'post_tag') { 36716 suffix = `tag`; 36717 } 36718 accumulator[slug] = suffix; 36719 return accumulator; 36720 }, {}), [publicTaxonomies]); 36721 // We need to keep track of naming conflicts. If a conflict 36722 // occurs, we need to add slug. 36723 const taxonomyLabels = publicTaxonomies?.reduce((accumulator, { 36724 labels 36725 }) => { 36726 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36727 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 36728 return accumulator; 36729 }, {}); 36730 const needsUniqueIdentifier = (labels, slug) => { 36731 if (['category', 'post_tag'].includes(slug)) { 36732 return false; 36733 } 36734 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36735 return taxonomyLabels[templateName] > 1 && templateName !== slug; 36736 }; 36737 const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes); 36738 const existingTemplateSlugs = (existingTemplates || []).map(({ 36739 slug 36740 }) => slug); 36741 const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => { 36742 const { 36743 slug, 36744 labels 36745 } = taxonomy; 36746 // We need to check if the general template is part of the 36747 // defaultTemplateTypes. If it is, just use that info and 36748 // augment it with the specific template functionality. 36749 const generalTemplateSlug = templatePrefixes[slug]; 36750 const defaultTemplateType = defaultTemplateTypes?.find(({ 36751 slug: _slug 36752 }) => _slug === generalTemplateSlug); 36753 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 36754 const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug); 36755 let menuItemTitle = labels.template_name || labels.singular_name; 36756 if (_needsUniqueIdentifier) { 36757 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 36758 // translators: %1s: Name of the template e.g: "Products by Category"; %2s: Slug of the taxonomy e.g: "product_cat". 36759 (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 36760 // translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat". 36761 (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.singular_name, slug); 36762 } 36763 const menuItem = defaultTemplateType ? { 36764 ...defaultTemplateType, 36765 templatePrefix: templatePrefixes[slug] 36766 } : { 36767 slug: generalTemplateSlug, 36768 title: menuItemTitle, 36769 description: (0,external_wp_i18n_namespaceObject.sprintf)( 36770 // translators: %s: Name of the taxonomy e.g: "Product Categories". 36771 (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name), 36772 icon: block_meta, 36773 templatePrefix: templatePrefixes[slug] 36774 }; 36775 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; 36776 // We have a different template creation flow only if they have entities. 36777 if (hasEntities) { 36778 menuItem.onClick = template => { 36779 onClickMenuItem({ 36780 type: 'taxonomy', 36781 slug, 36782 config: { 36783 queryArgs: ({ 36784 search 36785 }) => { 36786 return { 36787 _fields: 'id,name,slug,link', 36788 orderBy: search ? 'name' : 'count', 36789 exclude: taxonomiesInfo[slug].existingEntitiesIds 36790 }; 36791 }, 36792 getSpecificTemplate: suggestion => { 36793 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 36794 return { 36795 title: templateSlug, 36796 slug: templateSlug, 36797 templatePrefix: templatePrefixes[slug] 36798 }; 36799 } 36800 }, 36801 labels, 36802 hasGeneralTemplate, 36803 template 36804 }); 36805 }; 36806 } 36807 // We don't need to add the menu item if there are no 36808 // entities and the general template exists. 36809 if (!hasGeneralTemplate || hasEntities) { 36810 accumulator.push(menuItem); 36811 } 36812 return accumulator; 36813 }, []); 36814 // Split menu items into two groups: one for the default taxonomies 36815 // and one for the rest. 36816 const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => { 36817 const { 36818 slug 36819 } = taxonomy; 36820 let key = 'taxonomiesMenuItems'; 36821 if (['category', 'tag'].includes(slug)) { 36822 key = 'defaultTaxonomiesMenuItems'; 36823 } 36824 accumulator[key].push(taxonomy); 36825 return accumulator; 36826 }, { 36827 defaultTaxonomiesMenuItems: [], 36828 taxonomiesMenuItems: [] 36829 }), [menuItems]); 36830 return taxonomiesMenuItems; 36831 }; 36832 const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { 36833 user: 'author' 36834 }; 36835 const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { 36836 user: { 36837 who: 'authors' 36838 } 36839 }; 36840 function useAuthorMenuItem(onClickMenuItem) { 36841 const existingTemplates = useExistingTemplates(); 36842 const defaultTemplateTypes = useDefaultTemplateTypes(); 36843 const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS); 36844 let authorMenuItem = defaultTemplateTypes?.find(({ 36845 slug 36846 }) => slug === 'author'); 36847 if (!authorMenuItem) { 36848 authorMenuItem = { 36849 description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'), 36850 slug: 'author', 36851 title: 'Author' 36852 }; 36853 } 36854 const hasGeneralTemplate = !!existingTemplates?.find(({ 36855 slug 36856 }) => slug === 'author'); 36857 if (authorInfo.user?.hasEntities) { 36858 authorMenuItem = { 36859 ...authorMenuItem, 36860 templatePrefix: 'author' 36861 }; 36862 authorMenuItem.onClick = template => { 36863 onClickMenuItem({ 36864 type: 'root', 36865 slug: 'user', 36866 config: { 36867 queryArgs: ({ 36868 search 36869 }) => { 36870 return { 36871 _fields: 'id,name,slug,link', 36872 orderBy: search ? 'name' : 'registered_date', 36873 exclude: authorInfo.user.existingEntitiesIds, 36874 who: 'authors' 36875 }; 36876 }, 36877 getSpecificTemplate: suggestion => { 36878 const templateSlug = `author-$suggestion.slug}`; 36879 return { 36880 title: templateSlug, 36881 slug: templateSlug, 36882 templatePrefix: 'author' 36883 }; 36884 } 36885 }, 36886 labels: { 36887 singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'), 36888 search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'), 36889 not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'), 36890 all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors') 36891 }, 36892 hasGeneralTemplate, 36893 template 36894 }); 36895 }; 36896 } 36897 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { 36898 return authorMenuItem; 36899 } 36900 } 36901 36902 /** 36903 * Helper hook that filters all the existing templates by the given 36904 * object with the entity's slug as key and the template prefix as value. 36905 * 36906 * Example: 36907 * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ] 36908 * `templatePrefixes` is: { post_tag: 'tag' } 36909 * It will return: { post_tag: ['apple'] } 36910 * 36911 * Note: We append the `-` to the given template prefix in this function for our checks. 36912 * 36913 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 36914 * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value. 36915 */ 36916 const useExistingTemplateSlugs = templatePrefixes => { 36917 const existingTemplates = useExistingTemplates(); 36918 const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => { 36919 return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => { 36920 const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => { 36921 const _prefix = `$prefix}-`; 36922 if (existingTemplate.slug.startsWith(_prefix)) { 36923 _accumulator.push(existingTemplate.slug.substring(_prefix.length)); 36924 } 36925 return _accumulator; 36926 }, []); 36927 if (slugsWithTemplates.length) { 36928 accumulator[slug] = slugsWithTemplates; 36929 } 36930 return accumulator; 36931 }, {}); 36932 }, [templatePrefixes, existingTemplates]); 36933 return existingSlugs; 36934 }; 36935 36936 /** 36937 * Helper hook that finds the existing records with an associated template, 36938 * as they need to be excluded from the template suggestions. 36939 * 36940 * @param {string} entityName The entity's name. 36941 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 36942 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 36943 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value. 36944 */ 36945 const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => { 36946 const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes); 36947 const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => { 36948 return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, [slug, slugsWithTemplates]) => { 36949 const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 36950 _fields: 'id', 36951 context: 'view', 36952 slug: slugsWithTemplates, 36953 ...additionalQueryParameters[slug] 36954 }); 36955 if (entitiesWithTemplates?.length) { 36956 accumulator[slug] = entitiesWithTemplates; 36957 } 36958 return accumulator; 36959 }, {}); 36960 }, [slugsToExcludePerEntity]); 36961 return recordsToExcludePerEntity; 36962 }; 36963 36964 /** 36965 * Helper hook that returns information about an entity having 36966 * records that we can create a specific template for. 36967 * 36968 * For example we can search for `terms` in `taxonomy` entity or 36969 * `posts` in `postType` entity. 36970 * 36971 * First we need to find the existing records with an associated template, 36972 * to query afterwards for any remaining record, by excluding them. 36973 * 36974 * @param {string} entityName The entity's name. 36975 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 36976 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 36977 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value. 36978 */ 36979 const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => { 36980 const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters); 36981 const entitiesHasRecords = (0,external_wp_data_namespaceObject.useSelect)(select => { 36982 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 36983 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 36984 id 36985 }) => id) || []; 36986 accumulator[slug] = !!select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 36987 per_page: 1, 36988 _fields: 'id', 36989 context: 'view', 36990 exclude: existingEntitiesIds, 36991 ...additionalQueryParameters[slug] 36992 })?.length; 36993 return accumulator; 36994 }, {}); 36995 }, [templatePrefixes, recordsToExcludePerEntity, entityName, additionalQueryParameters]); 36996 const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => { 36997 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 36998 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 36999 id 37000 }) => id) || []; 37001 accumulator[slug] = { 37002 hasEntities: entitiesHasRecords[slug], 37003 existingEntitiesIds 37004 }; 37005 return accumulator; 37006 }, {}); 37007 }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]); 37008 return entitiesInfo; 37009 }; 37010 37011 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js 37012 /** 37013 * WordPress dependencies 37014 */ 37015 37016 37017 37018 37019 37020 37021 37022 /** 37023 * Internal dependencies 37024 */ 37025 37026 37027 37028 37029 const add_custom_template_modal_content_EMPTY_ARRAY = []; 37030 function SuggestionListItem({ 37031 suggestion, 37032 search, 37033 onSelect, 37034 entityForSuggestions 37035 }) { 37036 const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item'; 37037 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 37038 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37039 __next40pxDefaultSize: true, 37040 role: "option", 37041 className: baseCssClass, 37042 onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion)) 37043 }), 37044 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37045 size: "body", 37046 lineHeight: 1.53846153846 // 20px 37047 , 37048 weight: 500, 37049 className: `$baseCssClass}__title`, 37050 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight, { 37051 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name), 37052 highlight: search 37053 }) 37054 }), suggestion.link && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37055 size: "body", 37056 lineHeight: 1.53846153846 // 20px 37057 , 37058 className: `$baseCssClass}__info`, 37059 children: suggestion.link 37060 })] 37061 }); 37062 } 37063 function useSearchSuggestions(entityForSuggestions, search) { 37064 const { 37065 config 37066 } = entityForSuggestions; 37067 const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 37068 order: 'asc', 37069 context: 'view', 37070 search, 37071 per_page: search ? 20 : 10, 37072 ...config.queryArgs(search) 37073 }), [search, config]); 37074 const { 37075 records: searchResults, 37076 hasResolved: searchHasResolved 37077 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query); 37078 const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(add_custom_template_modal_content_EMPTY_ARRAY); 37079 (0,external_wp_element_namespaceObject.useEffect)(() => { 37080 if (!searchHasResolved) { 37081 return; 37082 } 37083 let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY; 37084 if (searchResults?.length) { 37085 newSuggestions = searchResults; 37086 if (config.recordNamePath) { 37087 newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath); 37088 } 37089 } 37090 // Update suggestions only when the query has resolved, so as to keep 37091 // the previous results in the UI. 37092 setSuggestions(newSuggestions); 37093 }, [searchResults, searchHasResolved]); 37094 return suggestions; 37095 } 37096 function SuggestionList({ 37097 entityForSuggestions, 37098 onSelect 37099 }) { 37100 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); 37101 const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch); 37102 const { 37103 labels 37104 } = entityForSuggestions; 37105 const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false); 37106 if (!showSearchControl && suggestions?.length > 9) { 37107 setShowSearchControl(true); 37108 } 37109 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37110 children: [showSearchControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 37111 __nextHasNoMarginBottom: true, 37112 onChange: setSearch, 37113 value: search, 37114 label: labels.search_items, 37115 placeholder: labels.search_items 37116 }), !!suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 37117 orientation: "vertical", 37118 role: "listbox", 37119 className: "edit-site-custom-template-modal__suggestions_list", 37120 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list'), 37121 children: suggestions.map(suggestion => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionListItem, { 37122 suggestion: suggestion, 37123 search: debouncedSearch, 37124 onSelect: onSelect, 37125 entityForSuggestions: entityForSuggestions 37126 }, suggestion.slug)) 37127 }), debouncedSearch && !suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37128 as: "p", 37129 className: "edit-site-custom-template-modal__no-results", 37130 children: labels.not_found 37131 })] 37132 }); 37133 } 37134 function AddCustomTemplateModalContent({ 37135 onSelect, 37136 entityForSuggestions 37137 }) { 37138 const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate); 37139 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37140 spacing: 4, 37141 className: "edit-site-custom-template-modal__contents-wrapper", 37142 alignment: "left", 37143 children: [!showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37144 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37145 as: "p", 37146 children: (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.') 37147 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 37148 className: "edit-site-custom-template-modal__contents", 37149 gap: "4", 37150 align: "initial", 37151 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 37152 isBlock: true, 37153 as: external_wp_components_namespaceObject.Button, 37154 onClick: () => { 37155 const { 37156 slug, 37157 title, 37158 description, 37159 templatePrefix 37160 } = entityForSuggestions.template; 37161 onSelect({ 37162 slug, 37163 title, 37164 description, 37165 templatePrefix 37166 }); 37167 }, 37168 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37169 as: "span", 37170 weight: 500, 37171 lineHeight: 1.53846153846 // 20px 37172 , 37173 children: entityForSuggestions.labels.all_items 37174 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37175 as: "span", 37176 lineHeight: 1.53846153846 // 20px 37177 , 37178 children: 37179 // 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. 37180 (0,external_wp_i18n_namespaceObject.__)('For all items') 37181 })] 37182 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 37183 isBlock: true, 37184 as: external_wp_components_namespaceObject.Button, 37185 onClick: () => { 37186 setShowSearchEntities(true); 37187 }, 37188 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37189 as: "span", 37190 weight: 500, 37191 lineHeight: 1.53846153846 // 20px 37192 , 37193 children: entityForSuggestions.labels.singular_name 37194 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37195 as: "span", 37196 lineHeight: 1.53846153846 // 20px 37197 , 37198 children: 37199 // 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. 37200 (0,external_wp_i18n_namespaceObject.__)('For a specific item') 37201 })] 37202 })] 37203 })] 37204 }), showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37205 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37206 as: "p", 37207 children: (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.') 37208 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionList, { 37209 entityForSuggestions: entityForSuggestions, 37210 onSelect: onSelect 37211 })] 37212 })] 37213 }); 37214 } 37215 /* harmony default export */ const add_custom_template_modal_content = (AddCustomTemplateModalContent); 37216 37217 ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs 37218 /****************************************************************************** 37219 Copyright (c) Microsoft Corporation. 37220 37221 Permission to use, copy, modify, and/or distribute this software for any 37222 purpose with or without fee is hereby granted. 37223 37224 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 37225 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 37226 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 37227 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 37228 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 37229 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 37230 PERFORMANCE OF THIS SOFTWARE. 37231 ***************************************************************************** */ 37232 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 37233 37234 var extendStatics = function(d, b) { 37235 extendStatics = Object.setPrototypeOf || 37236 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 37237 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 37238 return extendStatics(d, b); 37239 }; 37240 37241 function __extends(d, b) { 37242 if (typeof b !== "function" && b !== null) 37243 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 37244 extendStatics(d, b); 37245 function __() { this.constructor = d; } 37246 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 37247 } 37248 37249 var __assign = function() { 37250 __assign = Object.assign || function __assign(t) { 37251 for (var s, i = 1, n = arguments.length; i < n; i++) { 37252 s = arguments[i]; 37253 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 37254 } 37255 return t; 37256 } 37257 return __assign.apply(this, arguments); 37258 } 37259 37260 function __rest(s, e) { 37261 var t = {}; 37262 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 37263 t[p] = s[p]; 37264 if (s != null && typeof Object.getOwnPropertySymbols === "function") 37265 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 37266 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 37267 t[p[i]] = s[p[i]]; 37268 } 37269 return t; 37270 } 37271 37272 function __decorate(decorators, target, key, desc) { 37273 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 37274 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 37275 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; 37276 return c > 3 && r && Object.defineProperty(target, key, r), r; 37277 } 37278 37279 function __param(paramIndex, decorator) { 37280 return function (target, key) { decorator(target, key, paramIndex); } 37281 } 37282 37283 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 37284 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 37285 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 37286 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 37287 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 37288 var _, done = false; 37289 for (var i = decorators.length - 1; i >= 0; i--) { 37290 var context = {}; 37291 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 37292 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 37293 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 37294 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 37295 if (kind === "accessor") { 37296 if (result === void 0) continue; 37297 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 37298 if (_ = accept(result.get)) descriptor.get = _; 37299 if (_ = accept(result.set)) descriptor.set = _; 37300 if (_ = accept(result.init)) initializers.unshift(_); 37301 } 37302 else if (_ = accept(result)) { 37303 if (kind === "field") initializers.unshift(_); 37304 else descriptor[key] = _; 37305 } 37306 } 37307 if (target) Object.defineProperty(target, contextIn.name, descriptor); 37308 done = true; 37309 }; 37310 37311 function __runInitializers(thisArg, initializers, value) { 37312 var useValue = arguments.length > 2; 37313 for (var i = 0; i < initializers.length; i++) { 37314 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 37315 } 37316 return useValue ? value : void 0; 37317 }; 37318 37319 function __propKey(x) { 37320 return typeof x === "symbol" ? x : "".concat(x); 37321 }; 37322 37323 function __setFunctionName(f, name, prefix) { 37324 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 37325 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 37326 }; 37327 37328 function __metadata(metadataKey, metadataValue) { 37329 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 37330 } 37331 37332 function __awaiter(thisArg, _arguments, P, generator) { 37333 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 37334 return new (P || (P = Promise))(function (resolve, reject) { 37335 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 37336 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 37337 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 37338 step((generator = generator.apply(thisArg, _arguments || [])).next()); 37339 }); 37340 } 37341 37342 function __generator(thisArg, body) { 37343 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); 37344 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 37345 function verb(n) { return function (v) { return step([n, v]); }; } 37346 function step(op) { 37347 if (f) throw new TypeError("Generator is already executing."); 37348 while (g && (g = 0, op[0] && (_ = 0)), _) try { 37349 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; 37350 if (y = 0, t) op = [op[0] & 2, t.value]; 37351 switch (op[0]) { 37352 case 0: case 1: t = op; break; 37353 case 4: _.label++; return { value: op[1], done: false }; 37354 case 5: _.label++; y = op[1]; op = [0]; continue; 37355 case 7: op = _.ops.pop(); _.trys.pop(); continue; 37356 default: 37357 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 37358 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 37359 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 37360 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 37361 if (t[2]) _.ops.pop(); 37362 _.trys.pop(); continue; 37363 } 37364 op = body.call(thisArg, _); 37365 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 37366 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 37367 } 37368 } 37369 37370 var __createBinding = Object.create ? (function(o, m, k, k2) { 37371 if (k2 === undefined) k2 = k; 37372 var desc = Object.getOwnPropertyDescriptor(m, k); 37373 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 37374 desc = { enumerable: true, get: function() { return m[k]; } }; 37375 } 37376 Object.defineProperty(o, k2, desc); 37377 }) : (function(o, m, k, k2) { 37378 if (k2 === undefined) k2 = k; 37379 o[k2] = m[k]; 37380 }); 37381 37382 function __exportStar(m, o) { 37383 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 37384 } 37385 37386 function __values(o) { 37387 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 37388 if (m) return m.call(o); 37389 if (o && typeof o.length === "number") return { 37390 next: function () { 37391 if (o && i >= o.length) o = void 0; 37392 return { value: o && o[i++], done: !o }; 37393 } 37394 }; 37395 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 37396 } 37397 37398 function __read(o, n) { 37399 var m = typeof Symbol === "function" && o[Symbol.iterator]; 37400 if (!m) return o; 37401 var i = m.call(o), r, ar = [], e; 37402 try { 37403 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 37404 } 37405 catch (error) { e = { error: error }; } 37406 finally { 37407 try { 37408 if (r && !r.done && (m = i["return"])) m.call(i); 37409 } 37410 finally { if (e) throw e.error; } 37411 } 37412 return ar; 37413 } 37414 37415 /** @deprecated */ 37416 function __spread() { 37417 for (var ar = [], i = 0; i < arguments.length; i++) 37418 ar = ar.concat(__read(arguments[i])); 37419 return ar; 37420 } 37421 37422 /** @deprecated */ 37423 function __spreadArrays() { 37424 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 37425 for (var r = Array(s), k = 0, i = 0; i < il; i++) 37426 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 37427 r[k] = a[j]; 37428 return r; 37429 } 37430 37431 function __spreadArray(to, from, pack) { 37432 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 37433 if (ar || !(i in from)) { 37434 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 37435 ar[i] = from[i]; 37436 } 37437 } 37438 return to.concat(ar || Array.prototype.slice.call(from)); 37439 } 37440 37441 function __await(v) { 37442 return this instanceof __await ? (this.v = v, this) : new __await(v); 37443 } 37444 37445 function __asyncGenerator(thisArg, _arguments, generator) { 37446 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 37447 var g = generator.apply(thisArg, _arguments || []), i, q = []; 37448 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 37449 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 37450 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]); } } 37451 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 37452 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 37453 function fulfill(value) { resume("next", value); } 37454 function reject(value) { resume("throw", value); } 37455 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 37456 } 37457 37458 function __asyncDelegator(o) { 37459 var i, p; 37460 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 37461 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; } 37462 } 37463 37464 function __asyncValues(o) { 37465 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 37466 var m = o[Symbol.asyncIterator], i; 37467 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); 37468 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); }); }; } 37469 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 37470 } 37471 37472 function __makeTemplateObject(cooked, raw) { 37473 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 37474 return cooked; 37475 }; 37476 37477 var __setModuleDefault = Object.create ? (function(o, v) { 37478 Object.defineProperty(o, "default", { enumerable: true, value: v }); 37479 }) : function(o, v) { 37480 o["default"] = v; 37481 }; 37482 37483 function __importStar(mod) { 37484 if (mod && mod.__esModule) return mod; 37485 var result = {}; 37486 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 37487 __setModuleDefault(result, mod); 37488 return result; 37489 } 37490 37491 function __importDefault(mod) { 37492 return (mod && mod.__esModule) ? mod : { default: mod }; 37493 } 37494 37495 function __classPrivateFieldGet(receiver, state, kind, f) { 37496 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 37497 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"); 37498 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 37499 } 37500 37501 function __classPrivateFieldSet(receiver, state, value, kind, f) { 37502 if (kind === "m") throw new TypeError("Private method is not writable"); 37503 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 37504 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"); 37505 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 37506 } 37507 37508 function __classPrivateFieldIn(state, receiver) { 37509 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 37510 return typeof state === "function" ? receiver === state : state.has(receiver); 37511 } 37512 37513 function __addDisposableResource(env, value, async) { 37514 if (value !== null && value !== void 0) { 37515 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 37516 var dispose, inner; 37517 if (async) { 37518 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 37519 dispose = value[Symbol.asyncDispose]; 37520 } 37521 if (dispose === void 0) { 37522 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 37523 dispose = value[Symbol.dispose]; 37524 if (async) inner = dispose; 37525 } 37526 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 37527 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 37528 env.stack.push({ value: value, dispose: dispose, async: async }); 37529 } 37530 else if (async) { 37531 env.stack.push({ async: true }); 37532 } 37533 return value; 37534 } 37535 37536 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 37537 var e = new Error(message); 37538 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 37539 }; 37540 37541 function __disposeResources(env) { 37542 function fail(e) { 37543 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 37544 env.hasError = true; 37545 } 37546 var r, s = 0; 37547 function next() { 37548 while (r = env.stack.pop()) { 37549 try { 37550 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 37551 if (r.dispose) { 37552 var result = r.dispose.call(r.value); 37553 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 37554 } 37555 else s |= 1; 37556 } 37557 catch (e) { 37558 fail(e); 37559 } 37560 } 37561 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 37562 if (env.hasError) throw env.error; 37563 } 37564 return next(); 37565 } 37566 37567 /* harmony default export */ const tslib_es6 = ({ 37568 __extends, 37569 __assign, 37570 __rest, 37571 __decorate, 37572 __param, 37573 __metadata, 37574 __awaiter, 37575 __generator, 37576 __createBinding, 37577 __exportStar, 37578 __values, 37579 __read, 37580 __spread, 37581 __spreadArrays, 37582 __spreadArray, 37583 __await, 37584 __asyncGenerator, 37585 __asyncDelegator, 37586 __asyncValues, 37587 __makeTemplateObject, 37588 __importStar, 37589 __importDefault, 37590 __classPrivateFieldGet, 37591 __classPrivateFieldSet, 37592 __classPrivateFieldIn, 37593 __addDisposableResource, 37594 __disposeResources, 37595 }); 37596 37597 ;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js 37598 /** 37599 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 37600 */ 37601 var SUPPORTED_LOCALE = { 37602 tr: { 37603 regexp: /\u0130|\u0049|\u0049\u0307/g, 37604 map: { 37605 İ: "\u0069", 37606 I: "\u0131", 37607 İ: "\u0069", 37608 }, 37609 }, 37610 az: { 37611 regexp: /\u0130/g, 37612 map: { 37613 İ: "\u0069", 37614 I: "\u0131", 37615 İ: "\u0069", 37616 }, 37617 }, 37618 lt: { 37619 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 37620 map: { 37621 I: "\u0069\u0307", 37622 J: "\u006A\u0307", 37623 Į: "\u012F\u0307", 37624 Ì: "\u0069\u0307\u0300", 37625 Í: "\u0069\u0307\u0301", 37626 Ĩ: "\u0069\u0307\u0303", 37627 }, 37628 }, 37629 }; 37630 /** 37631 * Localized lower case. 37632 */ 37633 function localeLowerCase(str, locale) { 37634 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 37635 if (lang) 37636 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 37637 return lowerCase(str); 37638 } 37639 /** 37640 * Lower case as a function. 37641 */ 37642 function lowerCase(str) { 37643 return str.toLowerCase(); 37644 } 37645 37646 ;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js 37647 37648 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 37649 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 37650 // Remove all non-word characters. 37651 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 37652 /** 37653 * Normalize the string into something other libraries can manipulate easier. 37654 */ 37655 function noCase(input, options) { 37656 if (options === void 0) { options = {}; } 37657 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; 37658 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 37659 var start = 0; 37660 var end = result.length; 37661 // Trim the delimiter from around the output string. 37662 while (result.charAt(start) === "\0") 37663 start++; 37664 while (result.charAt(end - 1) === "\0") 37665 end--; 37666 // Transform each token independently. 37667 return result.slice(start, end).split("\0").map(transform).join(delimiter); 37668 } 37669 /** 37670 * Replace `re` in the input string with the replacement value. 37671 */ 37672 function replace(input, re, value) { 37673 if (re instanceof RegExp) 37674 return input.replace(re, value); 37675 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 37676 } 37677 37678 ;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js 37679 37680 37681 function dotCase(input, options) { 37682 if (options === void 0) { options = {}; } 37683 return noCase(input, __assign({ delimiter: "." }, options)); 37684 } 37685 37686 ;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js 37687 37688 37689 function paramCase(input, options) { 37690 if (options === void 0) { options = {}; } 37691 return dotCase(input, __assign({ delimiter: "-" }, options)); 37692 } 37693 37694 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js 37695 /** 37696 * External dependencies 37697 */ 37698 37699 37700 /** 37701 * WordPress dependencies 37702 */ 37703 37704 37705 37706 37707 37708 function AddCustomGenericTemplateModalContent({ 37709 onClose, 37710 createTemplate 37711 }) { 37712 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 37713 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); 37714 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 37715 async function onCreateTemplate(event) { 37716 event.preventDefault(); 37717 if (isBusy) { 37718 return; 37719 } 37720 setIsBusy(true); 37721 try { 37722 await createTemplate({ 37723 slug: 'wp-custom-template-' + paramCase(title || defaultTitle), 37724 title: title || defaultTitle 37725 }, false); 37726 } finally { 37727 setIsBusy(false); 37728 } 37729 } 37730 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 37731 onSubmit: onCreateTemplate, 37732 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37733 spacing: 6, 37734 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 37735 __next40pxDefaultSize: true, 37736 __nextHasNoMarginBottom: true, 37737 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 37738 value: title, 37739 onChange: setTitle, 37740 placeholder: defaultTitle, 37741 disabled: isBusy, 37742 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.') 37743 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37744 className: "edit-site-custom-generic-template__modal-actions", 37745 justify: "right", 37746 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37747 __next40pxDefaultSize: true, 37748 variant: "tertiary", 37749 onClick: () => { 37750 onClose(); 37751 }, 37752 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 37753 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37754 __next40pxDefaultSize: true, 37755 variant: "primary", 37756 type: "submit", 37757 isBusy: isBusy, 37758 "aria-disabled": isBusy, 37759 children: (0,external_wp_i18n_namespaceObject.__)('Create') 37760 })] 37761 })] 37762 }) 37763 }); 37764 } 37765 /* harmony default export */ const add_custom_generic_template_modal_content = (AddCustomGenericTemplateModalContent); 37766 37767 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js 37768 /** 37769 * External dependencies 37770 */ 37771 37772 37773 /** 37774 * WordPress dependencies 37775 */ 37776 37777 37778 37779 37780 37781 37782 37783 37784 37785 37786 37787 /** 37788 * Internal dependencies 37789 */ 37790 37791 37792 /** 37793 * Internal dependencies 37794 */ 37795 37796 37797 37798 37799 37800 37801 37802 const { 37803 useHistory: add_new_template_useHistory 37804 } = unlock(external_wp_router_namespaceObject.privateApis); 37805 const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'search', '404']; 37806 const TEMPLATE_ICONS = { 37807 'front-page': library_home, 37808 home: library_verse, 37809 single: library_pin, 37810 page: library_page, 37811 archive: library_archive, 37812 search: library_search, 37813 404: not_found, 37814 index: library_list, 37815 category: library_category, 37816 author: comment_author_avatar, 37817 taxonomy: block_meta, 37818 date: library_calendar, 37819 tag: library_tag, 37820 attachment: library_media 37821 }; 37822 function TemplateListItem({ 37823 title, 37824 direction, 37825 className, 37826 description, 37827 icon, 37828 onClick, 37829 children 37830 }) { 37831 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37832 __next40pxDefaultSize: true, 37833 className: className, 37834 onClick: onClick, 37835 label: description, 37836 showTooltip: !!description, 37837 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 37838 as: "span", 37839 spacing: 2, 37840 align: "center", 37841 justify: "center", 37842 style: { 37843 width: '100%' 37844 }, 37845 direction: direction, 37846 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37847 className: "edit-site-add-new-template__template-icon", 37848 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 37849 icon: icon 37850 }) 37851 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37852 className: "edit-site-add-new-template__template-name", 37853 alignment: "center", 37854 spacing: 0, 37855 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37856 align: "center", 37857 weight: 500, 37858 lineHeight: 1.53846153846 // 20px 37859 , 37860 children: title 37861 }), children] 37862 })] 37863 }) 37864 }); 37865 } 37866 const modalContentMap = { 37867 templatesList: 1, 37868 customTemplate: 2, 37869 customGenericTemplate: 3 37870 }; 37871 function NewTemplateModal({ 37872 onClose 37873 }) { 37874 const [modalContent, setModalContent] = (0,external_wp_element_namespaceObject.useState)(modalContentMap.templatesList); 37875 const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({}); 37876 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 37877 const missingTemplates = useMissingTemplates(setEntityForSuggestions, () => setModalContent(modalContentMap.customTemplate)); 37878 const history = add_new_template_useHistory(); 37879 const { 37880 saveEntityRecord 37881 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 37882 const { 37883 createErrorNotice, 37884 createSuccessNotice 37885 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 37886 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 37887 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 37888 // Site index. 37889 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 37890 }, []); 37891 const TEMPLATE_SHORT_DESCRIPTIONS = { 37892 'front-page': homeUrl, 37893 date: (0,external_wp_i18n_namespaceObject.sprintf)( 37894 // translators: %s: The homepage url. 37895 (0,external_wp_i18n_namespaceObject.__)('E.g. %s'), homeUrl + '/' + new Date().getFullYear()) 37896 }; 37897 async function createTemplate(template, isWPSuggestion = true) { 37898 if (isSubmitting) { 37899 return; 37900 } 37901 setIsSubmitting(true); 37902 try { 37903 const { 37904 title, 37905 description, 37906 slug 37907 } = template; 37908 const newTemplate = await saveEntityRecord('postType', TEMPLATE_POST_TYPE, { 37909 description, 37910 // Slugs need to be strings, so this is for template `404` 37911 slug: slug.toString(), 37912 status: 'publish', 37913 title, 37914 // This adds a post meta field in template that is part of `is_custom` value calculation. 37915 is_wp_suggestion: isWPSuggestion 37916 }, { 37917 throwOnError: true 37918 }); 37919 37920 // Navigate to the created template editor. 37921 history.push({ 37922 postId: newTemplate.id, 37923 postType: TEMPLATE_POST_TYPE, 37924 canvas: 'edit' 37925 }); 37926 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 37927 // translators: %s: Title of the created template e.g: "Category". 37928 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title)), { 37929 type: 'snackbar' 37930 }); 37931 } catch (error) { 37932 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); 37933 createErrorNotice(errorMessage, { 37934 type: 'snackbar' 37935 }); 37936 } finally { 37937 setIsSubmitting(false); 37938 } 37939 } 37940 const onModalClose = () => { 37941 onClose(); 37942 setModalContent(modalContentMap.templatesList); 37943 }; 37944 let modalTitle = (0,external_wp_i18n_namespaceObject.__)('Add template'); 37945 if (modalContent === modalContentMap.customTemplate) { 37946 modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 37947 // translators: %s: Name of the post type e.g: "Post". 37948 (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name); 37949 } else if (modalContent === modalContentMap.customGenericTemplate) { 37950 modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create custom template'); 37951 } 37952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 37953 title: modalTitle, 37954 className: dist_clsx('edit-site-add-new-template__modal', { 37955 'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList, 37956 'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate 37957 }), 37958 onRequestClose: onModalClose, 37959 overlayClassName: modalContent === modalContentMap.customGenericTemplate ? 'edit-site-custom-generic-template__modal' : undefined, 37960 children: [modalContent === modalContentMap.templatesList && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 37961 columns: isMobile ? 2 : 3, 37962 gap: 4, 37963 align: "flex-start", 37964 justify: "center", 37965 className: "edit-site-add-new-template__template-list__contents", 37966 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 37967 className: "edit-site-add-new-template__template-list__prompt", 37968 children: (0,external_wp_i18n_namespaceObject.__)('Select what the new template should apply to:') 37969 }), missingTemplates.map(template => { 37970 const { 37971 title, 37972 slug, 37973 onClick 37974 } = template; 37975 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 37976 title: title, 37977 direction: "column", 37978 className: "edit-site-add-new-template__template-button", 37979 description: TEMPLATE_SHORT_DESCRIPTIONS[slug], 37980 icon: TEMPLATE_ICONS[slug] || library_layout, 37981 onClick: () => onClick ? onClick(template) : createTemplate(template) 37982 }, slug); 37983 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 37984 title: (0,external_wp_i18n_namespaceObject.__)('Custom template'), 37985 direction: "row", 37986 className: "edit-site-add-new-template__custom-template-button", 37987 icon: edit, 37988 onClick: () => setModalContent(modalContentMap.customGenericTemplate), 37989 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37990 lineHeight: 1.53846153846 // 20px 37991 , 37992 children: (0,external_wp_i18n_namespaceObject.__)('A custom template can be manually applied to any post or page.') 37993 }) 37994 })] 37995 }), modalContent === modalContentMap.customTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_template_modal_content, { 37996 onSelect: createTemplate, 37997 entityForSuggestions: entityForSuggestions 37998 }), modalContent === modalContentMap.customGenericTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_generic_template_modal_content, { 37999 onClose: onModalClose, 38000 createTemplate: createTemplate 38001 })] 38002 }); 38003 } 38004 function NewTemplate() { 38005 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 38006 const { 38007 postType 38008 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 38009 const { 38010 getPostType 38011 } = select(external_wp_coreData_namespaceObject.store); 38012 return { 38013 postType: getPostType(TEMPLATE_POST_TYPE) 38014 }; 38015 }, []); 38016 if (!postType) { 38017 return null; 38018 } 38019 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38020 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 38021 variant: "primary", 38022 onClick: () => setShowModal(true), 38023 label: postType.labels.add_new_item, 38024 __next40pxDefaultSize: true, 38025 children: postType.labels.add_new_item 38026 }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { 38027 onClose: () => setShowModal(false) 38028 })] 38029 }); 38030 } 38031 function useMissingTemplates(setEntityForSuggestions, onClick) { 38032 const existingTemplates = useExistingTemplates(); 38033 const defaultTemplateTypes = useDefaultTemplateTypes(); 38034 const existingTemplateSlugs = (existingTemplates || []).map(({ 38035 slug 38036 }) => slug); 38037 const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)); 38038 const onClickMenuItem = _entityForSuggestions => { 38039 onClick?.(); 38040 setEntityForSuggestions(_entityForSuggestions); 38041 }; 38042 // We need to replace existing default template types with 38043 // the create specific template functionality. The original 38044 // info (title, description, etc.) is preserved in the 38045 // used hooks. 38046 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; 38047 const { 38048 defaultTaxonomiesMenuItems, 38049 taxonomiesMenuItems 38050 } = useTaxonomiesMenuItems(onClickMenuItem); 38051 const { 38052 defaultPostTypesMenuItems, 38053 postTypesMenuItems 38054 } = usePostTypeMenuItems(onClickMenuItem); 38055 const authorMenuItem = useAuthorMenuItem(onClickMenuItem); 38056 [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => { 38057 if (!menuItem) { 38058 return; 38059 } 38060 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug); 38061 // Some default template types might have been filtered above from 38062 // `missingDefaultTemplates` because they only check for the general 38063 // template. So here we either replace or append the item, augmented 38064 // with the check if it has available specific item to create a 38065 // template for. 38066 if (matchIndex > -1) { 38067 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; 38068 } else { 38069 enhancedMissingDefaultTemplateTypes.push(menuItem); 38070 } 38071 }); 38072 // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order. 38073 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { 38074 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); 38075 }); 38076 const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems]; 38077 return missingTemplates; 38078 } 38079 /* harmony default export */ const add_new_template = ((0,external_wp_element_namespaceObject.memo)(NewTemplate)); 38080 38081 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js 38082 /** 38083 * External dependencies 38084 */ 38085 38086 38087 /** 38088 * WordPress dependencies 38089 */ 38090 38091 38092 38093 38094 38095 38096 38097 38098 /** 38099 * Internal dependencies 38100 */ 38101 38102 38103 38104 38105 38106 38107 38108 const { 38109 useGlobalStyle: page_templates_fields_useGlobalStyle 38110 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 38111 function fields_PreviewField({ 38112 item 38113 }) { 38114 const settings = usePatternSettings(); 38115 const [backgroundColor = 'white'] = page_templates_fields_useGlobalStyle('color.background'); 38116 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 38117 return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw); 38118 }, [item.content.raw]); 38119 const { 38120 onClick 38121 } = useLink({ 38122 postId: item.id, 38123 postType: item.type, 38124 canvas: 'edit' 38125 }); 38126 const isEmpty = !blocks?.length; 38127 // Wrap everything in a block editor provider to ensure 'styles' that are needed 38128 // for the previews are synced between the site editor store and the block editor store. 38129 // Additionally we need to have the `__experimentalBlockPatterns` setting in order to 38130 // render patterns inside the previews. 38131 // TODO: Same approach is used in the patterns list and it becomes obvious that some of 38132 // the block editor settings are needed in context where we don't have the block editor. 38133 // Explore how we can solve this in a better way. 38134 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { 38135 post: item, 38136 settings: settings, 38137 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38138 className: "page-templates-preview-field", 38139 style: { 38140 backgroundColor 38141 }, 38142 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("button", { 38143 className: "page-templates-preview-field__button", 38144 type: "button", 38145 onClick: onClick, 38146 "aria-label": item.title?.rendered || item.title, 38147 children: [isEmpty && (0,external_wp_i18n_namespaceObject.__)('Empty template'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Async, { 38148 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 38149 blocks: blocks 38150 }) 38151 })] 38152 }) 38153 }) 38154 }); 38155 } 38156 const fields_previewField = { 38157 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 38158 id: 'preview', 38159 render: fields_PreviewField, 38160 enableSorting: false 38161 }; 38162 function fields_TitleField({ 38163 item 38164 }) { 38165 const linkProps = { 38166 params: { 38167 postId: item.id, 38168 postType: item.type, 38169 canvas: 'edit' 38170 } 38171 }; 38172 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Link, { 38173 ...linkProps, 38174 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 38175 }); 38176 } 38177 const fields_titleField = { 38178 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 38179 id: 'title', 38180 getValue: ({ 38181 item 38182 }) => item.title?.rendered, 38183 render: fields_TitleField, 38184 enableHiding: false, 38185 enableGlobalSearch: true 38186 }; 38187 const descriptionField = { 38188 label: (0,external_wp_i18n_namespaceObject.__)('Description'), 38189 id: 'description', 38190 render: ({ 38191 item 38192 }) => { 38193 return item.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 38194 className: "page-templates-description", 38195 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description) 38196 }); 38197 }, 38198 enableSorting: false, 38199 enableGlobalSearch: true 38200 }; 38201 function fields_AuthorField({ 38202 item 38203 }) { 38204 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 38205 const { 38206 text, 38207 icon, 38208 imageUrl 38209 } = useAddedBy(item.type, item.id); 38210 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 38211 alignment: "left", 38212 spacing: 0, 38213 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38214 className: dist_clsx('page-templates-author-field__avatar', { 38215 'is-loaded': isImageLoaded 38216 }), 38217 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 38218 onLoad: () => setIsImageLoaded(true), 38219 alt: "", 38220 src: imageUrl 38221 }) 38222 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38223 className: "page-templates-author-field__icon", 38224 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 38225 icon: icon 38226 }) 38227 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 38228 className: "page-templates-author-field__name", 38229 children: text 38230 })] 38231 }); 38232 } 38233 const authorField = { 38234 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 38235 id: 'author', 38236 getValue: ({ 38237 item 38238 }) => item.author_text, 38239 render: fields_AuthorField 38240 }; 38241 38242 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js 38243 /** 38244 * WordPress dependencies 38245 */ 38246 38247 38248 38249 38250 38251 38252 38253 /** 38254 * Internal dependencies 38255 */ 38256 38257 38258 38259 38260 38261 38262 38263 const { 38264 usePostActions: page_templates_usePostActions 38265 } = unlock(external_wp_editor_namespaceObject.privateApis); 38266 const { 38267 useHistory: page_templates_useHistory, 38268 useLocation: page_templates_useLocation 38269 } = unlock(external_wp_router_namespaceObject.privateApis); 38270 const { 38271 useEntityRecordsWithPermissions: page_templates_useEntityRecordsWithPermissions 38272 } = unlock(external_wp_coreData_namespaceObject.privateApis); 38273 const page_templates_EMPTY_ARRAY = []; 38274 const page_templates_defaultLayouts = { 38275 [LAYOUT_TABLE]: { 38276 fields: ['template', 'author'], 38277 layout: { 38278 primaryField: 'title', 38279 combinedFields: [{ 38280 id: 'template', 38281 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 38282 children: ['title', 'description'], 38283 direction: 'vertical' 38284 }], 38285 styles: { 38286 template: { 38287 maxWidth: 400, 38288 minWidth: 320 38289 }, 38290 preview: { 38291 width: '1%' 38292 }, 38293 author: { 38294 width: '1%' 38295 } 38296 } 38297 } 38298 }, 38299 [LAYOUT_GRID]: { 38300 fields: ['title', 'description', 'author'], 38301 layout: { 38302 mediaField: 'preview', 38303 primaryField: 'title', 38304 columnFields: ['description'] 38305 } 38306 }, 38307 [LAYOUT_LIST]: { 38308 fields: ['title', 'description', 'author'], 38309 layout: { 38310 primaryField: 'title', 38311 mediaField: 'preview' 38312 } 38313 } 38314 }; 38315 const page_templates_DEFAULT_VIEW = { 38316 type: LAYOUT_GRID, 38317 search: '', 38318 page: 1, 38319 perPage: 20, 38320 sort: { 38321 field: 'title', 38322 direction: 'asc' 38323 }, 38324 fields: page_templates_defaultLayouts[LAYOUT_GRID].fields, 38325 layout: page_templates_defaultLayouts[LAYOUT_GRID].layout, 38326 filters: [] 38327 }; 38328 function PageTemplates() { 38329 const { 38330 params 38331 } = page_templates_useLocation(); 38332 const { 38333 activeView = 'all', 38334 layout, 38335 postId 38336 } = params; 38337 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([postId]); 38338 const defaultView = (0,external_wp_element_namespaceObject.useMemo)(() => { 38339 const usedType = layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type; 38340 return { 38341 ...page_templates_DEFAULT_VIEW, 38342 type: usedType, 38343 layout: page_templates_defaultLayouts[usedType].layout, 38344 fields: page_templates_defaultLayouts[usedType].fields, 38345 filters: activeView !== 'all' ? [{ 38346 field: 'author', 38347 operator: 'isAny', 38348 value: [activeView] 38349 }] : [] 38350 }; 38351 }, [layout, activeView]); 38352 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(defaultView); 38353 (0,external_wp_element_namespaceObject.useEffect)(() => { 38354 setView(currentView => ({ 38355 ...currentView, 38356 filters: activeView !== 'all' ? [{ 38357 field: 'author', 38358 operator: OPERATOR_IS_ANY, 38359 value: [activeView] 38360 }] : [] 38361 })); 38362 }, [activeView]); 38363 const { 38364 records, 38365 isResolving: isLoadingData 38366 } = page_templates_useEntityRecordsWithPermissions('postType', TEMPLATE_POST_TYPE, { 38367 per_page: -1 38368 }); 38369 const history = page_templates_useHistory(); 38370 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 38371 setSelection(items); 38372 if (view?.type === LAYOUT_LIST) { 38373 history.push({ 38374 ...params, 38375 postId: items.length === 1 ? items[0] : undefined 38376 }); 38377 } 38378 }, [history, params, view?.type]); 38379 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 38380 if (!records) { 38381 return page_templates_EMPTY_ARRAY; 38382 } 38383 const authorsSet = new Set(); 38384 records.forEach(template => { 38385 authorsSet.add(template.author_text); 38386 }); 38387 return Array.from(authorsSet).map(author => ({ 38388 value: author, 38389 label: author 38390 })); 38391 }, [records]); 38392 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [fields_previewField, fields_titleField, descriptionField, { 38393 ...authorField, 38394 elements: authors 38395 }], [authors]); 38396 const { 38397 data, 38398 paginationInfo 38399 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 38400 return filterSortAndPaginate(records, view, fields); 38401 }, [records, view, fields]); 38402 const postTypeActions = page_templates_usePostActions({ 38403 postType: TEMPLATE_POST_TYPE, 38404 context: 'list' 38405 }); 38406 const editAction = useEditPostAction(); 38407 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 38408 const onChangeView = (0,external_wp_element_namespaceObject.useCallback)(newView => { 38409 if (newView.type !== view.type) { 38410 history.push({ 38411 ...params, 38412 layout: newView.type 38413 }); 38414 } 38415 setView(newView); 38416 }, [view.type, setView, history, params]); 38417 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 38418 className: "edit-site-page-templates", 38419 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 38420 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template, {}), 38421 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 38422 paginationInfo: paginationInfo, 38423 fields: fields, 38424 actions: actions, 38425 data: data, 38426 isLoading: isLoadingData, 38427 view: view, 38428 onChangeView: onChangeView, 38429 onChangeSelection: onChangeSelection, 38430 selection: selection, 38431 defaultLayouts: page_templates_defaultLayouts 38432 }, activeView) 38433 }); 38434 } 38435 38436 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js 38437 /** 38438 * External dependencies 38439 */ 38440 38441 38442 /** 38443 * WordPress dependencies 38444 */ 38445 38446 38447 function SidebarButton(props) { 38448 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 38449 size: "compact", 38450 ...props, 38451 className: dist_clsx('edit-site-sidebar-button', props.className) 38452 }); 38453 } 38454 38455 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js 38456 /** 38457 * External dependencies 38458 */ 38459 38460 38461 /** 38462 * WordPress dependencies 38463 */ 38464 38465 38466 38467 38468 38469 38470 38471 38472 /** 38473 * Internal dependencies 38474 */ 38475 38476 38477 38478 38479 38480 38481 38482 38483 const { 38484 useHistory: sidebar_navigation_screen_useHistory, 38485 useLocation: sidebar_navigation_screen_useLocation 38486 } = unlock(external_wp_router_namespaceObject.privateApis); 38487 function SidebarNavigationScreen({ 38488 isRoot, 38489 title, 38490 actions, 38491 meta, 38492 content, 38493 footer, 38494 description, 38495 backPath: backPathProp 38496 }) { 38497 const { 38498 dashboardLink, 38499 dashboardLinkText, 38500 previewingThemeName 38501 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 38502 const { 38503 getSettings 38504 } = unlock(select(store)); 38505 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 38506 return { 38507 dashboardLink: getSettings().__experimentalDashboardLink, 38508 dashboardLinkText: getSettings().__experimentalDashboardLinkText, 38509 // Do not call `getTheme` with null, it will cause a request to 38510 // the server. 38511 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined 38512 }; 38513 }, []); 38514 const location = sidebar_navigation_screen_useLocation(); 38515 const history = sidebar_navigation_screen_useHistory(); 38516 const { 38517 navigate 38518 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 38519 const backPath = backPathProp !== null && backPathProp !== void 0 ? backPathProp : location.state?.backPath; 38520 const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; 38521 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38522 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 38523 className: dist_clsx('edit-site-sidebar-navigation-screen__main', { 38524 'has-footer': !!footer 38525 }), 38526 spacing: 0, 38527 justify: "flex-start", 38528 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 38529 spacing: 3, 38530 alignment: "flex-start", 38531 className: "edit-site-sidebar-navigation-screen__title-icon", 38532 children: [!isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38533 onClick: () => { 38534 history.push(backPath); 38535 navigate('back'); 38536 }, 38537 icon: icon, 38538 label: (0,external_wp_i18n_namespaceObject.__)('Back'), 38539 showTooltip: false 38540 }), isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38541 icon: icon, 38542 label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 38543 href: dashboardLink || 'index.php' 38544 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 38545 className: "edit-site-sidebar-navigation-screen__title", 38546 color: '#e0e0e0' /* $gray-200 */, 38547 level: 1, 38548 size: 20, 38549 children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)('Previewing %1$s: %2$s', previewingThemeName, title) 38550 }), actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38551 className: "edit-site-sidebar-navigation-screen__actions", 38552 children: actions 38553 })] 38554 }), meta && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38555 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38556 className: "edit-site-sidebar-navigation-screen__meta", 38557 children: meta 38558 }) 38559 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 38560 className: "edit-site-sidebar-navigation-screen__content", 38561 children: [description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 38562 className: "edit-site-sidebar-navigation-screen__description", 38563 children: description 38564 }), content] 38565 })] 38566 }), footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { 38567 className: "edit-site-sidebar-navigation-screen__footer", 38568 children: footer 38569 })] 38570 }); 38571 } 38572 38573 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 38574 /** 38575 * WordPress dependencies 38576 */ 38577 38578 38579 const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38580 xmlns: "http://www.w3.org/2000/svg", 38581 viewBox: "0 0 24 24", 38582 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38583 d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" 38584 }) 38585 }); 38586 /* harmony default export */ const chevron_left_small = (chevronLeftSmall); 38587 38588 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 38589 /** 38590 * WordPress dependencies 38591 */ 38592 38593 38594 const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38595 xmlns: "http://www.w3.org/2000/svg", 38596 viewBox: "0 0 24 24", 38597 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38598 d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" 38599 }) 38600 }); 38601 /* harmony default export */ const chevron_right_small = (chevronRightSmall); 38602 38603 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js 38604 /** 38605 * External dependencies 38606 */ 38607 38608 38609 /** 38610 * WordPress dependencies 38611 */ 38612 38613 38614 38615 38616 38617 38618 /** 38619 * Internal dependencies 38620 */ 38621 38622 38623 38624 38625 const { 38626 useHistory: sidebar_navigation_item_useHistory 38627 } = unlock(external_wp_router_namespaceObject.privateApis); 38628 function SidebarNavigationItem({ 38629 className, 38630 icon, 38631 withChevron = false, 38632 suffix, 38633 uid, 38634 params, 38635 onClick, 38636 children, 38637 ...props 38638 }) { 38639 const history = sidebar_navigation_item_useHistory(); 38640 const { 38641 navigate 38642 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 38643 // If there is no custom click handler, create one that navigates to `params`. 38644 function handleClick(e) { 38645 if (onClick) { 38646 onClick(e); 38647 navigate('forward'); 38648 } else if (params) { 38649 e.preventDefault(); 38650 history.push(params); 38651 navigate('forward', `[id="$uid}"]`); 38652 } 38653 } 38654 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 38655 className: dist_clsx('edit-site-sidebar-navigation-item', { 38656 'with-suffix': !withChevron && suffix 38657 }, className), 38658 onClick: handleClick, 38659 id: uid, 38660 ...props, 38661 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 38662 justify: "flex-start", 38663 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 38664 style: { 38665 fill: 'currentcolor' 38666 }, 38667 icon: icon, 38668 size: 24 38669 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 38670 children: children 38671 }), withChevron && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 38672 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, 38673 className: "edit-site-sidebar-navigation-item__drilldown-indicator", 38674 size: 24 38675 }), !withChevron && suffix] 38676 }) 38677 }); 38678 } 38679 38680 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js 38681 /** 38682 * WordPress dependencies 38683 */ 38684 38685 38686 function SidebarNavigationScreenDetailsPanelLabel({ 38687 children 38688 }) { 38689 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38690 className: "edit-site-sidebar-navigation-details-screen-panel__label", 38691 children: children 38692 }); 38693 } 38694 38695 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js 38696 /** 38697 * External dependencies 38698 */ 38699 38700 38701 /** 38702 * WordPress dependencies 38703 */ 38704 38705 38706 function SidebarNavigationScreenDetailsPanelRow({ 38707 label, 38708 children, 38709 className, 38710 ...extraProps 38711 }) { 38712 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 38713 spacing: 5, 38714 alignment: "left", 38715 className: dist_clsx('edit-site-sidebar-navigation-details-screen-panel__row', className), 38716 ...extraProps, 38717 children: children 38718 }, label); 38719 } 38720 38721 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js 38722 /** 38723 * WordPress dependencies 38724 */ 38725 38726 38727 function SidebarNavigationScreenDetailsPanelValue({ 38728 children 38729 }) { 38730 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38731 className: "edit-site-sidebar-navigation-details-screen-panel__value", 38732 children: children 38733 }); 38734 } 38735 38736 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/index.js 38737 /** 38738 * WordPress dependencies 38739 */ 38740 38741 38742 /** 38743 * Internal dependencies 38744 */ 38745 38746 38747 38748 38749 38750 function SidebarNavigationScreenDetailsPanel({ 38751 title, 38752 children, 38753 spacing 38754 }) { 38755 return /*#__PURE__*/_jsxs(VStack, { 38756 className: "edit-site-sidebar-navigation-details-screen-panel", 38757 spacing: spacing, 38758 children: [title && /*#__PURE__*/_jsx(Heading, { 38759 className: "edit-site-sidebar-navigation-details-screen-panel__heading", 38760 level: 2, 38761 children: title 38762 }), children] 38763 }); 38764 } 38765 38766 38767 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js 38768 /** 38769 * WordPress dependencies 38770 */ 38771 38772 38773 38774 38775 38776 38777 38778 /** 38779 * Internal dependencies 38780 */ 38781 38782 38783 38784 38785 function SidebarNavigationScreenDetailsFooter({ 38786 record, 38787 ...otherProps 38788 }) { 38789 var _record$_links$predec, _record$_links$versio; 38790 /* 38791 * There might be other items in the future, 38792 * but for now it's just modified date. 38793 * Later we might render a list of items and isolate 38794 * the following logic. 38795 */ 38796 const hrefProps = {}; 38797 const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null; 38798 const revisionsCount = (_record$_links$versio = record?._links?.['version-history']?.[0]?.count) !== null && _record$_links$versio !== void 0 ? _record$_links$versio : 0; 38799 // Enable the revisions link if there is a last revision and there are more than one revisions. 38800 if (lastRevisionId && revisionsCount > 1) { 38801 hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 38802 revision: record?._links['predecessor-version'][0].id 38803 }); 38804 hrefProps.as = 'a'; 38805 } 38806 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 38807 className: "edit-site-sidebar-navigation-screen-details-footer", 38808 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38809 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Revisions'), 38810 ...hrefProps, 38811 ...otherProps, 38812 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SidebarNavigationScreenDetailsPanelRow, { 38813 justify: "space-between", 38814 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsPanelLabel, { 38815 children: (0,external_wp_i18n_namespaceObject.__)('Last modified') 38816 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsPanelValue, { 38817 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is the relative time when the post was last modified. */ 38818 (0,external_wp_i18n_namespaceObject.__)('<time>%s</time>'), (0,external_wp_date_namespaceObject.humanTimeDiff)(record.modified)), { 38819 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 38820 dateTime: record.modified 38821 }) 38822 }) 38823 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 38824 className: "edit-site-sidebar-navigation-screen-details-footer__icon", 38825 icon: library_backup 38826 })] 38827 }) 38828 }) 38829 }); 38830 } 38831 38832 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js 38833 /** 38834 * WordPress dependencies 38835 */ 38836 38837 38838 38839 38840 38841 38842 38843 38844 38845 /** 38846 * Internal dependencies 38847 */ 38848 38849 38850 38851 38852 38853 38854 38855 38856 38857 38858 38859 38860 function SidebarNavigationItemGlobalStyles(props) { 38861 const { 38862 openGeneralSidebar 38863 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38864 const { 38865 setCanvasMode 38866 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 38867 const hasGlobalStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []); 38868 if (hasGlobalStyleVariations) { 38869 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38870 ...props, 38871 params: { 38872 path: '/wp_global_styles' 38873 }, 38874 uid: "global-styles-navigation-item" 38875 }); 38876 } 38877 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38878 ...props, 38879 onClick: () => { 38880 // Switch to edit mode. 38881 setCanvasMode('edit'); 38882 // Open global styles sidebar. 38883 openGeneralSidebar('edit-site/global-styles'); 38884 } 38885 }); 38886 } 38887 function SidebarNavigationScreenGlobalStyles({ 38888 backPath 38889 }) { 38890 const { 38891 revisions, 38892 isLoading: isLoadingRevisions 38893 } = useGlobalStylesRevisions(); 38894 const { 38895 openGeneralSidebar 38896 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38897 const { 38898 setIsListViewOpened 38899 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 38900 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 38901 const { 38902 setCanvasMode, 38903 setEditorCanvasContainerView 38904 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 38905 const { 38906 isViewMode, 38907 isStyleBookOpened, 38908 revisionsCount 38909 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 38910 var _globalStyles$_links$; 38911 const { 38912 getCanvasMode, 38913 getEditorCanvasContainerView 38914 } = unlock(select(store)); 38915 const { 38916 getEntityRecord, 38917 __experimentalGetCurrentGlobalStylesId 38918 } = select(external_wp_coreData_namespaceObject.store); 38919 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 38920 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 38921 return { 38922 isViewMode: 'view' === getCanvasMode(), 38923 isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(), 38924 revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0 38925 }; 38926 }, []); 38927 const { 38928 set: setPreference 38929 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 38930 const openGlobalStyles = (0,external_wp_element_namespaceObject.useCallback)(async () => { 38931 return Promise.all([setPreference('core', 'distractionFree', false), setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]); 38932 }, [setCanvasMode, openGeneralSidebar, setPreference]); 38933 const openStyleBook = (0,external_wp_element_namespaceObject.useCallback)(async () => { 38934 await openGlobalStyles(); 38935 // Open the Style Book once the canvas mode is set to edit, 38936 // and the global styles sidebar is open. This ensures that 38937 // the Style Book is not prematurely closed. 38938 setEditorCanvasContainerView('style-book'); 38939 setIsListViewOpened(false); 38940 }, [openGlobalStyles, setEditorCanvasContainerView, setIsListViewOpened]); 38941 const openRevisions = (0,external_wp_element_namespaceObject.useCallback)(async () => { 38942 await openGlobalStyles(); 38943 // Open the global styles revisions once the canvas mode is set to edit, 38944 // and the global styles sidebar is open. The global styles UI is responsible 38945 // for redirecting to the revisions screen once the editor canvas container 38946 // has been set to 'global-styles-revisions'. 38947 setEditorCanvasContainerView('global-styles-revisions'); 38948 }, [openGlobalStyles, setEditorCanvasContainerView]); 38949 38950 // If there are no revisions, do not render a footer. 38951 const hasRevisions = revisionsCount > 0; 38952 const modifiedDateTime = revisions?.[0]?.modified; 38953 const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime; 38954 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38955 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 38956 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 38957 description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles.'), 38958 backPath: backPath, 38959 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}), 38960 footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsFooter, { 38961 record: revisions?.[0], 38962 onClick: openRevisions 38963 }), 38964 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38965 children: [!isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38966 icon: library_seen, 38967 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 38968 onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined), 38969 isPressed: isStyleBookOpened 38970 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38971 icon: edit, 38972 label: (0,external_wp_i18n_namespaceObject.__)('Edit styles'), 38973 onClick: async () => await openGlobalStyles() 38974 })] 38975 }) 38976 }), isStyleBookOpened && !isMobileViewport && isViewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 38977 enableResizing: false, 38978 isSelected: () => false, 38979 onClick: openStyleBook, 38980 onSelect: openStyleBook, 38981 showCloseButton: false, 38982 showTabs: false 38983 })] 38984 }); 38985 } 38986 38987 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js 38988 /** 38989 * WordPress dependencies 38990 */ 38991 38992 38993 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38994 viewBox: "0 0 24 24", 38995 xmlns: "http://www.w3.org/2000/svg", 38996 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38997 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" 38998 }) 38999 }); 39000 /* harmony default export */ const library_navigation = (navigation); 39001 39002 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js 39003 /** 39004 * WordPress dependencies 39005 */ 39006 39007 39008 39009 39010 39011 39012 /** 39013 * Internal dependencies 39014 */ 39015 39016 39017 39018 39019 39020 39021 39022 39023 39024 function SidebarNavigationScreenMain() { 39025 const { 39026 setEditorCanvasContainerView 39027 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 39028 39029 // Clear the editor canvas container view when accessing the main navigation screen. 39030 (0,external_wp_element_namespaceObject.useEffect)(() => { 39031 setEditorCanvasContainerView(undefined); 39032 }, [setEditorCanvasContainerView]); 39033 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 39034 isRoot: true, 39035 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 39036 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'), 39037 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39038 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 39039 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39040 uid: "navigation-navigation-item", 39041 params: { 39042 postType: NAVIGATION_POST_TYPE 39043 }, 39044 withChevron: true, 39045 icon: library_navigation, 39046 children: (0,external_wp_i18n_namespaceObject.__)('Navigation') 39047 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItemGlobalStyles, { 39048 uid: "styles-navigation-item", 39049 withChevron: true, 39050 icon: library_styles, 39051 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 39052 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39053 uid: "page-navigation-item", 39054 params: { 39055 postType: 'page' 39056 }, 39057 withChevron: true, 39058 icon: library_page, 39059 children: (0,external_wp_i18n_namespaceObject.__)('Pages') 39060 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39061 uid: "template-navigation-item", 39062 params: { 39063 postType: TEMPLATE_POST_TYPE 39064 }, 39065 withChevron: true, 39066 icon: library_layout, 39067 children: (0,external_wp_i18n_namespaceObject.__)('Templates') 39068 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39069 uid: "patterns-navigation-item", 39070 params: { 39071 postType: PATTERN_TYPES.user 39072 }, 39073 withChevron: true, 39074 icon: library_symbol, 39075 children: (0,external_wp_i18n_namespaceObject.__)('Patterns') 39076 })] 39077 }) 39078 }) 39079 }); 39080 } 39081 39082 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js 39083 // This requested is preloaded in `gutenberg_preload_navigation_posts`. 39084 // As unbounded queries are limited to 100 by `fetchAllMiddleware` 39085 // on apiFetch this query is limited to 100. 39086 // These parameters must be kept aligned with those in 39087 // lib/compat/wordpress-6.3/navigation-block-preloading.php 39088 // and 39089 // block-library/src/navigation/constants.js 39090 const PRELOADED_NAVIGATION_MENUS_QUERY = { 39091 per_page: 100, 39092 status: ['publish', 'draft'], 39093 order: 'desc', 39094 orderby: 'date' 39095 }; 39096 39097 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js 39098 /** 39099 * WordPress dependencies 39100 */ 39101 39102 39103 39104 39105 39106 const notEmptyString = testString => testString?.trim()?.length > 0; 39107 function rename_modal_RenameModal({ 39108 menuTitle, 39109 onClose, 39110 onSave 39111 }) { 39112 const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_namespaceObject.useState)(menuTitle); 39113 const titleHasChanged = editedMenuTitle !== menuTitle; 39114 const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); 39115 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 39116 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 39117 onRequestClose: onClose, 39118 focusOnMount: "firstContentElement", 39119 size: "small", 39120 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 39121 className: "sidebar-navigation__rename-modal-form", 39122 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 39123 spacing: "3", 39124 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 39125 __nextHasNoMarginBottom: true, 39126 __next40pxDefaultSize: true, 39127 value: editedMenuTitle, 39128 placeholder: (0,external_wp_i18n_namespaceObject.__)('Navigation title'), 39129 onChange: setEditedMenuTitle, 39130 label: (0,external_wp_i18n_namespaceObject.__)('Name') 39131 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 39132 justify: "right", 39133 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39134 __next40pxDefaultSize: true, 39135 variant: "tertiary", 39136 onClick: onClose, 39137 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 39138 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39139 __next40pxDefaultSize: true, 39140 accessibleWhenDisabled: true, 39141 disabled: !isEditedMenuTitleValid, 39142 variant: "primary", 39143 type: "submit", 39144 onClick: e => { 39145 e.preventDefault(); 39146 if (!isEditedMenuTitleValid) { 39147 return; 39148 } 39149 onSave({ 39150 title: editedMenuTitle 39151 }); 39152 39153 // Immediate close avoids ability to hit save multiple times. 39154 onClose(); 39155 }, 39156 children: (0,external_wp_i18n_namespaceObject.__)('Save') 39157 })] 39158 })] 39159 }) 39160 }) 39161 }); 39162 } 39163 39164 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js 39165 /** 39166 * WordPress dependencies 39167 */ 39168 39169 39170 39171 function DeleteConfirmDialog({ 39172 onClose, 39173 onConfirm 39174 }) { 39175 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 39176 isOpen: true, 39177 onConfirm: () => { 39178 onConfirm(); 39179 39180 // Immediate close avoids ability to hit delete multiple times. 39181 onClose(); 39182 }, 39183 onCancel: onClose, 39184 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 39185 size: "medium", 39186 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation Menu?') 39187 }); 39188 } 39189 39190 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js 39191 /** 39192 * WordPress dependencies 39193 */ 39194 39195 39196 39197 39198 39199 39200 /** 39201 * Internal dependencies 39202 */ 39203 39204 39205 39206 39207 39208 39209 const { 39210 useHistory: more_menu_useHistory 39211 } = unlock(external_wp_router_namespaceObject.privateApis); 39212 const POPOVER_PROPS = { 39213 position: 'bottom right' 39214 }; 39215 function ScreenNavigationMoreMenu(props) { 39216 const { 39217 onDelete, 39218 onSave, 39219 onDuplicate, 39220 menuTitle, 39221 menuId 39222 } = props; 39223 const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 39224 const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 39225 const history = more_menu_useHistory(); 39226 const closeModals = () => { 39227 setRenameModalOpen(false); 39228 setDeleteConfirmDialogOpen(false); 39229 }; 39230 const openRenameModal = () => setRenameModalOpen(true); 39231 const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); 39232 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39233 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 39234 className: "sidebar-navigation__more-menu", 39235 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 39236 icon: more_vertical, 39237 popoverProps: POPOVER_PROPS, 39238 children: ({ 39239 onClose 39240 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39241 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 39242 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39243 onClick: () => { 39244 openRenameModal(); 39245 // Close the dropdown after opening the modal. 39246 onClose(); 39247 }, 39248 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 39249 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39250 onClick: () => { 39251 history.push({ 39252 postId: menuId, 39253 postType: 'wp_navigation', 39254 canvas: 'edit' 39255 }); 39256 }, 39257 children: (0,external_wp_i18n_namespaceObject.__)('Edit') 39258 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39259 onClick: () => { 39260 onDuplicate(); 39261 onClose(); 39262 }, 39263 children: (0,external_wp_i18n_namespaceObject.__)('Duplicate') 39264 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39265 isDestructive: true, 39266 onClick: () => { 39267 openDeleteConfirmDialog(); 39268 39269 // Close the dropdown after opening the modal. 39270 onClose(); 39271 }, 39272 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 39273 })] 39274 }) 39275 }) 39276 }), deleteConfirmDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteConfirmDialog, { 39277 onClose: closeModals, 39278 onConfirm: onDelete 39279 }), renameModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_modal_RenameModal, { 39280 onClose: closeModals, 39281 menuTitle: menuTitle, 39282 onSave: onSave 39283 })] 39284 }); 39285 } 39286 39287 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js 39288 /** 39289 * WordPress dependencies 39290 */ 39291 39292 39293 39294 39295 39296 39297 39298 39299 const leaf_more_menu_POPOVER_PROPS = { 39300 className: 'block-editor-block-settings-menu__popover', 39301 placement: 'bottom-start' 39302 }; 39303 39304 /** 39305 * Internal dependencies 39306 */ 39307 39308 39309 39310 39311 const { 39312 useHistory: leaf_more_menu_useHistory 39313 } = unlock(external_wp_router_namespaceObject.privateApis); 39314 function LeafMoreMenu(props) { 39315 const history = leaf_more_menu_useHistory(); 39316 const { 39317 block 39318 } = props; 39319 const { 39320 clientId 39321 } = block; 39322 const { 39323 moveBlocksDown, 39324 moveBlocksUp, 39325 removeBlocks 39326 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 39327 const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ 39328 (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 39329 clientId, 39330 maximumLength: 25 39331 })); 39332 const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ 39333 (0,external_wp_i18n_namespaceObject.__)('Go to %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 39334 clientId, 39335 maximumLength: 25 39336 })); 39337 const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { 39338 const { 39339 getBlockRootClientId 39340 } = select(external_wp_blockEditor_namespaceObject.store); 39341 return getBlockRootClientId(clientId); 39342 }, [clientId]); 39343 const onGoToPage = (0,external_wp_element_namespaceObject.useCallback)(selectedBlock => { 39344 const { 39345 attributes, 39346 name 39347 } = selectedBlock; 39348 if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) { 39349 const { 39350 params 39351 } = history.getLocationWithParams(); 39352 history.push({ 39353 postType: attributes.type, 39354 postId: attributes.id, 39355 canvas: 'edit' 39356 }, { 39357 backPath: params 39358 }); 39359 } 39360 if (name === 'core/page-list-item' && attributes.id && history) { 39361 const { 39362 params 39363 } = history.getLocationWithParams(); 39364 history.push({ 39365 postType: 'page', 39366 postId: attributes.id, 39367 canvas: 'edit' 39368 }, { 39369 backPath: params 39370 }); 39371 } 39372 }, [history]); 39373 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 39374 icon: more_vertical, 39375 label: (0,external_wp_i18n_namespaceObject.__)('Options'), 39376 className: "block-editor-block-settings-menu", 39377 popoverProps: leaf_more_menu_POPOVER_PROPS, 39378 noIcons: true, 39379 ...props, 39380 children: ({ 39381 onClose 39382 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39383 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 39384 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39385 icon: chevron_up, 39386 onClick: () => { 39387 moveBlocksUp([clientId], rootClientId); 39388 onClose(); 39389 }, 39390 children: (0,external_wp_i18n_namespaceObject.__)('Move up') 39391 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39392 icon: chevron_down, 39393 onClick: () => { 39394 moveBlocksDown([clientId], rootClientId); 39395 onClose(); 39396 }, 39397 children: (0,external_wp_i18n_namespaceObject.__)('Move down') 39398 }), block.attributes?.type === 'page' && block.attributes?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39399 onClick: () => { 39400 onGoToPage(block); 39401 onClose(); 39402 }, 39403 children: goToLabel 39404 })] 39405 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 39406 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39407 onClick: () => { 39408 removeBlocks([clientId], false); 39409 onClose(); 39410 }, 39411 children: removeLabel 39412 }) 39413 })] 39414 }) 39415 }); 39416 } 39417 39418 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js 39419 /** 39420 * WordPress dependencies 39421 */ 39422 39423 39424 39425 39426 39427 39428 /** 39429 * Internal dependencies 39430 */ 39431 39432 39433 39434 39435 39436 const { 39437 PrivateListView 39438 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 39439 39440 // Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js. 39441 const MAX_PAGE_COUNT = 100; 39442 const PAGES_QUERY = ['postType', 'page', { 39443 per_page: MAX_PAGE_COUNT, 39444 _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'], 39445 // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby 39446 // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent 39447 // sort. 39448 orderby: 'menu_order', 39449 order: 'asc' 39450 }]; 39451 function NavigationMenuContent({ 39452 rootClientId 39453 }) { 39454 const { 39455 listViewRootClientId, 39456 isLoading 39457 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39458 const { 39459 areInnerBlocksControlled, 39460 getBlockName, 39461 getBlockCount, 39462 getBlockOrder 39463 } = select(external_wp_blockEditor_namespaceObject.store); 39464 const { 39465 isResolving 39466 } = select(external_wp_coreData_namespaceObject.store); 39467 const blockClientIds = getBlockOrder(rootClientId); 39468 const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === 'core/page-list'; 39469 const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; 39470 const isLoadingPages = isResolving('getEntityRecords', PAGES_QUERY); 39471 return { 39472 listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, 39473 // This is a small hack to wait for the navigation block 39474 // to actually load its inner blocks. 39475 isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages 39476 }; 39477 }, [rootClientId]); 39478 const { 39479 replaceBlock, 39480 __unstableMarkNextChangeAsNotPersistent 39481 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 39482 const offCanvasOnselect = (0,external_wp_element_namespaceObject.useCallback)(block => { 39483 if (block.name === 'core/navigation-link' && !block.attributes.url) { 39484 __unstableMarkNextChangeAsNotPersistent(); 39485 replaceBlock(block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', block.attributes)); 39486 } 39487 }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock]); 39488 39489 // The hidden block is needed because it makes block edit side effects trigger. 39490 // For example a navigation page list load its items has an effect on edit to load its items. 39491 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39492 children: [!isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { 39493 rootClientId: listViewRootClientId, 39494 onSelect: offCanvasOnselect, 39495 blockSettingsMenu: LeafMoreMenu, 39496 showAppender: false 39497 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39498 className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", 39499 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) 39500 })] 39501 }); 39502 } 39503 39504 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js 39505 /** 39506 * WordPress dependencies 39507 */ 39508 39509 39510 39511 39512 39513 /** 39514 * Internal dependencies 39515 */ 39516 39517 39518 39519 39520 const navigation_menu_editor_noop = () => {}; 39521 function NavigationMenuEditor({ 39522 navigationMenuId 39523 }) { 39524 const { 39525 storedSettings 39526 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39527 const { 39528 getSettings 39529 } = unlock(select(store)); 39530 return { 39531 storedSettings: getSettings() 39532 }; 39533 }, []); 39534 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 39535 if (!navigationMenuId) { 39536 return []; 39537 } 39538 return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { 39539 ref: navigationMenuId 39540 })]; 39541 }, [navigationMenuId]); 39542 if (!navigationMenuId || !blocks?.length) { 39543 return null; 39544 } 39545 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 39546 settings: storedSettings, 39547 value: blocks, 39548 onChange: navigation_menu_editor_noop, 39549 onInput: navigation_menu_editor_noop, 39550 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39551 className: "edit-site-sidebar-navigation-screen-navigation-menus__content", 39552 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { 39553 rootClientId: blocks[0].clientId 39554 }) 39555 }) 39556 }); 39557 } 39558 39559 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js 39560 /** 39561 * WordPress dependencies 39562 */ 39563 39564 39565 39566 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 39567 function buildNavigationLabel(title, id, status) { 39568 if (!title?.rendered) { 39569 /* translators: %s is the index of the menu in the list of menus. */ 39570 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 39571 } 39572 if (status === 'publish') { 39573 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered); 39574 } 39575 return (0,external_wp_i18n_namespaceObject.sprintf)( 39576 // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.). 39577 (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status); 39578 } 39579 39580 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js 39581 /** 39582 * WordPress dependencies 39583 */ 39584 39585 39586 /** 39587 * Internal dependencies 39588 */ 39589 39590 39591 39592 39593 39594 39595 function SingleNavigationMenu({ 39596 navigationMenu, 39597 backPath, 39598 handleDelete, 39599 handleDuplicate, 39600 handleSave 39601 }) { 39602 const menuTitle = navigationMenu?.title?.rendered; 39603 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39604 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39605 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 39606 menuId: navigationMenu?.id, 39607 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 39608 onDelete: handleDelete, 39609 onSave: handleSave, 39610 onDuplicate: handleDuplicate 39611 }) 39612 }), 39613 backPath: backPath, 39614 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 39615 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 39616 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { 39617 navigationMenuId: navigationMenu?.id 39618 }) 39619 }); 39620 } 39621 39622 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js 39623 /** 39624 * WordPress dependencies 39625 */ 39626 39627 39628 39629 39630 39631 39632 39633 /** 39634 * Internal dependencies 39635 */ 39636 39637 39638 39639 39640 39641 39642 39643 const { 39644 useLocation: sidebar_navigation_screen_navigation_menu_useLocation 39645 } = unlock(external_wp_router_namespaceObject.privateApis); 39646 const postType = `wp_navigation`; 39647 function SidebarNavigationScreenNavigationMenu({ 39648 backPath 39649 }) { 39650 const { 39651 params: { 39652 postId 39653 } 39654 } = sidebar_navigation_screen_navigation_menu_useLocation(); 39655 const { 39656 record: navigationMenu, 39657 isResolving 39658 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId); 39659 const { 39660 isSaving, 39661 isDeleting 39662 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39663 const { 39664 isSavingEntityRecord, 39665 isDeletingEntityRecord 39666 } = select(external_wp_coreData_namespaceObject.store); 39667 return { 39668 isSaving: isSavingEntityRecord('postType', postType, postId), 39669 isDeleting: isDeletingEntityRecord('postType', postType, postId) 39670 }; 39671 }, [postId]); 39672 const isLoading = isResolving || isSaving || isDeleting; 39673 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 39674 const { 39675 handleSave, 39676 handleDelete, 39677 handleDuplicate 39678 } = useNavigationMenuHandlers(); 39679 const _handleDelete = () => handleDelete(navigationMenu); 39680 const _handleSave = edits => handleSave(navigationMenu, edits); 39681 const _handleDuplicate = () => handleDuplicate(navigationMenu); 39682 if (isLoading) { 39683 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39684 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 39685 backPath: backPath, 39686 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 39687 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 39688 }) 39689 }); 39690 } 39691 if (!isLoading && !navigationMenu) { 39692 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39693 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menu missing.'), 39694 backPath: backPath 39695 }); 39696 } 39697 if (!navigationMenu?.content?.raw) { 39698 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39699 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 39700 menuId: navigationMenu?.id, 39701 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 39702 onDelete: _handleDelete, 39703 onSave: _handleSave, 39704 onDuplicate: _handleDuplicate 39705 }), 39706 backPath: backPath, 39707 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 39708 description: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.') 39709 }); 39710 } 39711 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 39712 navigationMenu: navigationMenu, 39713 backPath: backPath, 39714 handleDelete: _handleDelete, 39715 handleSave: _handleSave, 39716 handleDuplicate: _handleDuplicate 39717 }); 39718 } 39719 39720 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js 39721 /** 39722 * WordPress dependencies 39723 */ 39724 39725 39726 39727 39728 39729 39730 /** 39731 * Internal dependencies 39732 */ 39733 39734 39735 39736 const { 39737 useHistory: use_navigation_menu_handlers_useHistory 39738 } = unlock(external_wp_router_namespaceObject.privateApis); 39739 function useDeleteNavigationMenu() { 39740 const { 39741 deleteEntityRecord 39742 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39743 const { 39744 createSuccessNotice, 39745 createErrorNotice 39746 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39747 const history = use_navigation_menu_handlers_useHistory(); 39748 const handleDelete = async navigationMenu => { 39749 const postId = navigationMenu?.id; 39750 try { 39751 await deleteEntityRecord('postType', postType, postId, { 39752 force: true 39753 }, { 39754 throwOnError: true 39755 }); 39756 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Navigation Menu successfully deleted.'), { 39757 type: 'snackbar' 39758 }); 39759 history.push({ 39760 postType: 'wp_navigation' 39761 }); 39762 } catch (error) { 39763 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */ 39764 (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), error?.message), { 39765 type: 'snackbar' 39766 }); 39767 } 39768 }; 39769 return handleDelete; 39770 } 39771 function useSaveNavigationMenu() { 39772 const { 39773 getEditedEntityRecord 39774 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39775 const { 39776 getEditedEntityRecord: getEditedEntityRecordSelector 39777 } = select(external_wp_coreData_namespaceObject.store); 39778 return { 39779 getEditedEntityRecord: getEditedEntityRecordSelector 39780 }; 39781 }, []); 39782 const { 39783 editEntityRecord, 39784 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 39785 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39786 const { 39787 createSuccessNotice, 39788 createErrorNotice 39789 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39790 const handleSave = async (navigationMenu, edits) => { 39791 if (!edits) { 39792 return; 39793 } 39794 const postId = navigationMenu?.id; 39795 // Prepare for revert in case of error. 39796 const originalRecord = getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, postId); 39797 39798 // Apply the edits. 39799 editEntityRecord('postType', postType, postId, edits); 39800 const recordPropertiesToSave = Object.keys(edits); 39801 39802 // Attempt to persist. 39803 try { 39804 await saveSpecifiedEntityEdits('postType', postType, postId, recordPropertiesToSave, { 39805 throwOnError: true 39806 }); 39807 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Renamed Navigation Menu'), { 39808 type: 'snackbar' 39809 }); 39810 } catch (error) { 39811 // Revert to original in case of error. 39812 editEntityRecord('postType', postType, postId, originalRecord); 39813 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be renamed. */ 39814 (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), error?.message), { 39815 type: 'snackbar' 39816 }); 39817 } 39818 }; 39819 return handleSave; 39820 } 39821 function useDuplicateNavigationMenu() { 39822 const history = use_navigation_menu_handlers_useHistory(); 39823 const { 39824 saveEntityRecord 39825 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39826 const { 39827 createSuccessNotice, 39828 createErrorNotice 39829 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39830 const handleDuplicate = async navigationMenu => { 39831 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 39832 try { 39833 const savedRecord = await saveEntityRecord('postType', postType, { 39834 title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Navigation menu title */ 39835 (0,external_wp_i18n_namespaceObject.__)('%s (Copy)'), menuTitle), 39836 content: navigationMenu?.content?.raw, 39837 status: 'publish' 39838 }, { 39839 throwOnError: true 39840 }); 39841 if (savedRecord) { 39842 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Duplicated Navigation Menu'), { 39843 type: 'snackbar' 39844 }); 39845 history.push({ 39846 postType: postType, 39847 postId: savedRecord.id 39848 }); 39849 } 39850 } catch (error) { 39851 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */ 39852 (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), error?.message), { 39853 type: 'snackbar' 39854 }); 39855 } 39856 }; 39857 return handleDuplicate; 39858 } 39859 function useNavigationMenuHandlers() { 39860 return { 39861 handleDelete: useDeleteNavigationMenu(), 39862 handleSave: useSaveNavigationMenu(), 39863 handleDuplicate: useDuplicateNavigationMenu() 39864 }; 39865 } 39866 39867 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js 39868 /** 39869 * WordPress dependencies 39870 */ 39871 39872 39873 39874 39875 39876 39877 39878 /** 39879 * Internal dependencies 39880 */ 39881 39882 39883 39884 39885 39886 39887 39888 39889 39890 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 39891 39892 function buildMenuLabel(title, id, status) { 39893 if (!title) { 39894 /* translators: %s is the index of the menu in the list of menus. */ 39895 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 39896 } 39897 if (status === 'publish') { 39898 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); 39899 } 39900 return (0,external_wp_i18n_namespaceObject.sprintf)( 39901 // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.). 39902 (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status); 39903 } 39904 39905 // Save a boolean to prevent us creating a fallback more than once per session. 39906 let hasCreatedFallback = false; 39907 function SidebarNavigationScreenNavigationMenus({ 39908 backPath 39909 }) { 39910 const { 39911 records: navigationMenus, 39912 isResolving: isResolvingNavigationMenus, 39913 hasResolved: hasResolvedNavigationMenus 39914 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY); 39915 const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; 39916 const { 39917 getNavigationFallbackId 39918 } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store)); 39919 const firstNavigationMenu = navigationMenus?.[0]; 39920 39921 // Save a boolean to prevent us creating a fallback more than once per session. 39922 if (firstNavigationMenu) { 39923 hasCreatedFallback = true; 39924 } 39925 39926 // If there is no navigation menu found 39927 // then trigger fallback algorithm to create one. 39928 if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && !hasCreatedFallback) { 39929 getNavigationFallbackId(); 39930 } 39931 const { 39932 handleSave, 39933 handleDelete, 39934 handleDuplicate 39935 } = useNavigationMenuHandlers(); 39936 const hasNavigationMenus = !!navigationMenus?.length; 39937 if (isLoading) { 39938 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39939 backPath: backPath, 39940 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 39941 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 39942 }) 39943 }); 39944 } 39945 if (!isLoading && !hasNavigationMenus) { 39946 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39947 description: (0,external_wp_i18n_namespaceObject.__)('No Navigation Menus found.'), 39948 backPath: backPath 39949 }); 39950 } 39951 39952 // if single menu then render it 39953 if (navigationMenus?.length === 1) { 39954 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 39955 navigationMenu: firstNavigationMenu, 39956 backPath: backPath, 39957 handleDelete: () => handleDelete(firstNavigationMenu), 39958 handleDuplicate: () => handleDuplicate(firstNavigationMenu), 39959 handleSave: edits => handleSave(firstNavigationMenu, edits) 39960 }); 39961 } 39962 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39963 backPath: backPath, 39964 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 39965 children: navigationMenus?.map(({ 39966 id, 39967 title, 39968 status 39969 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavMenuItem, { 39970 postId: id, 39971 withChevron: true, 39972 icon: library_navigation, 39973 children: buildMenuLabel(title?.rendered, index + 1, status) 39974 }, id)) 39975 }) 39976 }); 39977 } 39978 function SidebarNavigationScreenWrapper({ 39979 children, 39980 actions, 39981 title, 39982 description, 39983 backPath 39984 }) { 39985 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 39986 title: title || (0,external_wp_i18n_namespaceObject.__)('Navigation'), 39987 actions: actions, 39988 description: description || (0,external_wp_i18n_namespaceObject.__)('Manage your Navigation Menus.'), 39989 backPath: backPath, 39990 content: children 39991 }); 39992 } 39993 const NavMenuItem = ({ 39994 postId, 39995 ...props 39996 }) => { 39997 const linkInfo = useLink({ 39998 postId, 39999 postType: 'wp_navigation' 40000 }); 40001 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40002 ...linkInfo, 40003 ...props 40004 }); 40005 }; 40006 40007 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js 40008 /** 40009 * External dependencies 40010 */ 40011 40012 40013 /** 40014 * WordPress dependencies 40015 */ 40016 40017 40018 40019 40020 /** 40021 * Internal dependencies 40022 */ 40023 40024 40025 40026 40027 40028 const { 40029 useLocation: dataview_item_useLocation 40030 } = unlock(external_wp_router_namespaceObject.privateApis); 40031 function DataViewItem({ 40032 title, 40033 slug, 40034 customViewId, 40035 type, 40036 icon, 40037 isActive, 40038 isCustom, 40039 suffix 40040 }) { 40041 const { 40042 params: { 40043 postType 40044 } 40045 } = dataview_item_useLocation(); 40046 const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon; 40047 let activeView = isCustom ? customViewId : slug; 40048 if (activeView === 'all') { 40049 activeView = undefined; 40050 } 40051 const linkInfo = useLink({ 40052 postType, 40053 layout: type, 40054 activeView, 40055 isCustom: isCustom ? 'true' : undefined 40056 }); 40057 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40058 justify: "flex-start", 40059 className: dist_clsx('edit-site-sidebar-dataviews-dataview-item', { 40060 'is-selected': isActive 40061 }), 40062 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40063 icon: iconToUse, 40064 ...linkInfo, 40065 "aria-current": isActive ? 'true' : undefined, 40066 children: title 40067 }), suffix] 40068 }); 40069 } 40070 40071 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js 40072 /** 40073 * WordPress dependencies 40074 */ 40075 40076 40077 40078 40079 /** 40080 * Internal dependencies 40081 */ 40082 40083 40084 40085 40086 40087 40088 const content_EMPTY_ARRAY = []; 40089 function TemplateDataviewItem({ 40090 template, 40091 isActive 40092 }) { 40093 const { 40094 text, 40095 icon 40096 } = useAddedBy(template.type, template.id); 40097 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40098 slug: text, 40099 title: text, 40100 icon: icon, 40101 isActive: isActive, 40102 isCustom: false 40103 }, text); 40104 } 40105 function DataviewsTemplatesSidebarContent({ 40106 activeView, 40107 title 40108 }) { 40109 const { 40110 records 40111 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_POST_TYPE, { 40112 per_page: -1 40113 }); 40114 const firstItemPerAuthorText = (0,external_wp_element_namespaceObject.useMemo)(() => { 40115 var _ref; 40116 const firstItemPerAuthor = records?.reduce((acc, template) => { 40117 const author = template.author_text; 40118 if (author && !acc[author]) { 40119 acc[author] = template; 40120 } 40121 return acc; 40122 }, {}); 40123 return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : content_EMPTY_ARRAY; 40124 }, [records]); 40125 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40126 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40127 slug: "all", 40128 title: title, 40129 icon: library_layout, 40130 isActive: activeView === 'all', 40131 isCustom: false 40132 }), firstItemPerAuthorText.map(template => { 40133 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateDataviewItem, { 40134 template: template, 40135 isActive: activeView === template.author_text 40136 }, template.author_text); 40137 })] 40138 }); 40139 } 40140 40141 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js 40142 /** 40143 * WordPress dependencies 40144 */ 40145 40146 40147 40148 /** 40149 * Internal dependencies 40150 */ 40151 40152 40153 40154 40155 const { 40156 useLocation: sidebar_navigation_screen_templates_browse_useLocation 40157 } = unlock(external_wp_router_namespaceObject.privateApis); 40158 function SidebarNavigationScreenTemplatesBrowse({ 40159 backPath 40160 }) { 40161 const { 40162 params: { 40163 activeView = 'all' 40164 } 40165 } = sidebar_navigation_screen_templates_browse_useLocation(); 40166 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 40167 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 40168 description: (0,external_wp_i18n_namespaceObject.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'), 40169 backPath: backPath, 40170 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, { 40171 activeView: activeView, 40172 title: (0,external_wp_i18n_namespaceObject.__)('All templates') 40173 }) 40174 }); 40175 } 40176 40177 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js 40178 /** 40179 * WordPress dependencies 40180 */ 40181 40182 40183 const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40184 viewBox: "0 0 24 24", 40185 xmlns: "http://www.w3.org/2000/svg", 40186 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40187 fillRule: "evenodd", 40188 clipRule: "evenodd", 40189 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" 40190 }) 40191 }); 40192 /* harmony default export */ const library_file = (file); 40193 40194 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js 40195 /** 40196 * Internal dependencies 40197 */ 40198 40199 40200 40201 40202 function CategoryItem({ 40203 count, 40204 icon, 40205 id, 40206 isActive, 40207 label, 40208 type 40209 }) { 40210 const linkInfo = useLink({ 40211 categoryId: id !== TEMPLATE_PART_ALL_AREAS_CATEGORY && id !== PATTERN_DEFAULT_CATEGORY ? id : undefined, 40212 postType: type === TEMPLATE_PART_POST_TYPE ? TEMPLATE_PART_POST_TYPE : PATTERN_TYPES.user 40213 }); 40214 if (!count) { 40215 return; 40216 } 40217 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40218 ...linkInfo, 40219 icon: icon, 40220 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 40221 children: count 40222 }), 40223 "aria-current": isActive ? 'true' : undefined, 40224 children: label 40225 }); 40226 } 40227 40228 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js 40229 /** 40230 * WordPress dependencies 40231 */ 40232 40233 40234 40235 40236 /** 40237 * Internal dependencies 40238 */ 40239 40240 const useTemplatePartsGroupedByArea = items => { 40241 const allItems = items || []; 40242 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []); 40243 40244 // Create map of template areas ensuring that default areas are displayed before 40245 // any custom registered template part areas. 40246 const knownAreas = { 40247 header: {}, 40248 footer: {}, 40249 sidebar: {}, 40250 uncategorized: {} 40251 }; 40252 templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { 40253 ...templatePartArea, 40254 templateParts: [] 40255 }); 40256 const groupedByArea = allItems.reduce((accumulator, item) => { 40257 const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; 40258 accumulator[key].templateParts.push(item); 40259 return accumulator; 40260 }, knownAreas); 40261 return groupedByArea; 40262 }; 40263 function useTemplatePartAreas() { 40264 const { 40265 records: templateParts, 40266 isResolving: isLoading 40267 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 40268 per_page: -1 40269 }); 40270 return { 40271 hasTemplateParts: templateParts ? !!templateParts.length : false, 40272 isLoading, 40273 templatePartAreas: useTemplatePartsGroupedByArea(templateParts) 40274 }; 40275 } 40276 40277 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js 40278 /** 40279 * WordPress dependencies 40280 */ 40281 40282 40283 40284 40285 40286 40287 40288 40289 /** 40290 * Internal dependencies 40291 */ 40292 40293 40294 40295 40296 40297 40298 40299 40300 40301 const { 40302 useLocation: sidebar_navigation_screen_patterns_useLocation 40303 } = unlock(external_wp_router_namespaceObject.privateApis); 40304 function CategoriesGroup({ 40305 templatePartAreas, 40306 patternCategories, 40307 currentCategory, 40308 currentType 40309 }) { 40310 const [allPatterns, ...otherPatterns] = patternCategories; 40311 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40312 className: "edit-site-sidebar-navigation-screen-patterns__group", 40313 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40314 count: Object.values(templatePartAreas).map(({ 40315 templateParts 40316 }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0), 40317 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)() /* no name, so it provides the fallback icon */, 40318 label: (0,external_wp_i18n_namespaceObject.__)('All template parts'), 40319 id: TEMPLATE_PART_ALL_AREAS_CATEGORY, 40320 type: TEMPLATE_PART_POST_TYPE, 40321 isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE 40322 }, "all"), Object.entries(templatePartAreas).map(([area, { 40323 label, 40324 templateParts 40325 }]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40326 count: templateParts?.length, 40327 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area), 40328 label: label, 40329 id: area, 40330 type: TEMPLATE_PART_POST_TYPE, 40331 isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE 40332 }, area)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40333 className: "edit-site-sidebar-navigation-screen-patterns__divider" 40334 }), allPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40335 count: allPatterns.count, 40336 label: allPatterns.label, 40337 icon: library_file, 40338 id: allPatterns.name, 40339 type: PATTERN_TYPES.user, 40340 isActive: currentCategory === `$allPatterns.name}` && currentType === PATTERN_TYPES.user 40341 }, allPatterns.name), otherPatterns.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40342 count: category.count, 40343 label: category.label, 40344 icon: library_file, 40345 id: category.name, 40346 type: PATTERN_TYPES.user, 40347 isActive: currentCategory === `$category.name}` && currentType === PATTERN_TYPES.user 40348 }, category.name))] 40349 }); 40350 } 40351 function SidebarNavigationScreenPatterns({ 40352 backPath 40353 }) { 40354 const { 40355 params: { 40356 postType, 40357 categoryId 40358 } 40359 } = sidebar_navigation_screen_patterns_useLocation(); 40360 const currentType = postType || PATTERN_TYPES.user; 40361 const currentCategory = categoryId || (currentType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); 40362 const { 40363 templatePartAreas, 40364 hasTemplateParts, 40365 isLoading 40366 } = useTemplatePartAreas(); 40367 const { 40368 patternCategories, 40369 hasPatterns 40370 } = usePatternCategories(); 40371 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); 40372 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 40373 isRoot: !isBlockBasedTheme, 40374 title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), 40375 description: (0,external_wp_i18n_namespaceObject.__)('Manage what patterns are available when editing the site.'), 40376 backPath: backPath, 40377 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40378 children: [isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading items…'), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40379 children: [!hasTemplateParts && !hasPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40380 className: "edit-site-sidebar-navigation-screen-patterns__group", 40381 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 40382 children: (0,external_wp_i18n_namespaceObject.__)('No items found') 40383 }) 40384 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoriesGroup, { 40385 templatePartAreas: templatePartAreas, 40386 patternCategories: patternCategories, 40387 currentCategory: currentCategory, 40388 currentType: currentType 40389 })] 40390 })] 40391 }) 40392 }); 40393 } 40394 40395 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/add-new-view.js 40396 /** 40397 * WordPress dependencies 40398 */ 40399 40400 40401 40402 40403 40404 40405 40406 40407 /** 40408 * Internal dependencies 40409 */ 40410 40411 40412 40413 40414 40415 40416 const { 40417 useHistory: add_new_view_useHistory 40418 } = unlock(external_wp_router_namespaceObject.privateApis); 40419 function AddNewItemModalContent({ 40420 type, 40421 setIsAdding 40422 }) { 40423 const history = add_new_view_useHistory(); 40424 const { 40425 saveEntityRecord 40426 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40427 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 40428 const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); 40429 const defaultViews = useDefaultViews({ 40430 postType: type 40431 }); 40432 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40433 onSubmit: async event => { 40434 event.preventDefault(); 40435 setIsSaving(true); 40436 const { 40437 getEntityRecords 40438 } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store); 40439 let dataViewTaxonomyId; 40440 const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', { 40441 slug: type 40442 }); 40443 if (dataViewTypeRecords && dataViewTypeRecords.length > 0) { 40444 dataViewTaxonomyId = dataViewTypeRecords[0].id; 40445 } else { 40446 const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', { 40447 name: type 40448 }); 40449 if (record && record.id) { 40450 dataViewTaxonomyId = record.id; 40451 } 40452 } 40453 const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', { 40454 title, 40455 status: 'publish', 40456 wp_dataviews_type: dataViewTaxonomyId, 40457 content: JSON.stringify(defaultViews[0].view) 40458 }); 40459 const { 40460 params: { 40461 postType 40462 } 40463 } = history.getLocationWithParams(); 40464 history.push({ 40465 postType, 40466 activeView: savedRecord.id, 40467 isCustom: 'true' 40468 }); 40469 setIsSaving(false); 40470 setIsAdding(false); 40471 }, 40472 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40473 spacing: "5", 40474 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40475 __next40pxDefaultSize: true, 40476 __nextHasNoMarginBottom: true, 40477 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40478 value: title, 40479 onChange: setTitle, 40480 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40481 className: "patterns-create-modal__name-input" 40482 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40483 justify: "right", 40484 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40485 __next40pxDefaultSize: true, 40486 variant: "tertiary", 40487 onClick: () => { 40488 setIsAdding(false); 40489 }, 40490 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40491 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40492 __next40pxDefaultSize: true, 40493 variant: "primary", 40494 type: "submit", 40495 "aria-disabled": !title || isSaving, 40496 isBusy: isSaving, 40497 children: (0,external_wp_i18n_namespaceObject.__)('Create') 40498 })] 40499 })] 40500 }) 40501 }); 40502 } 40503 function AddNewItem({ 40504 type 40505 }) { 40506 const [isAdding, setIsAdding] = (0,external_wp_element_namespaceObject.useState)(false); 40507 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40508 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40509 icon: library_plus, 40510 onClick: () => { 40511 setIsAdding(true); 40512 }, 40513 className: "dataviews__siderbar-content-add-new-item", 40514 children: (0,external_wp_i18n_namespaceObject.__)('New view') 40515 }), isAdding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40516 title: (0,external_wp_i18n_namespaceObject.__)('Add new view'), 40517 onRequestClose: () => { 40518 setIsAdding(false); 40519 }, 40520 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItemModalContent, { 40521 type: type, 40522 setIsAdding: setIsAdding 40523 }) 40524 })] 40525 }); 40526 } 40527 40528 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/custom-dataviews-list.js 40529 /** 40530 * WordPress dependencies 40531 */ 40532 40533 40534 40535 40536 40537 40538 40539 40540 /** 40541 * Internal dependencies 40542 */ 40543 40544 40545 40546 40547 40548 40549 const { 40550 useHistory: custom_dataviews_list_useHistory 40551 } = unlock(external_wp_router_namespaceObject.privateApis); 40552 const custom_dataviews_list_EMPTY_ARRAY = []; 40553 function RenameItemModalContent({ 40554 dataviewId, 40555 currentTitle, 40556 setIsRenaming 40557 }) { 40558 const { 40559 editEntityRecord 40560 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40561 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(currentTitle); 40562 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40563 onSubmit: async event => { 40564 event.preventDefault(); 40565 await editEntityRecord('postType', 'wp_dataviews', dataviewId, { 40566 title 40567 }); 40568 setIsRenaming(false); 40569 }, 40570 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40571 spacing: "5", 40572 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40573 __next40pxDefaultSize: true, 40574 __nextHasNoMarginBottom: true, 40575 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40576 value: title, 40577 onChange: setTitle, 40578 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40579 className: "patterns-create-modal__name-input" 40580 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40581 justify: "right", 40582 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40583 variant: "tertiary", 40584 __next40pxDefaultSize: true, 40585 onClick: () => { 40586 setIsRenaming(false); 40587 }, 40588 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40589 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40590 variant: "primary", 40591 type: "submit", 40592 "aria-disabled": !title, 40593 __next40pxDefaultSize: true, 40594 children: (0,external_wp_i18n_namespaceObject.__)('Save') 40595 })] 40596 })] 40597 }) 40598 }); 40599 } 40600 function CustomDataViewItem({ 40601 dataviewId, 40602 isActive 40603 }) { 40604 const history = custom_dataviews_list_useHistory(); 40605 const { 40606 dataview 40607 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 40608 const { 40609 getEditedEntityRecord 40610 } = select(external_wp_coreData_namespaceObject.store); 40611 return { 40612 dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId) 40613 }; 40614 }, [dataviewId]); 40615 const { 40616 deleteEntityRecord 40617 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40618 const type = (0,external_wp_element_namespaceObject.useMemo)(() => { 40619 const viewContent = JSON.parse(dataview.content); 40620 return viewContent.type; 40621 }, [dataview.content]); 40622 const [isRenaming, setIsRenaming] = (0,external_wp_element_namespaceObject.useState)(false); 40623 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40624 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40625 title: dataview.title, 40626 type: type, 40627 isActive: isActive, 40628 isCustom: true, 40629 customViewId: dataviewId, 40630 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 40631 icon: more_vertical, 40632 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 40633 className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu", 40634 toggleProps: { 40635 style: { 40636 color: 'inherit' 40637 }, 40638 size: 'small' 40639 }, 40640 children: ({ 40641 onClose 40642 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 40643 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40644 onClick: () => { 40645 setIsRenaming(true); 40646 onClose(); 40647 }, 40648 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 40649 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40650 onClick: async () => { 40651 await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, { 40652 force: true 40653 }); 40654 if (isActive) { 40655 const { 40656 params: { 40657 postType 40658 } 40659 } = history.getLocationWithParams(); 40660 history.replace({ 40661 postType 40662 }); 40663 } 40664 onClose(); 40665 }, 40666 isDestructive: true, 40667 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 40668 })] 40669 }) 40670 }) 40671 }), isRenaming && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40672 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 40673 onRequestClose: () => { 40674 setIsRenaming(false); 40675 }, 40676 focusOnMount: "firstContentElement", 40677 size: "small", 40678 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameItemModalContent, { 40679 dataviewId: dataviewId, 40680 setIsRenaming: setIsRenaming, 40681 currentTitle: dataview.title 40682 }) 40683 })] 40684 }); 40685 } 40686 function useCustomDataViews(type) { 40687 const customDataViews = (0,external_wp_data_namespaceObject.useSelect)(select => { 40688 const { 40689 getEntityRecords 40690 } = select(external_wp_coreData_namespaceObject.store); 40691 const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', { 40692 slug: type 40693 }); 40694 if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) { 40695 return custom_dataviews_list_EMPTY_ARRAY; 40696 } 40697 const dataViews = getEntityRecords('postType', 'wp_dataviews', { 40698 wp_dataviews_type: dataViewTypeRecords[0].id, 40699 orderby: 'date', 40700 order: 'asc' 40701 }); 40702 if (!dataViews) { 40703 return custom_dataviews_list_EMPTY_ARRAY; 40704 } 40705 return dataViews; 40706 }); 40707 return customDataViews; 40708 } 40709 function CustomDataViewsList({ 40710 type, 40711 activeView, 40712 isCustom 40713 }) { 40714 const customDataViews = useCustomDataViews(type); 40715 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40716 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40717 className: "edit-site-sidebar-navigation-screen-dataviews__group-header", 40718 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 40719 level: 2, 40720 children: (0,external_wp_i18n_namespaceObject.__)('Custom Views') 40721 }) 40722 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40723 children: [customDataViews.map(customViewRecord => { 40724 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewItem, { 40725 dataviewId: customViewRecord.id, 40726 isActive: isCustom && Number(activeView) === customViewRecord.id 40727 }, customViewRecord.id); 40728 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItem, { 40729 type: type 40730 })] 40731 })] 40732 }); 40733 } 40734 40735 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js 40736 /** 40737 * WordPress dependencies 40738 */ 40739 40740 40741 40742 /** 40743 * Internal dependencies 40744 */ 40745 40746 40747 40748 40749 40750 40751 40752 const { 40753 useLocation: sidebar_dataviews_useLocation 40754 } = unlock(external_wp_router_namespaceObject.privateApis); 40755 function DataViewsSidebarContent() { 40756 const { 40757 params: { 40758 postType, 40759 activeView = 'all', 40760 isCustom = 'false' 40761 } 40762 } = sidebar_dataviews_useLocation(); 40763 const defaultViews = useDefaultViews({ 40764 postType 40765 }); 40766 if (!postType) { 40767 return null; 40768 } 40769 const isCustomBoolean = isCustom === 'true'; 40770 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40771 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40772 children: defaultViews.map(dataview => { 40773 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40774 slug: dataview.slug, 40775 title: dataview.title, 40776 icon: dataview.icon, 40777 type: dataview.view.type, 40778 isActive: !isCustomBoolean && dataview.slug === activeView, 40779 isCustom: false 40780 }, dataview.slug); 40781 }) 40782 }), window?.__experimentalCustomViews && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewsList, { 40783 activeView: activeView, 40784 type: postType, 40785 isCustom: true 40786 })] 40787 }); 40788 } 40789 40790 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js 40791 /** 40792 * WordPress dependencies 40793 */ 40794 40795 40796 40797 /** 40798 * Internal dependencies 40799 */ 40800 40801 40802 function FormRegular({ 40803 data, 40804 fields, 40805 form, 40806 onChange 40807 }) { 40808 const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => { 40809 var _form$fields; 40810 return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({ 40811 id 40812 }) => id === fieldId)).filter(field => !!field)); 40813 }, [fields, form.fields]); 40814 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 40815 spacing: 4, 40816 children: visibleFields.map(field => { 40817 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 40818 data: data, 40819 field: field, 40820 onChange: onChange 40821 }, field.id); 40822 }) 40823 }); 40824 } 40825 40826 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js 40827 /** 40828 * WordPress dependencies 40829 */ 40830 40831 40832 40833 40834 40835 /** 40836 * Internal dependencies 40837 */ 40838 40839 40840 40841 40842 function DropdownHeader({ 40843 title, 40844 onClose 40845 }) { 40846 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 40847 className: "dataforms-layouts-panel__dropdown-header", 40848 spacing: 4, 40849 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40850 alignment: "center", 40851 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 40852 level: 2, 40853 size: 13, 40854 children: title 40855 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40856 label: (0,external_wp_i18n_namespaceObject.__)('Close'), 40857 icon: close_small, 40858 onClick: onClose, 40859 size: "small" 40860 })] 40861 }) 40862 }); 40863 } 40864 function FormField({ 40865 data, 40866 field, 40867 onChange 40868 }) { 40869 // Use internal state instead of a ref to make sure that the component 40870 // re-renders when the popover's anchor updates. 40871 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 40872 // Memoize popoverProps to avoid returning a new object every time. 40873 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 40874 // Anchor the popover to the middle of the entire row so that it doesn't 40875 // move around when the label changes. 40876 anchor: popoverAnchor, 40877 placement: 'left-start', 40878 offset: 36, 40879 shift: true 40880 }), [popoverAnchor]); 40881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40882 ref: setPopoverAnchor, 40883 className: "dataforms-layouts-panel__field", 40884 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40885 className: "dataforms-layouts-panel__field-label", 40886 children: field.label 40887 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40888 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 40889 contentClassName: "dataforms-layouts-panel__field-dropdown", 40890 popoverProps: popoverProps, 40891 focusOnMount: true, 40892 toggleProps: { 40893 size: 'compact', 40894 variant: 'tertiary', 40895 tooltipPosition: 'middle left' 40896 }, 40897 renderToggle: ({ 40898 isOpen, 40899 onToggle 40900 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40901 className: "dataforms-layouts-panel__field-control", 40902 size: "compact", 40903 variant: "tertiary", 40904 "aria-expanded": isOpen, 40905 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 40906 // translators: %s: Field name. 40907 (0,external_wp_i18n_namespaceObject.__)('Edit %s'), field.label), 40908 onClick: onToggle, 40909 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 40910 item: data 40911 }) 40912 }), 40913 renderContent: ({ 40914 onClose 40915 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40916 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { 40917 title: field.label, 40918 onClose: onClose 40919 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 40920 data: data, 40921 field: field, 40922 onChange: onChange, 40923 hideLabelFromVision: true 40924 }, field.id)] 40925 }) 40926 }) 40927 })] 40928 }); 40929 } 40930 function FormPanel({ 40931 data, 40932 fields, 40933 form, 40934 onChange 40935 }) { 40936 const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => { 40937 var _form$fields; 40938 return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({ 40939 id 40940 }) => id === fieldId)).filter(field => !!field)); 40941 }, [fields, form.fields]); 40942 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 40943 spacing: 2, 40944 children: visibleFields.map(field => { 40945 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormField, { 40946 data: data, 40947 field: field, 40948 onChange: onChange 40949 }, field.id); 40950 }) 40951 }); 40952 } 40953 40954 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js 40955 /** 40956 * Internal dependencies 40957 */ 40958 40959 40960 const FORM_LAYOUTS = [{ 40961 type: 'regular', 40962 component: FormRegular 40963 }, { 40964 type: 'panel', 40965 component: FormPanel 40966 }]; 40967 function getFormLayout(type) { 40968 return FORM_LAYOUTS.find(layout => layout.type === type); 40969 } 40970 40971 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js 40972 /** 40973 * Internal dependencies 40974 */ 40975 40976 40977 40978 function DataForm({ 40979 form, 40980 ...props 40981 }) { 40982 var _form$type; 40983 const layout = getFormLayout((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : 'regular'); 40984 if (!layout) { 40985 return null; 40986 } 40987 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout.component, { 40988 form: form, 40989 ...props 40990 }); 40991 } 40992 40993 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js 40994 /** 40995 * External dependencies 40996 */ 40997 40998 40999 /** 41000 * WordPress dependencies 41001 */ 41002 41003 41004 41005 41006 41007 41008 41009 41010 /** 41011 * Internal dependencies 41012 */ 41013 41014 41015 41016 41017 41018 const { 41019 PostCardPanel 41020 } = unlock(external_wp_editor_namespaceObject.privateApis); 41021 function PostEditForm({ 41022 postType, 41023 postId 41024 }) { 41025 const ids = (0,external_wp_element_namespaceObject.useMemo)(() => postId.split(','), [postId]); 41026 const { 41027 record 41028 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 41029 return { 41030 record: ids.length === 1 ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, ids[0]) : null 41031 }; 41032 }, [postType, ids]); 41033 const [multiEdits, setMultiEdits] = (0,external_wp_element_namespaceObject.useState)({}); 41034 const { 41035 editEntityRecord 41036 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 41037 const { 41038 fields: _fields 41039 } = post_fields(); 41040 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => _fields?.map(field => { 41041 if (field.id === 'status') { 41042 return { 41043 ...field, 41044 elements: field.elements.filter(element => element.value !== 'trash') 41045 }; 41046 } 41047 return field; 41048 }), [_fields]); 41049 const form = { 41050 type: 'panel', 41051 fields: ['title', 'status', 'date', 'author', 'comment_status'] 41052 }; 41053 const onChange = edits => { 41054 for (const id of ids) { 41055 if (edits.status !== 'future' && record.status === 'future' && new Date(record.date) > new Date()) { 41056 edits.date = null; 41057 } 41058 if (edits.status === 'private' && record.password) { 41059 edits.password = ''; 41060 } 41061 editEntityRecord('postType', postType, id, edits); 41062 if (ids.length > 1) { 41063 setMultiEdits(prev => ({ 41064 ...prev, 41065 ...edits 41066 })); 41067 } 41068 } 41069 }; 41070 (0,external_wp_element_namespaceObject.useEffect)(() => { 41071 setMultiEdits({}); 41072 }, [ids]); 41073 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 41074 spacing: 4, 41075 children: [ids.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { 41076 postType: postType, 41077 postId: ids[0] 41078 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { 41079 data: ids.length === 1 ? record : multiEdits, 41080 fields: fields, 41081 form: form, 41082 onChange: onChange 41083 })] 41084 }); 41085 } 41086 function PostEdit({ 41087 postType, 41088 postId 41089 }) { 41090 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 41091 className: dist_clsx('edit-site-post-edit', { 41092 'is-empty': !postId 41093 }), 41094 label: (0,external_wp_i18n_namespaceObject.__)('Post Edit'), 41095 children: [postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { 41096 postType: postType, 41097 postId: postId 41098 }), !postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 41099 children: (0,external_wp_i18n_namespaceObject.__)('Select a page to edit') 41100 })] 41101 }); 41102 } 41103 41104 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/router.js 41105 /** 41106 * WordPress dependencies 41107 */ 41108 41109 41110 41111 /** 41112 * Internal dependencies 41113 */ 41114 41115 41116 41117 41118 41119 41120 41121 41122 41123 41124 41125 41126 41127 41128 41129 41130 const { 41131 useLocation: router_useLocation, 41132 useHistory: router_useHistory 41133 } = unlock(external_wp_router_namespaceObject.privateApis); 41134 function useRedirectOldPaths() { 41135 const history = router_useHistory(); 41136 const { 41137 params 41138 } = router_useLocation(); 41139 (0,external_wp_element_namespaceObject.useEffect)(() => { 41140 const { 41141 postType, 41142 path, 41143 categoryType, 41144 ...rest 41145 } = params; 41146 if (path === '/wp_template_part/all') { 41147 history.replace({ 41148 postType: TEMPLATE_PART_POST_TYPE 41149 }); 41150 } 41151 if (path === '/page') { 41152 history.replace({ 41153 postType: 'page', 41154 ...rest 41155 }); 41156 } 41157 if (path === '/wp_template') { 41158 history.replace({ 41159 postType: TEMPLATE_POST_TYPE, 41160 ...rest 41161 }); 41162 } 41163 if (path === '/patterns') { 41164 history.replace({ 41165 postType: categoryType === TEMPLATE_PART_POST_TYPE ? TEMPLATE_PART_POST_TYPE : PATTERN_TYPES.user, 41166 ...rest 41167 }); 41168 } 41169 if (path === '/navigation') { 41170 history.replace({ 41171 postType: NAVIGATION_POST_TYPE, 41172 ...rest 41173 }); 41174 } 41175 }, [history, params]); 41176 } 41177 function useLayoutAreas() { 41178 const { 41179 params 41180 } = router_useLocation(); 41181 const { 41182 postType, 41183 postId, 41184 path, 41185 layout, 41186 isCustom, 41187 canvas, 41188 quickEdit 41189 } = params; 41190 const hasEditCanvasMode = canvas === 'edit'; 41191 useRedirectOldPaths(); 41192 41193 // Page list 41194 if (postType === 'page') { 41195 const isListLayout = layout === 'list' || !layout; 41196 const showQuickEdit = quickEdit && !isListLayout; 41197 return { 41198 key: 'pages', 41199 areas: { 41200 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 41201 title: (0,external_wp_i18n_namespaceObject.__)('Pages'), 41202 backPath: {}, 41203 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, {}) 41204 }), 41205 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41206 postType: postType 41207 }), 41208 preview: !showQuickEdit && (isListLayout || hasEditCanvasMode) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41209 mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41210 postType: postType 41211 }), 41212 edit: showQuickEdit && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { 41213 postType: postType, 41214 postId: postId 41215 }) 41216 }, 41217 widths: { 41218 content: isListLayout ? 380 : undefined, 41219 edit: showQuickEdit ? 380 : undefined 41220 } 41221 }; 41222 } 41223 41224 // Templates 41225 if (postType === TEMPLATE_POST_TYPE) { 41226 const isListLayout = isCustom !== 'true' && layout === 'list'; 41227 return { 41228 key: 'templates', 41229 areas: { 41230 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { 41231 backPath: {} 41232 }), 41233 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}), 41234 preview: (isListLayout || hasEditCanvasMode) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41235 mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) 41236 }, 41237 widths: { 41238 content: isListLayout ? 380 : undefined 41239 } 41240 }; 41241 } 41242 41243 // Patterns 41244 if ([TEMPLATE_PART_POST_TYPE, PATTERN_TYPES.user].includes(postType)) { 41245 return { 41246 key: 'patterns', 41247 areas: { 41248 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 41249 backPath: {} 41250 }), 41251 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), 41252 mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), 41253 preview: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41254 } 41255 }; 41256 } 41257 41258 // Styles 41259 if (path === '/wp_global_styles') { 41260 return { 41261 key: 'styles', 41262 areas: { 41263 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { 41264 backPath: {} 41265 }), 41266 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41267 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41268 } 41269 }; 41270 } 41271 41272 // Navigation 41273 if (postType === NAVIGATION_POST_TYPE) { 41274 if (postId) { 41275 return { 41276 key: 'navigation', 41277 areas: { 41278 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { 41279 backPath: { 41280 postType: NAVIGATION_POST_TYPE 41281 } 41282 }), 41283 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41284 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41285 } 41286 }; 41287 } 41288 return { 41289 key: 'navigation', 41290 areas: { 41291 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { 41292 backPath: {} 41293 }), 41294 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41295 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41296 } 41297 }; 41298 } 41299 41300 // Fallback shows the home page preview 41301 return { 41302 key: 'default', 41303 areas: { 41304 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), 41305 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41306 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41307 } 41308 }; 41309 } 41310 41311 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js 41312 /** 41313 * WordPress dependencies 41314 */ 41315 41316 41317 41318 41319 /** 41320 * Internal dependencies 41321 */ 41322 41323 41324 41325 const { 41326 useCommandContext 41327 } = unlock(external_wp_commands_namespaceObject.privateApis); 41328 41329 /** 41330 * React hook used to set the correct command context based on the current state. 41331 */ 41332 function useSetCommandContext() { 41333 const { 41334 hasBlockSelected, 41335 canvasMode 41336 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 41337 const { 41338 getCanvasMode 41339 } = unlock(select(store)); 41340 const { 41341 getBlockSelectionStart 41342 } = select(external_wp_blockEditor_namespaceObject.store); 41343 return { 41344 canvasMode: getCanvasMode(), 41345 hasBlockSelected: getBlockSelectionStart() 41346 }; 41347 }, []); 41348 const hasEditorCanvasContainer = useHasEditorCanvasContainer(); 41349 41350 // Sets the right context for the command palette 41351 let commandContext = 'site-editor'; 41352 if (canvasMode === 'edit') { 41353 commandContext = 'entity-edit'; 41354 } 41355 if (hasBlockSelected) { 41356 commandContext = 'block-selection-edit'; 41357 } 41358 if (hasEditorCanvasContainer) { 41359 /* 41360 * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context 41361 * to remove the suggested commands that may not make sense with Style Book or Style Revisions open. 41362 * See https://github.com/WordPress/gutenberg/issues/62216. 41363 */ 41364 commandContext = ''; 41365 } 41366 useCommandContext(commandContext); 41367 } 41368 41369 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/app/index.js 41370 /** 41371 * WordPress dependencies 41372 */ 41373 41374 41375 41376 41377 41378 41379 41380 41381 /** 41382 * Internal dependencies 41383 */ 41384 41385 41386 41387 41388 41389 41390 41391 41392 41393 const { 41394 RouterProvider 41395 } = unlock(external_wp_router_namespaceObject.privateApis); 41396 const { 41397 GlobalStylesProvider 41398 } = unlock(external_wp_editor_namespaceObject.privateApis); 41399 function AppLayout() { 41400 // This ensures the edited entity id and type are initialized properly. 41401 useInitEditedEntityFromURL(); 41402 useEditModeCommands(); 41403 useCommonCommands(); 41404 useSetCommandContext(); 41405 const route = useLayoutAreas(); 41406 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { 41407 route: route 41408 }); 41409 } 41410 function App() { 41411 const { 41412 createErrorNotice 41413 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 41414 function onPluginAreaError(name) { 41415 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ 41416 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); 41417 } 41418 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { 41419 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { 41420 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(RouterProvider, { 41421 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { 41422 onError: onPluginAreaError 41423 })] 41424 })] 41425 }) 41426 }); 41427 } 41428 41429 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/deprecated.js 41430 /** 41431 * WordPress dependencies 41432 */ 41433 41434 41435 41436 41437 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 41438 const deprecateSlot = name => { 41439 external_wp_deprecated_default()(`wp.editPost.$name}`, { 41440 since: '6.6', 41441 alternative: `wp.editor.$name}` 41442 }); 41443 }; 41444 41445 /* eslint-disable jsdoc/require-param */ 41446 /** 41447 * @see PluginMoreMenuItem in @wordpress/editor package. 41448 */ 41449 function PluginMoreMenuItem(props) { 41450 if (!isSiteEditor) { 41451 return null; 41452 } 41453 deprecateSlot('PluginMoreMenuItem'); 41454 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { 41455 ...props 41456 }); 41457 } 41458 41459 /** 41460 * @see PluginSidebar in @wordpress/editor package. 41461 */ 41462 function PluginSidebar(props) { 41463 if (!isSiteEditor) { 41464 return null; 41465 } 41466 deprecateSlot('PluginSidebar'); 41467 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { 41468 ...props 41469 }); 41470 } 41471 41472 /** 41473 * @see PluginSidebarMoreMenuItem in @wordpress/editor package. 41474 */ 41475 function PluginSidebarMoreMenuItem(props) { 41476 if (!isSiteEditor) { 41477 return null; 41478 } 41479 deprecateSlot('PluginSidebarMoreMenuItem'); 41480 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { 41481 ...props 41482 }); 41483 } 41484 /* eslint-enable jsdoc/require-param */ 41485 41486 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/posts-app/router.js 41487 /** 41488 * WordPress dependencies 41489 */ 41490 41491 41492 41493 41494 /** 41495 * Internal dependencies 41496 */ 41497 41498 41499 41500 41501 41502 41503 41504 const { 41505 useLocation: posts_app_router_useLocation 41506 } = unlock(external_wp_router_namespaceObject.privateApis); 41507 function router_useLayoutAreas() { 41508 const { 41509 params = {} 41510 } = posts_app_router_useLocation(); 41511 const { 41512 postType, 41513 layout, 41514 canvas 41515 } = params; 41516 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => { 41517 return select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels; 41518 }, [postType]); 41519 41520 // Posts list. 41521 if (['post'].includes(postType)) { 41522 const isListLayout = layout === 'list' || !layout; 41523 return { 41524 key: 'posts-list', 41525 areas: { 41526 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 41527 title: labels?.name, 41528 isRoot: true, 41529 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, {}) 41530 }), 41531 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41532 postType: postType 41533 }), 41534 preview: (isListLayout || canvas === 'edit') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41535 isPostsList: true 41536 }), 41537 mobile: canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41538 isPostsList: true 41539 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41540 postType: postType 41541 }) 41542 }, 41543 widths: { 41544 content: isListLayout ? 380 : undefined 41545 } 41546 }; 41547 } 41548 41549 // Fallback shows the home page preview 41550 return { 41551 key: 'default', 41552 areas: { 41553 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), 41554 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41555 isPostsList: true 41556 }), 41557 mobile: canvas === 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41558 isPostsList: true 41559 }) 41560 } 41561 }; 41562 } 41563 41564 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js 41565 /** 41566 * WordPress dependencies 41567 */ 41568 41569 41570 41571 /** 41572 * Internal dependencies 41573 */ 41574 41575 41576 41577 41578 41579 41580 const { 41581 RouterProvider: posts_app_RouterProvider 41582 } = unlock(external_wp_router_namespaceObject.privateApis); 41583 const { 41584 GlobalStylesProvider: posts_app_GlobalStylesProvider 41585 } = unlock(external_wp_editor_namespaceObject.privateApis); 41586 function PostsLayout() { 41587 // This ensures the edited entity id and type are initialized properly. 41588 useInitEditedEntityFromURL(); 41589 const route = router_useLayoutAreas(); 41590 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { 41591 route: route 41592 }); 41593 } 41594 function PostsApp() { 41595 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(posts_app_GlobalStylesProvider, { 41596 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { 41597 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsLayout, {}) 41598 })] 41599 }); 41600 } 41601 41602 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/posts.js 41603 /** 41604 * WordPress dependencies 41605 */ 41606 41607 41608 41609 41610 41611 41612 41613 /** 41614 * Internal dependencies 41615 */ 41616 41617 41618 41619 /** 41620 * Internal dependencies 41621 */ 41622 41623 41624 /** 41625 * Initializes the "Posts Dashboard" 41626 * @param {string} id ID of the root element to render the screen in. 41627 * @param {Object} settings Editor settings. 41628 */ 41629 41630 function initializePostsDashboard(id, settings) { 41631 if (true) { 41632 return; 41633 } 41634 const target = document.getElementById(id); 41635 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 41636 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 41637 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 41638 name 41639 }) => name !== 'core/freeform'); 41640 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 41641 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 41642 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 41643 inserter: false 41644 }); 41645 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 41646 inserter: false 41647 }); 41648 if (false) {} 41649 41650 // We dispatch actions and update the store synchronously before rendering 41651 // so that we won't trigger unnecessary re-renders with useEffect. 41652 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 41653 welcomeGuide: true, 41654 welcomeGuideStyles: true, 41655 welcomeGuidePage: true, 41656 welcomeGuideTemplate: true 41657 }); 41658 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 41659 allowRightClickOverrides: true, 41660 distractionFree: false, 41661 editorMode: 'visual', 41662 fixedToolbar: false, 41663 focusMode: false, 41664 inactivePanels: [], 41665 keepCaretInsideBlock: false, 41666 openPanels: ['post-status'], 41667 showBlockBreadcrumbs: true, 41668 showListViewByDefault: false, 41669 enableChoosePatternModal: true 41670 }); 41671 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 41672 41673 // Prevent the default browser action for files dropped outside of dropzones. 41674 window.addEventListener('dragover', e => e.preventDefault(), false); 41675 window.addEventListener('drop', e => e.preventDefault(), false); 41676 root.render( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 41677 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) 41678 })); 41679 return root; 41680 } 41681 41682 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/index.js 41683 /** 41684 * WordPress dependencies 41685 */ 41686 41687 41688 41689 41690 41691 41692 41693 41694 41695 /** 41696 * Internal dependencies 41697 */ 41698 41699 41700 41701 41702 41703 const { 41704 registerCoreBlockBindingsSources 41705 } = unlock(external_wp_editor_namespaceObject.privateApis); 41706 41707 /** 41708 * Initializes the site editor screen. 41709 * 41710 * @param {string} id ID of the root element to render the screen in. 41711 * @param {Object} settings Editor settings. 41712 */ 41713 function initializeEditor(id, settings) { 41714 const target = document.getElementById(id); 41715 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 41716 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 41717 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 41718 name 41719 }) => name !== 'core/freeform'); 41720 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 41721 registerCoreBlockBindingsSources(); 41722 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 41723 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 41724 inserter: false 41725 }); 41726 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 41727 inserter: false 41728 }); 41729 if (false) {} 41730 41731 // We dispatch actions and update the store synchronously before rendering 41732 // so that we won't trigger unnecessary re-renders with useEffect. 41733 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 41734 welcomeGuide: true, 41735 welcomeGuideStyles: true, 41736 welcomeGuidePage: true, 41737 welcomeGuideTemplate: true 41738 }); 41739 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 41740 allowRightClickOverrides: true, 41741 distractionFree: false, 41742 editorMode: 'visual', 41743 fixedToolbar: false, 41744 focusMode: false, 41745 inactivePanels: [], 41746 keepCaretInsideBlock: false, 41747 openPanels: ['post-status'], 41748 showBlockBreadcrumbs: true, 41749 showListViewByDefault: false, 41750 enableChoosePatternModal: true 41751 }); 41752 if (window.__experimentalMediaProcessing) { 41753 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/media', { 41754 requireApproval: true, 41755 optimizeOnUpload: true 41756 }); 41757 } 41758 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 41759 41760 // Keep the defaultTemplateTypes in the core/editor settings too, 41761 // so that they can be selected with core/editor selectors in any editor. 41762 // This is needed because edit-site doesn't initialize with EditorProvider, 41763 // which internally uses updateEditorSettings as well. 41764 (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).updateEditorSettings({ 41765 defaultTemplateTypes: settings.defaultTemplateTypes, 41766 defaultTemplatePartAreas: settings.defaultTemplatePartAreas 41767 }); 41768 41769 // Prevent the default browser action for files dropped outside of dropzones. 41770 window.addEventListener('dragover', e => e.preventDefault(), false); 41771 window.addEventListener('drop', e => e.preventDefault(), false); 41772 root.render( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 41773 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) 41774 })); 41775 return root; 41776 } 41777 function reinitializeEditor() { 41778 external_wp_deprecated_default()('wp.editSite.reinitializeEditor', { 41779 since: '6.2', 41780 version: '6.3' 41781 }); 41782 } 41783 41784 41785 41786 41787 // Temporary: While the posts dashboard is being iterated on 41788 // it's being built in the same package as the site editor. 41789 41790 41791 })(); 41792 41793 (window.wp = window.wp || {}).editSite = __webpack_exports__; 41794 /******/ })() 41795 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Oct 24 08:20:01 2024 | Cross-referenced by PHPXref |