[ 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: The name of active theme, 2: 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: variation title. 2: variation description. */ 13025 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'variation label'), 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 22084 const { 22085 useZoomOut 22086 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22087 function ScreenStyleVariations() { 22088 // Style Variations should only be previewed in with 22089 // - a "zoomed out" editor 22090 // - "Desktop" device preview 22091 const { 22092 setDeviceType 22093 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 22094 useZoomOut(); 22095 setDeviceType('desktop'); 22096 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22097 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22098 title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'), 22099 description: (0,external_wp_i18n_namespaceObject.__)('Choose a variation to change the look of the site.') 22100 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 22101 size: "small", 22102 isBorderless: true, 22103 className: "edit-site-global-styles-screen-style-variations", 22104 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { 22105 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) 22106 }) 22107 })] 22108 }); 22109 } 22110 /* harmony default export */ const screen_style_variations = (ScreenStyleVariations); 22111 22112 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 22113 /** 22114 * WordPress dependencies 22115 */ 22116 22117 22118 const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22119 xmlns: "http://www.w3.org/2000/svg", 22120 viewBox: "0 0 24 24", 22121 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22122 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" 22123 }) 22124 }); 22125 /* harmony default export */ const close_small = (closeSmall); 22126 22127 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js 22128 /** 22129 * WordPress dependencies 22130 */ 22131 22132 22133 22134 22135 22136 22137 22138 22139 22140 22141 /** 22142 * Internal dependencies 22143 */ 22144 22145 22146 22147 22148 const { 22149 EditorContentSlotFill, 22150 ResizableEditor 22151 } = unlock(external_wp_editor_namespaceObject.privateApis); 22152 22153 /** 22154 * Returns a translated string for the title of the editor canvas container. 22155 * 22156 * @param {string} view Editor canvas container view. 22157 * 22158 * @return {Object} Translated string for the view title and associated icon, both defaulting to ''. 22159 */ 22160 function getEditorCanvasContainerTitle(view) { 22161 switch (view) { 22162 case 'style-book': 22163 return (0,external_wp_i18n_namespaceObject.__)('Style Book'); 22164 case 'global-styles-revisions': 22165 case 'global-styles-revisions:style-book': 22166 return (0,external_wp_i18n_namespaceObject.__)('Style Revisions'); 22167 default: 22168 return ''; 22169 } 22170 } 22171 function EditorCanvasContainer({ 22172 children, 22173 closeButtonLabel, 22174 onClose, 22175 enableResizing = false 22176 }) { 22177 const { 22178 editorCanvasContainerView, 22179 showListViewByDefault 22180 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22181 const _editorCanvasContainerView = unlock(select(store)).getEditorCanvasContainerView(); 22182 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 22183 return { 22184 editorCanvasContainerView: _editorCanvasContainerView, 22185 showListViewByDefault: _showListViewByDefault 22186 }; 22187 }, []); 22188 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 22189 const { 22190 setEditorCanvasContainerView 22191 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 22192 const { 22193 setIsListViewOpened 22194 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 22195 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); 22196 const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); 22197 function onCloseContainer() { 22198 setIsListViewOpened(showListViewByDefault); 22199 setEditorCanvasContainerView(undefined); 22200 setIsClosed(true); 22201 if (typeof onClose === 'function') { 22202 onClose(); 22203 } 22204 } 22205 function closeOnEscape(event) { 22206 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 22207 event.preventDefault(); 22208 onCloseContainer(); 22209 } 22210 } 22211 const childrenWithProps = Array.isArray(children) ? external_wp_element_namespaceObject.Children.map(children, (child, index) => index === 0 ? (0,external_wp_element_namespaceObject.cloneElement)(child, { 22212 ref: sectionFocusReturnRef 22213 }) : child) : (0,external_wp_element_namespaceObject.cloneElement)(children, { 22214 ref: sectionFocusReturnRef 22215 }); 22216 if (isClosed) { 22217 return null; 22218 } 22219 const title = getEditorCanvasContainerTitle(editorCanvasContainerView); 22220 const shouldShowCloseButton = onClose || closeButtonLabel; 22221 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { 22222 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22223 className: "edit-site-editor-canvas-container", 22224 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { 22225 enableResizing: enableResizing, 22226 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { 22227 className: "edit-site-editor-canvas-container__section", 22228 ref: shouldShowCloseButton ? focusOnMountRef : null, 22229 onKeyDown: closeOnEscape, 22230 "aria-label": title, 22231 children: [shouldShowCloseButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 22232 __next40pxDefaultSize: true, 22233 className: "edit-site-editor-canvas-container__close-button", 22234 icon: close_small, 22235 label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close'), 22236 onClick: onCloseContainer 22237 }), childrenWithProps] 22238 }) 22239 }) 22240 }) 22241 }); 22242 } 22243 function useHasEditorCanvasContainer() { 22244 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.privateKey); 22245 return !!fills?.length; 22246 } 22247 /* harmony default export */ const editor_canvas_container = (EditorCanvasContainer); 22248 22249 22250 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js 22251 /** 22252 * External dependencies 22253 */ 22254 22255 22256 /** 22257 * WordPress dependencies 22258 */ 22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 22269 /** 22270 * Internal dependencies 22271 */ 22272 22273 22274 22275 22276 const { 22277 ExperimentalBlockEditorProvider, 22278 useGlobalStyle: style_book_useGlobalStyle, 22279 GlobalStylesContext: style_book_GlobalStylesContext, 22280 useGlobalStylesOutputWithConfig 22281 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22282 const { 22283 mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs 22284 } = unlock(external_wp_editor_namespaceObject.privateApis); 22285 const { 22286 Tabs: style_book_Tabs 22287 } = unlock(external_wp_components_namespaceObject.privateApis); 22288 22289 // The content area of the Style Book is rendered within an iframe so that global styles 22290 // are applied to elements within the entire content area. To support elements that are 22291 // not part of the block previews, such as headings and layout for the block previews, 22292 // additional CSS rules need to be passed into the iframe. These are hard-coded below. 22293 // Note that button styles are unset, and then focus rules from the `Button` component are 22294 // applied to the `button` element, targeted via `.edit-site-style-book__example`. 22295 // This is to ensure that browser default styles for buttons are not applied to the previews. 22296 const STYLE_BOOK_IFRAME_STYLES = ` 22297 .edit-site-style-book__examples { 22298 max-width: 900px; 22299 margin: 0 auto; 22300 } 22301 22302 .edit-site-style-book__example { 22303 border-radius: 2px; 22304 cursor: pointer; 22305 display: flex; 22306 flex-direction: column; 22307 gap: 40px; 22308 margin-bottom: 40px; 22309 padding: 16px; 22310 width: 100%; 22311 box-sizing: border-box; 22312 scroll-margin-top: 32px; 22313 scroll-margin-bottom: 32px; 22314 } 22315 22316 .edit-site-style-book__example.is-selected { 22317 box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22318 } 22319 22320 .edit-site-style-book__example:focus:not(:disabled) { 22321 box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22322 outline: 3px solid transparent; 22323 } 22324 22325 .edit-site-style-book__examples.is-wide .edit-site-style-book__example { 22326 flex-direction: row; 22327 } 22328 22329 .edit-site-style-book__example-title { 22330 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 22331 font-size: 11px; 22332 font-weight: 500; 22333 line-height: normal; 22334 margin: 0; 22335 text-align: left; 22336 text-transform: uppercase; 22337 } 22338 22339 .edit-site-style-book__examples.is-wide .edit-site-style-book__example-title { 22340 text-align: right; 22341 width: 120px; 22342 } 22343 22344 .edit-site-style-book__example-preview { 22345 width: 100%; 22346 } 22347 22348 .edit-site-style-book__example-preview .block-editor-block-list__insertion-point, 22349 .edit-site-style-book__example-preview .block-list-appender { 22350 display: none; 22351 } 22352 22353 .edit-site-style-book__example-preview .is-root-container > .wp-block:first-child { 22354 margin-top: 0; 22355 } 22356 .edit-site-style-book__example-preview .is-root-container > .wp-block:last-child { 22357 margin-bottom: 0; 22358 } 22359 `; 22360 function isObjectEmpty(object) { 22361 return !object || Object.keys(object).length === 0; 22362 } 22363 function getExamples() { 22364 const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => { 22365 const { 22366 name, 22367 example, 22368 supports 22369 } = blockType; 22370 return name !== 'core/heading' && !!example && supports.inserter !== false; 22371 }).map(blockType => ({ 22372 name: blockType.name, 22373 title: blockType.title, 22374 category: blockType.category, 22375 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, blockType.example) 22376 })); 22377 const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/heading'); 22378 if (!isHeadingBlockRegistered) { 22379 return nonHeadingBlockExamples; 22380 } 22381 22382 // Use our own example for the Heading block so that we can show multiple 22383 // heading levels. 22384 const headingsExample = { 22385 name: 'core/heading', 22386 title: (0,external_wp_i18n_namespaceObject.__)('Headings'), 22387 category: 'text', 22388 blocks: [1, 2, 3, 4, 5, 6].map(level => { 22389 return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { 22390 content: (0,external_wp_i18n_namespaceObject.sprintf)( 22391 // translators: %d: heading level e.g: "1", "2", "3" 22392 (0,external_wp_i18n_namespaceObject.__)('Heading %d'), level), 22393 level 22394 }); 22395 }) 22396 }; 22397 return [headingsExample, ...nonHeadingBlockExamples]; 22398 } 22399 function StyleBook({ 22400 enableResizing = true, 22401 isSelected, 22402 onClick, 22403 onSelect, 22404 showCloseButton = true, 22405 onClose, 22406 showTabs = true, 22407 userConfig = {} 22408 }) { 22409 const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 22410 const [textColor] = style_book_useGlobalStyle('color.text'); 22411 const [backgroundColor] = style_book_useGlobalStyle('color.background'); 22412 const [examples] = (0,external_wp_element_namespaceObject.useState)(getExamples); 22413 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 => ({ 22414 name: category.slug, 22415 title: category.title, 22416 icon: category.icon 22417 })), [examples]); 22418 const { 22419 base: baseConfig 22420 } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); 22421 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 22422 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 22423 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 22424 } 22425 return {}; 22426 }, [baseConfig, userConfig]); 22427 22428 // Copied from packages/edit-site/src/components/revisions/index.js 22429 // could we create a shared hook? 22430 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 22431 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 22432 ...originalSettings, 22433 __unstableIsPreviewMode: true 22434 }), [originalSettings]); 22435 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 22436 settings.styles = !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : settings.styles; 22437 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 22438 onClose: onClose, 22439 enableResizing: enableResizing, 22440 closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)('Close') : null, 22441 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 22442 className: dist_clsx('edit-site-style-book', { 22443 'is-wide': sizes.width > 600, 22444 'is-button': !!onClick 22445 }), 22446 style: { 22447 color: textColor, 22448 background: backgroundColor 22449 }, 22450 children: [resizeObserver, showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22451 className: "edit-site-style-book__tabs", 22452 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { 22453 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { 22454 children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.Tab, { 22455 tabId: tab.name, 22456 children: tab.title 22457 }, tab.name)) 22458 }), tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabPanel, { 22459 tabId: tab.name, 22460 focusable: false, 22461 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 22462 category: tab.name, 22463 examples: examples, 22464 isSelected: isSelected, 22465 onSelect: onSelect, 22466 settings: settings, 22467 sizes: sizes, 22468 title: tab.title 22469 }) 22470 }, tab.name))] 22471 }) 22472 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 22473 examples: examples, 22474 isSelected: isSelected, 22475 onClick: onClick, 22476 onSelect: onSelect, 22477 settings: settings, 22478 sizes: sizes 22479 })] 22480 }) 22481 }); 22482 } 22483 const StyleBookBody = ({ 22484 category, 22485 examples, 22486 isSelected, 22487 onClick, 22488 onSelect, 22489 settings, 22490 sizes, 22491 title 22492 }) => { 22493 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 22494 22495 // The presence of an `onClick` prop indicates that the Style Book is being used as a button. 22496 // In this case, add additional props to the iframe to make it behave like a button. 22497 const buttonModeProps = { 22498 role: 'button', 22499 onFocus: () => setIsFocused(true), 22500 onBlur: () => setIsFocused(false), 22501 onKeyDown: event => { 22502 if (event.defaultPrevented) { 22503 return; 22504 } 22505 const { 22506 keyCode 22507 } = event; 22508 if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) { 22509 event.preventDefault(); 22510 onClick(event); 22511 } 22512 }, 22513 onClick: event => { 22514 if (event.defaultPrevented) { 22515 return; 22516 } 22517 if (onClick) { 22518 event.preventDefault(); 22519 onClick(event); 22520 } 22521 }, 22522 readonly: true 22523 }; 22524 const buttonModeStyles = onClick ? 'body { cursor: pointer; } body * { pointer-events: none; }' : ''; 22525 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 22526 className: dist_clsx('edit-site-style-book__iframe', { 22527 'is-focused': isFocused && !!onClick, 22528 'is-button': !!onClick 22529 }), 22530 name: "style-book-canvas", 22531 tabIndex: 0, 22532 ...(onClick ? buttonModeProps : {}), 22533 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 22534 styles: settings.styles 22535 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { 22536 children: 22537 // Forming a "block formatting context" to prevent margin collapsing. 22538 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 22539 `.is-root-container { display: flow-root; } 22540 body { position: relative; padding: 32px !important; }` + STYLE_BOOK_IFRAME_STYLES + buttonModeStyles 22541 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Examples, { 22542 className: dist_clsx('edit-site-style-book__examples', { 22543 'is-wide': sizes.width > 600 22544 }), 22545 examples: examples, 22546 category: category, 22547 label: title ? (0,external_wp_i18n_namespaceObject.sprintf)( 22548 // translators: %s: Category of blocks, e.g. Text. 22549 (0,external_wp_i18n_namespaceObject.__)('Examples of blocks in the %s category'), title) : (0,external_wp_i18n_namespaceObject.__)('Examples of blocks'), 22550 isSelected: isSelected, 22551 onSelect: onSelect 22552 }, category)] 22553 }); 22554 }; 22555 const Examples = (0,external_wp_element_namespaceObject.memo)(({ 22556 className, 22557 examples, 22558 category, 22559 label, 22560 isSelected, 22561 onSelect 22562 }) => { 22563 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 22564 orientation: "vertical", 22565 className: className, 22566 "aria-label": label, 22567 role: "grid", 22568 children: examples.filter(example => category ? example.category === category : true).map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { 22569 id: `example-$example.name}`, 22570 title: example.title, 22571 blocks: example.blocks, 22572 isSelected: isSelected(example.name), 22573 onClick: () => { 22574 onSelect?.(example.name); 22575 } 22576 }, example.name)) 22577 }); 22578 }); 22579 const Example = ({ 22580 id, 22581 title, 22582 blocks, 22583 isSelected, 22584 onClick 22585 }) => { 22586 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 22587 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 22588 ...originalSettings, 22589 focusMode: false, 22590 // Disable "Spotlight mode". 22591 __unstableIsPreviewMode: true 22592 }), [originalSettings]); 22593 22594 // Cache the list of blocks to avoid additional processing when the component is re-rendered. 22595 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 22596 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22597 role: "row", 22598 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22599 role: "gridcell", 22600 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 22601 className: dist_clsx('edit-site-style-book__example', { 22602 'is-selected': isSelected 22603 }), 22604 id: id, 22605 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 22606 // translators: %s: Title of a block, e.g. Heading. 22607 (0,external_wp_i18n_namespaceObject.__)('Open %s styles in Styles panel'), title), 22608 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 22609 role: "button", 22610 onClick: onClick, 22611 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 22612 className: "edit-site-style-book__example-title", 22613 children: title 22614 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22615 className: "edit-site-style-book__example-preview", 22616 "aria-hidden": true, 22617 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 22618 className: "edit-site-style-book__example-preview__content", 22619 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { 22620 value: renderedBlocks, 22621 settings: settings, 22622 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 22623 renderAppender: false 22624 }) 22625 }) 22626 }) 22627 })] 22628 }) 22629 }) 22630 }); 22631 }; 22632 /* harmony default export */ const style_book = (StyleBook); 22633 22634 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js 22635 /** 22636 * WordPress dependencies 22637 */ 22638 22639 22640 22641 22642 /** 22643 * Internal dependencies 22644 */ 22645 22646 22647 22648 22649 22650 const { 22651 useGlobalStyle: screen_css_useGlobalStyle, 22652 AdvancedPanel: screen_css_StylesAdvancedPanel 22653 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22654 function ScreenCSS() { 22655 const description = (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.'); 22656 const [style] = screen_css_useGlobalStyle('', undefined, 'user', { 22657 shouldDecodeEncode: false 22658 }); 22659 const [inheritedStyle, setStyle] = screen_css_useGlobalStyle('', undefined, 'all', { 22660 shouldDecodeEncode: false 22661 }); 22662 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22663 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22664 title: (0,external_wp_i18n_namespaceObject.__)('CSS'), 22665 description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22666 children: [description, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 22667 href: (0,external_wp_i18n_namespaceObject.__)('https://developer.wordpress.org/advanced-administration/wordpress/css/'), 22668 className: "edit-site-global-styles-screen-css-help-link", 22669 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about CSS') 22670 })] 22671 }) 22672 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 22673 className: "edit-site-global-styles-screen-css", 22674 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_StylesAdvancedPanel, { 22675 value: style, 22676 onChange: setStyle, 22677 inheritedValue: inheritedStyle 22678 }) 22679 })] 22680 }); 22681 } 22682 /* harmony default export */ const screen_css = (ScreenCSS); 22683 22684 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js 22685 /** 22686 * WordPress dependencies 22687 */ 22688 22689 22690 22691 22692 22693 22694 22695 /** 22696 * Internal dependencies 22697 */ 22698 22699 22700 22701 22702 22703 const { 22704 ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider, 22705 GlobalStylesContext: revisions_GlobalStylesContext, 22706 useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig, 22707 __unstableBlockStyleVariationOverridesWithConfig 22708 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22709 const { 22710 mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs 22711 } = unlock(external_wp_editor_namespaceObject.privateApis); 22712 function revisions_isObjectEmpty(object) { 22713 return !object || Object.keys(object).length === 0; 22714 } 22715 function Revisions({ 22716 userConfig, 22717 blocks 22718 }) { 22719 const { 22720 base: baseConfig 22721 } = (0,external_wp_element_namespaceObject.useContext)(revisions_GlobalStylesContext); 22722 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 22723 if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) { 22724 return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig); 22725 } 22726 return {}; 22727 }, [baseConfig, userConfig]); 22728 const renderedBlocksArray = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 22729 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 22730 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 22731 ...originalSettings, 22732 __unstableIsPreviewMode: true 22733 }), [originalSettings]); 22734 const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig); 22735 const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles; 22736 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 22737 title: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 22738 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions'), 22739 enableResizing: true, 22740 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 22741 className: "edit-site-revisions__iframe", 22742 name: "revisions", 22743 tabIndex: 0, 22744 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { 22745 children: 22746 // Forming a "block formatting context" to prevent margin collapsing. 22747 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 22748 `.is-root-container { display: flow-root; }` 22749 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 22750 className: "edit-site-revisions__example-preview__content", 22751 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(revisions_ExperimentalBlockEditorProvider, { 22752 value: renderedBlocksArray, 22753 settings: settings, 22754 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 22755 renderAppender: false 22756 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 22757 styles: editorStyles 22758 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(__unstableBlockStyleVariationOverridesWithConfig, { 22759 config: mergedConfig 22760 })] 22761 }) 22762 })] 22763 }) 22764 }); 22765 } 22766 /* harmony default export */ const components_revisions = (Revisions); 22767 22768 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js 22769 /** 22770 * WordPress dependencies 22771 */ 22772 22773 22774 22775 22776 22777 /** 22778 * Internal dependencies 22779 */ 22780 22781 const SITE_EDITOR_AUTHORS_QUERY = { 22782 per_page: -1, 22783 _fields: 'id,name,avatar_urls', 22784 context: 'view', 22785 capabilities: ['edit_theme_options'] 22786 }; 22787 const DEFAULT_QUERY = { 22788 per_page: 100, 22789 page: 1 22790 }; 22791 const use_global_styles_revisions_EMPTY_ARRAY = []; 22792 const { 22793 GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext 22794 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22795 function useGlobalStylesRevisions({ 22796 query 22797 } = {}) { 22798 const { 22799 user: userConfig 22800 } = (0,external_wp_element_namespaceObject.useContext)(use_global_styles_revisions_GlobalStylesContext); 22801 const _query = { 22802 ...DEFAULT_QUERY, 22803 ...query 22804 }; 22805 const { 22806 authors, 22807 currentUser, 22808 isDirty, 22809 revisions, 22810 isLoadingGlobalStylesRevisions, 22811 revisionsCount 22812 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22813 var _globalStyles$_links$; 22814 const { 22815 __experimentalGetDirtyEntityRecords, 22816 getCurrentUser, 22817 getUsers, 22818 getRevisions, 22819 __experimentalGetCurrentGlobalStylesId, 22820 getEntityRecord, 22821 isResolving 22822 } = select(external_wp_coreData_namespaceObject.store); 22823 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 22824 const _currentUser = getCurrentUser(); 22825 const _isDirty = dirtyEntityRecords.length > 0; 22826 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 22827 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 22828 const _revisionsCount = (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0; 22829 const globalStylesRevisions = getRevisions('root', 'globalStyles', globalStylesId, _query) || use_global_styles_revisions_EMPTY_ARRAY; 22830 const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY; 22831 const _isResolving = isResolving('getRevisions', ['root', 'globalStyles', globalStylesId, _query]); 22832 return { 22833 authors: _authors, 22834 currentUser: _currentUser, 22835 isDirty: _isDirty, 22836 revisions: globalStylesRevisions, 22837 isLoadingGlobalStylesRevisions: _isResolving, 22838 revisionsCount: _revisionsCount 22839 }; 22840 }, [query]); 22841 return (0,external_wp_element_namespaceObject.useMemo)(() => { 22842 if (!authors.length || isLoadingGlobalStylesRevisions) { 22843 return { 22844 revisions: use_global_styles_revisions_EMPTY_ARRAY, 22845 hasUnsavedChanges: isDirty, 22846 isLoading: true, 22847 revisionsCount 22848 }; 22849 } 22850 22851 // Adds author details to each revision. 22852 const _modifiedRevisions = revisions.map(revision => { 22853 return { 22854 ...revision, 22855 author: authors.find(author => author.id === revision.author) 22856 }; 22857 }); 22858 const fetchedRevisionsCount = revisions.length; 22859 if (fetchedRevisionsCount) { 22860 // Flags the most current saved revision. 22861 if (_modifiedRevisions[0].id !== 'unsaved' && _query.page === 1) { 22862 _modifiedRevisions[0].isLatest = true; 22863 } 22864 22865 // Adds an item for unsaved changes. 22866 if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { 22867 const unsavedRevision = { 22868 id: 'unsaved', 22869 styles: userConfig?.styles, 22870 settings: userConfig?.settings, 22871 _links: userConfig?._links, 22872 author: { 22873 name: currentUser?.name, 22874 avatar_urls: currentUser?.avatar_urls 22875 }, 22876 modified: new Date() 22877 }; 22878 _modifiedRevisions.unshift(unsavedRevision); 22879 } 22880 if (_query.page === Math.ceil(revisionsCount / _query.per_page)) { 22881 // Adds an item for the default theme styles. 22882 _modifiedRevisions.push({ 22883 id: 'parent', 22884 styles: {}, 22885 settings: {} 22886 }); 22887 } 22888 } 22889 return { 22890 revisions: _modifiedRevisions, 22891 hasUnsavedChanges: isDirty, 22892 isLoading: false, 22893 revisionsCount 22894 }; 22895 }, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]); 22896 } 22897 22898 ;// CONCATENATED MODULE: external ["wp","date"] 22899 const external_wp_date_namespaceObject = window["wp"]["date"]; 22900 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js 22901 /** 22902 * External dependencies 22903 */ 22904 22905 22906 /** 22907 * WordPress dependencies 22908 */ 22909 22910 22911 22912 22913 22914 22915 22916 /** 22917 * Internal dependencies 22918 */ 22919 22920 22921 22922 const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24; 22923 const { 22924 getGlobalStylesChanges 22925 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22926 function ChangesSummary({ 22927 revision, 22928 previousRevision 22929 }) { 22930 const changes = getGlobalStylesChanges(revision, previousRevision, { 22931 maxResults: 7 22932 }); 22933 if (!changes.length) { 22934 return null; 22935 } 22936 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 22937 "data-testid": "global-styles-revision-changes", 22938 className: "edit-site-global-styles-screen-revisions__changes", 22939 children: changes.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 22940 children: change 22941 }, change)) 22942 }); 22943 } 22944 22945 /** 22946 * Returns a button label for the revision. 22947 * 22948 * @param {string|number} id A revision object. 22949 * @param {string} authorDisplayName Author name. 22950 * @param {string} formattedModifiedDate Revision modified date formatted. 22951 * @param {boolean} areStylesEqual Whether the revision matches the current editor styles. 22952 * @return {string} Translated label. 22953 */ 22954 function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) { 22955 if ('parent' === id) { 22956 return (0,external_wp_i18n_namespaceObject.__)('Reset the styles to the theme defaults'); 22957 } 22958 if ('unsaved' === id) { 22959 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: author display name */ 22960 (0,external_wp_i18n_namespaceObject.__)('Unsaved changes by %s'), authorDisplayName); 22961 } 22962 return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)( 22963 // translators: 1: author display name. 2: revision creation date. 22964 (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)( 22965 // translators: 1: author display name. 2: revision creation date. 22966 (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s'), authorDisplayName, formattedModifiedDate); 22967 } 22968 22969 /** 22970 * Returns a rendered list of revisions buttons. 22971 * 22972 * @typedef {Object} props 22973 * @property {Array<Object>} userRevisions A collection of user revisions. 22974 * @property {number} selectedRevisionId The id of the currently-selected revision. 22975 * @property {Function} onChange Callback fired when a revision is selected. 22976 * 22977 * @param {props} Component props. 22978 * @return {JSX.Element} The modal component. 22979 */ 22980 function RevisionsButtons({ 22981 userRevisions, 22982 selectedRevisionId, 22983 onChange, 22984 canApplyRevision, 22985 onApplyRevision 22986 }) { 22987 const { 22988 currentThemeName, 22989 currentUser 22990 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22991 const { 22992 getCurrentTheme, 22993 getCurrentUser 22994 } = select(external_wp_coreData_namespaceObject.store); 22995 const currentTheme = getCurrentTheme(); 22996 return { 22997 currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet, 22998 currentUser: getCurrentUser() 22999 }; 23000 }, []); 23001 const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime(); 23002 const { 23003 datetimeAbbreviated 23004 } = (0,external_wp_date_namespaceObject.getSettings)().formats; 23005 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ol", { 23006 className: "edit-site-global-styles-screen-revisions__revisions-list", 23007 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Global styles revisions list'), 23008 role: "group", 23009 children: userRevisions.map((revision, index) => { 23010 const { 23011 id, 23012 author, 23013 modified 23014 } = revision; 23015 const isUnsaved = 'unsaved' === id; 23016 // Unsaved changes are created by the current user. 23017 const revisionAuthor = isUnsaved ? currentUser : author; 23018 const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)('User'); 23019 const authorAvatar = revisionAuthor?.avatar_urls?.['48']; 23020 const isFirstItem = index === 0; 23021 const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem; 23022 const areStylesEqual = !canApplyRevision && isSelected; 23023 const isReset = 'parent' === id; 23024 const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified); 23025 const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified); 23026 const revisionLabel = getRevisionLabel(id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual); 23027 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 23028 className: dist_clsx('edit-site-global-styles-screen-revisions__revision-item', { 23029 'is-selected': isSelected, 23030 'is-active': areStylesEqual, 23031 'is-reset': isReset 23032 }), 23033 "aria-current": isSelected, 23034 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23035 __next40pxDefaultSize: true, 23036 className: "edit-site-global-styles-screen-revisions__revision-button", 23037 accessibleWhenDisabled: true, 23038 disabled: isSelected, 23039 onClick: () => { 23040 onChange(revision); 23041 }, 23042 "aria-label": revisionLabel, 23043 children: isReset ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23044 className: "edit-site-global-styles-screen-revisions__description", 23045 children: [(0,external_wp_i18n_namespaceObject.__)('Default styles'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23046 className: "edit-site-global-styles-screen-revisions__meta", 23047 children: currentThemeName 23048 })] 23049 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23050 className: "edit-site-global-styles-screen-revisions__description", 23051 children: [isUnsaved ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23052 className: "edit-site-global-styles-screen-revisions__date", 23053 children: (0,external_wp_i18n_namespaceObject.__)('(Unsaved)') 23054 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 23055 className: "edit-site-global-styles-screen-revisions__date", 23056 dateTime: modified, 23057 children: displayDate 23058 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23059 className: "edit-site-global-styles-screen-revisions__meta", 23060 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 23061 alt: authorDisplayName, 23062 src: authorAvatar 23063 }), authorDisplayName] 23064 }), isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangesSummary, { 23065 revision: revision, 23066 previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {} 23067 })] 23068 }) 23069 }), isSelected && (areStylesEqual ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 23070 className: "edit-site-global-styles-screen-revisions__applied-text", 23071 children: (0,external_wp_i18n_namespaceObject.__)('These styles are already applied to your site.') 23072 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23073 size: "compact", 23074 variant: "primary", 23075 className: "edit-site-global-styles-screen-revisions__apply-button", 23076 onClick: onApplyRevision, 23077 children: isReset ? (0,external_wp_i18n_namespaceObject.__)('Reset to defaults') : (0,external_wp_i18n_namespaceObject.__)('Apply') 23078 }))] 23079 }, id); 23080 }) 23081 }); 23082 } 23083 /* harmony default export */ const revisions_buttons = (RevisionsButtons); 23084 23085 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js 23086 /** 23087 * WordPress dependencies 23088 */ 23089 23090 23091 const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 23092 xmlns: "http://www.w3.org/2000/svg", 23093 viewBox: "0 0 24 24", 23094 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 23095 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" 23096 }) 23097 }); 23098 /* harmony default export */ const library_next = (next); 23099 23100 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js 23101 /** 23102 * WordPress dependencies 23103 */ 23104 23105 23106 const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 23107 xmlns: "http://www.w3.org/2000/svg", 23108 viewBox: "0 0 24 24", 23109 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 23110 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" 23111 }) 23112 }); 23113 /* harmony default export */ const library_previous = (previous); 23114 23115 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js 23116 /** 23117 * External dependencies 23118 */ 23119 23120 23121 /** 23122 * WordPress dependencies 23123 */ 23124 23125 23126 23127 23128 23129 function Pagination({ 23130 currentPage, 23131 numPages, 23132 changePage, 23133 totalItems, 23134 className, 23135 disabled = false, 23136 buttonVariant = 'tertiary', 23137 label = (0,external_wp_i18n_namespaceObject.__)('Pagination Navigation') 23138 }) { 23139 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 23140 expanded: false, 23141 as: "nav", 23142 "aria-label": label, 23143 spacing: 3, 23144 justify: "flex-start", 23145 className: dist_clsx('edit-site-pagination', className), 23146 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 23147 variant: "muted", 23148 className: "edit-site-pagination__total", 23149 children: 23150 // translators: %s: Total number of patterns. 23151 (0,external_wp_i18n_namespaceObject.sprintf)( 23152 // translators: %s: Total number of patterns. 23153 (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems) 23154 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 23155 expanded: false, 23156 spacing: 1, 23157 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23158 variant: buttonVariant, 23159 onClick: () => changePage(1), 23160 accessibleWhenDisabled: true, 23161 disabled: disabled || currentPage === 1, 23162 label: (0,external_wp_i18n_namespaceObject.__)('First page'), 23163 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 23164 size: "compact" 23165 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23166 variant: buttonVariant, 23167 onClick: () => changePage(currentPage - 1), 23168 accessibleWhenDisabled: true, 23169 disabled: disabled || currentPage === 1, 23170 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 23171 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 23172 size: "compact" 23173 })] 23174 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 23175 variant: "muted", 23176 children: (0,external_wp_i18n_namespaceObject.sprintf)( 23177 // translators: 1: Current page number. 2: Total number of pages. 23178 (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages) 23179 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 23180 expanded: false, 23181 spacing: 1, 23182 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23183 variant: buttonVariant, 23184 onClick: () => changePage(currentPage + 1), 23185 accessibleWhenDisabled: true, 23186 disabled: disabled || currentPage === numPages, 23187 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 23188 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, 23189 size: "compact" 23190 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23191 variant: buttonVariant, 23192 onClick: () => changePage(numPages), 23193 accessibleWhenDisabled: true, 23194 disabled: disabled || currentPage === numPages, 23195 label: (0,external_wp_i18n_namespaceObject.__)('Last page'), 23196 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 23197 size: "compact" 23198 })] 23199 })] 23200 }); 23201 } 23202 23203 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js 23204 /** 23205 * WordPress dependencies 23206 */ 23207 23208 23209 23210 23211 23212 23213 /** 23214 * Internal dependencies 23215 */ 23216 23217 23218 23219 23220 23221 23222 23223 23224 23225 23226 23227 const { 23228 GlobalStylesContext: screen_revisions_GlobalStylesContext, 23229 areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual 23230 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23231 const PAGE_SIZE = 10; 23232 function ScreenRevisions() { 23233 const { 23234 goTo 23235 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23236 const { 23237 user: currentEditorGlobalStyles, 23238 setUserConfig 23239 } = (0,external_wp_element_namespaceObject.useContext)(screen_revisions_GlobalStylesContext); 23240 const { 23241 blocks, 23242 editorCanvasContainerView 23243 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 23244 editorCanvasContainerView: unlock(select(store)).getEditorCanvasContainerView(), 23245 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() 23246 }), []); 23247 const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); 23248 const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_namespaceObject.useState)([]); 23249 const { 23250 revisions, 23251 isLoading, 23252 hasUnsavedChanges, 23253 revisionsCount 23254 } = useGlobalStylesRevisions({ 23255 query: { 23256 per_page: PAGE_SIZE, 23257 page: currentPage 23258 } 23259 }); 23260 const numPages = Math.ceil(revisionsCount / PAGE_SIZE); 23261 const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_namespaceObject.useState)(currentEditorGlobalStyles); 23262 const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = (0,external_wp_element_namespaceObject.useState)(false); 23263 const { 23264 setEditorCanvasContainerView 23265 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 23266 const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(currentlySelectedRevision, currentEditorGlobalStyles); 23267 const onCloseRevisions = () => { 23268 goTo('/'); // Return to global styles main panel. 23269 const canvasContainerView = editorCanvasContainerView === 'global-styles-revisions:style-book' ? 'style-book' : undefined; 23270 setEditorCanvasContainerView(canvasContainerView); 23271 }; 23272 const restoreRevision = revision => { 23273 setUserConfig(() => revision); 23274 setIsLoadingRevisionWithUnsavedChanges(false); 23275 onCloseRevisions(); 23276 }; 23277 (0,external_wp_element_namespaceObject.useEffect)(() => { 23278 if (!editorCanvasContainerView || !editorCanvasContainerView.startsWith('global-styles-revisions')) { 23279 goTo('/'); // Return to global styles main panel. 23280 } 23281 }, [editorCanvasContainerView]); 23282 (0,external_wp_element_namespaceObject.useEffect)(() => { 23283 if (!isLoading && revisions.length) { 23284 setCurrentRevisions(revisions); 23285 } 23286 }, [revisions, isLoading]); 23287 const firstRevision = revisions[0]; 23288 const currentlySelectedRevisionId = currentlySelectedRevision?.id; 23289 const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId; 23290 (0,external_wp_element_namespaceObject.useEffect)(() => { 23291 /* 23292 * Ensure that the first item is selected and loaded into the preview pane 23293 * when no revision is selected and the selected styles don't match the current editor styles. 23294 * This is required in case editor styles are changed outside the revisions panel, 23295 * e.g., via the reset styles function of useGlobalStylesReset(). 23296 * See: https://github.com/WordPress/gutenberg/issues/55866 23297 */ 23298 if (shouldSelectFirstItem) { 23299 setCurrentlySelectedRevision(firstRevision); 23300 } 23301 }, [shouldSelectFirstItem, firstRevision]); 23302 23303 // Only display load button if there is a revision to load, 23304 // and it is different from the current editor styles. 23305 const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== 'unsaved' && !selectedRevisionMatchesEditorStyles; 23306 const hasRevisions = !!currentRevisions.length; 23307 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23308 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 23309 title: revisionsCount && 23310 // translators: %s: number of revisions. 23311 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount), 23312 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.'), 23313 onBack: onCloseRevisions 23314 }), !hasRevisions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 23315 className: "edit-site-global-styles-screen-revisions__loading" 23316 }), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 23317 userConfig: currentlySelectedRevision, 23318 isSelected: () => {}, 23319 onClose: () => { 23320 setEditorCanvasContainerView('global-styles-revisions'); 23321 } 23322 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_revisions, { 23323 blocks: blocks, 23324 userConfig: currentlySelectedRevision, 23325 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions') 23326 })), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(revisions_buttons, { 23327 onChange: setCurrentlySelectedRevision, 23328 selectedRevisionId: currentlySelectedRevisionId, 23329 userRevisions: currentRevisions, 23330 canApplyRevision: isLoadButtonEnabled, 23331 onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision) 23332 }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23333 className: "edit-site-global-styles-screen-revisions__footer", 23334 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { 23335 className: "edit-site-global-styles-screen-revisions__pagination", 23336 currentPage: currentPage, 23337 numPages: numPages, 23338 changePage: setCurrentPage, 23339 totalItems: revisionsCount, 23340 disabled: isLoading, 23341 label: (0,external_wp_i18n_namespaceObject.__)('Global Styles pagination navigation') 23342 }) 23343 }), isLoadingRevisionWithUnsavedChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 23344 isOpen: isLoadingRevisionWithUnsavedChanges, 23345 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Apply'), 23346 onConfirm: () => restoreRevision(currentlySelectedRevision), 23347 onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false), 23348 size: "medium", 23349 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to apply this revision? Any unsaved changes will be lost.') 23350 })] 23351 }); 23352 } 23353 /* harmony default export */ const screen_revisions = (ScreenRevisions); 23354 23355 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js 23356 /** 23357 * WordPress dependencies 23358 */ 23359 23360 23361 23362 23363 23364 23365 23366 23367 23368 23369 /** 23370 * Internal dependencies 23371 */ 23372 23373 23374 23375 23376 23377 23378 23379 23380 23381 23382 23383 23384 23385 23386 23387 23388 23389 23390 23391 23392 23393 const SLOT_FILL_NAME = 'GlobalStylesMenu'; 23394 const { 23395 useGlobalStylesReset: ui_useGlobalStylesReset 23396 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23397 const { 23398 Slot: GlobalStylesMenuSlot, 23399 Fill: GlobalStylesMenuFill 23400 } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME); 23401 function GlobalStylesActionMenu() { 23402 const [canReset, onReset] = ui_useGlobalStylesReset(); 23403 const { 23404 toggle 23405 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 23406 const { 23407 canEditCSS 23408 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23409 const { 23410 getEntityRecord, 23411 __experimentalGetCurrentGlobalStylesId 23412 } = select(external_wp_coreData_namespaceObject.store); 23413 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 23414 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 23415 return { 23416 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 23417 }; 23418 }, []); 23419 const { 23420 setEditorCanvasContainerView 23421 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 23422 const { 23423 goTo 23424 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23425 const loadCustomCSS = () => { 23426 setEditorCanvasContainerView('global-styles-css'); 23427 goTo('/css'); 23428 }; 23429 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { 23430 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 23431 icon: more_vertical, 23432 label: (0,external_wp_i18n_namespaceObject.__)('More'), 23433 toggleProps: { 23434 size: 'compact' 23435 }, 23436 children: ({ 23437 onClose 23438 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23439 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 23440 children: [canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23441 onClick: loadCustomCSS, 23442 children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') 23443 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23444 onClick: () => { 23445 toggle('core/edit-site', 'welcomeGuideStyles'); 23446 onClose(); 23447 }, 23448 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 23449 })] 23450 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 23451 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23452 onClick: () => { 23453 onReset(); 23454 onClose(); 23455 }, 23456 disabled: !canReset, 23457 children: (0,external_wp_i18n_namespaceObject.__)('Reset styles') 23458 }) 23459 })] 23460 }) 23461 }) 23462 }); 23463 } 23464 function GlobalStylesNavigationScreen({ 23465 className, 23466 ...props 23467 }) { 23468 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 23469 className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' '), 23470 ...props 23471 }); 23472 } 23473 function BlockStylesNavigationScreens({ 23474 parentMenu, 23475 blockStyles, 23476 blockName 23477 }) { 23478 return blockStyles.map((style, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23479 path: parentMenu + '/variations/' + style.name, 23480 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 23481 name: blockName, 23482 variation: style.name 23483 }) 23484 }, index)); 23485 } 23486 function ContextScreens({ 23487 name, 23488 parentMenu = '' 23489 }) { 23490 const blockStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => { 23491 const { 23492 getBlockStyles 23493 } = select(external_wp_blocks_namespaceObject.store); 23494 return getBlockStyles(name); 23495 }, [name]); 23496 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23497 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23498 path: parentMenu + '/colors/palette', 23499 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette, { 23500 name: name 23501 }) 23502 }), !!blockStyleVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesNavigationScreens, { 23503 parentMenu: parentMenu, 23504 blockStyles: blockStyleVariations, 23505 blockName: name 23506 })] 23507 }); 23508 } 23509 function GlobalStylesStyleBook() { 23510 const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23511 const { 23512 path 23513 } = navigator.location; 23514 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 23515 isSelected: blockName => 23516 // Match '/blocks/core%2Fbutton' and 23517 // '/blocks/core%2Fbutton/typography', but not 23518 // '/blocks/core%2Fbuttons'. 23519 path === `/blocks/$encodeURIComponent(blockName)}` || path.startsWith(`/blocks/$encodeURIComponent(blockName)}/`), 23520 onSelect: blockName => { 23521 // Now go to the selected block. 23522 navigator.goTo('/blocks/' + encodeURIComponent(blockName)); 23523 } 23524 }); 23525 } 23526 function GlobalStylesBlockLink() { 23527 const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23528 const { 23529 selectedBlockName, 23530 selectedBlockClientId 23531 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23532 const { 23533 getSelectedBlockClientId, 23534 getBlockName 23535 } = select(external_wp_blockEditor_namespaceObject.store); 23536 const clientId = getSelectedBlockClientId(); 23537 return { 23538 selectedBlockName: getBlockName(clientId), 23539 selectedBlockClientId: clientId 23540 }; 23541 }, []); 23542 const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName); 23543 // When we're in the `Blocks` screen enable deep linking to the selected block. 23544 (0,external_wp_element_namespaceObject.useEffect)(() => { 23545 if (!selectedBlockClientId || !blockHasGlobalStyles) { 23546 return; 23547 } 23548 const currentPath = navigator.location.path; 23549 if (currentPath !== '/blocks' && !currentPath.startsWith('/blocks/')) { 23550 return; 23551 } 23552 const newPath = '/blocks/' + encodeURIComponent(selectedBlockName); 23553 // Avoid navigating to the same path. This can happen when selecting 23554 // a new block of the same type. 23555 if (newPath !== currentPath) { 23556 navigator.goTo(newPath, { 23557 skipFocus: true 23558 }); 23559 } 23560 }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]); 23561 } 23562 function GlobalStylesEditorCanvasContainerLink() { 23563 const { 23564 goTo, 23565 location 23566 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23567 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 23568 const path = location?.path; 23569 const isRevisionsOpen = path === '/revisions'; 23570 23571 // If the user switches the editor canvas container view, redirect 23572 // to the appropriate screen. This effectively allows deep linking to the 23573 // desired screens from outside the global styles navigation provider. 23574 (0,external_wp_element_namespaceObject.useEffect)(() => { 23575 switch (editorCanvasContainerView) { 23576 case 'global-styles-revisions': 23577 case 'global-styles-revisions:style-book': 23578 goTo('/revisions'); 23579 break; 23580 case 'global-styles-css': 23581 goTo('/css'); 23582 break; 23583 case 'style-book': 23584 /* 23585 * The stand-alone style book is open 23586 * and the revisions panel is open, 23587 * close the revisions panel. 23588 * Otherwise keep the style book open while 23589 * browsing global styles panel. 23590 */ 23591 if (isRevisionsOpen) { 23592 goTo('/'); 23593 } 23594 break; 23595 } 23596 }, [editorCanvasContainerView, isRevisionsOpen, goTo]); 23597 } 23598 function GlobalStylesUI() { 23599 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); 23600 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 23601 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { 23602 className: "edit-site-global-styles-sidebar__navigator-provider", 23603 initialPath: "/", 23604 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23605 path: "/", 23606 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root, {}) 23607 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23608 path: "/variations", 23609 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations, {}) 23610 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23611 path: "/blocks", 23612 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list, {}) 23613 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23614 path: "/typography", 23615 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography, {}) 23616 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23617 path: "/typography/font-sizes/", 23618 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes, {}) 23619 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23620 path: "/typography/font-sizes/:origin/:slug", 23621 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size, {}) 23622 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23623 path: "/typography/text", 23624 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23625 element: "text" 23626 }) 23627 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23628 path: "/typography/link", 23629 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23630 element: "link" 23631 }) 23632 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23633 path: "/typography/heading", 23634 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23635 element: "heading" 23636 }) 23637 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23638 path: "/typography/caption", 23639 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23640 element: "caption" 23641 }) 23642 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23643 path: "/typography/button", 23644 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 23645 element: "button" 23646 }) 23647 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23648 path: "/colors", 23649 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors, {}) 23650 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23651 path: "/shadows", 23652 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) 23653 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23654 path: "/shadows/edit/:category/:slug", 23655 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) 23656 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23657 path: "/layout", 23658 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout, {}) 23659 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23660 path: "/css", 23661 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css, {}) 23662 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23663 path: "/revisions", 23664 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions, {}) 23665 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23666 path: "/background", 23667 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background, {}) 23668 }), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 23669 path: '/blocks/' + encodeURIComponent(block.name), 23670 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 23671 name: block.name 23672 }) 23673 }, 'menu-block-' + block.name)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, { 23674 name: block.name, 23675 parentMenu: '/blocks/' + encodeURIComponent(block.name) 23676 }, '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, {})] 23677 }); 23678 } 23679 23680 /* harmony default export */ const global_styles_ui = (GlobalStylesUI); 23681 23682 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js 23683 23684 23685 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js 23686 /** 23687 * WordPress dependencies 23688 */ 23689 23690 23691 /** 23692 * Internal dependencies 23693 */ 23694 23695 23696 23697 23698 const { 23699 ComplementaryArea, 23700 ComplementaryAreaMoreMenuItem 23701 } = unlock(external_wp_editor_namespaceObject.privateApis); 23702 function DefaultSidebar({ 23703 className, 23704 identifier, 23705 title, 23706 icon, 23707 children, 23708 closeLabel, 23709 header, 23710 headerClassName, 23711 panelClassName, 23712 isActiveByDefault 23713 }) { 23714 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23715 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryArea, { 23716 className: className, 23717 scope: "core", 23718 identifier: identifier, 23719 title: title, 23720 smallScreenTitle: title, 23721 icon: icon, 23722 closeLabel: closeLabel, 23723 header: header, 23724 headerClassName: headerClassName, 23725 panelClassName: panelClassName, 23726 isActiveByDefault: isActiveByDefault, 23727 children: children 23728 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { 23729 scope: "core", 23730 identifier: identifier, 23731 icon: icon, 23732 children: title 23733 })] 23734 }); 23735 } 23736 23737 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js 23738 /** 23739 * WordPress dependencies 23740 */ 23741 23742 23743 23744 23745 23746 23747 23748 23749 /** 23750 * Internal dependencies 23751 */ 23752 23753 23754 23755 23756 23757 23758 23759 23760 const { 23761 interfaceStore: global_styles_sidebar_interfaceStore 23762 } = unlock(external_wp_editor_namespaceObject.privateApis); 23763 function GlobalStylesSidebar() { 23764 const { 23765 shouldClearCanvasContainerView, 23766 isStyleBookOpened, 23767 showListViewByDefault, 23768 hasRevisions, 23769 isRevisionsOpened, 23770 isRevisionsStyleBookOpened 23771 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23772 const { 23773 getActiveComplementaryArea 23774 } = select(global_styles_sidebar_interfaceStore); 23775 const { 23776 getEditorCanvasContainerView, 23777 getCanvasMode 23778 } = unlock(select(store)); 23779 const canvasContainerView = getEditorCanvasContainerView(); 23780 const _isVisualEditorMode = 'visual' === select(external_wp_editor_namespaceObject.store).getEditorMode(); 23781 const _isEditCanvasMode = 'edit' === getCanvasMode(); 23782 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 23783 const { 23784 getEntityRecord, 23785 __experimentalGetCurrentGlobalStylesId 23786 } = select(external_wp_coreData_namespaceObject.store); 23787 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 23788 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 23789 return { 23790 isStyleBookOpened: 'style-book' === canvasContainerView, 23791 shouldClearCanvasContainerView: 'edit-site/global-styles' !== getActiveComplementaryArea('core') || !_isVisualEditorMode || !_isEditCanvasMode, 23792 showListViewByDefault: _showListViewByDefault, 23793 hasRevisions: !!globalStyles?._links?.['version-history']?.[0]?.count, 23794 isRevisionsStyleBookOpened: 'global-styles-revisions:style-book' === canvasContainerView, 23795 isRevisionsOpened: 'global-styles-revisions' === canvasContainerView 23796 }; 23797 }, []); 23798 const { 23799 setEditorCanvasContainerView 23800 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 23801 (0,external_wp_element_namespaceObject.useEffect)(() => { 23802 if (shouldClearCanvasContainerView) { 23803 setEditorCanvasContainerView(undefined); 23804 } 23805 }, [shouldClearCanvasContainerView]); 23806 const { 23807 setIsListViewOpened 23808 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 23809 const { 23810 goTo 23811 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); 23812 const toggleRevisions = () => { 23813 setIsListViewOpened(false); 23814 if (isRevisionsStyleBookOpened) { 23815 goTo('/'); 23816 setEditorCanvasContainerView('style-book'); 23817 return; 23818 } 23819 if (isRevisionsOpened) { 23820 goTo('/'); 23821 setEditorCanvasContainerView(undefined); 23822 return; 23823 } 23824 goTo('/revisions'); 23825 if (isStyleBookOpened) { 23826 setEditorCanvasContainerView('global-styles-revisions:style-book'); 23827 } else { 23828 setEditorCanvasContainerView('global-styles-revisions'); 23829 } 23830 }; 23831 const toggleStyleBook = () => { 23832 if (isRevisionsOpened) { 23833 setEditorCanvasContainerView('global-styles-revisions:style-book'); 23834 return; 23835 } 23836 if (isRevisionsStyleBookOpened) { 23837 setEditorCanvasContainerView('global-styles-revisions'); 23838 return; 23839 } 23840 setIsListViewOpened(isStyleBookOpened && showListViewByDefault); 23841 setEditorCanvasContainerView(isStyleBookOpened ? undefined : 'style-book'); 23842 }; 23843 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultSidebar, { 23844 className: "edit-site-global-styles-sidebar", 23845 identifier: "edit-site/global-styles", 23846 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 23847 icon: library_styles, 23848 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Styles'), 23849 panelClassName: "edit-site-global-styles-sidebar__panel", 23850 header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 23851 className: "edit-site-global-styles-sidebar__header", 23852 gap: 1, 23853 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 23854 style: { 23855 minWidth: 'min-content' 23856 }, 23857 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 23858 className: "edit-site-global-styles-sidebar__header-title", 23859 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 23860 }) 23861 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 23862 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23863 icon: library_seen, 23864 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 23865 isPressed: isStyleBookOpened || isRevisionsStyleBookOpened, 23866 accessibleWhenDisabled: true, 23867 disabled: shouldClearCanvasContainerView, 23868 onClick: toggleStyleBook, 23869 size: "compact" 23870 }) 23871 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 23872 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23873 label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 23874 icon: library_backup, 23875 onClick: toggleRevisions, 23876 accessibleWhenDisabled: true, 23877 disabled: !hasRevisions, 23878 isPressed: isRevisionsOpened || isRevisionsStyleBookOpened, 23879 size: "compact" 23880 }) 23881 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})] 23882 }), 23883 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, {}) 23884 }); 23885 } 23886 23887 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js 23888 /** 23889 * WordPress dependencies 23890 */ 23891 23892 23893 const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 23894 xmlns: "http://www.w3.org/2000/svg", 23895 viewBox: "0 0 24 24", 23896 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 23897 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" 23898 }) 23899 }); 23900 /* harmony default export */ const library_download = (download); 23901 23902 ;// CONCATENATED MODULE: external ["wp","blob"] 23903 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 23904 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js 23905 /** 23906 * WordPress dependencies 23907 */ 23908 23909 23910 23911 23912 23913 23914 23915 23916 function SiteExport() { 23917 const { 23918 createErrorNotice 23919 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 23920 async function handleExport() { 23921 try { 23922 const response = await external_wp_apiFetch_default()({ 23923 path: '/wp-block-editor/v1/export', 23924 parse: false, 23925 headers: { 23926 Accept: 'application/zip' 23927 } 23928 }); 23929 const blob = await response.blob(); 23930 const contentDisposition = response.headers.get('content-disposition'); 23931 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); 23932 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export'; 23933 (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + '.zip', blob, 'application/zip'); 23934 } catch (errorResponse) { 23935 let error = {}; 23936 try { 23937 error = await errorResponse.json(); 23938 } catch (e) {} 23939 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); 23940 createErrorNotice(errorMessage, { 23941 type: 'snackbar' 23942 }); 23943 } 23944 } 23945 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23946 role: "menuitem", 23947 icon: library_download, 23948 onClick: handleExport, 23949 info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.'), 23950 children: (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item') 23951 }); 23952 } 23953 23954 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js 23955 /** 23956 * WordPress dependencies 23957 */ 23958 23959 23960 23961 23962 23963 function WelcomeGuideMenuItem() { 23964 const { 23965 toggle 23966 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 23967 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 23968 onClick: () => toggle('core/edit-site', 'welcomeGuide'), 23969 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 23970 }); 23971 } 23972 23973 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js 23974 /** 23975 * WordPress dependencies 23976 */ 23977 23978 23979 23980 23981 /** 23982 * Internal dependencies 23983 */ 23984 23985 23986 23987 23988 23989 23990 const { 23991 ToolsMoreMenuGroup, 23992 PreferencesModal 23993 } = unlock(external_wp_editor_namespaceObject.privateApis); 23994 function MoreMenu() { 23995 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 23996 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 23997 }, []); 23998 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23999 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { 24000 children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})] 24001 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})] 24002 }); 24003 } 24004 24005 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js 24006 /** 24007 * External dependencies 24008 */ 24009 24010 24011 /** 24012 * WordPress dependencies 24013 */ 24014 24015 24016 24017 24018 24019 24020 /** 24021 * Internal dependencies 24022 */ 24023 24024 24025 function useEditorIframeProps() { 24026 const { 24027 canvasMode, 24028 currentPostIsTrashed 24029 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24030 const { 24031 getCanvasMode 24032 } = unlock(select(store)); 24033 return { 24034 canvasMode: getCanvasMode(), 24035 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash' 24036 }; 24037 }, []); 24038 const { 24039 setCanvasMode 24040 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24041 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 24042 (0,external_wp_element_namespaceObject.useEffect)(() => { 24043 if (canvasMode === 'edit') { 24044 setIsFocused(false); 24045 } 24046 }, [canvasMode]); 24047 24048 // In view mode, make the canvas iframe be perceived and behave as a button 24049 // to switch to edit mode, with a meaningful label and no title attribute. 24050 const viewModeIframeProps = { 24051 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Edit'), 24052 'aria-disabled': currentPostIsTrashed, 24053 title: null, 24054 role: 'button', 24055 tabIndex: 0, 24056 onFocus: () => setIsFocused(true), 24057 onBlur: () => setIsFocused(false), 24058 onKeyDown: event => { 24059 const { 24060 keyCode 24061 } = event; 24062 if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) { 24063 event.preventDefault(); 24064 setCanvasMode('edit'); 24065 } 24066 }, 24067 onClick: () => { 24068 setCanvasMode('edit'); 24069 }, 24070 onClickCapture: event => { 24071 if (currentPostIsTrashed) { 24072 event.preventDefault(); 24073 event.stopPropagation(); 24074 } 24075 }, 24076 readonly: true 24077 }; 24078 return { 24079 className: dist_clsx('edit-site-visual-editor__editor-canvas', { 24080 'is-focused': isFocused && canvasMode === 'view' 24081 }), 24082 ...(canvasMode === 'view' ? viewModeIframeProps : {}) 24083 }; 24084 } 24085 24086 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js 24087 /** 24088 * WordPress dependencies 24089 */ 24090 24091 24092 24093 24094 24095 24096 24097 24098 /** 24099 * Internal dependencies 24100 */ 24101 24102 const { 24103 useLocation: use_title_useLocation 24104 } = unlock(external_wp_router_namespaceObject.privateApis); 24105 function useTitle(title) { 24106 const location = use_title_useLocation(); 24107 const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')?.title, []); 24108 const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); 24109 (0,external_wp_element_namespaceObject.useEffect)(() => { 24110 isInitialLocationRef.current = false; 24111 }, [location]); 24112 (0,external_wp_element_namespaceObject.useEffect)(() => { 24113 // Don't update or announce the title for initial page load. 24114 if (isInitialLocationRef.current) { 24115 return; 24116 } 24117 if (title && siteTitle) { 24118 // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 24119 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ 24120 (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)); 24121 document.title = formattedTitle; 24122 24123 // Announce title on route change for screen readers. 24124 (0,external_wp_a11y_namespaceObject.speak)(title, 'assertive'); 24125 } 24126 }, [title, siteTitle, location]); 24127 } 24128 24129 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js 24130 /** 24131 * WordPress dependencies 24132 */ 24133 24134 24135 /** 24136 * Internal dependencies 24137 */ 24138 24139 24140 24141 function useEditorTitle() { 24142 const { 24143 record: editedPost, 24144 getTitle, 24145 isLoaded: hasLoadedPost 24146 } = useEditedEntityRecord(); 24147 let title; 24148 if (hasLoadedPost) { 24149 var _POST_TYPE_LABELS$edi; 24150 title = (0,external_wp_i18n_namespaceObject.sprintf)( 24151 // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part). 24152 (0,external_wp_i18n_namespaceObject._x)('%1$s ‹ %2$s', 'breadcrumb trail'), 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]); 24153 } 24154 24155 // Only announce the title once the editor is ready to prevent "Replace" 24156 // action in <URLQueryController> from double-announcing. 24157 useTitle(hasLoadedPost && title); 24158 } 24159 /* harmony default export */ const use_editor_title = (useEditorTitle); 24160 24161 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js 24162 /** 24163 * External dependencies 24164 */ 24165 24166 24167 /** 24168 * WordPress dependencies 24169 */ 24170 24171 24172 24173 24174 24175 24176 24177 24178 24179 24180 24181 24182 24183 24184 24185 /** 24186 * Internal dependencies 24187 */ 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199 24200 24201 24202 24203 24204 24205 24206 24207 24208 const { 24209 Editor, 24210 BackButton 24211 } = unlock(external_wp_editor_namespaceObject.privateApis); 24212 const { 24213 useHistory: editor_useHistory, 24214 useLocation: editor_useLocation 24215 } = unlock(external_wp_router_namespaceObject.privateApis); 24216 const { 24217 BlockKeyboardShortcuts 24218 } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); 24219 const toggleHomeIconVariants = { 24220 edit: { 24221 opacity: 0, 24222 scale: 0.2 24223 }, 24224 hover: { 24225 opacity: 1, 24226 scale: 1, 24227 clipPath: 'inset( 22% round 2px )' 24228 } 24229 }; 24230 const siteIconVariants = { 24231 edit: { 24232 clipPath: 'inset(0% round 0px)' 24233 }, 24234 hover: { 24235 clipPath: 'inset( 22% round 2px )' 24236 }, 24237 tap: { 24238 clipPath: 'inset(0% round 0px)' 24239 } 24240 }; 24241 function EditSiteEditor({ 24242 isPostsList = false 24243 }) { 24244 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 24245 const { 24246 params 24247 } = editor_useLocation(); 24248 const isLoading = useIsSiteEditorLoading(); 24249 const { 24250 editedPostType, 24251 editedPostId, 24252 contextPostType, 24253 contextPostId, 24254 canvasMode, 24255 isEditingPage, 24256 supportsGlobalStyles, 24257 showIconLabels, 24258 editorCanvasView, 24259 currentPostIsTrashed, 24260 hasSiteIcon 24261 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24262 const { 24263 getEditorCanvasContainerView, 24264 getEditedPostContext, 24265 getCanvasMode, 24266 isPage, 24267 getEditedPostType, 24268 getEditedPostId 24269 } = unlock(select(store)); 24270 const { 24271 get 24272 } = select(external_wp_preferences_namespaceObject.store); 24273 const { 24274 getCurrentTheme, 24275 getEntityRecord 24276 } = select(external_wp_coreData_namespaceObject.store); 24277 const _context = getEditedPostContext(); 24278 const siteData = getEntityRecord('root', '__unstableBase', undefined); 24279 24280 // The currently selected entity to display. 24281 // Typically template or template part in the site editor. 24282 return { 24283 editedPostType: getEditedPostType(), 24284 editedPostId: getEditedPostId(), 24285 contextPostType: _context?.postId ? _context.postType : undefined, 24286 contextPostId: _context?.postId ? _context.postId : undefined, 24287 canvasMode: getCanvasMode(), 24288 isEditingPage: isPage(), 24289 supportsGlobalStyles: getCurrentTheme()?.is_block_theme, 24290 showIconLabels: get('core', 'showIconLabels'), 24291 editorCanvasView: getEditorCanvasContainerView(), 24292 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash', 24293 hasSiteIcon: !!siteData?.site_icon_url 24294 }; 24295 }, []); 24296 use_editor_title(); 24297 const _isPreviewingTheme = isPreviewingTheme(); 24298 const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer(); 24299 const iframeProps = useEditorIframeProps(); 24300 const isEditMode = canvasMode === 'edit'; 24301 const postWithTemplate = !!contextPostId; 24302 const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(CanvasLoader, 'edit-site-editor__loading-progress'); 24303 const settings = useSpecificEditorSettings(); 24304 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...settings.styles, { 24305 // Forming a "block formatting context" to prevent margin collapsing. 24306 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 24307 css: canvasMode === 'view' ? `body{min-height: 100vh; $currentPostIsTrashed ? '' : 'cursor: pointer;'}}` : undefined 24308 }], [settings.styles, canvasMode, currentPostIsTrashed]); 24309 const { 24310 setCanvasMode 24311 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24312 const { 24313 __unstableSetEditorMode, 24314 resetZoomLevel 24315 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 24316 const { 24317 createSuccessNotice 24318 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24319 const history = editor_useHistory(); 24320 const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => { 24321 switch (actionId) { 24322 case 'move-to-trash': 24323 case 'delete-post': 24324 { 24325 history.push({ 24326 postType: items[0].type 24327 }); 24328 } 24329 break; 24330 case 'duplicate-post': 24331 { 24332 const newItem = items[0]; 24333 const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered; 24334 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 24335 // translators: %s: Title of the created post or template, e.g: "Hello world". 24336 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title)), { 24337 type: 'snackbar', 24338 id: 'duplicate-post-action', 24339 actions: [{ 24340 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 24341 onClick: () => { 24342 history.push({ 24343 postId: newItem.id, 24344 postType: newItem.type, 24345 canvas: 'edit' 24346 }); 24347 } 24348 }] 24349 }); 24350 } 24351 break; 24352 } 24353 }, [history, createSuccessNotice]); 24354 24355 // Replace the title and icon displayed in the DocumentBar when there's an overlay visible. 24356 const title = getEditorCanvasContainerTitle(editorCanvasView); 24357 const isReady = !isLoading; 24358 const transition = { 24359 duration: disableMotion ? 0 : 0.2 24360 }; 24361 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24362 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, { 24363 id: loadingProgressId 24364 }) : null, isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, {}), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Editor, { 24365 postType: postWithTemplate ? contextPostType : editedPostType, 24366 postId: postWithTemplate ? contextPostId : editedPostId, 24367 templateId: postWithTemplate ? editedPostId : undefined, 24368 settings: settings, 24369 className: dist_clsx('edit-site-editor__editor-interface', { 24370 'show-icon-labels': showIconLabels 24371 }), 24372 styles: styles, 24373 customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { 24374 size: "compact" 24375 }), 24376 customSavePanel: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}), 24377 forceDisableBlockTools: !hasDefaultEditorCanvasView, 24378 title: title, 24379 iframeProps: iframeProps, 24380 onActionPerformed: onActionPerformed, 24381 extraSidebarPanels: !isEditingPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel.Slot, {}), 24382 children: [isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { 24383 children: ({ 24384 length 24385 }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 24386 className: "edit-site-editor__view-mode-toggle", 24387 transition: transition, 24388 animate: "edit", 24389 initial: "edit", 24390 whileHover: "hover", 24391 whileTap: "tap", 24392 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24393 __next40pxDefaultSize: true, 24394 label: (0,external_wp_i18n_namespaceObject.__)('Open Navigation'), 24395 showTooltip: true, 24396 tooltipPosition: "middle right", 24397 onClick: () => { 24398 setCanvasMode('view'); 24399 __unstableSetEditorMode('edit'); 24400 resetZoomLevel(); 24401 24402 // TODO: this is a temporary solution to navigate to the posts list if we are 24403 // come here through `posts list` and are in focus mode editing a template, template part etc.. 24404 if (isPostsList && params?.focusMode) { 24405 history.push({ 24406 page: 'gutenberg-posts-dashboard', 24407 postType: 'post' 24408 }); 24409 } 24410 }, 24411 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 24412 variants: siteIconVariants, 24413 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 24414 className: "edit-site-editor__view-mode-toggle-icon" 24415 }) 24416 }) 24417 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 24418 className: dist_clsx('edit-site-editor__back-icon', { 24419 'has-site-icon': hasSiteIcon 24420 }), 24421 variants: toggleHomeIconVariants, 24422 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 24423 icon: arrow_up_left 24424 }) 24425 })] 24426 }) 24427 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), supportsGlobalStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})] 24428 })] 24429 }); 24430 } 24431 24432 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 24433 var remove_accents = __webpack_require__(9681); 24434 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 24435 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-up.js 24436 /** 24437 * WordPress dependencies 24438 */ 24439 24440 24441 const arrowUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 24442 xmlns: "http://www.w3.org/2000/svg", 24443 viewBox: "0 0 24 24", 24444 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 24445 d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" 24446 }) 24447 }); 24448 /* harmony default export */ const arrow_up = (arrowUp); 24449 24450 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-down.js 24451 /** 24452 * WordPress dependencies 24453 */ 24454 24455 24456 const arrowDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 24457 xmlns: "http://www.w3.org/2000/svg", 24458 viewBox: "0 0 24 24", 24459 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 24460 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" 24461 }) 24462 }); 24463 /* harmony default export */ const arrow_down = (arrowDown); 24464 24465 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/constants.js 24466 /** 24467 * WordPress dependencies 24468 */ 24469 24470 24471 24472 /** 24473 * Internal dependencies 24474 */ 24475 24476 // Filter operators. 24477 const constants_OPERATOR_IS = 'is'; 24478 const constants_OPERATOR_IS_NOT = 'isNot'; 24479 const constants_OPERATOR_IS_ANY = 'isAny'; 24480 const constants_OPERATOR_IS_NONE = 'isNone'; 24481 const OPERATOR_IS_ALL = 'isAll'; 24482 const OPERATOR_IS_NOT_ALL = 'isNotAll'; 24483 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]; 24484 const OPERATORS = { 24485 [constants_OPERATOR_IS]: { 24486 key: 'is-filter', 24487 label: (0,external_wp_i18n_namespaceObject.__)('Is') 24488 }, 24489 [constants_OPERATOR_IS_NOT]: { 24490 key: 'is-not-filter', 24491 label: (0,external_wp_i18n_namespaceObject.__)('Is not') 24492 }, 24493 [constants_OPERATOR_IS_ANY]: { 24494 key: 'is-any-filter', 24495 label: (0,external_wp_i18n_namespaceObject.__)('Is any') 24496 }, 24497 [constants_OPERATOR_IS_NONE]: { 24498 key: 'is-none-filter', 24499 label: (0,external_wp_i18n_namespaceObject.__)('Is none') 24500 }, 24501 [OPERATOR_IS_ALL]: { 24502 key: 'is-all-filter', 24503 label: (0,external_wp_i18n_namespaceObject.__)('Is all') 24504 }, 24505 [OPERATOR_IS_NOT_ALL]: { 24506 key: 'is-not-all-filter', 24507 label: (0,external_wp_i18n_namespaceObject.__)('Is not all') 24508 } 24509 }; 24510 const SORTING_DIRECTIONS = ['asc', 'desc']; 24511 const sortArrows = { 24512 asc: '↑', 24513 desc: '↓' 24514 }; 24515 const sortValues = { 24516 asc: 'ascending', 24517 desc: 'descending' 24518 }; 24519 const sortLabels = { 24520 asc: (0,external_wp_i18n_namespaceObject.__)('Sort ascending'), 24521 desc: (0,external_wp_i18n_namespaceObject.__)('Sort descending') 24522 }; 24523 const sortIcons = { 24524 asc: arrow_up, 24525 desc: arrow_down 24526 }; 24527 24528 // View layouts. 24529 const constants_LAYOUT_TABLE = 'table'; 24530 const constants_LAYOUT_GRID = 'grid'; 24531 const constants_LAYOUT_LIST = 'list'; 24532 24533 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js 24534 /** 24535 * Internal dependencies 24536 */ 24537 24538 function sort(a, b, direction) { 24539 return direction === 'asc' ? a - b : b - a; 24540 } 24541 function isValid(value, context) { 24542 // TODO: this implicitely means the value is required. 24543 if (value === '') { 24544 return false; 24545 } 24546 if (!Number.isInteger(Number(value))) { 24547 return false; 24548 } 24549 if (context?.elements) { 24550 const validValues = context?.elements.map(f => f.value); 24551 if (!validValues.includes(Number(value))) { 24552 return false; 24553 } 24554 } 24555 return true; 24556 } 24557 /* harmony default export */ const integer = ({ 24558 sort, 24559 isValid, 24560 Edit: 'integer' 24561 }); 24562 24563 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/text.js 24564 /** 24565 * Internal dependencies 24566 */ 24567 24568 function text_sort(valueA, valueB, direction) { 24569 return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 24570 } 24571 function text_isValid(value, context) { 24572 if (context?.elements) { 24573 const validValues = context?.elements?.map(f => f.value); 24574 if (!validValues.includes(value)) { 24575 return false; 24576 } 24577 } 24578 return true; 24579 } 24580 /* harmony default export */ const field_types_text = ({ 24581 sort: text_sort, 24582 isValid: text_isValid, 24583 Edit: 'text' 24584 }); 24585 24586 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js 24587 /** 24588 * Internal dependencies 24589 */ 24590 24591 function datetime_sort(a, b, direction) { 24592 const timeA = new Date(a).getTime(); 24593 const timeB = new Date(b).getTime(); 24594 return direction === 'asc' ? timeA - timeB : timeB - timeA; 24595 } 24596 function datetime_isValid(value, context) { 24597 if (context?.elements) { 24598 const validValues = context?.elements.map(f => f.value); 24599 if (!validValues.includes(value)) { 24600 return false; 24601 } 24602 } 24603 return true; 24604 } 24605 /* harmony default export */ const datetime = ({ 24606 sort: datetime_sort, 24607 isValid: datetime_isValid, 24608 Edit: 'datetime' 24609 }); 24610 24611 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/index.js 24612 /** 24613 * Internal dependencies 24614 */ 24615 24616 24617 24618 24619 24620 /** 24621 * 24622 * @param {FieldType} type The field type definition to get. 24623 * 24624 * @return A field type definition. 24625 */ 24626 function getFieldTypeDefinition(type) { 24627 if ('integer' === type) { 24628 return integer; 24629 } 24630 if ('text' === type) { 24631 return field_types_text; 24632 } 24633 if ('datetime' === type) { 24634 return datetime; 24635 } 24636 return { 24637 sort: (a, b, direction) => { 24638 if (typeof a === 'number' && typeof b === 'number') { 24639 return direction === 'asc' ? a - b : b - a; 24640 } 24641 return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); 24642 }, 24643 isValid: (value, context) => { 24644 if (context?.elements) { 24645 const validValues = context?.elements?.map(f => f.value); 24646 if (!validValues.includes(value)) { 24647 return false; 24648 } 24649 } 24650 return true; 24651 }, 24652 Edit: () => null 24653 }; 24654 } 24655 24656 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js 24657 /** 24658 * WordPress dependencies 24659 */ 24660 24661 24662 24663 /** 24664 * Internal dependencies 24665 */ 24666 24667 24668 function DateTime({ 24669 data, 24670 field, 24671 onChange, 24672 hideLabelFromVision 24673 }) { 24674 const { 24675 id, 24676 label 24677 } = field; 24678 const value = field.getValue({ 24679 item: data 24680 }); 24681 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24682 [id]: newValue 24683 }), [id, onChange]); 24684 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 24685 className: "dataviews-controls__datetime", 24686 children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 24687 as: "legend", 24688 children: label 24689 }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 24690 as: "legend", 24691 children: label 24692 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { 24693 currentTime: value, 24694 onChange: onChangeControl, 24695 hideLabelFromVision: true 24696 })] 24697 }); 24698 } 24699 24700 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js 24701 /** 24702 * WordPress dependencies 24703 */ 24704 24705 24706 24707 /** 24708 * Internal dependencies 24709 */ 24710 24711 function Integer({ 24712 data, 24713 field, 24714 onChange, 24715 hideLabelFromVision 24716 }) { 24717 var _field$getValue; 24718 const { 24719 id, 24720 label, 24721 description 24722 } = field; 24723 const value = (_field$getValue = field.getValue({ 24724 item: data 24725 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 24726 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24727 [id]: Number(newValue) 24728 }), [id, onChange]); 24729 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 24730 label: label, 24731 help: description, 24732 value: value, 24733 onChange: onChangeControl, 24734 __next40pxDefaultSize: true, 24735 hideLabelFromVision: hideLabelFromVision 24736 }); 24737 } 24738 24739 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js 24740 /** 24741 * WordPress dependencies 24742 */ 24743 24744 24745 24746 /** 24747 * Internal dependencies 24748 */ 24749 24750 function Radio({ 24751 data, 24752 field, 24753 onChange, 24754 hideLabelFromVision 24755 }) { 24756 const { 24757 id, 24758 label 24759 } = field; 24760 const value = field.getValue({ 24761 item: data 24762 }); 24763 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24764 [id]: newValue 24765 }), [id, onChange]); 24766 if (field.elements) { 24767 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 24768 label: label, 24769 onChange: onChangeControl, 24770 options: field.elements, 24771 selected: value, 24772 hideLabelFromVision: hideLabelFromVision 24773 }); 24774 } 24775 return null; 24776 } 24777 24778 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js 24779 /** 24780 * WordPress dependencies 24781 */ 24782 24783 24784 24785 24786 /** 24787 * Internal dependencies 24788 */ 24789 24790 function Select({ 24791 data, 24792 field, 24793 onChange, 24794 hideLabelFromVision 24795 }) { 24796 var _field$getValue, _field$elements; 24797 const { 24798 id, 24799 label 24800 } = field; 24801 const value = (_field$getValue = field.getValue({ 24802 item: data 24803 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 24804 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24805 [id]: newValue 24806 }), [id, onChange]); 24807 const elements = [ 24808 /* 24809 * Value can be undefined when: 24810 * 24811 * - the field is not required 24812 * - in bulk editing 24813 * 24814 */ 24815 { 24816 label: (0,external_wp_i18n_namespaceObject.__)('Select item'), 24817 value: '' 24818 }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; 24819 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 24820 label: label, 24821 value: value, 24822 options: elements, 24823 onChange: onChangeControl, 24824 __next40pxDefaultSize: true, 24825 __nextHasNoMarginBottom: true, 24826 hideLabelFromVision: hideLabelFromVision 24827 }); 24828 } 24829 24830 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js 24831 /** 24832 * WordPress dependencies 24833 */ 24834 24835 24836 24837 /** 24838 * Internal dependencies 24839 */ 24840 24841 function Text({ 24842 data, 24843 field, 24844 onChange, 24845 hideLabelFromVision 24846 }) { 24847 const { 24848 id, 24849 label, 24850 placeholder 24851 } = field; 24852 const value = field.getValue({ 24853 item: data 24854 }); 24855 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 24856 [id]: newValue 24857 }), [id, onChange]); 24858 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 24859 label: label, 24860 placeholder: placeholder, 24861 value: value !== null && value !== void 0 ? value : '', 24862 onChange: onChangeControl, 24863 __next40pxDefaultSize: true, 24864 __nextHasNoMarginBottom: true, 24865 hideLabelFromVision: hideLabelFromVision 24866 }); 24867 } 24868 24869 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js 24870 /** 24871 * External dependencies 24872 */ 24873 24874 /** 24875 * Internal dependencies 24876 */ 24877 24878 24879 24880 24881 24882 24883 const FORM_CONTROLS = { 24884 datetime: DateTime, 24885 integer: Integer, 24886 radio: Radio, 24887 select: Select, 24888 text: Text 24889 }; 24890 function getControl(field, fieldTypeDefinition) { 24891 if (typeof field.Edit === 'function') { 24892 return field.Edit; 24893 } 24894 if (typeof field.Edit === 'string') { 24895 return getControlByType(field.Edit); 24896 } 24897 if (field.elements) { 24898 return getControlByType('select'); 24899 } 24900 if (typeof fieldTypeDefinition.Edit === 'string') { 24901 return getControlByType(fieldTypeDefinition.Edit); 24902 } 24903 return fieldTypeDefinition.Edit; 24904 } 24905 function getControlByType(type) { 24906 if (Object.keys(FORM_CONTROLS).includes(type)) { 24907 return FORM_CONTROLS[type]; 24908 } 24909 throw 'Control ' + type + ' not found'; 24910 } 24911 24912 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js 24913 /** 24914 * Internal dependencies 24915 */ 24916 24917 24918 24919 /** 24920 * Apply default values and normalize the fields config. 24921 * 24922 * @param fields Fields config. 24923 * @return Normalized fields config. 24924 */ 24925 function normalizeFields(fields) { 24926 return fields.map(field => { 24927 var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; 24928 const fieldTypeDefinition = getFieldTypeDefinition(field.type); 24929 const getValue = field.getValue || (({ 24930 item 24931 }) => item[field.id]); 24932 const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { 24933 return fieldTypeDefinition.sort(getValue({ 24934 item: a 24935 }), getValue({ 24936 item: b 24937 }), direction); 24938 }; 24939 const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { 24940 return fieldTypeDefinition.isValid(getValue({ 24941 item 24942 }), context); 24943 }; 24944 const Edit = getControl(field, fieldTypeDefinition); 24945 const renderFromElements = ({ 24946 item 24947 }) => { 24948 const value = getValue({ 24949 item 24950 }); 24951 return field?.elements?.find(element => element.value === value)?.label || getValue({ 24952 item 24953 }); 24954 }; 24955 const render = field.render || (field.elements ? renderFromElements : getValue); 24956 return { 24957 ...field, 24958 label: field.label || field.id, 24959 header: field.header || field.label || field.id, 24960 getValue, 24961 render, 24962 sort, 24963 isValid, 24964 Edit, 24965 enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, 24966 enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true 24967 }; 24968 }); 24969 } 24970 24971 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/filter-and-sort-data-view.js 24972 /** 24973 * External dependencies 24974 */ 24975 24976 24977 /** 24978 * Internal dependencies 24979 */ 24980 24981 24982 function normalizeSearchInput(input = '') { 24983 return remove_accents_default()(input.trim().toLowerCase()); 24984 } 24985 const filter_and_sort_data_view_EMPTY_ARRAY = []; 24986 24987 /** 24988 * Applies the filtering, sorting and pagination to the raw data based on the view configuration. 24989 * 24990 * @param data Raw data. 24991 * @param view View config. 24992 * @param fields Fields config. 24993 * 24994 * @return Filtered, sorted and paginated data. 24995 */ 24996 function filterSortAndPaginate(data, view, fields) { 24997 if (!data) { 24998 return { 24999 data: filter_and_sort_data_view_EMPTY_ARRAY, 25000 paginationInfo: { 25001 totalItems: 0, 25002 totalPages: 0 25003 } 25004 }; 25005 } 25006 const _fields = normalizeFields(fields); 25007 let filteredData = [...data]; 25008 // Handle global search. 25009 if (view.search) { 25010 const normalizedSearch = normalizeSearchInput(view.search); 25011 filteredData = filteredData.filter(item => { 25012 return _fields.filter(field => field.enableGlobalSearch).map(field => { 25013 return normalizeSearchInput(field.getValue({ 25014 item 25015 })); 25016 }).some(field => field.includes(normalizedSearch)); 25017 }); 25018 } 25019 if (view.filters && view.filters?.length > 0) { 25020 view.filters.forEach(filter => { 25021 const field = _fields.find(_field => _field.id === filter.field); 25022 if (field) { 25023 if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) { 25024 filteredData = filteredData.filter(item => { 25025 const fieldValue = field.getValue({ 25026 item 25027 }); 25028 if (Array.isArray(fieldValue)) { 25029 return filter.value.some(filterValue => fieldValue.includes(filterValue)); 25030 } else if (typeof fieldValue === 'string') { 25031 return filter.value.includes(fieldValue); 25032 } 25033 return false; 25034 }); 25035 } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) { 25036 filteredData = filteredData.filter(item => { 25037 const fieldValue = field.getValue({ 25038 item 25039 }); 25040 if (Array.isArray(fieldValue)) { 25041 return !filter.value.some(filterValue => fieldValue.includes(filterValue)); 25042 } else if (typeof fieldValue === 'string') { 25043 return !filter.value.includes(fieldValue); 25044 } 25045 return false; 25046 }); 25047 } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) { 25048 filteredData = filteredData.filter(item => { 25049 return filter.value.every(value => { 25050 return field.getValue({ 25051 item 25052 })?.includes(value); 25053 }); 25054 }); 25055 } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) { 25056 filteredData = filteredData.filter(item => { 25057 return filter.value.every(value => { 25058 return !field.getValue({ 25059 item 25060 })?.includes(value); 25061 }); 25062 }); 25063 } else if (filter.operator === constants_OPERATOR_IS) { 25064 filteredData = filteredData.filter(item => { 25065 return filter.value === field.getValue({ 25066 item 25067 }); 25068 }); 25069 } else if (filter.operator === constants_OPERATOR_IS_NOT) { 25070 filteredData = filteredData.filter(item => { 25071 return filter.value !== field.getValue({ 25072 item 25073 }); 25074 }); 25075 } 25076 } 25077 }); 25078 } 25079 25080 // Handle sorting. 25081 if (view.sort) { 25082 const fieldId = view.sort.field; 25083 const fieldToSort = _fields.find(field => { 25084 return field.id === fieldId; 25085 }); 25086 if (fieldToSort) { 25087 filteredData.sort((a, b) => { 25088 var _view$sort$direction; 25089 return fieldToSort.sort(a, b, (_view$sort$direction = view.sort?.direction) !== null && _view$sort$direction !== void 0 ? _view$sort$direction : 'desc'); 25090 }); 25091 } 25092 } 25093 25094 // Handle pagination. 25095 let totalItems = filteredData.length; 25096 let totalPages = 1; 25097 if (view.page !== undefined && view.perPage !== undefined) { 25098 const start = (view.page - 1) * view.perPage; 25099 totalItems = filteredData?.length || 0; 25100 totalPages = Math.ceil(totalItems / view.perPage); 25101 filteredData = filteredData?.slice(start, start + view.perPage); 25102 } 25103 return { 25104 data: filteredData, 25105 paginationInfo: { 25106 totalItems, 25107 totalPages 25108 } 25109 }; 25110 } 25111 25112 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js 25113 /** 25114 * WordPress dependencies 25115 */ 25116 25117 25118 /** 25119 * Internal dependencies 25120 */ 25121 25122 25123 const DataViewsContext = (0,external_wp_element_namespaceObject.createContext)({ 25124 view: { 25125 type: constants_LAYOUT_TABLE 25126 }, 25127 onChangeView: () => {}, 25128 fields: [], 25129 data: [], 25130 paginationInfo: { 25131 totalItems: 0, 25132 totalPages: 0 25133 }, 25134 selection: [], 25135 onChangeSelection: () => {}, 25136 setOpenedFilter: () => {}, 25137 openedFilter: null, 25138 getItemId: item => item.id, 25139 density: 0 25140 }); 25141 /* harmony default export */ const dataviews_context = (DataViewsContext); 25142 25143 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/funnel.js 25144 /** 25145 * WordPress dependencies 25146 */ 25147 25148 25149 const funnel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25150 viewBox: "0 0 24 24", 25151 xmlns: "http://www.w3.org/2000/svg", 25152 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25153 d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" 25154 }) 25155 }); 25156 /* harmony default export */ const library_funnel = (funnel); 25157 25158 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js 25159 "use client"; 25160 var __defProp = Object.defineProperty; 25161 var __defProps = Object.defineProperties; 25162 var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 25163 var __getOwnPropSymbols = Object.getOwnPropertySymbols; 25164 var __hasOwnProp = Object.prototype.hasOwnProperty; 25165 var __propIsEnum = Object.prototype.propertyIsEnumerable; 25166 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 25167 var _3YLGPPWQ_spreadValues = (a, b) => { 25168 for (var prop in b || (b = {})) 25169 if (__hasOwnProp.call(b, prop)) 25170 __defNormalProp(a, prop, b[prop]); 25171 if (__getOwnPropSymbols) 25172 for (var prop of __getOwnPropSymbols(b)) { 25173 if (__propIsEnum.call(b, prop)) 25174 __defNormalProp(a, prop, b[prop]); 25175 } 25176 return a; 25177 }; 25178 var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 25179 var __objRest = (source, exclude) => { 25180 var target = {}; 25181 for (var prop in source) 25182 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 25183 target[prop] = source[prop]; 25184 if (source != null && __getOwnPropSymbols) 25185 for (var prop of __getOwnPropSymbols(source)) { 25186 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) 25187 target[prop] = source[prop]; 25188 } 25189 return target; 25190 }; 25191 25192 25193 25194 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js 25195 "use client"; 25196 var _3YLGPPWQ_defProp = Object.defineProperty; 25197 var _3YLGPPWQ_defProps = Object.defineProperties; 25198 var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; 25199 var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; 25200 var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; 25201 var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; 25202 var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 25203 var _chunks_3YLGPPWQ_spreadValues = (a, b) => { 25204 for (var prop in b || (b = {})) 25205 if (_3YLGPPWQ_hasOwnProp.call(b, prop)) 25206 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 25207 if (_3YLGPPWQ_getOwnPropSymbols) 25208 for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { 25209 if (_3YLGPPWQ_propIsEnum.call(b, prop)) 25210 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 25211 } 25212 return a; 25213 }; 25214 var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); 25215 var _3YLGPPWQ_objRest = (source, exclude) => { 25216 var target = {}; 25217 for (var prop in source) 25218 if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 25219 target[prop] = source[prop]; 25220 if (source != null && _3YLGPPWQ_getOwnPropSymbols) 25221 for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { 25222 if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) 25223 target[prop] = source[prop]; 25224 } 25225 return target; 25226 }; 25227 25228 25229 25230 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js 25231 "use client"; 25232 25233 25234 // src/utils/misc.ts 25235 function PBFD2E7P_noop(..._) { 25236 } 25237 function shallowEqual(a, b) { 25238 if (a === b) return true; 25239 if (!a) return false; 25240 if (!b) return false; 25241 if (typeof a !== "object") return false; 25242 if (typeof b !== "object") return false; 25243 const aKeys = Object.keys(a); 25244 const bKeys = Object.keys(b); 25245 const { length } = aKeys; 25246 if (bKeys.length !== length) return false; 25247 for (const key of aKeys) { 25248 if (a[key] !== b[key]) { 25249 return false; 25250 } 25251 } 25252 return true; 25253 } 25254 function applyState(argument, currentValue) { 25255 if (isUpdater(argument)) { 25256 const value = isLazyValue(currentValue) ? currentValue() : currentValue; 25257 return argument(value); 25258 } 25259 return argument; 25260 } 25261 function isUpdater(argument) { 25262 return typeof argument === "function"; 25263 } 25264 function isLazyValue(value) { 25265 return typeof value === "function"; 25266 } 25267 function isObject(arg) { 25268 return typeof arg === "object" && arg != null; 25269 } 25270 function isEmpty(arg) { 25271 if (Array.isArray(arg)) return !arg.length; 25272 if (isObject(arg)) return !Object.keys(arg).length; 25273 if (arg == null) return true; 25274 if (arg === "") return true; 25275 return false; 25276 } 25277 function isInteger(arg) { 25278 if (typeof arg === "number") { 25279 return Math.floor(arg) === arg; 25280 } 25281 return String(Math.floor(Number(arg))) === arg; 25282 } 25283 function PBFD2E7P_hasOwnProperty(object, prop) { 25284 if (typeof Object.hasOwn === "function") { 25285 return Object.hasOwn(object, prop); 25286 } 25287 return Object.prototype.hasOwnProperty.call(object, prop); 25288 } 25289 function chain(...fns) { 25290 return (...args) => { 25291 for (const fn of fns) { 25292 if (typeof fn === "function") { 25293 fn(...args); 25294 } 25295 } 25296 }; 25297 } 25298 function cx(...args) { 25299 return args.filter(Boolean).join(" ") || void 0; 25300 } 25301 function normalizeString(str) { 25302 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 25303 } 25304 function omit(object, keys) { 25305 const result = _chunks_3YLGPPWQ_spreadValues({}, object); 25306 for (const key of keys) { 25307 if (PBFD2E7P_hasOwnProperty(result, key)) { 25308 delete result[key]; 25309 } 25310 } 25311 return result; 25312 } 25313 function pick(object, paths) { 25314 const result = {}; 25315 for (const key of paths) { 25316 if (PBFD2E7P_hasOwnProperty(object, key)) { 25317 result[key] = object[key]; 25318 } 25319 } 25320 return result; 25321 } 25322 function identity(value) { 25323 return value; 25324 } 25325 function beforePaint(cb = PBFD2E7P_noop) { 25326 const raf = requestAnimationFrame(cb); 25327 return () => cancelAnimationFrame(raf); 25328 } 25329 function afterPaint(cb = PBFD2E7P_noop) { 25330 let raf = requestAnimationFrame(() => { 25331 raf = requestAnimationFrame(cb); 25332 }); 25333 return () => cancelAnimationFrame(raf); 25334 } 25335 function invariant(condition, message) { 25336 if (condition) return; 25337 if (typeof message !== "string") throw new Error("Invariant failed"); 25338 throw new Error(message); 25339 } 25340 function getKeys(obj) { 25341 return Object.keys(obj); 25342 } 25343 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 25344 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 25345 if (result == null) return false; 25346 return !result; 25347 } 25348 function disabledFromProps(props) { 25349 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 25350 } 25351 function removeUndefinedValues(obj) { 25352 const result = {}; 25353 for (const key in obj) { 25354 if (obj[key] !== void 0) { 25355 result[key] = obj[key]; 25356 } 25357 } 25358 return result; 25359 } 25360 function defaultValue(...values) { 25361 for (const value of values) { 25362 if (value !== void 0) return value; 25363 } 25364 return void 0; 25365 } 25366 25367 25368 25369 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js 25370 "use client"; 25371 25372 25373 // src/utils/misc.ts 25374 25375 25376 function setRef(ref, value) { 25377 if (typeof ref === "function") { 25378 ref(value); 25379 } else if (ref) { 25380 ref.current = value; 25381 } 25382 } 25383 function isValidElementWithRef(element) { 25384 if (!element) return false; 25385 if (!(0,external_React_.isValidElement)(element)) return false; 25386 if ("ref" in element.props) return true; 25387 if ("ref" in element) return true; 25388 return false; 25389 } 25390 function getRefProperty(element) { 25391 if (!isValidElementWithRef(element)) return null; 25392 const props = _3YLGPPWQ_spreadValues({}, element.props); 25393 return props.ref || element.ref; 25394 } 25395 function mergeProps(base, overrides) { 25396 const props = _3YLGPPWQ_spreadValues({}, base); 25397 for (const key in overrides) { 25398 if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; 25399 if (key === "className") { 25400 const prop = "className"; 25401 props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop]; 25402 continue; 25403 } 25404 if (key === "style") { 25405 const prop = "style"; 25406 props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; 25407 continue; 25408 } 25409 const overrideValue = overrides[key]; 25410 if (typeof overrideValue === "function" && key.startsWith("on")) { 25411 const baseValue = base[key]; 25412 if (typeof baseValue === "function") { 25413 props[key] = (...args) => { 25414 overrideValue(...args); 25415 baseValue(...args); 25416 }; 25417 continue; 25418 } 25419 } 25420 props[key] = overrideValue; 25421 } 25422 return props; 25423 } 25424 25425 25426 25427 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js 25428 "use client"; 25429 25430 // src/utils/dom.ts 25431 var HWOIWM4O_canUseDOM = checkIsBrowser(); 25432 function checkIsBrowser() { 25433 var _a; 25434 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); 25435 } 25436 function getDocument(node) { 25437 return node ? node.ownerDocument || node : document; 25438 } 25439 function getWindow(node) { 25440 return getDocument(node).defaultView || window; 25441 } 25442 function HWOIWM4O_getActiveElement(node, activeDescendant = false) { 25443 const { activeElement } = getDocument(node); 25444 if (!(activeElement == null ? void 0 : activeElement.nodeName)) { 25445 return null; 25446 } 25447 if (HWOIWM4O_isFrame(activeElement) && activeElement.contentDocument) { 25448 return HWOIWM4O_getActiveElement( 25449 activeElement.contentDocument.body, 25450 activeDescendant 25451 ); 25452 } 25453 if (activeDescendant) { 25454 const id = activeElement.getAttribute("aria-activedescendant"); 25455 if (id) { 25456 const element = getDocument(activeElement).getElementById(id); 25457 if (element) { 25458 return element; 25459 } 25460 } 25461 } 25462 return activeElement; 25463 } 25464 function contains(parent, child) { 25465 return parent === child || parent.contains(child); 25466 } 25467 function HWOIWM4O_isFrame(element) { 25468 return element.tagName === "IFRAME"; 25469 } 25470 function isButton(element) { 25471 const tagName = element.tagName.toLowerCase(); 25472 if (tagName === "button") return true; 25473 if (tagName === "input" && element.type) { 25474 return buttonInputTypes.indexOf(element.type) !== -1; 25475 } 25476 return false; 25477 } 25478 var buttonInputTypes = [ 25479 "button", 25480 "color", 25481 "file", 25482 "image", 25483 "reset", 25484 "submit" 25485 ]; 25486 function isVisible(element) { 25487 if (typeof element.checkVisibility === "function") { 25488 return element.checkVisibility(); 25489 } 25490 const htmlElement = element; 25491 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 25492 } 25493 function isTextField(element) { 25494 try { 25495 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 25496 const isTextArea = element.tagName === "TEXTAREA"; 25497 return isTextInput || isTextArea || false; 25498 } catch (error) { 25499 return false; 25500 } 25501 } 25502 function isTextbox(element) { 25503 return element.isContentEditable || isTextField(element); 25504 } 25505 function getTextboxValue(element) { 25506 if (isTextField(element)) { 25507 return element.value; 25508 } 25509 if (element.isContentEditable) { 25510 const range = getDocument(element).createRange(); 25511 range.selectNodeContents(element); 25512 return range.toString(); 25513 } 25514 return ""; 25515 } 25516 function getTextboxSelection(element) { 25517 let start = 0; 25518 let end = 0; 25519 if (isTextField(element)) { 25520 start = element.selectionStart || 0; 25521 end = element.selectionEnd || 0; 25522 } else if (element.isContentEditable) { 25523 const selection = getDocument(element).getSelection(); 25524 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { 25525 const range = selection.getRangeAt(0); 25526 const nextRange = range.cloneRange(); 25527 nextRange.selectNodeContents(element); 25528 nextRange.setEnd(range.startContainer, range.startOffset); 25529 start = nextRange.toString().length; 25530 nextRange.setEnd(range.endContainer, range.endOffset); 25531 end = nextRange.toString().length; 25532 } 25533 } 25534 return { start, end }; 25535 } 25536 function getPopupRole(element, fallback) { 25537 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; 25538 const role = element == null ? void 0 : element.getAttribute("role"); 25539 if (role && allowedPopupRoles.indexOf(role) !== -1) { 25540 return role; 25541 } 25542 return fallback; 25543 } 25544 function getPopupItemRole(element, fallback) { 25545 var _a; 25546 const itemRoleByPopupRole = { 25547 menu: "menuitem", 25548 listbox: "option", 25549 tree: "treeitem" 25550 }; 25551 const popupRole = getPopupRole(element); 25552 if (!popupRole) return fallback; 25553 const key = popupRole; 25554 return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; 25555 } 25556 function scrollIntoViewIfNeeded(element, arg) { 25557 if (isPartiallyHidden(element) && "scrollIntoView" in element) { 25558 element.scrollIntoView(arg); 25559 } 25560 } 25561 function getScrollingElement(element) { 25562 if (!element) return null; 25563 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 25564 const { overflowY } = getComputedStyle(element); 25565 const isScrollable = overflowY !== "visible" && overflowY !== "hidden"; 25566 if (isScrollable) return element; 25567 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 25568 const { overflowX } = getComputedStyle(element); 25569 const isScrollable = overflowX !== "visible" && overflowX !== "hidden"; 25570 if (isScrollable) return element; 25571 } 25572 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; 25573 } 25574 function isPartiallyHidden(element) { 25575 const elementRect = element.getBoundingClientRect(); 25576 const scroller = getScrollingElement(element); 25577 if (!scroller) return false; 25578 const scrollerRect = scroller.getBoundingClientRect(); 25579 const isHTML = scroller.tagName === "HTML"; 25580 const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; 25581 const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; 25582 const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; 25583 const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; 25584 const top = elementRect.top < scrollerTop; 25585 const left = elementRect.left < scrollerLeft; 25586 const bottom = elementRect.bottom > scrollerBottom; 25587 const right = elementRect.right > scrollerRight; 25588 return top || left || bottom || right; 25589 } 25590 function setSelectionRange(element, ...args) { 25591 if (/text|search|password|tel|url/i.test(element.type)) { 25592 element.setSelectionRange(...args); 25593 } 25594 } 25595 25596 25597 25598 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/US4USQPI.js 25599 "use client"; 25600 25601 25602 // src/utils/platform.ts 25603 function isTouchDevice() { 25604 return HWOIWM4O_canUseDOM && !!navigator.maxTouchPoints; 25605 } 25606 function isApple() { 25607 if (!HWOIWM4O_canUseDOM) return false; 25608 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 25609 } 25610 function isSafari() { 25611 return HWOIWM4O_canUseDOM && isApple() && /apple/i.test(navigator.vendor); 25612 } 25613 function isFirefox() { 25614 return HWOIWM4O_canUseDOM && /firefox\//i.test(navigator.userAgent); 25615 } 25616 function isMac() { 25617 return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); 25618 } 25619 25620 25621 25622 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/events.js 25623 "use client"; 25624 25625 25626 25627 25628 // src/utils/events.ts 25629 function isPortalEvent(event) { 25630 return Boolean( 25631 event.currentTarget && !contains(event.currentTarget, event.target) 25632 ); 25633 } 25634 function isSelfTarget(event) { 25635 return event.target === event.currentTarget; 25636 } 25637 function isOpeningInNewTab(event) { 25638 const element = event.currentTarget; 25639 if (!element) return false; 25640 const isAppleDevice = isApple(); 25641 if (isAppleDevice && !event.metaKey) return false; 25642 if (!isAppleDevice && !event.ctrlKey) return false; 25643 const tagName = element.tagName.toLowerCase(); 25644 if (tagName === "a") return true; 25645 if (tagName === "button" && element.type === "submit") return true; 25646 if (tagName === "input" && element.type === "submit") return true; 25647 return false; 25648 } 25649 function isDownloading(event) { 25650 const element = event.currentTarget; 25651 if (!element) return false; 25652 const tagName = element.tagName.toLowerCase(); 25653 if (!event.altKey) return false; 25654 if (tagName === "a") return true; 25655 if (tagName === "button" && element.type === "submit") return true; 25656 if (tagName === "input" && element.type === "submit") return true; 25657 return false; 25658 } 25659 function fireEvent(element, type, eventInit) { 25660 const event = new Event(type, eventInit); 25661 return element.dispatchEvent(event); 25662 } 25663 function fireBlurEvent(element, eventInit) { 25664 const event = new FocusEvent("blur", eventInit); 25665 const defaultAllowed = element.dispatchEvent(event); 25666 const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); 25667 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 25668 return defaultAllowed; 25669 } 25670 function fireFocusEvent(element, eventInit) { 25671 const event = new FocusEvent("focus", eventInit); 25672 const defaultAllowed = element.dispatchEvent(event); 25673 const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); 25674 element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); 25675 return defaultAllowed; 25676 } 25677 function fireKeyboardEvent(element, type, eventInit) { 25678 const event = new KeyboardEvent(type, eventInit); 25679 return element.dispatchEvent(event); 25680 } 25681 function fireClickEvent(element, eventInit) { 25682 const event = new MouseEvent("click", eventInit); 25683 return element.dispatchEvent(event); 25684 } 25685 function isFocusEventOutside(event, container) { 25686 const containerElement = container || event.currentTarget; 25687 const relatedTarget = event.relatedTarget; 25688 return !relatedTarget || !contains(containerElement, relatedTarget); 25689 } 25690 function getInputType(event) { 25691 const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; 25692 if (!nativeEvent) return; 25693 if (!("inputType" in nativeEvent)) return; 25694 if (typeof nativeEvent.inputType !== "string") return; 25695 return nativeEvent.inputType; 25696 } 25697 function queueBeforeEvent(element, type, callback, timeout) { 25698 const createTimer = (callback2) => { 25699 if (timeout) { 25700 const timerId2 = setTimeout(callback2, timeout); 25701 return () => clearTimeout(timerId2); 25702 } 25703 const timerId = requestAnimationFrame(callback2); 25704 return () => cancelAnimationFrame(timerId); 25705 }; 25706 const cancelTimer = createTimer(() => { 25707 element.removeEventListener(type, callSync, true); 25708 callback(); 25709 }); 25710 const callSync = () => { 25711 cancelTimer(); 25712 callback(); 25713 }; 25714 element.addEventListener(type, callSync, { once: true, capture: true }); 25715 return cancelTimer; 25716 } 25717 function addGlobalEventListener(type, listener, options, scope = window) { 25718 const children = []; 25719 try { 25720 scope.document.addEventListener(type, listener, options); 25721 for (const frame of Array.from(scope.frames)) { 25722 children.push(addGlobalEventListener(type, listener, options, frame)); 25723 } 25724 } catch (e) { 25725 } 25726 const removeEventListener = () => { 25727 try { 25728 scope.document.removeEventListener(type, listener, options); 25729 } catch (e) { 25730 } 25731 for (const remove of children) { 25732 remove(); 25733 } 25734 }; 25735 return removeEventListener; 25736 } 25737 25738 25739 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js 25740 "use client"; 25741 25742 25743 25744 // src/utils/hooks.ts 25745 25746 25747 25748 25749 var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); 25750 var useReactId = _React.useId; 25751 var useReactDeferredValue = _React.useDeferredValue; 25752 var useReactInsertionEffect = _React.useInsertionEffect; 25753 var useSafeLayoutEffect = HWOIWM4O_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; 25754 function useInitialValue(value) { 25755 const [initialValue] = useState(value); 25756 return initialValue; 25757 } 25758 function useLazyValue(init) { 25759 const ref = useRef(); 25760 if (ref.current === void 0) { 25761 ref.current = init(); 25762 } 25763 return ref.current; 25764 } 25765 function useLiveRef(value) { 25766 const ref = (0,external_React_.useRef)(value); 25767 useSafeLayoutEffect(() => { 25768 ref.current = value; 25769 }); 25770 return ref; 25771 } 25772 function usePreviousValue(value) { 25773 const [previousValue, setPreviousValue] = useState(value); 25774 if (value !== previousValue) { 25775 setPreviousValue(value); 25776 } 25777 return previousValue; 25778 } 25779 function useEvent(callback) { 25780 const ref = (0,external_React_.useRef)(() => { 25781 throw new Error("Cannot call an event handler while rendering."); 25782 }); 25783 if (useReactInsertionEffect) { 25784 useReactInsertionEffect(() => { 25785 ref.current = callback; 25786 }); 25787 } else { 25788 ref.current = callback; 25789 } 25790 return (0,external_React_.useCallback)((...args) => { 25791 var _a; 25792 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); 25793 }, []); 25794 } 25795 function useTransactionState(callback) { 25796 const [state, setState] = (0,external_React_.useState)(null); 25797 useSafeLayoutEffect(() => { 25798 if (state == null) return; 25799 if (!callback) return; 25800 let prevState = null; 25801 callback((prev) => { 25802 prevState = prev; 25803 return state; 25804 }); 25805 return () => { 25806 callback(prevState); 25807 }; 25808 }, [state, callback]); 25809 return [state, setState]; 25810 } 25811 function useMergeRefs(...refs) { 25812 return (0,external_React_.useMemo)(() => { 25813 if (!refs.some(Boolean)) return; 25814 return (value) => { 25815 for (const ref of refs) { 25816 setRef(ref, value); 25817 } 25818 }; 25819 }, refs); 25820 } 25821 function useId(defaultId) { 25822 if (useReactId) { 25823 const reactId = useReactId(); 25824 if (defaultId) return defaultId; 25825 return reactId; 25826 } 25827 const [id, setId] = (0,external_React_.useState)(defaultId); 25828 useSafeLayoutEffect(() => { 25829 if (defaultId || id) return; 25830 const random = Math.random().toString(36).substr(2, 6); 25831 setId(`id-$random}`); 25832 }, [defaultId, id]); 25833 return defaultId || id; 25834 } 25835 function useDeferredValue(value) { 25836 if (useReactDeferredValue) { 25837 return useReactDeferredValue(value); 25838 } 25839 const [deferredValue, setDeferredValue] = useState(value); 25840 useEffect(() => { 25841 const raf = requestAnimationFrame(() => setDeferredValue(value)); 25842 return () => cancelAnimationFrame(raf); 25843 }, [value]); 25844 return deferredValue; 25845 } 25846 function useTagName(refOrElement, type) { 25847 const stringOrUndefined = (type2) => { 25848 if (typeof type2 !== "string") return; 25849 return type2; 25850 }; 25851 const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); 25852 useSafeLayoutEffect(() => { 25853 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 25854 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); 25855 }, [refOrElement, type]); 25856 return tagName; 25857 } 25858 function useAttribute(refOrElement, attributeName, defaultValue) { 25859 const [attribute, setAttribute] = (0,external_React_.useState)(defaultValue); 25860 useSafeLayoutEffect(() => { 25861 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 25862 if (!element) return; 25863 const callback = () => { 25864 const value = element.getAttribute(attributeName); 25865 if (value == null) return; 25866 setAttribute(value); 25867 }; 25868 const observer = new MutationObserver(callback); 25869 observer.observe(element, { attributeFilter: [attributeName] }); 25870 callback(); 25871 return () => observer.disconnect(); 25872 }, [refOrElement, attributeName]); 25873 return attribute; 25874 } 25875 function useUpdateEffect(effect, deps) { 25876 const mounted = (0,external_React_.useRef)(false); 25877 (0,external_React_.useEffect)(() => { 25878 if (mounted.current) { 25879 return effect(); 25880 } 25881 mounted.current = true; 25882 }, deps); 25883 (0,external_React_.useEffect)( 25884 () => () => { 25885 mounted.current = false; 25886 }, 25887 [] 25888 ); 25889 } 25890 function useUpdateLayoutEffect(effect, deps) { 25891 const mounted = (0,external_React_.useRef)(false); 25892 useSafeLayoutEffect(() => { 25893 if (mounted.current) { 25894 return effect(); 25895 } 25896 mounted.current = true; 25897 }, deps); 25898 useSafeLayoutEffect( 25899 () => () => { 25900 mounted.current = false; 25901 }, 25902 [] 25903 ); 25904 } 25905 function useForceUpdate() { 25906 return (0,external_React_.useReducer)(() => [], []); 25907 } 25908 function useBooleanEvent(booleanOrCallback) { 25909 return useEvent( 25910 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback 25911 ); 25912 } 25913 function useWrapElement(props, callback, deps = []) { 25914 const wrapElement = (0,external_React_.useCallback)( 25915 (element) => { 25916 if (props.wrapElement) { 25917 element = props.wrapElement(element); 25918 } 25919 return callback(element); 25920 }, 25921 [...deps, props.wrapElement] 25922 ); 25923 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); 25924 } 25925 function usePortalRef(portalProp = false, portalRefProp) { 25926 const [portalNode, setPortalNode] = useState(null); 25927 const portalRef = useMergeRefs(setPortalNode, portalRefProp); 25928 const domReady = !portalProp || portalNode; 25929 return { portalRef, portalNode, domReady }; 25930 } 25931 function useMetadataProps(props, key, value) { 25932 const parent = props.onLoadedMetadataCapture; 25933 const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { 25934 return Object.assign(() => { 25935 }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); 25936 }, [parent, key, value]); 25937 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; 25938 } 25939 function useIsMouseMoving() { 25940 (0,external_React_.useEffect)(() => { 25941 addGlobalEventListener("mousemove", setMouseMoving, true); 25942 addGlobalEventListener("mousedown", resetMouseMoving, true); 25943 addGlobalEventListener("mouseup", resetMouseMoving, true); 25944 addGlobalEventListener("keydown", resetMouseMoving, true); 25945 addGlobalEventListener("scroll", resetMouseMoving, true); 25946 }, []); 25947 const isMouseMoving = useEvent(() => mouseMoving); 25948 return isMouseMoving; 25949 } 25950 var mouseMoving = false; 25951 var previousScreenX = 0; 25952 var previousScreenY = 0; 25953 function hasMouseMovement(event) { 25954 const movementX = event.movementX || event.screenX - previousScreenX; 25955 const movementY = event.movementY || event.screenY - previousScreenY; 25956 previousScreenX = event.screenX; 25957 previousScreenY = event.screenY; 25958 return movementX || movementY || "production" === "test"; 25959 } 25960 function setMouseMoving(event) { 25961 if (!hasMouseMovement(event)) return; 25962 mouseMoving = true; 25963 } 25964 function resetMouseMoving() { 25965 mouseMoving = false; 25966 } 25967 25968 25969 25970 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js 25971 "use client"; 25972 25973 25974 25975 25976 // src/utils/system.tsx 25977 25978 25979 function forwardRef2(render) { 25980 const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); 25981 Role.displayName = render.displayName || render.name; 25982 return Role; 25983 } 25984 function memo2(Component, propsAreEqual) { 25985 return external_React_.memo(Component, propsAreEqual); 25986 } 25987 function createElement(Type, props) { 25988 const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); 25989 const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); 25990 let element; 25991 if (external_React_.isValidElement(render)) { 25992 const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); 25993 element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); 25994 } else if (render) { 25995 element = render(rest); 25996 } else { 25997 element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); 25998 } 25999 if (wrapElement) { 26000 return wrapElement(element); 26001 } 26002 return element; 26003 } 26004 function createHook(useProps) { 26005 const useRole = (props = {}) => { 26006 return useProps(props); 26007 }; 26008 useRole.displayName = useProps.name; 26009 return useRole; 26010 } 26011 function createStoreContext(providers = [], scopedProviders = []) { 26012 const context = external_React_.createContext(void 0); 26013 const scopedContext = external_React_.createContext(void 0); 26014 const useContext2 = () => external_React_.useContext(context); 26015 const useScopedContext = (onlyScoped = false) => { 26016 const scoped = external_React_.useContext(scopedContext); 26017 const store = useContext2(); 26018 if (onlyScoped) return scoped; 26019 return scoped || store; 26020 }; 26021 const useProviderContext = () => { 26022 const scoped = external_React_.useContext(scopedContext); 26023 const store = useContext2(); 26024 if (scoped && scoped === store) return; 26025 return store; 26026 }; 26027 const ContextProvider = (props) => { 26028 return providers.reduceRight( 26029 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 26030 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) 26031 ); 26032 }; 26033 const ScopedContextProvider = (props) => { 26034 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( 26035 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 26036 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) 26037 ) })); 26038 }; 26039 return { 26040 context, 26041 scopedContext, 26042 useContext: useContext2, 26043 useScopedContext, 26044 useProviderContext, 26045 ContextProvider, 26046 ScopedContextProvider 26047 }; 26048 } 26049 26050 26051 26052 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/FMYQNSCK.js 26053 "use client"; 26054 26055 26056 // src/collection/collection-context.tsx 26057 var ctx = createStoreContext(); 26058 var useCollectionContext = ctx.useContext; 26059 var useCollectionScopedContext = ctx.useScopedContext; 26060 var useCollectionProviderContext = ctx.useProviderContext; 26061 var CollectionContextProvider = ctx.ContextProvider; 26062 var CollectionScopedContextProvider = ctx.ScopedContextProvider; 26063 26064 26065 26066 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/WENSINUV.js 26067 "use client"; 26068 26069 26070 26071 // src/composite/composite-context.tsx 26072 26073 var WENSINUV_ctx = createStoreContext( 26074 [CollectionContextProvider], 26075 [CollectionScopedContextProvider] 26076 ); 26077 var useCompositeContext = WENSINUV_ctx.useContext; 26078 var useCompositeScopedContext = WENSINUV_ctx.useScopedContext; 26079 var useCompositeProviderContext = WENSINUV_ctx.useProviderContext; 26080 var CompositeContextProvider = WENSINUV_ctx.ContextProvider; 26081 var CompositeScopedContextProvider = WENSINUV_ctx.ScopedContextProvider; 26082 var CompositeItemContext = (0,external_React_.createContext)( 26083 void 0 26084 ); 26085 var CompositeRowContext = (0,external_React_.createContext)( 26086 void 0 26087 ); 26088 26089 26090 26091 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/P2OTTZSX.js 26092 "use client"; 26093 26094 26095 26096 // src/tag/tag-context.tsx 26097 26098 var TagValueContext = (0,external_React_.createContext)(null); 26099 var TagRemoveIdContext = (0,external_React_.createContext)( 26100 null 26101 ); 26102 var P2OTTZSX_ctx = createStoreContext( 26103 [CompositeContextProvider], 26104 [CompositeScopedContextProvider] 26105 ); 26106 var useTagContext = P2OTTZSX_ctx.useContext; 26107 var useTagScopedContext = P2OTTZSX_ctx.useScopedContext; 26108 var useTagProviderContext = P2OTTZSX_ctx.useProviderContext; 26109 var TagContextProvider = P2OTTZSX_ctx.ContextProvider; 26110 var TagScopedContextProvider = P2OTTZSX_ctx.ScopedContextProvider; 26111 26112 26113 26114 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js 26115 "use client"; 26116 26117 26118 26119 // src/utils/store.ts 26120 function getInternal(store, key) { 26121 const internals = store.__unstableInternals; 26122 invariant(internals, "Invalid store"); 26123 return internals[key]; 26124 } 26125 function createStore(initialState, ...stores) { 26126 let state = initialState; 26127 let prevStateBatch = state; 26128 let lastUpdate = Symbol(); 26129 let destroy = PBFD2E7P_noop; 26130 const instances = /* @__PURE__ */ new Set(); 26131 const updatedKeys = /* @__PURE__ */ new Set(); 26132 const setups = /* @__PURE__ */ new Set(); 26133 const listeners = /* @__PURE__ */ new Set(); 26134 const batchListeners = /* @__PURE__ */ new Set(); 26135 const disposables = /* @__PURE__ */ new WeakMap(); 26136 const listenerKeys = /* @__PURE__ */ new WeakMap(); 26137 const storeSetup = (callback) => { 26138 setups.add(callback); 26139 return () => setups.delete(callback); 26140 }; 26141 const storeInit = () => { 26142 const initialized = instances.size; 26143 const instance = Symbol(); 26144 instances.add(instance); 26145 const maybeDestroy = () => { 26146 instances.delete(instance); 26147 if (instances.size) return; 26148 destroy(); 26149 }; 26150 if (initialized) return maybeDestroy; 26151 const desyncs = getKeys(state).map( 26152 (key) => chain( 26153 ...stores.map((store) => { 26154 var _a; 26155 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); 26156 if (!storeState) return; 26157 if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; 26158 return sync(store, [key], (state2) => { 26159 setState( 26160 key, 26161 state2[key], 26162 // @ts-expect-error - Not public API. This is just to prevent 26163 // infinite loops. 26164 true 26165 ); 26166 }); 26167 }) 26168 ) 26169 ); 26170 const teardowns = []; 26171 for (const setup2 of setups) { 26172 teardowns.push(setup2()); 26173 } 26174 const cleanups = stores.map(init); 26175 destroy = chain(...desyncs, ...teardowns, ...cleanups); 26176 return maybeDestroy; 26177 }; 26178 const sub = (keys, listener, set = listeners) => { 26179 set.add(listener); 26180 listenerKeys.set(listener, keys); 26181 return () => { 26182 var _a; 26183 (_a = disposables.get(listener)) == null ? void 0 : _a(); 26184 disposables.delete(listener); 26185 listenerKeys.delete(listener); 26186 set.delete(listener); 26187 }; 26188 }; 26189 const storeSubscribe = (keys, listener) => sub(keys, listener); 26190 const storeSync = (keys, listener) => { 26191 disposables.set(listener, listener(state, state)); 26192 return sub(keys, listener); 26193 }; 26194 const storeBatch = (keys, listener) => { 26195 disposables.set(listener, listener(state, prevStateBatch)); 26196 return sub(keys, listener, batchListeners); 26197 }; 26198 const storePick = (keys) => createStore(pick(state, keys), finalStore); 26199 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 26200 const getState = () => state; 26201 const setState = (key, value, fromStores = false) => { 26202 var _a; 26203 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 26204 const nextValue = applyState(value, state[key]); 26205 if (nextValue === state[key]) return; 26206 if (!fromStores) { 26207 for (const store of stores) { 26208 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); 26209 } 26210 } 26211 const prevState = state; 26212 state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); 26213 const thisUpdate = Symbol(); 26214 lastUpdate = thisUpdate; 26215 updatedKeys.add(key); 26216 const run = (listener, prev, uKeys) => { 26217 var _a2; 26218 const keys = listenerKeys.get(listener); 26219 const updated = (k) => uKeys ? uKeys.has(k) : k === key; 26220 if (!keys || keys.some(updated)) { 26221 (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); 26222 disposables.set(listener, listener(state, prev)); 26223 } 26224 }; 26225 for (const listener of listeners) { 26226 run(listener, prevState); 26227 } 26228 queueMicrotask(() => { 26229 if (lastUpdate !== thisUpdate) return; 26230 const snapshot = state; 26231 for (const listener of batchListeners) { 26232 run(listener, prevStateBatch, updatedKeys); 26233 } 26234 prevStateBatch = snapshot; 26235 updatedKeys.clear(); 26236 }); 26237 }; 26238 const finalStore = { 26239 getState, 26240 setState, 26241 __unstableInternals: { 26242 setup: storeSetup, 26243 init: storeInit, 26244 subscribe: storeSubscribe, 26245 sync: storeSync, 26246 batch: storeBatch, 26247 pick: storePick, 26248 omit: storeOmit 26249 } 26250 }; 26251 return finalStore; 26252 } 26253 function setup(store, ...args) { 26254 if (!store) return; 26255 return getInternal(store, "setup")(...args); 26256 } 26257 function init(store, ...args) { 26258 if (!store) return; 26259 return getInternal(store, "init")(...args); 26260 } 26261 function subscribe(store, ...args) { 26262 if (!store) return; 26263 return getInternal(store, "subscribe")(...args); 26264 } 26265 function sync(store, ...args) { 26266 if (!store) return; 26267 return getInternal(store, "sync")(...args); 26268 } 26269 function batch(store, ...args) { 26270 if (!store) return; 26271 return getInternal(store, "batch")(...args); 26272 } 26273 function omit2(store, ...args) { 26274 if (!store) return; 26275 return getInternal(store, "omit")(...args); 26276 } 26277 function pick2(store, ...args) { 26278 if (!store) return; 26279 return getInternal(store, "pick")(...args); 26280 } 26281 function mergeStore(...stores) { 26282 const initialState = stores.reduce((state, store2) => { 26283 var _a; 26284 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); 26285 if (!nextState) return state; 26286 return Object.assign(state, nextState); 26287 }, {}); 26288 const store = createStore(initialState, ...stores); 26289 return store; 26290 } 26291 function throwOnConflictingProps(props, store) { 26292 if (true) return; 26293 if (!store) return; 26294 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 26295 var _a; 26296 const stateKey = key.replace("default", ""); 26297 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`; 26298 }); 26299 if (!defaultKeys.length) return; 26300 const storeState = store.getState(); 26301 const conflictingProps = defaultKeys.filter( 26302 (key) => PBFD2E7P_hasOwnProperty(storeState, key) 26303 ); 26304 if (!conflictingProps.length) return; 26305 throw new Error( 26306 `Passing a store prop in conjunction with a default state is not supported. 26307 26308 const store = useSelectStore(); 26309 <SelectProvider store={store} defaultValue="Apple" /> 26310 ^ ^ 26311 26312 Instead, pass the default state to the topmost store: 26313 26314 const store = useSelectStore({ defaultValue: "Apple" }); 26315 <SelectProvider store={store} /> 26316 26317 See https://github.com/ariakit/ariakit/pull/2745 for more details. 26318 26319 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 26320 ` 26321 ); 26322 } 26323 26324 26325 26326 // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js 26327 var shim = __webpack_require__(422); 26328 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js 26329 "use client"; 26330 26331 26332 26333 // src/utils/store.tsx 26334 26335 26336 26337 26338 var { useSyncExternalStore } = shim; 26339 var noopSubscribe = () => () => { 26340 }; 26341 function useStoreState(store, keyOrSelector = identity) { 26342 const storeSubscribe = external_React_.useCallback( 26343 (callback) => { 26344 if (!store) return noopSubscribe(); 26345 return subscribe(store, null, callback); 26346 }, 26347 [store] 26348 ); 26349 const getSnapshot = () => { 26350 const key = typeof keyOrSelector === "string" ? keyOrSelector : null; 26351 const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; 26352 const state = store == null ? void 0 : store.getState(); 26353 if (selector) return selector(state); 26354 if (!state) return; 26355 if (!key) return; 26356 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 26357 return state[key]; 26358 }; 26359 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 26360 } 26361 function useStoreProps(store, props, key, setKey) { 26362 const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; 26363 const setValue = setKey ? props[setKey] : void 0; 26364 const propsRef = useLiveRef({ value, setValue }); 26365 useSafeLayoutEffect(() => { 26366 return sync(store, [key], (state, prev) => { 26367 const { value: value2, setValue: setValue2 } = propsRef.current; 26368 if (!setValue2) return; 26369 if (state[key] === prev[key]) return; 26370 if (state[key] === value2) return; 26371 setValue2(state[key]); 26372 }); 26373 }, [store, key]); 26374 useSafeLayoutEffect(() => { 26375 if (value === void 0) return; 26376 store.setState(key, value); 26377 return batch(store, [key], () => { 26378 if (value === void 0) return; 26379 store.setState(key, value); 26380 }); 26381 }); 26382 } 26383 function _2GXGCHW6_useStore(createStore, props) { 26384 const [store, setStore] = external_React_.useState(() => createStore(props)); 26385 useSafeLayoutEffect(() => init(store), [store]); 26386 const useState2 = external_React_.useCallback( 26387 (keyOrSelector) => useStoreState(store, keyOrSelector), 26388 [store] 26389 ); 26390 const memoizedStore = external_React_.useMemo( 26391 () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), 26392 [store, useState2] 26393 ); 26394 const updateStore = useEvent(() => { 26395 setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); 26396 }); 26397 return [memoizedStore, updateStore]; 26398 } 26399 26400 26401 26402 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/TCAGH6BH.js 26403 "use client"; 26404 26405 26406 26407 // src/collection/collection-store.ts 26408 26409 function useCollectionStoreProps(store, update, props) { 26410 useUpdateEffect(update, [props.store]); 26411 useStoreProps(store, props, "items", "setItems"); 26412 return store; 26413 } 26414 function useCollectionStore(props = {}) { 26415 const [store, update] = useStore(Core.createCollectionStore, props); 26416 return useCollectionStoreProps(store, update, props); 26417 } 26418 26419 26420 26421 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/UVQLZ7T5.js 26422 "use client"; 26423 26424 26425 26426 // src/composite/composite-store.ts 26427 26428 function useCompositeStoreProps(store, update, props) { 26429 store = useCollectionStoreProps(store, update, props); 26430 useStoreProps(store, props, "activeId", "setActiveId"); 26431 useStoreProps(store, props, "includesBaseElement"); 26432 useStoreProps(store, props, "virtualFocus"); 26433 useStoreProps(store, props, "orientation"); 26434 useStoreProps(store, props, "rtl"); 26435 useStoreProps(store, props, "focusLoop"); 26436 useStoreProps(store, props, "focusWrap"); 26437 useStoreProps(store, props, "focusShift"); 26438 return store; 26439 } 26440 function useCompositeStore(props = {}) { 26441 const [store, update] = useStore(Core.createCompositeStore, props); 26442 return useCompositeStoreProps(store, update, props); 26443 } 26444 26445 26446 26447 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/KGK2TTFO.js 26448 "use client"; 26449 26450 26451 26452 // src/disclosure/disclosure-store.ts 26453 26454 function useDisclosureStoreProps(store, update, props) { 26455 useUpdateEffect(update, [props.store, props.disclosure]); 26456 useStoreProps(store, props, "open", "setOpen"); 26457 useStoreProps(store, props, "mounted", "setMounted"); 26458 useStoreProps(store, props, "animated"); 26459 return Object.assign(store, { disclosure: props.disclosure }); 26460 } 26461 function useDisclosureStore(props = {}) { 26462 const [store, update] = useStore(Core.createDisclosureStore, props); 26463 return useDisclosureStoreProps(store, update, props); 26464 } 26465 26466 26467 26468 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/QYS5FHDY.js 26469 "use client"; 26470 26471 26472 26473 // src/dialog/dialog-store.ts 26474 26475 function useDialogStoreProps(store, update, props) { 26476 return useDisclosureStoreProps(store, update, props); 26477 } 26478 function useDialogStore(props = {}) { 26479 const [store, update] = useStore(Core.createDialogStore, props); 26480 return useDialogStoreProps(store, update, props); 26481 } 26482 26483 26484 26485 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/CBC47ZYL.js 26486 "use client"; 26487 26488 26489 26490 26491 // src/popover/popover-store.ts 26492 26493 function usePopoverStoreProps(store, update, props) { 26494 useUpdateEffect(update, [props.popover]); 26495 useStoreProps(store, props, "placement"); 26496 return useDialogStoreProps(store, update, props); 26497 } 26498 function usePopoverStore(props = {}) { 26499 const [store, update] = useStore(Core.createPopoverStore, props); 26500 return usePopoverStoreProps(store, update, props); 26501 } 26502 26503 26504 26505 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/6DHTHWXD.js 26506 "use client"; 26507 26508 26509 26510 26511 26512 // src/collection/collection-store.ts 26513 function isElementPreceding(a, b) { 26514 return Boolean( 26515 b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING 26516 ); 26517 } 26518 function sortBasedOnDOMPosition(items) { 26519 const pairs = items.map((item, index) => [index, item]); 26520 let isOrderDifferent = false; 26521 pairs.sort(([indexA, a], [indexB, b]) => { 26522 const elementA = a.element; 26523 const elementB = b.element; 26524 if (elementA === elementB) return 0; 26525 if (!elementA || !elementB) return 0; 26526 if (isElementPreceding(elementA, elementB)) { 26527 if (indexA > indexB) { 26528 isOrderDifferent = true; 26529 } 26530 return -1; 26531 } 26532 if (indexA < indexB) { 26533 isOrderDifferent = true; 26534 } 26535 return 1; 26536 }); 26537 if (isOrderDifferent) { 26538 return pairs.map(([_, item]) => item); 26539 } 26540 return items; 26541 } 26542 function getCommonParent(items) { 26543 var _a; 26544 const firstItem = items.find((item) => !!item.element); 26545 const lastItem = [...items].reverse().find((item) => !!item.element); 26546 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; 26547 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { 26548 const parent = parentElement; 26549 if (lastItem && parent.contains(lastItem.element)) { 26550 return parentElement; 26551 } 26552 parentElement = parentElement.parentElement; 26553 } 26554 return getDocument(parentElement).body; 26555 } 26556 function getPrivateStore(store) { 26557 return store == null ? void 0 : store.__unstablePrivateStore; 26558 } 26559 function createCollectionStore(props = {}) { 26560 var _a; 26561 throwOnConflictingProps(props, props.store); 26562 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 26563 const items = defaultValue( 26564 props.items, 26565 syncState == null ? void 0 : syncState.items, 26566 props.defaultItems, 26567 [] 26568 ); 26569 const itemsMap = new Map(items.map((item) => [item.id, item])); 26570 const initialState = { 26571 items, 26572 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) 26573 }; 26574 const syncPrivateStore = getPrivateStore(props.store); 26575 const privateStore = createStore( 26576 { items, renderedItems: initialState.renderedItems }, 26577 syncPrivateStore 26578 ); 26579 const collection = createStore(initialState, props.store); 26580 const sortItems = (renderedItems) => { 26581 const sortedItems = sortBasedOnDOMPosition(renderedItems); 26582 privateStore.setState("renderedItems", sortedItems); 26583 collection.setState("renderedItems", sortedItems); 26584 }; 26585 setup(collection, () => init(privateStore)); 26586 setup(privateStore, () => { 26587 return batch(privateStore, ["items"], (state) => { 26588 collection.setState("items", state.items); 26589 }); 26590 }); 26591 setup(privateStore, () => { 26592 return batch(privateStore, ["renderedItems"], (state) => { 26593 let firstRun = true; 26594 let raf = requestAnimationFrame(() => { 26595 const { renderedItems } = collection.getState(); 26596 if (state.renderedItems === renderedItems) return; 26597 sortItems(state.renderedItems); 26598 }); 26599 if (typeof IntersectionObserver !== "function") { 26600 return () => cancelAnimationFrame(raf); 26601 } 26602 const ioCallback = () => { 26603 if (firstRun) { 26604 firstRun = false; 26605 return; 26606 } 26607 cancelAnimationFrame(raf); 26608 raf = requestAnimationFrame(() => sortItems(state.renderedItems)); 26609 }; 26610 const root = getCommonParent(state.renderedItems); 26611 const observer = new IntersectionObserver(ioCallback, { root }); 26612 for (const item of state.renderedItems) { 26613 if (!item.element) continue; 26614 observer.observe(item.element); 26615 } 26616 return () => { 26617 cancelAnimationFrame(raf); 26618 observer.disconnect(); 26619 }; 26620 }); 26621 }); 26622 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 26623 let prevItem; 26624 setItems((items2) => { 26625 const index = items2.findIndex(({ id }) => id === item.id); 26626 const nextItems = items2.slice(); 26627 if (index !== -1) { 26628 prevItem = items2[index]; 26629 const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); 26630 nextItems[index] = nextItem; 26631 itemsMap.set(item.id, nextItem); 26632 } else { 26633 nextItems.push(item); 26634 itemsMap.set(item.id, item); 26635 } 26636 return nextItems; 26637 }); 26638 const unmergeItem = () => { 26639 setItems((items2) => { 26640 if (!prevItem) { 26641 if (canDeleteFromMap) { 26642 itemsMap.delete(item.id); 26643 } 26644 return items2.filter(({ id }) => id !== item.id); 26645 } 26646 const index = items2.findIndex(({ id }) => id === item.id); 26647 if (index === -1) return items2; 26648 const nextItems = items2.slice(); 26649 nextItems[index] = prevItem; 26650 itemsMap.set(item.id, prevItem); 26651 return nextItems; 26652 }); 26653 }; 26654 return unmergeItem; 26655 }; 26656 const registerItem = (item) => mergeItem( 26657 item, 26658 (getItems) => privateStore.setState("items", getItems), 26659 true 26660 ); 26661 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { 26662 registerItem, 26663 renderItem: (item) => chain( 26664 registerItem(item), 26665 mergeItem( 26666 item, 26667 (getItems) => privateStore.setState("renderedItems", getItems) 26668 ) 26669 ), 26670 item: (id) => { 26671 if (!id) return null; 26672 let item = itemsMap.get(id); 26673 if (!item) { 26674 const { items: items2 } = collection.getState(); 26675 item = items2.find((item2) => item2.id === id); 26676 if (item) { 26677 itemsMap.set(id, item); 26678 } 26679 } 26680 return item || null; 26681 }, 26682 // @ts-expect-error Internal 26683 __unstablePrivateStore: privateStore 26684 }); 26685 } 26686 26687 26688 26689 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js 26690 "use client"; 26691 26692 // src/utils/array.ts 26693 function toArray(arg) { 26694 if (Array.isArray(arg)) { 26695 return arg; 26696 } 26697 return typeof arg !== "undefined" ? [arg] : []; 26698 } 26699 function addItemToArray(array, item, index = -1) { 26700 if (!(index in array)) { 26701 return [...array, item]; 26702 } 26703 return [...array.slice(0, index), item, ...array.slice(index)]; 26704 } 26705 function flatten2DArray(array) { 26706 const flattened = []; 26707 for (const row of array) { 26708 flattened.push(...row); 26709 } 26710 return flattened; 26711 } 26712 function reverseArray(array) { 26713 return array.slice().reverse(); 26714 } 26715 26716 26717 26718 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/D7EIQZAU.js 26719 "use client"; 26720 26721 26722 26723 26724 26725 26726 // src/composite/composite-store.ts 26727 var NULL_ITEM = { id: null }; 26728 function findFirstEnabledItem(items, excludeId) { 26729 return items.find((item) => { 26730 if (excludeId) { 26731 return !item.disabled && item.id !== excludeId; 26732 } 26733 return !item.disabled; 26734 }); 26735 } 26736 function getEnabledItems(items, excludeId) { 26737 return items.filter((item) => { 26738 if (excludeId) { 26739 return !item.disabled && item.id !== excludeId; 26740 } 26741 return !item.disabled; 26742 }); 26743 } 26744 function getOppositeOrientation(orientation) { 26745 if (orientation === "vertical") return "horizontal"; 26746 if (orientation === "horizontal") return "vertical"; 26747 return; 26748 } 26749 function getItemsInRow(items, rowId) { 26750 return items.filter((item) => item.rowId === rowId); 26751 } 26752 function flipItems(items, activeId, shouldInsertNullItem = false) { 26753 const index = items.findIndex((item) => item.id === activeId); 26754 return [ 26755 ...items.slice(index + 1), 26756 ...shouldInsertNullItem ? [NULL_ITEM] : [], 26757 ...items.slice(0, index) 26758 ]; 26759 } 26760 function groupItemsByRows(items) { 26761 const rows = []; 26762 for (const item of items) { 26763 const row = rows.find((currentRow) => { 26764 var _a; 26765 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 26766 }); 26767 if (row) { 26768 row.push(item); 26769 } else { 26770 rows.push([item]); 26771 } 26772 } 26773 return rows; 26774 } 26775 function getMaxRowLength(array) { 26776 let maxLength = 0; 26777 for (const { length } of array) { 26778 if (length > maxLength) { 26779 maxLength = length; 26780 } 26781 } 26782 return maxLength; 26783 } 26784 function createEmptyItem(rowId) { 26785 return { 26786 id: "__EMPTY_ITEM__", 26787 disabled: true, 26788 rowId 26789 }; 26790 } 26791 function normalizeRows(rows, activeId, focusShift) { 26792 const maxLength = getMaxRowLength(rows); 26793 for (const row of rows) { 26794 for (let i = 0; i < maxLength; i += 1) { 26795 const item = row[i]; 26796 if (!item || focusShift && item.disabled) { 26797 const isFirst = i === 0; 26798 const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; 26799 row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); 26800 } 26801 } 26802 } 26803 return rows; 26804 } 26805 function verticalizeItems(items) { 26806 const rows = groupItemsByRows(items); 26807 const maxLength = getMaxRowLength(rows); 26808 const verticalized = []; 26809 for (let i = 0; i < maxLength; i += 1) { 26810 for (const row of rows) { 26811 const item = row[i]; 26812 if (item) { 26813 verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { 26814 // If there's no rowId, it means that it's not a grid composite, but 26815 // a single row instead. So, instead of verticalizing it, that is, 26816 // assigning a different rowId based on the column index, we keep it 26817 // undefined so they will be part of the same row. This is useful 26818 // when using up/down on one-dimensional composites. 26819 rowId: item.rowId ? `$i}` : void 0 26820 })); 26821 } 26822 } 26823 } 26824 return verticalized; 26825 } 26826 function createCompositeStore(props = {}) { 26827 var _a; 26828 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 26829 const collection = createCollectionStore(props); 26830 const activeId = defaultValue( 26831 props.activeId, 26832 syncState == null ? void 0 : syncState.activeId, 26833 props.defaultActiveId 26834 ); 26835 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { 26836 activeId, 26837 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), 26838 includesBaseElement: defaultValue( 26839 props.includesBaseElement, 26840 syncState == null ? void 0 : syncState.includesBaseElement, 26841 activeId === null 26842 ), 26843 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), 26844 orientation: defaultValue( 26845 props.orientation, 26846 syncState == null ? void 0 : syncState.orientation, 26847 "both" 26848 ), 26849 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), 26850 virtualFocus: defaultValue( 26851 props.virtualFocus, 26852 syncState == null ? void 0 : syncState.virtualFocus, 26853 false 26854 ), 26855 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), 26856 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), 26857 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) 26858 }); 26859 const composite = createStore(initialState, collection, props.store); 26860 setup( 26861 composite, 26862 () => sync(composite, ["renderedItems", "activeId"], (state) => { 26863 composite.setState("activeId", (activeId2) => { 26864 var _a2; 26865 if (activeId2 !== void 0) return activeId2; 26866 return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; 26867 }); 26868 }) 26869 ); 26870 const getNextId = (items, orientation, hasNullItem, skip) => { 26871 var _a2, _b; 26872 const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState(); 26873 const isHorizontal = orientation !== "vertical"; 26874 const isRTL = rtl && isHorizontal; 26875 const allItems = isRTL ? reverseArray(items) : items; 26876 if (activeId2 == null) { 26877 return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id; 26878 } 26879 const activeItem = allItems.find((item) => item.id === activeId2); 26880 if (!activeItem) { 26881 return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id; 26882 } 26883 const isGrid = !!activeItem.rowId; 26884 const activeIndex = allItems.indexOf(activeItem); 26885 const nextItems = allItems.slice(activeIndex + 1); 26886 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 26887 if (skip !== void 0) { 26888 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 26889 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. 26890 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; 26891 return nextItem2 == null ? void 0 : nextItem2.id; 26892 } 26893 const oppositeOrientation = getOppositeOrientation( 26894 // If it's a grid and orientation is not set, it's a next/previous call, 26895 // which is inherently horizontal. up/down will call next with orientation 26896 // set to vertical by default (see below on up/down methods). 26897 isGrid ? orientation || "horizontal" : orientation 26898 ); 26899 const canLoop = focusLoop && focusLoop !== oppositeOrientation; 26900 const canWrap = isGrid && focusWrap && focusWrap !== oppositeOrientation; 26901 hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement; 26902 if (canLoop) { 26903 const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId); 26904 const sortedItems = flipItems(loopItems, activeId2, hasNullItem); 26905 const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); 26906 return nextItem2 == null ? void 0 : nextItem2.id; 26907 } 26908 if (canWrap) { 26909 const nextItem2 = findFirstEnabledItem( 26910 // We can use nextItems, which contains all the next items, including 26911 // items from other rows, to wrap between rows. However, if there is a 26912 // null item (the composite container), we'll only use the next items in 26913 // the row. So moving next from the last item will focus on the 26914 // composite container. On grid composites, horizontal navigation never 26915 // focuses on the composite container, only vertical. 26916 hasNullItem ? nextItemsInRow : nextItems, 26917 activeId2 26918 ); 26919 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; 26920 return nextId; 26921 } 26922 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); 26923 if (!nextItem && hasNullItem) { 26924 return null; 26925 } 26926 return nextItem == null ? void 0 : nextItem.id; 26927 }; 26928 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { 26929 setBaseElement: (element) => composite.setState("baseElement", element), 26930 setActiveId: (id) => composite.setState("activeId", id), 26931 move: (id) => { 26932 if (id === void 0) return; 26933 composite.setState("activeId", id); 26934 composite.setState("moves", (moves) => moves + 1); 26935 }, 26936 first: () => { 26937 var _a2; 26938 return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; 26939 }, 26940 last: () => { 26941 var _a2; 26942 return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; 26943 }, 26944 next: (skip) => { 26945 const { renderedItems, orientation } = composite.getState(); 26946 return getNextId(renderedItems, orientation, false, skip); 26947 }, 26948 previous: (skip) => { 26949 var _a2; 26950 const { renderedItems, orientation, includesBaseElement } = composite.getState(); 26951 const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId); 26952 const hasNullItem = !isGrid && includesBaseElement; 26953 return getNextId( 26954 reverseArray(renderedItems), 26955 orientation, 26956 hasNullItem, 26957 skip 26958 ); 26959 }, 26960 down: (skip) => { 26961 const { 26962 activeId: activeId2, 26963 renderedItems, 26964 focusShift, 26965 focusLoop, 26966 includesBaseElement 26967 } = composite.getState(); 26968 const shouldShift = focusShift && !skip; 26969 const verticalItems = verticalizeItems( 26970 flatten2DArray( 26971 normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift) 26972 ) 26973 ); 26974 const canLoop = focusLoop && focusLoop !== "horizontal"; 26975 const hasNullItem = canLoop && includesBaseElement; 26976 return getNextId(verticalItems, "vertical", hasNullItem, skip); 26977 }, 26978 up: (skip) => { 26979 const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState(); 26980 const shouldShift = focusShift && !skip; 26981 const verticalItems = verticalizeItems( 26982 reverseArray( 26983 flatten2DArray( 26984 normalizeRows( 26985 groupItemsByRows(renderedItems), 26986 activeId2, 26987 shouldShift 26988 ) 26989 ) 26990 ) 26991 ); 26992 const hasNullItem = includesBaseElement; 26993 return getNextId(verticalItems, "vertical", hasNullItem, skip); 26994 } 26995 }); 26996 } 26997 26998 26999 27000 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/6E4KKOSB.js 27001 "use client"; 27002 27003 27004 27005 27006 // src/disclosure/disclosure-store.ts 27007 function createDisclosureStore(props = {}) { 27008 const store = mergeStore( 27009 props.store, 27010 omit2(props.disclosure, ["contentElement", "disclosureElement"]) 27011 ); 27012 throwOnConflictingProps(props, store); 27013 const syncState = store == null ? void 0 : store.getState(); 27014 const open = defaultValue( 27015 props.open, 27016 syncState == null ? void 0 : syncState.open, 27017 props.defaultOpen, 27018 false 27019 ); 27020 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); 27021 const initialState = { 27022 open, 27023 animated, 27024 animating: !!animated && open, 27025 mounted: open, 27026 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), 27027 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) 27028 }; 27029 const disclosure = createStore(initialState, store); 27030 setup( 27031 disclosure, 27032 () => sync(disclosure, ["animated", "animating"], (state) => { 27033 if (state.animated) return; 27034 disclosure.setState("animating", false); 27035 }) 27036 ); 27037 setup( 27038 disclosure, 27039 () => subscribe(disclosure, ["open"], () => { 27040 if (!disclosure.getState().animated) return; 27041 disclosure.setState("animating", true); 27042 }) 27043 ); 27044 setup( 27045 disclosure, 27046 () => sync(disclosure, ["open", "animating"], (state) => { 27047 disclosure.setState("mounted", state.open || state.animating); 27048 }) 27049 ); 27050 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { 27051 disclosure: props.disclosure, 27052 setOpen: (value) => disclosure.setState("open", value), 27053 show: () => disclosure.setState("open", true), 27054 hide: () => disclosure.setState("open", false), 27055 toggle: () => disclosure.setState("open", (open2) => !open2), 27056 stopAnimation: () => disclosure.setState("animating", false), 27057 setContentElement: (value) => disclosure.setState("contentElement", value), 27058 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 27059 }); 27060 } 27061 27062 27063 27064 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/YOHCVXJB.js 27065 "use client"; 27066 27067 27068 // src/dialog/dialog-store.ts 27069 function createDialogStore(props = {}) { 27070 return createDisclosureStore(props); 27071 } 27072 27073 27074 27075 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/3UYWTADI.js 27076 "use client"; 27077 27078 27079 27080 27081 27082 // src/popover/popover-store.ts 27083 function createPopoverStore(_a = {}) { 27084 var _b = _a, { 27085 popover: otherPopover 27086 } = _b, props = _3YLGPPWQ_objRest(_b, [ 27087 "popover" 27088 ]); 27089 const store = mergeStore( 27090 props.store, 27091 omit2(otherPopover, [ 27092 "arrowElement", 27093 "anchorElement", 27094 "contentElement", 27095 "popoverElement", 27096 "disclosureElement" 27097 ]) 27098 ); 27099 throwOnConflictingProps(props, store); 27100 const syncState = store == null ? void 0 : store.getState(); 27101 const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); 27102 const placement = defaultValue( 27103 props.placement, 27104 syncState == null ? void 0 : syncState.placement, 27105 "bottom" 27106 ); 27107 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { 27108 placement, 27109 currentPlacement: placement, 27110 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), 27111 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), 27112 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), 27113 rendered: Symbol("rendered") 27114 }); 27115 const popover = createStore(initialState, dialog, store); 27116 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { 27117 setAnchorElement: (element) => popover.setState("anchorElement", element), 27118 setPopoverElement: (element) => popover.setState("popoverElement", element), 27119 setArrowElement: (element) => popover.setState("arrowElement", element), 27120 render: () => popover.setState("rendered", Symbol("rendered")) 27121 }); 27122 } 27123 27124 27125 27126 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/combobox/combobox-store.js 27127 "use client"; 27128 27129 27130 27131 27132 27133 27134 27135 27136 27137 27138 27139 27140 // src/combobox/combobox-store.ts 27141 var isTouchSafari = isSafari() && isTouchDevice(); 27142 function createComboboxStore(_a = {}) { 27143 var _b = _a, { 27144 tag 27145 } = _b, props = _3YLGPPWQ_objRest(_b, [ 27146 "tag" 27147 ]); 27148 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 27149 throwOnConflictingProps(props, store); 27150 const tagState = tag == null ? void 0 : tag.getState(); 27151 const syncState = store == null ? void 0 : store.getState(); 27152 const activeId = defaultValue( 27153 props.activeId, 27154 syncState == null ? void 0 : syncState.activeId, 27155 props.defaultActiveId, 27156 null 27157 ); 27158 const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 27159 activeId, 27160 includesBaseElement: defaultValue( 27161 props.includesBaseElement, 27162 syncState == null ? void 0 : syncState.includesBaseElement, 27163 true 27164 ), 27165 orientation: defaultValue( 27166 props.orientation, 27167 syncState == null ? void 0 : syncState.orientation, 27168 "vertical" 27169 ), 27170 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), 27171 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), 27172 virtualFocus: defaultValue( 27173 props.virtualFocus, 27174 syncState == null ? void 0 : syncState.virtualFocus, 27175 true 27176 ) 27177 })); 27178 const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 27179 placement: defaultValue( 27180 props.placement, 27181 syncState == null ? void 0 : syncState.placement, 27182 "bottom-start" 27183 ) 27184 })); 27185 const value = defaultValue( 27186 props.value, 27187 syncState == null ? void 0 : syncState.value, 27188 props.defaultValue, 27189 "" 27190 ); 27191 const selectedValue = defaultValue( 27192 props.selectedValue, 27193 syncState == null ? void 0 : syncState.selectedValue, 27194 tagState == null ? void 0 : tagState.values, 27195 props.defaultSelectedValue, 27196 "" 27197 ); 27198 const multiSelectable = Array.isArray(selectedValue); 27199 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { 27200 value, 27201 selectedValue, 27202 resetValueOnSelect: defaultValue( 27203 props.resetValueOnSelect, 27204 syncState == null ? void 0 : syncState.resetValueOnSelect, 27205 multiSelectable 27206 ), 27207 resetValueOnHide: defaultValue( 27208 props.resetValueOnHide, 27209 syncState == null ? void 0 : syncState.resetValueOnHide, 27210 multiSelectable && !tag 27211 ), 27212 activeValue: syncState == null ? void 0 : syncState.activeValue 27213 }); 27214 const combobox = createStore(initialState, composite, popover, store); 27215 if (isTouchSafari) { 27216 setup( 27217 combobox, 27218 () => sync(combobox, ["virtualFocus"], () => { 27219 combobox.setState("virtualFocus", false); 27220 }) 27221 ); 27222 } 27223 setup(combobox, () => { 27224 if (!tag) return; 27225 return chain( 27226 sync(combobox, ["selectedValue"], (state) => { 27227 if (!Array.isArray(state.selectedValue)) return; 27228 tag.setValues(state.selectedValue); 27229 }), 27230 sync(tag, ["values"], (state) => { 27231 combobox.setState("selectedValue", state.values); 27232 }) 27233 ); 27234 }); 27235 setup( 27236 combobox, 27237 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { 27238 if (!state.resetValueOnHide) return; 27239 if (state.mounted) return; 27240 combobox.setState("value", value); 27241 }) 27242 ); 27243 setup( 27244 combobox, 27245 () => sync(combobox, ["open"], (state) => { 27246 if (state.open) return; 27247 combobox.setState("activeId", activeId); 27248 combobox.setState("moves", 0); 27249 }) 27250 ); 27251 setup( 27252 combobox, 27253 () => sync(combobox, ["moves", "activeId"], (state, prevState) => { 27254 if (state.moves === prevState.moves) { 27255 combobox.setState("activeValue", void 0); 27256 } 27257 }) 27258 ); 27259 setup( 27260 combobox, 27261 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 27262 if (state.moves === prev.moves) return; 27263 const { activeId: activeId2 } = combobox.getState(); 27264 const activeItem = composite.item(activeId2); 27265 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); 27266 }) 27267 ); 27268 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), { 27269 tag, 27270 setValue: (value2) => combobox.setState("value", value2), 27271 resetValue: () => combobox.setState("value", initialState.value), 27272 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 27273 }); 27274 } 27275 27276 27277 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7BSNT25J.js 27278 "use client"; 27279 27280 27281 27282 27283 27284 27285 27286 // src/combobox/combobox-store.ts 27287 27288 function useComboboxStoreProps(store, update, props) { 27289 useUpdateEffect(update, [props.tag]); 27290 useStoreProps(store, props, "value", "setValue"); 27291 useStoreProps(store, props, "selectedValue", "setSelectedValue"); 27292 useStoreProps(store, props, "resetValueOnHide"); 27293 useStoreProps(store, props, "resetValueOnSelect"); 27294 return Object.assign( 27295 useCompositeStoreProps( 27296 usePopoverStoreProps(store, update, props), 27297 update, 27298 props 27299 ), 27300 { tag: props.tag } 27301 ); 27302 } 27303 function useComboboxStore(props = {}) { 27304 const tag = useTagContext(); 27305 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 27306 tag: props.tag !== void 0 ? props.tag : tag 27307 }); 27308 const [store, update] = _2GXGCHW6_useStore(createComboboxStore, props); 27309 return useComboboxStoreProps(store, update, props); 27310 } 27311 27312 27313 27314 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/RGUP62TM.js 27315 "use client"; 27316 27317 27318 // src/disclosure/disclosure-context.tsx 27319 var RGUP62TM_ctx = createStoreContext(); 27320 var useDisclosureContext = RGUP62TM_ctx.useContext; 27321 var useDisclosureScopedContext = RGUP62TM_ctx.useScopedContext; 27322 var useDisclosureProviderContext = RGUP62TM_ctx.useProviderContext; 27323 var DisclosureContextProvider = RGUP62TM_ctx.ContextProvider; 27324 var DisclosureScopedContextProvider = RGUP62TM_ctx.ScopedContextProvider; 27325 27326 27327 27328 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/DU4D3UCJ.js 27329 "use client"; 27330 27331 27332 27333 // src/dialog/dialog-context.tsx 27334 27335 var DU4D3UCJ_ctx = createStoreContext( 27336 [DisclosureContextProvider], 27337 [DisclosureScopedContextProvider] 27338 ); 27339 var useDialogContext = DU4D3UCJ_ctx.useContext; 27340 var useDialogScopedContext = DU4D3UCJ_ctx.useScopedContext; 27341 var useDialogProviderContext = DU4D3UCJ_ctx.useProviderContext; 27342 var DialogContextProvider = DU4D3UCJ_ctx.ContextProvider; 27343 var DialogScopedContextProvider = DU4D3UCJ_ctx.ScopedContextProvider; 27344 var DialogHeadingContext = (0,external_React_.createContext)(void 0); 27345 var DialogDescriptionContext = (0,external_React_.createContext)(void 0); 27346 27347 27348 27349 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/54MGSIOI.js 27350 "use client"; 27351 27352 27353 27354 // src/popover/popover-context.tsx 27355 var _54MGSIOI_ctx = createStoreContext( 27356 [DialogContextProvider], 27357 [DialogScopedContextProvider] 27358 ); 27359 var usePopoverContext = _54MGSIOI_ctx.useContext; 27360 var usePopoverScopedContext = _54MGSIOI_ctx.useScopedContext; 27361 var usePopoverProviderContext = _54MGSIOI_ctx.useProviderContext; 27362 var PopoverContextProvider = _54MGSIOI_ctx.ContextProvider; 27363 var PopoverScopedContextProvider = _54MGSIOI_ctx.ScopedContextProvider; 27364 27365 27366 27367 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/DWZ7E5TJ.js 27368 "use client"; 27369 27370 27371 27372 27373 // src/combobox/combobox-context.tsx 27374 27375 var ComboboxListRoleContext = (0,external_React_.createContext)( 27376 void 0 27377 ); 27378 var DWZ7E5TJ_ctx = createStoreContext( 27379 [PopoverContextProvider, CompositeContextProvider], 27380 [PopoverScopedContextProvider, CompositeScopedContextProvider] 27381 ); 27382 var useComboboxContext = DWZ7E5TJ_ctx.useContext; 27383 var useComboboxScopedContext = DWZ7E5TJ_ctx.useScopedContext; 27384 var useComboboxProviderContext = DWZ7E5TJ_ctx.useProviderContext; 27385 var ComboboxContextProvider = DWZ7E5TJ_ctx.ContextProvider; 27386 var ComboboxScopedContextProvider = DWZ7E5TJ_ctx.ScopedContextProvider; 27387 var ComboboxItemValueContext = (0,external_React_.createContext)( 27388 void 0 27389 ); 27390 var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); 27391 27392 27393 27394 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js 27395 "use client"; 27396 27397 27398 27399 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 27412 27413 27414 27415 // src/combobox/combobox-provider.tsx 27416 27417 function ComboboxProvider(props = {}) { 27418 const store = useComboboxStore(props); 27419 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children }); 27420 } 27421 27422 27423 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js 27424 "use client"; 27425 27426 27427 27428 27429 27430 27431 27432 27433 27434 27435 27436 // src/combobox/combobox-label.tsx 27437 27438 var TagName = "label"; 27439 var useComboboxLabel = createHook( 27440 function useComboboxLabel2(_a) { 27441 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 27442 const context = useComboboxProviderContext(); 27443 store = store || context; 27444 invariant( 27445 store, 27446 false && 0 27447 ); 27448 const comboboxId = store.useState((state) => { 27449 var _a2; 27450 return (_a2 = state.baseElement) == null ? void 0 : _a2.id; 27451 }); 27452 props = _3YLGPPWQ_spreadValues({ 27453 htmlFor: comboboxId 27454 }, props); 27455 return removeUndefinedValues(props); 27456 } 27457 ); 27458 var ComboboxLabel = memo2( 27459 forwardRef2(function ComboboxLabel2(props) { 27460 const htmlProps = useComboboxLabel(props); 27461 return createElement(TagName, htmlProps); 27462 }) 27463 ); 27464 27465 27466 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/74NFH3UH.js 27467 "use client"; 27468 27469 27470 27471 27472 27473 // src/popover/popover-anchor.tsx 27474 var _74NFH3UH_TagName = "div"; 27475 var usePopoverAnchor = createHook( 27476 function usePopoverAnchor2(_a) { 27477 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 27478 const context = usePopoverProviderContext(); 27479 store = store || context; 27480 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 27481 ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) 27482 }); 27483 return props; 27484 } 27485 ); 27486 var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { 27487 const htmlProps = usePopoverAnchor(props); 27488 return createElement(_74NFH3UH_TagName, htmlProps); 27489 }); 27490 27491 27492 27493 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js 27494 "use client"; 27495 27496 // src/composite/utils.ts 27497 27498 var _5VQZOHHZ_NULL_ITEM = { id: null }; 27499 function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { 27500 const index = items.findIndex((item) => item.id === activeId); 27501 return [ 27502 ...items.slice(index + 1), 27503 ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], 27504 ...items.slice(0, index) 27505 ]; 27506 } 27507 function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { 27508 return items.find((item) => { 27509 if (excludeId) { 27510 return !item.disabled && item.id !== excludeId; 27511 } 27512 return !item.disabled; 27513 }); 27514 } 27515 function getEnabledItem(store, id) { 27516 if (!id) return null; 27517 return store.item(id) || null; 27518 } 27519 function _5VQZOHHZ_groupItemsByRows(items) { 27520 const rows = []; 27521 for (const item of items) { 27522 const row = rows.find((currentRow) => { 27523 var _a; 27524 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 27525 }); 27526 if (row) { 27527 row.push(item); 27528 } else { 27529 rows.push([item]); 27530 } 27531 } 27532 return rows; 27533 } 27534 function selectTextField(element, collapseToEnd = false) { 27535 if (isTextField(element)) { 27536 element.setSelectionRange( 27537 collapseToEnd ? element.value.length : 0, 27538 element.value.length 27539 ); 27540 } else if (element.isContentEditable) { 27541 const selection = getDocument(element).getSelection(); 27542 selection == null ? void 0 : selection.selectAllChildren(element); 27543 if (collapseToEnd) { 27544 selection == null ? void 0 : selection.collapseToEnd(); 27545 } 27546 } 27547 } 27548 var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); 27549 function focusSilently(element) { 27550 element[FOCUS_SILENTLY] = true; 27551 element.focus({ preventScroll: true }); 27552 } 27553 function silentlyFocused(element) { 27554 const isSilentlyFocused = element[FOCUS_SILENTLY]; 27555 delete element[FOCUS_SILENTLY]; 27556 return isSilentlyFocused; 27557 } 27558 function isItem(store, element, exclude) { 27559 if (!element) return false; 27560 if (element === exclude) return false; 27561 const item = store.item(element.id); 27562 if (!item) return false; 27563 if (exclude && item.element === exclude) return false; 27564 return true; 27565 } 27566 27567 27568 27569 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js 27570 "use client"; 27571 27572 // src/focusable/focusable-context.tsx 27573 27574 var FocusableContext = (0,external_React_.createContext)(true); 27575 27576 27577 27578 ;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/focus.js 27579 "use client"; 27580 27581 27582 27583 // src/utils/focus.ts 27584 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'])"; 27585 function hasNegativeTabIndex(element) { 27586 const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); 27587 return tabIndex < 0; 27588 } 27589 function isFocusable(element) { 27590 if (!element.matches(selector)) return false; 27591 if (!isVisible(element)) return false; 27592 if (element.closest("[inert]")) return false; 27593 return true; 27594 } 27595 function isTabbable(element) { 27596 if (!isFocusable(element)) return false; 27597 if (hasNegativeTabIndex(element)) return false; 27598 if (!("form" in element)) return true; 27599 if (!element.form) return true; 27600 if (element.checked) return true; 27601 if (element.type !== "radio") return true; 27602 const radioGroup = element.form.elements.namedItem(element.name); 27603 if (!radioGroup) return true; 27604 if (!("length" in radioGroup)) return true; 27605 const activeElement = getActiveElement(element); 27606 if (!activeElement) return true; 27607 if (activeElement === element) return true; 27608 if (!("form" in activeElement)) return true; 27609 if (activeElement.form !== element.form) return true; 27610 if (activeElement.name !== element.name) return true; 27611 return false; 27612 } 27613 function getAllFocusableIn(container, includeContainer) { 27614 const elements = Array.from( 27615 container.querySelectorAll(selector) 27616 ); 27617 if (includeContainer) { 27618 elements.unshift(container); 27619 } 27620 const focusableElements = elements.filter(isFocusable); 27621 focusableElements.forEach((element, i) => { 27622 if (isFrame(element) && element.contentDocument) { 27623 const frameBody = element.contentDocument.body; 27624 focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); 27625 } 27626 }); 27627 return focusableElements; 27628 } 27629 function getAllFocusable(includeBody) { 27630 return getAllFocusableIn(document.body, includeBody); 27631 } 27632 function getFirstFocusableIn(container, includeContainer) { 27633 const [first] = getAllFocusableIn(container, includeContainer); 27634 return first || null; 27635 } 27636 function getFirstFocusable(includeBody) { 27637 return getFirstFocusableIn(document.body, includeBody); 27638 } 27639 function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { 27640 const elements = Array.from( 27641 container.querySelectorAll(selector) 27642 ); 27643 const tabbableElements = elements.filter(isTabbable); 27644 if (includeContainer && isTabbable(container)) { 27645 tabbableElements.unshift(container); 27646 } 27647 tabbableElements.forEach((element, i) => { 27648 if (isFrame(element) && element.contentDocument) { 27649 const frameBody = element.contentDocument.body; 27650 const allFrameTabbable = getAllTabbableIn( 27651 frameBody, 27652 false, 27653 fallbackToFocusable 27654 ); 27655 tabbableElements.splice(i, 1, ...allFrameTabbable); 27656 } 27657 }); 27658 if (!tabbableElements.length && fallbackToFocusable) { 27659 return elements; 27660 } 27661 return tabbableElements; 27662 } 27663 function getAllTabbable(fallbackToFocusable) { 27664 return getAllTabbableIn(document.body, false, fallbackToFocusable); 27665 } 27666 function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { 27667 const [first] = getAllTabbableIn( 27668 container, 27669 includeContainer, 27670 fallbackToFocusable 27671 ); 27672 return first || null; 27673 } 27674 function getFirstTabbable(fallbackToFocusable) { 27675 return getFirstTabbableIn(document.body, false, fallbackToFocusable); 27676 } 27677 function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { 27678 const allTabbable = getAllTabbableIn( 27679 container, 27680 includeContainer, 27681 fallbackToFocusable 27682 ); 27683 return allTabbable[allTabbable.length - 1] || null; 27684 } 27685 function getLastTabbable(fallbackToFocusable) { 27686 return getLastTabbableIn(document.body, false, fallbackToFocusable); 27687 } 27688 function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { 27689 const activeElement = getActiveElement(container); 27690 const allFocusable = getAllFocusableIn(container, includeContainer); 27691 const activeIndex = allFocusable.indexOf(activeElement); 27692 const nextFocusableElements = allFocusable.slice(activeIndex + 1); 27693 return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; 27694 } 27695 function getNextTabbable(fallbackToFirst, fallbackToFocusable) { 27696 return getNextTabbableIn( 27697 document.body, 27698 false, 27699 fallbackToFirst, 27700 fallbackToFocusable 27701 ); 27702 } 27703 function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { 27704 const activeElement = getActiveElement(container); 27705 const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); 27706 const activeIndex = allFocusable.indexOf(activeElement); 27707 const previousFocusableElements = allFocusable.slice(activeIndex + 1); 27708 return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; 27709 } 27710 function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { 27711 return getPreviousTabbableIn( 27712 document.body, 27713 false, 27714 fallbackToFirst, 27715 fallbackToFocusable 27716 ); 27717 } 27718 function getClosestFocusable(element) { 27719 while (element && !isFocusable(element)) { 27720 element = element.closest(selector); 27721 } 27722 return element || null; 27723 } 27724 function hasFocus(element) { 27725 const activeElement = HWOIWM4O_getActiveElement(element); 27726 if (!activeElement) return false; 27727 if (activeElement === element) return true; 27728 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 27729 if (!activeDescendant) return false; 27730 return activeDescendant === element.id; 27731 } 27732 function hasFocusWithin(element) { 27733 const activeElement = HWOIWM4O_getActiveElement(element); 27734 if (!activeElement) return false; 27735 if (contains(element, activeElement)) return true; 27736 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 27737 if (!activeDescendant) return false; 27738 if (!("id" in element)) return false; 27739 if (activeDescendant === element.id) return true; 27740 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 27741 } 27742 function focusIfNeeded(element) { 27743 if (!hasFocusWithin(element) && isFocusable(element)) { 27744 element.focus(); 27745 } 27746 } 27747 function disableFocus(element) { 27748 var _a; 27749 const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; 27750 element.setAttribute("data-tabindex", currentTabindex); 27751 element.setAttribute("tabindex", "-1"); 27752 } 27753 function disableFocusIn(container, includeContainer) { 27754 const tabbableElements = getAllTabbableIn(container, includeContainer); 27755 for (const element of tabbableElements) { 27756 disableFocus(element); 27757 } 27758 } 27759 function restoreFocusIn(container) { 27760 const elements = container.querySelectorAll("[data-tabindex]"); 27761 const restoreTabIndex = (element) => { 27762 const tabindex = element.getAttribute("data-tabindex"); 27763 element.removeAttribute("data-tabindex"); 27764 if (tabindex) { 27765 element.setAttribute("tabindex", tabindex); 27766 } else { 27767 element.removeAttribute("tabindex"); 27768 } 27769 }; 27770 if (container.hasAttribute("data-tabindex")) { 27771 restoreTabIndex(container); 27772 } 27773 for (const element of elements) { 27774 restoreTabIndex(element); 27775 } 27776 } 27777 function focusIntoView(element, options) { 27778 if (!("scrollIntoView" in element)) { 27779 element.focus(); 27780 } else { 27781 element.focus({ preventScroll: true }); 27782 element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); 27783 } 27784 } 27785 27786 27787 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OD7ALSX5.js 27788 "use client"; 27789 27790 27791 27792 27793 27794 // src/focusable/focusable.tsx 27795 27796 27797 27798 27799 27800 27801 var OD7ALSX5_TagName = "div"; 27802 var isSafariBrowser = isSafari(); 27803 var alwaysFocusVisibleInputTypes = [ 27804 "text", 27805 "search", 27806 "url", 27807 "tel", 27808 "email", 27809 "password", 27810 "number", 27811 "date", 27812 "month", 27813 "week", 27814 "time", 27815 "datetime", 27816 "datetime-local" 27817 ]; 27818 var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); 27819 function isSafariFocusAncestor(element) { 27820 if (!element) return false; 27821 return !!element[safariFocusAncestorSymbol]; 27822 } 27823 function markSafariFocusAncestor(element, value) { 27824 if (!element) return; 27825 element[safariFocusAncestorSymbol] = value; 27826 } 27827 function isAlwaysFocusVisible(element) { 27828 const { tagName, readOnly, type } = element; 27829 if (tagName === "TEXTAREA" && !readOnly) return true; 27830 if (tagName === "SELECT" && !readOnly) return true; 27831 if (tagName === "INPUT" && !readOnly) { 27832 return alwaysFocusVisibleInputTypes.includes(type); 27833 } 27834 if (element.isContentEditable) return true; 27835 const role = element.getAttribute("role"); 27836 if (role === "combobox" && element.dataset.name) { 27837 return true; 27838 } 27839 return false; 27840 } 27841 function getLabels(element) { 27842 if ("labels" in element) { 27843 return element.labels; 27844 } 27845 return null; 27846 } 27847 function isNativeCheckboxOrRadio(element) { 27848 const tagName = element.tagName.toLowerCase(); 27849 if (tagName === "input" && element.type) { 27850 return element.type === "radio" || element.type === "checkbox"; 27851 } 27852 return false; 27853 } 27854 function isNativeTabbable(tagName) { 27855 if (!tagName) return true; 27856 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 27857 } 27858 function supportsDisabledAttribute(tagName) { 27859 if (!tagName) return true; 27860 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 27861 } 27862 function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { 27863 if (!focusable) { 27864 return tabIndexProp; 27865 } 27866 if (trulyDisabled) { 27867 if (nativeTabbable && !supportsDisabled) { 27868 return -1; 27869 } 27870 return; 27871 } 27872 if (nativeTabbable) { 27873 return tabIndexProp; 27874 } 27875 return tabIndexProp || 0; 27876 } 27877 function useDisableEvent(onEvent, disabled) { 27878 return useEvent((event) => { 27879 onEvent == null ? void 0 : onEvent(event); 27880 if (event.defaultPrevented) return; 27881 if (disabled) { 27882 event.stopPropagation(); 27883 event.preventDefault(); 27884 } 27885 }); 27886 } 27887 var isKeyboardModality = true; 27888 function onGlobalMouseDown(event) { 27889 const target = event.target; 27890 if (target && "hasAttribute" in target) { 27891 if (!target.hasAttribute("data-focus-visible")) { 27892 isKeyboardModality = false; 27893 } 27894 } 27895 } 27896 function onGlobalKeyDown(event) { 27897 if (event.metaKey) return; 27898 if (event.ctrlKey) return; 27899 if (event.altKey) return; 27900 isKeyboardModality = true; 27901 } 27902 var useFocusable = createHook( 27903 function useFocusable2(_a) { 27904 var _b = _a, { 27905 focusable = true, 27906 accessibleWhenDisabled, 27907 autoFocus, 27908 onFocusVisible 27909 } = _b, props = __objRest(_b, [ 27910 "focusable", 27911 "accessibleWhenDisabled", 27912 "autoFocus", 27913 "onFocusVisible" 27914 ]); 27915 const ref = (0,external_React_.useRef)(null); 27916 (0,external_React_.useEffect)(() => { 27917 if (!focusable) return; 27918 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 27919 addGlobalEventListener("keydown", onGlobalKeyDown, true); 27920 }, [focusable]); 27921 if (isSafariBrowser) { 27922 (0,external_React_.useEffect)(() => { 27923 if (!focusable) return; 27924 const element = ref.current; 27925 if (!element) return; 27926 if (!isNativeCheckboxOrRadio(element)) return; 27927 const labels = getLabels(element); 27928 if (!labels) return; 27929 const onMouseUp = () => queueMicrotask(() => element.focus()); 27930 for (const label of labels) { 27931 label.addEventListener("mouseup", onMouseUp); 27932 } 27933 return () => { 27934 for (const label of labels) { 27935 label.removeEventListener("mouseup", onMouseUp); 27936 } 27937 }; 27938 }, [focusable]); 27939 } 27940 const disabled = focusable && disabledFromProps(props); 27941 const trulyDisabled = !!disabled && !accessibleWhenDisabled; 27942 const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); 27943 (0,external_React_.useEffect)(() => { 27944 if (!focusable) return; 27945 if (trulyDisabled && focusVisible) { 27946 setFocusVisible(false); 27947 } 27948 }, [focusable, trulyDisabled, focusVisible]); 27949 (0,external_React_.useEffect)(() => { 27950 if (!focusable) return; 27951 if (!focusVisible) return; 27952 const element = ref.current; 27953 if (!element) return; 27954 if (typeof IntersectionObserver === "undefined") return; 27955 const observer = new IntersectionObserver(() => { 27956 if (!isFocusable(element)) { 27957 setFocusVisible(false); 27958 } 27959 }); 27960 observer.observe(element); 27961 return () => observer.disconnect(); 27962 }, [focusable, focusVisible]); 27963 const onKeyPressCapture = useDisableEvent( 27964 props.onKeyPressCapture, 27965 disabled 27966 ); 27967 const onMouseDownCapture = useDisableEvent( 27968 props.onMouseDownCapture, 27969 disabled 27970 ); 27971 const onClickCapture = useDisableEvent(props.onClickCapture, disabled); 27972 const onMouseDownProp = props.onMouseDown; 27973 const onMouseDown = useEvent((event) => { 27974 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 27975 if (event.defaultPrevented) return; 27976 if (!focusable) return; 27977 const element = event.currentTarget; 27978 if (!isSafariBrowser) return; 27979 if (isPortalEvent(event)) return; 27980 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; 27981 let receivedFocus = false; 27982 const onFocus = () => { 27983 receivedFocus = true; 27984 }; 27985 const options = { capture: true, once: true }; 27986 element.addEventListener("focusin", onFocus, options); 27987 const focusableContainer = getClosestFocusable(element.parentElement); 27988 markSafariFocusAncestor(focusableContainer, true); 27989 queueBeforeEvent(element, "mouseup", () => { 27990 element.removeEventListener("focusin", onFocus, true); 27991 markSafariFocusAncestor(focusableContainer, false); 27992 if (receivedFocus) return; 27993 focusIfNeeded(element); 27994 }); 27995 }); 27996 const handleFocusVisible = (event, currentTarget) => { 27997 if (currentTarget) { 27998 event.currentTarget = currentTarget; 27999 } 28000 if (!focusable) return; 28001 const element = event.currentTarget; 28002 if (!element) return; 28003 if (!hasFocus(element)) return; 28004 onFocusVisible == null ? void 0 : onFocusVisible(event); 28005 if (event.defaultPrevented) return; 28006 element.dataset.focusVisible = "true"; 28007 setFocusVisible(true); 28008 }; 28009 const onKeyDownCaptureProp = props.onKeyDownCapture; 28010 const onKeyDownCapture = useEvent((event) => { 28011 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); 28012 if (event.defaultPrevented) return; 28013 if (!focusable) return; 28014 if (focusVisible) return; 28015 if (event.metaKey) return; 28016 if (event.altKey) return; 28017 if (event.ctrlKey) return; 28018 if (!isSelfTarget(event)) return; 28019 const element = event.currentTarget; 28020 const applyFocusVisible = () => handleFocusVisible(event, element); 28021 queueBeforeEvent(element, "focusout", applyFocusVisible); 28022 }); 28023 const onFocusCaptureProp = props.onFocusCapture; 28024 const onFocusCapture = useEvent((event) => { 28025 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 28026 if (event.defaultPrevented) return; 28027 if (!focusable) return; 28028 if (!isSelfTarget(event)) { 28029 setFocusVisible(false); 28030 return; 28031 } 28032 const element = event.currentTarget; 28033 const applyFocusVisible = () => handleFocusVisible(event, element); 28034 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { 28035 queueBeforeEvent(event.target, "focusout", applyFocusVisible); 28036 } else { 28037 setFocusVisible(false); 28038 } 28039 }); 28040 const onBlurProp = props.onBlur; 28041 const onBlur = useEvent((event) => { 28042 onBlurProp == null ? void 0 : onBlurProp(event); 28043 if (!focusable) return; 28044 if (!isFocusEventOutside(event)) return; 28045 setFocusVisible(false); 28046 }); 28047 const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); 28048 const autoFocusRef = useEvent((element) => { 28049 if (!focusable) return; 28050 if (!autoFocus) return; 28051 if (!element) return; 28052 if (!autoFocusOnShow) return; 28053 queueMicrotask(() => { 28054 if (hasFocus(element)) return; 28055 if (!isFocusable(element)) return; 28056 element.focus(); 28057 }); 28058 }); 28059 const tagName = useTagName(ref); 28060 const nativeTabbable = focusable && isNativeTabbable(tagName); 28061 const supportsDisabled = focusable && supportsDisabledAttribute(tagName); 28062 const styleProp = props.style; 28063 const style = (0,external_React_.useMemo)(() => { 28064 if (trulyDisabled) { 28065 return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); 28066 } 28067 return styleProp; 28068 }, [trulyDisabled, styleProp]); 28069 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28070 "data-focus-visible": focusable && focusVisible || void 0, 28071 "data-autofocus": autoFocus || void 0, 28072 "aria-disabled": disabled || void 0 28073 }, props), { 28074 ref: useMergeRefs(ref, autoFocusRef, props.ref), 28075 style, 28076 tabIndex: getTabIndex( 28077 focusable, 28078 trulyDisabled, 28079 nativeTabbable, 28080 supportsDisabled, 28081 props.tabIndex 28082 ), 28083 disabled: supportsDisabled && trulyDisabled ? true : void 0, 28084 // TODO: Test Focusable contentEditable. 28085 contentEditable: disabled ? void 0 : props.contentEditable, 28086 onKeyPressCapture, 28087 onClickCapture, 28088 onMouseDownCapture, 28089 onMouseDown, 28090 onKeyDownCapture, 28091 onFocusCapture, 28092 onBlur 28093 }); 28094 return removeUndefinedValues(props); 28095 } 28096 ); 28097 var Focusable = forwardRef2(function Focusable2(props) { 28098 const htmlProps = useFocusable(props); 28099 return createElement(OD7ALSX5_TagName, htmlProps); 28100 }); 28101 28102 28103 28104 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/2BDG6X5K.js 28105 "use client"; 28106 28107 28108 28109 28110 28111 28112 28113 // src/composite/composite.tsx 28114 28115 28116 28117 28118 28119 28120 28121 var _2BDG6X5K_TagName = "div"; 28122 function isGrid(items) { 28123 return items.some((item) => !!item.rowId); 28124 } 28125 function isPrintableKey(event) { 28126 const target = event.target; 28127 if (target && !isTextField(target)) return false; 28128 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 28129 } 28130 function isModifierKey(event) { 28131 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 28132 } 28133 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { 28134 return useEvent((event) => { 28135 var _a; 28136 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); 28137 if (event.defaultPrevented) return; 28138 if (event.isPropagationStopped()) return; 28139 if (!isSelfTarget(event)) return; 28140 if (isModifierKey(event)) return; 28141 if (isPrintableKey(event)) return; 28142 const state = store.getState(); 28143 const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; 28144 if (!activeElement) return; 28145 const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]); 28146 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; 28147 if (activeElement !== previousElement) { 28148 activeElement.focus(); 28149 } 28150 if (!fireKeyboardEvent(activeElement, event.type, eventInit)) { 28151 event.preventDefault(); 28152 } 28153 if (event.currentTarget.contains(activeElement)) { 28154 event.stopPropagation(); 28155 } 28156 }); 28157 } 28158 function findFirstEnabledItemInTheLastRow(items) { 28159 return _5VQZOHHZ_findFirstEnabledItem( 28160 flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items))) 28161 ); 28162 } 28163 function useScheduleFocus(store) { 28164 const [scheduled, setScheduled] = (0,external_React_.useState)(false); 28165 const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []); 28166 const activeItem = store.useState( 28167 (state) => getEnabledItem(store, state.activeId) 28168 ); 28169 (0,external_React_.useEffect)(() => { 28170 const activeElement = activeItem == null ? void 0 : activeItem.element; 28171 if (!scheduled) return; 28172 if (!activeElement) return; 28173 setScheduled(false); 28174 activeElement.focus({ preventScroll: true }); 28175 }, [activeItem, scheduled]); 28176 return schedule; 28177 } 28178 var useComposite = createHook( 28179 function useComposite2(_a) { 28180 var _b = _a, { 28181 store, 28182 composite = true, 28183 focusOnMove = composite, 28184 moveOnKeyPress = true 28185 } = _b, props = __objRest(_b, [ 28186 "store", 28187 "composite", 28188 "focusOnMove", 28189 "moveOnKeyPress" 28190 ]); 28191 const context = useCompositeProviderContext(); 28192 store = store || context; 28193 invariant( 28194 store, 28195 false && 0 28196 ); 28197 const ref = (0,external_React_.useRef)(null); 28198 const previousElementRef = (0,external_React_.useRef)(null); 28199 const scheduleFocus = useScheduleFocus(store); 28200 const moves = store.useState("moves"); 28201 const [, setBaseElement] = useTransactionState( 28202 composite ? store.setBaseElement : null 28203 ); 28204 (0,external_React_.useEffect)(() => { 28205 var _a2; 28206 if (!store) return; 28207 if (!moves) return; 28208 if (!composite) return; 28209 if (!focusOnMove) return; 28210 const { activeId: activeId2 } = store.getState(); 28211 const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 28212 if (!itemElement) return; 28213 focusIntoView(itemElement); 28214 }, [store, moves, composite, focusOnMove]); 28215 useSafeLayoutEffect(() => { 28216 if (!store) return; 28217 if (!moves) return; 28218 if (!composite) return; 28219 const { baseElement, activeId: activeId2 } = store.getState(); 28220 const isSelfAcive = activeId2 === null; 28221 if (!isSelfAcive) return; 28222 if (!baseElement) return; 28223 const previousElement = previousElementRef.current; 28224 previousElementRef.current = null; 28225 if (previousElement) { 28226 fireBlurEvent(previousElement, { relatedTarget: baseElement }); 28227 } 28228 if (!hasFocus(baseElement)) { 28229 baseElement.focus(); 28230 } 28231 }, [store, moves, composite]); 28232 const activeId = store.useState("activeId"); 28233 const virtualFocus = store.useState("virtualFocus"); 28234 useSafeLayoutEffect(() => { 28235 var _a2; 28236 if (!store) return; 28237 if (!composite) return; 28238 if (!virtualFocus) return; 28239 const previousElement = previousElementRef.current; 28240 previousElementRef.current = null; 28241 if (!previousElement) return; 28242 const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element; 28243 const relatedTarget = activeElement || HWOIWM4O_getActiveElement(previousElement); 28244 if (relatedTarget === previousElement) return; 28245 fireBlurEvent(previousElement, { relatedTarget }); 28246 }, [store, activeId, virtualFocus, composite]); 28247 const onKeyDownCapture = useKeyboardEventProxy( 28248 store, 28249 props.onKeyDownCapture, 28250 previousElementRef 28251 ); 28252 const onKeyUpCapture = useKeyboardEventProxy( 28253 store, 28254 props.onKeyUpCapture, 28255 previousElementRef 28256 ); 28257 const onFocusCaptureProp = props.onFocusCapture; 28258 const onFocusCapture = useEvent((event) => { 28259 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 28260 if (event.defaultPrevented) return; 28261 if (!store) return; 28262 const { virtualFocus: virtualFocus2 } = store.getState(); 28263 if (!virtualFocus2) return; 28264 const previousActiveElement = event.relatedTarget; 28265 const isSilentlyFocused = silentlyFocused(event.currentTarget); 28266 if (isSelfTarget(event) && isSilentlyFocused) { 28267 event.stopPropagation(); 28268 previousElementRef.current = previousActiveElement; 28269 } 28270 }); 28271 const onFocusProp = props.onFocus; 28272 const onFocus = useEvent((event) => { 28273 onFocusProp == null ? void 0 : onFocusProp(event); 28274 if (event.defaultPrevented) return; 28275 if (!composite) return; 28276 if (!store) return; 28277 const { relatedTarget } = event; 28278 const { virtualFocus: virtualFocus2 } = store.getState(); 28279 if (virtualFocus2) { 28280 if (isSelfTarget(event) && !isItem(store, relatedTarget)) { 28281 queueMicrotask(scheduleFocus); 28282 } 28283 } else if (isSelfTarget(event)) { 28284 store.setActiveId(null); 28285 } 28286 }); 28287 const onBlurCaptureProp = props.onBlurCapture; 28288 const onBlurCapture = useEvent((event) => { 28289 var _a2; 28290 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 28291 if (event.defaultPrevented) return; 28292 if (!store) return; 28293 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); 28294 if (!virtualFocus2) return; 28295 const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 28296 const nextActiveElement = event.relatedTarget; 28297 const nextActiveElementIsItem = isItem(store, nextActiveElement); 28298 const previousElement = previousElementRef.current; 28299 previousElementRef.current = null; 28300 if (isSelfTarget(event) && nextActiveElementIsItem) { 28301 if (nextActiveElement === activeElement) { 28302 if (previousElement && previousElement !== nextActiveElement) { 28303 fireBlurEvent(previousElement, event); 28304 } 28305 } else if (activeElement) { 28306 fireBlurEvent(activeElement, event); 28307 } else if (previousElement) { 28308 fireBlurEvent(previousElement, event); 28309 } 28310 event.stopPropagation(); 28311 } else { 28312 const targetIsItem = isItem(store, event.target); 28313 if (!targetIsItem && activeElement) { 28314 fireBlurEvent(activeElement, event); 28315 } 28316 } 28317 }); 28318 const onKeyDownProp = props.onKeyDown; 28319 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 28320 const onKeyDown = useEvent((event) => { 28321 var _a2; 28322 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 28323 if (event.defaultPrevented) return; 28324 if (!store) return; 28325 if (!isSelfTarget(event)) return; 28326 const { orientation, items, renderedItems, activeId: activeId2 } = store.getState(); 28327 const activeItem = getEnabledItem(store, activeId2); 28328 if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return; 28329 const isVertical = orientation !== "horizontal"; 28330 const isHorizontal = orientation !== "vertical"; 28331 const grid = isGrid(renderedItems); 28332 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; 28333 if (isHorizontalKey && isTextField(event.currentTarget)) return; 28334 const up = () => { 28335 if (grid) { 28336 const item = items && findFirstEnabledItemInTheLastRow(items); 28337 return item == null ? void 0 : item.id; 28338 } 28339 return store == null ? void 0 : store.last(); 28340 }; 28341 const keyMap = { 28342 ArrowUp: (grid || isVertical) && up, 28343 ArrowRight: (grid || isHorizontal) && store.first, 28344 ArrowDown: (grid || isVertical) && store.first, 28345 ArrowLeft: (grid || isHorizontal) && store.last, 28346 Home: store.first, 28347 End: store.last, 28348 PageUp: store.first, 28349 PageDown: store.last 28350 }; 28351 const action = keyMap[event.key]; 28352 if (action) { 28353 const id = action(); 28354 if (id !== void 0) { 28355 if (!moveOnKeyPressProp(event)) return; 28356 event.preventDefault(); 28357 store.move(id); 28358 } 28359 } 28360 }); 28361 props = useWrapElement( 28362 props, 28363 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }), 28364 [store] 28365 ); 28366 const activeDescendant = store.useState((state) => { 28367 var _a2; 28368 if (!store) return; 28369 if (!composite) return; 28370 if (!state.virtualFocus) return; 28371 return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id; 28372 }); 28373 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28374 "aria-activedescendant": activeDescendant 28375 }, props), { 28376 ref: useMergeRefs(ref, setBaseElement, props.ref), 28377 onKeyDownCapture, 28378 onKeyUpCapture, 28379 onFocusCapture, 28380 onFocus, 28381 onBlurCapture, 28382 onKeyDown 28383 }); 28384 const focusable = store.useState( 28385 (state) => composite && (state.virtualFocus || state.activeId === null) 28386 ); 28387 props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props)); 28388 return props; 28389 } 28390 ); 28391 var Composite = forwardRef2(function Composite2(props) { 28392 const htmlProps = useComposite(props); 28393 return createElement(_2BDG6X5K_TagName, htmlProps); 28394 }); 28395 28396 28397 28398 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox.js 28399 "use client"; 28400 28401 28402 28403 28404 28405 28406 28407 28408 28409 28410 28411 28412 28413 28414 28415 28416 // src/combobox/combobox.tsx 28417 28418 28419 28420 28421 28422 28423 var combobox_TagName = "input"; 28424 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 28425 if (!autoSelect) return false; 28426 const firstItem = items.find((item) => !item.disabled && item.value); 28427 return (firstItem == null ? void 0 : firstItem.value) === activeValue; 28428 } 28429 function hasCompletionString(value, activeValue) { 28430 if (!activeValue) return false; 28431 if (value == null) return false; 28432 value = normalizeString(value); 28433 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; 28434 } 28435 function isInputEvent(event) { 28436 return event.type === "input"; 28437 } 28438 function isAriaAutoCompleteValue(value) { 28439 return value === "inline" || value === "list" || value === "both" || value === "none"; 28440 } 28441 function getDefaultAutoSelectId(items) { 28442 const item = items.find((item2) => { 28443 var _a; 28444 if (item2.disabled) return false; 28445 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; 28446 }); 28447 return item == null ? void 0 : item.id; 28448 } 28449 var useCombobox = createHook( 28450 function useCombobox2(_a) { 28451 var _b = _a, { 28452 store, 28453 focusable = true, 28454 autoSelect: autoSelectProp = false, 28455 getAutoSelectId, 28456 setValueOnChange, 28457 showMinLength = 0, 28458 showOnChange, 28459 showOnMouseDown, 28460 showOnClick = showOnMouseDown, 28461 showOnKeyDown, 28462 showOnKeyPress = showOnKeyDown, 28463 blurActiveItemOnClick, 28464 setValueOnClick = true, 28465 moveOnKeyPress = true, 28466 autoComplete = "list" 28467 } = _b, props = __objRest(_b, [ 28468 "store", 28469 "focusable", 28470 "autoSelect", 28471 "getAutoSelectId", 28472 "setValueOnChange", 28473 "showMinLength", 28474 "showOnChange", 28475 "showOnMouseDown", 28476 "showOnClick", 28477 "showOnKeyDown", 28478 "showOnKeyPress", 28479 "blurActiveItemOnClick", 28480 "setValueOnClick", 28481 "moveOnKeyPress", 28482 "autoComplete" 28483 ]); 28484 const context = useComboboxProviderContext(); 28485 store = store || context; 28486 invariant( 28487 store, 28488 false && 0 28489 ); 28490 const ref = (0,external_React_.useRef)(null); 28491 const [valueUpdated, forceValueUpdate] = useForceUpdate(); 28492 const canAutoSelectRef = (0,external_React_.useRef)(false); 28493 const composingRef = (0,external_React_.useRef)(false); 28494 const autoSelect = store.useState( 28495 (state) => state.virtualFocus && autoSelectProp 28496 ); 28497 const inline = autoComplete === "inline" || autoComplete === "both"; 28498 const [canInline, setCanInline] = (0,external_React_.useState)(inline); 28499 useUpdateLayoutEffect(() => { 28500 if (!inline) return; 28501 setCanInline(true); 28502 }, [inline]); 28503 const storeValue = store.useState("value"); 28504 const prevSelectedValueRef = (0,external_React_.useRef)(); 28505 (0,external_React_.useEffect)(() => { 28506 return sync(store, ["selectedValue", "activeId"], (_, prev) => { 28507 prevSelectedValueRef.current = prev.selectedValue; 28508 }); 28509 }, []); 28510 const inlineActiveValue = store.useState((state) => { 28511 var _a2; 28512 if (!inline) return; 28513 if (!canInline) return; 28514 if (state.activeValue && Array.isArray(state.selectedValue)) { 28515 if (state.selectedValue.includes(state.activeValue)) return; 28516 if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return; 28517 } 28518 return state.activeValue; 28519 }); 28520 const items = store.useState("renderedItems"); 28521 const open = store.useState("open"); 28522 const contentElement = store.useState("contentElement"); 28523 const value = (0,external_React_.useMemo)(() => { 28524 if (!inline) return storeValue; 28525 if (!canInline) return storeValue; 28526 const firstItemAutoSelected = isFirstItemAutoSelected( 28527 items, 28528 inlineActiveValue, 28529 autoSelect 28530 ); 28531 if (firstItemAutoSelected) { 28532 if (hasCompletionString(storeValue, inlineActiveValue)) { 28533 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; 28534 return storeValue + slice; 28535 } 28536 return storeValue; 28537 } 28538 return inlineActiveValue || storeValue; 28539 }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]); 28540 (0,external_React_.useEffect)(() => { 28541 const element = ref.current; 28542 if (!element) return; 28543 const onCompositeItemMove = () => setCanInline(true); 28544 element.addEventListener("combobox-item-move", onCompositeItemMove); 28545 return () => { 28546 element.removeEventListener("combobox-item-move", onCompositeItemMove); 28547 }; 28548 }, []); 28549 (0,external_React_.useEffect)(() => { 28550 if (!inline) return; 28551 if (!canInline) return; 28552 if (!inlineActiveValue) return; 28553 const firstItemAutoSelected = isFirstItemAutoSelected( 28554 items, 28555 inlineActiveValue, 28556 autoSelect 28557 ); 28558 if (!firstItemAutoSelected) return; 28559 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 28560 let cleanup = PBFD2E7P_noop; 28561 queueMicrotask(() => { 28562 const element = ref.current; 28563 if (!element) return; 28564 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 28565 const nextStart = storeValue.length; 28566 const nextEnd = inlineActiveValue.length; 28567 setSelectionRange(element, nextStart, nextEnd); 28568 cleanup = () => { 28569 if (!hasFocus(element)) return; 28570 const { start, end } = getTextboxSelection(element); 28571 if (start !== nextStart) return; 28572 if (end !== nextEnd) return; 28573 setSelectionRange(element, prevStart, prevEnd); 28574 }; 28575 }); 28576 return () => cleanup(); 28577 }, [ 28578 valueUpdated, 28579 inline, 28580 canInline, 28581 inlineActiveValue, 28582 items, 28583 autoSelect, 28584 storeValue 28585 ]); 28586 const scrollingElementRef = (0,external_React_.useRef)(null); 28587 const getAutoSelectIdProp = useEvent(getAutoSelectId); 28588 const autoSelectIdRef = (0,external_React_.useRef)(null); 28589 (0,external_React_.useEffect)(() => { 28590 if (!open) return; 28591 if (!contentElement) return; 28592 const scrollingElement = getScrollingElement(contentElement); 28593 if (!scrollingElement) return; 28594 scrollingElementRef.current = scrollingElement; 28595 const onUserScroll = () => { 28596 canAutoSelectRef.current = false; 28597 }; 28598 const onScroll = () => { 28599 if (!store) return; 28600 if (!canAutoSelectRef.current) return; 28601 const { activeId } = store.getState(); 28602 if (activeId === null) return; 28603 if (activeId === autoSelectIdRef.current) return; 28604 canAutoSelectRef.current = false; 28605 }; 28606 const options = { passive: true, capture: true }; 28607 scrollingElement.addEventListener("wheel", onUserScroll, options); 28608 scrollingElement.addEventListener("touchmove", onUserScroll, options); 28609 scrollingElement.addEventListener("scroll", onScroll, options); 28610 return () => { 28611 scrollingElement.removeEventListener("wheel", onUserScroll, true); 28612 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 28613 scrollingElement.removeEventListener("scroll", onScroll, true); 28614 }; 28615 }, [open, contentElement, store]); 28616 useSafeLayoutEffect(() => { 28617 if (!storeValue) return; 28618 if (composingRef.current) return; 28619 canAutoSelectRef.current = true; 28620 }, [storeValue]); 28621 useSafeLayoutEffect(() => { 28622 if (autoSelect !== "always" && open) return; 28623 canAutoSelectRef.current = open; 28624 }, [autoSelect, open]); 28625 const resetValueOnSelect = store.useState("resetValueOnSelect"); 28626 useUpdateEffect(() => { 28627 var _a2, _b2; 28628 const canAutoSelect = canAutoSelectRef.current; 28629 if (!store) return; 28630 if (!open) return; 28631 if ((!autoSelect || !canAutoSelect) && !resetValueOnSelect) return; 28632 const { baseElement, contentElement: contentElement2, activeId } = store.getState(); 28633 if (baseElement && !hasFocus(baseElement)) return; 28634 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { 28635 const observer = new MutationObserver(forceValueUpdate); 28636 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 28637 return () => observer.disconnect(); 28638 } 28639 if (autoSelect && canAutoSelect) { 28640 const userAutoSelectId = getAutoSelectIdProp(items); 28641 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first(); 28642 autoSelectIdRef.current = autoSelectId; 28643 store.move(autoSelectId != null ? autoSelectId : null); 28644 } else { 28645 const element = (_b2 = store.item(activeId)) == null ? void 0 : _b2.element; 28646 if (element && "scrollIntoView" in element) { 28647 element.scrollIntoView({ block: "nearest", inline: "nearest" }); 28648 } 28649 } 28650 return; 28651 }, [ 28652 store, 28653 open, 28654 valueUpdated, 28655 storeValue, 28656 autoSelect, 28657 resetValueOnSelect, 28658 getAutoSelectIdProp, 28659 items 28660 ]); 28661 (0,external_React_.useEffect)(() => { 28662 if (!inline) return; 28663 const combobox = ref.current; 28664 if (!combobox) return; 28665 const elements = [combobox, contentElement].filter( 28666 (value2) => !!value2 28667 ); 28668 const onBlur2 = (event) => { 28669 if (elements.every((el) => isFocusEventOutside(event, el))) { 28670 store == null ? void 0 : store.setValue(value); 28671 } 28672 }; 28673 for (const element of elements) { 28674 element.addEventListener("focusout", onBlur2); 28675 } 28676 return () => { 28677 for (const element of elements) { 28678 element.removeEventListener("focusout", onBlur2); 28679 } 28680 }; 28681 }, [inline, contentElement, store, value]); 28682 const canShow = (event) => { 28683 const currentTarget = event.currentTarget; 28684 return currentTarget.value.length >= showMinLength; 28685 }; 28686 const onChangeProp = props.onChange; 28687 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); 28688 const setValueOnChangeProp = useBooleanEvent( 28689 // If the combobox is combined with tags, the value will be set by the tag 28690 // input component. 28691 setValueOnChange != null ? setValueOnChange : !store.tag 28692 ); 28693 const onChange = useEvent((event) => { 28694 onChangeProp == null ? void 0 : onChangeProp(event); 28695 if (event.defaultPrevented) return; 28696 if (!store) return; 28697 const currentTarget = event.currentTarget; 28698 const { value: value2, selectionStart, selectionEnd } = currentTarget; 28699 const nativeEvent = event.nativeEvent; 28700 canAutoSelectRef.current = true; 28701 if (isInputEvent(nativeEvent)) { 28702 if (nativeEvent.isComposing) { 28703 canAutoSelectRef.current = false; 28704 composingRef.current = true; 28705 } 28706 if (inline) { 28707 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 28708 const caretAtEnd = selectionStart === value2.length; 28709 setCanInline(textInserted && caretAtEnd); 28710 } 28711 } 28712 if (setValueOnChangeProp(event)) { 28713 const isSameValue = value2 === store.getState().value; 28714 store.setValue(value2); 28715 queueMicrotask(() => { 28716 setSelectionRange(currentTarget, selectionStart, selectionEnd); 28717 }); 28718 if (inline && autoSelect && isSameValue) { 28719 forceValueUpdate(); 28720 } 28721 } 28722 if (showOnChangeProp(event)) { 28723 store.show(); 28724 } 28725 if (!autoSelect || !canAutoSelectRef.current) { 28726 store.setActiveId(null); 28727 } 28728 }); 28729 const onCompositionEndProp = props.onCompositionEnd; 28730 const onCompositionEnd = useEvent((event) => { 28731 canAutoSelectRef.current = true; 28732 composingRef.current = false; 28733 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); 28734 if (event.defaultPrevented) return; 28735 if (!autoSelect) return; 28736 forceValueUpdate(); 28737 }); 28738 const onMouseDownProp = props.onMouseDown; 28739 const blurActiveItemOnClickProp = useBooleanEvent( 28740 blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement) 28741 ); 28742 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 28743 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); 28744 const onMouseDown = useEvent((event) => { 28745 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 28746 if (event.defaultPrevented) return; 28747 if (event.button) return; 28748 if (event.ctrlKey) return; 28749 if (!store) return; 28750 if (blurActiveItemOnClickProp(event)) { 28751 store.setActiveId(null); 28752 } 28753 if (setValueOnClickProp(event)) { 28754 store.setValue(value); 28755 } 28756 if (showOnClickProp(event)) { 28757 queueBeforeEvent(event.currentTarget, "mouseup", store.show); 28758 } 28759 }); 28760 const onKeyDownProp = props.onKeyDown; 28761 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); 28762 const onKeyDown = useEvent((event) => { 28763 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 28764 if (!event.repeat) { 28765 canAutoSelectRef.current = false; 28766 } 28767 if (event.defaultPrevented) return; 28768 if (event.ctrlKey) return; 28769 if (event.altKey) return; 28770 if (event.shiftKey) return; 28771 if (event.metaKey) return; 28772 if (!store) return; 28773 const { open: open2 } = store.getState(); 28774 if (open2) return; 28775 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 28776 if (showOnKeyPressProp(event)) { 28777 event.preventDefault(); 28778 store.show(); 28779 } 28780 } 28781 }); 28782 const onBlurProp = props.onBlur; 28783 const onBlur = useEvent((event) => { 28784 canAutoSelectRef.current = false; 28785 onBlurProp == null ? void 0 : onBlurProp(event); 28786 if (event.defaultPrevented) return; 28787 }); 28788 const id = useId(props.id); 28789 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 28790 const isActiveItem = store.useState((state) => state.activeId === null); 28791 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28792 id, 28793 role: "combobox", 28794 "aria-autocomplete": ariaAutoComplete, 28795 "aria-haspopup": getPopupRole(contentElement, "listbox"), 28796 "aria-expanded": open, 28797 "aria-controls": contentElement == null ? void 0 : contentElement.id, 28798 "data-active-item": isActiveItem || void 0, 28799 value 28800 }, props), { 28801 ref: useMergeRefs(ref, props.ref), 28802 onChange, 28803 onCompositionEnd, 28804 onMouseDown, 28805 onKeyDown, 28806 onBlur 28807 }); 28808 props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28809 store, 28810 focusable 28811 }, props), { 28812 // Enable inline autocomplete when the user moves from the combobox input 28813 // to an item. 28814 moveOnKeyPress: (event) => { 28815 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 28816 if (inline) setCanInline(true); 28817 return true; 28818 } 28819 })); 28820 props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props)); 28821 return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props); 28822 } 28823 ); 28824 var Combobox = forwardRef2(function Combobox2(props) { 28825 const htmlProps = useCombobox(props); 28826 return createElement(combobox_TagName, htmlProps); 28827 }); 28828 28829 28830 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/BSEL4YAF.js 28831 "use client"; 28832 28833 28834 28835 28836 28837 28838 28839 // src/disclosure/disclosure-content.tsx 28840 28841 28842 28843 28844 var BSEL4YAF_TagName = "div"; 28845 function afterTimeout(timeoutMs, cb) { 28846 const timeoutId = setTimeout(cb, timeoutMs); 28847 return () => clearTimeout(timeoutId); 28848 } 28849 function BSEL4YAF_afterPaint(cb) { 28850 let raf = requestAnimationFrame(() => { 28851 raf = requestAnimationFrame(cb); 28852 }); 28853 return () => cancelAnimationFrame(raf); 28854 } 28855 function parseCSSTime(...times) { 28856 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { 28857 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; 28858 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; 28859 if (currentTime > longestTime) return currentTime; 28860 return longestTime; 28861 }, 0); 28862 } 28863 function isHidden(mounted, hidden, alwaysVisible) { 28864 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 28865 } 28866 var useDisclosureContent = createHook(function useDisclosureContent2(_a) { 28867 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 28868 const context = useDisclosureProviderContext(); 28869 store = store || context; 28870 invariant( 28871 store, 28872 false && 0 28873 ); 28874 const ref = (0,external_React_.useRef)(null); 28875 const id = useId(props.id); 28876 const [transition, setTransition] = (0,external_React_.useState)(null); 28877 const open = store.useState("open"); 28878 const mounted = store.useState("mounted"); 28879 const animated = store.useState("animated"); 28880 const contentElement = store.useState("contentElement"); 28881 const otherElement = useStoreState(store.disclosure, "contentElement"); 28882 useSafeLayoutEffect(() => { 28883 if (!ref.current) return; 28884 store == null ? void 0 : store.setContentElement(ref.current); 28885 }, [store]); 28886 useSafeLayoutEffect(() => { 28887 let previousAnimated; 28888 store == null ? void 0 : store.setState("animated", (animated2) => { 28889 previousAnimated = animated2; 28890 return true; 28891 }); 28892 return () => { 28893 if (previousAnimated === void 0) return; 28894 store == null ? void 0 : store.setState("animated", previousAnimated); 28895 }; 28896 }, [store]); 28897 useSafeLayoutEffect(() => { 28898 if (!animated) return; 28899 if (!(contentElement == null ? void 0 : contentElement.isConnected)) { 28900 setTransition(null); 28901 return; 28902 } 28903 return BSEL4YAF_afterPaint(() => { 28904 setTransition(open ? "enter" : mounted ? "leave" : null); 28905 }); 28906 }, [animated, contentElement, open, mounted]); 28907 useSafeLayoutEffect(() => { 28908 if (!store) return; 28909 if (!animated) return; 28910 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); 28911 const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation); 28912 if (!transition || !contentElement) { 28913 stopAnimation(); 28914 return; 28915 } 28916 if (transition === "leave" && open) return; 28917 if (transition === "enter" && !open) return; 28918 if (typeof animated === "number") { 28919 const timeout2 = animated; 28920 return afterTimeout(timeout2, stopAnimationSync); 28921 } 28922 const { 28923 transitionDuration, 28924 animationDuration, 28925 transitionDelay, 28926 animationDelay 28927 } = getComputedStyle(contentElement); 28928 const { 28929 transitionDuration: transitionDuration2 = "0", 28930 animationDuration: animationDuration2 = "0", 28931 transitionDelay: transitionDelay2 = "0", 28932 animationDelay: animationDelay2 = "0" 28933 } = otherElement ? getComputedStyle(otherElement) : {}; 28934 const delay = parseCSSTime( 28935 transitionDelay, 28936 animationDelay, 28937 transitionDelay2, 28938 animationDelay2 28939 ); 28940 const duration = parseCSSTime( 28941 transitionDuration, 28942 animationDuration, 28943 transitionDuration2, 28944 animationDuration2 28945 ); 28946 const timeout = delay + duration; 28947 if (!timeout) { 28948 if (transition === "enter") { 28949 store.setState("animated", false); 28950 } 28951 stopAnimation(); 28952 return; 28953 } 28954 const frameRate = 1e3 / 60; 28955 const maxTimeout = Math.max(timeout - frameRate, 0); 28956 return afterTimeout(maxTimeout, stopAnimationSync); 28957 }, [store, animated, contentElement, otherElement, open, transition]); 28958 props = useWrapElement( 28959 props, 28960 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }), 28961 [store] 28962 ); 28963 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 28964 const styleProp = props.style; 28965 const style = (0,external_React_.useMemo)(() => { 28966 if (hidden) return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" }); 28967 return styleProp; 28968 }, [hidden, styleProp]); 28969 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 28970 id, 28971 "data-open": open || void 0, 28972 "data-enter": transition === "enter" || void 0, 28973 "data-leave": transition === "leave" || void 0, 28974 hidden 28975 }, props), { 28976 ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref), 28977 style 28978 }); 28979 return removeUndefinedValues(props); 28980 }); 28981 var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) { 28982 const htmlProps = useDisclosureContent(props); 28983 return createElement(BSEL4YAF_TagName, htmlProps); 28984 }); 28985 var DisclosureContent = forwardRef2(function DisclosureContent2(_a) { 28986 var _b = _a, { 28987 unmountOnHide 28988 } = _b, props = __objRest(_b, [ 28989 "unmountOnHide" 28990 ]); 28991 const context = useDisclosureProviderContext(); 28992 const store = props.store || context; 28993 const mounted = useStoreState( 28994 store, 28995 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) 28996 ); 28997 if (mounted === false) return null; 28998 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props)); 28999 }); 29000 29001 29002 29003 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/6ZVAPMHT.js 29004 "use client"; 29005 29006 29007 29008 29009 29010 29011 // src/combobox/combobox-list.tsx 29012 29013 29014 29015 var _6ZVAPMHT_TagName = "div"; 29016 var useComboboxList = createHook( 29017 function useComboboxList2(_a) { 29018 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 29019 const scopedContext = useComboboxScopedContext(true); 29020 const context = useComboboxContext(); 29021 store = store || context; 29022 const scopedContextSameStore = !!store && store === scopedContext; 29023 invariant( 29024 store, 29025 false && 0 29026 ); 29027 const ref = (0,external_React_.useRef)(null); 29028 const id = useId(props.id); 29029 const mounted = store.useState("mounted"); 29030 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 29031 const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; 29032 const multiSelectable = store.useState( 29033 (state) => Array.isArray(state.selectedValue) 29034 ); 29035 const role = useAttribute(ref, "role", props.role); 29036 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; 29037 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; 29038 const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false); 29039 const contentElement = store.useState("contentElement"); 29040 useSafeLayoutEffect(() => { 29041 if (!mounted) return; 29042 const element = ref.current; 29043 if (!element) return; 29044 if (contentElement !== element) return; 29045 const callback = () => { 29046 setHasListboxInside(!!element.querySelector("[role='listbox']")); 29047 }; 29048 const observer = new MutationObserver(callback); 29049 observer.observe(element, { 29050 subtree: true, 29051 childList: true, 29052 attributeFilter: ["role"] 29053 }); 29054 callback(); 29055 return () => observer.disconnect(); 29056 }, [mounted, contentElement]); 29057 if (!hasListboxInside) { 29058 props = _3YLGPPWQ_spreadValues({ 29059 role: "listbox", 29060 "aria-multiselectable": ariaMultiSelectable 29061 }, props); 29062 } 29063 props = useWrapElement( 29064 props, 29065 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), 29066 [store, role] 29067 ); 29068 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; 29069 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29070 id, 29071 hidden 29072 }, props), { 29073 ref: useMergeRefs(setContentElement, ref, props.ref), 29074 style 29075 }); 29076 return removeUndefinedValues(props); 29077 } 29078 ); 29079 var ComboboxList = forwardRef2(function ComboboxList2(props) { 29080 const htmlProps = useComboboxList(props); 29081 return createElement(_6ZVAPMHT_TagName, htmlProps); 29082 }); 29083 29084 29085 29086 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OBZMLI6J.js 29087 "use client"; 29088 29089 29090 29091 29092 29093 // src/composite/composite-hover.tsx 29094 29095 29096 29097 29098 var OBZMLI6J_TagName = "div"; 29099 function getMouseDestination(event) { 29100 const relatedTarget = event.relatedTarget; 29101 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { 29102 return relatedTarget; 29103 } 29104 return null; 29105 } 29106 function hoveringInside(event) { 29107 const nextElement = getMouseDestination(event); 29108 if (!nextElement) return false; 29109 return contains(event.currentTarget, nextElement); 29110 } 29111 var symbol = Symbol("composite-hover"); 29112 function movingToAnotherItem(event) { 29113 let dest = getMouseDestination(event); 29114 if (!dest) return false; 29115 do { 29116 if (PBFD2E7P_hasOwnProperty(dest, symbol) && dest[symbol]) return true; 29117 dest = dest.parentElement; 29118 } while (dest); 29119 return false; 29120 } 29121 var useCompositeHover = createHook( 29122 function useCompositeHover2(_a) { 29123 var _b = _a, { 29124 store, 29125 focusOnHover = true, 29126 blurOnHoverEnd = !!focusOnHover 29127 } = _b, props = __objRest(_b, [ 29128 "store", 29129 "focusOnHover", 29130 "blurOnHoverEnd" 29131 ]); 29132 const context = useCompositeContext(); 29133 store = store || context; 29134 invariant( 29135 store, 29136 false && 0 29137 ); 29138 const isMouseMoving = useIsMouseMoving(); 29139 const onMouseMoveProp = props.onMouseMove; 29140 const focusOnHoverProp = useBooleanEvent(focusOnHover); 29141 const onMouseMove = useEvent((event) => { 29142 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); 29143 if (event.defaultPrevented) return; 29144 if (!isMouseMoving()) return; 29145 if (!focusOnHoverProp(event)) return; 29146 if (!hasFocusWithin(event.currentTarget)) { 29147 const baseElement = store == null ? void 0 : store.getState().baseElement; 29148 if (baseElement && !hasFocus(baseElement)) { 29149 baseElement.focus(); 29150 } 29151 } 29152 store == null ? void 0 : store.setActiveId(event.currentTarget.id); 29153 }); 29154 const onMouseLeaveProp = props.onMouseLeave; 29155 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 29156 const onMouseLeave = useEvent((event) => { 29157 var _a2; 29158 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); 29159 if (event.defaultPrevented) return; 29160 if (!isMouseMoving()) return; 29161 if (hoveringInside(event)) return; 29162 if (movingToAnotherItem(event)) return; 29163 if (!focusOnHoverProp(event)) return; 29164 if (!blurOnHoverEndProp(event)) return; 29165 store == null ? void 0 : store.setActiveId(null); 29166 (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus(); 29167 }); 29168 const ref = (0,external_React_.useCallback)((element) => { 29169 if (!element) return; 29170 element[symbol] = true; 29171 }, []); 29172 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 29173 ref: useMergeRefs(ref, props.ref), 29174 onMouseMove, 29175 onMouseLeave 29176 }); 29177 return removeUndefinedValues(props); 29178 } 29179 ); 29180 var CompositeHover = memo2( 29181 forwardRef2(function CompositeHover2(props) { 29182 const htmlProps = useCompositeHover(props); 29183 return createElement(OBZMLI6J_TagName, htmlProps); 29184 }) 29185 ); 29186 29187 29188 29189 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/PLQDTVXM.js 29190 "use client"; 29191 29192 29193 29194 29195 29196 // src/collection/collection-item.tsx 29197 29198 29199 var PLQDTVXM_TagName = "div"; 29200 var useCollectionItem = createHook( 29201 function useCollectionItem2(_a) { 29202 var _b = _a, { 29203 store, 29204 shouldRegisterItem = true, 29205 getItem = identity, 29206 element: element 29207 } = _b, props = __objRest(_b, [ 29208 "store", 29209 "shouldRegisterItem", 29210 "getItem", 29211 // @ts-expect-error This prop may come from a collection renderer. 29212 "element" 29213 ]); 29214 const context = useCollectionContext(); 29215 store = store || context; 29216 const id = useId(props.id); 29217 const ref = (0,external_React_.useRef)(element); 29218 (0,external_React_.useEffect)(() => { 29219 const element2 = ref.current; 29220 if (!id) return; 29221 if (!element2) return; 29222 if (!shouldRegisterItem) return; 29223 const item = getItem({ id, element: element2 }); 29224 return store == null ? void 0 : store.renderItem(item); 29225 }, [id, shouldRegisterItem, getItem, store]); 29226 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 29227 ref: useMergeRefs(ref, props.ref) 29228 }); 29229 return removeUndefinedValues(props); 29230 } 29231 ); 29232 var CollectionItem = forwardRef2(function CollectionItem2(props) { 29233 const htmlProps = useCollectionItem(props); 29234 return createElement(PLQDTVXM_TagName, htmlProps); 29235 }); 29236 29237 29238 29239 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HGP5L2ST.js 29240 "use client"; 29241 29242 29243 29244 29245 29246 // src/command/command.tsx 29247 29248 29249 29250 29251 29252 var HGP5L2ST_TagName = "button"; 29253 function isNativeClick(event) { 29254 if (!event.isTrusted) return false; 29255 const element = event.currentTarget; 29256 if (event.key === "Enter") { 29257 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 29258 } 29259 if (event.key === " ") { 29260 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 29261 } 29262 return false; 29263 } 29264 var HGP5L2ST_symbol = Symbol("command"); 29265 var useCommand = createHook( 29266 function useCommand2(_a) { 29267 var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]); 29268 const ref = (0,external_React_.useRef)(null); 29269 const tagName = useTagName(ref); 29270 const type = props.type; 29271 const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)( 29272 () => !!tagName && isButton({ tagName, type }) 29273 ); 29274 (0,external_React_.useEffect)(() => { 29275 if (!ref.current) return; 29276 setIsNativeButton(isButton(ref.current)); 29277 }, []); 29278 const [active, setActive] = (0,external_React_.useState)(false); 29279 const activeRef = (0,external_React_.useRef)(false); 29280 const disabled = disabledFromProps(props); 29281 const [isDuplicate, metadataProps] = useMetadataProps(props, HGP5L2ST_symbol, true); 29282 const onKeyDownProp = props.onKeyDown; 29283 const onKeyDown = useEvent((event) => { 29284 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 29285 const element = event.currentTarget; 29286 if (event.defaultPrevented) return; 29287 if (isDuplicate) return; 29288 if (disabled) return; 29289 if (!isSelfTarget(event)) return; 29290 if (isTextField(element)) return; 29291 if (element.isContentEditable) return; 29292 const isEnter = clickOnEnter && event.key === "Enter"; 29293 const isSpace = clickOnSpace && event.key === " "; 29294 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 29295 const shouldPreventSpace = event.key === " " && !clickOnSpace; 29296 if (shouldPreventEnter || shouldPreventSpace) { 29297 event.preventDefault(); 29298 return; 29299 } 29300 if (isEnter || isSpace) { 29301 const nativeClick = isNativeClick(event); 29302 if (isEnter) { 29303 if (!nativeClick) { 29304 event.preventDefault(); 29305 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 29306 const click = () => fireClickEvent(element, eventInit); 29307 if (isFirefox()) { 29308 queueBeforeEvent(element, "keyup", click); 29309 } else { 29310 queueMicrotask(click); 29311 } 29312 } 29313 } else if (isSpace) { 29314 activeRef.current = true; 29315 if (!nativeClick) { 29316 event.preventDefault(); 29317 setActive(true); 29318 } 29319 } 29320 } 29321 }); 29322 const onKeyUpProp = props.onKeyUp; 29323 const onKeyUp = useEvent((event) => { 29324 onKeyUpProp == null ? void 0 : onKeyUpProp(event); 29325 if (event.defaultPrevented) return; 29326 if (isDuplicate) return; 29327 if (disabled) return; 29328 if (event.metaKey) return; 29329 const isSpace = clickOnSpace && event.key === " "; 29330 if (activeRef.current && isSpace) { 29331 activeRef.current = false; 29332 if (!isNativeClick(event)) { 29333 event.preventDefault(); 29334 setActive(false); 29335 const element = event.currentTarget; 29336 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 29337 queueMicrotask(() => fireClickEvent(element, eventInit)); 29338 } 29339 } 29340 }); 29341 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ 29342 "data-active": active || void 0, 29343 type: isNativeButton ? "button" : void 0 29344 }, metadataProps), props), { 29345 ref: useMergeRefs(ref, props.ref), 29346 onKeyDown, 29347 onKeyUp 29348 }); 29349 props = useFocusable(props); 29350 return props; 29351 } 29352 ); 29353 var Command = forwardRef2(function Command2(props) { 29354 const htmlProps = useCommand(props); 29355 return createElement(HGP5L2ST_TagName, htmlProps); 29356 }); 29357 29358 29359 29360 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7QKWW6TW.js 29361 "use client"; 29362 29363 29364 29365 29366 29367 29368 29369 29370 29371 // src/composite/composite-item.tsx 29372 29373 29374 29375 29376 29377 29378 var _7QKWW6TW_TagName = "button"; 29379 function isEditableElement(element) { 29380 if (isTextbox(element)) return true; 29381 return element.tagName === "INPUT" && !isButton(element); 29382 } 29383 function getNextPageOffset(scrollingElement, pageUp = false) { 29384 const height = scrollingElement.clientHeight; 29385 const { top } = scrollingElement.getBoundingClientRect(); 29386 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 29387 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 29388 if (scrollingElement.tagName === "HTML") { 29389 return pageOffset + scrollingElement.scrollTop; 29390 } 29391 return pageOffset; 29392 } 29393 function getItemOffset(itemElement, pageUp = false) { 29394 const { top } = itemElement.getBoundingClientRect(); 29395 if (pageUp) { 29396 return top + itemElement.clientHeight; 29397 } 29398 return top; 29399 } 29400 function findNextPageItemId(element, store, next, pageUp = false) { 29401 var _a; 29402 if (!store) return; 29403 if (!next) return; 29404 const { renderedItems } = store.getState(); 29405 const scrollingElement = getScrollingElement(element); 29406 if (!scrollingElement) return; 29407 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 29408 let id; 29409 let prevDifference; 29410 for (let i = 0; i < renderedItems.length; i += 1) { 29411 const previousId = id; 29412 id = next(i); 29413 if (!id) break; 29414 if (id === previousId) continue; 29415 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; 29416 if (!itemElement) continue; 29417 const itemOffset = getItemOffset(itemElement, pageUp); 29418 const difference = itemOffset - nextPageOffset; 29419 const absDifference = Math.abs(difference); 29420 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 29421 if (prevDifference !== void 0 && prevDifference < absDifference) { 29422 id = previousId; 29423 } 29424 break; 29425 } 29426 prevDifference = absDifference; 29427 } 29428 return id; 29429 } 29430 function targetIsAnotherItem(event, store) { 29431 if (isSelfTarget(event)) return false; 29432 return isItem(store, event.target); 29433 } 29434 var useCompositeItem = createHook( 29435 function useCompositeItem2(_a) { 29436 var _b = _a, { 29437 store, 29438 rowId: rowIdProp, 29439 preventScrollOnKeyDown = false, 29440 moveOnKeyPress = true, 29441 tabbable = false, 29442 getItem: getItemProp, 29443 "aria-setsize": ariaSetSizeProp, 29444 "aria-posinset": ariaPosInSetProp 29445 } = _b, props = __objRest(_b, [ 29446 "store", 29447 "rowId", 29448 "preventScrollOnKeyDown", 29449 "moveOnKeyPress", 29450 "tabbable", 29451 "getItem", 29452 "aria-setsize", 29453 "aria-posinset" 29454 ]); 29455 const context = useCompositeContext(); 29456 store = store || context; 29457 const id = useId(props.id); 29458 const ref = (0,external_React_.useRef)(null); 29459 const row = (0,external_React_.useContext)(CompositeRowContext); 29460 const rowId = useStoreState(store, (state) => { 29461 if (rowIdProp) return rowIdProp; 29462 if (!state) return; 29463 if (!(row == null ? void 0 : row.baseElement)) return; 29464 if (row.baseElement !== state.baseElement) return; 29465 return row.id; 29466 }); 29467 const disabled = disabledFromProps(props); 29468 const trulyDisabled = disabled && !props.accessibleWhenDisabled; 29469 const getItem = (0,external_React_.useCallback)( 29470 (item) => { 29471 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { 29472 id: id || item.id, 29473 rowId, 29474 disabled: !!trulyDisabled 29475 }); 29476 if (getItemProp) { 29477 return getItemProp(nextItem); 29478 } 29479 return nextItem; 29480 }, 29481 [id, rowId, trulyDisabled, getItemProp] 29482 ); 29483 const onFocusProp = props.onFocus; 29484 const hasFocusedComposite = (0,external_React_.useRef)(false); 29485 const onFocus = useEvent((event) => { 29486 onFocusProp == null ? void 0 : onFocusProp(event); 29487 if (event.defaultPrevented) return; 29488 if (isPortalEvent(event)) return; 29489 if (!id) return; 29490 if (!store) return; 29491 if (targetIsAnotherItem(event, store)) return; 29492 const { virtualFocus, baseElement: baseElement2 } = store.getState(); 29493 store.setActiveId(id); 29494 if (isTextbox(event.currentTarget)) { 29495 selectTextField(event.currentTarget); 29496 } 29497 if (!virtualFocus) return; 29498 if (!isSelfTarget(event)) return; 29499 if (isEditableElement(event.currentTarget)) return; 29500 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; 29501 if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) { 29502 event.currentTarget.scrollIntoView({ 29503 block: "nearest", 29504 inline: "nearest" 29505 }); 29506 } 29507 hasFocusedComposite.current = true; 29508 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); 29509 if (fromComposite) { 29510 focusSilently(baseElement2); 29511 } else { 29512 baseElement2.focus(); 29513 } 29514 }); 29515 const onBlurCaptureProp = props.onBlurCapture; 29516 const onBlurCapture = useEvent((event) => { 29517 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 29518 if (event.defaultPrevented) return; 29519 const state = store == null ? void 0 : store.getState(); 29520 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { 29521 hasFocusedComposite.current = false; 29522 event.preventDefault(); 29523 event.stopPropagation(); 29524 } 29525 }); 29526 const onKeyDownProp = props.onKeyDown; 29527 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 29528 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 29529 const onKeyDown = useEvent((event) => { 29530 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 29531 if (event.defaultPrevented) return; 29532 if (!isSelfTarget(event)) return; 29533 if (!store) return; 29534 const { currentTarget } = event; 29535 const state = store.getState(); 29536 const item = store.item(id); 29537 const isGrid = !!(item == null ? void 0 : item.rowId); 29538 const isVertical = state.orientation !== "horizontal"; 29539 const isHorizontal = state.orientation !== "vertical"; 29540 const canHomeEnd = () => { 29541 if (isGrid) return true; 29542 if (isHorizontal) return true; 29543 if (!state.baseElement) return true; 29544 if (!isTextField(state.baseElement)) return true; 29545 return false; 29546 }; 29547 const keyMap = { 29548 ArrowUp: (isGrid || isVertical) && store.up, 29549 ArrowRight: (isGrid || isHorizontal) && store.next, 29550 ArrowDown: (isGrid || isVertical) && store.down, 29551 ArrowLeft: (isGrid || isHorizontal) && store.previous, 29552 Home: () => { 29553 if (!canHomeEnd()) return; 29554 if (!isGrid || event.ctrlKey) { 29555 return store == null ? void 0 : store.first(); 29556 } 29557 return store == null ? void 0 : store.previous(-1); 29558 }, 29559 End: () => { 29560 if (!canHomeEnd()) return; 29561 if (!isGrid || event.ctrlKey) { 29562 return store == null ? void 0 : store.last(); 29563 } 29564 return store == null ? void 0 : store.next(-1); 29565 }, 29566 PageUp: () => { 29567 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); 29568 }, 29569 PageDown: () => { 29570 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); 29571 } 29572 }; 29573 const action = keyMap[event.key]; 29574 if (action) { 29575 if (isTextbox(currentTarget)) { 29576 const selection = getTextboxSelection(currentTarget); 29577 const isLeft = isHorizontal && event.key === "ArrowLeft"; 29578 const isRight = isHorizontal && event.key === "ArrowRight"; 29579 const isUp = isVertical && event.key === "ArrowUp"; 29580 const isDown = isVertical && event.key === "ArrowDown"; 29581 if (isRight || isDown) { 29582 const { length: valueLength } = getTextboxValue(currentTarget); 29583 if (selection.end !== valueLength) return; 29584 } else if ((isLeft || isUp) && selection.start !== 0) return; 29585 } 29586 const nextId = action(); 29587 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { 29588 if (!moveOnKeyPressProp(event)) return; 29589 event.preventDefault(); 29590 store.move(nextId); 29591 } 29592 } 29593 }); 29594 const baseElement = useStoreState( 29595 store, 29596 (state) => (state == null ? void 0 : state.baseElement) || void 0 29597 ); 29598 const providerValue = (0,external_React_.useMemo)( 29599 () => ({ id, baseElement }), 29600 [id, baseElement] 29601 ); 29602 props = useWrapElement( 29603 props, 29604 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), 29605 [providerValue] 29606 ); 29607 const isActiveItem = useStoreState( 29608 store, 29609 (state) => !!state && state.activeId === id 29610 ); 29611 const ariaSetSize = useStoreState(store, (state) => { 29612 if (ariaSetSizeProp != null) return ariaSetSizeProp; 29613 if (!state) return; 29614 if (!(row == null ? void 0 : row.ariaSetSize)) return; 29615 if (row.baseElement !== state.baseElement) return; 29616 return row.ariaSetSize; 29617 }); 29618 const ariaPosInSet = useStoreState(store, (state) => { 29619 if (ariaPosInSetProp != null) return ariaPosInSetProp; 29620 if (!state) return; 29621 if (!(row == null ? void 0 : row.ariaPosInSet)) return; 29622 if (row.baseElement !== state.baseElement) return; 29623 const itemsInRow = state.renderedItems.filter( 29624 (item) => item.rowId === rowId 29625 ); 29626 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 29627 }); 29628 const isTabbable = useStoreState(store, (state) => { 29629 if (!(state == null ? void 0 : state.renderedItems.length)) return true; 29630 if (state.virtualFocus) return false; 29631 if (tabbable) return true; 29632 return state.activeId === id; 29633 }); 29634 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29635 id, 29636 "data-active-item": isActiveItem || void 0 29637 }, props), { 29638 ref: useMergeRefs(ref, props.ref), 29639 tabIndex: isTabbable ? props.tabIndex : -1, 29640 onFocus, 29641 onBlurCapture, 29642 onKeyDown 29643 }); 29644 props = useCommand(props); 29645 props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29646 store 29647 }, props), { 29648 getItem, 29649 shouldRegisterItem: id ? props.shouldRegisterItem : false 29650 })); 29651 return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 29652 "aria-setsize": ariaSetSize, 29653 "aria-posinset": ariaPosInSet 29654 })); 29655 } 29656 ); 29657 var CompositeItem = memo2( 29658 forwardRef2(function CompositeItem2(props) { 29659 const htmlProps = useCompositeItem(props); 29660 return createElement(_7QKWW6TW_TagName, htmlProps); 29661 }) 29662 ); 29663 29664 29665 29666 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-item.js 29667 "use client"; 29668 29669 29670 29671 29672 29673 29674 29675 29676 29677 29678 29679 29680 29681 29682 29683 29684 29685 29686 29687 // src/combobox/combobox-item.tsx 29688 29689 29690 29691 29692 29693 29694 var combobox_item_TagName = "div"; 29695 function isSelected(storeValue, itemValue) { 29696 if (itemValue == null) return; 29697 if (storeValue == null) return false; 29698 if (Array.isArray(storeValue)) { 29699 return storeValue.includes(itemValue); 29700 } 29701 return storeValue === itemValue; 29702 } 29703 function getItemRole(popupRole) { 29704 var _a; 29705 const itemRoleByPopupRole = { 29706 menu: "menuitem", 29707 listbox: "option", 29708 tree: "treeitem" 29709 }; 29710 const key = popupRole; 29711 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option"; 29712 } 29713 var useComboboxItem = createHook( 29714 function useComboboxItem2(_a) { 29715 var _b = _a, { 29716 store, 29717 value, 29718 hideOnClick, 29719 setValueOnClick, 29720 selectValueOnClick = true, 29721 resetValueOnSelect, 29722 focusOnHover = false, 29723 moveOnKeyPress = true, 29724 getItem: getItemProp 29725 } = _b, props = __objRest(_b, [ 29726 "store", 29727 "value", 29728 "hideOnClick", 29729 "setValueOnClick", 29730 "selectValueOnClick", 29731 "resetValueOnSelect", 29732 "focusOnHover", 29733 "moveOnKeyPress", 29734 "getItem" 29735 ]); 29736 var _a2; 29737 const context = useComboboxScopedContext(); 29738 store = store || context; 29739 invariant( 29740 store, 29741 false && 0 29742 ); 29743 const getItem = (0,external_React_.useCallback)( 29744 (item) => { 29745 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value }); 29746 if (getItemProp) { 29747 return getItemProp(nextItem); 29748 } 29749 return nextItem; 29750 }, 29751 [value, getItemProp] 29752 ); 29753 const multiSelectable = store.useState( 29754 (state) => Array.isArray(state.selectedValue) 29755 ); 29756 const selected = store.useState( 29757 (state) => isSelected(state.selectedValue, value) 29758 ); 29759 const resetValueOnSelectState = store.useState("resetValueOnSelect"); 29760 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; 29761 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; 29762 const onClickProp = props.onClick; 29763 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 29764 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 29765 const resetValueOnSelectProp = useBooleanEvent( 29766 (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable 29767 ); 29768 const hideOnClickProp = useBooleanEvent(hideOnClick); 29769 const onClick = useEvent((event) => { 29770 onClickProp == null ? void 0 : onClickProp(event); 29771 if (event.defaultPrevented) return; 29772 if (isDownloading(event)) return; 29773 if (isOpeningInNewTab(event)) return; 29774 if (value != null) { 29775 if (selectValueOnClickProp(event)) { 29776 if (resetValueOnSelectProp(event)) { 29777 store == null ? void 0 : store.resetValue(); 29778 } 29779 store == null ? void 0 : store.setSelectedValue((prevValue) => { 29780 if (!Array.isArray(prevValue)) return value; 29781 if (prevValue.includes(value)) { 29782 return prevValue.filter((v) => v !== value); 29783 } 29784 return [...prevValue, value]; 29785 }); 29786 } 29787 if (setValueOnClickProp(event)) { 29788 store == null ? void 0 : store.setValue(value); 29789 } 29790 } 29791 if (hideOnClickProp(event)) { 29792 store == null ? void 0 : store.hide(); 29793 } 29794 }); 29795 const onKeyDownProp = props.onKeyDown; 29796 const onKeyDown = useEvent((event) => { 29797 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 29798 if (event.defaultPrevented) return; 29799 const baseElement = store == null ? void 0 : store.getState().baseElement; 29800 if (!baseElement) return; 29801 if (hasFocus(baseElement)) return; 29802 const printable = event.key.length === 1; 29803 if (printable || event.key === "Backspace" || event.key === "Delete") { 29804 queueMicrotask(() => baseElement.focus()); 29805 if (isTextField(baseElement)) { 29806 store == null ? void 0 : store.setValue(baseElement.value); 29807 } 29808 } 29809 }); 29810 if (multiSelectable && selected != null) { 29811 props = _3YLGPPWQ_spreadValues({ 29812 "aria-selected": selected 29813 }, props); 29814 } 29815 props = useWrapElement( 29816 props, 29817 (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 }) }), 29818 [value, selected] 29819 ); 29820 const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext); 29821 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29822 role: getItemRole(popupRole), 29823 children: value 29824 }, props), { 29825 onClick, 29826 onKeyDown 29827 }); 29828 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 29829 props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 29830 store 29831 }, props), { 29832 getItem, 29833 // Dispatch a custom event on the combobox input when moving to an item 29834 // with the keyboard so the Combobox component can enable inline 29835 // autocompletion. 29836 moveOnKeyPress: (event) => { 29837 if (!moveOnKeyPressProp(event)) return false; 29838 const moveEvent = new Event("combobox-item-move"); 29839 const baseElement = store == null ? void 0 : store.getState().baseElement; 29840 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); 29841 return true; 29842 } 29843 })); 29844 props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props)); 29845 return props; 29846 } 29847 ); 29848 var ComboboxItem = memo2( 29849 forwardRef2(function ComboboxItem2(props) { 29850 const htmlProps = useComboboxItem(props); 29851 return createElement(combobox_item_TagName, htmlProps); 29852 }) 29853 ); 29854 29855 29856 ;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js 29857 "use client"; 29858 29859 29860 29861 29862 29863 29864 29865 29866 29867 29868 29869 29870 // src/combobox/combobox-item-value.tsx 29871 29872 29873 29874 29875 var combobox_item_value_TagName = "span"; 29876 function normalizeValue(value) { 29877 return normalizeString(value).toLowerCase(); 29878 } 29879 function getOffsets(string, values) { 29880 const offsets = []; 29881 for (const value of values) { 29882 let pos = 0; 29883 const length = value.length; 29884 while (string.indexOf(value, pos) !== -1) { 29885 const index = string.indexOf(value, pos); 29886 if (index !== -1) { 29887 offsets.push([index, length]); 29888 } 29889 pos = index + 1; 29890 } 29891 } 29892 return offsets; 29893 } 29894 function filterOverlappingOffsets(offsets) { 29895 return offsets.filter(([offset, length], i, arr) => { 29896 return !arr.some( 29897 ([o, l], j) => j !== i && o <= offset && o + l >= offset + length 29898 ); 29899 }); 29900 } 29901 function sortOffsets(offsets) { 29902 return offsets.sort(([a], [b]) => a - b); 29903 } 29904 function splitValue(itemValue, userValue) { 29905 if (!itemValue) return itemValue; 29906 if (!userValue) return itemValue; 29907 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue); 29908 const parts = []; 29909 const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29910 "span", 29911 { 29912 "data-autocomplete-value": autocomplete ? "" : void 0, 29913 "data-user-value": autocomplete ? void 0 : "", 29914 children: value 29915 }, 29916 parts.length 29917 ); 29918 const offsets = sortOffsets( 29919 filterOverlappingOffsets( 29920 // Convert userValues into a set to avoid duplicates 29921 getOffsets(normalizeValue(itemValue), new Set(userValues)) 29922 ) 29923 ); 29924 if (!offsets.length) { 29925 parts.push(span(itemValue, true)); 29926 return parts; 29927 } 29928 const [firstOffset] = offsets[0]; 29929 const values = [ 29930 itemValue.slice(0, firstOffset), 29931 ...offsets.flatMap(([offset, length], i) => { 29932 var _a; 29933 const value = itemValue.slice(offset, offset + length); 29934 const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0]; 29935 const nextValue = itemValue.slice(offset + length, nextOffset); 29936 return [value, nextValue]; 29937 }) 29938 ]; 29939 values.forEach((value, i) => { 29940 if (!value) return; 29941 parts.push(span(value, i % 2 === 0)); 29942 }); 29943 return parts; 29944 } 29945 var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) { 29946 var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]); 29947 const context = useComboboxScopedContext(); 29948 store = store || context; 29949 const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext); 29950 const itemValue = value != null ? value : itemContext; 29951 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); 29952 const children = (0,external_React_.useMemo)(() => { 29953 if (!itemValue) return; 29954 if (!inputValue) return itemValue; 29955 return splitValue(itemValue, inputValue); 29956 }, [itemValue, inputValue]); 29957 props = _3YLGPPWQ_spreadValues({ 29958 children 29959 }, props); 29960 return removeUndefinedValues(props); 29961 }); 29962 var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) { 29963 const htmlProps = useComboboxItemValue(props); 29964 return createElement(combobox_item_value_TagName, htmlProps); 29965 }); 29966 29967 29968 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js 29969 /** 29970 * External dependencies 29971 */ 29972 // eslint-disable-next-line no-restricted-imports 29973 29974 29975 29976 /** 29977 * WordPress dependencies 29978 */ 29979 29980 29981 29982 29983 29984 29985 29986 /** 29987 * Internal dependencies 29988 */ 29989 29990 29991 const radioCheck = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 29992 xmlns: "http://www.w3.org/2000/svg", 29993 viewBox: "0 0 24 24", 29994 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, { 29995 cx: 12, 29996 cy: 12, 29997 r: 3 29998 }) 29999 }); 30000 function search_widget_normalizeSearchInput(input = '') { 30001 return remove_accents_default()(input.trim().toLowerCase()); 30002 } 30003 const search_widget_EMPTY_ARRAY = []; 30004 const getCurrentValue = (filterDefinition, currentFilter) => { 30005 if (filterDefinition.singleSelection) { 30006 return currentFilter?.value; 30007 } 30008 if (Array.isArray(currentFilter?.value)) { 30009 return currentFilter.value; 30010 } 30011 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 30012 return [currentFilter.value]; 30013 } 30014 return search_widget_EMPTY_ARRAY; 30015 }; 30016 const getNewValue = (filterDefinition, currentFilter, value) => { 30017 if (filterDefinition.singleSelection) { 30018 return value; 30019 } 30020 if (Array.isArray(currentFilter?.value)) { 30021 return currentFilter.value.includes(value) ? currentFilter.value.filter(v => v !== value) : [...currentFilter.value, value]; 30022 } 30023 return [value]; 30024 }; 30025 function generateFilterElementCompositeItemId(prefix, filterElementValue) { 30026 return `$prefix}-$filterElementValue}`; 30027 } 30028 function ListBox({ 30029 view, 30030 filter, 30031 onChangeView 30032 }) { 30033 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, 'dataviews-filter-list-box'); 30034 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)( 30035 // When there are one or less operators, the first item is set as active 30036 // (by setting the initial `activeId` to `undefined`). 30037 // With 2 or more operators, the focus is moved on the operators control 30038 // (by setting the initial `activeId` to `null`), meaning that there won't 30039 // be an active item initially. Focus is then managed via the 30040 // `onFocusVisible` callback. 30041 filter.operators?.length === 1 ? undefined : null); 30042 const currentFilter = view.filters?.find(f => f.field === filter.field); 30043 const currentValue = getCurrentValue(filter, currentFilter); 30044 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 30045 virtualFocus: true, 30046 focusLoop: true, 30047 activeId: activeCompositeId, 30048 setActiveId: setActiveCompositeId, 30049 role: "listbox", 30050 className: "dataviews-filters__search-widget-listbox", 30051 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 30052 (0,external_wp_i18n_namespaceObject.__)('List of: %1$s'), filter.name), 30053 onFocusVisible: () => { 30054 // `onFocusVisible` needs the `Composite` component to be focusable, 30055 // which is implicitly achieved via the `virtualFocus` prop. 30056 if (!activeCompositeId && filter.elements.length) { 30057 setActiveCompositeId(generateFilterElementCompositeItemId(baseId, filter.elements[0].value)); 30058 } 30059 }, 30060 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}), 30061 children: filter.elements.map(element => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Hover, { 30062 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 30063 id: generateFilterElementCompositeItemId(baseId, element.value), 30064 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30065 "aria-label": element.label, 30066 role: "option", 30067 className: "dataviews-filters__search-widget-listitem" 30068 }), 30069 onClick: () => { 30070 var _view$filters, _view$filters2; 30071 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 30072 if (_filter.field === filter.field) { 30073 return { 30074 ..._filter, 30075 operator: currentFilter.operator || filter.operators[0], 30076 value: getNewValue(filter, currentFilter, element.value) 30077 }; 30078 } 30079 return _filter; 30080 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 30081 field: filter.field, 30082 operator: filter.operators[0], 30083 value: getNewValue(filter, currentFilter, element.value) 30084 }]; 30085 onChangeView({ 30086 ...view, 30087 page: 1, 30088 filters: newFilters 30089 }); 30090 } 30091 }), 30092 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 30093 className: "dataviews-filters__search-widget-listitem-check", 30094 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30095 icon: radioCheck 30096 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30097 icon: library_check 30098 })] 30099 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30100 children: element.label 30101 })] 30102 }, element.value)) 30103 }); 30104 } 30105 function search_widget_ComboboxList({ 30106 view, 30107 filter, 30108 onChangeView 30109 }) { 30110 const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(''); 30111 const deferredSearchValue = (0,external_wp_element_namespaceObject.useDeferredValue)(searchValue); 30112 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 30113 const currentValue = getCurrentValue(filter, currentFilter); 30114 const matches = (0,external_wp_element_namespaceObject.useMemo)(() => { 30115 const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue); 30116 return filter.elements.filter(item => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch)); 30117 }, [filter.elements, deferredSearchValue]); 30118 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxProvider, { 30119 selectedValue: currentValue, 30120 setSelectedValue: value => { 30121 var _view$filters3, _view$filters4; 30122 const newFilters = currentFilter ? [...((_view$filters3 = view.filters) !== null && _view$filters3 !== void 0 ? _view$filters3 : []).map(_filter => { 30123 if (_filter.field === filter.field) { 30124 return { 30125 ..._filter, 30126 operator: currentFilter.operator || filter.operators[0], 30127 value 30128 }; 30129 } 30130 return _filter; 30131 })] : [...((_view$filters4 = view.filters) !== null && _view$filters4 !== void 0 ? _view$filters4 : []), { 30132 field: filter.field, 30133 operator: filter.operators[0], 30134 value 30135 }]; 30136 onChangeView({ 30137 ...view, 30138 page: 1, 30139 filters: newFilters 30140 }); 30141 }, 30142 setValue: setSearchValue, 30143 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30144 className: "dataviews-filters__search-widget-filter-combobox__wrapper", 30145 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxLabel, { 30146 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 30147 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 30148 }), 30149 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 30150 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Combobox, { 30151 autoSelect: "always", 30152 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'), 30153 className: "dataviews-filters__search-widget-filter-combobox__input" 30154 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30155 className: "dataviews-filters__search-widget-filter-combobox__icon", 30156 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30157 icon: library_search 30158 }) 30159 })] 30160 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxList, { 30161 className: "dataviews-filters__search-widget-filter-combobox-list", 30162 alwaysVisible: true, 30163 children: [matches.map(element => { 30164 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxItem, { 30165 resetValueOnSelect: false, 30166 value: element.value, 30167 className: "dataviews-filters__search-widget-listitem", 30168 hideOnClick: false, 30169 setValueOnClick: false, 30170 focusOnHover: true, 30171 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 30172 className: "dataviews-filters__search-widget-listitem-check", 30173 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30174 icon: radioCheck 30175 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30176 icon: library_check 30177 })] 30178 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 30179 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValue, { 30180 className: "dataviews-filters__search-widget-filter-combobox-item-value", 30181 value: element.label 30182 }), !!element.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30183 className: "dataviews-filters__search-widget-listitem-description", 30184 children: element.description 30185 })] 30186 })] 30187 }, element.value); 30188 }), !matches.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 30189 children: (0,external_wp_i18n_namespaceObject.__)('No results found') 30190 })] 30191 })] 30192 }); 30193 } 30194 function SearchWidget(props) { 30195 const Widget = props.filter.elements.length > 10 ? search_widget_ComboboxList : ListBox; 30196 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { 30197 ...props 30198 }); 30199 } 30200 30201 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter-summary.js 30202 /** 30203 * External dependencies 30204 */ 30205 30206 /** 30207 * WordPress dependencies 30208 */ 30209 30210 30211 30212 30213 const ENTER = 'Enter'; 30214 const SPACE = ' '; 30215 30216 /** 30217 * Internal dependencies 30218 */ 30219 30220 30221 30222 30223 const FilterText = ({ 30224 activeElements, 30225 filterInView, 30226 filter 30227 }) => { 30228 if (activeElements === undefined || activeElements.length === 0) { 30229 return filter.name; 30230 } 30231 const filterTextWrappers = { 30232 Name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30233 className: "dataviews-filters__summary-filter-text-name" 30234 }), 30235 Value: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30236 className: "dataviews-filters__summary-filter-text-value" 30237 }) 30238 }; 30239 if (filterInView?.operator === constants_OPERATOR_IS_ANY) { 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 any: Admin, Editor". */ 30241 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is any: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 30242 } 30243 if (filterInView?.operator === constants_OPERATOR_IS_NONE) { 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 none: Admin, Editor". */ 30245 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is none: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 30246 } 30247 if (filterInView?.operator === OPERATOR_IS_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 all: Admin, Editor". */ 30249 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 30250 } 30251 if (filterInView?.operator === OPERATOR_IS_NOT_ALL) { 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 not all: Admin, Editor". */ 30253 (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); 30254 } 30255 if (filterInView?.operator === constants_OPERATOR_IS) { 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: Admin". */ 30257 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 30258 } 30259 if (filterInView?.operator === constants_OPERATOR_IS_NOT) { 30260 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". */ 30261 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 30262 } 30263 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name e.g.: "Unknown status for Author". */ 30264 (0,external_wp_i18n_namespaceObject.__)('Unknown status for %1$s'), filter.name); 30265 }; 30266 function OperatorSelector({ 30267 filter, 30268 view, 30269 onChangeView 30270 }) { 30271 const operatorOptions = filter.operators?.map(operator => ({ 30272 value: operator, 30273 label: OPERATORS[operator]?.label 30274 })); 30275 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 30276 const value = currentFilter?.operator || filter.operators[0]; 30277 return operatorOptions.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 30278 spacing: 2, 30279 justify: "flex-start", 30280 className: "dataviews-filters__summary-operators-container", 30281 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 30282 className: "dataviews-filters__summary-operators-filter-name", 30283 children: filter.name 30284 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 30285 label: (0,external_wp_i18n_namespaceObject.__)('Conditions'), 30286 value: value, 30287 options: operatorOptions, 30288 onChange: newValue => { 30289 var _view$filters, _view$filters2; 30290 const operator = newValue; 30291 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 30292 if (_filter.field === filter.field) { 30293 return { 30294 ..._filter, 30295 operator 30296 }; 30297 } 30298 return _filter; 30299 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 30300 field: filter.field, 30301 operator, 30302 value: undefined 30303 }]; 30304 onChangeView({ 30305 ...view, 30306 page: 1, 30307 filters: newFilters 30308 }); 30309 }, 30310 size: "small", 30311 __nextHasNoMarginBottom: true, 30312 hideLabelFromVision: true 30313 })] 30314 }); 30315 } 30316 function FilterSummary({ 30317 addFilterRef, 30318 openedFilter, 30319 ...commonProps 30320 }) { 30321 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(null); 30322 const { 30323 filter, 30324 view, 30325 onChangeView 30326 } = commonProps; 30327 const filterInView = view.filters?.find(f => f.field === filter.field); 30328 const activeElements = filter.elements.filter(element => { 30329 if (filter.singleSelection) { 30330 return element.value === filterInView?.value; 30331 } 30332 return filterInView?.value?.includes(element.value); 30333 }); 30334 const isPrimary = filter.isPrimary; 30335 const hasValues = filterInView?.value !== undefined; 30336 const canResetOrRemove = !isPrimary || hasValues; 30337 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 30338 defaultOpen: openedFilter === filter.field, 30339 contentClassName: "dataviews-filters__summary-popover", 30340 popoverProps: { 30341 placement: 'bottom-start', 30342 role: 'dialog' 30343 }, 30344 onClose: () => { 30345 toggleRef.current?.focus(); 30346 }, 30347 renderToggle: ({ 30348 isOpen, 30349 onToggle 30350 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30351 className: "dataviews-filters__summary-chip-container", 30352 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 30353 text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. */ 30354 (0,external_wp_i18n_namespaceObject.__)('Filter by: %1$s'), filter.name.toLowerCase()), 30355 placement: "top", 30356 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30357 className: dist_clsx('dataviews-filters__summary-chip', { 30358 'has-reset': canResetOrRemove, 30359 'has-values': hasValues 30360 }), 30361 role: "button", 30362 tabIndex: 0, 30363 onClick: onToggle, 30364 onKeyDown: event => { 30365 if ([ENTER, SPACE].includes(event.key)) { 30366 onToggle(); 30367 event.preventDefault(); 30368 } 30369 }, 30370 "aria-pressed": isOpen, 30371 "aria-expanded": isOpen, 30372 ref: toggleRef, 30373 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterText, { 30374 activeElements: activeElements, 30375 filterInView: filterInView, 30376 filter: filter 30377 }) 30378 }) 30379 }), canResetOrRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 30380 text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove'), 30381 placement: "top", 30382 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 30383 className: dist_clsx('dataviews-filters__summary-chip-remove', { 30384 'has-values': hasValues 30385 }), 30386 onClick: () => { 30387 onChangeView({ 30388 ...view, 30389 page: 1, 30390 filters: view.filters?.filter(_filter => _filter.field !== filter.field) 30391 }); 30392 // If the filter is not primary and can be removed, it will be added 30393 // back to the available filters from `Add filter` component. 30394 if (!isPrimary) { 30395 addFilterRef.current?.focus(); 30396 } else { 30397 // If is primary, focus the toggle button. 30398 toggleRef.current?.focus(); 30399 } 30400 }, 30401 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 30402 icon: close_small 30403 }) 30404 }) 30405 })] 30406 }), 30407 renderContent: () => { 30408 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 30409 spacing: 0, 30410 justify: "flex-start", 30411 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { 30412 ...commonProps 30413 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchWidget, { 30414 ...commonProps 30415 })] 30416 }); 30417 } 30418 }); 30419 } 30420 30421 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js 30422 /** 30423 * WordPress dependencies 30424 */ 30425 30426 const { 30427 lock: lock_unlock_lock, 30428 unlock: lock_unlock_unlock 30429 } = (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'); 30430 30431 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js 30432 /** 30433 * External dependencies 30434 */ 30435 30436 /** 30437 * WordPress dependencies 30438 */ 30439 30440 30441 30442 30443 /** 30444 * Internal dependencies 30445 */ 30446 30447 30448 const { 30449 DropdownMenuV2: add_filter_DropdownMenuV2 30450 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 30451 function AddFilterDropdownMenu({ 30452 filters, 30453 view, 30454 onChangeView, 30455 setOpenedFilter, 30456 trigger 30457 }) { 30458 const inactiveFilters = filters.filter(filter => !filter.isVisible); 30459 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuV2, { 30460 trigger: trigger, 30461 children: inactiveFilters.map(filter => { 30462 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuV2.Item, { 30463 onClick: () => { 30464 setOpenedFilter(filter.field); 30465 onChangeView({ 30466 ...view, 30467 page: 1, 30468 filters: [...(view.filters || []), { 30469 field: filter.field, 30470 value: undefined, 30471 operator: filter.operators[0] 30472 }] 30473 }); 30474 }, 30475 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuV2.ItemLabel, { 30476 children: filter.name 30477 }) 30478 }, filter.field); 30479 }) 30480 }); 30481 } 30482 function AddFilter({ 30483 filters, 30484 view, 30485 onChangeView, 30486 setOpenedFilter 30487 }, ref) { 30488 if (!filters.length || filters.every(({ 30489 isPrimary 30490 }) => isPrimary)) { 30491 return null; 30492 } 30493 const inactiveFilters = filters.filter(filter => !filter.isVisible); 30494 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterDropdownMenu, { 30495 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30496 accessibleWhenDisabled: true, 30497 size: "compact", 30498 className: "dataviews-filters-button", 30499 variant: "tertiary", 30500 disabled: !inactiveFilters.length, 30501 ref: ref, 30502 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 30503 }), 30504 filters, 30505 view, 30506 onChangeView, 30507 setOpenedFilter 30508 }); 30509 } 30510 /* harmony default export */ const add_filter = ((0,external_wp_element_namespaceObject.forwardRef)(AddFilter)); 30511 30512 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js 30513 /** 30514 * WordPress dependencies 30515 */ 30516 30517 30518 30519 /** 30520 * Internal dependencies 30521 */ 30522 30523 function ResetFilter({ 30524 filters, 30525 view, 30526 onChangeView 30527 }) { 30528 const isPrimary = field => filters.some(_filter => _filter.field === field && _filter.isPrimary); 30529 const isDisabled = !view.search && !view.filters?.some(_filter => _filter.value !== undefined || !isPrimary(_filter.field)); 30530 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30531 disabled: isDisabled, 30532 accessibleWhenDisabled: true, 30533 size: "compact", 30534 variant: "tertiary", 30535 className: "dataviews-filters__reset-button", 30536 onClick: () => { 30537 onChangeView({ 30538 ...view, 30539 page: 1, 30540 search: '', 30541 filters: [] 30542 }); 30543 }, 30544 children: (0,external_wp_i18n_namespaceObject.__)('Reset') 30545 }); 30546 } 30547 30548 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/utils.js 30549 /** 30550 * Internal dependencies 30551 */ 30552 30553 function sanitizeOperators(field) { 30554 let operators = field.filterBy?.operators; 30555 30556 // Assign default values. 30557 if (!operators || !Array.isArray(operators)) { 30558 operators = [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE]; 30559 } 30560 30561 // Make sure only valid operators are used. 30562 operators = operators.filter(operator => ALL_OPERATORS.includes(operator)); 30563 30564 // Do not allow mixing single & multiselection operators. 30565 // Remove multiselection operators if any of the single selection ones is present. 30566 if (operators.includes(constants_OPERATOR_IS) || operators.includes(constants_OPERATOR_IS_NOT)) { 30567 operators = operators.filter(operator => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(operator)); 30568 } 30569 return operators; 30570 } 30571 30572 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/index.js 30573 /** 30574 * WordPress dependencies 30575 */ 30576 30577 30578 30579 30580 30581 /** 30582 * Internal dependencies 30583 */ 30584 30585 30586 30587 30588 30589 30590 30591 30592 function useFilters(fields, view) { 30593 return (0,external_wp_element_namespaceObject.useMemo)(() => { 30594 const filters = []; 30595 fields.forEach(field => { 30596 if (!field.elements?.length) { 30597 return; 30598 } 30599 const operators = sanitizeOperators(field); 30600 if (operators.length === 0) { 30601 return; 30602 } 30603 const isPrimary = !!field.filterBy?.isPrimary; 30604 filters.push({ 30605 field: field.id, 30606 name: field.label, 30607 elements: field.elements, 30608 singleSelection: operators.some(op => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(op)), 30609 operators, 30610 isVisible: isPrimary || !!view.filters?.some(f => f.field === field.id && ALL_OPERATORS.includes(f.operator)), 30611 isPrimary 30612 }); 30613 }); 30614 // Sort filters by primary property. We need the primary filters to be first. 30615 // Then we sort by name. 30616 filters.sort((a, b) => { 30617 if (a.isPrimary && !b.isPrimary) { 30618 return -1; 30619 } 30620 if (!a.isPrimary && b.isPrimary) { 30621 return 1; 30622 } 30623 return a.name.localeCompare(b.name); 30624 }); 30625 return filters; 30626 }, [fields, view]); 30627 } 30628 function FilterVisibilityToggle({ 30629 filters, 30630 view, 30631 onChangeView, 30632 setOpenedFilter, 30633 isShowingFilter, 30634 setIsShowingFilter 30635 }) { 30636 const onChangeViewWithFilterVisibility = (0,external_wp_element_namespaceObject.useCallback)(_view => { 30637 onChangeView(_view); 30638 setIsShowingFilter(true); 30639 }, [onChangeView, setIsShowingFilter]); 30640 const visibleFilters = filters.filter(filter => filter.isVisible); 30641 const hasVisibleFilters = !!visibleFilters.length; 30642 if (filters.length === 0) { 30643 return null; 30644 } 30645 if (!hasVisibleFilters) { 30646 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterDropdownMenu, { 30647 filters: filters, 30648 view: view, 30649 onChangeView: onChangeViewWithFilterVisibility, 30650 setOpenedFilter: setOpenedFilter, 30651 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30652 className: "dataviews-filters__visibility-toggle", 30653 size: "compact", 30654 icon: library_funnel, 30655 label: (0,external_wp_i18n_namespaceObject.__)('Add filter'), 30656 isPressed: false, 30657 "aria-expanded": false 30658 }) 30659 }); 30660 } 30661 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30662 className: "dataviews-filters__container-visibility-toggle", 30663 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30664 className: "dataviews-filters__visibility-toggle", 30665 size: "compact", 30666 icon: library_funnel, 30667 label: (0,external_wp_i18n_namespaceObject.__)('Toggle filter display'), 30668 onClick: () => { 30669 if (!isShowingFilter) { 30670 setOpenedFilter(null); 30671 } 30672 setIsShowingFilter(!isShowingFilter); 30673 }, 30674 isPressed: isShowingFilter, 30675 "aria-expanded": isShowingFilter 30676 }), hasVisibleFilters && !!view.filters?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 30677 className: "dataviews-filters-toggle__count", 30678 children: view.filters?.length 30679 })] 30680 }); 30681 } 30682 function Filters() { 30683 const { 30684 fields, 30685 view, 30686 onChangeView, 30687 openedFilter, 30688 setOpenedFilter 30689 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 30690 const addFilterRef = (0,external_wp_element_namespaceObject.useRef)(null); 30691 const filters = useFilters(fields, view); 30692 const addFilter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter, { 30693 filters: filters, 30694 view: view, 30695 onChangeView: onChangeView, 30696 ref: addFilterRef, 30697 setOpenedFilter: setOpenedFilter 30698 }, "add-filter"); 30699 const visibleFilters = filters.filter(filter => filter.isVisible); 30700 if (visibleFilters.length === 0) { 30701 return null; 30702 } 30703 const filterComponents = [...visibleFilters.map(filter => { 30704 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterSummary, { 30705 filter: filter, 30706 view: view, 30707 onChangeView: onChangeView, 30708 addFilterRef: addFilterRef, 30709 openedFilter: openedFilter 30710 }, filter.field); 30711 }), addFilter]; 30712 filterComponents.push( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetFilter, { 30713 filters: filters, 30714 view: view, 30715 onChangeView: onChangeView 30716 }, "reset-filters")); 30717 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 30718 justify: "flex-start", 30719 style: { 30720 width: 'fit-content' 30721 }, 30722 className: "dataviews-filters__container", 30723 wrap: true, 30724 children: filterComponents 30725 }); 30726 } 30727 /* harmony default export */ const dataviews_filters = ((0,external_wp_element_namespaceObject.memo)(Filters)); 30728 30729 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-table.js 30730 /** 30731 * WordPress dependencies 30732 */ 30733 30734 30735 const blockTable = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30736 viewBox: "0 0 24 24", 30737 xmlns: "http://www.w3.org/2000/svg", 30738 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30739 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" 30740 }) 30741 }); 30742 /* harmony default export */ const block_table = (blockTable); 30743 30744 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js 30745 /** 30746 * WordPress dependencies 30747 */ 30748 30749 30750 const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30751 viewBox: "0 0 24 24", 30752 xmlns: "http://www.w3.org/2000/svg", 30753 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30754 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", 30755 fillRule: "evenodd", 30756 clipRule: "evenodd" 30757 }) 30758 }); 30759 /* harmony default export */ const library_category = (category); 30760 30761 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js 30762 /** 30763 * WordPress dependencies 30764 */ 30765 30766 30767 const formatListBulletsRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30768 xmlns: "http://www.w3.org/2000/svg", 30769 viewBox: "0 0 24 24", 30770 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30771 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" 30772 }) 30773 }); 30774 /* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL); 30775 30776 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 30777 /** 30778 * WordPress dependencies 30779 */ 30780 30781 30782 const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 30783 xmlns: "http://www.w3.org/2000/svg", 30784 viewBox: "0 0 24 24", 30785 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 30786 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" 30787 }) 30788 }); 30789 /* harmony default export */ const format_list_bullets = (formatListBullets); 30790 30791 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js 30792 /** 30793 * WordPress dependencies 30794 */ 30795 30796 30797 30798 /** 30799 * Internal dependencies 30800 */ 30801 30802 function DataViewsSelectionCheckbox({ 30803 selection, 30804 onChangeSelection, 30805 item, 30806 getItemId, 30807 primaryField, 30808 disabled 30809 }) { 30810 const id = getItemId(item); 30811 const checked = !disabled && selection.includes(id); 30812 let selectionLabel; 30813 if (primaryField?.getValue && item) { 30814 // eslint-disable-next-line @wordpress/valid-sprintf 30815 selectionLabel = (0,external_wp_i18n_namespaceObject.sprintf)(checked ? /* translators: %s: item title. */(0,external_wp_i18n_namespaceObject.__)('Deselect item: %s') : /* translators: %s: item title. */(0,external_wp_i18n_namespaceObject.__)('Select item: %s'), primaryField.getValue({ 30816 item 30817 })); 30818 } else { 30819 selectionLabel = checked ? (0,external_wp_i18n_namespaceObject.__)('Select a new item') : (0,external_wp_i18n_namespaceObject.__)('Deselect item'); 30820 } 30821 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 30822 className: "dataviews-selection-checkbox", 30823 __nextHasNoMarginBottom: true, 30824 "aria-label": selectionLabel, 30825 "aria-disabled": disabled, 30826 checked: checked, 30827 onChange: () => { 30828 if (disabled) { 30829 return; 30830 } 30831 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 30832 } 30833 }); 30834 } 30835 30836 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js 30837 /** 30838 * External dependencies 30839 */ 30840 30841 /** 30842 * WordPress dependencies 30843 */ 30844 30845 30846 30847 30848 30849 30850 /** 30851 * Internal dependencies 30852 */ 30853 30854 30855 30856 30857 const { 30858 DropdownMenuV2: dataviews_item_actions_DropdownMenuV2, 30859 kebabCase: dataviews_item_actions_kebabCase 30860 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 30861 function ButtonTrigger({ 30862 action, 30863 onClick, 30864 items 30865 }) { 30866 const label = typeof action.label === 'string' ? action.label : action.label(items); 30867 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30868 label: label, 30869 icon: action.icon, 30870 isDestructive: action.isDestructive, 30871 size: "compact", 30872 onClick: onClick 30873 }); 30874 } 30875 function DropdownMenuItemTrigger({ 30876 action, 30877 onClick, 30878 items 30879 }) { 30880 const label = typeof action.label === 'string' ? action.label : action.label(items); 30881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2.Item, { 30882 onClick: onClick, 30883 hideOnClick: !('RenderModal' in action), 30884 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2.ItemLabel, { 30885 children: label 30886 }) 30887 }); 30888 } 30889 function ActionModal({ 30890 action, 30891 items, 30892 closeModal 30893 }) { 30894 const label = typeof action.label === 'string' ? action.label : action.label(items); 30895 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 30896 title: action.modalHeader || label, 30897 __experimentalHideHeader: !!action.hideModalHeader, 30898 onRequestClose: closeModal !== null && closeModal !== void 0 ? closeModal : () => {}, 30899 focusOnMount: "firstContentElement", 30900 size: "small", 30901 overlayClassName: `dataviews-action-modal dataviews-action-modal__$dataviews_item_actions_kebabCase(action.id)}`, 30902 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { 30903 items: items, 30904 closeModal: closeModal 30905 }) 30906 }); 30907 } 30908 function ActionWithModal({ 30909 action, 30910 items, 30911 ActionTrigger, 30912 isBusy 30913 }) { 30914 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 30915 const actionTriggerProps = { 30916 action, 30917 onClick: () => { 30918 setIsModalOpen(true); 30919 }, 30920 items, 30921 isBusy 30922 }; 30923 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 30924 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { 30925 ...actionTriggerProps 30926 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 30927 action: action, 30928 items: items, 30929 closeModal: () => setIsModalOpen(false) 30930 })] 30931 }); 30932 } 30933 function ActionsDropdownMenuGroup({ 30934 actions, 30935 item 30936 }) { 30937 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 30938 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2.Group, { 30939 children: actions.map(action => { 30940 if ('RenderModal' in action) { 30941 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 30942 action: action, 30943 items: [item], 30944 ActionTrigger: DropdownMenuItemTrigger 30945 }, action.id); 30946 } 30947 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemTrigger, { 30948 action: action, 30949 onClick: () => { 30950 action.callback([item], { 30951 registry 30952 }); 30953 }, 30954 items: [item] 30955 }, action.id); 30956 }) 30957 }); 30958 } 30959 function ItemActions({ 30960 item, 30961 actions, 30962 isCompact 30963 }) { 30964 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 30965 const { 30966 primaryActions, 30967 eligibleActions 30968 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 30969 // If an action is eligible for all items, doesn't need 30970 // to provide the `isEligible` function. 30971 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 30972 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 30973 return { 30974 primaryActions: _primaryActions, 30975 eligibleActions: _eligibleActions 30976 }; 30977 }, [actions, item]); 30978 if (isCompact) { 30979 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 30980 item: item, 30981 actions: eligibleActions 30982 }); 30983 } 30984 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 30985 spacing: 1, 30986 justify: "flex-end", 30987 className: "dataviews-item-actions", 30988 style: { 30989 flexShrink: '0', 30990 width: 'auto' 30991 }, 30992 children: [!!primaryActions.length && primaryActions.map(action => { 30993 if ('RenderModal' in action) { 30994 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 30995 action: action, 30996 items: [item], 30997 ActionTrigger: ButtonTrigger 30998 }, action.id); 30999 } 31000 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ButtonTrigger, { 31001 action: action, 31002 onClick: () => { 31003 action.callback([item], { 31004 registry 31005 }); 31006 }, 31007 items: [item] 31008 }, action.id); 31009 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 31010 item: item, 31011 actions: eligibleActions 31012 })] 31013 }); 31014 } 31015 function CompactItemActions({ 31016 item, 31017 actions 31018 }) { 31019 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_DropdownMenuV2, { 31020 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31021 size: "compact", 31022 icon: more_vertical, 31023 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 31024 accessibleWhenDisabled: true, 31025 disabled: !actions.length, 31026 className: "dataviews-all-actions-button" 31027 }), 31028 placement: "bottom-end", 31029 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, { 31030 actions: actions, 31031 item: item 31032 }) 31033 }); 31034 } 31035 31036 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js 31037 /** 31038 * WordPress dependencies 31039 */ 31040 31041 31042 31043 31044 31045 31046 /** 31047 * Internal dependencies 31048 */ 31049 31050 31051 31052 31053 function useHasAPossibleBulkAction(actions, item) { 31054 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31055 return actions.some(action => { 31056 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 31057 }); 31058 }, [actions, item]); 31059 } 31060 function useSomeItemHasAPossibleBulkAction(actions, data) { 31061 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31062 return data.some(item => { 31063 return actions.some(action => { 31064 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 31065 }); 31066 }); 31067 }, [actions, data]); 31068 } 31069 function BulkSelectionCheckbox({ 31070 selection, 31071 onChangeSelection, 31072 data, 31073 actions, 31074 getItemId 31075 }) { 31076 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31077 return data.filter(item => { 31078 return actions.some(action => action.supportsBulk && (!action.isEligible || action.isEligible(item))); 31079 }); 31080 }, [data, actions]); 31081 const selectedItems = data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 31082 const areAllSelected = selectedItems.length === selectableItems.length; 31083 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 31084 className: "dataviews-view-table-selection-checkbox", 31085 __nextHasNoMarginBottom: true, 31086 checked: areAllSelected, 31087 indeterminate: !areAllSelected && !!selectedItems.length, 31088 onChange: () => { 31089 if (areAllSelected) { 31090 onChangeSelection([]); 31091 } else { 31092 onChangeSelection(selectableItems.map(item => getItemId(item))); 31093 } 31094 }, 31095 "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect all') : (0,external_wp_i18n_namespaceObject.__)('Select all') 31096 }); 31097 } 31098 function ActionTrigger({ 31099 action, 31100 onClick, 31101 isBusy, 31102 items 31103 }) { 31104 const label = typeof action.label === 'string' ? action.label : action.label(items); 31105 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31106 disabled: isBusy, 31107 accessibleWhenDisabled: true, 31108 label: label, 31109 icon: action.icon, 31110 isDestructive: action.isDestructive, 31111 size: "compact", 31112 onClick: onClick, 31113 isBusy: isBusy, 31114 tooltipPosition: "top" 31115 }); 31116 } 31117 const dataviews_bulk_actions_EMPTY_ARRAY = []; 31118 function ActionButton({ 31119 action, 31120 selectedItems, 31121 actionInProgress, 31122 setActionInProgress 31123 }) { 31124 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 31125 const selectedEligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31126 return selectedItems.filter(item => { 31127 return !action.isEligible || action.isEligible(item); 31128 }); 31129 }, [action, selectedItems]); 31130 if ('RenderModal' in action) { 31131 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 31132 action: action, 31133 items: selectedEligibleItems, 31134 ActionTrigger: ActionTrigger 31135 }, action.id); 31136 } 31137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { 31138 action: action, 31139 onClick: async () => { 31140 setActionInProgress(action.id); 31141 await action.callback(selectedItems, { 31142 registry 31143 }); 31144 setActionInProgress(null); 31145 }, 31146 items: selectedEligibleItems, 31147 isBusy: actionInProgress === action.id 31148 }, action.id); 31149 } 31150 function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) { 31151 const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of items. */ 31152 (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. */ 31153 (0,external_wp_i18n_namespaceObject._n)('%d Item', '%d Items', data.length), data.length); 31154 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31155 expanded: false, 31156 className: "dataviews-bulk-actions-footer__container", 31157 spacing: 3, 31158 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 31159 selection: selection, 31160 onChangeSelection: onChangeSelection, 31161 data: data, 31162 actions: actions, 31163 getItemId: getItemId 31164 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 31165 className: "dataviews-bulk-actions-footer__item-count", 31166 children: message 31167 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31168 className: "dataviews-bulk-actions-footer__action-buttons", 31169 expanded: false, 31170 spacing: 1, 31171 children: [actionsToShow.map(action => { 31172 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionButton, { 31173 action: action, 31174 selectedItems: selectedItems, 31175 actionInProgress: actionInProgress, 31176 setActionInProgress: setActionInProgress 31177 }, action.id); 31178 }), selectedItems.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31179 icon: close_small, 31180 showTooltip: true, 31181 tooltipPosition: "top", 31182 size: "compact", 31183 label: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 31184 disabled: !!actionInProgress, 31185 accessibleWhenDisabled: false, 31186 onClick: () => { 31187 onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY); 31188 } 31189 })] 31190 })] 31191 }); 31192 } 31193 function FooterContent({ 31194 selection, 31195 actions, 31196 onChangeSelection, 31197 data, 31198 getItemId 31199 }) { 31200 const [actionInProgress, setActionInProgress] = (0,external_wp_element_namespaceObject.useState)(null); 31201 const footerContent = (0,external_wp_element_namespaceObject.useRef)(null); 31202 const bulkActions = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => action.supportsBulk), [actions]); 31203 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31204 return data.filter(item => { 31205 return bulkActions.some(action => !action.isEligible || action.isEligible(item)); 31206 }); 31207 }, [data, bulkActions]); 31208 const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 31209 return data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 31210 }, [selection, data, getItemId, selectableItems]); 31211 const actionsToShow = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => { 31212 return action.supportsBulk && action.icon && selectedItems.some(item => !action.isEligible || action.isEligible(item)); 31213 }), [actions, selectedItems]); 31214 if (!actionInProgress) { 31215 if (footerContent.current) { 31216 footerContent.current = null; 31217 } 31218 return renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 31219 } else if (!footerContent.current) { 31220 footerContent.current = renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 31221 } 31222 return footerContent.current; 31223 } 31224 function BulkActionsFooter() { 31225 const { 31226 data, 31227 selection, 31228 actions = dataviews_bulk_actions_EMPTY_ARRAY, 31229 onChangeSelection, 31230 getItemId 31231 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 31232 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FooterContent, { 31233 selection: selection, 31234 onChangeSelection: onChangeSelection, 31235 data: data, 31236 actions: actions, 31237 getItemId: getItemId 31238 }); 31239 } 31240 31241 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 31242 /** 31243 * WordPress dependencies 31244 */ 31245 31246 31247 const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 31248 xmlns: "http://www.w3.org/2000/svg", 31249 viewBox: "0 0 24 24", 31250 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 31251 d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" 31252 }) 31253 }); 31254 /* harmony default export */ const arrow_left = (arrowLeft); 31255 31256 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-right.js 31257 /** 31258 * WordPress dependencies 31259 */ 31260 31261 31262 const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 31263 xmlns: "http://www.w3.org/2000/svg", 31264 viewBox: "0 0 24 24", 31265 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 31266 d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" 31267 }) 31268 }); 31269 /* harmony default export */ const arrow_right = (arrowRight); 31270 31271 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/unseen.js 31272 /** 31273 * WordPress dependencies 31274 */ 31275 31276 31277 const unseen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 31278 viewBox: "0 0 24 24", 31279 xmlns: "http://www.w3.org/2000/svg", 31280 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 31281 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" 31282 }) 31283 }); 31284 /* harmony default export */ const library_unseen = (unseen); 31285 31286 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js 31287 /** 31288 * External dependencies 31289 */ 31290 31291 /** 31292 * WordPress dependencies 31293 */ 31294 31295 31296 31297 31298 31299 /** 31300 * Internal dependencies 31301 */ 31302 31303 31304 31305 31306 31307 31308 const { 31309 DropdownMenuV2: column_header_menu_DropdownMenuV2 31310 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 31311 function WithDropDownMenuSeparators({ 31312 children 31313 }) { 31314 return external_wp_element_namespaceObject.Children.toArray(children).filter(Boolean).map((child, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { 31315 children: [i > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Separator, {}), child] 31316 }, i)); 31317 } 31318 const _HeaderMenu = (0,external_wp_element_namespaceObject.forwardRef)(function HeaderMenu({ 31319 fieldId, 31320 view, 31321 fields, 31322 onChangeView, 31323 onHide, 31324 setOpenedFilter 31325 }, ref) { 31326 const visibleFieldIds = getVisibleFieldIds(view, fields); 31327 const index = visibleFieldIds?.indexOf(fieldId); 31328 const isSorted = view.sort?.field === fieldId; 31329 let isHidable = false; 31330 let isSortable = false; 31331 let canAddFilter = false; 31332 let header; 31333 let operators = []; 31334 const combinedField = view.layout?.combinedFields?.find(f => f.id === fieldId); 31335 const field = fields.find(f => f.id === fieldId); 31336 if (!combinedField) { 31337 if (!field) { 31338 // No combined or regular field found. 31339 return null; 31340 } 31341 isHidable = field.enableHiding !== false; 31342 isSortable = field.enableSorting !== false; 31343 header = field.header; 31344 operators = sanitizeOperators(field); 31345 // Filter can be added: 31346 // 1. If the field is not already part of a view's filters. 31347 // 2. If the field meets the type and operator requirements. 31348 // 3. If it's not primary. If it is, it should be already visible. 31349 canAddFilter = !view.filters?.some(_filter => fieldId === _filter.field) && !!field.elements?.length && !!operators.length && !field.filterBy?.isPrimary; 31350 } else { 31351 header = combinedField.header || combinedField.label; 31352 } 31353 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2, { 31354 align: "start", 31355 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 31356 size: "compact", 31357 className: "dataviews-view-table-header-button", 31358 ref: ref, 31359 variant: "tertiary", 31360 children: [header, view.sort && isSorted && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 31361 "aria-hidden": "true", 31362 children: sortArrows[view.sort.direction] 31363 })] 31364 }), 31365 style: { 31366 minWidth: '240px' 31367 }, 31368 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithDropDownMenuSeparators, { 31369 children: [isSortable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Group, { 31370 children: SORTING_DIRECTIONS.map(direction => { 31371 const isChecked = view.sort && isSorted && view.sort.direction === direction; 31372 const value = `$fieldId}-$direction}`; 31373 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.RadioItem, { 31374 // All sorting radio items share the same name, so that 31375 // selecting a sorting option automatically deselects the 31376 // previously selected one, even if it is displayed in 31377 // another submenu. The field and direction are passed via 31378 // the `value` prop. 31379 name: "view-table-sorting", 31380 value: value, 31381 checked: isChecked, 31382 onChange: () => { 31383 onChangeView({ 31384 ...view, 31385 sort: { 31386 field: fieldId, 31387 direction 31388 } 31389 }); 31390 }, 31391 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31392 children: sortLabels[direction] 31393 }) 31394 }, value); 31395 }) 31396 }), canAddFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Group, { 31397 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31398 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31399 icon: library_funnel 31400 }), 31401 onClick: () => { 31402 setOpenedFilter(fieldId); 31403 onChangeView({ 31404 ...view, 31405 page: 1, 31406 filters: [...(view.filters || []), { 31407 field: fieldId, 31408 value: undefined, 31409 operator: operators[0] 31410 }] 31411 }); 31412 }, 31413 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31414 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 31415 }) 31416 }) 31417 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_DropdownMenuV2.Group, { 31418 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31419 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31420 icon: arrow_left 31421 }), 31422 disabled: index < 1, 31423 onClick: () => { 31424 var _visibleFieldIds$slic; 31425 onChangeView({ 31426 ...view, 31427 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), fieldId, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 31428 }); 31429 }, 31430 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31431 children: (0,external_wp_i18n_namespaceObject.__)('Move left') 31432 }) 31433 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31434 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31435 icon: arrow_right 31436 }), 31437 disabled: index >= visibleFieldIds.length - 1, 31438 onClick: () => { 31439 var _visibleFieldIds$slic2; 31440 onChangeView({ 31441 ...view, 31442 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], fieldId, ...visibleFieldIds.slice(index + 2)] 31443 }); 31444 }, 31445 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31446 children: (0,external_wp_i18n_namespaceObject.__)('Move right') 31447 }) 31448 }), isHidable && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.Item, { 31449 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 31450 icon: library_unseen 31451 }), 31452 onClick: () => { 31453 onHide(field); 31454 onChangeView({ 31455 ...view, 31456 fields: visibleFieldIds.filter(id => id !== fieldId) 31457 }); 31458 }, 31459 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_DropdownMenuV2.ItemLabel, { 31460 children: (0,external_wp_i18n_namespaceObject.__)('Hide column') 31461 }) 31462 })] 31463 })] 31464 }) 31465 }); 31466 }); 31467 31468 // @ts-expect-error Lift the `Item` type argument through the forwardRef. 31469 const ColumnHeaderMenu = _HeaderMenu; 31470 /* harmony default export */ const column_header_menu = (ColumnHeaderMenu); 31471 31472 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js 31473 /** 31474 * External dependencies 31475 */ 31476 31477 31478 /** 31479 * WordPress dependencies 31480 */ 31481 31482 31483 31484 31485 /** 31486 * Internal dependencies 31487 */ 31488 31489 31490 31491 31492 31493 31494 31495 31496 31497 function TableColumn({ 31498 column, 31499 fields, 31500 view, 31501 ...props 31502 }) { 31503 const field = fields.find(f => f.id === column); 31504 if (!!field) { 31505 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumnField, { 31506 ...props, 31507 field: field 31508 }); 31509 } 31510 const combinedField = view.layout?.combinedFields?.find(f => f.id === column); 31511 if (!!combinedField) { 31512 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumnCombined, { 31513 ...props, 31514 fields: fields, 31515 view: view, 31516 field: combinedField 31517 }); 31518 } 31519 return null; 31520 } 31521 function TableColumnField({ 31522 primaryField, 31523 item, 31524 field 31525 }) { 31526 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31527 className: dist_clsx('dataviews-view-table__cell-content-wrapper', { 31528 'dataviews-view-table__primary-field': primaryField?.id === field.id 31529 }), 31530 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 31531 item 31532 }) 31533 }); 31534 } 31535 function TableColumnCombined({ 31536 field, 31537 ...props 31538 }) { 31539 const children = field.children.map(child => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumn, { 31540 ...props, 31541 column: child 31542 }, child)); 31543 if (field.direction === 'horizontal') { 31544 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 31545 spacing: 3, 31546 children: children 31547 }); 31548 } 31549 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 31550 spacing: 0, 31551 children: children 31552 }); 31553 } 31554 function TableRow({ 31555 hasBulkActions, 31556 item, 31557 actions, 31558 fields, 31559 id, 31560 view, 31561 primaryField, 31562 selection, 31563 getItemId, 31564 onChangeSelection 31565 }) { 31566 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 31567 const isSelected = hasPossibleBulkAction && selection.includes(id); 31568 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 31569 const handleMouseEnter = () => { 31570 setIsHovered(true); 31571 }; 31572 const handleMouseLeave = () => { 31573 setIsHovered(false); 31574 }; 31575 31576 // Will be set to true if `onTouchStart` fires. This happens before 31577 // `onClick` and can be used to exclude touchscreen devices from certain 31578 // behaviours. 31579 const isTouchDeviceRef = (0,external_wp_element_namespaceObject.useRef)(false); 31580 const columns = getVisibleFieldIds(view, fields); 31581 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 31582 className: dist_clsx('dataviews-view-table__row', { 31583 'is-selected': hasPossibleBulkAction && isSelected, 31584 'is-hovered': isHovered, 31585 'has-bulk-actions': hasPossibleBulkAction 31586 }), 31587 onMouseEnter: handleMouseEnter, 31588 onMouseLeave: handleMouseLeave, 31589 onTouchStart: () => { 31590 isTouchDeviceRef.current = true; 31591 }, 31592 onClick: () => { 31593 if (!hasPossibleBulkAction) { 31594 return; 31595 } 31596 if (!isTouchDeviceRef.current && document.getSelection()?.type !== 'Range') { 31597 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [id]); 31598 } 31599 }, 31600 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 31601 className: "dataviews-view-table__checkbox-column", 31602 style: { 31603 width: '1%' 31604 }, 31605 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31606 className: "dataviews-view-table__cell-content-wrapper", 31607 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 31608 item: item, 31609 selection: selection, 31610 onChangeSelection: onChangeSelection, 31611 getItemId: getItemId, 31612 primaryField: primaryField, 31613 disabled: !hasPossibleBulkAction 31614 }) 31615 }) 31616 }), columns.map(column => { 31617 var _view$layout$styles$c; 31618 // Explicits picks the supported styles. 31619 const { 31620 width, 31621 maxWidth, 31622 minWidth 31623 } = (_view$layout$styles$c = view.layout?.styles?.[column]) !== null && _view$layout$styles$c !== void 0 ? _view$layout$styles$c : {}; 31624 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 31625 style: { 31626 width, 31627 maxWidth, 31628 minWidth 31629 }, 31630 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumn, { 31631 primaryField: primaryField, 31632 fields: fields, 31633 item: item, 31634 column: column, 31635 view: view 31636 }) 31637 }, column); 31638 }), !!actions?.length && 31639 /*#__PURE__*/ 31640 // Disable reason: we are not making the element interactive, 31641 // but preventing any click events from bubbling up to the 31642 // table row. This allows us to add a click handler to the row 31643 // itself (to toggle row selection) without erroneously 31644 // intercepting click events from ItemActions. 31645 /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ 31646 (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 31647 className: "dataviews-view-table__actions-column", 31648 onClick: e => e.stopPropagation(), 31649 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 31650 item: item, 31651 actions: actions 31652 }) 31653 }) 31654 /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */] 31655 }); 31656 } 31657 function ViewTable({ 31658 actions, 31659 data, 31660 fields, 31661 getItemId, 31662 isLoading = false, 31663 onChangeView, 31664 onChangeSelection, 31665 selection, 31666 setOpenedFilter, 31667 view 31668 }) { 31669 const headerMenuRefs = (0,external_wp_element_namespaceObject.useRef)(new Map()); 31670 const headerMenuToFocusRef = (0,external_wp_element_namespaceObject.useRef)(); 31671 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_namespaceObject.useState)(); 31672 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 31673 (0,external_wp_element_namespaceObject.useEffect)(() => { 31674 if (headerMenuToFocusRef.current) { 31675 headerMenuToFocusRef.current.focus(); 31676 headerMenuToFocusRef.current = undefined; 31677 } 31678 }); 31679 const tableNoticeId = (0,external_wp_element_namespaceObject.useId)(); 31680 if (nextHeaderMenuToFocus) { 31681 // If we need to force focus, we short-circuit rendering here 31682 // to prevent any additional work while we handle that. 31683 // Clearing out the focus directive is necessary to make sure 31684 // future renders don't cause unexpected focus jumps. 31685 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 31686 setNextHeaderMenuToFocus(undefined); 31687 return; 31688 } 31689 const onHide = field => { 31690 const hidden = headerMenuRefs.current.get(field.id); 31691 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : undefined; 31692 setNextHeaderMenuToFocus(fallback?.node); 31693 }; 31694 const columns = getVisibleFieldIds(view, fields); 31695 const hasData = !!data?.length; 31696 const primaryField = fields.find(field => field.id === view.layout?.primaryField); 31697 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31698 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("table", { 31699 className: "dataviews-view-table", 31700 "aria-busy": isLoading, 31701 "aria-describedby": tableNoticeId, 31702 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { 31703 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 31704 className: "dataviews-view-table__row", 31705 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 31706 className: "dataviews-view-table__checkbox-column", 31707 style: { 31708 width: '1%' 31709 }, 31710 scope: "col", 31711 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 31712 selection: selection, 31713 onChangeSelection: onChangeSelection, 31714 data: data, 31715 actions: actions, 31716 getItemId: getItemId 31717 }) 31718 }), columns.map((column, index) => { 31719 var _view$layout$styles$c2; 31720 // Explicits picks the supported styles. 31721 const { 31722 width, 31723 maxWidth, 31724 minWidth 31725 } = (_view$layout$styles$c2 = view.layout?.styles?.[column]) !== null && _view$layout$styles$c2 !== void 0 ? _view$layout$styles$c2 : {}; 31726 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 31727 style: { 31728 width, 31729 maxWidth, 31730 minWidth 31731 }, 31732 "aria-sort": view.sort?.field === column ? sortValues[view.sort.direction] : undefined, 31733 scope: "col", 31734 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { 31735 ref: node => { 31736 if (node) { 31737 headerMenuRefs.current.set(column, { 31738 node, 31739 fallback: columns[index > 0 ? index - 1 : 1] 31740 }); 31741 } else { 31742 headerMenuRefs.current.delete(column); 31743 } 31744 }, 31745 fieldId: column, 31746 view: view, 31747 fields: fields, 31748 onChangeView: onChangeView, 31749 onHide: onHide, 31750 setOpenedFilter: setOpenedFilter 31751 }) 31752 }, column); 31753 }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 31754 className: "dataviews-view-table__actions-column", 31755 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 31756 className: "dataviews-view-table-header", 31757 children: (0,external_wp_i18n_namespaceObject.__)('Actions') 31758 }) 31759 })] 31760 }) 31761 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { 31762 children: hasData && data.map((item, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableRow, { 31763 item: item, 31764 hasBulkActions: hasBulkActions, 31765 actions: actions, 31766 fields: fields, 31767 id: getItemId(item) || index.toString(), 31768 view: view, 31769 primaryField: primaryField, 31770 selection: selection, 31771 getItemId: getItemId, 31772 onChangeSelection: onChangeSelection 31773 }, getItemId(item))) 31774 })] 31775 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31776 className: dist_clsx({ 31777 'dataviews-loading': isLoading, 31778 'dataviews-no-results': !hasData && !isLoading 31779 }), 31780 id: tableNoticeId, 31781 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 31782 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 31783 }) 31784 })] 31785 }); 31786 } 31787 /* harmony default export */ const table = (ViewTable); 31788 31789 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js 31790 /** 31791 * External dependencies 31792 */ 31793 31794 31795 /** 31796 * WordPress dependencies 31797 */ 31798 31799 31800 31801 /** 31802 * Internal dependencies 31803 */ 31804 31805 31806 31807 31808 31809 31810 function GridItem({ 31811 selection, 31812 onChangeSelection, 31813 getItemId, 31814 item, 31815 actions, 31816 mediaField, 31817 primaryField, 31818 visibleFields, 31819 badgeFields, 31820 columnFields 31821 }) { 31822 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 31823 const id = getItemId(item); 31824 const isSelected = selection.includes(id); 31825 const renderedMediaField = mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 31826 item: item 31827 }) : null; 31828 const renderedPrimaryField = primaryField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(primaryField.render, { 31829 item: item 31830 }) : null; 31831 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 31832 spacing: 0, 31833 className: dist_clsx('dataviews-view-grid__card', { 31834 'is-selected': hasBulkAction && isSelected 31835 }), 31836 onClickCapture: event => { 31837 if (event.ctrlKey || event.metaKey) { 31838 event.stopPropagation(); 31839 event.preventDefault(); 31840 if (!hasBulkAction) { 31841 return; 31842 } 31843 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 31844 } 31845 }, 31846 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31847 className: "dataviews-view-grid__media", 31848 children: renderedMediaField 31849 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 31850 item: item, 31851 selection: selection, 31852 onChangeSelection: onChangeSelection, 31853 getItemId: getItemId, 31854 primaryField: primaryField, 31855 disabled: !hasBulkAction 31856 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31857 justify: "space-between", 31858 className: "dataviews-view-grid__title-actions", 31859 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 31860 className: "dataviews-view-grid__primary-field", 31861 children: renderedPrimaryField 31862 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 31863 item: item, 31864 actions: actions, 31865 isCompact: true 31866 })] 31867 }), !!badgeFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 31868 className: "dataviews-view-grid__badge-fields", 31869 spacing: 2, 31870 wrap: true, 31871 alignment: "top", 31872 justify: "flex-start", 31873 children: badgeFields.map(field => { 31874 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 31875 className: "dataviews-view-grid__field-value", 31876 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 31877 item: item 31878 }) 31879 }, field.id); 31880 }) 31881 }), !!visibleFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 31882 className: "dataviews-view-grid__fields", 31883 spacing: 1, 31884 children: visibleFields.map(field => { 31885 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 31886 className: dist_clsx('dataviews-view-grid__field', columnFields?.includes(field.id) ? 'is-column' : 'is-row'), 31887 gap: 1, 31888 justify: "flex-start", 31889 expanded: true, 31890 style: { 31891 height: 'auto' 31892 }, 31893 direction: columnFields?.includes(field.id) ? 'column' : 'row', 31894 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31895 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 31896 className: "dataviews-view-grid__field-name", 31897 children: field.header 31898 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 31899 className: "dataviews-view-grid__field-value", 31900 style: { 31901 maxHeight: 'none' 31902 }, 31903 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 31904 item: item 31905 }) 31906 })] 31907 }) 31908 }, field.id); 31909 }) 31910 })] 31911 }, id); 31912 } 31913 function ViewGrid({ 31914 actions, 31915 data, 31916 fields, 31917 getItemId, 31918 isLoading, 31919 onChangeSelection, 31920 selection, 31921 view, 31922 density 31923 }) { 31924 const mediaField = fields.find(field => field.id === view.layout?.mediaField); 31925 const primaryField = fields.find(field => field.id === view.layout?.primaryField); 31926 const viewFields = view.fields || fields.map(field => field.id); 31927 const { 31928 visibleFields, 31929 badgeFields 31930 } = fields.reduce((accumulator, field) => { 31931 if (!viewFields.includes(field.id) || [view.layout?.mediaField, view?.layout?.primaryField].includes(field.id)) { 31932 return accumulator; 31933 } 31934 // If the field is a badge field, add it to the badgeFields array 31935 // otherwise add it to the rest visibleFields array. 31936 const key = view.layout?.badgeFields?.includes(field.id) ? 'badgeFields' : 'visibleFields'; 31937 accumulator[key].push(field); 31938 return accumulator; 31939 }, { 31940 visibleFields: [], 31941 badgeFields: [] 31942 }); 31943 const hasData = !!data?.length; 31944 const gridStyle = density ? { 31945 gridTemplateColumns: `repeat($density}, minmax(0, 1fr))` 31946 } : {}; 31947 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31948 children: [hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 31949 gap: 8, 31950 columns: 2, 31951 alignment: "top", 31952 className: "dataviews-view-grid", 31953 style: gridStyle, 31954 "aria-busy": isLoading, 31955 children: data.map(item => { 31956 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItem, { 31957 selection: selection, 31958 onChangeSelection: onChangeSelection, 31959 getItemId: getItemId, 31960 item: item, 31961 actions: actions, 31962 mediaField: mediaField, 31963 primaryField: primaryField, 31964 visibleFields: visibleFields, 31965 badgeFields: badgeFields, 31966 columnFields: view.layout?.columnFields 31967 }, getItemId(item)); 31968 }) 31969 }), !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31970 className: dist_clsx({ 31971 'dataviews-loading': isLoading, 31972 'dataviews-no-results': !isLoading 31973 }), 31974 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 31975 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 31976 }) 31977 })] 31978 }); 31979 } 31980 31981 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js 31982 /** 31983 * External dependencies 31984 */ 31985 31986 31987 /** 31988 * WordPress dependencies 31989 */ 31990 31991 31992 31993 31994 31995 31996 31997 /** 31998 * Internal dependencies 31999 */ 32000 32001 32002 32003 32004 const { 32005 DropdownMenuV2: DropdownMenu 32006 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 32007 function generateItemWrapperCompositeId(idPrefix) { 32008 return `$idPrefix}-item-wrapper`; 32009 } 32010 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 32011 return `$idPrefix}-primary-action-$primaryActionId}`; 32012 } 32013 function generateDropdownTriggerCompositeId(idPrefix) { 32014 return `$idPrefix}-dropdown`; 32015 } 32016 function PrimaryActionGridCell({ 32017 idPrefix, 32018 primaryAction, 32019 item 32020 }) { 32021 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 32022 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 32023 const compositeItemId = generatePrimaryActionCompositeId(idPrefix, primaryAction.id); 32024 const label = typeof primaryAction.label === 'string' ? primaryAction.label : primaryAction.label([item]); 32025 return 'RenderModal' in primaryAction ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32026 role: "gridcell", 32027 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32028 id: compositeItemId, 32029 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32030 label: label, 32031 icon: primaryAction.icon, 32032 isDestructive: primaryAction.isDestructive, 32033 size: "small", 32034 onClick: () => setIsModalOpen(true) 32035 }), 32036 children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 32037 action: primaryAction, 32038 items: [item], 32039 closeModal: () => setIsModalOpen(false) 32040 }) 32041 }) 32042 }, primaryAction.id) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32043 role: "gridcell", 32044 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32045 id: compositeItemId, 32046 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32047 label: label, 32048 icon: primaryAction.icon, 32049 isDestructive: primaryAction.isDestructive, 32050 size: "small", 32051 onClick: () => { 32052 primaryAction.callback([item], { 32053 registry 32054 }); 32055 } 32056 }) 32057 }) 32058 }, primaryAction.id); 32059 } 32060 function ListItem({ 32061 actions, 32062 idPrefix, 32063 isSelected, 32064 item, 32065 mediaField, 32066 onSelect, 32067 primaryField, 32068 visibleFields, 32069 onDropdownTriggerKeyDown 32070 }) { 32071 const itemRef = (0,external_wp_element_namespaceObject.useRef)(null); 32072 const labelId = `$idPrefix}-label`; 32073 const descriptionId = `$idPrefix}-description`; 32074 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 32075 const handleHover = ({ 32076 type 32077 }) => { 32078 const isHover = type === 'mouseenter'; 32079 setIsHovered(isHover); 32080 }; 32081 (0,external_wp_element_namespaceObject.useEffect)(() => { 32082 if (isSelected) { 32083 itemRef.current?.scrollIntoView({ 32084 behavior: 'auto', 32085 block: 'nearest', 32086 inline: 'nearest' 32087 }); 32088 } 32089 }, [isSelected]); 32090 const { 32091 primaryAction, 32092 eligibleActions 32093 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 32094 // If an action is eligible for all items, doesn't need 32095 // to provide the `isEligible` function. 32096 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 32097 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 32098 return { 32099 primaryAction: _primaryActions?.[0], 32100 eligibleActions: _eligibleActions 32101 }; 32102 }, [actions, item]); 32103 const renderedMediaField = mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 32104 item: item 32105 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32106 className: "dataviews-view-list__media-placeholder" 32107 }); 32108 const renderedPrimaryField = primaryField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(primaryField.render, { 32109 item: item 32110 }) : null; 32111 const usedActions = eligibleActions?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32112 spacing: 3, 32113 className: "dataviews-view-list__item-actions", 32114 children: [primaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActionGridCell, { 32115 idPrefix: idPrefix, 32116 primaryAction: primaryAction, 32117 item: item 32118 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32119 role: "gridcell", 32120 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenu, { 32121 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32122 id: generateDropdownTriggerCompositeId(idPrefix), 32123 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32124 size: "small", 32125 icon: more_vertical, 32126 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 32127 accessibleWhenDisabled: true, 32128 disabled: !actions.length, 32129 onKeyDown: onDropdownTriggerKeyDown 32130 }) 32131 }), 32132 placement: "bottom-end", 32133 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, { 32134 actions: eligibleActions, 32135 item: item 32136 }) 32137 }) 32138 })] 32139 }); 32140 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Row, { 32141 ref: itemRef, 32142 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {}), 32143 role: "row", 32144 className: dist_clsx({ 32145 'is-selected': isSelected, 32146 'is-hovered': isHovered 32147 }), 32148 onMouseEnter: handleHover, 32149 onMouseLeave: handleHover, 32150 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32151 className: "dataviews-view-list__item-wrapper", 32152 spacing: 0, 32153 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32154 role: "gridcell", 32155 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 32156 id: generateItemWrapperCompositeId(idPrefix), 32157 "aria-pressed": isSelected, 32158 "aria-labelledby": labelId, 32159 "aria-describedby": descriptionId, 32160 className: "dataviews-view-list__item", 32161 onClick: () => onSelect(item) 32162 }) 32163 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32164 spacing: 3, 32165 justify: "start", 32166 alignment: "flex-start", 32167 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32168 className: "dataviews-view-list__media-wrapper", 32169 children: renderedMediaField 32170 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32171 spacing: 1, 32172 className: "dataviews-view-list__field-wrapper", 32173 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32174 spacing: 0, 32175 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32176 className: "dataviews-view-list__primary-field", 32177 id: labelId, 32178 children: renderedPrimaryField 32179 }), usedActions] 32180 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32181 className: "dataviews-view-list__fields", 32182 id: descriptionId, 32183 children: visibleFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 32184 className: "dataviews-view-list__field", 32185 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 32186 as: "span", 32187 className: "dataviews-view-list__field-label", 32188 children: field.label 32189 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 32190 className: "dataviews-view-list__field-value", 32191 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 32192 item: item 32193 }) 32194 })] 32195 }, field.id)) 32196 })] 32197 })] 32198 })] 32199 }) 32200 }); 32201 } 32202 function ViewList(props) { 32203 const { 32204 actions, 32205 data, 32206 fields, 32207 getItemId, 32208 isLoading, 32209 onChangeSelection, 32210 selection, 32211 view 32212 } = props; 32213 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, 'view-list'); 32214 const selectedItem = data?.findLast(item => selection.includes(getItemId(item))); 32215 const mediaField = fields.find(field => field.id === view.layout?.mediaField); 32216 const primaryField = fields.find(field => field.id === view.layout?.primaryField); 32217 const viewFields = view.fields || fields.map(field => field.id); 32218 const visibleFields = fields.filter(field => viewFields.includes(field.id) && ![view.layout?.primaryField, view.layout?.mediaField].includes(field.id)); 32219 const onSelect = item => onChangeSelection([getItemId(item)]); 32220 const generateCompositeItemIdPrefix = (0,external_wp_element_namespaceObject.useCallback)(item => `$baseId}-$getItemId(item)}`, [baseId, getItemId]); 32221 const isActiveCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((item, idToCheck) => { 32222 // All composite items use the same prefix in their IDs. 32223 return idToCheck.startsWith(generateCompositeItemIdPrefix(item)); 32224 }, [generateCompositeItemIdPrefix]); 32225 32226 // Controlled state for the active composite item. 32227 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(undefined); 32228 32229 // Update the active composite item when the selected item changes. 32230 (0,external_wp_element_namespaceObject.useEffect)(() => { 32231 if (selectedItem) { 32232 setActiveCompositeId(generateItemWrapperCompositeId(generateCompositeItemIdPrefix(selectedItem))); 32233 } 32234 }, [selectedItem, generateCompositeItemIdPrefix]); 32235 const activeItemIndex = data.findIndex(item => isActiveCompositeItem(item, activeCompositeId !== null && activeCompositeId !== void 0 ? activeCompositeId : '')); 32236 const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex); 32237 const isActiveIdInList = activeItemIndex !== -1; 32238 const selectCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((targetIndex, generateCompositeId) => { 32239 // Clamping between 0 and data.length - 1 to avoid out of bounds. 32240 const clampedIndex = Math.min(data.length - 1, Math.max(0, targetIndex)); 32241 if (!data[clampedIndex]) { 32242 return; 32243 } 32244 const itemIdPrefix = generateCompositeItemIdPrefix(data[clampedIndex]); 32245 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 32246 setActiveCompositeId(targetCompositeItemId); 32247 document.getElementById(targetCompositeItemId)?.focus(); 32248 }, [data, generateCompositeItemIdPrefix]); 32249 32250 // Select a new active composite item when the current active item 32251 // is removed from the list. 32252 (0,external_wp_element_namespaceObject.useEffect)(() => { 32253 const wasActiveIdInList = previousActiveItemIndex !== undefined && previousActiveItemIndex !== -1; 32254 if (!isActiveIdInList && wasActiveIdInList) { 32255 // By picking `previousActiveItemIndex` as the next item index, we are 32256 // basically picking the item that would have been after the deleted one. 32257 // If the previously active (and removed) item was the last of the list, 32258 // we will select the item before it — which is the new last item. 32259 selectCompositeItem(previousActiveItemIndex, generateItemWrapperCompositeId); 32260 } 32261 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 32262 32263 // Prevent the default behavior (open dropdown menu) and instead select the 32264 // dropdown menu trigger on the previous/next row. 32265 // https://github.com/ariakit/ariakit/issues/3768 32266 const onDropdownTriggerKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => { 32267 if (event.key === 'ArrowDown') { 32268 // Select the dropdown menu trigger item in the next row. 32269 event.preventDefault(); 32270 selectCompositeItem(activeItemIndex + 1, generateDropdownTriggerCompositeId); 32271 } 32272 if (event.key === 'ArrowUp') { 32273 // Select the dropdown menu trigger item in the previous row. 32274 event.preventDefault(); 32275 selectCompositeItem(activeItemIndex - 1, generateDropdownTriggerCompositeId); 32276 } 32277 }, [selectCompositeItem, activeItemIndex]); 32278 const hasData = data?.length; 32279 if (!hasData) { 32280 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32281 className: dist_clsx({ 32282 'dataviews-loading': isLoading, 32283 'dataviews-no-results': !hasData && !isLoading 32284 }), 32285 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 32286 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 32287 }) 32288 }); 32289 } 32290 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 32291 id: baseId, 32292 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {}), 32293 className: "dataviews-view-list", 32294 role: "grid", 32295 activeId: activeCompositeId, 32296 setActiveId: setActiveCompositeId, 32297 children: data.map(item => { 32298 const id = generateCompositeItemIdPrefix(item); 32299 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListItem, { 32300 idPrefix: id, 32301 actions: actions, 32302 item: item, 32303 isSelected: item === selectedItem, 32304 onSelect: onSelect, 32305 mediaField: mediaField, 32306 primaryField: primaryField, 32307 visibleFields: visibleFields, 32308 onDropdownTriggerKeyDown: onDropdownTriggerKeyDown 32309 }, id); 32310 }) 32311 }); 32312 } 32313 32314 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js 32315 /** 32316 * WordPress dependencies 32317 */ 32318 32319 32320 32321 /** 32322 * Internal dependencies 32323 */ 32324 32325 32326 32327 32328 const VIEW_LAYOUTS = [{ 32329 type: constants_LAYOUT_TABLE, 32330 label: (0,external_wp_i18n_namespaceObject.__)('Table'), 32331 component: table, 32332 icon: block_table 32333 }, { 32334 type: constants_LAYOUT_GRID, 32335 label: (0,external_wp_i18n_namespaceObject.__)('Grid'), 32336 component: ViewGrid, 32337 icon: library_category 32338 }, { 32339 type: constants_LAYOUT_LIST, 32340 label: (0,external_wp_i18n_namespaceObject.__)('List'), 32341 component: ViewList, 32342 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets 32343 }]; 32344 function getNotHidableFieldIds(view) { 32345 if (view.type === 'table') { 32346 var _view$layout$combined; 32347 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); 32348 } 32349 if (view.type === 'grid') { 32350 return [view.layout?.primaryField, view.layout?.mediaField].filter(item => !!item); 32351 } 32352 if (view.type === 'list') { 32353 return [view.layout?.primaryField, view.layout?.mediaField].filter(item => !!item); 32354 } 32355 return []; 32356 } 32357 function getCombinedFieldIds(view) { 32358 const combinedFields = []; 32359 if (view.type === constants_LAYOUT_TABLE && view.layout?.combinedFields) { 32360 view.layout.combinedFields.forEach(combination => { 32361 combinedFields.push(...combination.children); 32362 }); 32363 } 32364 return combinedFields; 32365 } 32366 function getVisibleFieldIds(view, fields) { 32367 const fieldsToExclude = getCombinedFieldIds(view); 32368 if (view.fields) { 32369 return view.fields.filter(id => !fieldsToExclude.includes(id)); 32370 } 32371 const visibleFields = []; 32372 if (view.type === constants_LAYOUT_TABLE && view.layout?.combinedFields) { 32373 visibleFields.push(...view.layout.combinedFields.map(({ 32374 id 32375 }) => id)); 32376 } 32377 visibleFields.push(...fields.filter(({ 32378 id 32379 }) => !fieldsToExclude.includes(id)).map(({ 32380 id 32381 }) => id)); 32382 return visibleFields; 32383 } 32384 function getHiddenFieldIds(view, fields) { 32385 const fieldsToExclude = [...getCombinedFieldIds(view), ...getVisibleFieldIds(view, fields)]; 32386 32387 // The media field does not need to be in the view.fields to be displayed. 32388 if (view.type === constants_LAYOUT_GRID && view.layout?.mediaField) { 32389 fieldsToExclude.push(view.layout?.mediaField); 32390 } 32391 if (view.type === constants_LAYOUT_LIST && view.layout?.mediaField) { 32392 fieldsToExclude.push(view.layout?.mediaField); 32393 } 32394 return fields.filter(({ 32395 id, 32396 enableHiding 32397 }) => !fieldsToExclude.includes(id) && enableHiding).map(({ 32398 id 32399 }) => id); 32400 } 32401 32402 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js 32403 /** 32404 * External dependencies 32405 */ 32406 32407 /** 32408 * WordPress dependencies 32409 */ 32410 32411 32412 /** 32413 * Internal dependencies 32414 */ 32415 32416 32417 32418 function DataViewsLayout() { 32419 const { 32420 actions = [], 32421 data, 32422 fields, 32423 getItemId, 32424 isLoading, 32425 view, 32426 onChangeView, 32427 selection, 32428 onChangeSelection, 32429 setOpenedFilter, 32430 density 32431 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32432 const ViewComponent = VIEW_LAYOUTS.find(v => v.type === view.type)?.component; 32433 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewComponent, { 32434 actions: actions, 32435 data: data, 32436 fields: fields, 32437 getItemId: getItemId, 32438 isLoading: isLoading, 32439 onChangeView: onChangeView, 32440 onChangeSelection: onChangeSelection, 32441 selection: selection, 32442 setOpenedFilter: setOpenedFilter, 32443 view: view, 32444 density: density 32445 }); 32446 } 32447 32448 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js 32449 /** 32450 * WordPress dependencies 32451 */ 32452 32453 32454 32455 32456 32457 /** 32458 * Internal dependencies 32459 */ 32460 32461 32462 32463 function DataViewsPagination() { 32464 var _view$page; 32465 const { 32466 view, 32467 onChangeView, 32468 paginationInfo: { 32469 totalItems = 0, 32470 totalPages 32471 } 32472 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32473 if (!totalItems || !totalPages) { 32474 return null; 32475 } 32476 const currentPage = (_view$page = view.page) !== null && _view$page !== void 0 ? _view$page : 1; 32477 const pageSelectOptions = Array.from(Array(totalPages)).map((_, i) => { 32478 const page = i + 1; 32479 return { 32480 value: page.toString(), 32481 label: page.toString(), 32482 'aria-label': currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)( 32483 // translators: Current page number in total number of pages 32484 (0,external_wp_i18n_namespaceObject.__)('Page %1$s of %2$s'), currentPage, totalPages) : page.toString() 32485 }; 32486 }); 32487 return !!totalItems && totalPages !== 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32488 expanded: false, 32489 className: "dataviews-pagination", 32490 justify: "end", 32491 spacing: 6, 32492 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 32493 justify: "flex-start", 32494 expanded: false, 32495 spacing: 1, 32496 className: "dataviews-pagination__page-select", 32497 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( 32498 // translators: 1: Current page number, 2: Total number of pages. 32499 (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { 32500 div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32501 "aria-hidden": true 32502 }), 32503 CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 32504 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), 32505 value: currentPage.toString(), 32506 options: pageSelectOptions, 32507 onChange: newValue => { 32508 onChangeView({ 32509 ...view, 32510 page: +newValue 32511 }); 32512 }, 32513 size: "small", 32514 __nextHasNoMarginBottom: true, 32515 variant: "minimal" 32516 }) 32517 }) 32518 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32519 expanded: false, 32520 spacing: 1, 32521 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32522 onClick: () => onChangeView({ 32523 ...view, 32524 page: currentPage - 1 32525 }), 32526 disabled: currentPage === 1, 32527 accessibleWhenDisabled: true, 32528 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 32529 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 32530 showTooltip: true, 32531 size: "compact", 32532 tooltipPosition: "top" 32533 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32534 onClick: () => onChangeView({ 32535 ...view, 32536 page: currentPage + 1 32537 }), 32538 disabled: currentPage >= totalPages, 32539 accessibleWhenDisabled: true, 32540 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 32541 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 32542 showTooltip: true, 32543 size: "compact", 32544 tooltipPosition: "top" 32545 })] 32546 })] 32547 }); 32548 } 32549 /* harmony default export */ const dataviews_pagination = ((0,external_wp_element_namespaceObject.memo)(DataViewsPagination)); 32550 32551 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js 32552 /** 32553 * WordPress dependencies 32554 */ 32555 32556 32557 32558 /** 32559 * Internal dependencies 32560 */ 32561 32562 32563 32564 32565 32566 32567 const dataviews_footer_EMPTY_ARRAY = []; 32568 function DataViewsFooter() { 32569 const { 32570 view, 32571 paginationInfo: { 32572 totalItems = 0, 32573 totalPages 32574 }, 32575 data, 32576 actions = dataviews_footer_EMPTY_ARRAY 32577 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32578 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type); 32579 if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) { 32580 return null; 32581 } 32582 return !!totalItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32583 expanded: false, 32584 justify: "end", 32585 className: "dataviews-footer", 32586 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination, {})] 32587 }); 32588 } 32589 32590 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js 32591 /** 32592 * WordPress dependencies 32593 */ 32594 32595 32596 32597 32598 32599 /** 32600 * Internal dependencies 32601 */ 32602 32603 32604 const DataViewsSearch = (0,external_wp_element_namespaceObject.memo)(function Search({ 32605 label 32606 }) { 32607 const { 32608 view, 32609 onChangeView 32610 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32611 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(view.search); 32612 (0,external_wp_element_namespaceObject.useEffect)(() => { 32613 var _view$search; 32614 setSearch((_view$search = view.search) !== null && _view$search !== void 0 ? _view$search : ''); 32615 }, [view.search, setSearch]); 32616 const onChangeViewRef = (0,external_wp_element_namespaceObject.useRef)(onChangeView); 32617 const viewRef = (0,external_wp_element_namespaceObject.useRef)(view); 32618 (0,external_wp_element_namespaceObject.useEffect)(() => { 32619 onChangeViewRef.current = onChangeView; 32620 viewRef.current = view; 32621 }, [onChangeView, view]); 32622 (0,external_wp_element_namespaceObject.useEffect)(() => { 32623 if (debouncedSearch !== viewRef.current?.search) { 32624 onChangeViewRef.current({ 32625 ...viewRef.current, 32626 page: 1, 32627 search: debouncedSearch 32628 }); 32629 } 32630 }, [debouncedSearch]); 32631 const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)('Search'); 32632 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 32633 className: "dataviews-search", 32634 __nextHasNoMarginBottom: true, 32635 onChange: setSearch, 32636 value: search, 32637 label: searchLabel, 32638 placeholder: searchLabel, 32639 size: "compact" 32640 }); 32641 }); 32642 /* harmony default export */ const dataviews_search = (DataViewsSearch); 32643 32644 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 32645 /** 32646 * WordPress dependencies 32647 */ 32648 32649 32650 const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 32651 viewBox: "0 0 24 24", 32652 xmlns: "http://www.w3.org/2000/svg", 32653 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 32654 d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" 32655 }) 32656 }); 32657 /* harmony default export */ const chevron_up = (chevronUp); 32658 32659 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 32660 /** 32661 * WordPress dependencies 32662 */ 32663 32664 32665 const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 32666 viewBox: "0 0 24 24", 32667 xmlns: "http://www.w3.org/2000/svg", 32668 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 32669 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" 32670 }) 32671 }); 32672 /* harmony default export */ const chevron_down = (chevronDown); 32673 32674 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js 32675 /** 32676 * WordPress dependencies 32677 */ 32678 32679 32680 const cog = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 32681 xmlns: "http://www.w3.org/2000/svg", 32682 viewBox: "0 0 24 24", 32683 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 32684 fillRule: "evenodd", 32685 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", 32686 clipRule: "evenodd" 32687 }) 32688 }); 32689 /* harmony default export */ const library_cog = (cog); 32690 32691 ;// CONCATENATED MODULE: external ["wp","warning"] 32692 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 32693 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 32694 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/density-picker.js 32695 /** 32696 * WordPress dependencies 32697 */ 32698 32699 32700 32701 32702 32703 const viewportBreaks = { 32704 xhuge: { 32705 min: 3, 32706 max: 6, 32707 default: 5 32708 }, 32709 huge: { 32710 min: 2, 32711 max: 4, 32712 default: 4 32713 }, 32714 xlarge: { 32715 min: 2, 32716 max: 3, 32717 default: 3 32718 }, 32719 large: { 32720 min: 1, 32721 max: 2, 32722 default: 2 32723 }, 32724 mobile: { 32725 min: 1, 32726 max: 2, 32727 default: 2 32728 } 32729 }; 32730 function useViewPortBreakpoint() { 32731 const isXHuge = (0,external_wp_compose_namespaceObject.useViewportMatch)('xhuge', '>='); 32732 const isHuge = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>='); 32733 const isXlarge = (0,external_wp_compose_namespaceObject.useViewportMatch)('xlarge', '>='); 32734 const isLarge = (0,external_wp_compose_namespaceObject.useViewportMatch)('large', '>='); 32735 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('mobile', '>='); 32736 if (isXHuge) { 32737 return 'xhuge'; 32738 } 32739 if (isHuge) { 32740 return 'huge'; 32741 } 32742 if (isXlarge) { 32743 return 'xlarge'; 32744 } 32745 if (isLarge) { 32746 return 'large'; 32747 } 32748 if (isMobile) { 32749 return 'mobile'; 32750 } 32751 return null; 32752 } 32753 function DensityPicker({ 32754 density, 32755 setDensity 32756 }) { 32757 const viewport = useViewPortBreakpoint(); 32758 (0,external_wp_element_namespaceObject.useEffect)(() => { 32759 setDensity(_density => { 32760 if (!viewport || !_density) { 32761 return 0; 32762 } 32763 const breakValues = viewportBreaks[viewport]; 32764 if (_density < breakValues.min) { 32765 return breakValues.min; 32766 } 32767 if (_density > breakValues.max) { 32768 return breakValues.max; 32769 } 32770 return _density; 32771 }); 32772 }, [setDensity, viewport]); 32773 const breakValues = viewportBreaks[viewport || 'mobile']; 32774 const densityToUse = density || breakValues.default; 32775 const marks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.from({ 32776 length: breakValues.max - breakValues.min + 1 32777 }, (_, i) => { 32778 return { 32779 value: breakValues.min + i 32780 }; 32781 }), [breakValues]); 32782 if (!viewport) { 32783 return null; 32784 } 32785 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { 32786 __nextHasNoMarginBottom: true, 32787 __next40pxDefaultSize: true, 32788 showTooltip: false, 32789 label: (0,external_wp_i18n_namespaceObject.__)('Preview size'), 32790 value: breakValues.max + breakValues.min - densityToUse, 32791 marks: marks, 32792 min: breakValues.min, 32793 max: breakValues.max, 32794 withInputField: false, 32795 onChange: (value = 0) => { 32796 setDensity(breakValues.max + breakValues.min - value); 32797 }, 32798 step: 1 32799 }); 32800 } 32801 32802 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js 32803 /** 32804 * External dependencies 32805 */ 32806 32807 /** 32808 * WordPress dependencies 32809 */ 32810 32811 32812 32813 32814 32815 32816 /** 32817 * Internal dependencies 32818 */ 32819 32820 32821 32822 32823 32824 32825 32826 32827 const { 32828 DropdownMenuV2: dataviews_view_config_DropdownMenuV2 32829 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 32830 function ViewTypeMenu({ 32831 defaultLayouts = { 32832 list: {}, 32833 grid: {}, 32834 table: {} 32835 } 32836 }) { 32837 const { 32838 view, 32839 onChangeView 32840 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32841 const availableLayouts = Object.keys(defaultLayouts); 32842 if (availableLayouts.length <= 1) { 32843 return null; 32844 } 32845 const activeView = VIEW_LAYOUTS.find(v => view.type === v.type); 32846 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_DropdownMenuV2, { 32847 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32848 size: "compact", 32849 icon: activeView?.icon, 32850 label: (0,external_wp_i18n_namespaceObject.__)('Layout') 32851 }), 32852 children: availableLayouts.map(layout => { 32853 const config = VIEW_LAYOUTS.find(v => v.type === layout); 32854 if (!config) { 32855 return null; 32856 } 32857 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_DropdownMenuV2.RadioItem, { 32858 value: layout, 32859 name: "view-actions-available-view", 32860 checked: layout === view.type, 32861 hideOnClick: true, 32862 onChange: e => { 32863 switch (e.target.value) { 32864 case 'list': 32865 case 'grid': 32866 case 'table': 32867 return onChangeView({ 32868 ...view, 32869 type: e.target.value, 32870 ...defaultLayouts[e.target.value] 32871 }); 32872 } 32873 true ? external_wp_warning_default()('Invalid dataview') : 0; 32874 }, 32875 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_DropdownMenuV2.ItemLabel, { 32876 children: config.label 32877 }) 32878 }, layout); 32879 }) 32880 }); 32881 } 32882 function SortFieldControl() { 32883 const { 32884 view, 32885 fields, 32886 onChangeView 32887 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32888 const orderOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 32889 const sortableFields = fields.filter(field => field.enableSorting !== false); 32890 return sortableFields.map(field => { 32891 return { 32892 label: field.label, 32893 value: field.id 32894 }; 32895 }); 32896 }, [fields]); 32897 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 32898 __nextHasNoMarginBottom: true, 32899 __next40pxDefaultSize: true, 32900 label: (0,external_wp_i18n_namespaceObject.__)('Sort by'), 32901 value: view.sort?.field, 32902 options: orderOptions, 32903 onChange: value => { 32904 onChangeView({ 32905 ...view, 32906 sort: { 32907 direction: view?.sort?.direction || 'desc', 32908 field: value 32909 } 32910 }); 32911 } 32912 }); 32913 } 32914 function SortDirectionControl() { 32915 const { 32916 view, 32917 fields, 32918 onChangeView 32919 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32920 const sortableFields = fields.filter(field => field.enableSorting !== false); 32921 if (sortableFields.length === 0) { 32922 return null; 32923 } 32924 let value = view.sort?.direction; 32925 if (!value && view.sort?.field) { 32926 value = 'desc'; 32927 } 32928 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 32929 className: "dataviews-view-config__sort-direction", 32930 __nextHasNoMarginBottom: true, 32931 __next40pxDefaultSize: true, 32932 isBlock: true, 32933 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 32934 value: value, 32935 onChange: newDirection => { 32936 if (newDirection === 'asc' || newDirection === 'desc') { 32937 onChangeView({ 32938 ...view, 32939 sort: { 32940 direction: newDirection, 32941 field: view.sort?.field || 32942 // If there is no field assigned as the sorting field assign the first sortable field. 32943 fields.find(field => field.enableSorting !== false)?.id || '' 32944 } 32945 }); 32946 return; 32947 } 32948 true ? external_wp_warning_default()('Invalid direction') : 0; 32949 }, 32950 children: SORTING_DIRECTIONS.map(direction => { 32951 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { 32952 value: direction, 32953 icon: sortIcons[direction], 32954 label: sortLabels[direction] 32955 }, direction); 32956 }) 32957 }); 32958 } 32959 const PAGE_SIZE_VALUES = [10, 20, 50, 100]; 32960 function ItemsPerPageControl() { 32961 const { 32962 view, 32963 onChangeView 32964 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 32965 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 32966 __nextHasNoMarginBottom: true, 32967 __next40pxDefaultSize: true, 32968 isBlock: true, 32969 label: (0,external_wp_i18n_namespaceObject.__)('Items per page'), 32970 value: view.perPage || 10, 32971 disabled: !view?.sort?.field, 32972 onChange: newItemsPerPage => { 32973 const newItemsPerPageNumber = typeof newItemsPerPage === 'number' || newItemsPerPage === undefined ? newItemsPerPage : parseInt(newItemsPerPage, 10); 32974 onChangeView({ 32975 ...view, 32976 perPage: newItemsPerPageNumber, 32977 page: 1 32978 }); 32979 }, 32980 children: PAGE_SIZE_VALUES.map(value => { 32981 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 32982 value: value, 32983 label: value.toString() 32984 }, value); 32985 }) 32986 }); 32987 } 32988 function FieldItem({ 32989 field: { 32990 id, 32991 label, 32992 index, 32993 isVisible, 32994 isHidable 32995 }, 32996 fields, 32997 view, 32998 onChangeView 32999 }) { 33000 const visibleFieldIds = getVisibleFieldIds(view, fields); 33001 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 33002 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33003 expanded: true, 33004 className: `dataviews-field-control__field dataviews-field-control__field-$id}`, 33005 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33006 children: label 33007 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33008 justify: "flex-end", 33009 expanded: false, 33010 className: "dataviews-field-control__actions", 33011 children: [view.type === constants_LAYOUT_TABLE && isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33012 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33013 disabled: index < 1, 33014 accessibleWhenDisabled: true, 33015 size: "compact", 33016 onClick: () => { 33017 var _visibleFieldIds$slic; 33018 onChangeView({ 33019 ...view, 33020 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), id, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 33021 }); 33022 }, 33023 icon: chevron_up, 33024 label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33025 (0,external_wp_i18n_namespaceObject.__)('Move %s up'), label) 33026 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33027 disabled: index >= visibleFieldIds.length - 1, 33028 accessibleWhenDisabled: true, 33029 size: "compact", 33030 onClick: () => { 33031 var _visibleFieldIds$slic2; 33032 onChangeView({ 33033 ...view, 33034 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], id, ...visibleFieldIds.slice(index + 2)] 33035 }); 33036 }, 33037 icon: chevron_down, 33038 label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33039 (0,external_wp_i18n_namespaceObject.__)('Move %s down'), label) 33040 }), ' '] 33041 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33042 className: "dataviews-field-control__field-visibility-button", 33043 disabled: !isHidable, 33044 accessibleWhenDisabled: true, 33045 size: "compact", 33046 onClick: () => { 33047 onChangeView({ 33048 ...view, 33049 fields: isVisible ? visibleFieldIds.filter(fieldId => fieldId !== id) : [...visibleFieldIds, id] 33050 }); 33051 // Focus the visibility button to avoid focus loss. 33052 // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. 33053 // eslint-disable-next-line @wordpress/react-no-unsafe-timeout 33054 setTimeout(() => { 33055 const element = document.querySelector(`.dataviews-field-control__field-$id} .dataviews-field-control__field-visibility-button`); 33056 if (element instanceof HTMLElement) { 33057 element.focus(); 33058 } 33059 }, 50); 33060 }, 33061 icon: isVisible ? library_seen : library_unseen, 33062 label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33063 (0,external_wp_i18n_namespaceObject._x)('Hide %s', 'field'), label) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: field label */ 33064 (0,external_wp_i18n_namespaceObject._x)('Show %s', 'field'), label) 33065 })] 33066 })] 33067 }) 33068 }, id); 33069 } 33070 function FieldControl() { 33071 const { 33072 view, 33073 fields, 33074 onChangeView 33075 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 33076 const visibleFieldIds = (0,external_wp_element_namespaceObject.useMemo)(() => getVisibleFieldIds(view, fields), [view, fields]); 33077 const hiddenFieldIds = (0,external_wp_element_namespaceObject.useMemo)(() => getHiddenFieldIds(view, fields), [view, fields]); 33078 const notHidableFieldIds = (0,external_wp_element_namespaceObject.useMemo)(() => getNotHidableFieldIds(view), [view]); 33079 const visibleFields = fields.filter(({ 33080 id 33081 }) => visibleFieldIds.includes(id)).map(({ 33082 id, 33083 label, 33084 enableHiding 33085 }) => { 33086 return { 33087 id, 33088 label, 33089 index: visibleFieldIds.indexOf(id), 33090 isVisible: true, 33091 isHidable: notHidableFieldIds.includes(id) ? false : enableHiding 33092 }; 33093 }); 33094 if (view.type === constants_LAYOUT_TABLE && view.layout?.combinedFields) { 33095 view.layout.combinedFields.forEach(({ 33096 id, 33097 label 33098 }) => { 33099 visibleFields.push({ 33100 id, 33101 label, 33102 index: visibleFieldIds.indexOf(id), 33103 isVisible: true, 33104 isHidable: notHidableFieldIds.includes(id) 33105 }); 33106 }); 33107 } 33108 visibleFields.sort((a, b) => a.index - b.index); 33109 const hiddenFields = fields.filter(({ 33110 id 33111 }) => hiddenFieldIds.includes(id)).map(({ 33112 id, 33113 label, 33114 enableHiding 33115 }, index) => { 33116 return { 33117 id, 33118 label, 33119 index, 33120 isVisible: false, 33121 isHidable: enableHiding 33122 }; 33123 }); 33124 if (!visibleFields?.length && !hiddenFields?.length) { 33125 return null; 33126 } 33127 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33128 spacing: 6, 33129 className: "dataviews-field-control", 33130 children: [!!visibleFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 33131 isBordered: true, 33132 isSeparated: true, 33133 children: visibleFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 33134 field: field, 33135 fields: fields, 33136 view: view, 33137 onChangeView: onChangeView 33138 }, field.id)) 33139 }), !!hiddenFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33140 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33141 spacing: 4, 33142 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 33143 style: { 33144 margin: 0 33145 }, 33146 children: (0,external_wp_i18n_namespaceObject.__)('Hidden') 33147 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 33148 isBordered: true, 33149 isSeparated: true, 33150 children: hiddenFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 33151 field: field, 33152 fields: fields, 33153 view: view, 33154 onChangeView: onChangeView 33155 }, field.id)) 33156 })] 33157 }) 33158 })] 33159 }); 33160 } 33161 function SettingsSection({ 33162 title, 33163 description, 33164 children 33165 }) { 33166 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 33167 columns: 12, 33168 className: "dataviews-settings-section", 33169 gap: 4, 33170 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33171 className: "dataviews-settings-section__sidebar", 33172 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 33173 level: 2, 33174 className: "dataviews-settings-section__title", 33175 children: title 33176 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 33177 variant: "muted", 33178 className: "dataviews-settings-section__description", 33179 children: description 33180 })] 33181 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 33182 columns: 8, 33183 gap: 4, 33184 className: "dataviews-settings-section__content", 33185 children: children 33186 })] 33187 }); 33188 } 33189 function DataviewsViewConfigContent({ 33190 density, 33191 setDensity 33192 }) { 33193 const { 33194 view 33195 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 33196 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33197 className: "dataviews-view-config", 33198 spacing: 6, 33199 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { 33200 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 33201 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33202 expanded: true, 33203 className: "is-divided-in-two", 33204 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {})] 33205 }), view.type === constants_LAYOUT_GRID && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DensityPicker, { 33206 density: density, 33207 setDensity: setDensity 33208 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {})] 33209 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { 33210 title: (0,external_wp_i18n_namespaceObject.__)('Properties'), 33211 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) 33212 })] 33213 }); 33214 } 33215 function _DataViewsViewConfig({ 33216 density, 33217 setDensity, 33218 defaultLayouts = { 33219 list: {}, 33220 grid: {}, 33221 table: {} 33222 } 33223 }) { 33224 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33225 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, { 33226 defaultLayouts: defaultLayouts 33227 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 33228 popoverProps: { 33229 placement: 'bottom-end', 33230 offset: 9 33231 }, 33232 contentClassName: "dataviews-view-config", 33233 renderToggle: ({ 33234 onToggle 33235 }) => { 33236 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33237 size: "compact", 33238 icon: library_cog, 33239 label: (0,external_wp_i18n_namespaceObject._x)('View options', 'View is used as a noun'), 33240 onClick: onToggle 33241 }); 33242 }, 33243 renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigContent, { 33244 density: density, 33245 setDensity: setDensity 33246 }) 33247 })] 33248 }); 33249 } 33250 const DataViewsViewConfig = (0,external_wp_element_namespaceObject.memo)(_DataViewsViewConfig); 33251 /* harmony default export */ const dataviews_view_config = (DataViewsViewConfig); 33252 33253 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js 33254 /** 33255 * External dependencies 33256 */ 33257 33258 /** 33259 * WordPress dependencies 33260 */ 33261 33262 33263 33264 /** 33265 * Internal dependencies 33266 */ 33267 33268 33269 33270 33271 33272 33273 33274 33275 33276 const defaultGetItemId = item => item.id; 33277 function DataViews({ 33278 view, 33279 onChangeView, 33280 fields, 33281 search = true, 33282 searchLabel = undefined, 33283 actions = [], 33284 data, 33285 getItemId = defaultGetItemId, 33286 isLoading = false, 33287 paginationInfo, 33288 defaultLayouts, 33289 selection: selectionProperty, 33290 onChangeSelection, 33291 header 33292 }) { 33293 const [selectionState, setSelectionState] = (0,external_wp_element_namespaceObject.useState)([]); 33294 const [density, setDensity] = (0,external_wp_element_namespaceObject.useState)(0); 33295 const isUncontrolled = selectionProperty === undefined || onChangeSelection === undefined; 33296 const selection = isUncontrolled ? selectionState : selectionProperty; 33297 const [openedFilter, setOpenedFilter] = (0,external_wp_element_namespaceObject.useState)(null); 33298 function setSelectionWithChange(value) { 33299 const newValue = typeof value === 'function' ? value(selection) : value; 33300 if (isUncontrolled) { 33301 setSelectionState(newValue); 33302 } 33303 if (onChangeSelection) { 33304 onChangeSelection(newValue); 33305 } 33306 } 33307 const _fields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); 33308 const _selection = (0,external_wp_element_namespaceObject.useMemo)(() => { 33309 return selection.filter(id => data.some(item => getItemId(item) === id)); 33310 }, [selection, data, getItemId]); 33311 const filters = useFilters(_fields, view); 33312 const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_namespaceObject.useState)(() => (filters || []).some(filter => filter.isPrimary)); 33313 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_context.Provider, { 33314 value: { 33315 view, 33316 onChangeView, 33317 fields: _fields, 33318 actions, 33319 data, 33320 isLoading, 33321 paginationInfo, 33322 selection: _selection, 33323 onChangeSelection: setSelectionWithChange, 33324 openedFilter, 33325 setOpenedFilter, 33326 getItemId, 33327 density 33328 }, 33329 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33330 className: "dataviews-wrapper", 33331 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33332 alignment: "top", 33333 justify: "space-between", 33334 className: "dataviews__view-actions", 33335 spacing: 1, 33336 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33337 justify: "start", 33338 expanded: false, 33339 className: "dataviews__search", 33340 children: [search && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search, { 33341 label: searchLabel 33342 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterVisibilityToggle, { 33343 filters: filters, 33344 view: view, 33345 onChangeView: onChangeView, 33346 setOpenedFilter: setOpenedFilter, 33347 setIsShowingFilter: setIsShowingFilter, 33348 isShowingFilter: isShowingFilter 33349 })] 33350 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33351 spacing: 1, 33352 expanded: false, 33353 style: { 33354 flexShrink: 0 33355 }, 33356 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config, { 33357 defaultLayouts: defaultLayouts, 33358 density: density, 33359 setDensity: setDensity 33360 }), header] 33361 })] 33362 }), isShowingFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_filters, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {})] 33363 }) 33364 }); 33365 } 33366 33367 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 33368 /** 33369 * WordPress dependencies 33370 */ 33371 33372 33373 const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33374 width: "24", 33375 height: "24", 33376 xmlns: "http://www.w3.org/2000/svg", 33377 viewBox: "0 0 24 24", 33378 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33379 fillRule: "evenodd", 33380 clipRule: "evenodd", 33381 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" 33382 }) 33383 }); 33384 /* harmony default export */ const drawer_right = (drawerRight); 33385 33386 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page/header.js 33387 /** 33388 * WordPress dependencies 33389 */ 33390 33391 33392 /** 33393 * Internal dependencies 33394 */ 33395 33396 33397 function Header({ 33398 title, 33399 subTitle, 33400 actions 33401 }) { 33402 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33403 className: "edit-site-page-header", 33404 as: "header", 33405 spacing: 0, 33406 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33407 className: "edit-site-page-header__page-title", 33408 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 33409 as: "h2", 33410 level: 3, 33411 weight: 500, 33412 className: "edit-site-page-header__title", 33413 truncate: true, 33414 children: title 33415 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 33416 className: "edit-site-page-header__actions", 33417 children: actions 33418 })] 33419 }), subTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 33420 variant: "muted", 33421 as: "p", 33422 className: "edit-site-page-header__sub-title", 33423 children: subTitle 33424 })] 33425 }); 33426 } 33427 33428 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page/index.js 33429 /** 33430 * External dependencies 33431 */ 33432 33433 33434 /** 33435 * WordPress dependencies 33436 */ 33437 33438 33439 /** 33440 * Internal dependencies 33441 */ 33442 33443 33444 33445 33446 const { 33447 NavigableRegion: page_NavigableRegion 33448 } = unlock(external_wp_editor_namespaceObject.privateApis); 33449 function Page({ 33450 title, 33451 subTitle, 33452 actions, 33453 children, 33454 className, 33455 hideTitleFromUI = false 33456 }) { 33457 const classes = dist_clsx('edit-site-page', className); 33458 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_NavigableRegion, { 33459 className: classes, 33460 ariaLabel: title, 33461 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33462 className: "edit-site-page-content", 33463 children: [!hideTitleFromUI && title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, { 33464 title: title, 33465 subTitle: subTitle, 33466 actions: actions 33467 }), children] 33468 }) 33469 }); 33470 } 33471 33472 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pages.js 33473 /** 33474 * WordPress dependencies 33475 */ 33476 33477 33478 33479 const pages = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 33480 xmlns: "http://www.w3.org/2000/svg", 33481 viewBox: "0 0 24 24", 33482 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33483 d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" 33484 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33485 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" 33486 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33487 d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" 33488 })] 33489 }); 33490 /* harmony default export */ const library_pages = (pages); 33491 33492 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/published.js 33493 /** 33494 * WordPress dependencies 33495 */ 33496 33497 33498 const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33499 xmlns: "http://www.w3.org/2000/svg", 33500 viewBox: "0 0 24 24", 33501 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33502 fillRule: "evenodd", 33503 clipRule: "evenodd", 33504 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" 33505 }) 33506 }); 33507 /* harmony default export */ const library_published = (published); 33508 33509 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/scheduled.js 33510 /** 33511 * WordPress dependencies 33512 */ 33513 33514 33515 const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33516 xmlns: "http://www.w3.org/2000/svg", 33517 viewBox: "0 0 24 24", 33518 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33519 fillRule: "evenodd", 33520 clipRule: "evenodd", 33521 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" 33522 }) 33523 }); 33524 /* harmony default export */ const library_scheduled = (scheduled); 33525 33526 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drafts.js 33527 /** 33528 * WordPress dependencies 33529 */ 33530 33531 33532 const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33533 xmlns: "http://www.w3.org/2000/svg", 33534 viewBox: "0 0 24 24", 33535 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33536 fillRule: "evenodd", 33537 clipRule: "evenodd", 33538 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" 33539 }) 33540 }); 33541 /* harmony default export */ const library_drafts = (drafts); 33542 33543 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pending.js 33544 /** 33545 * WordPress dependencies 33546 */ 33547 33548 33549 const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33550 xmlns: "http://www.w3.org/2000/svg", 33551 viewBox: "0 0 24 24", 33552 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33553 fillRule: "evenodd", 33554 clipRule: "evenodd", 33555 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" 33556 }) 33557 }); 33558 /* harmony default export */ const library_pending = (pending); 33559 33560 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 33561 /** 33562 * WordPress dependencies 33563 */ 33564 33565 33566 const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33567 xmlns: "http://www.w3.org/2000/svg", 33568 viewBox: "0 0 24 24", 33569 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33570 fillRule: "evenodd", 33571 clipRule: "evenodd", 33572 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" 33573 }) 33574 }); 33575 /* harmony default export */ const not_allowed = (notAllowed); 33576 33577 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/default-views.js 33578 /** 33579 * WordPress dependencies 33580 */ 33581 33582 33583 33584 33585 33586 33587 /** 33588 * Internal dependencies 33589 */ 33590 33591 const defaultLayouts = { 33592 [LAYOUT_TABLE]: { 33593 layout: { 33594 primaryField: 'title', 33595 styles: { 33596 'featured-image': { 33597 width: '1%' 33598 }, 33599 title: { 33600 maxWidth: 300 33601 } 33602 } 33603 } 33604 }, 33605 [LAYOUT_GRID]: { 33606 layout: { 33607 mediaField: 'featured-image', 33608 primaryField: 'title' 33609 } 33610 }, 33611 [LAYOUT_LIST]: { 33612 layout: { 33613 primaryField: 'title', 33614 mediaField: 'featured-image' 33615 } 33616 } 33617 }; 33618 const DEFAULT_POST_BASE = { 33619 type: LAYOUT_LIST, 33620 search: '', 33621 filters: [], 33622 page: 1, 33623 perPage: 20, 33624 sort: { 33625 field: 'date', 33626 direction: 'desc' 33627 }, 33628 fields: ['title', 'author', 'status'], 33629 layout: defaultLayouts[LAYOUT_LIST].layout 33630 }; 33631 function useDefaultViews({ 33632 postType 33633 }) { 33634 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => { 33635 const { 33636 getPostType 33637 } = select(external_wp_coreData_namespaceObject.store); 33638 return getPostType(postType)?.labels; 33639 }, [postType]); 33640 return (0,external_wp_element_namespaceObject.useMemo)(() => { 33641 return [{ 33642 title: labels?.all_items || (0,external_wp_i18n_namespaceObject.__)('All items'), 33643 slug: 'all', 33644 icon: library_pages, 33645 view: DEFAULT_POST_BASE 33646 }, { 33647 title: (0,external_wp_i18n_namespaceObject.__)('Published'), 33648 slug: 'published', 33649 icon: library_published, 33650 view: DEFAULT_POST_BASE, 33651 filters: [{ 33652 field: 'status', 33653 operator: OPERATOR_IS_ANY, 33654 value: 'publish' 33655 }] 33656 }, { 33657 title: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 33658 slug: 'future', 33659 icon: library_scheduled, 33660 view: DEFAULT_POST_BASE, 33661 filters: [{ 33662 field: 'status', 33663 operator: OPERATOR_IS_ANY, 33664 value: 'future' 33665 }] 33666 }, { 33667 title: (0,external_wp_i18n_namespaceObject.__)('Drafts'), 33668 slug: 'drafts', 33669 icon: library_drafts, 33670 view: DEFAULT_POST_BASE, 33671 filters: [{ 33672 field: 'status', 33673 operator: OPERATOR_IS_ANY, 33674 value: 'draft' 33675 }] 33676 }, { 33677 title: (0,external_wp_i18n_namespaceObject.__)('Pending'), 33678 slug: 'pending', 33679 icon: library_pending, 33680 view: DEFAULT_POST_BASE, 33681 filters: [{ 33682 field: 'status', 33683 operator: OPERATOR_IS_ANY, 33684 value: 'pending' 33685 }] 33686 }, { 33687 title: (0,external_wp_i18n_namespaceObject.__)('Private'), 33688 slug: 'private', 33689 icon: not_allowed, 33690 view: DEFAULT_POST_BASE, 33691 filters: [{ 33692 field: 'status', 33693 operator: OPERATOR_IS_ANY, 33694 value: 'private' 33695 }] 33696 }, { 33697 title: (0,external_wp_i18n_namespaceObject.__)('Trash'), 33698 slug: 'trash', 33699 icon: library_trash, 33700 view: { 33701 ...DEFAULT_POST_BASE, 33702 type: LAYOUT_TABLE, 33703 layout: defaultLayouts[LAYOUT_TABLE].layout 33704 }, 33705 filters: [{ 33706 field: 'status', 33707 operator: OPERATOR_IS_ANY, 33708 value: 'trash' 33709 }] 33710 }]; 33711 }, [labels]); 33712 } 33713 33714 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js 33715 /** 33716 * WordPress dependencies 33717 */ 33718 33719 33720 33721 33722 33723 33724 33725 33726 33727 33728 function AddNewPostModal({ 33729 postType, 33730 onSave, 33731 onClose 33732 }) { 33733 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels, [postType]); 33734 const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_namespaceObject.useState)(false); 33735 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 33736 const { 33737 saveEntityRecord 33738 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 33739 const { 33740 createErrorNotice, 33741 createSuccessNotice 33742 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 33743 const { 33744 resolveSelect 33745 } = (0,external_wp_data_namespaceObject.useRegistry)(); 33746 async function createPost(event) { 33747 event.preventDefault(); 33748 if (isCreatingPost) { 33749 return; 33750 } 33751 setIsCreatingPost(true); 33752 try { 33753 const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 33754 const newPage = await saveEntityRecord('postType', postType, { 33755 status: 'draft', 33756 title, 33757 slug: title || (0,external_wp_i18n_namespaceObject.__)('No title'), 33758 content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)((0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)([], postTypeObject.template)) : undefined 33759 }, { 33760 throwOnError: true 33761 }); 33762 onSave(newPage); 33763 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 33764 // translators: %s: Title of the created post or template, e.g: "Hello world". 33765 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title)), { 33766 type: 'snackbar' 33767 }); 33768 } catch (error) { 33769 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the item.'); 33770 createErrorNotice(errorMessage, { 33771 type: 'snackbar' 33772 }); 33773 } finally { 33774 setIsCreatingPost(false); 33775 } 33776 } 33777 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 33778 title: 33779 // translators: %s: post type singular_name label e.g: "Page". 33780 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Draft new: %s'), labels?.singular_name), 33781 onRequestClose: onClose, 33782 focusOnMount: "firstContentElement", 33783 size: "small", 33784 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 33785 onSubmit: createPost, 33786 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33787 spacing: 4, 33788 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 33789 __next40pxDefaultSize: true, 33790 __nextHasNoMarginBottom: true, 33791 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 33792 onChange: setTitle, 33793 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 33794 value: title 33795 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33796 spacing: 2, 33797 justify: "end", 33798 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33799 __next40pxDefaultSize: true, 33800 variant: "tertiary", 33801 onClick: onClose, 33802 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 33803 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33804 __next40pxDefaultSize: true, 33805 variant: "primary", 33806 type: "submit", 33807 isBusy: isCreatingPost, 33808 "aria-disabled": isCreatingPost, 33809 children: (0,external_wp_i18n_namespaceObject.__)('Create draft') 33810 })] 33811 })] 33812 }) 33813 }) 33814 }); 33815 } 33816 33817 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js 33818 /** 33819 * WordPress dependencies 33820 */ 33821 33822 33823 const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33824 xmlns: "http://www.w3.org/2000/svg", 33825 viewBox: "0 0 24 24", 33826 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33827 d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" 33828 }) 33829 }); 33830 /* harmony default export */ const library_pencil = (pencil); 33831 33832 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js 33833 /** 33834 * Internal dependencies 33835 */ 33836 33837 33838 /* harmony default export */ const edit = (library_pencil); 33839 33840 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js 33841 /** 33842 * WordPress dependencies 33843 */ 33844 33845 33846 33847 33848 33849 /** 33850 * Internal dependencies 33851 */ 33852 33853 33854 const { 33855 useHistory: dataviews_actions_useHistory 33856 } = unlock(external_wp_router_namespaceObject.privateApis); 33857 const useEditPostAction = () => { 33858 const history = dataviews_actions_useHistory(); 33859 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ 33860 id: 'edit-post', 33861 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 33862 isPrimary: true, 33863 icon: edit, 33864 isEligible(post) { 33865 if (post.status === 'trash') { 33866 return false; 33867 } 33868 // It's eligible for all post types except theme patterns. 33869 return post.type !== PATTERN_TYPES.theme; 33870 }, 33871 callback(items) { 33872 const post = items[0]; 33873 history.push({ 33874 postId: post.id, 33875 postType: post.type, 33876 canvas: 'edit' 33877 }); 33878 } 33879 }), [history]); 33880 }; 33881 33882 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 33883 /** 33884 * WordPress dependencies 33885 */ 33886 33887 33888 const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33889 xmlns: "http://www.w3.org/2000/svg", 33890 viewBox: "0 0 24 24", 33891 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33892 fillRule: "evenodd", 33893 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", 33894 clipRule: "evenodd" 33895 }) 33896 }); 33897 /* harmony default export */ const comment_author_avatar = (commentAuthorAvatar); 33898 33899 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/media/index.js 33900 /** 33901 * WordPress dependencies 33902 */ 33903 33904 33905 function Media({ 33906 id, 33907 size = ['large', 'medium', 'thumbnail'], 33908 ...props 33909 }) { 33910 const { 33911 record: media 33912 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'media', id); 33913 const currentSize = size.find(s => !!media?.media_details?.sizes[s]); 33914 const mediaUrl = media?.media_details?.sizes[currentSize]?.source_url || media?.source_url; 33915 if (!mediaUrl) { 33916 return null; 33917 } 33918 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 33919 ...props, 33920 src: mediaUrl, 33921 alt: media.alt_text 33922 }); 33923 } 33924 /* harmony default export */ const components_media = (Media); 33925 33926 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/post-fields/index.js 33927 /** 33928 * External dependencies 33929 */ 33930 33931 33932 /** 33933 * WordPress dependencies 33934 */ 33935 33936 33937 33938 33939 33940 33941 33942 33943 33944 /** 33945 * Internal dependencies 33946 */ 33947 33948 33949 33950 33951 // See https://github.com/WordPress/gutenberg/issues/55886 33952 // We do not support custom statutes at the moment. 33953 33954 33955 const STATUSES = [{ 33956 value: 'draft', 33957 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 33958 icon: library_drafts, 33959 description: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.') 33960 }, { 33961 value: 'future', 33962 label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 33963 icon: library_scheduled, 33964 description: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.') 33965 }, { 33966 value: 'pending', 33967 label: (0,external_wp_i18n_namespaceObject.__)('Pending Review'), 33968 icon: library_pending, 33969 description: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.') 33970 }, { 33971 value: 'private', 33972 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 33973 icon: not_allowed, 33974 description: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 33975 }, { 33976 value: 'publish', 33977 label: (0,external_wp_i18n_namespaceObject.__)('Published'), 33978 icon: library_published, 33979 description: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 33980 }, { 33981 value: 'trash', 33982 label: (0,external_wp_i18n_namespaceObject.__)('Trash'), 33983 icon: library_trash 33984 }]; 33985 const getFormattedDate = dateToDisplay => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay)); 33986 function FeaturedImage({ 33987 item, 33988 viewType 33989 }) { 33990 const isDisabled = item.status === 'trash'; 33991 const { 33992 onClick 33993 } = useLink({ 33994 postId: item.id, 33995 postType: item.type, 33996 canvas: 'edit' 33997 }); 33998 const hasMedia = !!item.featured_media; 33999 const size = viewType === LAYOUT_GRID ? ['large', 'full', 'medium', 'thumbnail'] : ['thumbnail', 'medium', 'large', 'full']; 34000 const media = hasMedia ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_media, { 34001 className: "edit-site-post-list__featured-image", 34002 id: item.featured_media, 34003 size: size 34004 }) : null; 34005 const renderButton = viewType !== LAYOUT_LIST && !isDisabled; 34006 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34007 className: `edit-site-post-list__featured-image-wrapper is-layout-$viewType}`, 34008 children: renderButton ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 34009 className: "edit-site-post-list__featured-image-button", 34010 type: "button", 34011 onClick: onClick, 34012 "aria-label": item.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)'), 34013 children: media 34014 }) : media 34015 }); 34016 } 34017 function PostStatusField({ 34018 item 34019 }) { 34020 const status = STATUSES.find(({ 34021 value 34022 }) => value === item.status); 34023 const label = status?.label || item.status; 34024 const icon = status?.icon; 34025 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34026 alignment: "left", 34027 spacing: 0, 34028 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34029 className: "edit-site-post-list__status-icon", 34030 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34031 icon: icon 34032 }) 34033 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34034 children: label 34035 })] 34036 }); 34037 } 34038 function PostAuthorField({ 34039 item 34040 }) { 34041 const { 34042 text, 34043 imageUrl 34044 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 34045 const { 34046 getUser 34047 } = select(external_wp_coreData_namespaceObject.store); 34048 const user = getUser(item.author); 34049 return { 34050 imageUrl: user?.avatar_urls?.[48], 34051 text: user?.name 34052 }; 34053 }, [item]); 34054 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 34055 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34056 alignment: "left", 34057 spacing: 0, 34058 children: [!!imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34059 className: dist_clsx('page-templates-author-field__avatar', { 34060 'is-loaded': isImageLoaded 34061 }), 34062 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 34063 onLoad: () => setIsImageLoaded(true), 34064 alt: (0,external_wp_i18n_namespaceObject.__)('Author avatar'), 34065 src: imageUrl 34066 }) 34067 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34068 className: "page-templates-author-field__icon", 34069 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34070 icon: comment_author_avatar 34071 }) 34072 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34073 className: "page-templates-author-field__name", 34074 children: text 34075 })] 34076 }); 34077 } 34078 function usePostFields(viewType) { 34079 const { 34080 records: authors, 34081 isResolving: isLoadingAuthors 34082 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'user', { 34083 per_page: -1 34084 }); 34085 const { 34086 frontPageId, 34087 postsPageId 34088 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 34089 const { 34090 getEntityRecord 34091 } = select(external_wp_coreData_namespaceObject.store); 34092 const siteSettings = getEntityRecord('root', 'site'); 34093 return { 34094 frontPageId: siteSettings?.page_on_front, 34095 postsPageId: siteSettings?.page_for_posts 34096 }; 34097 }, []); 34098 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [{ 34099 id: 'featured-image', 34100 label: (0,external_wp_i18n_namespaceObject.__)('Featured Image'), 34101 getValue: ({ 34102 item 34103 }) => item.featured_media, 34104 render: ({ 34105 item 34106 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FeaturedImage, { 34107 item: item, 34108 viewType: viewType 34109 }), 34110 enableSorting: false 34111 }, { 34112 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 34113 id: 'title', 34114 type: 'text', 34115 getValue: ({ 34116 item 34117 }) => typeof item.title === 'string' ? item.title : item.title?.raw, 34118 render: ({ 34119 item 34120 }) => { 34121 const addLink = [LAYOUT_TABLE, LAYOUT_GRID].includes(viewType) && item.status !== 'trash'; 34122 const renderedTitle = typeof item.title === 'string' ? item.title : item.title?.rendered; 34123 const title = addLink ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Link, { 34124 params: { 34125 postId: item.id, 34126 postType: item.type, 34127 canvas: 'edit' 34128 }, 34129 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(renderedTitle) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 34130 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34131 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(renderedTitle) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 34132 }); 34133 let suffix = ''; 34134 if (item.id === frontPageId) { 34135 suffix = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34136 className: "edit-site-post-list__title-badge", 34137 children: (0,external_wp_i18n_namespaceObject.__)('Homepage') 34138 }); 34139 } else if (item.id === postsPageId) { 34140 suffix = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34141 className: "edit-site-post-list__title-badge", 34142 children: (0,external_wp_i18n_namespaceObject.__)('Posts Page') 34143 }); 34144 } 34145 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34146 className: "edit-site-post-list__title", 34147 alignment: "center", 34148 justify: "flex-start", 34149 children: [title, suffix] 34150 }); 34151 }, 34152 enableHiding: false 34153 }, { 34154 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 34155 id: 'author', 34156 type: 'integer', 34157 elements: authors?.map(({ 34158 id, 34159 name 34160 }) => ({ 34161 value: id, 34162 label: name 34163 })) || [], 34164 render: PostAuthorField, 34165 sort: (a, b, direction) => { 34166 const nameA = a._embedded?.author?.[0]?.name || ''; 34167 const nameB = b._embedded?.author?.[0]?.name || ''; 34168 return direction === 'asc' ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); 34169 } 34170 }, { 34171 label: (0,external_wp_i18n_namespaceObject.__)('Status'), 34172 id: 'status', 34173 type: 'text', 34174 elements: STATUSES, 34175 render: PostStatusField, 34176 Edit: 'radio', 34177 enableSorting: false, 34178 filterBy: { 34179 operators: [OPERATOR_IS_ANY] 34180 } 34181 }, { 34182 label: (0,external_wp_i18n_namespaceObject.__)('Date'), 34183 id: 'date', 34184 type: 'datetime', 34185 render: ({ 34186 item 34187 }) => { 34188 const isDraftOrPrivate = ['draft', 'private'].includes(item.status); 34189 if (isDraftOrPrivate) { 34190 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation or modification date. */ 34191 (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(item.date)), { 34192 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34193 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34194 }); 34195 } 34196 const isScheduled = item.status === 'future'; 34197 if (isScheduled) { 34198 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation date */ 34199 (0,external_wp_i18n_namespaceObject.__)('<span>Scheduled: <time>%s</time></span>'), getFormattedDate(item.date)), { 34200 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34201 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34202 }); 34203 } 34204 const isPublished = item.status === 'publish'; 34205 if (isPublished) { 34206 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation time */ 34207 (0,external_wp_i18n_namespaceObject.__)('<span>Published: <time>%s</time></span>'), getFormattedDate(item.date)), { 34208 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34209 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34210 }); 34211 } 34212 34213 // Pending posts show the modified date if it's newer. 34214 const dateToDisplay = (0,external_wp_date_namespaceObject.getDate)(item.modified) > (0,external_wp_date_namespaceObject.getDate)(item.date) ? item.modified : item.date; 34215 const isPending = item.status === 'pending'; 34216 if (isPending) { 34217 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation or modification date. */ 34218 (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(dateToDisplay)), { 34219 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 34220 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 34221 }); 34222 } 34223 34224 // Unknow status. 34225 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 34226 children: getFormattedDate(item.date) 34227 }); 34228 } 34229 }, { 34230 id: 'comment_status', 34231 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 34232 type: 'text', 34233 Edit: 'radio', 34234 enableSorting: false, 34235 filterBy: { 34236 operators: [] 34237 }, 34238 elements: [{ 34239 value: 'open', 34240 label: (0,external_wp_i18n_namespaceObject.__)('Open'), 34241 description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') 34242 }, { 34243 value: 'closed', 34244 label: (0,external_wp_i18n_namespaceObject.__)('Closed'), 34245 description: (0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies. Existing comments remain visible.') 34246 }] 34247 }], [authors, viewType, frontPageId, postsPageId]); 34248 return { 34249 isLoading: isLoadingAuthors, 34250 fields 34251 }; 34252 } 34253 /* harmony default export */ const post_fields = (usePostFields); 34254 34255 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js 34256 /** 34257 * WordPress dependencies 34258 */ 34259 34260 34261 34262 34263 34264 34265 34266 34267 34268 34269 /** 34270 * Internal dependencies 34271 */ 34272 34273 34274 34275 34276 34277 34278 34279 34280 34281 34282 34283 const { 34284 usePostActions 34285 } = unlock(external_wp_editor_namespaceObject.privateApis); 34286 const { 34287 useLocation: post_list_useLocation, 34288 useHistory: post_list_useHistory 34289 } = unlock(external_wp_router_namespaceObject.privateApis); 34290 const { 34291 useEntityRecordsWithPermissions 34292 } = unlock(external_wp_coreData_namespaceObject.privateApis); 34293 const post_list_EMPTY_ARRAY = []; 34294 const getDefaultView = (defaultViews, activeView) => { 34295 return defaultViews.find(({ 34296 slug 34297 }) => slug === activeView)?.view; 34298 }; 34299 const getCustomView = editedEntityRecord => { 34300 if (!editedEntityRecord?.content) { 34301 return undefined; 34302 } 34303 const content = JSON.parse(editedEntityRecord.content); 34304 if (!content) { 34305 return undefined; 34306 } 34307 return { 34308 ...content, 34309 layout: defaultLayouts[content.type]?.layout 34310 }; 34311 }; 34312 34313 /** 34314 * This function abstracts working with default & custom views by 34315 * providing a [ state, setState ] tuple based on the URL parameters. 34316 * 34317 * Consumers use the provided tuple to work with state 34318 * and don't have to deal with the specifics of default & custom views. 34319 * 34320 * @param {string} postType Post type to retrieve default views for. 34321 * @return {Array} The [ state, setState ] tuple. 34322 */ 34323 function useView(postType) { 34324 const { 34325 params: { 34326 activeView = 'all', 34327 isCustom = 'false', 34328 layout 34329 } 34330 } = post_list_useLocation(); 34331 const history = post_list_useHistory(); 34332 const defaultViews = useDefaultViews({ 34333 postType 34334 }); 34335 const { 34336 editEntityRecord 34337 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 34338 const editedEntityRecord = (0,external_wp_data_namespaceObject.useSelect)(select => { 34339 if (isCustom !== 'true') { 34340 return undefined; 34341 } 34342 const { 34343 getEditedEntityRecord 34344 } = select(external_wp_coreData_namespaceObject.store); 34345 return getEditedEntityRecord('postType', 'wp_dataviews', Number(activeView)); 34346 }, [activeView, isCustom]); 34347 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(() => { 34348 let initialView; 34349 if (isCustom === 'true') { 34350 var _getCustomView; 34351 initialView = (_getCustomView = getCustomView(editedEntityRecord)) !== null && _getCustomView !== void 0 ? _getCustomView : { 34352 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 34353 }; 34354 } else { 34355 var _getDefaultView; 34356 initialView = (_getDefaultView = getDefaultView(defaultViews, activeView)) !== null && _getDefaultView !== void 0 ? _getDefaultView : { 34357 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 34358 }; 34359 } 34360 const type = layout !== null && layout !== void 0 ? layout : initialView.type; 34361 return { 34362 ...initialView, 34363 type 34364 }; 34365 }); 34366 const setViewWithUrlUpdate = (0,external_wp_element_namespaceObject.useCallback)(newView => { 34367 const { 34368 params 34369 } = history.getLocationWithParams(); 34370 if (newView.type === LAYOUT_LIST && !params?.layout) { 34371 // Skip updating the layout URL param if 34372 // it is not present and the newView.type is LAYOUT_LIST. 34373 } else if (newView.type !== params?.layout) { 34374 history.push({ 34375 ...params, 34376 layout: newView.type 34377 }); 34378 } 34379 setView(newView); 34380 if (isCustom === 'true' && editedEntityRecord?.id) { 34381 editEntityRecord('postType', 'wp_dataviews', editedEntityRecord?.id, { 34382 content: JSON.stringify(newView) 34383 }); 34384 } 34385 }, [history, isCustom, editEntityRecord, editedEntityRecord?.id]); 34386 34387 // When layout URL param changes, update the view type 34388 // without affecting any other config. 34389 (0,external_wp_element_namespaceObject.useEffect)(() => { 34390 setView(prevView => ({ 34391 ...prevView, 34392 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 34393 })); 34394 }, [layout]); 34395 34396 // When activeView or isCustom URL parameters change, reset the view. 34397 (0,external_wp_element_namespaceObject.useEffect)(() => { 34398 let newView; 34399 if (isCustom === 'true') { 34400 newView = getCustomView(editedEntityRecord); 34401 } else { 34402 newView = getDefaultView(defaultViews, activeView); 34403 } 34404 if (newView) { 34405 const type = layout !== null && layout !== void 0 ? layout : newView.type; 34406 setView({ 34407 ...newView, 34408 type 34409 }); 34410 } 34411 }, [activeView, isCustom, layout, defaultViews, editedEntityRecord]); 34412 return [view, setViewWithUrlUpdate, setViewWithUrlUpdate]; 34413 } 34414 const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'. 34415 34416 function getItemId(item) { 34417 return item.id.toString(); 34418 } 34419 function PostList({ 34420 postType 34421 }) { 34422 var _postId$split, _data$map, _usePrevious; 34423 const [view, setView] = useView(postType); 34424 const defaultViews = useDefaultViews({ 34425 postType 34426 }); 34427 const history = post_list_useHistory(); 34428 const location = post_list_useLocation(); 34429 const { 34430 postId, 34431 quickEdit = false, 34432 isCustom, 34433 activeView = 'all' 34434 } = location.params; 34435 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)((_postId$split = postId?.split(',')) !== null && _postId$split !== void 0 ? _postId$split : []); 34436 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 34437 var _params$isCustom; 34438 setSelection(items); 34439 const { 34440 params 34441 } = history.getLocationWithParams(); 34442 if (((_params$isCustom = params.isCustom) !== null && _params$isCustom !== void 0 ? _params$isCustom : 'false') === 'false') { 34443 history.push({ 34444 ...params, 34445 postId: items.join(',') 34446 }); 34447 } 34448 }, [history]); 34449 const getActiveViewFilters = (views, match) => { 34450 var _found$filters; 34451 const found = views.find(({ 34452 slug 34453 }) => slug === match); 34454 return (_found$filters = found?.filters) !== null && _found$filters !== void 0 ? _found$filters : []; 34455 }; 34456 const { 34457 isLoading: isLoadingFields, 34458 fields: _fields 34459 } = post_fields(view.type); 34460 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 34461 const activeViewFilters = getActiveViewFilters(defaultViews, activeView).map(({ 34462 field 34463 }) => field); 34464 return _fields.map(field => ({ 34465 ...field, 34466 elements: activeViewFilters.includes(field.id) ? [] : field.elements 34467 })); 34468 }, [_fields, defaultViews, activeView]); 34469 const queryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => { 34470 const filters = {}; 34471 view.filters?.forEach(filter => { 34472 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 34473 filters.status = filter.value; 34474 } 34475 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 34476 filters.author = filter.value; 34477 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 34478 filters.author_exclude = filter.value; 34479 } 34480 }); 34481 34482 // The bundled views want data filtered without displaying the filter. 34483 const activeViewFilters = getActiveViewFilters(defaultViews, activeView); 34484 activeViewFilters.forEach(filter => { 34485 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 34486 filters.status = filter.value; 34487 } 34488 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 34489 filters.author = filter.value; 34490 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 34491 filters.author_exclude = filter.value; 34492 } 34493 }); 34494 34495 // We want to provide a different default item for the status filter 34496 // than the REST API provides. 34497 if (!filters.status || filters.status === '') { 34498 filters.status = DEFAULT_STATUSES; 34499 } 34500 return { 34501 per_page: view.perPage, 34502 page: view.page, 34503 _embed: 'author', 34504 order: view.sort?.direction, 34505 orderby: view.sort?.field, 34506 search: view.search, 34507 ...filters 34508 }; 34509 }, [view, activeView, defaultViews]); 34510 const { 34511 records, 34512 isResolving: isLoadingData, 34513 totalItems, 34514 totalPages 34515 } = useEntityRecordsWithPermissions('postType', postType, queryArgs); 34516 34517 // The REST API sort the authors by ID, but we want to sort them by name. 34518 const data = (0,external_wp_element_namespaceObject.useMemo)(() => { 34519 if (!isLoadingFields && view?.sort?.field === 'author') { 34520 return filterSortAndPaginate(records, { 34521 sort: { 34522 ...view.sort 34523 } 34524 }, fields).data; 34525 } 34526 return records; 34527 }, [records, fields, isLoadingFields, view?.sort]); 34528 const ids = (_data$map = data?.map(record => getItemId(record))) !== null && _data$map !== void 0 ? _data$map : []; 34529 const prevIds = (_usePrevious = (0,external_wp_compose_namespaceObject.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : []; 34530 const deletedIds = prevIds.filter(id => !ids.includes(id)); 34531 const postIdWasDeleted = deletedIds.includes(postId); 34532 (0,external_wp_element_namespaceObject.useEffect)(() => { 34533 if (postIdWasDeleted) { 34534 history.push({ 34535 ...history.getLocationWithParams().params, 34536 postId: undefined 34537 }); 34538 } 34539 }, [postIdWasDeleted, history]); 34540 const paginationInfo = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 34541 totalItems, 34542 totalPages 34543 }), [totalItems, totalPages]); 34544 const { 34545 labels, 34546 canCreateRecord 34547 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 34548 const { 34549 getPostType, 34550 canUser 34551 } = select(external_wp_coreData_namespaceObject.store); 34552 return { 34553 labels: getPostType(postType)?.labels, 34554 canCreateRecord: canUser('create', { 34555 kind: 'postType', 34556 name: postType 34557 }) 34558 }; 34559 }, [postType]); 34560 const postTypeActions = usePostActions({ 34561 postType, 34562 context: 'list' 34563 }); 34564 const editAction = useEditPostAction(); 34565 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 34566 const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_namespaceObject.useState)(false); 34567 const openModal = () => setShowAddPostModal(true); 34568 const closeModal = () => setShowAddPostModal(false); 34569 const handleNewPage = ({ 34570 type, 34571 id 34572 }) => { 34573 history.push({ 34574 postId: id, 34575 postType: type, 34576 canvas: 'edit' 34577 }); 34578 closeModal(); 34579 }; 34580 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 34581 title: labels?.name, 34582 actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34583 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34584 variant: "primary", 34585 onClick: openModal, 34586 __next40pxDefaultSize: true, 34587 children: labels.add_new_item 34588 }), showAddPostModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPostModal, { 34589 postType: postType, 34590 onSave: handleNewPage, 34591 onClose: closeModal 34592 })] 34593 }), 34594 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 34595 paginationInfo: paginationInfo, 34596 fields: fields, 34597 actions: actions, 34598 data: data || post_list_EMPTY_ARRAY, 34599 isLoading: isLoadingData || isLoadingFields, 34600 view: view, 34601 onChangeView: setView, 34602 selection: selection, 34603 onChangeSelection: onChangeSelection, 34604 getItemId: getItemId, 34605 defaultLayouts: defaultLayouts, 34606 header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34607 size: "compact", 34608 isPressed: quickEdit, 34609 icon: drawer_right, 34610 label: (0,external_wp_i18n_namespaceObject.__)('Toggle details panel'), 34611 onClick: () => { 34612 history.push({ 34613 ...location.params, 34614 quickEdit: quickEdit ? undefined : true 34615 }); 34616 } 34617 }) 34618 }, activeView + isCustom) 34619 }); 34620 } 34621 34622 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js 34623 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); 34624 34625 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js 34626 /** 34627 * WordPress dependencies 34628 */ 34629 34630 34631 34632 34633 /** 34634 * Internal dependencies 34635 */ 34636 34637 34638 34639 function usePatternSettings() { 34640 var _storedSettings$__exp; 34641 const storedSettings = (0,external_wp_data_namespaceObject.useSelect)(select => { 34642 const { 34643 getSettings 34644 } = unlock(select(store)); 34645 return getSettings(); 34646 }, []); 34647 const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : 34648 // WP 6.0 34649 storedSettings.__experimentalBlockPatterns; // WP 5.9 34650 34651 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), []); 34652 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]); 34653 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { 34654 const { 34655 __experimentalAdditionalBlockPatterns, 34656 ...restStoredSettings 34657 } = storedSettings; 34658 return { 34659 ...restStoredSettings, 34660 __experimentalBlockPatterns: blockPatterns, 34661 __unstableIsPreviewMode: true 34662 }; 34663 }, [storedSettings, blockPatterns]); 34664 return settings; 34665 } 34666 34667 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js 34668 /** 34669 * WordPress dependencies 34670 */ 34671 34672 34673 /** 34674 * Internal dependencies 34675 */ 34676 34677 const { 34678 extractWords, 34679 getNormalizedSearchTerms, 34680 normalizeString: search_items_normalizeString 34681 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 34682 34683 /** 34684 * Internal dependencies 34685 */ 34686 34687 34688 // Default search helpers. 34689 const defaultGetName = item => { 34690 if (item.type === PATTERN_TYPES.user) { 34691 return item.slug; 34692 } 34693 if (item.type === TEMPLATE_PART_POST_TYPE) { 34694 return ''; 34695 } 34696 return item.name || ''; 34697 }; 34698 const defaultGetTitle = item => { 34699 if (typeof item.title === 'string') { 34700 return item.title; 34701 } 34702 if (item.title && item.title.rendered) { 34703 return item.title.rendered; 34704 } 34705 if (item.title && item.title.raw) { 34706 return item.title.raw; 34707 } 34708 return ''; 34709 }; 34710 const defaultGetDescription = item => { 34711 if (item.type === PATTERN_TYPES.user) { 34712 return item.excerpt.raw; 34713 } 34714 return item.description || ''; 34715 }; 34716 const defaultGetKeywords = item => item.keywords || []; 34717 const defaultHasCategory = () => false; 34718 const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 34719 return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term))); 34720 }; 34721 34722 /** 34723 * Filters an item list given a search term. 34724 * 34725 * @param {Array} items Item list 34726 * @param {string} searchInput Search input. 34727 * @param {Object} config Search Config. 34728 * 34729 * @return {Array} Filtered item list. 34730 */ 34731 const searchItems = (items = [], searchInput = '', config = {}) => { 34732 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 34733 34734 // Filter patterns by category: the default category indicates that all patterns will be shown. 34735 const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; 34736 const searchRankConfig = { 34737 ...config, 34738 onlyFilterByCategory 34739 }; 34740 34741 // If we aren't filtering on search terms, matching on category is satisfactory. 34742 // If we are, then we need more than a category match. 34743 const threshold = onlyFilterByCategory ? 0 : 1; 34744 const rankedItems = items.map(item => { 34745 return [item, getItemSearchRank(item, searchInput, searchRankConfig)]; 34746 }).filter(([, rank]) => rank > threshold); 34747 34748 // If we didn't have terms to search on, there's no point sorting. 34749 if (normalizedSearchTerms.length === 0) { 34750 return rankedItems.map(([item]) => item); 34751 } 34752 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 34753 return rankedItems.map(([item]) => item); 34754 }; 34755 34756 /** 34757 * Get the search rank for a given item and a specific search term. 34758 * The better the match, the higher the rank. 34759 * If the rank equals 0, it should be excluded from the results. 34760 * 34761 * @param {Object} item Item to filter. 34762 * @param {string} searchTerm Search term. 34763 * @param {Object} config Search Config. 34764 * 34765 * @return {number} Search Rank. 34766 */ 34767 function getItemSearchRank(item, searchTerm, config) { 34768 const { 34769 categoryId, 34770 getName = defaultGetName, 34771 getTitle = defaultGetTitle, 34772 getDescription = defaultGetDescription, 34773 getKeywords = defaultGetKeywords, 34774 hasCategory = defaultHasCategory, 34775 onlyFilterByCategory 34776 } = config; 34777 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; 34778 34779 // If an item doesn't belong to the current category or we don't have 34780 // search terms to filter by, return the initial rank value. 34781 if (!rank || onlyFilterByCategory) { 34782 return rank; 34783 } 34784 const name = getName(item); 34785 const title = getTitle(item); 34786 const description = getDescription(item); 34787 const keywords = getKeywords(item); 34788 const normalizedSearchInput = search_items_normalizeString(searchTerm); 34789 const normalizedTitle = search_items_normalizeString(title); 34790 34791 // Prefers exact matches 34792 // Then prefers if the beginning of the title matches the search term 34793 // name, keywords, description matches come later. 34794 if (normalizedSearchInput === normalizedTitle) { 34795 rank += 30; 34796 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 34797 rank += 20; 34798 } else { 34799 const terms = [name, title, description, ...keywords].join(' '); 34800 const normalizedSearchTerms = extractWords(normalizedSearchInput); 34801 const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); 34802 if (unmatchedTerms.length === 0) { 34803 rank += 10; 34804 } 34805 } 34806 return rank; 34807 } 34808 34809 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js 34810 /** 34811 * WordPress dependencies 34812 */ 34813 34814 34815 34816 34817 34818 34819 /** 34820 * Internal dependencies 34821 */ 34822 34823 34824 34825 34826 34827 const EMPTY_PATTERN_LIST = []; 34828 const selectTemplateParts = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, search = '') => { 34829 var _getEntityRecords; 34830 const { 34831 getEntityRecords, 34832 isResolving: isResolvingSelector 34833 } = select(external_wp_coreData_namespaceObject.store); 34834 const { 34835 __experimentalGetDefaultTemplatePartAreas 34836 } = select(external_wp_editor_namespaceObject.store); 34837 const query = { 34838 per_page: -1 34839 }; 34840 const templateParts = (_getEntityRecords = getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST; 34841 34842 // In the case where a custom template part area has been removed we need 34843 // the current list of areas to cross check against so orphaned template 34844 // parts can be treated as uncategorized. 34845 const knownAreas = __experimentalGetDefaultTemplatePartAreas() || []; 34846 const templatePartAreas = knownAreas.map(area => area.area); 34847 const templatePartHasCategory = (item, category) => { 34848 if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { 34849 return item.area === category; 34850 } 34851 return item.area === category || !templatePartAreas.includes(item.area); 34852 }; 34853 const isResolving = isResolvingSelector('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, query]); 34854 const patterns = searchItems(templateParts, search, { 34855 categoryId, 34856 hasCategory: templatePartHasCategory 34857 }); 34858 return { 34859 patterns, 34860 isResolving 34861 }; 34862 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 34863 per_page: -1 34864 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, { 34865 per_page: -1 34866 }]), select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas()]); 34867 const selectThemePatterns = (0,external_wp_data_namespaceObject.createSelector)(select => { 34868 var _settings$__experimen; 34869 const { 34870 getSettings 34871 } = unlock(select(store)); 34872 const { 34873 isResolving: isResolvingSelector 34874 } = select(external_wp_coreData_namespaceObject.store); 34875 const settings = getSettings(); 34876 const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns; 34877 const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns(); 34878 const patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({ 34879 ...pattern, 34880 keywords: pattern.keywords || [], 34881 type: PATTERN_TYPES.theme, 34882 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 34883 __unstableSkipMigrationLogs: true 34884 }) 34885 })); 34886 return { 34887 patterns, 34888 isResolving: isResolvingSelector('getBlockPatterns') 34889 }; 34890 }, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).isResolving('getBlockPatterns'), unlock(select(store)).getSettings()]); 34891 const selectPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, syncStatus, search = '') => { 34892 const { 34893 patterns: themePatterns, 34894 isResolving: isResolvingThemePatterns 34895 } = selectThemePatterns(select); 34896 const { 34897 patterns: userPatterns, 34898 isResolving: isResolvingUserPatterns, 34899 categories: userPatternCategories 34900 } = selectUserPatterns(select); 34901 let patterns = [...(themePatterns || []), ...(userPatterns || [])]; 34902 if (syncStatus) { 34903 // User patterns can have their sync statuses checked directly 34904 // Non-user patterns are all unsynced for the time being. 34905 patterns = patterns.filter(pattern => { 34906 return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; 34907 }); 34908 } 34909 if (categoryId) { 34910 patterns = searchItems(patterns, search, { 34911 categoryId, 34912 hasCategory: (item, currentCategory) => { 34913 if (item.type === PATTERN_TYPES.user) { 34914 return item.wp_pattern_category.some(catId => userPatternCategories.find(cat => cat.id === catId)?.slug === currentCategory); 34915 } 34916 return item.categories?.includes(currentCategory); 34917 } 34918 }); 34919 } else { 34920 patterns = searchItems(patterns, search, { 34921 hasCategory: item => { 34922 if (item.type === PATTERN_TYPES.user) { 34923 return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category.some(catId => userPatternCategories.find(cat => cat.id === catId))); 34924 } 34925 return !item.hasOwnProperty('categories'); 34926 } 34927 }); 34928 } 34929 return { 34930 patterns, 34931 isResolving: isResolvingThemePatterns || isResolvingUserPatterns 34932 }; 34933 }, select => [selectThemePatterns(select), selectUserPatterns(select)]); 34934 const selectUserPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, syncStatus, search = '') => { 34935 const { 34936 getEntityRecords, 34937 isResolving: isResolvingSelector, 34938 getUserPatternCategories 34939 } = select(external_wp_coreData_namespaceObject.store); 34940 const query = { 34941 per_page: -1 34942 }; 34943 const patternPosts = getEntityRecords('postType', PATTERN_TYPES.user, query); 34944 const userPatternCategories = getUserPatternCategories(); 34945 const categories = new Map(); 34946 userPatternCategories.forEach(userCategory => categories.set(userCategory.id, userCategory)); 34947 let patterns = patternPosts !== null && patternPosts !== void 0 ? patternPosts : EMPTY_PATTERN_LIST; 34948 const isResolving = isResolvingSelector('getEntityRecords', ['postType', PATTERN_TYPES.user, query]); 34949 if (syncStatus) { 34950 patterns = patterns.filter(pattern => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus); 34951 } 34952 patterns = searchItems(patterns, search, { 34953 // We exit user pattern retrieval early if we aren't in the 34954 // catch-all category for user created patterns, so it has 34955 // to be in the category. 34956 hasCategory: () => true 34957 }); 34958 return { 34959 patterns, 34960 isResolving, 34961 categories: userPatternCategories 34962 }; 34963 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', PATTERN_TYPES.user, { 34964 per_page: -1 34965 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, { 34966 per_page: -1 34967 }]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()]); 34968 function useAugmentPatternsWithPermissions(patterns) { 34969 const idsAndTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 34970 var _patterns$filter$map; 34971 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 : []; 34972 }, [patterns]); 34973 const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => { 34974 const { 34975 getEntityRecordPermissions 34976 } = unlock(select(external_wp_coreData_namespaceObject.store)); 34977 return idsAndTypes.reduce((acc, [type, id]) => { 34978 acc[id] = getEntityRecordPermissions('postType', type, id); 34979 return acc; 34980 }, {}); 34981 }, [idsAndTypes]); 34982 return (0,external_wp_element_namespaceObject.useMemo)(() => { 34983 var _patterns$map; 34984 return (_patterns$map = patterns?.map(record => { 34985 var _permissions$record$i; 34986 return { 34987 ...record, 34988 permissions: (_permissions$record$i = permissions?.[record.id]) !== null && _permissions$record$i !== void 0 ? _permissions$record$i : {} 34989 }; 34990 })) !== null && _patterns$map !== void 0 ? _patterns$map : []; 34991 }, [patterns, permissions]); 34992 } 34993 const usePatterns = (postType, categoryId, { 34994 search = '', 34995 syncStatus 34996 } = {}) => { 34997 return (0,external_wp_data_namespaceObject.useSelect)(select => { 34998 if (postType === TEMPLATE_PART_POST_TYPE) { 34999 return selectTemplateParts(select, categoryId, search); 35000 } else if (postType === PATTERN_TYPES.user && !!categoryId) { 35001 const appliedCategory = categoryId === 'uncategorized' ? '' : categoryId; 35002 return selectPatterns(select, appliedCategory, syncStatus, search); 35003 } else if (postType === PATTERN_TYPES.user) { 35004 return selectUserPatterns(select, syncStatus, search); 35005 } 35006 return { 35007 patterns: EMPTY_PATTERN_LIST, 35008 isResolving: false 35009 }; 35010 }, [categoryId, postType, search, syncStatus]); 35011 }; 35012 /* harmony default export */ const use_patterns = (usePatterns); 35013 35014 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js 35015 /** 35016 * WordPress dependencies 35017 */ 35018 35019 35020 const symbol_symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35021 xmlns: "http://www.w3.org/2000/svg", 35022 viewBox: "0 0 24 24", 35023 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35024 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" 35025 }) 35026 }); 35027 /* harmony default export */ const library_symbol = (symbol_symbol); 35028 35029 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 35030 /** 35031 * WordPress dependencies 35032 */ 35033 35034 35035 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35036 xmlns: "http://www.w3.org/2000/svg", 35037 viewBox: "0 0 24 24", 35038 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35039 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" 35040 }) 35041 }); 35042 /* harmony default export */ const symbol_filled = (symbolFilled); 35043 35044 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js 35045 /** 35046 * WordPress dependencies 35047 */ 35048 35049 35050 const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35051 xmlns: "http://www.w3.org/2000/svg", 35052 viewBox: "0 0 24 24", 35053 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35054 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" 35055 }) 35056 }); 35057 /* harmony default export */ const library_upload = (upload); 35058 35059 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js 35060 /** 35061 * WordPress dependencies 35062 */ 35063 35064 35065 35066 35067 35068 35069 35070 35071 35072 35073 35074 /** 35075 * Internal dependencies 35076 */ 35077 35078 35079 35080 35081 35082 const { 35083 useHistory: add_new_pattern_useHistory 35084 } = unlock(external_wp_router_namespaceObject.privateApis); 35085 const { 35086 CreatePatternModal, 35087 useAddPatternCategory 35088 } = unlock(external_wp_patterns_namespaceObject.privateApis); 35089 const { 35090 CreateTemplatePartModal 35091 } = unlock(external_wp_editor_namespaceObject.privateApis); 35092 function AddNewPattern() { 35093 const history = add_new_pattern_useHistory(); 35094 const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false); 35095 const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false); 35096 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 35097 const { 35098 createPatternFromFile 35099 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store)); 35100 const { 35101 createSuccessNotice, 35102 createErrorNotice 35103 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 35104 const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)(); 35105 const { 35106 isBlockBasedTheme, 35107 addNewPatternLabel, 35108 addNewTemplatePartLabel, 35109 canCreatePattern, 35110 canCreateTemplatePart 35111 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 35112 const { 35113 getCurrentTheme, 35114 getPostType, 35115 canUser 35116 } = select(external_wp_coreData_namespaceObject.store); 35117 return { 35118 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 35119 addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, 35120 addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, 35121 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 35122 canCreatePattern: canUser('create', { 35123 kind: 'postType', 35124 name: PATTERN_TYPES.user 35125 }), 35126 canCreateTemplatePart: canUser('create', { 35127 kind: 'postType', 35128 name: TEMPLATE_PART_POST_TYPE 35129 }) 35130 }; 35131 }, []); 35132 function handleCreatePattern({ 35133 pattern 35134 }) { 35135 setShowPatternModal(false); 35136 history.push({ 35137 postId: pattern.id, 35138 postType: PATTERN_TYPES.user, 35139 canvas: 'edit' 35140 }); 35141 } 35142 function handleCreateTemplatePart(templatePart) { 35143 setShowTemplatePartModal(false); 35144 35145 // Navigate to the created template part editor. 35146 history.push({ 35147 postId: templatePart.id, 35148 postType: TEMPLATE_PART_POST_TYPE, 35149 canvas: 'edit' 35150 }); 35151 } 35152 function handleError() { 35153 setShowPatternModal(false); 35154 setShowTemplatePartModal(false); 35155 } 35156 const controls = []; 35157 if (canCreatePattern) { 35158 controls.push({ 35159 icon: library_symbol, 35160 onClick: () => setShowPatternModal(true), 35161 title: addNewPatternLabel 35162 }); 35163 } 35164 if (isBlockBasedTheme && canCreateTemplatePart) { 35165 controls.push({ 35166 icon: symbol_filled, 35167 onClick: () => setShowTemplatePartModal(true), 35168 title: addNewTemplatePartLabel 35169 }); 35170 } 35171 if (canCreatePattern) { 35172 controls.push({ 35173 icon: library_upload, 35174 onClick: () => { 35175 patternUploadInputRef.current.click(); 35176 }, 35177 title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON') 35178 }); 35179 } 35180 const { 35181 categoryMap, 35182 findOrCreateTerm 35183 } = useAddPatternCategory(); 35184 if (controls.length === 0) { 35185 return null; 35186 } 35187 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35188 children: [addNewPatternLabel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 35189 controls: controls, 35190 icon: null, 35191 toggleProps: { 35192 variant: 'primary', 35193 showTooltip: false, 35194 __next40pxDefaultSize: true 35195 }, 35196 text: addNewPatternLabel, 35197 label: addNewPatternLabel 35198 }), showPatternModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModal, { 35199 onClose: () => setShowPatternModal(false), 35200 onSuccess: handleCreatePattern, 35201 onError: handleError 35202 }), showTemplatePartModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { 35203 closeModal: () => setShowTemplatePartModal(false), 35204 blocks: [], 35205 onCreate: handleCreateTemplatePart, 35206 onError: handleError 35207 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 35208 type: "file", 35209 accept: ".json", 35210 hidden: true, 35211 ref: patternUploadInputRef, 35212 onChange: async event => { 35213 const file = event.target.files?.[0]; 35214 if (!file) { 35215 return; 35216 } 35217 try { 35218 const { 35219 params: { 35220 postType, 35221 categoryId 35222 } 35223 } = history.getLocationWithParams(); 35224 let currentCategoryId; 35225 // When we're not handling template parts, we should 35226 // add or create the proper pattern category. 35227 if (postType !== TEMPLATE_PART_POST_TYPE) { 35228 /* 35229 * categoryMap.values() returns an iterator. 35230 * Iterator.prototype.find() is not yet widely supported. 35231 * Convert to array to use the Array.prototype.find method. 35232 */ 35233 const currentCategory = Array.from(categoryMap.values()).find(term => term.name === categoryId); 35234 if (currentCategory) { 35235 currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label)); 35236 } 35237 } 35238 const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined); 35239 35240 // Navigate to the All patterns category for the newly created pattern 35241 // if we're not on that page already and if we're not in the `my-patterns` 35242 // category. 35243 if (!currentCategoryId && categoryId !== 'my-patterns') { 35244 history.push({ 35245 postType: PATTERN_TYPES.user, 35246 categoryId: PATTERN_DEFAULT_CATEGORY 35247 }); 35248 } 35249 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 35250 // translators: %s: The imported pattern's title. 35251 (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), { 35252 type: 'snackbar', 35253 id: 'import-pattern-success' 35254 }); 35255 } catch (err) { 35256 createErrorNotice(err.message, { 35257 type: 'snackbar', 35258 id: 'import-pattern-error' 35259 }); 35260 } finally { 35261 event.target.value = ''; 35262 } 35263 } 35264 })] 35265 }); 35266 } 35267 35268 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js 35269 /** 35270 * WordPress dependencies 35271 */ 35272 35273 35274 35275 /** 35276 * Internal dependencies 35277 */ 35278 35279 35280 function useDefaultPatternCategories() { 35281 const blockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => { 35282 var _settings$__experimen; 35283 const { 35284 getSettings 35285 } = unlock(select(store)); 35286 const settings = getSettings(); 35287 return (_settings$__experimen = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatternCategories; 35288 }); 35289 const restBlockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()); 35290 return [...(blockPatternCategories || []), ...(restBlockPatternCategories || [])]; 35291 } 35292 35293 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js 35294 /** 35295 * WordPress dependencies 35296 */ 35297 35298 35299 35300 35301 /** 35302 * Internal dependencies 35303 */ 35304 35305 35306 35307 35308 function useThemePatterns() { 35309 const blockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => { 35310 var _getSettings$__experi; 35311 const { 35312 getSettings 35313 } = unlock(select(store)); 35314 return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns; 35315 }); 35316 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns()); 35317 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]); 35318 return patterns; 35319 } 35320 35321 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js 35322 /** 35323 * WordPress dependencies 35324 */ 35325 35326 35327 35328 /** 35329 * Internal dependencies 35330 */ 35331 35332 35333 35334 35335 function usePatternCategories() { 35336 const defaultCategories = useDefaultPatternCategories(); 35337 defaultCategories.push({ 35338 name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, 35339 label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') 35340 }); 35341 const themePatterns = useThemePatterns(); 35342 const { 35343 patterns: userPatterns, 35344 categories: userPatternCategories 35345 } = use_patterns(PATTERN_TYPES.user); 35346 const patternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { 35347 const categoryMap = {}; 35348 const categoriesWithCounts = []; 35349 35350 // Create a map for easier counting of patterns in categories. 35351 defaultCategories.forEach(category => { 35352 if (!categoryMap[category.name]) { 35353 categoryMap[category.name] = { 35354 ...category, 35355 count: 0 35356 }; 35357 } 35358 }); 35359 userPatternCategories.forEach(category => { 35360 if (!categoryMap[category.name]) { 35361 categoryMap[category.name] = { 35362 ...category, 35363 count: 0 35364 }; 35365 } 35366 }); 35367 35368 // Update the category counts to reflect theme registered patterns. 35369 themePatterns.forEach(pattern => { 35370 pattern.categories?.forEach(category => { 35371 if (categoryMap[category]) { 35372 categoryMap[category].count += 1; 35373 } 35374 }); 35375 // If the pattern has no categories, add it to uncategorized. 35376 if (!pattern.categories?.length) { 35377 categoryMap.uncategorized.count += 1; 35378 } 35379 }); 35380 35381 // Update the category counts to reflect user registered patterns. 35382 userPatterns.forEach(pattern => { 35383 pattern.wp_pattern_category?.forEach(catId => { 35384 const category = userPatternCategories.find(cat => cat.id === catId)?.name; 35385 if (categoryMap[category]) { 35386 categoryMap[category].count += 1; 35387 } 35388 }); 35389 // If the pattern has no categories, add it to uncategorized. 35390 if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category.some(catId => userPatternCategories.find(cat => cat.id === catId))) { 35391 categoryMap.uncategorized.count += 1; 35392 } 35393 }); 35394 35395 // Filter categories so we only have those containing patterns. 35396 [...defaultCategories, ...userPatternCategories].forEach(category => { 35397 if (categoryMap[category.name].count && !categoriesWithCounts.find(cat => cat.name === category.name)) { 35398 categoriesWithCounts.push(categoryMap[category.name]); 35399 } 35400 }); 35401 const sortedCategories = categoriesWithCounts.sort((a, b) => a.label.localeCompare(b.label)); 35402 sortedCategories.unshift({ 35403 name: PATTERN_USER_CATEGORY, 35404 label: (0,external_wp_i18n_namespaceObject.__)('My patterns'), 35405 count: userPatterns.length 35406 }); 35407 sortedCategories.unshift({ 35408 name: PATTERN_DEFAULT_CATEGORY, 35409 label: (0,external_wp_i18n_namespaceObject.__)('All patterns'), 35410 description: (0,external_wp_i18n_namespaceObject.__)('A list of all patterns from all sources.'), 35411 count: themePatterns.length + userPatterns.length 35412 }); 35413 return sortedCategories; 35414 }, [defaultCategories, themePatterns, userPatternCategories, userPatterns]); 35415 return { 35416 patternCategories, 35417 hasPatterns: !!patternCategories.length 35418 }; 35419 } 35420 35421 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js 35422 /** 35423 * WordPress dependencies 35424 */ 35425 35426 35427 35428 35429 /** 35430 * Internal dependencies 35431 */ 35432 35433 35434 /** 35435 * Internal dependencies 35436 */ 35437 35438 35439 35440 35441 const { 35442 RenamePatternCategoryModal 35443 } = unlock(external_wp_patterns_namespaceObject.privateApis); 35444 function RenameCategoryMenuItem({ 35445 category, 35446 onClose 35447 }) { 35448 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 35449 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35450 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 35451 onClick: () => setIsModalOpen(true), 35452 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 35453 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameModal, { 35454 category: category, 35455 onClose: () => { 35456 setIsModalOpen(false); 35457 onClose(); 35458 } 35459 })] 35460 }); 35461 } 35462 function RenameModal({ 35463 category, 35464 onClose 35465 }) { 35466 // User created pattern categories have their properties updated when 35467 // retrieved via `getUserPatternCategories`. The rename modal expects an 35468 // object that will match the pattern category entity. 35469 const normalizedCategory = { 35470 id: category.id, 35471 slug: category.slug, 35472 name: category.label 35473 }; 35474 35475 // Optimization - only use pattern categories when the modal is open. 35476 const existingCategories = usePatternCategories(); 35477 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternCategoryModal, { 35478 category: normalizedCategory, 35479 existingCategories: existingCategories, 35480 onClose: onClose, 35481 overlayClassName: "edit-site-list__rename-modal", 35482 focusOnMount: "firstContentElement", 35483 size: "small" 35484 }); 35485 } 35486 35487 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js 35488 /** 35489 * WordPress dependencies 35490 */ 35491 35492 35493 35494 35495 35496 35497 35498 35499 35500 /** 35501 * Internal dependencies 35502 */ 35503 35504 35505 35506 35507 35508 const { 35509 useHistory: delete_category_menu_item_useHistory 35510 } = unlock(external_wp_router_namespaceObject.privateApis); 35511 function DeleteCategoryMenuItem({ 35512 category, 35513 onClose 35514 }) { 35515 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 35516 const history = delete_category_menu_item_useHistory(); 35517 const { 35518 createSuccessNotice, 35519 createErrorNotice 35520 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 35521 const { 35522 deleteEntityRecord, 35523 invalidateResolution 35524 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 35525 const onDelete = async () => { 35526 try { 35527 await deleteEntityRecord('taxonomy', 'wp_pattern_category', category.id, { 35528 force: true 35529 }, { 35530 throwOnError: true 35531 }); 35532 35533 // Prevent the need to refresh the page to get up-to-date categories 35534 // and pattern categorization. 35535 invalidateResolution('getUserPatternCategories'); 35536 invalidateResolution('getEntityRecords', ['postType', PATTERN_TYPES.user, { 35537 per_page: -1 35538 }]); 35539 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The pattern category's name */ 35540 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'pattern category'), category.label), { 35541 type: 'snackbar', 35542 id: 'pattern-category-delete' 35543 }); 35544 onClose?.(); 35545 history.push({ 35546 postType: PATTERN_TYPES.user, 35547 categoryId: PATTERN_DEFAULT_CATEGORY 35548 }); 35549 } catch (error) { 35550 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the pattern category.'); 35551 createErrorNotice(errorMessage, { 35552 type: 'snackbar', 35553 id: 'pattern-category-delete' 35554 }); 35555 } 35556 }; 35557 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35558 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 35559 isDestructive: true, 35560 onClick: () => setIsModalOpen(true), 35561 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 35562 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 35563 isOpen: isModalOpen, 35564 onConfirm: onDelete, 35565 onCancel: () => setIsModalOpen(false), 35566 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 35567 className: "edit-site-patterns__delete-modal", 35568 title: (0,external_wp_i18n_namespaceObject.sprintf)( 35569 // translators: %s: The pattern category's name. 35570 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'pattern category'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)), 35571 size: "medium", 35572 __experimentalHideHeader: false, 35573 children: (0,external_wp_i18n_namespaceObject.sprintf)( 35574 // translators: %s: The pattern category's name. 35575 (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)) 35576 })] 35577 }); 35578 } 35579 35580 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/header.js 35581 /** 35582 * WordPress dependencies 35583 */ 35584 35585 35586 35587 35588 35589 35590 /** 35591 * Internal dependencies 35592 */ 35593 35594 35595 35596 35597 35598 35599 35600 function PatternsHeader({ 35601 categoryId, 35602 type, 35603 titleId, 35604 descriptionId 35605 }) { 35606 const { 35607 patternCategories 35608 } = usePatternCategories(); 35609 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []); 35610 let title, description, patternCategory; 35611 if (type === TEMPLATE_PART_POST_TYPE) { 35612 const templatePartArea = templatePartAreas.find(area => area.area === categoryId); 35613 title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)('All Template Parts'); 35614 description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)('Includes every template part defined for any area.'); 35615 } else if (type === PATTERN_TYPES.user && !!categoryId) { 35616 patternCategory = patternCategories.find(category => category.name === categoryId); 35617 title = patternCategory?.label; 35618 description = patternCategory?.description; 35619 } 35620 if (!title) { 35621 return null; 35622 } 35623 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35624 className: "edit-site-patterns__section-header", 35625 spacing: 1, 35626 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35627 justify: "space-between", 35628 className: "edit-site-patterns__title", 35629 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 35630 as: "h2", 35631 level: 3, 35632 id: titleId, 35633 weight: 500, 35634 truncate: true, 35635 children: title 35636 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35637 expanded: false, 35638 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}), !!patternCategory?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 35639 icon: more_vertical, 35640 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 35641 toggleProps: { 35642 className: 'edit-site-patterns__button', 35643 description: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: pattern category name */ 35644 (0,external_wp_i18n_namespaceObject.__)('Action menu for %s pattern category'), title), 35645 size: 'compact' 35646 }, 35647 children: ({ 35648 onClose 35649 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 35650 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameCategoryMenuItem, { 35651 category: patternCategory, 35652 onClose: onClose 35653 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteCategoryMenuItem, { 35654 category: patternCategory, 35655 onClose: onClose 35656 })] 35657 }) 35658 })] 35659 })] 35660 }), description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 35661 variant: "muted", 35662 as: "p", 35663 id: descriptionId, 35664 className: "edit-site-patterns__sub-title", 35665 children: description 35666 }) : null] 35667 }); 35668 } 35669 35670 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-small.js 35671 /** 35672 * WordPress dependencies 35673 */ 35674 35675 35676 const lockSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35677 viewBox: "0 0 24 24", 35678 xmlns: "http://www.w3.org/2000/svg", 35679 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35680 fillRule: "evenodd", 35681 clipRule: "evenodd", 35682 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" 35683 }) 35684 }); 35685 /* harmony default export */ const lock_small = (lockSmall); 35686 35687 ;// CONCATENATED MODULE: external ["wp","priorityQueue"] 35688 const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; 35689 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/async/index.js 35690 /** 35691 * WordPress dependencies 35692 */ 35693 35694 35695 const blockPreviewQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)(); 35696 35697 /** 35698 * Renders a component at the next idle time. 35699 * @param {*} props 35700 */ 35701 function Async({ 35702 children, 35703 placeholder 35704 }) { 35705 const [shouldRender, setShouldRender] = (0,external_wp_element_namespaceObject.useState)(false); 35706 35707 // In the future, we could try to use startTransition here, but currently 35708 // react will batch all transitions, which means all previews will be 35709 // rendered at the same time. 35710 // https://react.dev/reference/react/startTransition#caveats 35711 // > If there are multiple ongoing Transitions, React currently batches them 35712 // > together. This is a limitation that will likely be removed in a future 35713 // > release. 35714 35715 (0,external_wp_element_namespaceObject.useEffect)(() => { 35716 const context = {}; 35717 blockPreviewQueue.add(context, () => { 35718 // Synchronously run all renders so it consumes timeRemaining. 35719 // See https://github.com/WordPress/gutenberg/pull/48238 35720 (0,external_wp_element_namespaceObject.flushSync)(() => { 35721 setShouldRender(true); 35722 }); 35723 }); 35724 return () => { 35725 blockPreviewQueue.cancel(context); 35726 }; 35727 }, []); 35728 if (!shouldRender) { 35729 return placeholder; 35730 } 35731 return children; 35732 } 35733 35734 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js 35735 /** 35736 * WordPress dependencies 35737 */ 35738 35739 35740 const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35741 xmlns: "http://www.w3.org/2000/svg", 35742 viewBox: "0 0 24 24", 35743 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35744 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" 35745 }) 35746 }); 35747 /* harmony default export */ const library_plugins = (plugins); 35748 35749 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js 35750 /** 35751 * WordPress dependencies 35752 */ 35753 35754 35755 const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 35756 xmlns: "http://www.w3.org/2000/svg", 35757 viewBox: "0 0 24 24", 35758 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 35759 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" 35760 }) 35761 }); 35762 /* harmony default export */ const library_globe = (globe); 35763 35764 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js 35765 /** 35766 * WordPress dependencies 35767 */ 35768 35769 35770 35771 35772 /** 35773 * Internal dependencies 35774 */ 35775 35776 35777 /** @typedef {'wp_template'|'wp_template_part'} TemplateType */ 35778 35779 /** 35780 * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType 35781 * 35782 * @typedef AddedByData 35783 * @type {Object} 35784 * @property {AddedByType} type The type of the data. 35785 * @property {JSX.Element} icon The icon to display. 35786 * @property {string} [imageUrl] The optional image URL to display. 35787 * @property {string} [text] The text to display. 35788 * @property {boolean} isCustomized Whether the template has been customized. 35789 * 35790 * @param {TemplateType} postType The template post type. 35791 * @param {number} postId The template post id. 35792 * @return {AddedByData} The added by object or null. 35793 */ 35794 function useAddedBy(postType, postId) { 35795 return (0,external_wp_data_namespaceObject.useSelect)(select => { 35796 const { 35797 getEntityRecord, 35798 getMedia, 35799 getUser, 35800 getEditedEntityRecord 35801 } = select(external_wp_coreData_namespaceObject.store); 35802 const template = getEditedEntityRecord('postType', postType, postId); 35803 const originalSource = template?.original_source; 35804 const authorText = template?.author_text; 35805 switch (originalSource) { 35806 case 'theme': 35807 { 35808 return { 35809 type: originalSource, 35810 icon: library_layout, 35811 text: authorText, 35812 isCustomized: template.source === TEMPLATE_ORIGINS.custom 35813 }; 35814 } 35815 case 'plugin': 35816 { 35817 return { 35818 type: originalSource, 35819 icon: library_plugins, 35820 text: authorText, 35821 isCustomized: template.source === TEMPLATE_ORIGINS.custom 35822 }; 35823 } 35824 case 'site': 35825 { 35826 const siteData = getEntityRecord('root', '__unstableBase'); 35827 return { 35828 type: originalSource, 35829 icon: library_globe, 35830 imageUrl: siteData?.site_logo ? getMedia(siteData.site_logo)?.source_url : undefined, 35831 text: authorText, 35832 isCustomized: false 35833 }; 35834 } 35835 default: 35836 { 35837 const user = getUser(template.author); 35838 return { 35839 type: 'user', 35840 icon: comment_author_avatar, 35841 imageUrl: user?.avatar_urls?.[48], 35842 text: authorText, 35843 isCustomized: false 35844 }; 35845 } 35846 } 35847 }, [postType, postId]); 35848 } 35849 35850 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js 35851 /** 35852 * External dependencies 35853 */ 35854 35855 35856 /** 35857 * WordPress dependencies 35858 */ 35859 35860 35861 35862 35863 35864 35865 35866 35867 /** 35868 * Internal dependencies 35869 */ 35870 35871 35872 35873 35874 35875 35876 35877 35878 const { 35879 useGlobalStyle: fields_useGlobalStyle 35880 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 35881 function PreviewWrapper({ 35882 item, 35883 onClick, 35884 ariaDescribedBy, 35885 children 35886 }) { 35887 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 35888 className: "page-patterns-preview-field__button", 35889 type: "button", 35890 onClick: item.type !== PATTERN_TYPES.theme ? onClick : undefined, 35891 "aria-label": item.title, 35892 "aria-describedby": ariaDescribedBy, 35893 "aria-disabled": item.type === PATTERN_TYPES.theme, 35894 children: children 35895 }); 35896 } 35897 function PreviewField({ 35898 item 35899 }) { 35900 const descriptionId = (0,external_wp_element_namespaceObject.useId)(); 35901 const description = item.description || item?.excerpt?.raw; 35902 const isUserPattern = item.type === PATTERN_TYPES.user; 35903 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; 35904 const [backgroundColor] = fields_useGlobalStyle('color.background'); 35905 const { 35906 onClick 35907 } = useLink({ 35908 postType: item.type, 35909 postId: isUserPattern || isTemplatePart ? item.id : item.name, 35910 canvas: 'edit' 35911 }); 35912 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 35913 var _item$blocks; 35914 return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, { 35915 __unstableSkipMigrationLogs: true 35916 }); 35917 }, [item?.content?.raw, item.blocks]); 35918 const isEmpty = !blocks?.length; 35919 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 35920 className: "page-patterns-preview-field", 35921 style: { 35922 backgroundColor 35923 }, 35924 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewWrapper, { 35925 item: item, 35926 onClick: onClick, 35927 ariaDescribedBy: !!description ? descriptionId : undefined, 35928 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, { 35929 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 35930 blocks: blocks, 35931 viewportWidth: item.viewportWidth 35932 }) 35933 })] 35934 }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35935 hidden: true, 35936 id: descriptionId, 35937 children: description 35938 })] 35939 }); 35940 } 35941 const previewField = { 35942 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 35943 id: 'preview', 35944 render: PreviewField, 35945 enableSorting: false 35946 }; 35947 function TitleField({ 35948 item 35949 }) { 35950 const isUserPattern = item.type === PATTERN_TYPES.user; 35951 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; 35952 const { 35953 onClick 35954 } = useLink({ 35955 postType: item.type, 35956 postId: isUserPattern || isTemplatePart ? item.id : item.name, 35957 canvas: 'edit' 35958 }); 35959 const title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(defaultGetTitle(item)); 35960 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35961 alignment: "center", 35962 justify: "flex-start", 35963 spacing: 2, 35964 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 35965 as: "div", 35966 gap: 0, 35967 justify: "flex-start", 35968 className: "edit-site-patterns__pattern-title", 35969 children: item.type === PATTERN_TYPES.theme ? title : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35970 __next40pxDefaultSize: true, 35971 variant: "link", 35972 onClick: onClick 35973 // Required for the grid's roving tab index system. 35974 // See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243. 35975 , 35976 tabIndex: "-1", 35977 children: title 35978 }) 35979 }), item.type === PATTERN_TYPES.theme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 35980 placement: "top", 35981 text: (0,external_wp_i18n_namespaceObject.__)('This pattern cannot be edited.'), 35982 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 35983 className: "edit-site-patterns__pattern-lock-icon", 35984 icon: lock_small, 35985 size: 24 35986 }) 35987 })] 35988 }); 35989 } 35990 const titleField = { 35991 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 35992 id: 'title', 35993 getValue: ({ 35994 item 35995 }) => item.title?.raw || item.title, 35996 render: TitleField, 35997 enableHiding: false 35998 }; 35999 const SYNC_FILTERS = [{ 36000 value: PATTERN_SYNC_TYPES.full, 36001 label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), 36002 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that are kept in sync across the site.') 36003 }, { 36004 value: PATTERN_SYNC_TYPES.unsynced, 36005 label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)'), 36006 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that can be changed freely without affecting the site.') 36007 }]; 36008 const patternStatusField = { 36009 label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), 36010 id: 'sync-status', 36011 render: ({ 36012 item 36013 }) => { 36014 const syncStatus = 'wp_pattern_sync_status' in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced; 36015 // User patterns can have their sync statuses checked directly. 36016 // Non-user patterns are all unsynced for the time being. 36017 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36018 className: `edit-site-patterns__field-sync-status-$syncStatus}`, 36019 children: SYNC_FILTERS.find(({ 36020 value 36021 }) => value === syncStatus).label 36022 }); 36023 }, 36024 elements: SYNC_FILTERS, 36025 filterBy: { 36026 operators: [OPERATOR_IS], 36027 isPrimary: true 36028 }, 36029 enableSorting: false 36030 }; 36031 function AuthorField({ 36032 item 36033 }) { 36034 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 36035 const { 36036 text, 36037 icon, 36038 imageUrl 36039 } = useAddedBy(item.type, item.id); 36040 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36041 alignment: "left", 36042 spacing: 0, 36043 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 36044 className: dist_clsx('page-templates-author-field__avatar', { 36045 'is-loaded': isImageLoaded 36046 }), 36047 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 36048 onLoad: () => setIsImageLoaded(true), 36049 alt: "", 36050 src: imageUrl 36051 }) 36052 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 36053 className: "page-templates-author-field__icon", 36054 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 36055 icon: icon 36056 }) 36057 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36058 className: "page-templates-author-field__name", 36059 children: text 36060 })] 36061 }); 36062 } 36063 const templatePartAuthorField = { 36064 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 36065 id: 'author', 36066 getValue: ({ 36067 item 36068 }) => item.author_text, 36069 render: AuthorField, 36070 filterBy: { 36071 isPrimary: true 36072 } 36073 }; 36074 36075 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js 36076 /** 36077 * WordPress dependencies 36078 */ 36079 36080 36081 36082 36083 36084 36085 36086 36087 36088 /** 36089 * Internal dependencies 36090 */ 36091 36092 36093 36094 36095 36096 36097 36098 36099 36100 36101 const { 36102 ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider 36103 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 36104 const { 36105 usePostActions: page_patterns_usePostActions 36106 } = unlock(external_wp_editor_namespaceObject.privateApis); 36107 const { 36108 useLocation: page_patterns_useLocation 36109 } = unlock(external_wp_router_namespaceObject.privateApis); 36110 const page_patterns_EMPTY_ARRAY = []; 36111 const page_patterns_defaultLayouts = { 36112 [LAYOUT_TABLE]: { 36113 layout: { 36114 primaryField: 'title', 36115 styles: { 36116 preview: { 36117 width: '1%' 36118 }, 36119 author: { 36120 width: '1%' 36121 } 36122 } 36123 } 36124 }, 36125 [LAYOUT_GRID]: { 36126 layout: { 36127 mediaField: 'preview', 36128 primaryField: 'title', 36129 badgeFields: ['sync-status'] 36130 } 36131 } 36132 }; 36133 const DEFAULT_VIEW = { 36134 type: LAYOUT_GRID, 36135 search: '', 36136 page: 1, 36137 perPage: 20, 36138 layout: page_patterns_defaultLayouts[LAYOUT_GRID].layout, 36139 fields: ['title', 'sync-status'], 36140 filters: [] 36141 }; 36142 function DataviewsPatterns() { 36143 const { 36144 params: { 36145 postType, 36146 categoryId: categoryIdFromURL 36147 } 36148 } = page_patterns_useLocation(); 36149 const type = postType || PATTERN_TYPES.user; 36150 const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY; 36151 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_VIEW); 36152 const previousCategoryId = (0,external_wp_compose_namespaceObject.usePrevious)(categoryId); 36153 const previousPostType = (0,external_wp_compose_namespaceObject.usePrevious)(type); 36154 const viewSyncStatus = view.filters?.find(({ 36155 field 36156 }) => field === 'sync-status')?.value; 36157 const { 36158 patterns, 36159 isResolving 36160 } = use_patterns(type, categoryId, { 36161 search: view.search, 36162 syncStatus: viewSyncStatus 36163 }); 36164 const { 36165 records 36166 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 36167 per_page: -1 36168 }); 36169 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 36170 if (!records) { 36171 return page_patterns_EMPTY_ARRAY; 36172 } 36173 const authorsSet = new Set(); 36174 records.forEach(template => { 36175 authorsSet.add(template.author_text); 36176 }); 36177 return Array.from(authorsSet).map(author => ({ 36178 value: author, 36179 label: author 36180 })); 36181 }, [records]); 36182 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 36183 const _fields = [previewField, titleField]; 36184 if (type === PATTERN_TYPES.user) { 36185 _fields.push(patternStatusField); 36186 } else if (type === TEMPLATE_PART_POST_TYPE) { 36187 _fields.push({ 36188 ...templatePartAuthorField, 36189 elements: authors 36190 }); 36191 } 36192 return _fields; 36193 }, [type, authors]); 36194 36195 // Reset the page number when the category changes. 36196 (0,external_wp_element_namespaceObject.useEffect)(() => { 36197 if (previousCategoryId !== categoryId || previousPostType !== type) { 36198 setView(prevView => ({ 36199 ...prevView, 36200 page: 1 36201 })); 36202 } 36203 }, [categoryId, previousCategoryId, previousPostType, type]); 36204 const { 36205 data, 36206 paginationInfo 36207 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 36208 // Search is managed server-side as well as filters for patterns. 36209 // However, the author filter in template parts is done client-side. 36210 const viewWithoutFilters = { 36211 ...view 36212 }; 36213 delete viewWithoutFilters.search; 36214 if (type !== TEMPLATE_PART_POST_TYPE) { 36215 viewWithoutFilters.filters = []; 36216 } 36217 return filterSortAndPaginate(patterns, viewWithoutFilters, fields); 36218 }, [patterns, view, fields, type]); 36219 const dataWithPermissions = useAugmentPatternsWithPermissions(data); 36220 const templatePartActions = page_patterns_usePostActions({ 36221 postType: TEMPLATE_PART_POST_TYPE, 36222 context: 'list' 36223 }); 36224 const patternActions = page_patterns_usePostActions({ 36225 postType: PATTERN_TYPES.user, 36226 context: 'list' 36227 }); 36228 const editAction = useEditPostAction(); 36229 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { 36230 if (type === TEMPLATE_PART_POST_TYPE) { 36231 return [editAction, ...templatePartActions].filter(Boolean); 36232 } 36233 return [editAction, ...patternActions].filter(Boolean); 36234 }, [editAction, type, templatePartActions, patternActions]); 36235 const id = (0,external_wp_element_namespaceObject.useId)(); 36236 const settings = usePatternSettings(); 36237 // Wrap everything in a block editor provider. 36238 // This ensures 'styles' that are needed for the previews are synced 36239 // from the site editor store to the block editor store. 36240 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { 36241 settings: settings, 36242 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 36243 title: (0,external_wp_i18n_namespaceObject.__)('Patterns content'), 36244 className: "edit-site-page-patterns-dataviews", 36245 hideTitleFromUI: true, 36246 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsHeader, { 36247 categoryId: categoryId, 36248 type: type, 36249 titleId: `$id}-title`, 36250 descriptionId: `$id}-description` 36251 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 36252 paginationInfo: paginationInfo, 36253 fields: fields, 36254 actions: actions, 36255 data: dataWithPermissions || page_patterns_EMPTY_ARRAY, 36256 getItemId: item => { 36257 var _item$name; 36258 return (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id; 36259 }, 36260 isLoading: isResolving, 36261 view: view, 36262 onChangeView: setView, 36263 defaultLayouts: page_patterns_defaultLayouts 36264 }, categoryId + postType)] 36265 }) 36266 }); 36267 } 36268 36269 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js 36270 /** 36271 * WordPress dependencies 36272 */ 36273 36274 36275 const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36276 xmlns: "http://www.w3.org/2000/svg", 36277 viewBox: "0 0 24 24", 36278 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36279 d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" 36280 }) 36281 }); 36282 /* harmony default export */ const library_home = (home); 36283 36284 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js 36285 /** 36286 * WordPress dependencies 36287 */ 36288 36289 36290 const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36291 viewBox: "0 0 24 24", 36292 xmlns: "http://www.w3.org/2000/svg", 36293 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36294 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" 36295 }) 36296 }); 36297 /* harmony default export */ const library_verse = (verse); 36298 36299 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pin.js 36300 /** 36301 * WordPress dependencies 36302 */ 36303 36304 36305 const pin = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36306 xmlns: "http://www.w3.org/2000/svg", 36307 viewBox: "0 0 24 24", 36308 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36309 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" 36310 }) 36311 }); 36312 /* harmony default export */ const library_pin = (pin); 36313 36314 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js 36315 /** 36316 * WordPress dependencies 36317 */ 36318 36319 36320 const archive = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36321 viewBox: "0 0 24 24", 36322 xmlns: "http://www.w3.org/2000/svg", 36323 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36324 fillRule: "evenodd", 36325 clipRule: "evenodd", 36326 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" 36327 }) 36328 }); 36329 /* harmony default export */ const library_archive = (archive); 36330 36331 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js 36332 /** 36333 * WordPress dependencies 36334 */ 36335 36336 36337 const notFound = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36338 xmlns: "http://www.w3.org/2000/svg", 36339 viewBox: "0 0 24 24", 36340 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36341 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" 36342 }) 36343 }); 36344 /* harmony default export */ const not_found = (notFound); 36345 36346 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js 36347 /** 36348 * WordPress dependencies 36349 */ 36350 36351 36352 const list = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36353 viewBox: "0 0 24 24", 36354 xmlns: "http://www.w3.org/2000/svg", 36355 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36356 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" 36357 }) 36358 }); 36359 /* harmony default export */ const library_list = (list); 36360 36361 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js 36362 /** 36363 * WordPress dependencies 36364 */ 36365 36366 36367 const blockMeta = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36368 xmlns: "http://www.w3.org/2000/svg", 36369 viewBox: "0 0 24 24", 36370 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36371 fillRule: "evenodd", 36372 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", 36373 clipRule: "evenodd" 36374 }) 36375 }); 36376 /* harmony default export */ const block_meta = (blockMeta); 36377 36378 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/calendar.js 36379 /** 36380 * WordPress dependencies 36381 */ 36382 36383 36384 const calendar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36385 viewBox: "0 0 24 24", 36386 xmlns: "http://www.w3.org/2000/svg", 36387 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36388 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" 36389 }) 36390 }); 36391 /* harmony default export */ const library_calendar = (calendar); 36392 36393 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js 36394 /** 36395 * WordPress dependencies 36396 */ 36397 36398 36399 const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36400 xmlns: "http://www.w3.org/2000/svg", 36401 viewBox: "0 0 24 24", 36402 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36403 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" 36404 }) 36405 }); 36406 /* harmony default export */ const library_tag = (tag); 36407 36408 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js 36409 /** 36410 * WordPress dependencies 36411 */ 36412 36413 36414 36415 const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 36416 xmlns: "http://www.w3.org/2000/svg", 36417 viewBox: "0 0 24 24", 36418 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36419 d: "m7 6.5 4 2.5-4 2.5z" 36420 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36421 fillRule: "evenodd", 36422 clipRule: "evenodd", 36423 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" 36424 })] 36425 }); 36426 /* harmony default export */ const library_media = (media); 36427 36428 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js 36429 /** 36430 * WordPress dependencies 36431 */ 36432 36433 36434 const post_post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36435 xmlns: "http://www.w3.org/2000/svg", 36436 viewBox: "0 0 24 24", 36437 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36438 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" 36439 }) 36440 }); 36441 /* harmony default export */ const library_post = (post_post); 36442 36443 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js 36444 /** 36445 * WordPress dependencies 36446 */ 36447 36448 36449 36450 36451 36452 36453 36454 36455 /** 36456 * Internal dependencies 36457 */ 36458 36459 const EMPTY_OBJECT = {}; 36460 36461 /** 36462 * @typedef IHasNameAndId 36463 * @property {string|number} id The entity's id. 36464 * @property {string} name The entity's name. 36465 */ 36466 36467 const utils_getValueFromObjectPath = (object, path) => { 36468 let value = object; 36469 path.split('.').forEach(fieldName => { 36470 value = value?.[fieldName]; 36471 }); 36472 return value; 36473 }; 36474 36475 /** 36476 * Helper util to map records to add a `name` prop from a 36477 * provided path, in order to handle all entities in the same 36478 * fashion(implementing`IHasNameAndId` interface). 36479 * 36480 * @param {Object[]} entities The array of entities. 36481 * @param {string} path The path to map a `name` property from the entity. 36482 * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface. 36483 */ 36484 const mapToIHasNameAndId = (entities, path) => { 36485 return (entities || []).map(entity => ({ 36486 ...entity, 36487 name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path)) 36488 })); 36489 }; 36490 36491 /** 36492 * @typedef {Object} EntitiesInfo 36493 * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..). 36494 * @property {number[]} existingEntitiesIds An array of the existing entities ids. 36495 */ 36496 36497 const useExistingTemplates = () => { 36498 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_POST_TYPE, { 36499 per_page: -1 36500 }), []); 36501 }; 36502 const useDefaultTemplateTypes = () => { 36503 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes(), []); 36504 }; 36505 const usePublicPostTypes = () => { 36506 const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({ 36507 per_page: -1 36508 }), []); 36509 return (0,external_wp_element_namespaceObject.useMemo)(() => { 36510 const excludedPostTypes = ['attachment']; 36511 return postTypes?.filter(({ 36512 viewable, 36513 slug 36514 }) => viewable && !excludedPostTypes.includes(slug)); 36515 }, [postTypes]); 36516 }; 36517 const usePublicTaxonomies = () => { 36518 const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 36519 per_page: -1 36520 }), []); 36521 return (0,external_wp_element_namespaceObject.useMemo)(() => { 36522 return taxonomies?.filter(({ 36523 visibility 36524 }) => visibility?.publicly_queryable); 36525 }, [taxonomies]); 36526 }; 36527 function usePostTypeArchiveMenuItems() { 36528 const publicPostTypes = usePublicPostTypes(); 36529 const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]); 36530 const existingTemplates = useExistingTemplates(); 36531 // We need to keep track of naming conflicts. If a conflict 36532 // occurs, we need to add slug. 36533 const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 36534 labels 36535 }) => { 36536 const singularName = labels.singular_name.toLowerCase(); 36537 accumulator[singularName] = (accumulator[singularName] || 0) + 1; 36538 return accumulator; 36539 }, {}), [publicPostTypes]); 36540 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 36541 labels, 36542 slug 36543 }) => { 36544 const singularName = labels.singular_name.toLowerCase(); 36545 return postTypeLabels[singularName] > 1 && singularName !== slug; 36546 }, [postTypeLabels]); 36547 return (0,external_wp_element_namespaceObject.useMemo)(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => { 36548 let title; 36549 if (needsUniqueIdentifier(postType)) { 36550 title = (0,external_wp_i18n_namespaceObject.sprintf)( 36551 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 36552 (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug); 36553 } else { 36554 title = (0,external_wp_i18n_namespaceObject.sprintf)( 36555 // translators: %s: Name of the post type e.g: "Post". 36556 (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name); 36557 } 36558 return { 36559 slug: 'archive-' + postType.slug, 36560 description: (0,external_wp_i18n_namespaceObject.sprintf)( 36561 // translators: %s: Name of the post type e.g: "Post". 36562 (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name), 36563 title, 36564 // `icon` is the `menu_icon` property of a post type. We 36565 // only handle `dashicons` for now, even if the `menu_icon` 36566 // also supports urls and svg as values. 36567 icon: typeof postType.icon === 'string' && postType.icon.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive, 36568 templatePrefix: 'archive' 36569 }; 36570 }) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]); 36571 } 36572 const usePostTypeMenuItems = onClickMenuItem => { 36573 const publicPostTypes = usePublicPostTypes(); 36574 const existingTemplates = useExistingTemplates(); 36575 const defaultTemplateTypes = useDefaultTemplateTypes(); 36576 // We need to keep track of naming conflicts. If a conflict 36577 // occurs, we need to add slug. 36578 const templateLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 36579 labels 36580 }) => { 36581 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36582 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 36583 return accumulator; 36584 }, {}), [publicPostTypes]); 36585 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 36586 labels, 36587 slug 36588 }) => { 36589 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36590 return templateLabels[templateName] > 1 && templateName !== slug; 36591 }, [templateLabels]); 36592 36593 // `page`is a special case in template hierarchy. 36594 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 36595 slug 36596 }) => { 36597 let suffix = slug; 36598 if (slug !== 'page') { 36599 suffix = `single-$suffix}`; 36600 } 36601 accumulator[slug] = suffix; 36602 return accumulator; 36603 }, {}), [publicPostTypes]); 36604 const postTypesInfo = useEntitiesInfo('postType', templatePrefixes); 36605 const existingTemplateSlugs = (existingTemplates || []).map(({ 36606 slug 36607 }) => slug); 36608 const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => { 36609 const { 36610 slug, 36611 labels, 36612 icon 36613 } = postType; 36614 // We need to check if the general template is part of the 36615 // defaultTemplateTypes. If it is, just use that info and 36616 // augment it with the specific template functionality. 36617 const generalTemplateSlug = templatePrefixes[slug]; 36618 const defaultTemplateType = defaultTemplateTypes?.find(({ 36619 slug: _slug 36620 }) => _slug === generalTemplateSlug); 36621 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 36622 const _needsUniqueIdentifier = needsUniqueIdentifier(postType); 36623 let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)( 36624 // translators: %s: Name of the post type e.g: "Post". 36625 (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name); 36626 if (_needsUniqueIdentifier) { 36627 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 36628 // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book". 36629 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'post type menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 36630 // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book". 36631 (0,external_wp_i18n_namespaceObject._x)('Single item: %1$s (%2$s)', 'post type menu label'), labels.singular_name, slug); 36632 } 36633 const menuItem = defaultTemplateType ? { 36634 ...defaultTemplateType, 36635 templatePrefix: templatePrefixes[slug] 36636 } : { 36637 slug: generalTemplateSlug, 36638 title: menuItemTitle, 36639 description: (0,external_wp_i18n_namespaceObject.sprintf)( 36640 // translators: %s: Name of the post type e.g: "Post". 36641 (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name), 36642 // `icon` is the `menu_icon` property of a post type. We 36643 // only handle `dashicons` for now, even if the `menu_icon` 36644 // also supports urls and svg as values. 36645 icon: typeof icon === 'string' && icon.startsWith('dashicons-') ? icon.slice(10) : library_post, 36646 templatePrefix: templatePrefixes[slug] 36647 }; 36648 const hasEntities = postTypesInfo?.[slug]?.hasEntities; 36649 // We have a different template creation flow only if they have entities. 36650 if (hasEntities) { 36651 menuItem.onClick = template => { 36652 onClickMenuItem({ 36653 type: 'postType', 36654 slug, 36655 config: { 36656 recordNamePath: 'title.rendered', 36657 queryArgs: ({ 36658 search 36659 }) => { 36660 return { 36661 _fields: 'id,title,slug,link', 36662 orderBy: search ? 'relevance' : 'modified', 36663 exclude: postTypesInfo[slug].existingEntitiesIds 36664 }; 36665 }, 36666 getSpecificTemplate: suggestion => { 36667 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 36668 return { 36669 title: templateSlug, 36670 slug: templateSlug, 36671 templatePrefix: templatePrefixes[slug] 36672 }; 36673 } 36674 }, 36675 labels, 36676 hasGeneralTemplate, 36677 template 36678 }); 36679 }; 36680 } 36681 // We don't need to add the menu item if there are no 36682 // entities and the general template exists. 36683 if (!hasGeneralTemplate || hasEntities) { 36684 accumulator.push(menuItem); 36685 } 36686 return accumulator; 36687 }, []); 36688 // Split menu items into two groups: one for the default post types 36689 // and one for the rest. 36690 const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => { 36691 const { 36692 slug 36693 } = postType; 36694 let key = 'postTypesMenuItems'; 36695 if (slug === 'page') { 36696 key = 'defaultPostTypesMenuItems'; 36697 } 36698 accumulator[key].push(postType); 36699 return accumulator; 36700 }, { 36701 defaultPostTypesMenuItems: [], 36702 postTypesMenuItems: [] 36703 }), [menuItems]); 36704 return postTypesMenuItems; 36705 }; 36706 const useTaxonomiesMenuItems = onClickMenuItem => { 36707 const publicTaxonomies = usePublicTaxonomies(); 36708 const existingTemplates = useExistingTemplates(); 36709 const defaultTemplateTypes = useDefaultTemplateTypes(); 36710 // `category` and `post_tag` are special cases in template hierarchy. 36711 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies?.reduce((accumulator, { 36712 slug 36713 }) => { 36714 let suffix = slug; 36715 if (!['category', 'post_tag'].includes(slug)) { 36716 suffix = `taxonomy-$suffix}`; 36717 } 36718 if (slug === 'post_tag') { 36719 suffix = `tag`; 36720 } 36721 accumulator[slug] = suffix; 36722 return accumulator; 36723 }, {}), [publicTaxonomies]); 36724 // We need to keep track of naming conflicts. If a conflict 36725 // occurs, we need to add slug. 36726 const taxonomyLabels = publicTaxonomies?.reduce((accumulator, { 36727 labels 36728 }) => { 36729 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36730 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 36731 return accumulator; 36732 }, {}); 36733 const needsUniqueIdentifier = (labels, slug) => { 36734 if (['category', 'post_tag'].includes(slug)) { 36735 return false; 36736 } 36737 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 36738 return taxonomyLabels[templateName] > 1 && templateName !== slug; 36739 }; 36740 const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes); 36741 const existingTemplateSlugs = (existingTemplates || []).map(({ 36742 slug 36743 }) => slug); 36744 const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => { 36745 const { 36746 slug, 36747 labels 36748 } = taxonomy; 36749 // We need to check if the general template is part of the 36750 // defaultTemplateTypes. If it is, just use that info and 36751 // augment it with the specific template functionality. 36752 const generalTemplateSlug = templatePrefixes[slug]; 36753 const defaultTemplateType = defaultTemplateTypes?.find(({ 36754 slug: _slug 36755 }) => _slug === generalTemplateSlug); 36756 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 36757 const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug); 36758 let menuItemTitle = labels.template_name || labels.singular_name; 36759 if (_needsUniqueIdentifier) { 36760 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 36761 // translators: 1: Name of the template e.g: "Products by Category". 2s: Slug of the taxonomy e.g: "product_cat". 36762 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy template menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 36763 // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat". 36764 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy menu label'), labels.singular_name, slug); 36765 } 36766 const menuItem = defaultTemplateType ? { 36767 ...defaultTemplateType, 36768 templatePrefix: templatePrefixes[slug] 36769 } : { 36770 slug: generalTemplateSlug, 36771 title: menuItemTitle, 36772 description: (0,external_wp_i18n_namespaceObject.sprintf)( 36773 // translators: %s: Name of the taxonomy e.g: "Product Categories". 36774 (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name), 36775 icon: block_meta, 36776 templatePrefix: templatePrefixes[slug] 36777 }; 36778 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; 36779 // We have a different template creation flow only if they have entities. 36780 if (hasEntities) { 36781 menuItem.onClick = template => { 36782 onClickMenuItem({ 36783 type: 'taxonomy', 36784 slug, 36785 config: { 36786 queryArgs: ({ 36787 search 36788 }) => { 36789 return { 36790 _fields: 'id,name,slug,link', 36791 orderBy: search ? 'name' : 'count', 36792 exclude: taxonomiesInfo[slug].existingEntitiesIds 36793 }; 36794 }, 36795 getSpecificTemplate: suggestion => { 36796 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 36797 return { 36798 title: templateSlug, 36799 slug: templateSlug, 36800 templatePrefix: templatePrefixes[slug] 36801 }; 36802 } 36803 }, 36804 labels, 36805 hasGeneralTemplate, 36806 template 36807 }); 36808 }; 36809 } 36810 // We don't need to add the menu item if there are no 36811 // entities and the general template exists. 36812 if (!hasGeneralTemplate || hasEntities) { 36813 accumulator.push(menuItem); 36814 } 36815 return accumulator; 36816 }, []); 36817 // Split menu items into two groups: one for the default taxonomies 36818 // and one for the rest. 36819 const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => { 36820 const { 36821 slug 36822 } = taxonomy; 36823 let key = 'taxonomiesMenuItems'; 36824 if (['category', 'tag'].includes(slug)) { 36825 key = 'defaultTaxonomiesMenuItems'; 36826 } 36827 accumulator[key].push(taxonomy); 36828 return accumulator; 36829 }, { 36830 defaultTaxonomiesMenuItems: [], 36831 taxonomiesMenuItems: [] 36832 }), [menuItems]); 36833 return taxonomiesMenuItems; 36834 }; 36835 const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { 36836 user: 'author' 36837 }; 36838 const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { 36839 user: { 36840 who: 'authors' 36841 } 36842 }; 36843 function useAuthorMenuItem(onClickMenuItem) { 36844 const existingTemplates = useExistingTemplates(); 36845 const defaultTemplateTypes = useDefaultTemplateTypes(); 36846 const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS); 36847 let authorMenuItem = defaultTemplateTypes?.find(({ 36848 slug 36849 }) => slug === 'author'); 36850 if (!authorMenuItem) { 36851 authorMenuItem = { 36852 description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'), 36853 slug: 'author', 36854 title: 'Author' 36855 }; 36856 } 36857 const hasGeneralTemplate = !!existingTemplates?.find(({ 36858 slug 36859 }) => slug === 'author'); 36860 if (authorInfo.user?.hasEntities) { 36861 authorMenuItem = { 36862 ...authorMenuItem, 36863 templatePrefix: 'author' 36864 }; 36865 authorMenuItem.onClick = template => { 36866 onClickMenuItem({ 36867 type: 'root', 36868 slug: 'user', 36869 config: { 36870 queryArgs: ({ 36871 search 36872 }) => { 36873 return { 36874 _fields: 'id,name,slug,link', 36875 orderBy: search ? 'name' : 'registered_date', 36876 exclude: authorInfo.user.existingEntitiesIds, 36877 who: 'authors' 36878 }; 36879 }, 36880 getSpecificTemplate: suggestion => { 36881 const templateSlug = `author-$suggestion.slug}`; 36882 return { 36883 title: templateSlug, 36884 slug: templateSlug, 36885 templatePrefix: 'author' 36886 }; 36887 } 36888 }, 36889 labels: { 36890 singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'), 36891 search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'), 36892 not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'), 36893 all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors') 36894 }, 36895 hasGeneralTemplate, 36896 template 36897 }); 36898 }; 36899 } 36900 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { 36901 return authorMenuItem; 36902 } 36903 } 36904 36905 /** 36906 * Helper hook that filters all the existing templates by the given 36907 * object with the entity's slug as key and the template prefix as value. 36908 * 36909 * Example: 36910 * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ] 36911 * `templatePrefixes` is: { post_tag: 'tag' } 36912 * It will return: { post_tag: ['apple'] } 36913 * 36914 * Note: We append the `-` to the given template prefix in this function for our checks. 36915 * 36916 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 36917 * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value. 36918 */ 36919 const useExistingTemplateSlugs = templatePrefixes => { 36920 const existingTemplates = useExistingTemplates(); 36921 const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => { 36922 return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => { 36923 const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => { 36924 const _prefix = `$prefix}-`; 36925 if (existingTemplate.slug.startsWith(_prefix)) { 36926 _accumulator.push(existingTemplate.slug.substring(_prefix.length)); 36927 } 36928 return _accumulator; 36929 }, []); 36930 if (slugsWithTemplates.length) { 36931 accumulator[slug] = slugsWithTemplates; 36932 } 36933 return accumulator; 36934 }, {}); 36935 }, [templatePrefixes, existingTemplates]); 36936 return existingSlugs; 36937 }; 36938 36939 /** 36940 * Helper hook that finds the existing records with an associated template, 36941 * as they need to be excluded from the template suggestions. 36942 * 36943 * @param {string} entityName The entity's name. 36944 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 36945 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 36946 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value. 36947 */ 36948 const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => { 36949 const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes); 36950 const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => { 36951 return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, [slug, slugsWithTemplates]) => { 36952 const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 36953 _fields: 'id', 36954 context: 'view', 36955 slug: slugsWithTemplates, 36956 ...additionalQueryParameters[slug] 36957 }); 36958 if (entitiesWithTemplates?.length) { 36959 accumulator[slug] = entitiesWithTemplates; 36960 } 36961 return accumulator; 36962 }, {}); 36963 }, [slugsToExcludePerEntity]); 36964 return recordsToExcludePerEntity; 36965 }; 36966 36967 /** 36968 * Helper hook that returns information about an entity having 36969 * records that we can create a specific template for. 36970 * 36971 * For example we can search for `terms` in `taxonomy` entity or 36972 * `posts` in `postType` entity. 36973 * 36974 * First we need to find the existing records with an associated template, 36975 * to query afterwards for any remaining record, by excluding them. 36976 * 36977 * @param {string} entityName The entity's name. 36978 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 36979 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 36980 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value. 36981 */ 36982 const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => { 36983 const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters); 36984 const entitiesHasRecords = (0,external_wp_data_namespaceObject.useSelect)(select => { 36985 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 36986 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 36987 id 36988 }) => id) || []; 36989 accumulator[slug] = !!select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 36990 per_page: 1, 36991 _fields: 'id', 36992 context: 'view', 36993 exclude: existingEntitiesIds, 36994 ...additionalQueryParameters[slug] 36995 })?.length; 36996 return accumulator; 36997 }, {}); 36998 }, [templatePrefixes, recordsToExcludePerEntity, entityName, additionalQueryParameters]); 36999 const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => { 37000 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 37001 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 37002 id 37003 }) => id) || []; 37004 accumulator[slug] = { 37005 hasEntities: entitiesHasRecords[slug], 37006 existingEntitiesIds 37007 }; 37008 return accumulator; 37009 }, {}); 37010 }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]); 37011 return entitiesInfo; 37012 }; 37013 37014 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js 37015 /** 37016 * WordPress dependencies 37017 */ 37018 37019 37020 37021 37022 37023 37024 37025 /** 37026 * Internal dependencies 37027 */ 37028 37029 37030 37031 37032 const add_custom_template_modal_content_EMPTY_ARRAY = []; 37033 function SuggestionListItem({ 37034 suggestion, 37035 search, 37036 onSelect, 37037 entityForSuggestions 37038 }) { 37039 const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item'; 37040 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 37041 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37042 __next40pxDefaultSize: true, 37043 role: "option", 37044 className: baseCssClass, 37045 onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion)) 37046 }), 37047 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37048 size: "body", 37049 lineHeight: 1.53846153846 // 20px 37050 , 37051 weight: 500, 37052 className: `$baseCssClass}__title`, 37053 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight, { 37054 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name), 37055 highlight: search 37056 }) 37057 }), suggestion.link && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37058 size: "body", 37059 lineHeight: 1.53846153846 // 20px 37060 , 37061 className: `$baseCssClass}__info`, 37062 children: suggestion.link 37063 })] 37064 }); 37065 } 37066 function useSearchSuggestions(entityForSuggestions, search) { 37067 const { 37068 config 37069 } = entityForSuggestions; 37070 const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 37071 order: 'asc', 37072 context: 'view', 37073 search, 37074 per_page: search ? 20 : 10, 37075 ...config.queryArgs(search) 37076 }), [search, config]); 37077 const { 37078 records: searchResults, 37079 hasResolved: searchHasResolved 37080 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query); 37081 const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(add_custom_template_modal_content_EMPTY_ARRAY); 37082 (0,external_wp_element_namespaceObject.useEffect)(() => { 37083 if (!searchHasResolved) { 37084 return; 37085 } 37086 let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY; 37087 if (searchResults?.length) { 37088 newSuggestions = searchResults; 37089 if (config.recordNamePath) { 37090 newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath); 37091 } 37092 } 37093 // Update suggestions only when the query has resolved, so as to keep 37094 // the previous results in the UI. 37095 setSuggestions(newSuggestions); 37096 }, [searchResults, searchHasResolved]); 37097 return suggestions; 37098 } 37099 function SuggestionList({ 37100 entityForSuggestions, 37101 onSelect 37102 }) { 37103 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); 37104 const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch); 37105 const { 37106 labels 37107 } = entityForSuggestions; 37108 const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false); 37109 if (!showSearchControl && suggestions?.length > 9) { 37110 setShowSearchControl(true); 37111 } 37112 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37113 children: [showSearchControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 37114 __nextHasNoMarginBottom: true, 37115 onChange: setSearch, 37116 value: search, 37117 label: labels.search_items, 37118 placeholder: labels.search_items 37119 }), !!suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 37120 orientation: "vertical", 37121 role: "listbox", 37122 className: "edit-site-custom-template-modal__suggestions_list", 37123 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list'), 37124 children: suggestions.map(suggestion => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionListItem, { 37125 suggestion: suggestion, 37126 search: debouncedSearch, 37127 onSelect: onSelect, 37128 entityForSuggestions: entityForSuggestions 37129 }, suggestion.slug)) 37130 }), debouncedSearch && !suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37131 as: "p", 37132 className: "edit-site-custom-template-modal__no-results", 37133 children: labels.not_found 37134 })] 37135 }); 37136 } 37137 function AddCustomTemplateModalContent({ 37138 onSelect, 37139 entityForSuggestions 37140 }) { 37141 const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate); 37142 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37143 spacing: 4, 37144 className: "edit-site-custom-template-modal__contents-wrapper", 37145 alignment: "left", 37146 children: [!showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37147 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37148 as: "p", 37149 children: (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.') 37150 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 37151 className: "edit-site-custom-template-modal__contents", 37152 gap: "4", 37153 align: "initial", 37154 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 37155 isBlock: true, 37156 as: external_wp_components_namespaceObject.Button, 37157 onClick: () => { 37158 const { 37159 slug, 37160 title, 37161 description, 37162 templatePrefix 37163 } = entityForSuggestions.template; 37164 onSelect({ 37165 slug, 37166 title, 37167 description, 37168 templatePrefix 37169 }); 37170 }, 37171 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37172 as: "span", 37173 weight: 500, 37174 lineHeight: 1.53846153846 // 20px 37175 , 37176 children: entityForSuggestions.labels.all_items 37177 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37178 as: "span", 37179 lineHeight: 1.53846153846 // 20px 37180 , 37181 children: 37182 // 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. 37183 (0,external_wp_i18n_namespaceObject.__)('For all items') 37184 })] 37185 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 37186 isBlock: true, 37187 as: external_wp_components_namespaceObject.Button, 37188 onClick: () => { 37189 setShowSearchEntities(true); 37190 }, 37191 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37192 as: "span", 37193 weight: 500, 37194 lineHeight: 1.53846153846 // 20px 37195 , 37196 children: entityForSuggestions.labels.singular_name 37197 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37198 as: "span", 37199 lineHeight: 1.53846153846 // 20px 37200 , 37201 children: 37202 // 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. 37203 (0,external_wp_i18n_namespaceObject.__)('For a specific item') 37204 })] 37205 })] 37206 })] 37207 }), showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37208 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37209 as: "p", 37210 children: (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.') 37211 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionList, { 37212 entityForSuggestions: entityForSuggestions, 37213 onSelect: onSelect 37214 })] 37215 })] 37216 }); 37217 } 37218 /* harmony default export */ const add_custom_template_modal_content = (AddCustomTemplateModalContent); 37219 37220 ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs 37221 /****************************************************************************** 37222 Copyright (c) Microsoft Corporation. 37223 37224 Permission to use, copy, modify, and/or distribute this software for any 37225 purpose with or without fee is hereby granted. 37226 37227 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 37228 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 37229 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 37230 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 37231 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 37232 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 37233 PERFORMANCE OF THIS SOFTWARE. 37234 ***************************************************************************** */ 37235 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 37236 37237 var extendStatics = function(d, b) { 37238 extendStatics = Object.setPrototypeOf || 37239 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 37240 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 37241 return extendStatics(d, b); 37242 }; 37243 37244 function __extends(d, b) { 37245 if (typeof b !== "function" && b !== null) 37246 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 37247 extendStatics(d, b); 37248 function __() { this.constructor = d; } 37249 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 37250 } 37251 37252 var __assign = function() { 37253 __assign = Object.assign || function __assign(t) { 37254 for (var s, i = 1, n = arguments.length; i < n; i++) { 37255 s = arguments[i]; 37256 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 37257 } 37258 return t; 37259 } 37260 return __assign.apply(this, arguments); 37261 } 37262 37263 function __rest(s, e) { 37264 var t = {}; 37265 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 37266 t[p] = s[p]; 37267 if (s != null && typeof Object.getOwnPropertySymbols === "function") 37268 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 37269 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 37270 t[p[i]] = s[p[i]]; 37271 } 37272 return t; 37273 } 37274 37275 function __decorate(decorators, target, key, desc) { 37276 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 37277 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 37278 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; 37279 return c > 3 && r && Object.defineProperty(target, key, r), r; 37280 } 37281 37282 function __param(paramIndex, decorator) { 37283 return function (target, key) { decorator(target, key, paramIndex); } 37284 } 37285 37286 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 37287 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 37288 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 37289 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 37290 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 37291 var _, done = false; 37292 for (var i = decorators.length - 1; i >= 0; i--) { 37293 var context = {}; 37294 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 37295 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 37296 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 37297 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 37298 if (kind === "accessor") { 37299 if (result === void 0) continue; 37300 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 37301 if (_ = accept(result.get)) descriptor.get = _; 37302 if (_ = accept(result.set)) descriptor.set = _; 37303 if (_ = accept(result.init)) initializers.unshift(_); 37304 } 37305 else if (_ = accept(result)) { 37306 if (kind === "field") initializers.unshift(_); 37307 else descriptor[key] = _; 37308 } 37309 } 37310 if (target) Object.defineProperty(target, contextIn.name, descriptor); 37311 done = true; 37312 }; 37313 37314 function __runInitializers(thisArg, initializers, value) { 37315 var useValue = arguments.length > 2; 37316 for (var i = 0; i < initializers.length; i++) { 37317 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 37318 } 37319 return useValue ? value : void 0; 37320 }; 37321 37322 function __propKey(x) { 37323 return typeof x === "symbol" ? x : "".concat(x); 37324 }; 37325 37326 function __setFunctionName(f, name, prefix) { 37327 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 37328 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 37329 }; 37330 37331 function __metadata(metadataKey, metadataValue) { 37332 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 37333 } 37334 37335 function __awaiter(thisArg, _arguments, P, generator) { 37336 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 37337 return new (P || (P = Promise))(function (resolve, reject) { 37338 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 37339 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 37340 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 37341 step((generator = generator.apply(thisArg, _arguments || [])).next()); 37342 }); 37343 } 37344 37345 function __generator(thisArg, body) { 37346 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); 37347 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 37348 function verb(n) { return function (v) { return step([n, v]); }; } 37349 function step(op) { 37350 if (f) throw new TypeError("Generator is already executing."); 37351 while (g && (g = 0, op[0] && (_ = 0)), _) try { 37352 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; 37353 if (y = 0, t) op = [op[0] & 2, t.value]; 37354 switch (op[0]) { 37355 case 0: case 1: t = op; break; 37356 case 4: _.label++; return { value: op[1], done: false }; 37357 case 5: _.label++; y = op[1]; op = [0]; continue; 37358 case 7: op = _.ops.pop(); _.trys.pop(); continue; 37359 default: 37360 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 37361 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 37362 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 37363 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 37364 if (t[2]) _.ops.pop(); 37365 _.trys.pop(); continue; 37366 } 37367 op = body.call(thisArg, _); 37368 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 37369 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 37370 } 37371 } 37372 37373 var __createBinding = Object.create ? (function(o, m, k, k2) { 37374 if (k2 === undefined) k2 = k; 37375 var desc = Object.getOwnPropertyDescriptor(m, k); 37376 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 37377 desc = { enumerable: true, get: function() { return m[k]; } }; 37378 } 37379 Object.defineProperty(o, k2, desc); 37380 }) : (function(o, m, k, k2) { 37381 if (k2 === undefined) k2 = k; 37382 o[k2] = m[k]; 37383 }); 37384 37385 function __exportStar(m, o) { 37386 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 37387 } 37388 37389 function __values(o) { 37390 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 37391 if (m) return m.call(o); 37392 if (o && typeof o.length === "number") return { 37393 next: function () { 37394 if (o && i >= o.length) o = void 0; 37395 return { value: o && o[i++], done: !o }; 37396 } 37397 }; 37398 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 37399 } 37400 37401 function __read(o, n) { 37402 var m = typeof Symbol === "function" && o[Symbol.iterator]; 37403 if (!m) return o; 37404 var i = m.call(o), r, ar = [], e; 37405 try { 37406 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 37407 } 37408 catch (error) { e = { error: error }; } 37409 finally { 37410 try { 37411 if (r && !r.done && (m = i["return"])) m.call(i); 37412 } 37413 finally { if (e) throw e.error; } 37414 } 37415 return ar; 37416 } 37417 37418 /** @deprecated */ 37419 function __spread() { 37420 for (var ar = [], i = 0; i < arguments.length; i++) 37421 ar = ar.concat(__read(arguments[i])); 37422 return ar; 37423 } 37424 37425 /** @deprecated */ 37426 function __spreadArrays() { 37427 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 37428 for (var r = Array(s), k = 0, i = 0; i < il; i++) 37429 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 37430 r[k] = a[j]; 37431 return r; 37432 } 37433 37434 function __spreadArray(to, from, pack) { 37435 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 37436 if (ar || !(i in from)) { 37437 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 37438 ar[i] = from[i]; 37439 } 37440 } 37441 return to.concat(ar || Array.prototype.slice.call(from)); 37442 } 37443 37444 function __await(v) { 37445 return this instanceof __await ? (this.v = v, this) : new __await(v); 37446 } 37447 37448 function __asyncGenerator(thisArg, _arguments, generator) { 37449 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 37450 var g = generator.apply(thisArg, _arguments || []), i, q = []; 37451 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 37452 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 37453 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]); } } 37454 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 37455 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 37456 function fulfill(value) { resume("next", value); } 37457 function reject(value) { resume("throw", value); } 37458 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 37459 } 37460 37461 function __asyncDelegator(o) { 37462 var i, p; 37463 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 37464 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; } 37465 } 37466 37467 function __asyncValues(o) { 37468 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 37469 var m = o[Symbol.asyncIterator], i; 37470 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); 37471 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); }); }; } 37472 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 37473 } 37474 37475 function __makeTemplateObject(cooked, raw) { 37476 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 37477 return cooked; 37478 }; 37479 37480 var __setModuleDefault = Object.create ? (function(o, v) { 37481 Object.defineProperty(o, "default", { enumerable: true, value: v }); 37482 }) : function(o, v) { 37483 o["default"] = v; 37484 }; 37485 37486 function __importStar(mod) { 37487 if (mod && mod.__esModule) return mod; 37488 var result = {}; 37489 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 37490 __setModuleDefault(result, mod); 37491 return result; 37492 } 37493 37494 function __importDefault(mod) { 37495 return (mod && mod.__esModule) ? mod : { default: mod }; 37496 } 37497 37498 function __classPrivateFieldGet(receiver, state, kind, f) { 37499 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 37500 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"); 37501 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 37502 } 37503 37504 function __classPrivateFieldSet(receiver, state, value, kind, f) { 37505 if (kind === "m") throw new TypeError("Private method is not writable"); 37506 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 37507 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"); 37508 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 37509 } 37510 37511 function __classPrivateFieldIn(state, receiver) { 37512 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 37513 return typeof state === "function" ? receiver === state : state.has(receiver); 37514 } 37515 37516 function __addDisposableResource(env, value, async) { 37517 if (value !== null && value !== void 0) { 37518 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 37519 var dispose, inner; 37520 if (async) { 37521 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 37522 dispose = value[Symbol.asyncDispose]; 37523 } 37524 if (dispose === void 0) { 37525 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 37526 dispose = value[Symbol.dispose]; 37527 if (async) inner = dispose; 37528 } 37529 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 37530 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 37531 env.stack.push({ value: value, dispose: dispose, async: async }); 37532 } 37533 else if (async) { 37534 env.stack.push({ async: true }); 37535 } 37536 return value; 37537 } 37538 37539 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 37540 var e = new Error(message); 37541 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 37542 }; 37543 37544 function __disposeResources(env) { 37545 function fail(e) { 37546 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 37547 env.hasError = true; 37548 } 37549 var r, s = 0; 37550 function next() { 37551 while (r = env.stack.pop()) { 37552 try { 37553 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 37554 if (r.dispose) { 37555 var result = r.dispose.call(r.value); 37556 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 37557 } 37558 else s |= 1; 37559 } 37560 catch (e) { 37561 fail(e); 37562 } 37563 } 37564 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 37565 if (env.hasError) throw env.error; 37566 } 37567 return next(); 37568 } 37569 37570 /* harmony default export */ const tslib_es6 = ({ 37571 __extends, 37572 __assign, 37573 __rest, 37574 __decorate, 37575 __param, 37576 __metadata, 37577 __awaiter, 37578 __generator, 37579 __createBinding, 37580 __exportStar, 37581 __values, 37582 __read, 37583 __spread, 37584 __spreadArrays, 37585 __spreadArray, 37586 __await, 37587 __asyncGenerator, 37588 __asyncDelegator, 37589 __asyncValues, 37590 __makeTemplateObject, 37591 __importStar, 37592 __importDefault, 37593 __classPrivateFieldGet, 37594 __classPrivateFieldSet, 37595 __classPrivateFieldIn, 37596 __addDisposableResource, 37597 __disposeResources, 37598 }); 37599 37600 ;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js 37601 /** 37602 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 37603 */ 37604 var SUPPORTED_LOCALE = { 37605 tr: { 37606 regexp: /\u0130|\u0049|\u0049\u0307/g, 37607 map: { 37608 İ: "\u0069", 37609 I: "\u0131", 37610 İ: "\u0069", 37611 }, 37612 }, 37613 az: { 37614 regexp: /\u0130/g, 37615 map: { 37616 İ: "\u0069", 37617 I: "\u0131", 37618 İ: "\u0069", 37619 }, 37620 }, 37621 lt: { 37622 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 37623 map: { 37624 I: "\u0069\u0307", 37625 J: "\u006A\u0307", 37626 Į: "\u012F\u0307", 37627 Ì: "\u0069\u0307\u0300", 37628 Í: "\u0069\u0307\u0301", 37629 Ĩ: "\u0069\u0307\u0303", 37630 }, 37631 }, 37632 }; 37633 /** 37634 * Localized lower case. 37635 */ 37636 function localeLowerCase(str, locale) { 37637 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 37638 if (lang) 37639 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 37640 return lowerCase(str); 37641 } 37642 /** 37643 * Lower case as a function. 37644 */ 37645 function lowerCase(str) { 37646 return str.toLowerCase(); 37647 } 37648 37649 ;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js 37650 37651 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 37652 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 37653 // Remove all non-word characters. 37654 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 37655 /** 37656 * Normalize the string into something other libraries can manipulate easier. 37657 */ 37658 function noCase(input, options) { 37659 if (options === void 0) { options = {}; } 37660 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; 37661 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 37662 var start = 0; 37663 var end = result.length; 37664 // Trim the delimiter from around the output string. 37665 while (result.charAt(start) === "\0") 37666 start++; 37667 while (result.charAt(end - 1) === "\0") 37668 end--; 37669 // Transform each token independently. 37670 return result.slice(start, end).split("\0").map(transform).join(delimiter); 37671 } 37672 /** 37673 * Replace `re` in the input string with the replacement value. 37674 */ 37675 function replace(input, re, value) { 37676 if (re instanceof RegExp) 37677 return input.replace(re, value); 37678 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 37679 } 37680 37681 ;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js 37682 37683 37684 function dotCase(input, options) { 37685 if (options === void 0) { options = {}; } 37686 return noCase(input, __assign({ delimiter: "." }, options)); 37687 } 37688 37689 ;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js 37690 37691 37692 function paramCase(input, options) { 37693 if (options === void 0) { options = {}; } 37694 return dotCase(input, __assign({ delimiter: "-" }, options)); 37695 } 37696 37697 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js 37698 /** 37699 * External dependencies 37700 */ 37701 37702 37703 /** 37704 * WordPress dependencies 37705 */ 37706 37707 37708 37709 37710 37711 function AddCustomGenericTemplateModalContent({ 37712 onClose, 37713 createTemplate 37714 }) { 37715 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 37716 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); 37717 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 37718 async function onCreateTemplate(event) { 37719 event.preventDefault(); 37720 if (isBusy) { 37721 return; 37722 } 37723 setIsBusy(true); 37724 try { 37725 await createTemplate({ 37726 slug: 'wp-custom-template-' + paramCase(title || defaultTitle), 37727 title: title || defaultTitle 37728 }, false); 37729 } finally { 37730 setIsBusy(false); 37731 } 37732 } 37733 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 37734 onSubmit: onCreateTemplate, 37735 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37736 spacing: 6, 37737 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 37738 __next40pxDefaultSize: true, 37739 __nextHasNoMarginBottom: true, 37740 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 37741 value: title, 37742 onChange: setTitle, 37743 placeholder: defaultTitle, 37744 disabled: isBusy, 37745 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.') 37746 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37747 className: "edit-site-custom-generic-template__modal-actions", 37748 justify: "right", 37749 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37750 __next40pxDefaultSize: true, 37751 variant: "tertiary", 37752 onClick: () => { 37753 onClose(); 37754 }, 37755 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 37756 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37757 __next40pxDefaultSize: true, 37758 variant: "primary", 37759 type: "submit", 37760 isBusy: isBusy, 37761 "aria-disabled": isBusy, 37762 children: (0,external_wp_i18n_namespaceObject.__)('Create') 37763 })] 37764 })] 37765 }) 37766 }); 37767 } 37768 /* harmony default export */ const add_custom_generic_template_modal_content = (AddCustomGenericTemplateModalContent); 37769 37770 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js 37771 /** 37772 * External dependencies 37773 */ 37774 37775 37776 /** 37777 * WordPress dependencies 37778 */ 37779 37780 37781 37782 37783 37784 37785 37786 37787 37788 37789 37790 /** 37791 * Internal dependencies 37792 */ 37793 37794 37795 /** 37796 * Internal dependencies 37797 */ 37798 37799 37800 37801 37802 37803 37804 37805 const { 37806 useHistory: add_new_template_useHistory 37807 } = unlock(external_wp_router_namespaceObject.privateApis); 37808 const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'search', '404']; 37809 const TEMPLATE_ICONS = { 37810 'front-page': library_home, 37811 home: library_verse, 37812 single: library_pin, 37813 page: library_page, 37814 archive: library_archive, 37815 search: library_search, 37816 404: not_found, 37817 index: library_list, 37818 category: library_category, 37819 author: comment_author_avatar, 37820 taxonomy: block_meta, 37821 date: library_calendar, 37822 tag: library_tag, 37823 attachment: library_media 37824 }; 37825 function TemplateListItem({ 37826 title, 37827 direction, 37828 className, 37829 description, 37830 icon, 37831 onClick, 37832 children 37833 }) { 37834 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 37835 __next40pxDefaultSize: true, 37836 className: className, 37837 onClick: onClick, 37838 label: description, 37839 showTooltip: !!description, 37840 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 37841 as: "span", 37842 spacing: 2, 37843 align: "center", 37844 justify: "center", 37845 style: { 37846 width: '100%' 37847 }, 37848 direction: direction, 37849 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37850 className: "edit-site-add-new-template__template-icon", 37851 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 37852 icon: icon 37853 }) 37854 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37855 className: "edit-site-add-new-template__template-name", 37856 alignment: "center", 37857 spacing: 0, 37858 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37859 align: "center", 37860 weight: 500, 37861 lineHeight: 1.53846153846 // 20px 37862 , 37863 children: title 37864 }), children] 37865 })] 37866 }) 37867 }); 37868 } 37869 const modalContentMap = { 37870 templatesList: 1, 37871 customTemplate: 2, 37872 customGenericTemplate: 3 37873 }; 37874 function NewTemplateModal({ 37875 onClose 37876 }) { 37877 const [modalContent, setModalContent] = (0,external_wp_element_namespaceObject.useState)(modalContentMap.templatesList); 37878 const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({}); 37879 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 37880 const missingTemplates = useMissingTemplates(setEntityForSuggestions, () => setModalContent(modalContentMap.customTemplate)); 37881 const history = add_new_template_useHistory(); 37882 const { 37883 saveEntityRecord 37884 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 37885 const { 37886 createErrorNotice, 37887 createSuccessNotice 37888 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 37889 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 37890 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 37891 // Site index. 37892 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 37893 }, []); 37894 const TEMPLATE_SHORT_DESCRIPTIONS = { 37895 'front-page': homeUrl, 37896 date: (0,external_wp_i18n_namespaceObject.sprintf)( 37897 // translators: %s: The homepage url. 37898 (0,external_wp_i18n_namespaceObject.__)('E.g. %s'), homeUrl + '/' + new Date().getFullYear()) 37899 }; 37900 async function createTemplate(template, isWPSuggestion = true) { 37901 if (isSubmitting) { 37902 return; 37903 } 37904 setIsSubmitting(true); 37905 try { 37906 const { 37907 title, 37908 description, 37909 slug 37910 } = template; 37911 const newTemplate = await saveEntityRecord('postType', TEMPLATE_POST_TYPE, { 37912 description, 37913 // Slugs need to be strings, so this is for template `404` 37914 slug: slug.toString(), 37915 status: 'publish', 37916 title, 37917 // This adds a post meta field in template that is part of `is_custom` value calculation. 37918 is_wp_suggestion: isWPSuggestion 37919 }, { 37920 throwOnError: true 37921 }); 37922 37923 // Navigate to the created template editor. 37924 history.push({ 37925 postId: newTemplate.id, 37926 postType: TEMPLATE_POST_TYPE, 37927 canvas: 'edit' 37928 }); 37929 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 37930 // translators: %s: Title of the created post or template, e.g: "Hello world". 37931 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title)), { 37932 type: 'snackbar' 37933 }); 37934 } catch (error) { 37935 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); 37936 createErrorNotice(errorMessage, { 37937 type: 'snackbar' 37938 }); 37939 } finally { 37940 setIsSubmitting(false); 37941 } 37942 } 37943 const onModalClose = () => { 37944 onClose(); 37945 setModalContent(modalContentMap.templatesList); 37946 }; 37947 let modalTitle = (0,external_wp_i18n_namespaceObject.__)('Add template'); 37948 if (modalContent === modalContentMap.customTemplate) { 37949 modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 37950 // translators: %s: Name of the post type e.g: "Post". 37951 (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name); 37952 } else if (modalContent === modalContentMap.customGenericTemplate) { 37953 modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create custom template'); 37954 } 37955 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 37956 title: modalTitle, 37957 className: dist_clsx('edit-site-add-new-template__modal', { 37958 'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList, 37959 'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate 37960 }), 37961 onRequestClose: onModalClose, 37962 overlayClassName: modalContent === modalContentMap.customGenericTemplate ? 'edit-site-custom-generic-template__modal' : undefined, 37963 children: [modalContent === modalContentMap.templatesList && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 37964 columns: isMobile ? 2 : 3, 37965 gap: 4, 37966 align: "flex-start", 37967 justify: "center", 37968 className: "edit-site-add-new-template__template-list__contents", 37969 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 37970 className: "edit-site-add-new-template__template-list__prompt", 37971 children: (0,external_wp_i18n_namespaceObject.__)('Select what the new template should apply to:') 37972 }), missingTemplates.map(template => { 37973 const { 37974 title, 37975 slug, 37976 onClick 37977 } = template; 37978 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 37979 title: title, 37980 direction: "column", 37981 className: "edit-site-add-new-template__template-button", 37982 description: TEMPLATE_SHORT_DESCRIPTIONS[slug], 37983 icon: TEMPLATE_ICONS[slug] || library_layout, 37984 onClick: () => onClick ? onClick(template) : createTemplate(template) 37985 }, slug); 37986 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 37987 title: (0,external_wp_i18n_namespaceObject.__)('Custom template'), 37988 direction: "row", 37989 className: "edit-site-add-new-template__custom-template-button", 37990 icon: edit, 37991 onClick: () => setModalContent(modalContentMap.customGenericTemplate), 37992 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37993 lineHeight: 1.53846153846 // 20px 37994 , 37995 children: (0,external_wp_i18n_namespaceObject.__)('A custom template can be manually applied to any post or page.') 37996 }) 37997 })] 37998 }), modalContent === modalContentMap.customTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_template_modal_content, { 37999 onSelect: createTemplate, 38000 entityForSuggestions: entityForSuggestions 38001 }), modalContent === modalContentMap.customGenericTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_generic_template_modal_content, { 38002 onClose: onModalClose, 38003 createTemplate: createTemplate 38004 })] 38005 }); 38006 } 38007 function NewTemplate() { 38008 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 38009 const { 38010 postType 38011 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 38012 const { 38013 getPostType 38014 } = select(external_wp_coreData_namespaceObject.store); 38015 return { 38016 postType: getPostType(TEMPLATE_POST_TYPE) 38017 }; 38018 }, []); 38019 if (!postType) { 38020 return null; 38021 } 38022 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38023 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 38024 variant: "primary", 38025 onClick: () => setShowModal(true), 38026 label: postType.labels.add_new_item, 38027 __next40pxDefaultSize: true, 38028 children: postType.labels.add_new_item 38029 }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { 38030 onClose: () => setShowModal(false) 38031 })] 38032 }); 38033 } 38034 function useMissingTemplates(setEntityForSuggestions, onClick) { 38035 const existingTemplates = useExistingTemplates(); 38036 const defaultTemplateTypes = useDefaultTemplateTypes(); 38037 const existingTemplateSlugs = (existingTemplates || []).map(({ 38038 slug 38039 }) => slug); 38040 const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)); 38041 const onClickMenuItem = _entityForSuggestions => { 38042 onClick?.(); 38043 setEntityForSuggestions(_entityForSuggestions); 38044 }; 38045 // We need to replace existing default template types with 38046 // the create specific template functionality. The original 38047 // info (title, description, etc.) is preserved in the 38048 // used hooks. 38049 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; 38050 const { 38051 defaultTaxonomiesMenuItems, 38052 taxonomiesMenuItems 38053 } = useTaxonomiesMenuItems(onClickMenuItem); 38054 const { 38055 defaultPostTypesMenuItems, 38056 postTypesMenuItems 38057 } = usePostTypeMenuItems(onClickMenuItem); 38058 const authorMenuItem = useAuthorMenuItem(onClickMenuItem); 38059 [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => { 38060 if (!menuItem) { 38061 return; 38062 } 38063 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug); 38064 // Some default template types might have been filtered above from 38065 // `missingDefaultTemplates` because they only check for the general 38066 // template. So here we either replace or append the item, augmented 38067 // with the check if it has available specific item to create a 38068 // template for. 38069 if (matchIndex > -1) { 38070 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; 38071 } else { 38072 enhancedMissingDefaultTemplateTypes.push(menuItem); 38073 } 38074 }); 38075 // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order. 38076 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { 38077 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); 38078 }); 38079 const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems]; 38080 return missingTemplates; 38081 } 38082 /* harmony default export */ const add_new_template = ((0,external_wp_element_namespaceObject.memo)(NewTemplate)); 38083 38084 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js 38085 /** 38086 * External dependencies 38087 */ 38088 38089 38090 /** 38091 * WordPress dependencies 38092 */ 38093 38094 38095 38096 38097 38098 38099 38100 38101 /** 38102 * Internal dependencies 38103 */ 38104 38105 38106 38107 38108 38109 38110 38111 const { 38112 useGlobalStyle: page_templates_fields_useGlobalStyle 38113 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 38114 function fields_PreviewField({ 38115 item 38116 }) { 38117 const settings = usePatternSettings(); 38118 const [backgroundColor = 'white'] = page_templates_fields_useGlobalStyle('color.background'); 38119 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 38120 return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw); 38121 }, [item.content.raw]); 38122 const { 38123 onClick 38124 } = useLink({ 38125 postId: item.id, 38126 postType: item.type, 38127 canvas: 'edit' 38128 }); 38129 const isEmpty = !blocks?.length; 38130 // Wrap everything in a block editor provider to ensure 'styles' that are needed 38131 // for the previews are synced between the site editor store and the block editor store. 38132 // Additionally we need to have the `__experimentalBlockPatterns` setting in order to 38133 // render patterns inside the previews. 38134 // TODO: Same approach is used in the patterns list and it becomes obvious that some of 38135 // the block editor settings are needed in context where we don't have the block editor. 38136 // Explore how we can solve this in a better way. 38137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { 38138 post: item, 38139 settings: settings, 38140 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38141 className: "page-templates-preview-field", 38142 style: { 38143 backgroundColor 38144 }, 38145 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("button", { 38146 className: "page-templates-preview-field__button", 38147 type: "button", 38148 onClick: onClick, 38149 "aria-label": item.title?.rendered || item.title, 38150 children: [isEmpty && (0,external_wp_i18n_namespaceObject.__)('Empty template'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Async, { 38151 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 38152 blocks: blocks 38153 }) 38154 })] 38155 }) 38156 }) 38157 }); 38158 } 38159 const fields_previewField = { 38160 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 38161 id: 'preview', 38162 render: fields_PreviewField, 38163 enableSorting: false 38164 }; 38165 function fields_TitleField({ 38166 item 38167 }) { 38168 const linkProps = { 38169 params: { 38170 postId: item.id, 38171 postType: item.type, 38172 canvas: 'edit' 38173 } 38174 }; 38175 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Link, { 38176 ...linkProps, 38177 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 38178 }); 38179 } 38180 const fields_titleField = { 38181 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 38182 id: 'title', 38183 getValue: ({ 38184 item 38185 }) => item.title?.rendered, 38186 render: fields_TitleField, 38187 enableHiding: false, 38188 enableGlobalSearch: true 38189 }; 38190 const descriptionField = { 38191 label: (0,external_wp_i18n_namespaceObject.__)('Description'), 38192 id: 'description', 38193 render: ({ 38194 item 38195 }) => { 38196 return item.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 38197 className: "page-templates-description", 38198 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description) 38199 }); 38200 }, 38201 enableSorting: false, 38202 enableGlobalSearch: true 38203 }; 38204 function fields_AuthorField({ 38205 item 38206 }) { 38207 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 38208 const { 38209 text, 38210 icon, 38211 imageUrl 38212 } = useAddedBy(item.type, item.id); 38213 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 38214 alignment: "left", 38215 spacing: 0, 38216 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38217 className: dist_clsx('page-templates-author-field__avatar', { 38218 'is-loaded': isImageLoaded 38219 }), 38220 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 38221 onLoad: () => setIsImageLoaded(true), 38222 alt: "", 38223 src: imageUrl 38224 }) 38225 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38226 className: "page-templates-author-field__icon", 38227 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 38228 icon: icon 38229 }) 38230 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 38231 className: "page-templates-author-field__name", 38232 children: text 38233 })] 38234 }); 38235 } 38236 const authorField = { 38237 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 38238 id: 'author', 38239 getValue: ({ 38240 item 38241 }) => item.author_text, 38242 render: fields_AuthorField 38243 }; 38244 38245 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js 38246 /** 38247 * WordPress dependencies 38248 */ 38249 38250 38251 38252 38253 38254 38255 38256 /** 38257 * Internal dependencies 38258 */ 38259 38260 38261 38262 38263 38264 38265 38266 const { 38267 usePostActions: page_templates_usePostActions 38268 } = unlock(external_wp_editor_namespaceObject.privateApis); 38269 const { 38270 useHistory: page_templates_useHistory, 38271 useLocation: page_templates_useLocation 38272 } = unlock(external_wp_router_namespaceObject.privateApis); 38273 const { 38274 useEntityRecordsWithPermissions: page_templates_useEntityRecordsWithPermissions 38275 } = unlock(external_wp_coreData_namespaceObject.privateApis); 38276 const page_templates_EMPTY_ARRAY = []; 38277 const page_templates_defaultLayouts = { 38278 [LAYOUT_TABLE]: { 38279 fields: ['template', 'author'], 38280 layout: { 38281 primaryField: 'title', 38282 combinedFields: [{ 38283 id: 'template', 38284 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 38285 children: ['title', 'description'], 38286 direction: 'vertical' 38287 }], 38288 styles: { 38289 template: { 38290 maxWidth: 400, 38291 minWidth: 320 38292 }, 38293 preview: { 38294 width: '1%' 38295 }, 38296 author: { 38297 width: '1%' 38298 } 38299 } 38300 } 38301 }, 38302 [LAYOUT_GRID]: { 38303 fields: ['title', 'description', 'author'], 38304 layout: { 38305 mediaField: 'preview', 38306 primaryField: 'title', 38307 columnFields: ['description'] 38308 } 38309 }, 38310 [LAYOUT_LIST]: { 38311 fields: ['title', 'description', 'author'], 38312 layout: { 38313 primaryField: 'title', 38314 mediaField: 'preview' 38315 } 38316 } 38317 }; 38318 const page_templates_DEFAULT_VIEW = { 38319 type: LAYOUT_GRID, 38320 search: '', 38321 page: 1, 38322 perPage: 20, 38323 sort: { 38324 field: 'title', 38325 direction: 'asc' 38326 }, 38327 fields: page_templates_defaultLayouts[LAYOUT_GRID].fields, 38328 layout: page_templates_defaultLayouts[LAYOUT_GRID].layout, 38329 filters: [] 38330 }; 38331 function PageTemplates() { 38332 const { 38333 params 38334 } = page_templates_useLocation(); 38335 const { 38336 activeView = 'all', 38337 layout, 38338 postId 38339 } = params; 38340 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([postId]); 38341 const defaultView = (0,external_wp_element_namespaceObject.useMemo)(() => { 38342 const usedType = layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type; 38343 return { 38344 ...page_templates_DEFAULT_VIEW, 38345 type: usedType, 38346 layout: page_templates_defaultLayouts[usedType].layout, 38347 fields: page_templates_defaultLayouts[usedType].fields, 38348 filters: activeView !== 'all' ? [{ 38349 field: 'author', 38350 operator: 'isAny', 38351 value: [activeView] 38352 }] : [] 38353 }; 38354 }, [layout, activeView]); 38355 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(defaultView); 38356 (0,external_wp_element_namespaceObject.useEffect)(() => { 38357 setView(currentView => ({ 38358 ...currentView, 38359 filters: activeView !== 'all' ? [{ 38360 field: 'author', 38361 operator: OPERATOR_IS_ANY, 38362 value: [activeView] 38363 }] : [] 38364 })); 38365 }, [activeView]); 38366 const { 38367 records, 38368 isResolving: isLoadingData 38369 } = page_templates_useEntityRecordsWithPermissions('postType', TEMPLATE_POST_TYPE, { 38370 per_page: -1 38371 }); 38372 const history = page_templates_useHistory(); 38373 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 38374 setSelection(items); 38375 if (view?.type === LAYOUT_LIST) { 38376 history.push({ 38377 ...params, 38378 postId: items.length === 1 ? items[0] : undefined 38379 }); 38380 } 38381 }, [history, params, view?.type]); 38382 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 38383 if (!records) { 38384 return page_templates_EMPTY_ARRAY; 38385 } 38386 const authorsSet = new Set(); 38387 records.forEach(template => { 38388 authorsSet.add(template.author_text); 38389 }); 38390 return Array.from(authorsSet).map(author => ({ 38391 value: author, 38392 label: author 38393 })); 38394 }, [records]); 38395 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [fields_previewField, fields_titleField, descriptionField, { 38396 ...authorField, 38397 elements: authors 38398 }], [authors]); 38399 const { 38400 data, 38401 paginationInfo 38402 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 38403 return filterSortAndPaginate(records, view, fields); 38404 }, [records, view, fields]); 38405 const postTypeActions = page_templates_usePostActions({ 38406 postType: TEMPLATE_POST_TYPE, 38407 context: 'list' 38408 }); 38409 const editAction = useEditPostAction(); 38410 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 38411 const onChangeView = (0,external_wp_element_namespaceObject.useCallback)(newView => { 38412 if (newView.type !== view.type) { 38413 history.push({ 38414 ...params, 38415 layout: newView.type 38416 }); 38417 } 38418 setView(newView); 38419 }, [view.type, setView, history, params]); 38420 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 38421 className: "edit-site-page-templates", 38422 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 38423 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template, {}), 38424 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 38425 paginationInfo: paginationInfo, 38426 fields: fields, 38427 actions: actions, 38428 data: data, 38429 isLoading: isLoadingData, 38430 view: view, 38431 onChangeView: onChangeView, 38432 onChangeSelection: onChangeSelection, 38433 selection: selection, 38434 defaultLayouts: page_templates_defaultLayouts 38435 }, activeView) 38436 }); 38437 } 38438 38439 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js 38440 /** 38441 * External dependencies 38442 */ 38443 38444 38445 /** 38446 * WordPress dependencies 38447 */ 38448 38449 38450 function SidebarButton(props) { 38451 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 38452 size: "compact", 38453 ...props, 38454 className: dist_clsx('edit-site-sidebar-button', props.className) 38455 }); 38456 } 38457 38458 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js 38459 /** 38460 * External dependencies 38461 */ 38462 38463 38464 /** 38465 * WordPress dependencies 38466 */ 38467 38468 38469 38470 38471 38472 38473 38474 38475 /** 38476 * Internal dependencies 38477 */ 38478 38479 38480 38481 38482 38483 38484 38485 38486 const { 38487 useHistory: sidebar_navigation_screen_useHistory, 38488 useLocation: sidebar_navigation_screen_useLocation 38489 } = unlock(external_wp_router_namespaceObject.privateApis); 38490 function SidebarNavigationScreen({ 38491 isRoot, 38492 title, 38493 actions, 38494 meta, 38495 content, 38496 footer, 38497 description, 38498 backPath: backPathProp 38499 }) { 38500 const { 38501 dashboardLink, 38502 dashboardLinkText, 38503 previewingThemeName 38504 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 38505 const { 38506 getSettings 38507 } = unlock(select(store)); 38508 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 38509 return { 38510 dashboardLink: getSettings().__experimentalDashboardLink, 38511 dashboardLinkText: getSettings().__experimentalDashboardLinkText, 38512 // Do not call `getTheme` with null, it will cause a request to 38513 // the server. 38514 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined 38515 }; 38516 }, []); 38517 const location = sidebar_navigation_screen_useLocation(); 38518 const history = sidebar_navigation_screen_useHistory(); 38519 const { 38520 navigate 38521 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 38522 const backPath = backPathProp !== null && backPathProp !== void 0 ? backPathProp : location.state?.backPath; 38523 const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; 38524 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38525 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 38526 className: dist_clsx('edit-site-sidebar-navigation-screen__main', { 38527 'has-footer': !!footer 38528 }), 38529 spacing: 0, 38530 justify: "flex-start", 38531 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 38532 spacing: 3, 38533 alignment: "flex-start", 38534 className: "edit-site-sidebar-navigation-screen__title-icon", 38535 children: [!isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38536 onClick: () => { 38537 history.push(backPath); 38538 navigate('back'); 38539 }, 38540 icon: icon, 38541 label: (0,external_wp_i18n_namespaceObject.__)('Back'), 38542 showTooltip: false 38543 }), isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38544 icon: icon, 38545 label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 38546 href: dashboardLink || 'index.php' 38547 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 38548 className: "edit-site-sidebar-navigation-screen__title", 38549 color: '#e0e0e0' /* $gray-200 */, 38550 level: 1, 38551 size: 20, 38552 children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: theme name. 2: title */ 38553 (0,external_wp_i18n_namespaceObject.__)('Previewing %1$s: %2$s'), previewingThemeName, title) 38554 }), actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38555 className: "edit-site-sidebar-navigation-screen__actions", 38556 children: actions 38557 })] 38558 }), meta && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38559 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 38560 className: "edit-site-sidebar-navigation-screen__meta", 38561 children: meta 38562 }) 38563 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 38564 className: "edit-site-sidebar-navigation-screen__content", 38565 children: [description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 38566 className: "edit-site-sidebar-navigation-screen__description", 38567 children: description 38568 }), content] 38569 })] 38570 }), footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { 38571 className: "edit-site-sidebar-navigation-screen__footer", 38572 children: footer 38573 })] 38574 }); 38575 } 38576 38577 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 38578 /** 38579 * WordPress dependencies 38580 */ 38581 38582 38583 const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38584 xmlns: "http://www.w3.org/2000/svg", 38585 viewBox: "0 0 24 24", 38586 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38587 d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" 38588 }) 38589 }); 38590 /* harmony default export */ const chevron_left_small = (chevronLeftSmall); 38591 38592 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 38593 /** 38594 * WordPress dependencies 38595 */ 38596 38597 38598 const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38599 xmlns: "http://www.w3.org/2000/svg", 38600 viewBox: "0 0 24 24", 38601 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38602 d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" 38603 }) 38604 }); 38605 /* harmony default export */ const chevron_right_small = (chevronRightSmall); 38606 38607 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js 38608 /** 38609 * External dependencies 38610 */ 38611 38612 38613 /** 38614 * WordPress dependencies 38615 */ 38616 38617 38618 38619 38620 38621 38622 /** 38623 * Internal dependencies 38624 */ 38625 38626 38627 38628 38629 const { 38630 useHistory: sidebar_navigation_item_useHistory 38631 } = unlock(external_wp_router_namespaceObject.privateApis); 38632 function SidebarNavigationItem({ 38633 className, 38634 icon, 38635 withChevron = false, 38636 suffix, 38637 uid, 38638 params, 38639 onClick, 38640 children, 38641 ...props 38642 }) { 38643 const history = sidebar_navigation_item_useHistory(); 38644 const { 38645 navigate 38646 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 38647 // If there is no custom click handler, create one that navigates to `params`. 38648 function handleClick(e) { 38649 if (onClick) { 38650 onClick(e); 38651 navigate('forward'); 38652 } else if (params) { 38653 e.preventDefault(); 38654 history.push(params); 38655 navigate('forward', `[id="$uid}"]`); 38656 } 38657 } 38658 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 38659 className: dist_clsx('edit-site-sidebar-navigation-item', { 38660 'with-suffix': !withChevron && suffix 38661 }, className), 38662 onClick: handleClick, 38663 id: uid, 38664 ...props, 38665 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 38666 justify: "flex-start", 38667 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 38668 style: { 38669 fill: 'currentcolor' 38670 }, 38671 icon: icon, 38672 size: 24 38673 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 38674 children: children 38675 }), withChevron && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 38676 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, 38677 className: "edit-site-sidebar-navigation-item__drilldown-indicator", 38678 size: 24 38679 }), !withChevron && suffix] 38680 }) 38681 }); 38682 } 38683 38684 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js 38685 /** 38686 * WordPress dependencies 38687 */ 38688 38689 38690 function SidebarNavigationScreenDetailsPanelLabel({ 38691 children 38692 }) { 38693 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38694 className: "edit-site-sidebar-navigation-details-screen-panel__label", 38695 children: children 38696 }); 38697 } 38698 38699 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js 38700 /** 38701 * External dependencies 38702 */ 38703 38704 38705 /** 38706 * WordPress dependencies 38707 */ 38708 38709 38710 function SidebarNavigationScreenDetailsPanelRow({ 38711 label, 38712 children, 38713 className, 38714 ...extraProps 38715 }) { 38716 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 38717 spacing: 5, 38718 alignment: "left", 38719 className: dist_clsx('edit-site-sidebar-navigation-details-screen-panel__row', className), 38720 ...extraProps, 38721 children: children 38722 }, label); 38723 } 38724 38725 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js 38726 /** 38727 * WordPress dependencies 38728 */ 38729 38730 38731 function SidebarNavigationScreenDetailsPanelValue({ 38732 children 38733 }) { 38734 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38735 className: "edit-site-sidebar-navigation-details-screen-panel__value", 38736 children: children 38737 }); 38738 } 38739 38740 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/index.js 38741 /** 38742 * WordPress dependencies 38743 */ 38744 38745 38746 /** 38747 * Internal dependencies 38748 */ 38749 38750 38751 38752 38753 38754 function SidebarNavigationScreenDetailsPanel({ 38755 title, 38756 children, 38757 spacing 38758 }) { 38759 return /*#__PURE__*/_jsxs(VStack, { 38760 className: "edit-site-sidebar-navigation-details-screen-panel", 38761 spacing: spacing, 38762 children: [title && /*#__PURE__*/_jsx(Heading, { 38763 className: "edit-site-sidebar-navigation-details-screen-panel__heading", 38764 level: 2, 38765 children: title 38766 }), children] 38767 }); 38768 } 38769 38770 38771 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js 38772 /** 38773 * WordPress dependencies 38774 */ 38775 38776 38777 38778 38779 38780 38781 38782 /** 38783 * Internal dependencies 38784 */ 38785 38786 38787 38788 38789 function SidebarNavigationScreenDetailsFooter({ 38790 record, 38791 ...otherProps 38792 }) { 38793 var _record$_links$predec, _record$_links$versio; 38794 /* 38795 * There might be other items in the future, 38796 * but for now it's just modified date. 38797 * Later we might render a list of items and isolate 38798 * the following logic. 38799 */ 38800 const hrefProps = {}; 38801 const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null; 38802 const revisionsCount = (_record$_links$versio = record?._links?.['version-history']?.[0]?.count) !== null && _record$_links$versio !== void 0 ? _record$_links$versio : 0; 38803 // Enable the revisions link if there is a last revision and there are more than one revisions. 38804 if (lastRevisionId && revisionsCount > 1) { 38805 hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 38806 revision: record?._links['predecessor-version'][0].id 38807 }); 38808 hrefProps.as = 'a'; 38809 } 38810 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 38811 className: "edit-site-sidebar-navigation-screen-details-footer", 38812 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38813 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Revisions'), 38814 ...hrefProps, 38815 ...otherProps, 38816 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SidebarNavigationScreenDetailsPanelRow, { 38817 justify: "space-between", 38818 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsPanelLabel, { 38819 children: (0,external_wp_i18n_namespaceObject.__)('Last modified') 38820 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsPanelValue, { 38821 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. */ 38822 (0,external_wp_i18n_namespaceObject.__)('<time>%s</time>'), (0,external_wp_date_namespaceObject.humanTimeDiff)(record.modified)), { 38823 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 38824 dateTime: record.modified 38825 }) 38826 }) 38827 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 38828 className: "edit-site-sidebar-navigation-screen-details-footer__icon", 38829 icon: library_backup 38830 })] 38831 }) 38832 }) 38833 }); 38834 } 38835 38836 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js 38837 /** 38838 * WordPress dependencies 38839 */ 38840 38841 38842 38843 38844 38845 38846 38847 38848 38849 /** 38850 * Internal dependencies 38851 */ 38852 38853 38854 38855 38856 38857 38858 38859 38860 38861 38862 38863 38864 function SidebarNavigationItemGlobalStyles(props) { 38865 const { 38866 openGeneralSidebar 38867 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38868 const { 38869 setCanvasMode 38870 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 38871 const hasGlobalStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []); 38872 if (hasGlobalStyleVariations) { 38873 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38874 ...props, 38875 params: { 38876 path: '/wp_global_styles' 38877 }, 38878 uid: "global-styles-navigation-item" 38879 }); 38880 } 38881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38882 ...props, 38883 onClick: () => { 38884 // Switch to edit mode. 38885 setCanvasMode('edit'); 38886 // Open global styles sidebar. 38887 openGeneralSidebar('edit-site/global-styles'); 38888 } 38889 }); 38890 } 38891 function SidebarNavigationScreenGlobalStyles({ 38892 backPath 38893 }) { 38894 const { 38895 revisions, 38896 isLoading: isLoadingRevisions 38897 } = useGlobalStylesRevisions(); 38898 const { 38899 openGeneralSidebar 38900 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38901 const { 38902 setIsListViewOpened 38903 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 38904 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 38905 const { 38906 setCanvasMode, 38907 setEditorCanvasContainerView 38908 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 38909 const { 38910 isViewMode, 38911 isStyleBookOpened, 38912 revisionsCount 38913 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 38914 var _globalStyles$_links$; 38915 const { 38916 getCanvasMode, 38917 getEditorCanvasContainerView 38918 } = unlock(select(store)); 38919 const { 38920 getEntityRecord, 38921 __experimentalGetCurrentGlobalStylesId 38922 } = select(external_wp_coreData_namespaceObject.store); 38923 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 38924 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 38925 return { 38926 isViewMode: 'view' === getCanvasMode(), 38927 isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(), 38928 revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0 38929 }; 38930 }, []); 38931 const { 38932 set: setPreference 38933 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 38934 const openGlobalStyles = (0,external_wp_element_namespaceObject.useCallback)(async () => { 38935 return Promise.all([setPreference('core', 'distractionFree', false), setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]); 38936 }, [setCanvasMode, openGeneralSidebar, setPreference]); 38937 const openStyleBook = (0,external_wp_element_namespaceObject.useCallback)(async () => { 38938 await openGlobalStyles(); 38939 // Open the Style Book once the canvas mode is set to edit, 38940 // and the global styles sidebar is open. This ensures that 38941 // the Style Book is not prematurely closed. 38942 setEditorCanvasContainerView('style-book'); 38943 setIsListViewOpened(false); 38944 }, [openGlobalStyles, setEditorCanvasContainerView, setIsListViewOpened]); 38945 const openRevisions = (0,external_wp_element_namespaceObject.useCallback)(async () => { 38946 await openGlobalStyles(); 38947 // Open the global styles revisions once the canvas mode is set to edit, 38948 // and the global styles sidebar is open. The global styles UI is responsible 38949 // for redirecting to the revisions screen once the editor canvas container 38950 // has been set to 'global-styles-revisions'. 38951 setEditorCanvasContainerView('global-styles-revisions'); 38952 }, [openGlobalStyles, setEditorCanvasContainerView]); 38953 38954 // If there are no revisions, do not render a footer. 38955 const hasRevisions = revisionsCount > 0; 38956 const modifiedDateTime = revisions?.[0]?.modified; 38957 const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime; 38958 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38959 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 38960 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 38961 description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles.'), 38962 backPath: backPath, 38963 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}), 38964 footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsFooter, { 38965 record: revisions?.[0], 38966 onClick: openRevisions 38967 }), 38968 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38969 children: [!isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38970 icon: library_seen, 38971 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 38972 onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined), 38973 isPressed: isStyleBookOpened 38974 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 38975 icon: edit, 38976 label: (0,external_wp_i18n_namespaceObject.__)('Edit styles'), 38977 onClick: async () => await openGlobalStyles() 38978 })] 38979 }) 38980 }), isStyleBookOpened && !isMobileViewport && isViewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 38981 enableResizing: false, 38982 isSelected: () => false, 38983 onClick: openStyleBook, 38984 onSelect: openStyleBook, 38985 showCloseButton: false, 38986 showTabs: false 38987 })] 38988 }); 38989 } 38990 38991 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js 38992 /** 38993 * WordPress dependencies 38994 */ 38995 38996 38997 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38998 viewBox: "0 0 24 24", 38999 xmlns: "http://www.w3.org/2000/svg", 39000 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 39001 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" 39002 }) 39003 }); 39004 /* harmony default export */ const library_navigation = (navigation); 39005 39006 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js 39007 /** 39008 * WordPress dependencies 39009 */ 39010 39011 39012 39013 39014 39015 39016 /** 39017 * Internal dependencies 39018 */ 39019 39020 39021 39022 39023 39024 39025 39026 39027 39028 function SidebarNavigationScreenMain() { 39029 const { 39030 setEditorCanvasContainerView 39031 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 39032 39033 // Clear the editor canvas container view when accessing the main navigation screen. 39034 (0,external_wp_element_namespaceObject.useEffect)(() => { 39035 setEditorCanvasContainerView(undefined); 39036 }, [setEditorCanvasContainerView]); 39037 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 39038 isRoot: true, 39039 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 39040 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'), 39041 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39042 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 39043 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39044 uid: "navigation-navigation-item", 39045 params: { 39046 postType: NAVIGATION_POST_TYPE 39047 }, 39048 withChevron: true, 39049 icon: library_navigation, 39050 children: (0,external_wp_i18n_namespaceObject.__)('Navigation') 39051 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItemGlobalStyles, { 39052 uid: "styles-navigation-item", 39053 withChevron: true, 39054 icon: library_styles, 39055 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 39056 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39057 uid: "page-navigation-item", 39058 params: { 39059 postType: 'page' 39060 }, 39061 withChevron: true, 39062 icon: library_page, 39063 children: (0,external_wp_i18n_namespaceObject.__)('Pages') 39064 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39065 uid: "template-navigation-item", 39066 params: { 39067 postType: TEMPLATE_POST_TYPE 39068 }, 39069 withChevron: true, 39070 icon: library_layout, 39071 children: (0,external_wp_i18n_namespaceObject.__)('Templates') 39072 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 39073 uid: "patterns-navigation-item", 39074 params: { 39075 postType: PATTERN_TYPES.user 39076 }, 39077 withChevron: true, 39078 icon: library_symbol, 39079 children: (0,external_wp_i18n_namespaceObject.__)('Patterns') 39080 })] 39081 }) 39082 }) 39083 }); 39084 } 39085 39086 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js 39087 // This requested is preloaded in `gutenberg_preload_navigation_posts`. 39088 // As unbounded queries are limited to 100 by `fetchAllMiddleware` 39089 // on apiFetch this query is limited to 100. 39090 // These parameters must be kept aligned with those in 39091 // lib/compat/wordpress-6.3/navigation-block-preloading.php 39092 // and 39093 // block-library/src/navigation/constants.js 39094 const PRELOADED_NAVIGATION_MENUS_QUERY = { 39095 per_page: 100, 39096 status: ['publish', 'draft'], 39097 order: 'desc', 39098 orderby: 'date' 39099 }; 39100 39101 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js 39102 /** 39103 * WordPress dependencies 39104 */ 39105 39106 39107 39108 39109 39110 const notEmptyString = testString => testString?.trim()?.length > 0; 39111 function rename_modal_RenameModal({ 39112 menuTitle, 39113 onClose, 39114 onSave 39115 }) { 39116 const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_namespaceObject.useState)(menuTitle); 39117 const titleHasChanged = editedMenuTitle !== menuTitle; 39118 const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); 39119 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 39120 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 39121 onRequestClose: onClose, 39122 focusOnMount: "firstContentElement", 39123 size: "small", 39124 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 39125 className: "sidebar-navigation__rename-modal-form", 39126 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 39127 spacing: "3", 39128 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 39129 __nextHasNoMarginBottom: true, 39130 __next40pxDefaultSize: true, 39131 value: editedMenuTitle, 39132 placeholder: (0,external_wp_i18n_namespaceObject.__)('Navigation title'), 39133 onChange: setEditedMenuTitle, 39134 label: (0,external_wp_i18n_namespaceObject.__)('Name') 39135 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 39136 justify: "right", 39137 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39138 __next40pxDefaultSize: true, 39139 variant: "tertiary", 39140 onClick: onClose, 39141 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 39142 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39143 __next40pxDefaultSize: true, 39144 accessibleWhenDisabled: true, 39145 disabled: !isEditedMenuTitleValid, 39146 variant: "primary", 39147 type: "submit", 39148 onClick: e => { 39149 e.preventDefault(); 39150 if (!isEditedMenuTitleValid) { 39151 return; 39152 } 39153 onSave({ 39154 title: editedMenuTitle 39155 }); 39156 39157 // Immediate close avoids ability to hit save multiple times. 39158 onClose(); 39159 }, 39160 children: (0,external_wp_i18n_namespaceObject.__)('Save') 39161 })] 39162 })] 39163 }) 39164 }) 39165 }); 39166 } 39167 39168 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js 39169 /** 39170 * WordPress dependencies 39171 */ 39172 39173 39174 39175 function DeleteConfirmDialog({ 39176 onClose, 39177 onConfirm 39178 }) { 39179 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 39180 isOpen: true, 39181 onConfirm: () => { 39182 onConfirm(); 39183 39184 // Immediate close avoids ability to hit delete multiple times. 39185 onClose(); 39186 }, 39187 onCancel: onClose, 39188 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 39189 size: "medium", 39190 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation Menu?') 39191 }); 39192 } 39193 39194 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js 39195 /** 39196 * WordPress dependencies 39197 */ 39198 39199 39200 39201 39202 39203 39204 /** 39205 * Internal dependencies 39206 */ 39207 39208 39209 39210 39211 39212 39213 const { 39214 useHistory: more_menu_useHistory 39215 } = unlock(external_wp_router_namespaceObject.privateApis); 39216 const POPOVER_PROPS = { 39217 position: 'bottom right' 39218 }; 39219 function ScreenNavigationMoreMenu(props) { 39220 const { 39221 onDelete, 39222 onSave, 39223 onDuplicate, 39224 menuTitle, 39225 menuId 39226 } = props; 39227 const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 39228 const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 39229 const history = more_menu_useHistory(); 39230 const closeModals = () => { 39231 setRenameModalOpen(false); 39232 setDeleteConfirmDialogOpen(false); 39233 }; 39234 const openRenameModal = () => setRenameModalOpen(true); 39235 const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); 39236 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39237 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 39238 className: "sidebar-navigation__more-menu", 39239 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 39240 icon: more_vertical, 39241 popoverProps: POPOVER_PROPS, 39242 children: ({ 39243 onClose 39244 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39245 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 39246 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39247 onClick: () => { 39248 openRenameModal(); 39249 // Close the dropdown after opening the modal. 39250 onClose(); 39251 }, 39252 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 39253 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39254 onClick: () => { 39255 history.push({ 39256 postId: menuId, 39257 postType: 'wp_navigation', 39258 canvas: 'edit' 39259 }); 39260 }, 39261 children: (0,external_wp_i18n_namespaceObject.__)('Edit') 39262 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39263 onClick: () => { 39264 onDuplicate(); 39265 onClose(); 39266 }, 39267 children: (0,external_wp_i18n_namespaceObject.__)('Duplicate') 39268 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39269 isDestructive: true, 39270 onClick: () => { 39271 openDeleteConfirmDialog(); 39272 39273 // Close the dropdown after opening the modal. 39274 onClose(); 39275 }, 39276 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 39277 })] 39278 }) 39279 }) 39280 }), deleteConfirmDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteConfirmDialog, { 39281 onClose: closeModals, 39282 onConfirm: onDelete 39283 }), renameModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_modal_RenameModal, { 39284 onClose: closeModals, 39285 menuTitle: menuTitle, 39286 onSave: onSave 39287 })] 39288 }); 39289 } 39290 39291 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js 39292 /** 39293 * WordPress dependencies 39294 */ 39295 39296 39297 39298 39299 39300 39301 39302 39303 const leaf_more_menu_POPOVER_PROPS = { 39304 className: 'block-editor-block-settings-menu__popover', 39305 placement: 'bottom-start' 39306 }; 39307 39308 /** 39309 * Internal dependencies 39310 */ 39311 39312 39313 39314 39315 const { 39316 useHistory: leaf_more_menu_useHistory 39317 } = unlock(external_wp_router_namespaceObject.privateApis); 39318 function LeafMoreMenu(props) { 39319 const history = leaf_more_menu_useHistory(); 39320 const { 39321 block 39322 } = props; 39323 const { 39324 clientId 39325 } = block; 39326 const { 39327 moveBlocksDown, 39328 moveBlocksUp, 39329 removeBlocks 39330 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 39331 const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ 39332 (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 39333 clientId, 39334 maximumLength: 25 39335 })); 39336 const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ 39337 (0,external_wp_i18n_namespaceObject.__)('Go to %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 39338 clientId, 39339 maximumLength: 25 39340 })); 39341 const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { 39342 const { 39343 getBlockRootClientId 39344 } = select(external_wp_blockEditor_namespaceObject.store); 39345 return getBlockRootClientId(clientId); 39346 }, [clientId]); 39347 const onGoToPage = (0,external_wp_element_namespaceObject.useCallback)(selectedBlock => { 39348 const { 39349 attributes, 39350 name 39351 } = selectedBlock; 39352 if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) { 39353 const { 39354 params 39355 } = history.getLocationWithParams(); 39356 history.push({ 39357 postType: attributes.type, 39358 postId: attributes.id, 39359 canvas: 'edit' 39360 }, { 39361 backPath: params 39362 }); 39363 } 39364 if (name === 'core/page-list-item' && attributes.id && history) { 39365 const { 39366 params 39367 } = history.getLocationWithParams(); 39368 history.push({ 39369 postType: 'page', 39370 postId: attributes.id, 39371 canvas: 'edit' 39372 }, { 39373 backPath: params 39374 }); 39375 } 39376 }, [history]); 39377 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 39378 icon: more_vertical, 39379 label: (0,external_wp_i18n_namespaceObject.__)('Options'), 39380 className: "block-editor-block-settings-menu", 39381 popoverProps: leaf_more_menu_POPOVER_PROPS, 39382 noIcons: true, 39383 ...props, 39384 children: ({ 39385 onClose 39386 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39387 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 39388 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39389 icon: chevron_up, 39390 onClick: () => { 39391 moveBlocksUp([clientId], rootClientId); 39392 onClose(); 39393 }, 39394 children: (0,external_wp_i18n_namespaceObject.__)('Move up') 39395 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39396 icon: chevron_down, 39397 onClick: () => { 39398 moveBlocksDown([clientId], rootClientId); 39399 onClose(); 39400 }, 39401 children: (0,external_wp_i18n_namespaceObject.__)('Move down') 39402 }), block.attributes?.type === 'page' && block.attributes?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39403 onClick: () => { 39404 onGoToPage(block); 39405 onClose(); 39406 }, 39407 children: goToLabel 39408 })] 39409 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 39410 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 39411 onClick: () => { 39412 removeBlocks([clientId], false); 39413 onClose(); 39414 }, 39415 children: removeLabel 39416 }) 39417 })] 39418 }) 39419 }); 39420 } 39421 39422 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js 39423 /** 39424 * WordPress dependencies 39425 */ 39426 39427 39428 39429 39430 39431 39432 /** 39433 * Internal dependencies 39434 */ 39435 39436 39437 39438 39439 39440 const { 39441 PrivateListView 39442 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 39443 39444 // Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js. 39445 const MAX_PAGE_COUNT = 100; 39446 const PAGES_QUERY = ['postType', 'page', { 39447 per_page: MAX_PAGE_COUNT, 39448 _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'], 39449 // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby 39450 // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent 39451 // sort. 39452 orderby: 'menu_order', 39453 order: 'asc' 39454 }]; 39455 function NavigationMenuContent({ 39456 rootClientId 39457 }) { 39458 const { 39459 listViewRootClientId, 39460 isLoading 39461 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39462 const { 39463 areInnerBlocksControlled, 39464 getBlockName, 39465 getBlockCount, 39466 getBlockOrder 39467 } = select(external_wp_blockEditor_namespaceObject.store); 39468 const { 39469 isResolving 39470 } = select(external_wp_coreData_namespaceObject.store); 39471 const blockClientIds = getBlockOrder(rootClientId); 39472 const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === 'core/page-list'; 39473 const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; 39474 const isLoadingPages = isResolving('getEntityRecords', PAGES_QUERY); 39475 return { 39476 listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, 39477 // This is a small hack to wait for the navigation block 39478 // to actually load its inner blocks. 39479 isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages 39480 }; 39481 }, [rootClientId]); 39482 const { 39483 replaceBlock, 39484 __unstableMarkNextChangeAsNotPersistent 39485 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 39486 const offCanvasOnselect = (0,external_wp_element_namespaceObject.useCallback)(block => { 39487 if (block.name === 'core/navigation-link' && !block.attributes.url) { 39488 __unstableMarkNextChangeAsNotPersistent(); 39489 replaceBlock(block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', block.attributes)); 39490 } 39491 }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock]); 39492 39493 // The hidden block is needed because it makes block edit side effects trigger. 39494 // For example a navigation page list load its items has an effect on edit to load its items. 39495 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39496 children: [!isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { 39497 rootClientId: listViewRootClientId, 39498 onSelect: offCanvasOnselect, 39499 blockSettingsMenu: LeafMoreMenu, 39500 showAppender: false 39501 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39502 className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", 39503 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) 39504 })] 39505 }); 39506 } 39507 39508 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js 39509 /** 39510 * WordPress dependencies 39511 */ 39512 39513 39514 39515 39516 39517 /** 39518 * Internal dependencies 39519 */ 39520 39521 39522 39523 39524 const navigation_menu_editor_noop = () => {}; 39525 function NavigationMenuEditor({ 39526 navigationMenuId 39527 }) { 39528 const { 39529 storedSettings 39530 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39531 const { 39532 getSettings 39533 } = unlock(select(store)); 39534 return { 39535 storedSettings: getSettings() 39536 }; 39537 }, []); 39538 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 39539 if (!navigationMenuId) { 39540 return []; 39541 } 39542 return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { 39543 ref: navigationMenuId 39544 })]; 39545 }, [navigationMenuId]); 39546 if (!navigationMenuId || !blocks?.length) { 39547 return null; 39548 } 39549 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 39550 settings: storedSettings, 39551 value: blocks, 39552 onChange: navigation_menu_editor_noop, 39553 onInput: navigation_menu_editor_noop, 39554 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39555 className: "edit-site-sidebar-navigation-screen-navigation-menus__content", 39556 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { 39557 rootClientId: blocks[0].clientId 39558 }) 39559 }) 39560 }); 39561 } 39562 39563 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js 39564 /** 39565 * WordPress dependencies 39566 */ 39567 39568 39569 39570 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 39571 function buildNavigationLabel(title, id, status) { 39572 if (!title?.rendered) { 39573 /* translators: %s: the index of the menu in the list of menus. */ 39574 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 39575 } 39576 if (status === 'publish') { 39577 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered); 39578 } 39579 return (0,external_wp_i18n_namespaceObject.sprintf)( 39580 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 39581 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status); 39582 } 39583 39584 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js 39585 /** 39586 * WordPress dependencies 39587 */ 39588 39589 39590 /** 39591 * Internal dependencies 39592 */ 39593 39594 39595 39596 39597 39598 39599 function SingleNavigationMenu({ 39600 navigationMenu, 39601 backPath, 39602 handleDelete, 39603 handleDuplicate, 39604 handleSave 39605 }) { 39606 const menuTitle = navigationMenu?.title?.rendered; 39607 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39608 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39609 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 39610 menuId: navigationMenu?.id, 39611 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 39612 onDelete: handleDelete, 39613 onSave: handleSave, 39614 onDuplicate: handleDuplicate 39615 }) 39616 }), 39617 backPath: backPath, 39618 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 39619 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 39620 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { 39621 navigationMenuId: navigationMenu?.id 39622 }) 39623 }); 39624 } 39625 39626 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js 39627 /** 39628 * WordPress dependencies 39629 */ 39630 39631 39632 39633 39634 39635 39636 39637 /** 39638 * Internal dependencies 39639 */ 39640 39641 39642 39643 39644 39645 39646 39647 const { 39648 useLocation: sidebar_navigation_screen_navigation_menu_useLocation 39649 } = unlock(external_wp_router_namespaceObject.privateApis); 39650 const postType = `wp_navigation`; 39651 function SidebarNavigationScreenNavigationMenu({ 39652 backPath 39653 }) { 39654 const { 39655 params: { 39656 postId 39657 } 39658 } = sidebar_navigation_screen_navigation_menu_useLocation(); 39659 const { 39660 record: navigationMenu, 39661 isResolving 39662 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId); 39663 const { 39664 isSaving, 39665 isDeleting 39666 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39667 const { 39668 isSavingEntityRecord, 39669 isDeletingEntityRecord 39670 } = select(external_wp_coreData_namespaceObject.store); 39671 return { 39672 isSaving: isSavingEntityRecord('postType', postType, postId), 39673 isDeleting: isDeletingEntityRecord('postType', postType, postId) 39674 }; 39675 }, [postId]); 39676 const isLoading = isResolving || isSaving || isDeleting; 39677 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 39678 const { 39679 handleSave, 39680 handleDelete, 39681 handleDuplicate 39682 } = useNavigationMenuHandlers(); 39683 const _handleDelete = () => handleDelete(navigationMenu); 39684 const _handleSave = edits => handleSave(navigationMenu, edits); 39685 const _handleDuplicate = () => handleDuplicate(navigationMenu); 39686 if (isLoading) { 39687 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39688 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 39689 backPath: backPath, 39690 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 39691 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 39692 }) 39693 }); 39694 } 39695 if (!isLoading && !navigationMenu) { 39696 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39697 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menu missing.'), 39698 backPath: backPath 39699 }); 39700 } 39701 if (!navigationMenu?.content?.raw) { 39702 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39703 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 39704 menuId: navigationMenu?.id, 39705 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 39706 onDelete: _handleDelete, 39707 onSave: _handleSave, 39708 onDuplicate: _handleDuplicate 39709 }), 39710 backPath: backPath, 39711 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 39712 description: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.') 39713 }); 39714 } 39715 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 39716 navigationMenu: navigationMenu, 39717 backPath: backPath, 39718 handleDelete: _handleDelete, 39719 handleSave: _handleSave, 39720 handleDuplicate: _handleDuplicate 39721 }); 39722 } 39723 39724 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js 39725 /** 39726 * WordPress dependencies 39727 */ 39728 39729 39730 39731 39732 39733 39734 /** 39735 * Internal dependencies 39736 */ 39737 39738 39739 39740 const { 39741 useHistory: use_navigation_menu_handlers_useHistory 39742 } = unlock(external_wp_router_namespaceObject.privateApis); 39743 function useDeleteNavigationMenu() { 39744 const { 39745 deleteEntityRecord 39746 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39747 const { 39748 createSuccessNotice, 39749 createErrorNotice 39750 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39751 const history = use_navigation_menu_handlers_useHistory(); 39752 const handleDelete = async navigationMenu => { 39753 const postId = navigationMenu?.id; 39754 try { 39755 await deleteEntityRecord('postType', postType, postId, { 39756 force: true 39757 }, { 39758 throwOnError: true 39759 }); 39760 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Navigation Menu successfully deleted.'), { 39761 type: 'snackbar' 39762 }); 39763 history.push({ 39764 postType: 'wp_navigation' 39765 }); 39766 } catch (error) { 39767 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */ 39768 (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), error?.message), { 39769 type: 'snackbar' 39770 }); 39771 } 39772 }; 39773 return handleDelete; 39774 } 39775 function useSaveNavigationMenu() { 39776 const { 39777 getEditedEntityRecord 39778 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39779 const { 39780 getEditedEntityRecord: getEditedEntityRecordSelector 39781 } = select(external_wp_coreData_namespaceObject.store); 39782 return { 39783 getEditedEntityRecord: getEditedEntityRecordSelector 39784 }; 39785 }, []); 39786 const { 39787 editEntityRecord, 39788 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 39789 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39790 const { 39791 createSuccessNotice, 39792 createErrorNotice 39793 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39794 const handleSave = async (navigationMenu, edits) => { 39795 if (!edits) { 39796 return; 39797 } 39798 const postId = navigationMenu?.id; 39799 // Prepare for revert in case of error. 39800 const originalRecord = getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, postId); 39801 39802 // Apply the edits. 39803 editEntityRecord('postType', postType, postId, edits); 39804 const recordPropertiesToSave = Object.keys(edits); 39805 39806 // Attempt to persist. 39807 try { 39808 await saveSpecifiedEntityEdits('postType', postType, postId, recordPropertiesToSave, { 39809 throwOnError: true 39810 }); 39811 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Renamed Navigation Menu'), { 39812 type: 'snackbar' 39813 }); 39814 } catch (error) { 39815 // Revert to original in case of error. 39816 editEntityRecord('postType', postType, postId, originalRecord); 39817 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be renamed. */ 39818 (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), error?.message), { 39819 type: 'snackbar' 39820 }); 39821 } 39822 }; 39823 return handleSave; 39824 } 39825 function useDuplicateNavigationMenu() { 39826 const history = use_navigation_menu_handlers_useHistory(); 39827 const { 39828 saveEntityRecord 39829 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39830 const { 39831 createSuccessNotice, 39832 createErrorNotice 39833 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39834 const handleDuplicate = async navigationMenu => { 39835 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 39836 try { 39837 const savedRecord = await saveEntityRecord('postType', postType, { 39838 title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Navigation menu title */ 39839 (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'navigation menu'), menuTitle), 39840 content: navigationMenu?.content?.raw, 39841 status: 'publish' 39842 }, { 39843 throwOnError: true 39844 }); 39845 if (savedRecord) { 39846 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Duplicated Navigation Menu'), { 39847 type: 'snackbar' 39848 }); 39849 history.push({ 39850 postType: postType, 39851 postId: savedRecord.id 39852 }); 39853 } 39854 } catch (error) { 39855 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */ 39856 (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), error?.message), { 39857 type: 'snackbar' 39858 }); 39859 } 39860 }; 39861 return handleDuplicate; 39862 } 39863 function useNavigationMenuHandlers() { 39864 return { 39865 handleDelete: useDeleteNavigationMenu(), 39866 handleSave: useSaveNavigationMenu(), 39867 handleDuplicate: useDuplicateNavigationMenu() 39868 }; 39869 } 39870 39871 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js 39872 /** 39873 * WordPress dependencies 39874 */ 39875 39876 39877 39878 39879 39880 39881 39882 /** 39883 * Internal dependencies 39884 */ 39885 39886 39887 39888 39889 39890 39891 39892 39893 39894 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 39895 39896 function buildMenuLabel(title, id, status) { 39897 if (!title) { 39898 /* translators: %s: the index of the menu in the list of menus. */ 39899 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 39900 } 39901 if (status === 'publish') { 39902 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); 39903 } 39904 return (0,external_wp_i18n_namespaceObject.sprintf)( 39905 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 39906 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status); 39907 } 39908 39909 // Save a boolean to prevent us creating a fallback more than once per session. 39910 let hasCreatedFallback = false; 39911 function SidebarNavigationScreenNavigationMenus({ 39912 backPath 39913 }) { 39914 const { 39915 records: navigationMenus, 39916 isResolving: isResolvingNavigationMenus, 39917 hasResolved: hasResolvedNavigationMenus 39918 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY); 39919 const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; 39920 const { 39921 getNavigationFallbackId 39922 } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store)); 39923 const firstNavigationMenu = navigationMenus?.[0]; 39924 39925 // Save a boolean to prevent us creating a fallback more than once per session. 39926 if (firstNavigationMenu) { 39927 hasCreatedFallback = true; 39928 } 39929 39930 // If there is no navigation menu found 39931 // then trigger fallback algorithm to create one. 39932 if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && !hasCreatedFallback) { 39933 getNavigationFallbackId(); 39934 } 39935 const { 39936 handleSave, 39937 handleDelete, 39938 handleDuplicate 39939 } = useNavigationMenuHandlers(); 39940 const hasNavigationMenus = !!navigationMenus?.length; 39941 if (isLoading) { 39942 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39943 backPath: backPath, 39944 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 39945 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 39946 }) 39947 }); 39948 } 39949 if (!isLoading && !hasNavigationMenus) { 39950 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39951 description: (0,external_wp_i18n_namespaceObject.__)('No Navigation Menus found.'), 39952 backPath: backPath 39953 }); 39954 } 39955 39956 // if single menu then render it 39957 if (navigationMenus?.length === 1) { 39958 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 39959 navigationMenu: firstNavigationMenu, 39960 backPath: backPath, 39961 handleDelete: () => handleDelete(firstNavigationMenu), 39962 handleDuplicate: () => handleDuplicate(firstNavigationMenu), 39963 handleSave: edits => handleSave(firstNavigationMenu, edits) 39964 }); 39965 } 39966 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 39967 backPath: backPath, 39968 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 39969 children: navigationMenus?.map(({ 39970 id, 39971 title, 39972 status 39973 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavMenuItem, { 39974 postId: id, 39975 withChevron: true, 39976 icon: library_navigation, 39977 children: buildMenuLabel(title?.rendered, index + 1, status) 39978 }, id)) 39979 }) 39980 }); 39981 } 39982 function SidebarNavigationScreenWrapper({ 39983 children, 39984 actions, 39985 title, 39986 description, 39987 backPath 39988 }) { 39989 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 39990 title: title || (0,external_wp_i18n_namespaceObject.__)('Navigation'), 39991 actions: actions, 39992 description: description || (0,external_wp_i18n_namespaceObject.__)('Manage your Navigation Menus.'), 39993 backPath: backPath, 39994 content: children 39995 }); 39996 } 39997 const NavMenuItem = ({ 39998 postId, 39999 ...props 40000 }) => { 40001 const linkInfo = useLink({ 40002 postId, 40003 postType: 'wp_navigation' 40004 }); 40005 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40006 ...linkInfo, 40007 ...props 40008 }); 40009 }; 40010 40011 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js 40012 /** 40013 * External dependencies 40014 */ 40015 40016 40017 /** 40018 * WordPress dependencies 40019 */ 40020 40021 40022 40023 40024 /** 40025 * Internal dependencies 40026 */ 40027 40028 40029 40030 40031 40032 const { 40033 useLocation: dataview_item_useLocation 40034 } = unlock(external_wp_router_namespaceObject.privateApis); 40035 function DataViewItem({ 40036 title, 40037 slug, 40038 customViewId, 40039 type, 40040 icon, 40041 isActive, 40042 isCustom, 40043 suffix 40044 }) { 40045 const { 40046 params: { 40047 postType 40048 } 40049 } = dataview_item_useLocation(); 40050 const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon; 40051 let activeView = isCustom ? customViewId : slug; 40052 if (activeView === 'all') { 40053 activeView = undefined; 40054 } 40055 const linkInfo = useLink({ 40056 postType, 40057 layout: type, 40058 activeView, 40059 isCustom: isCustom ? 'true' : undefined 40060 }); 40061 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40062 justify: "flex-start", 40063 className: dist_clsx('edit-site-sidebar-dataviews-dataview-item', { 40064 'is-selected': isActive 40065 }), 40066 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40067 icon: iconToUse, 40068 ...linkInfo, 40069 "aria-current": isActive ? 'true' : undefined, 40070 children: title 40071 }), suffix] 40072 }); 40073 } 40074 40075 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js 40076 /** 40077 * WordPress dependencies 40078 */ 40079 40080 40081 40082 40083 /** 40084 * Internal dependencies 40085 */ 40086 40087 40088 40089 40090 40091 40092 const content_EMPTY_ARRAY = []; 40093 function TemplateDataviewItem({ 40094 template, 40095 isActive 40096 }) { 40097 const { 40098 text, 40099 icon 40100 } = useAddedBy(template.type, template.id); 40101 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40102 slug: text, 40103 title: text, 40104 icon: icon, 40105 isActive: isActive, 40106 isCustom: false 40107 }, text); 40108 } 40109 function DataviewsTemplatesSidebarContent({ 40110 activeView, 40111 title 40112 }) { 40113 const { 40114 records 40115 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_POST_TYPE, { 40116 per_page: -1 40117 }); 40118 const firstItemPerAuthorText = (0,external_wp_element_namespaceObject.useMemo)(() => { 40119 var _ref; 40120 const firstItemPerAuthor = records?.reduce((acc, template) => { 40121 const author = template.author_text; 40122 if (author && !acc[author]) { 40123 acc[author] = template; 40124 } 40125 return acc; 40126 }, {}); 40127 return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : content_EMPTY_ARRAY; 40128 }, [records]); 40129 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40130 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40131 slug: "all", 40132 title: title, 40133 icon: library_layout, 40134 isActive: activeView === 'all', 40135 isCustom: false 40136 }), firstItemPerAuthorText.map(template => { 40137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateDataviewItem, { 40138 template: template, 40139 isActive: activeView === template.author_text 40140 }, template.author_text); 40141 })] 40142 }); 40143 } 40144 40145 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js 40146 /** 40147 * WordPress dependencies 40148 */ 40149 40150 40151 40152 /** 40153 * Internal dependencies 40154 */ 40155 40156 40157 40158 40159 const { 40160 useLocation: sidebar_navigation_screen_templates_browse_useLocation 40161 } = unlock(external_wp_router_namespaceObject.privateApis); 40162 function SidebarNavigationScreenTemplatesBrowse({ 40163 backPath 40164 }) { 40165 const { 40166 params: { 40167 activeView = 'all' 40168 } 40169 } = sidebar_navigation_screen_templates_browse_useLocation(); 40170 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 40171 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 40172 description: (0,external_wp_i18n_namespaceObject.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'), 40173 backPath: backPath, 40174 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, { 40175 activeView: activeView, 40176 title: (0,external_wp_i18n_namespaceObject.__)('All templates') 40177 }) 40178 }); 40179 } 40180 40181 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js 40182 /** 40183 * WordPress dependencies 40184 */ 40185 40186 40187 const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40188 viewBox: "0 0 24 24", 40189 xmlns: "http://www.w3.org/2000/svg", 40190 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40191 fillRule: "evenodd", 40192 clipRule: "evenodd", 40193 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" 40194 }) 40195 }); 40196 /* harmony default export */ const library_file = (file); 40197 40198 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js 40199 /** 40200 * Internal dependencies 40201 */ 40202 40203 40204 40205 40206 function CategoryItem({ 40207 count, 40208 icon, 40209 id, 40210 isActive, 40211 label, 40212 type 40213 }) { 40214 const linkInfo = useLink({ 40215 categoryId: id !== TEMPLATE_PART_ALL_AREAS_CATEGORY && id !== PATTERN_DEFAULT_CATEGORY ? id : undefined, 40216 postType: type === TEMPLATE_PART_POST_TYPE ? TEMPLATE_PART_POST_TYPE : PATTERN_TYPES.user 40217 }); 40218 if (!count) { 40219 return; 40220 } 40221 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40222 ...linkInfo, 40223 icon: icon, 40224 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 40225 children: count 40226 }), 40227 "aria-current": isActive ? 'true' : undefined, 40228 children: label 40229 }); 40230 } 40231 40232 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js 40233 /** 40234 * WordPress dependencies 40235 */ 40236 40237 40238 40239 40240 /** 40241 * Internal dependencies 40242 */ 40243 40244 const useTemplatePartsGroupedByArea = items => { 40245 const allItems = items || []; 40246 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []); 40247 40248 // Create map of template areas ensuring that default areas are displayed before 40249 // any custom registered template part areas. 40250 const knownAreas = { 40251 header: {}, 40252 footer: {}, 40253 sidebar: {}, 40254 uncategorized: {} 40255 }; 40256 templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { 40257 ...templatePartArea, 40258 templateParts: [] 40259 }); 40260 const groupedByArea = allItems.reduce((accumulator, item) => { 40261 const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; 40262 accumulator[key].templateParts.push(item); 40263 return accumulator; 40264 }, knownAreas); 40265 return groupedByArea; 40266 }; 40267 function useTemplatePartAreas() { 40268 const { 40269 records: templateParts, 40270 isResolving: isLoading 40271 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 40272 per_page: -1 40273 }); 40274 return { 40275 hasTemplateParts: templateParts ? !!templateParts.length : false, 40276 isLoading, 40277 templatePartAreas: useTemplatePartsGroupedByArea(templateParts) 40278 }; 40279 } 40280 40281 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js 40282 /** 40283 * WordPress dependencies 40284 */ 40285 40286 40287 40288 40289 40290 40291 40292 40293 /** 40294 * Internal dependencies 40295 */ 40296 40297 40298 40299 40300 40301 40302 40303 40304 40305 const { 40306 useLocation: sidebar_navigation_screen_patterns_useLocation 40307 } = unlock(external_wp_router_namespaceObject.privateApis); 40308 function CategoriesGroup({ 40309 templatePartAreas, 40310 patternCategories, 40311 currentCategory, 40312 currentType 40313 }) { 40314 const [allPatterns, ...otherPatterns] = patternCategories; 40315 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40316 className: "edit-site-sidebar-navigation-screen-patterns__group", 40317 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40318 count: Object.values(templatePartAreas).map(({ 40319 templateParts 40320 }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0), 40321 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)() /* no name, so it provides the fallback icon */, 40322 label: (0,external_wp_i18n_namespaceObject.__)('All template parts'), 40323 id: TEMPLATE_PART_ALL_AREAS_CATEGORY, 40324 type: TEMPLATE_PART_POST_TYPE, 40325 isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE 40326 }, "all"), Object.entries(templatePartAreas).map(([area, { 40327 label, 40328 templateParts 40329 }]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40330 count: templateParts?.length, 40331 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area), 40332 label: label, 40333 id: area, 40334 type: TEMPLATE_PART_POST_TYPE, 40335 isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE 40336 }, area)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40337 className: "edit-site-sidebar-navigation-screen-patterns__divider" 40338 }), allPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40339 count: allPatterns.count, 40340 label: allPatterns.label, 40341 icon: library_file, 40342 id: allPatterns.name, 40343 type: PATTERN_TYPES.user, 40344 isActive: currentCategory === `$allPatterns.name}` && currentType === PATTERN_TYPES.user 40345 }, allPatterns.name), otherPatterns.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 40346 count: category.count, 40347 label: category.label, 40348 icon: library_file, 40349 id: category.name, 40350 type: PATTERN_TYPES.user, 40351 isActive: currentCategory === `$category.name}` && currentType === PATTERN_TYPES.user 40352 }, category.name))] 40353 }); 40354 } 40355 function SidebarNavigationScreenPatterns({ 40356 backPath 40357 }) { 40358 const { 40359 params: { 40360 postType, 40361 categoryId 40362 } 40363 } = sidebar_navigation_screen_patterns_useLocation(); 40364 const currentType = postType || PATTERN_TYPES.user; 40365 const currentCategory = categoryId || (currentType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); 40366 const { 40367 templatePartAreas, 40368 hasTemplateParts, 40369 isLoading 40370 } = useTemplatePartAreas(); 40371 const { 40372 patternCategories, 40373 hasPatterns 40374 } = usePatternCategories(); 40375 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); 40376 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 40377 isRoot: !isBlockBasedTheme, 40378 title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), 40379 description: (0,external_wp_i18n_namespaceObject.__)('Manage what patterns are available when editing the site.'), 40380 backPath: backPath, 40381 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40382 children: [isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading items…'), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40383 children: [!hasTemplateParts && !hasPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40384 className: "edit-site-sidebar-navigation-screen-patterns__group", 40385 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 40386 children: (0,external_wp_i18n_namespaceObject.__)('No items found') 40387 }) 40388 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoriesGroup, { 40389 templatePartAreas: templatePartAreas, 40390 patternCategories: patternCategories, 40391 currentCategory: currentCategory, 40392 currentType: currentType 40393 })] 40394 })] 40395 }) 40396 }); 40397 } 40398 40399 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/add-new-view.js 40400 /** 40401 * WordPress dependencies 40402 */ 40403 40404 40405 40406 40407 40408 40409 40410 40411 /** 40412 * Internal dependencies 40413 */ 40414 40415 40416 40417 40418 40419 40420 const { 40421 useHistory: add_new_view_useHistory 40422 } = unlock(external_wp_router_namespaceObject.privateApis); 40423 function AddNewItemModalContent({ 40424 type, 40425 setIsAdding 40426 }) { 40427 const history = add_new_view_useHistory(); 40428 const { 40429 saveEntityRecord 40430 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40431 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 40432 const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); 40433 const defaultViews = useDefaultViews({ 40434 postType: type 40435 }); 40436 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40437 onSubmit: async event => { 40438 event.preventDefault(); 40439 setIsSaving(true); 40440 const { 40441 getEntityRecords 40442 } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store); 40443 let dataViewTaxonomyId; 40444 const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', { 40445 slug: type 40446 }); 40447 if (dataViewTypeRecords && dataViewTypeRecords.length > 0) { 40448 dataViewTaxonomyId = dataViewTypeRecords[0].id; 40449 } else { 40450 const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', { 40451 name: type 40452 }); 40453 if (record && record.id) { 40454 dataViewTaxonomyId = record.id; 40455 } 40456 } 40457 const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', { 40458 title, 40459 status: 'publish', 40460 wp_dataviews_type: dataViewTaxonomyId, 40461 content: JSON.stringify(defaultViews[0].view) 40462 }); 40463 const { 40464 params: { 40465 postType 40466 } 40467 } = history.getLocationWithParams(); 40468 history.push({ 40469 postType, 40470 activeView: savedRecord.id, 40471 isCustom: 'true' 40472 }); 40473 setIsSaving(false); 40474 setIsAdding(false); 40475 }, 40476 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40477 spacing: "5", 40478 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40479 __next40pxDefaultSize: true, 40480 __nextHasNoMarginBottom: true, 40481 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40482 value: title, 40483 onChange: setTitle, 40484 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40485 className: "patterns-create-modal__name-input" 40486 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40487 justify: "right", 40488 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40489 __next40pxDefaultSize: true, 40490 variant: "tertiary", 40491 onClick: () => { 40492 setIsAdding(false); 40493 }, 40494 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40495 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40496 __next40pxDefaultSize: true, 40497 variant: "primary", 40498 type: "submit", 40499 "aria-disabled": !title || isSaving, 40500 isBusy: isSaving, 40501 children: (0,external_wp_i18n_namespaceObject.__)('Create') 40502 })] 40503 })] 40504 }) 40505 }); 40506 } 40507 function AddNewItem({ 40508 type 40509 }) { 40510 const [isAdding, setIsAdding] = (0,external_wp_element_namespaceObject.useState)(false); 40511 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40512 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40513 icon: library_plus, 40514 onClick: () => { 40515 setIsAdding(true); 40516 }, 40517 className: "dataviews__siderbar-content-add-new-item", 40518 children: (0,external_wp_i18n_namespaceObject.__)('New view') 40519 }), isAdding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40520 title: (0,external_wp_i18n_namespaceObject.__)('Add new view'), 40521 onRequestClose: () => { 40522 setIsAdding(false); 40523 }, 40524 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItemModalContent, { 40525 type: type, 40526 setIsAdding: setIsAdding 40527 }) 40528 })] 40529 }); 40530 } 40531 40532 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/custom-dataviews-list.js 40533 /** 40534 * WordPress dependencies 40535 */ 40536 40537 40538 40539 40540 40541 40542 40543 40544 /** 40545 * Internal dependencies 40546 */ 40547 40548 40549 40550 40551 40552 40553 const { 40554 useHistory: custom_dataviews_list_useHistory 40555 } = unlock(external_wp_router_namespaceObject.privateApis); 40556 const custom_dataviews_list_EMPTY_ARRAY = []; 40557 function RenameItemModalContent({ 40558 dataviewId, 40559 currentTitle, 40560 setIsRenaming 40561 }) { 40562 const { 40563 editEntityRecord 40564 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40565 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(currentTitle); 40566 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40567 onSubmit: async event => { 40568 event.preventDefault(); 40569 await editEntityRecord('postType', 'wp_dataviews', dataviewId, { 40570 title 40571 }); 40572 setIsRenaming(false); 40573 }, 40574 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40575 spacing: "5", 40576 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40577 __next40pxDefaultSize: true, 40578 __nextHasNoMarginBottom: true, 40579 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40580 value: title, 40581 onChange: setTitle, 40582 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40583 className: "patterns-create-modal__name-input" 40584 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40585 justify: "right", 40586 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40587 variant: "tertiary", 40588 __next40pxDefaultSize: true, 40589 onClick: () => { 40590 setIsRenaming(false); 40591 }, 40592 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40593 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40594 variant: "primary", 40595 type: "submit", 40596 "aria-disabled": !title, 40597 __next40pxDefaultSize: true, 40598 children: (0,external_wp_i18n_namespaceObject.__)('Save') 40599 })] 40600 })] 40601 }) 40602 }); 40603 } 40604 function CustomDataViewItem({ 40605 dataviewId, 40606 isActive 40607 }) { 40608 const history = custom_dataviews_list_useHistory(); 40609 const { 40610 dataview 40611 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 40612 const { 40613 getEditedEntityRecord 40614 } = select(external_wp_coreData_namespaceObject.store); 40615 return { 40616 dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId) 40617 }; 40618 }, [dataviewId]); 40619 const { 40620 deleteEntityRecord 40621 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40622 const type = (0,external_wp_element_namespaceObject.useMemo)(() => { 40623 const viewContent = JSON.parse(dataview.content); 40624 return viewContent.type; 40625 }, [dataview.content]); 40626 const [isRenaming, setIsRenaming] = (0,external_wp_element_namespaceObject.useState)(false); 40627 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40628 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40629 title: dataview.title, 40630 type: type, 40631 isActive: isActive, 40632 isCustom: true, 40633 customViewId: dataviewId, 40634 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 40635 icon: more_vertical, 40636 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 40637 className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu", 40638 toggleProps: { 40639 style: { 40640 color: 'inherit' 40641 }, 40642 size: 'small' 40643 }, 40644 children: ({ 40645 onClose 40646 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 40647 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40648 onClick: () => { 40649 setIsRenaming(true); 40650 onClose(); 40651 }, 40652 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 40653 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40654 onClick: async () => { 40655 await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, { 40656 force: true 40657 }); 40658 if (isActive) { 40659 const { 40660 params: { 40661 postType 40662 } 40663 } = history.getLocationWithParams(); 40664 history.replace({ 40665 postType 40666 }); 40667 } 40668 onClose(); 40669 }, 40670 isDestructive: true, 40671 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 40672 })] 40673 }) 40674 }) 40675 }), isRenaming && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40676 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 40677 onRequestClose: () => { 40678 setIsRenaming(false); 40679 }, 40680 focusOnMount: "firstContentElement", 40681 size: "small", 40682 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameItemModalContent, { 40683 dataviewId: dataviewId, 40684 setIsRenaming: setIsRenaming, 40685 currentTitle: dataview.title 40686 }) 40687 })] 40688 }); 40689 } 40690 function useCustomDataViews(type) { 40691 const customDataViews = (0,external_wp_data_namespaceObject.useSelect)(select => { 40692 const { 40693 getEntityRecords 40694 } = select(external_wp_coreData_namespaceObject.store); 40695 const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', { 40696 slug: type 40697 }); 40698 if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) { 40699 return custom_dataviews_list_EMPTY_ARRAY; 40700 } 40701 const dataViews = getEntityRecords('postType', 'wp_dataviews', { 40702 wp_dataviews_type: dataViewTypeRecords[0].id, 40703 orderby: 'date', 40704 order: 'asc' 40705 }); 40706 if (!dataViews) { 40707 return custom_dataviews_list_EMPTY_ARRAY; 40708 } 40709 return dataViews; 40710 }); 40711 return customDataViews; 40712 } 40713 function CustomDataViewsList({ 40714 type, 40715 activeView, 40716 isCustom 40717 }) { 40718 const customDataViews = useCustomDataViews(type); 40719 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40720 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40721 className: "edit-site-sidebar-navigation-screen-dataviews__group-header", 40722 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 40723 level: 2, 40724 children: (0,external_wp_i18n_namespaceObject.__)('Custom Views') 40725 }) 40726 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40727 children: [customDataViews.map(customViewRecord => { 40728 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewItem, { 40729 dataviewId: customViewRecord.id, 40730 isActive: isCustom && Number(activeView) === customViewRecord.id 40731 }, customViewRecord.id); 40732 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItem, { 40733 type: type 40734 })] 40735 })] 40736 }); 40737 } 40738 40739 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js 40740 /** 40741 * WordPress dependencies 40742 */ 40743 40744 40745 40746 /** 40747 * Internal dependencies 40748 */ 40749 40750 40751 40752 40753 40754 40755 40756 const { 40757 useLocation: sidebar_dataviews_useLocation 40758 } = unlock(external_wp_router_namespaceObject.privateApis); 40759 function DataViewsSidebarContent() { 40760 const { 40761 params: { 40762 postType, 40763 activeView = 'all', 40764 isCustom = 'false' 40765 } 40766 } = sidebar_dataviews_useLocation(); 40767 const defaultViews = useDefaultViews({ 40768 postType 40769 }); 40770 if (!postType) { 40771 return null; 40772 } 40773 const isCustomBoolean = isCustom === 'true'; 40774 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40775 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40776 children: defaultViews.map(dataview => { 40777 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40778 slug: dataview.slug, 40779 title: dataview.title, 40780 icon: dataview.icon, 40781 type: dataview.view.type, 40782 isActive: !isCustomBoolean && dataview.slug === activeView, 40783 isCustom: false 40784 }, dataview.slug); 40785 }) 40786 }), window?.__experimentalCustomViews && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewsList, { 40787 activeView: activeView, 40788 type: postType, 40789 isCustom: true 40790 })] 40791 }); 40792 } 40793 40794 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js 40795 /** 40796 * WordPress dependencies 40797 */ 40798 40799 40800 40801 /** 40802 * Internal dependencies 40803 */ 40804 40805 40806 function FormRegular({ 40807 data, 40808 fields, 40809 form, 40810 onChange 40811 }) { 40812 const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => { 40813 var _form$fields; 40814 return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({ 40815 id 40816 }) => id === fieldId)).filter(field => !!field)); 40817 }, [fields, form.fields]); 40818 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 40819 spacing: 4, 40820 children: visibleFields.map(field => { 40821 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 40822 data: data, 40823 field: field, 40824 onChange: onChange 40825 }, field.id); 40826 }) 40827 }); 40828 } 40829 40830 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js 40831 /** 40832 * WordPress dependencies 40833 */ 40834 40835 40836 40837 40838 40839 /** 40840 * Internal dependencies 40841 */ 40842 40843 40844 40845 40846 function DropdownHeader({ 40847 title, 40848 onClose 40849 }) { 40850 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 40851 className: "dataforms-layouts-panel__dropdown-header", 40852 spacing: 4, 40853 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40854 alignment: "center", 40855 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 40856 level: 2, 40857 size: 13, 40858 children: title 40859 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40860 label: (0,external_wp_i18n_namespaceObject.__)('Close'), 40861 icon: close_small, 40862 onClick: onClose, 40863 size: "small" 40864 })] 40865 }) 40866 }); 40867 } 40868 function FormField({ 40869 data, 40870 field, 40871 onChange 40872 }) { 40873 // Use internal state instead of a ref to make sure that the component 40874 // re-renders when the popover's anchor updates. 40875 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 40876 // Memoize popoverProps to avoid returning a new object every time. 40877 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 40878 // Anchor the popover to the middle of the entire row so that it doesn't 40879 // move around when the label changes. 40880 anchor: popoverAnchor, 40881 placement: 'left-start', 40882 offset: 36, 40883 shift: true 40884 }), [popoverAnchor]); 40885 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40886 ref: setPopoverAnchor, 40887 className: "dataforms-layouts-panel__field", 40888 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40889 className: "dataforms-layouts-panel__field-label", 40890 children: field.label 40891 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40892 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 40893 contentClassName: "dataforms-layouts-panel__field-dropdown", 40894 popoverProps: popoverProps, 40895 focusOnMount: true, 40896 toggleProps: { 40897 size: 'compact', 40898 variant: 'tertiary', 40899 tooltipPosition: 'middle left' 40900 }, 40901 renderToggle: ({ 40902 isOpen, 40903 onToggle 40904 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40905 className: "dataforms-layouts-panel__field-control", 40906 size: "compact", 40907 variant: "tertiary", 40908 "aria-expanded": isOpen, 40909 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 40910 // translators: %s: Field name. 40911 (0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), field.label), 40912 onClick: onToggle, 40913 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 40914 item: data 40915 }) 40916 }), 40917 renderContent: ({ 40918 onClose 40919 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40920 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { 40921 title: field.label, 40922 onClose: onClose 40923 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 40924 data: data, 40925 field: field, 40926 onChange: onChange, 40927 hideLabelFromVision: true 40928 }, field.id)] 40929 }) 40930 }) 40931 })] 40932 }); 40933 } 40934 function FormPanel({ 40935 data, 40936 fields, 40937 form, 40938 onChange 40939 }) { 40940 const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => { 40941 var _form$fields; 40942 return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({ 40943 id 40944 }) => id === fieldId)).filter(field => !!field)); 40945 }, [fields, form.fields]); 40946 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 40947 spacing: 2, 40948 children: visibleFields.map(field => { 40949 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormField, { 40950 data: data, 40951 field: field, 40952 onChange: onChange 40953 }, field.id); 40954 }) 40955 }); 40956 } 40957 40958 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js 40959 /** 40960 * Internal dependencies 40961 */ 40962 40963 40964 const FORM_LAYOUTS = [{ 40965 type: 'regular', 40966 component: FormRegular 40967 }, { 40968 type: 'panel', 40969 component: FormPanel 40970 }]; 40971 function getFormLayout(type) { 40972 return FORM_LAYOUTS.find(layout => layout.type === type); 40973 } 40974 40975 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js 40976 /** 40977 * Internal dependencies 40978 */ 40979 40980 40981 40982 function DataForm({ 40983 form, 40984 ...props 40985 }) { 40986 var _form$type; 40987 const layout = getFormLayout((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : 'regular'); 40988 if (!layout) { 40989 return null; 40990 } 40991 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout.component, { 40992 form: form, 40993 ...props 40994 }); 40995 } 40996 40997 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js 40998 /** 40999 * External dependencies 41000 */ 41001 41002 41003 /** 41004 * WordPress dependencies 41005 */ 41006 41007 41008 41009 41010 41011 41012 41013 41014 /** 41015 * Internal dependencies 41016 */ 41017 41018 41019 41020 41021 41022 const { 41023 PostCardPanel 41024 } = unlock(external_wp_editor_namespaceObject.privateApis); 41025 function PostEditForm({ 41026 postType, 41027 postId 41028 }) { 41029 const ids = (0,external_wp_element_namespaceObject.useMemo)(() => postId.split(','), [postId]); 41030 const { 41031 record 41032 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 41033 return { 41034 record: ids.length === 1 ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, ids[0]) : null 41035 }; 41036 }, [postType, ids]); 41037 const [multiEdits, setMultiEdits] = (0,external_wp_element_namespaceObject.useState)({}); 41038 const { 41039 editEntityRecord 41040 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 41041 const { 41042 fields: _fields 41043 } = post_fields(); 41044 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => _fields?.map(field => { 41045 if (field.id === 'status') { 41046 return { 41047 ...field, 41048 elements: field.elements.filter(element => element.value !== 'trash') 41049 }; 41050 } 41051 return field; 41052 }), [_fields]); 41053 const form = { 41054 type: 'panel', 41055 fields: ['title', 'status', 'date', 'author', 'comment_status'] 41056 }; 41057 const onChange = edits => { 41058 for (const id of ids) { 41059 if (edits.status !== 'future' && record.status === 'future' && new Date(record.date) > new Date()) { 41060 edits.date = null; 41061 } 41062 if (edits.status === 'private' && record.password) { 41063 edits.password = ''; 41064 } 41065 editEntityRecord('postType', postType, id, edits); 41066 if (ids.length > 1) { 41067 setMultiEdits(prev => ({ 41068 ...prev, 41069 ...edits 41070 })); 41071 } 41072 } 41073 }; 41074 (0,external_wp_element_namespaceObject.useEffect)(() => { 41075 setMultiEdits({}); 41076 }, [ids]); 41077 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 41078 spacing: 4, 41079 children: [ids.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { 41080 postType: postType, 41081 postId: ids[0] 41082 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { 41083 data: ids.length === 1 ? record : multiEdits, 41084 fields: fields, 41085 form: form, 41086 onChange: onChange 41087 })] 41088 }); 41089 } 41090 function PostEdit({ 41091 postType, 41092 postId 41093 }) { 41094 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 41095 className: dist_clsx('edit-site-post-edit', { 41096 'is-empty': !postId 41097 }), 41098 label: (0,external_wp_i18n_namespaceObject.__)('Post Edit'), 41099 children: [postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { 41100 postType: postType, 41101 postId: postId 41102 }), !postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 41103 children: (0,external_wp_i18n_namespaceObject.__)('Select a page to edit') 41104 })] 41105 }); 41106 } 41107 41108 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/router.js 41109 /** 41110 * WordPress dependencies 41111 */ 41112 41113 41114 41115 /** 41116 * Internal dependencies 41117 */ 41118 41119 41120 41121 41122 41123 41124 41125 41126 41127 41128 41129 41130 41131 41132 41133 41134 const { 41135 useLocation: router_useLocation, 41136 useHistory: router_useHistory 41137 } = unlock(external_wp_router_namespaceObject.privateApis); 41138 function useRedirectOldPaths() { 41139 const history = router_useHistory(); 41140 const { 41141 params 41142 } = router_useLocation(); 41143 (0,external_wp_element_namespaceObject.useEffect)(() => { 41144 const { 41145 postType, 41146 path, 41147 categoryType, 41148 ...rest 41149 } = params; 41150 if (path === '/wp_template_part/all') { 41151 history.replace({ 41152 postType: TEMPLATE_PART_POST_TYPE 41153 }); 41154 } 41155 if (path === '/page') { 41156 history.replace({ 41157 postType: 'page', 41158 ...rest 41159 }); 41160 } 41161 if (path === '/wp_template') { 41162 history.replace({ 41163 postType: TEMPLATE_POST_TYPE, 41164 ...rest 41165 }); 41166 } 41167 if (path === '/patterns') { 41168 history.replace({ 41169 postType: categoryType === TEMPLATE_PART_POST_TYPE ? TEMPLATE_PART_POST_TYPE : PATTERN_TYPES.user, 41170 ...rest 41171 }); 41172 } 41173 if (path === '/navigation') { 41174 history.replace({ 41175 postType: NAVIGATION_POST_TYPE, 41176 ...rest 41177 }); 41178 } 41179 }, [history, params]); 41180 } 41181 function useLayoutAreas() { 41182 const { 41183 params 41184 } = router_useLocation(); 41185 const { 41186 postType, 41187 postId, 41188 path, 41189 layout, 41190 isCustom, 41191 canvas, 41192 quickEdit 41193 } = params; 41194 const hasEditCanvasMode = canvas === 'edit'; 41195 useRedirectOldPaths(); 41196 41197 // Page list 41198 if (postType === 'page') { 41199 const isListLayout = layout === 'list' || !layout; 41200 const showQuickEdit = quickEdit && !isListLayout; 41201 return { 41202 key: 'pages', 41203 areas: { 41204 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 41205 title: (0,external_wp_i18n_namespaceObject.__)('Pages'), 41206 backPath: {}, 41207 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, {}) 41208 }), 41209 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41210 postType: postType 41211 }), 41212 preview: !showQuickEdit && (isListLayout || hasEditCanvasMode) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41213 mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41214 postType: postType 41215 }), 41216 edit: showQuickEdit && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { 41217 postType: postType, 41218 postId: postId 41219 }) 41220 }, 41221 widths: { 41222 content: isListLayout ? 380 : undefined, 41223 edit: showQuickEdit ? 380 : undefined 41224 } 41225 }; 41226 } 41227 41228 // Templates 41229 if (postType === TEMPLATE_POST_TYPE) { 41230 const isListLayout = isCustom !== 'true' && layout === 'list'; 41231 return { 41232 key: 'templates', 41233 areas: { 41234 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { 41235 backPath: {} 41236 }), 41237 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}), 41238 preview: (isListLayout || hasEditCanvasMode) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41239 mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) 41240 }, 41241 widths: { 41242 content: isListLayout ? 380 : undefined 41243 } 41244 }; 41245 } 41246 41247 // Patterns 41248 if ([TEMPLATE_PART_POST_TYPE, PATTERN_TYPES.user].includes(postType)) { 41249 return { 41250 key: 'patterns', 41251 areas: { 41252 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 41253 backPath: {} 41254 }), 41255 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), 41256 mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), 41257 preview: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41258 } 41259 }; 41260 } 41261 41262 // Styles 41263 if (path === '/wp_global_styles') { 41264 return { 41265 key: 'styles', 41266 areas: { 41267 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { 41268 backPath: {} 41269 }), 41270 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41271 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41272 } 41273 }; 41274 } 41275 41276 // Navigation 41277 if (postType === NAVIGATION_POST_TYPE) { 41278 if (postId) { 41279 return { 41280 key: 'navigation', 41281 areas: { 41282 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { 41283 backPath: { 41284 postType: NAVIGATION_POST_TYPE 41285 } 41286 }), 41287 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41288 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41289 } 41290 }; 41291 } 41292 return { 41293 key: 'navigation', 41294 areas: { 41295 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { 41296 backPath: {} 41297 }), 41298 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41299 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41300 } 41301 }; 41302 } 41303 41304 // Fallback shows the home page preview 41305 return { 41306 key: 'default', 41307 areas: { 41308 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), 41309 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 41310 mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 41311 } 41312 }; 41313 } 41314 41315 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js 41316 /** 41317 * WordPress dependencies 41318 */ 41319 41320 41321 41322 41323 /** 41324 * Internal dependencies 41325 */ 41326 41327 41328 41329 const { 41330 useCommandContext 41331 } = unlock(external_wp_commands_namespaceObject.privateApis); 41332 41333 /** 41334 * React hook used to set the correct command context based on the current state. 41335 */ 41336 function useSetCommandContext() { 41337 const { 41338 hasBlockSelected, 41339 canvasMode 41340 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 41341 const { 41342 getCanvasMode 41343 } = unlock(select(store)); 41344 const { 41345 getBlockSelectionStart 41346 } = select(external_wp_blockEditor_namespaceObject.store); 41347 return { 41348 canvasMode: getCanvasMode(), 41349 hasBlockSelected: getBlockSelectionStart() 41350 }; 41351 }, []); 41352 const hasEditorCanvasContainer = useHasEditorCanvasContainer(); 41353 41354 // Sets the right context for the command palette 41355 let commandContext = 'site-editor'; 41356 if (canvasMode === 'edit') { 41357 commandContext = 'entity-edit'; 41358 } 41359 if (hasBlockSelected) { 41360 commandContext = 'block-selection-edit'; 41361 } 41362 if (hasEditorCanvasContainer) { 41363 /* 41364 * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context 41365 * to remove the suggested commands that may not make sense with Style Book or Style Revisions open. 41366 * See https://github.com/WordPress/gutenberg/issues/62216. 41367 */ 41368 commandContext = ''; 41369 } 41370 useCommandContext(commandContext); 41371 } 41372 41373 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/app/index.js 41374 /** 41375 * WordPress dependencies 41376 */ 41377 41378 41379 41380 41381 41382 41383 41384 41385 /** 41386 * Internal dependencies 41387 */ 41388 41389 41390 41391 41392 41393 41394 41395 41396 41397 const { 41398 RouterProvider 41399 } = unlock(external_wp_router_namespaceObject.privateApis); 41400 const { 41401 GlobalStylesProvider 41402 } = unlock(external_wp_editor_namespaceObject.privateApis); 41403 function AppLayout() { 41404 // This ensures the edited entity id and type are initialized properly. 41405 useInitEditedEntityFromURL(); 41406 useEditModeCommands(); 41407 useCommonCommands(); 41408 useSetCommandContext(); 41409 const route = useLayoutAreas(); 41410 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { 41411 route: route 41412 }); 41413 } 41414 function App() { 41415 const { 41416 createErrorNotice 41417 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 41418 function onPluginAreaError(name) { 41419 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ 41420 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); 41421 } 41422 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { 41423 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { 41424 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(RouterProvider, { 41425 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { 41426 onError: onPluginAreaError 41427 })] 41428 })] 41429 }) 41430 }); 41431 } 41432 41433 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/deprecated.js 41434 /** 41435 * WordPress dependencies 41436 */ 41437 41438 41439 41440 41441 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 41442 const deprecateSlot = name => { 41443 external_wp_deprecated_default()(`wp.editPost.$name}`, { 41444 since: '6.6', 41445 alternative: `wp.editor.$name}` 41446 }); 41447 }; 41448 41449 /* eslint-disable jsdoc/require-param */ 41450 /** 41451 * @see PluginMoreMenuItem in @wordpress/editor package. 41452 */ 41453 function PluginMoreMenuItem(props) { 41454 if (!isSiteEditor) { 41455 return null; 41456 } 41457 deprecateSlot('PluginMoreMenuItem'); 41458 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { 41459 ...props 41460 }); 41461 } 41462 41463 /** 41464 * @see PluginSidebar in @wordpress/editor package. 41465 */ 41466 function PluginSidebar(props) { 41467 if (!isSiteEditor) { 41468 return null; 41469 } 41470 deprecateSlot('PluginSidebar'); 41471 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { 41472 ...props 41473 }); 41474 } 41475 41476 /** 41477 * @see PluginSidebarMoreMenuItem in @wordpress/editor package. 41478 */ 41479 function PluginSidebarMoreMenuItem(props) { 41480 if (!isSiteEditor) { 41481 return null; 41482 } 41483 deprecateSlot('PluginSidebarMoreMenuItem'); 41484 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { 41485 ...props 41486 }); 41487 } 41488 /* eslint-enable jsdoc/require-param */ 41489 41490 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/posts-app/router.js 41491 /** 41492 * WordPress dependencies 41493 */ 41494 41495 41496 41497 41498 /** 41499 * Internal dependencies 41500 */ 41501 41502 41503 41504 41505 41506 41507 41508 const { 41509 useLocation: posts_app_router_useLocation 41510 } = unlock(external_wp_router_namespaceObject.privateApis); 41511 function router_useLayoutAreas() { 41512 const { 41513 params = {} 41514 } = posts_app_router_useLocation(); 41515 const { 41516 postType, 41517 layout, 41518 canvas 41519 } = params; 41520 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => { 41521 return select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels; 41522 }, [postType]); 41523 41524 // Posts list. 41525 if (['post'].includes(postType)) { 41526 const isListLayout = layout === 'list' || !layout; 41527 return { 41528 key: 'posts-list', 41529 areas: { 41530 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 41531 title: labels?.name, 41532 isRoot: true, 41533 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, {}) 41534 }), 41535 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41536 postType: postType 41537 }), 41538 preview: (isListLayout || canvas === 'edit') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41539 isPostsList: true 41540 }), 41541 mobile: canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41542 isPostsList: true 41543 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 41544 postType: postType 41545 }) 41546 }, 41547 widths: { 41548 content: isListLayout ? 380 : undefined 41549 } 41550 }; 41551 } 41552 41553 // Fallback shows the home page preview 41554 return { 41555 key: 'default', 41556 areas: { 41557 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), 41558 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41559 isPostsList: true 41560 }), 41561 mobile: canvas === 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 41562 isPostsList: true 41563 }) 41564 } 41565 }; 41566 } 41567 41568 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js 41569 /** 41570 * WordPress dependencies 41571 */ 41572 41573 41574 41575 /** 41576 * Internal dependencies 41577 */ 41578 41579 41580 41581 41582 41583 41584 const { 41585 RouterProvider: posts_app_RouterProvider 41586 } = unlock(external_wp_router_namespaceObject.privateApis); 41587 const { 41588 GlobalStylesProvider: posts_app_GlobalStylesProvider 41589 } = unlock(external_wp_editor_namespaceObject.privateApis); 41590 function PostsLayout() { 41591 // This ensures the edited entity id and type are initialized properly. 41592 useInitEditedEntityFromURL(); 41593 const route = router_useLayoutAreas(); 41594 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { 41595 route: route 41596 }); 41597 } 41598 function PostsApp() { 41599 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(posts_app_GlobalStylesProvider, { 41600 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { 41601 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsLayout, {}) 41602 })] 41603 }); 41604 } 41605 41606 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/posts.js 41607 /** 41608 * WordPress dependencies 41609 */ 41610 41611 41612 41613 41614 41615 41616 41617 /** 41618 * Internal dependencies 41619 */ 41620 41621 41622 41623 /** 41624 * Internal dependencies 41625 */ 41626 41627 41628 /** 41629 * Initializes the "Posts Dashboard" 41630 * @param {string} id ID of the root element to render the screen in. 41631 * @param {Object} settings Editor settings. 41632 */ 41633 41634 function initializePostsDashboard(id, settings) { 41635 if (true) { 41636 return; 41637 } 41638 const target = document.getElementById(id); 41639 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 41640 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 41641 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 41642 name 41643 }) => name !== 'core/freeform'); 41644 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 41645 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 41646 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 41647 inserter: false 41648 }); 41649 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 41650 inserter: false 41651 }); 41652 if (false) {} 41653 41654 // We dispatch actions and update the store synchronously before rendering 41655 // so that we won't trigger unnecessary re-renders with useEffect. 41656 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 41657 welcomeGuide: true, 41658 welcomeGuideStyles: true, 41659 welcomeGuidePage: true, 41660 welcomeGuideTemplate: true 41661 }); 41662 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 41663 allowRightClickOverrides: true, 41664 distractionFree: false, 41665 editorMode: 'visual', 41666 fixedToolbar: false, 41667 focusMode: false, 41668 inactivePanels: [], 41669 keepCaretInsideBlock: false, 41670 openPanels: ['post-status'], 41671 showBlockBreadcrumbs: true, 41672 showListViewByDefault: false, 41673 enableChoosePatternModal: true 41674 }); 41675 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 41676 41677 // Prevent the default browser action for files dropped outside of dropzones. 41678 window.addEventListener('dragover', e => e.preventDefault(), false); 41679 window.addEventListener('drop', e => e.preventDefault(), false); 41680 root.render( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 41681 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) 41682 })); 41683 return root; 41684 } 41685 41686 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/index.js 41687 /** 41688 * WordPress dependencies 41689 */ 41690 41691 41692 41693 41694 41695 41696 41697 41698 41699 /** 41700 * Internal dependencies 41701 */ 41702 41703 41704 41705 41706 41707 const { 41708 registerCoreBlockBindingsSources 41709 } = unlock(external_wp_editor_namespaceObject.privateApis); 41710 41711 /** 41712 * Initializes the site editor screen. 41713 * 41714 * @param {string} id ID of the root element to render the screen in. 41715 * @param {Object} settings Editor settings. 41716 */ 41717 function initializeEditor(id, settings) { 41718 const target = document.getElementById(id); 41719 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 41720 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 41721 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 41722 name 41723 }) => name !== 'core/freeform'); 41724 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 41725 registerCoreBlockBindingsSources(); 41726 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 41727 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 41728 inserter: false 41729 }); 41730 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 41731 inserter: false 41732 }); 41733 if (false) {} 41734 41735 // We dispatch actions and update the store synchronously before rendering 41736 // so that we won't trigger unnecessary re-renders with useEffect. 41737 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 41738 welcomeGuide: true, 41739 welcomeGuideStyles: true, 41740 welcomeGuidePage: true, 41741 welcomeGuideTemplate: true 41742 }); 41743 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 41744 allowRightClickOverrides: true, 41745 distractionFree: false, 41746 editorMode: 'visual', 41747 fixedToolbar: false, 41748 focusMode: false, 41749 inactivePanels: [], 41750 keepCaretInsideBlock: false, 41751 openPanels: ['post-status'], 41752 showBlockBreadcrumbs: true, 41753 showListViewByDefault: false, 41754 enableChoosePatternModal: true 41755 }); 41756 if (window.__experimentalMediaProcessing) { 41757 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/media', { 41758 requireApproval: true, 41759 optimizeOnUpload: true 41760 }); 41761 } 41762 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 41763 41764 // Keep the defaultTemplateTypes in the core/editor settings too, 41765 // so that they can be selected with core/editor selectors in any editor. 41766 // This is needed because edit-site doesn't initialize with EditorProvider, 41767 // which internally uses updateEditorSettings as well. 41768 (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).updateEditorSettings({ 41769 defaultTemplateTypes: settings.defaultTemplateTypes, 41770 defaultTemplatePartAreas: settings.defaultTemplatePartAreas 41771 }); 41772 41773 // Prevent the default browser action for files dropped outside of dropzones. 41774 window.addEventListener('dragover', e => e.preventDefault(), false); 41775 window.addEventListener('drop', e => e.preventDefault(), false); 41776 root.render( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 41777 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) 41778 })); 41779 return root; 41780 } 41781 function reinitializeEditor() { 41782 external_wp_deprecated_default()('wp.editSite.reinitializeEditor', { 41783 since: '6.2', 41784 version: '6.3' 41785 }); 41786 } 41787 41788 41789 41790 41791 // Temporary: While the posts dashboard is being iterated on 41792 // it's being built in the same package as the site editor. 41793 41794 41795 })(); 41796 41797 (window.wp = window.wp || {}).editSite = __webpack_exports__; 41798 /******/ })() 41799 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |